@reddb-io/red-skills 3.1.2 → 3.2.0
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/brain.bundle.min.mjs +44 -44
- package/dist/castle-mcp.bundle.min.mjs +334 -334
- package/dist/code-nav.bundle.min.mjs +34 -34
- package/dist/dev.bundle.min.mjs +581 -581
- package/dist/memory.bundle.min.mjs +236 -236
- package/dist/redskilled.bundle.min.mjs +41 -41
- package/dist/rsp.bundle.min.mjs +99 -99
- package/package.json +1 -1
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
-
var yP=Object.create;var Xs=Object.defineProperty;var _P=Object.getOwnPropertyDescriptor;var vP=Object.getOwnPropertyNames;var bP=Object.getPrototypeOf,wP=Object.prototype.hasOwnProperty;var mo=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var xP=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var k=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ys=(e,t)=>{for(var r in t)Xs(e,r,{get:t[r],enumerable:!0})},by=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vP(t))!wP.call(e,o)&&o!==r&&Xs(e,o,{get:()=>t[o],enumerable:!(n=_P(t,o))||n.enumerable});return e};var Qs=(e,t,r)=>(r=e!=null?yP(bP(e)):{},by(t||!e||!e.__esModule?Xs(r,"default",{value:e,enumerable:!0}):r,e)),Iu=e=>by(Xs({},"__esModule",{value:!0}),e);var ts=k(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.regexpCode=le.getEsmExportName=le.getProperty=le.safeStringify=le.stringify=le.strConcat=le.addCodeArg=le.str=le._=le.nil=le._Code=le.Name=le.IDENTIFIER=le._CodeOrName=void 0;var Qi=class{};le._CodeOrName=Qi;le.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Hn=class extends Qi{constructor(t){if(super(),!le.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};le.Name=Hn;var Lt=class extends Qi{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Hn&&(r[n.str]=(r[n.str]||0)+1),r),{})}};le._Code=Lt;le.nil=new Lt("");function gb(e,...t){let r=[e[0]],n=0;for(;n<t.length;)yf(r,t[n]),r.push(e[++n]);return new Lt(r)}le._=gb;var gf=new Lt("+");function yb(e,...t){let r=[es(e[0])],n=0;for(;n<t.length;)r.push(gf),yf(r,t[n]),r.push(gf,es(e[++n]));return vO(r),new Lt(r)}le.str=yb;function yf(e,t){t instanceof Lt?e.push(...t._items):t instanceof Hn?e.push(t):e.push(xO(t))}le.addCodeArg=yf;function vO(e){let t=1;for(;t<e.length-1;){if(e[t]===gf){let r=bO(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bO(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Hn||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Hn))return`"${e}${t.slice(1)}`}function wO(e,t){return t.emptyStr()?e:e.emptyStr()?t:yb`${e}${t}`}le.strConcat=wO;function xO(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:es(Array.isArray(e)?e.join(","):e)}function $O(e){return new Lt(es(e))}le.stringify=$O;function es(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}le.safeStringify=es;function SO(e){return typeof e=="string"&&le.IDENTIFIER.test(e)?new Lt(`.${e}`):gb`[${e}]`}le.getProperty=SO;function kO(e){if(typeof e=="string"&&le.IDENTIFIER.test(e))return new Lt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}le.getEsmExportName=kO;function PO(e){return new Lt(e.toString())}le.regexpCode=PO});var bf=k(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.ValueScope=St.ValueScopeName=St.Scope=St.varKinds=St.UsedValueState=void 0;var $t=ts(),_f=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ec;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ec||(St.UsedValueState=ec={}));St.varKinds={const:new $t.Name("const"),let:new $t.Name("let"),var:new $t.Name("var")};var tc=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof $t.Name?t:this.name(t)}name(t){return new $t.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};St.Scope=tc;var rc=class extends $t.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,$t._)`.${new $t.Name(r)}[${n}]`}};St.ValueScopeName=rc;var TO=(0,$t._)`\n`,vf=class extends tc{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?TO:$t.nil}}get(){return this._scope}name(t){return new rc(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,$t._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=$t.nil;for(let s in t){let a=t[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ec.Started);let l=r(u);if(l){let d=this.opts.es5?St.varKinds.var:St.varKinds.const;i=(0,$t._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,$t._)`${i}${l}${this.opts._n}`;else throw new _f(u);c.set(u,ec.Completed)})}return i}};St.ValueScope=vf});var Q=k(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.or=ee.and=ee.not=ee.CodeGen=ee.operators=ee.varKinds=ee.ValueScopeName=ee.ValueScope=ee.Scope=ee.Name=ee.regexpCode=ee.stringify=ee.getProperty=ee.nil=ee.strConcat=ee.str=ee._=void 0;var se=ts(),Xt=bf(),Xr=ts();Object.defineProperty(ee,"_",{enumerable:!0,get:function(){return Xr._}});Object.defineProperty(ee,"str",{enumerable:!0,get:function(){return Xr.str}});Object.defineProperty(ee,"strConcat",{enumerable:!0,get:function(){return Xr.strConcat}});Object.defineProperty(ee,"nil",{enumerable:!0,get:function(){return Xr.nil}});Object.defineProperty(ee,"getProperty",{enumerable:!0,get:function(){return Xr.getProperty}});Object.defineProperty(ee,"stringify",{enumerable:!0,get:function(){return Xr.stringify}});Object.defineProperty(ee,"regexpCode",{enumerable:!0,get:function(){return Xr.regexpCode}});Object.defineProperty(ee,"Name",{enumerable:!0,get:function(){return Xr.Name}});var sc=bf();Object.defineProperty(ee,"Scope",{enumerable:!0,get:function(){return sc.Scope}});Object.defineProperty(ee,"ValueScope",{enumerable:!0,get:function(){return sc.ValueScope}});Object.defineProperty(ee,"ValueScopeName",{enumerable:!0,get:function(){return sc.ValueScopeName}});Object.defineProperty(ee,"varKinds",{enumerable:!0,get:function(){return sc.varKinds}});ee.operators={GT:new se._Code(">"),GTE:new se._Code(">="),LT:new se._Code("<"),LTE:new se._Code("<="),EQ:new se._Code("==="),NEQ:new se._Code("!=="),NOT:new se._Code("!"),OR:new se._Code("||"),AND:new se._Code("&&"),ADD:new se._Code("+")};var Pr=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},wf=class extends Pr{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Xt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=jo(this.rhs,t,r)),this}get names(){return this.rhs instanceof se._CodeOrName?this.rhs.names:{}}},nc=class extends Pr{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof se.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=jo(this.rhs,t,r),this}get names(){let t=this.lhs instanceof se.Name?{}:{...this.lhs.names};return ic(t,this.rhs)}},xf=class extends nc{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},$f=class extends Pr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Sf=class extends Pr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},kf=class extends Pr{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Pf=class extends Pr{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=jo(this.code,t,r),this}get names(){return this.code instanceof se._CodeOrName?this.code.names:{}}},rs=class extends Pr{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||(RO(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Jn(t,r.names),{})}},Tr=class extends rs{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Tf=class extends rs{},Co=class extends Tr{};Co.kind="else";var Bn=class e extends Tr{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Co(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(_b(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=jo(this.condition,t,r),this}get names(){let t=super.names;return ic(t,this.condition),this.else&&Jn(t,this.else.names),t}};Bn.kind="if";var Wn=class extends Tr{};Wn.kind="for";var Rf=class extends Wn{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=jo(this.iteration,t,r),this}get names(){return Jn(super.names,this.iteration.names)}},zf=class extends Wn{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Xt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=ic(super.names,this.from);return ic(t,this.to)}},oc=class extends Wn{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=jo(this.iterable,t,r),this}get names(){return Jn(super.names,this.iterable.names)}},ns=class extends Tr{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};ns.kind="func";var os=class extends rs{render(t){return"return "+super.render(t)}};os.kind="return";var Ef=class extends Tr{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Jn(t,this.catch.names),this.finally&&Jn(t,this.finally.names),t}},is=class extends Tr{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};is.kind="catch";var ss=class extends Tr{render(t){return"finally"+super.render(t)}};ss.kind="finally";var Of=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
-
`:""},this._extScope=t,this._scope=new Xt.Scope({parent:t}),this._nodes=[new Tf]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new wf(t,i,n)),i}const(t,r,n){return this._def(Xt.varKinds.const,t,r,n)}let(t,r,n){return this._def(Xt.varKinds.let,t,r,n)}var(t,r,n){return this._def(Xt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new nc(t,r,n))}add(t,r){return this._leafNode(new xf(t,ee.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==se.nil&&this._leafNode(new Pf(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,se.addCodeArg)(r,o));return r.push("}"),new se._Code(r)}if(t,r,n){if(this._blockNode(new Bn(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Bn(t))}else(){return this._elseNode(new Co)}endIf(){return this._endBlockNode(Bn,Co)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Rf(t),r)}forRange(t,r,n,o,i=this.opts.es5?Xt.varKinds.var:Xt.varKinds.let){let s=this._scope.toName(t);return this._for(new zf(i,s,r,n),()=>o(s))}forOf(t,r,n,o=Xt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let s=r instanceof se.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,se._)`${s}.length`,a=>{this.var(i,(0,se._)`${s}[${a}]`),n(i)})}return this._for(new oc("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?Xt.varKinds.var:Xt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,se._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new oc("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Wn)}label(t){return this._leafNode(new $f(t))}break(t){return this._leafNode(new Sf(t))}return(t){let r=new os;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(os)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Ef;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new is(i),r(i)}return n&&(this._currNode=o.finally=new ss,this.code(n)),this._endBlockNode(is,ss)}throw(t){return this._leafNode(new kf(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=se.nil,n,o){return this._blockNode(new ns(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ns)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Bn))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};ee.CodeGen=Of;function Jn(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ic(e,t){return t instanceof se._CodeOrName?Jn(e,t.names):e}function jo(e,t,r){if(e instanceof se.Name)return n(e);if(!o(e))return e;return new se._Code(e._items.reduce((i,s)=>(s instanceof se.Name&&(s=n(s)),s instanceof se._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||t[i.str]!==1?i:(delete t[i.str],s)}function o(i){return i instanceof se._Code&&i._items.some(s=>s instanceof se.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function RO(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function _b(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,se._)`!${Cf(e)}`}ee.not=_b;var zO=vb(ee.operators.AND);function EO(...e){return e.reduce(zO)}ee.and=EO;var OO=vb(ee.operators.OR);function CO(...e){return e.reduce(OO)}ee.or=CO;function vb(e){return(t,r)=>t===se.nil?r:r===se.nil?t:(0,se._)`${Cf(t)} ${e} ${Cf(r)}`}function Cf(e){return e instanceof se.Name?e:(0,se._)`(${e})`}});var ce=k(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.checkStrictMode=te.getErrorPath=te.Type=te.useFunc=te.setEvaluated=te.evaluatedPropsToName=te.mergeEvaluated=te.eachItem=te.unescapeJsonPointer=te.escapeJsonPointer=te.escapeFragment=te.unescapeFragment=te.schemaRefOrVal=te.schemaHasRulesButRef=te.schemaHasRules=te.checkUnknownRules=te.alwaysValidSchema=te.toHash=void 0;var ve=Q(),jO=ts();function IO(e){let t={};for(let r of e)t[r]=!0;return t}te.toHash=IO;function NO(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(xb(e,t),!$b(t,e.self.RULES.all))}te.alwaysValidSchema=NO;function xb(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||Pb(e,`unknown keyword: "${i}"`)}te.checkUnknownRules=xb;function $b(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}te.schemaHasRules=$b;function MO(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}te.schemaHasRulesButRef=MO;function DO({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ve._)`${r}`}return(0,ve._)`${e}${t}${(0,ve.getProperty)(n)}`}te.schemaRefOrVal=DO;function AO(e){return Sb(decodeURIComponent(e))}te.unescapeFragment=AO;function qO(e){return encodeURIComponent(If(e))}te.escapeFragment=qO;function If(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}te.escapeJsonPointer=If;function Sb(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}te.unescapeJsonPointer=Sb;function ZO(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}te.eachItem=ZO;function bb({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof ve.Name?(i instanceof ve.Name?e(o,i,s):t(o,i,s),s):i instanceof ve.Name?(t(o,s,i),i):r(i,s);return a===ve.Name&&!(c instanceof ve.Name)?n(o,c):c}}te.mergeEvaluated={props:bb({mergeNames:(e,t,r)=>e.if((0,ve._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,ve._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,ve._)`${r} || {}`).code((0,ve._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,ve._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,ve._)`${r} || {}`),Nf(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:kb}),items:bb({mergeNames:(e,t,r)=>e.if((0,ve._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,ve._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,ve._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,ve._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function kb(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,ve._)`{}`);return t!==void 0&&Nf(e,r,t),r}te.evaluatedPropsToName=kb;function Nf(e,t,r){Object.keys(r).forEach(n=>e.assign((0,ve._)`${t}${(0,ve.getProperty)(n)}`,!0))}te.setEvaluated=Nf;var wb={};function LO(e,t){return e.scopeValue("func",{ref:t,code:wb[t.code]||(wb[t.code]=new jO._Code(t.code))})}te.useFunc=LO;var jf;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(jf||(te.Type=jf={}));function FO(e,t,r){if(e instanceof ve.Name){let n=t===jf.Num;return r?n?(0,ve._)`"[" + ${e} + "]"`:(0,ve._)`"['" + ${e} + "']"`:n?(0,ve._)`"/" + ${e}`:(0,ve._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ve.getProperty)(e).toString():"/"+If(e)}te.getErrorPath=FO;function Pb(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}te.checkStrictMode=Pb});var Rr=k(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});var it=Q(),UO={data:new it.Name("data"),valCxt:new it.Name("valCxt"),instancePath:new it.Name("instancePath"),parentData:new it.Name("parentData"),parentDataProperty:new it.Name("parentDataProperty"),rootData:new it.Name("rootData"),dynamicAnchors:new it.Name("dynamicAnchors"),vErrors:new it.Name("vErrors"),errors:new it.Name("errors"),this:new it.Name("this"),self:new it.Name("self"),scope:new it.Name("scope"),json:new it.Name("json"),jsonPos:new it.Name("jsonPos"),jsonLen:new it.Name("jsonLen"),jsonPart:new it.Name("jsonPart")};Mf.default=UO});var as=k(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.extendErrors=st.resetErrorsCount=st.reportExtraError=st.reportError=st.keyword$DataError=st.keywordError=void 0;var ue=Q(),ac=ce(),yt=Rr();st.keywordError={message:({keyword:e})=>(0,ue.str)`must pass "${e}" keyword validation`};st.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ue.str)`"${e}" keyword must be ${t} ($data)`:(0,ue.str)`"${e}" keyword is invalid ($data)`};function VO(e,t=st.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:s,allErrors:a}=o,c=zb(e,t,r);n??(s||a)?Tb(i,c):Rb(o,(0,ue._)`[${c}]`)}st.reportError=VO;function HO(e,t=st.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:s}=n,a=zb(e,t,r);Tb(o,a),i||s||Rb(n,yt.default.vErrors)}st.reportExtraError=HO;function BO(e,t){e.assign(yt.default.errors,t),e.if((0,ue._)`${yt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ue._)`${yt.default.vErrors}.length`,t),()=>e.assign(yt.default.vErrors,null)))}st.resetErrorsCount=BO;function WO({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=e.name("err");e.forRange("i",o,yt.default.errors,a=>{e.const(s,(0,ue._)`${yt.default.vErrors}[${a}]`),e.if((0,ue._)`${s}.instancePath === undefined`,()=>e.assign((0,ue._)`${s}.instancePath`,(0,ue.strConcat)(yt.default.instancePath,i.errorPath))),e.assign((0,ue._)`${s}.schemaPath`,(0,ue.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ue._)`${s}.schema`,r),e.assign((0,ue._)`${s}.data`,n))})}st.extendErrors=WO;function Tb(e,t){let r=e.const("err",t);e.if((0,ue._)`${yt.default.vErrors} === null`,()=>e.assign(yt.default.vErrors,(0,ue._)`[${r}]`),(0,ue._)`${yt.default.vErrors}.push(${r})`),e.code((0,ue._)`${yt.default.errors}++`)}function Rb(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ue._)`new ${e.ValidationError}(${t})`):(r.assign((0,ue._)`${n}.errors`,t),r.return(!1))}var Gn={keyword:new ue.Name("keyword"),schemaPath:new ue.Name("schemaPath"),params:new ue.Name("params"),propertyName:new ue.Name("propertyName"),message:new ue.Name("message"),schema:new ue.Name("schema"),parentSchema:new ue.Name("parentSchema")};function zb(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ue._)`{}`:JO(e,t,r)}function JO(e,t,r={}){let{gen:n,it:o}=e,i=[GO(o,r),KO(e,r)];return XO(e,t,i),n.object(...i)}function GO({errorPath:e},{instancePath:t}){let r=t?(0,ue.str)`${e}${(0,ac.getErrorPath)(t,ac.Type.Str)}`:e;return[yt.default.instancePath,(0,ue.strConcat)(yt.default.instancePath,r)]}function KO({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ue.str)`${t}/${e}`;return r&&(o=(0,ue.str)`${o}${(0,ac.getErrorPath)(r,ac.Type.Str)}`),[Gn.schemaPath,o]}function XO(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Gn.keyword,o],[Gn.params,typeof t=="function"?t(e):t||(0,ue._)`{}`]),c.messages&&n.push([Gn.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Gn.schema,s],[Gn.parentSchema,(0,ue._)`${l}${d}`],[yt.default.data,i]),u&&n.push([Gn.propertyName,u])}});var Ob=k(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});Io.boolOrEmptySchema=Io.topBoolOrEmptySchema=void 0;var YO=as(),QO=Q(),eC=Rr(),tC={message:"boolean schema is false"};function rC(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Eb(e,!1):typeof r=="object"&&r.$async===!0?t.return(eC.default.data):(t.assign((0,QO._)`${n}.errors`,null),t.return(!0))}Io.topBoolOrEmptySchema=rC;function nC(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Eb(e)):r.var(t,!0)}Io.boolOrEmptySchema=nC;function Eb(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,YO.reportError)(o,tC,void 0,t)}});var Df=k(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.getRules=No.isJSONType=void 0;var oC=["string","number","integer","boolean","null","object","array"],iC=new Set(oC);function sC(e){return typeof e=="string"&&iC.has(e)}No.isJSONType=sC;function aC(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}No.getRules=aC});var Af=k(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.shouldUseRule=Yr.shouldUseGroup=Yr.schemaHasRulesForType=void 0;function cC({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Cb(e,n)}Yr.schemaHasRulesForType=cC;function Cb(e,t){return t.rules.some(r=>jb(e,r))}Yr.shouldUseGroup=Cb;function jb(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Yr.shouldUseRule=jb});var cs=k(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.reportTypeError=at.checkDataTypes=at.checkDataType=at.coerceAndCheckDataType=at.getJSONTypes=at.getSchemaTypes=at.DataType=void 0;var uC=Df(),lC=Af(),dC=as(),X=Q(),Ib=ce(),Mo;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Mo||(at.DataType=Mo={}));function fC(e){let t=Nb(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}at.getSchemaTypes=fC;function Nb(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(uC.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}at.getJSONTypes=Nb;function pC(e,t){let{gen:r,data:n,opts:o}=e,i=mC(t,o.coerceTypes),s=t.length>0&&!(i.length===0&&t.length===1&&(0,lC.schemaHasRulesForType)(e,t[0]));if(s){let a=Zf(t,n,o.strictNumbers,Mo.Wrong);r.if(a,()=>{i.length?hC(e,t,i):Lf(e)})}return s}at.coerceAndCheckDataType=pC;var Mb=new Set(["string","number","integer","boolean","null"]);function mC(e,t){return t?e.filter(r=>Mb.has(r)||t==="array"&&r==="array"):[]}function hC(e,t,r){let{gen:n,data:o,opts:i}=e,s=n.let("dataType",(0,X._)`typeof ${o}`),a=n.let("coerced",(0,X._)`undefined`);i.coerceTypes==="array"&&n.if((0,X._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,X._)`${o}[0]`).assign(s,(0,X._)`typeof ${o}`).if(Zf(t,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,X._)`${a} !== undefined`);for(let u of r)(Mb.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Lf(e),n.endIf(),n.if((0,X._)`${a} !== undefined`,()=>{n.assign(o,a),gC(e,a)});function c(u){switch(u){case"string":n.elseIf((0,X._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,X._)`"" + ${o}`).elseIf((0,X._)`${o} === null`).assign(a,(0,X._)`""`);return;case"number":n.elseIf((0,X._)`${s} == "boolean" || ${o} === null
|
|
3
|
+
var yP=Object.create;var Xs=Object.defineProperty;var _P=Object.getOwnPropertyDescriptor;var vP=Object.getOwnPropertyNames;var bP=Object.getPrototypeOf,wP=Object.prototype.hasOwnProperty;var mo=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var xP=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var k=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ys=(e,t)=>{for(var r in t)Xs(e,r,{get:t[r],enumerable:!0})},by=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vP(t))!wP.call(e,o)&&o!==r&&Xs(e,o,{get:()=>t[o],enumerable:!(n=_P(t,o))||n.enumerable});return e};var Qs=(e,t,r)=>(r=e!=null?yP(bP(e)):{},by(t||!e||!e.__esModule?Xs(r,"default",{value:e,enumerable:!0}):r,e)),Mu=e=>by(Xs({},"__esModule",{value:!0}),e);var ts=k(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.regexpCode=le.getEsmExportName=le.getProperty=le.safeStringify=le.stringify=le.strConcat=le.addCodeArg=le.str=le._=le.nil=le._Code=le.Name=le.IDENTIFIER=le._CodeOrName=void 0;var Qi=class{};le._CodeOrName=Qi;le.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Hn=class extends Qi{constructor(t){if(super(),!le.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};le.Name=Hn;var Lt=class extends Qi{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof Hn&&(r[n.str]=(r[n.str]||0)+1),r),{})}};le._Code=Lt;le.nil=new Lt("");function gb(e,...t){let r=[e[0]],n=0;for(;n<t.length;)yf(r,t[n]),r.push(e[++n]);return new Lt(r)}le._=gb;var gf=new Lt("+");function yb(e,...t){let r=[es(e[0])],n=0;for(;n<t.length;)r.push(gf),yf(r,t[n]),r.push(gf,es(e[++n]));return vO(r),new Lt(r)}le.str=yb;function yf(e,t){t instanceof Lt?e.push(...t._items):t instanceof Hn?e.push(t):e.push(xO(t))}le.addCodeArg=yf;function vO(e){let t=1;for(;t<e.length-1;){if(e[t]===gf){let r=bO(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function bO(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof Hn||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Hn))return`"${e}${t.slice(1)}`}function wO(e,t){return t.emptyStr()?e:e.emptyStr()?t:yb`${e}${t}`}le.strConcat=wO;function xO(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:es(Array.isArray(e)?e.join(","):e)}function $O(e){return new Lt(es(e))}le.stringify=$O;function es(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}le.safeStringify=es;function SO(e){return typeof e=="string"&&le.IDENTIFIER.test(e)?new Lt(`.${e}`):gb`[${e}]`}le.getProperty=SO;function kO(e){if(typeof e=="string"&&le.IDENTIFIER.test(e))return new Lt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}le.getEsmExportName=kO;function PO(e){return new Lt(e.toString())}le.regexpCode=PO});var bf=k(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.ValueScope=St.ValueScopeName=St.Scope=St.varKinds=St.UsedValueState=void 0;var $t=ts(),_f=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ec;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ec||(St.UsedValueState=ec={}));St.varKinds={const:new $t.Name("const"),let:new $t.Name("let"),var:new $t.Name("var")};var tc=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof $t.Name?t:this.name(t)}name(t){return new $t.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};St.Scope=tc;var rc=class extends $t.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,$t._)`.${new $t.Name(r)}[${n}]`}};St.ValueScopeName=rc;var TO=(0,$t._)`\n`,vf=class extends tc{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?TO:$t.nil}}get(){return this._scope}name(t){return new rc(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,s=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[i];if(a){let l=a.get(s);if(l)return l}else a=this._values[i]=new Map;a.set(s,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,$t._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=$t.nil;for(let s in t){let a=t[s];if(!a)continue;let c=n[s]=n[s]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ec.Started);let l=r(u);if(l){let d=this.opts.es5?St.varKinds.var:St.varKinds.const;i=(0,$t._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,$t._)`${i}${l}${this.opts._n}`;else throw new _f(u);c.set(u,ec.Completed)})}return i}};St.ValueScope=vf});var Q=k(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.or=ee.and=ee.not=ee.CodeGen=ee.operators=ee.varKinds=ee.ValueScopeName=ee.ValueScope=ee.Scope=ee.Name=ee.regexpCode=ee.stringify=ee.getProperty=ee.nil=ee.strConcat=ee.str=ee._=void 0;var se=ts(),Xt=bf(),Xr=ts();Object.defineProperty(ee,"_",{enumerable:!0,get:function(){return Xr._}});Object.defineProperty(ee,"str",{enumerable:!0,get:function(){return Xr.str}});Object.defineProperty(ee,"strConcat",{enumerable:!0,get:function(){return Xr.strConcat}});Object.defineProperty(ee,"nil",{enumerable:!0,get:function(){return Xr.nil}});Object.defineProperty(ee,"getProperty",{enumerable:!0,get:function(){return Xr.getProperty}});Object.defineProperty(ee,"stringify",{enumerable:!0,get:function(){return Xr.stringify}});Object.defineProperty(ee,"regexpCode",{enumerable:!0,get:function(){return Xr.regexpCode}});Object.defineProperty(ee,"Name",{enumerable:!0,get:function(){return Xr.Name}});var sc=bf();Object.defineProperty(ee,"Scope",{enumerable:!0,get:function(){return sc.Scope}});Object.defineProperty(ee,"ValueScope",{enumerable:!0,get:function(){return sc.ValueScope}});Object.defineProperty(ee,"ValueScopeName",{enumerable:!0,get:function(){return sc.ValueScopeName}});Object.defineProperty(ee,"varKinds",{enumerable:!0,get:function(){return sc.varKinds}});ee.operators={GT:new se._Code(">"),GTE:new se._Code(">="),LT:new se._Code("<"),LTE:new se._Code("<="),EQ:new se._Code("==="),NEQ:new se._Code("!=="),NOT:new se._Code("!"),OR:new se._Code("||"),AND:new se._Code("&&"),ADD:new se._Code("+")};var Pr=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},wf=class extends Pr{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?Xt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=jo(this.rhs,t,r)),this}get names(){return this.rhs instanceof se._CodeOrName?this.rhs.names:{}}},nc=class extends Pr{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof se.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=jo(this.rhs,t,r),this}get names(){let t=this.lhs instanceof se.Name?{}:{...this.lhs.names};return ic(t,this.rhs)}},xf=class extends nc{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},$f=class extends Pr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Sf=class extends Pr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},kf=class extends Pr{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Pf=class extends Pr{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=jo(this.code,t,r),this}get names(){return this.code instanceof se._CodeOrName?this.code.names:{}}},rs=class extends Pr{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||(zO(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Jn(t,r.names),{})}},Tr=class extends rs{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Tf=class extends rs{},Co=class extends Tr{};Co.kind="else";var Bn=class e extends Tr{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Co(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(_b(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=jo(this.condition,t,r),this}get names(){let t=super.names;return ic(t,this.condition),this.else&&Jn(t,this.else.names),t}};Bn.kind="if";var Wn=class extends Tr{};Wn.kind="for";var zf=class extends Wn{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=jo(this.iteration,t,r),this}get names(){return Jn(super.names,this.iteration.names)}},Rf=class extends Wn{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?Xt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=ic(super.names,this.from);return ic(t,this.to)}},oc=class extends Wn{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=jo(this.iterable,t,r),this}get names(){return Jn(super.names,this.iterable.names)}},ns=class extends Tr{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};ns.kind="func";var os=class extends rs{render(t){return"return "+super.render(t)}};os.kind="return";var Ef=class extends Tr{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&Jn(t,this.catch.names),this.finally&&Jn(t,this.finally.names),t}},is=class extends Tr{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};is.kind="catch";var ss=class extends Tr{render(t){return"finally"+super.render(t)}};ss.kind="finally";var Of=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
+
`:""},this._extScope=t,this._scope=new Xt.Scope({parent:t}),this._nodes=[new Tf]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new wf(t,i,n)),i}const(t,r,n){return this._def(Xt.varKinds.const,t,r,n)}let(t,r,n){return this._def(Xt.varKinds.let,t,r,n)}var(t,r,n){return this._def(Xt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new nc(t,r,n))}add(t,r){return this._leafNode(new xf(t,ee.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==se.nil&&this._leafNode(new Pf(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,se.addCodeArg)(r,o));return r.push("}"),new se._Code(r)}if(t,r,n){if(this._blockNode(new Bn(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new Bn(t))}else(){return this._elseNode(new Co)}endIf(){return this._endBlockNode(Bn,Co)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new zf(t),r)}forRange(t,r,n,o,i=this.opts.es5?Xt.varKinds.var:Xt.varKinds.let){let s=this._scope.toName(t);return this._for(new Rf(i,s,r,n),()=>o(s))}forOf(t,r,n,o=Xt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let s=r instanceof se.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,se._)`${s}.length`,a=>{this.var(i,(0,se._)`${s}[${a}]`),n(i)})}return this._for(new oc("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?Xt.varKinds.var:Xt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,se._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new oc("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Wn)}label(t){return this._leafNode(new $f(t))}break(t){return this._leafNode(new Sf(t))}return(t){let r=new os;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(os)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Ef;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new is(i),r(i)}return n&&(this._currNode=o.finally=new ss,this.code(n)),this._endBlockNode(is,ss)}throw(t){return this._leafNode(new kf(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=se.nil,n,o){return this._blockNode(new ns(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ns)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof Bn))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};ee.CodeGen=Of;function Jn(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ic(e,t){return t instanceof se._CodeOrName?Jn(e,t.names):e}function jo(e,t,r){if(e instanceof se.Name)return n(e);if(!o(e))return e;return new se._Code(e._items.reduce((i,s)=>(s instanceof se.Name&&(s=n(s)),s instanceof se._Code?i.push(...s._items):i.push(s),i),[]));function n(i){let s=r[i.str];return s===void 0||t[i.str]!==1?i:(delete t[i.str],s)}function o(i){return i instanceof se._Code&&i._items.some(s=>s instanceof se.Name&&t[s.str]===1&&r[s.str]!==void 0)}}function zO(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function _b(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,se._)`!${Cf(e)}`}ee.not=_b;var RO=vb(ee.operators.AND);function EO(...e){return e.reduce(RO)}ee.and=EO;var OO=vb(ee.operators.OR);function CO(...e){return e.reduce(OO)}ee.or=CO;function vb(e){return(t,r)=>t===se.nil?r:r===se.nil?t:(0,se._)`${Cf(t)} ${e} ${Cf(r)}`}function Cf(e){return e instanceof se.Name?e:(0,se._)`(${e})`}});var ce=k(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te.checkStrictMode=te.getErrorPath=te.Type=te.useFunc=te.setEvaluated=te.evaluatedPropsToName=te.mergeEvaluated=te.eachItem=te.unescapeJsonPointer=te.escapeJsonPointer=te.escapeFragment=te.unescapeFragment=te.schemaRefOrVal=te.schemaHasRulesButRef=te.schemaHasRules=te.checkUnknownRules=te.alwaysValidSchema=te.toHash=void 0;var ve=Q(),jO=ts();function MO(e){let t={};for(let r of e)t[r]=!0;return t}te.toHash=MO;function NO(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(xb(e,t),!$b(t,e.self.RULES.all))}te.alwaysValidSchema=NO;function xb(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||Pb(e,`unknown keyword: "${i}"`)}te.checkUnknownRules=xb;function $b(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}te.schemaHasRules=$b;function IO(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}te.schemaHasRulesButRef=IO;function DO({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ve._)`${r}`}return(0,ve._)`${e}${t}${(0,ve.getProperty)(n)}`}te.schemaRefOrVal=DO;function AO(e){return Sb(decodeURIComponent(e))}te.unescapeFragment=AO;function qO(e){return encodeURIComponent(Mf(e))}te.escapeFragment=qO;function Mf(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}te.escapeJsonPointer=Mf;function Sb(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}te.unescapeJsonPointer=Sb;function ZO(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}te.eachItem=ZO;function bb({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,s,a)=>{let c=s===void 0?i:s instanceof ve.Name?(i instanceof ve.Name?e(o,i,s):t(o,i,s),s):i instanceof ve.Name?(t(o,s,i),i):r(i,s);return a===ve.Name&&!(c instanceof ve.Name)?n(o,c):c}}te.mergeEvaluated={props:bb({mergeNames:(e,t,r)=>e.if((0,ve._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,ve._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,ve._)`${r} || {}`).code((0,ve._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,ve._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,ve._)`${r} || {}`),Nf(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:kb}),items:bb({mergeNames:(e,t,r)=>e.if((0,ve._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,ve._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,ve._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,ve._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function kb(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,ve._)`{}`);return t!==void 0&&Nf(e,r,t),r}te.evaluatedPropsToName=kb;function Nf(e,t,r){Object.keys(r).forEach(n=>e.assign((0,ve._)`${t}${(0,ve.getProperty)(n)}`,!0))}te.setEvaluated=Nf;var wb={};function LO(e,t){return e.scopeValue("func",{ref:t,code:wb[t.code]||(wb[t.code]=new jO._Code(t.code))})}te.useFunc=LO;var jf;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(jf||(te.Type=jf={}));function FO(e,t,r){if(e instanceof ve.Name){let n=t===jf.Num;return r?n?(0,ve._)`"[" + ${e} + "]"`:(0,ve._)`"['" + ${e} + "']"`:n?(0,ve._)`"/" + ${e}`:(0,ve._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ve.getProperty)(e).toString():"/"+Mf(e)}te.getErrorPath=FO;function Pb(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}te.checkStrictMode=Pb});var zr=k(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var it=Q(),UO={data:new it.Name("data"),valCxt:new it.Name("valCxt"),instancePath:new it.Name("instancePath"),parentData:new it.Name("parentData"),parentDataProperty:new it.Name("parentDataProperty"),rootData:new it.Name("rootData"),dynamicAnchors:new it.Name("dynamicAnchors"),vErrors:new it.Name("vErrors"),errors:new it.Name("errors"),this:new it.Name("this"),self:new it.Name("self"),scope:new it.Name("scope"),json:new it.Name("json"),jsonPos:new it.Name("jsonPos"),jsonLen:new it.Name("jsonLen"),jsonPart:new it.Name("jsonPart")};If.default=UO});var as=k(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.extendErrors=st.resetErrorsCount=st.reportExtraError=st.reportError=st.keyword$DataError=st.keywordError=void 0;var ue=Q(),ac=ce(),yt=zr();st.keywordError={message:({keyword:e})=>(0,ue.str)`must pass "${e}" keyword validation`};st.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ue.str)`"${e}" keyword must be ${t} ($data)`:(0,ue.str)`"${e}" keyword is invalid ($data)`};function VO(e,t=st.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:s,allErrors:a}=o,c=Rb(e,t,r);n??(s||a)?Tb(i,c):zb(o,(0,ue._)`[${c}]`)}st.reportError=VO;function HO(e,t=st.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:s}=n,a=Rb(e,t,r);Tb(o,a),i||s||zb(n,yt.default.vErrors)}st.reportExtraError=HO;function BO(e,t){e.assign(yt.default.errors,t),e.if((0,ue._)`${yt.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ue._)`${yt.default.vErrors}.length`,t),()=>e.assign(yt.default.vErrors,null)))}st.resetErrorsCount=BO;function WO({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let s=e.name("err");e.forRange("i",o,yt.default.errors,a=>{e.const(s,(0,ue._)`${yt.default.vErrors}[${a}]`),e.if((0,ue._)`${s}.instancePath === undefined`,()=>e.assign((0,ue._)`${s}.instancePath`,(0,ue.strConcat)(yt.default.instancePath,i.errorPath))),e.assign((0,ue._)`${s}.schemaPath`,(0,ue.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ue._)`${s}.schema`,r),e.assign((0,ue._)`${s}.data`,n))})}st.extendErrors=WO;function Tb(e,t){let r=e.const("err",t);e.if((0,ue._)`${yt.default.vErrors} === null`,()=>e.assign(yt.default.vErrors,(0,ue._)`[${r}]`),(0,ue._)`${yt.default.vErrors}.push(${r})`),e.code((0,ue._)`${yt.default.errors}++`)}function zb(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ue._)`new ${e.ValidationError}(${t})`):(r.assign((0,ue._)`${n}.errors`,t),r.return(!1))}var Gn={keyword:new ue.Name("keyword"),schemaPath:new ue.Name("schemaPath"),params:new ue.Name("params"),propertyName:new ue.Name("propertyName"),message:new ue.Name("message"),schema:new ue.Name("schema"),parentSchema:new ue.Name("parentSchema")};function Rb(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ue._)`{}`:JO(e,t,r)}function JO(e,t,r={}){let{gen:n,it:o}=e,i=[GO(o,r),KO(e,r)];return XO(e,t,i),n.object(...i)}function GO({errorPath:e},{instancePath:t}){let r=t?(0,ue.str)`${e}${(0,ac.getErrorPath)(t,ac.Type.Str)}`:e;return[yt.default.instancePath,(0,ue.strConcat)(yt.default.instancePath,r)]}function KO({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ue.str)`${t}/${e}`;return r&&(o=(0,ue.str)`${o}${(0,ac.getErrorPath)(r,ac.Type.Str)}`),[Gn.schemaPath,o]}function XO(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:s,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Gn.keyword,o],[Gn.params,typeof t=="function"?t(e):t||(0,ue._)`{}`]),c.messages&&n.push([Gn.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Gn.schema,s],[Gn.parentSchema,(0,ue._)`${l}${d}`],[yt.default.data,i]),u&&n.push([Gn.propertyName,u])}});var Ob=k(Mo=>{"use strict";Object.defineProperty(Mo,"__esModule",{value:!0});Mo.boolOrEmptySchema=Mo.topBoolOrEmptySchema=void 0;var YO=as(),QO=Q(),eC=zr(),tC={message:"boolean schema is false"};function rC(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Eb(e,!1):typeof r=="object"&&r.$async===!0?t.return(eC.default.data):(t.assign((0,QO._)`${n}.errors`,null),t.return(!0))}Mo.topBoolOrEmptySchema=rC;function nC(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Eb(e)):r.var(t,!0)}Mo.boolOrEmptySchema=nC;function Eb(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,YO.reportError)(o,tC,void 0,t)}});var Df=k(No=>{"use strict";Object.defineProperty(No,"__esModule",{value:!0});No.getRules=No.isJSONType=void 0;var oC=["string","number","integer","boolean","null","object","array"],iC=new Set(oC);function sC(e){return typeof e=="string"&&iC.has(e)}No.isJSONType=sC;function aC(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}No.getRules=aC});var Af=k(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.shouldUseRule=Yr.shouldUseGroup=Yr.schemaHasRulesForType=void 0;function cC({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Cb(e,n)}Yr.schemaHasRulesForType=cC;function Cb(e,t){return t.rules.some(r=>jb(e,r))}Yr.shouldUseGroup=Cb;function jb(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Yr.shouldUseRule=jb});var cs=k(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.reportTypeError=at.checkDataTypes=at.checkDataType=at.coerceAndCheckDataType=at.getJSONTypes=at.getSchemaTypes=at.DataType=void 0;var uC=Df(),lC=Af(),dC=as(),X=Q(),Mb=ce(),Io;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Io||(at.DataType=Io={}));function fC(e){let t=Nb(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}at.getSchemaTypes=fC;function Nb(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(uC.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}at.getJSONTypes=Nb;function pC(e,t){let{gen:r,data:n,opts:o}=e,i=mC(t,o.coerceTypes),s=t.length>0&&!(i.length===0&&t.length===1&&(0,lC.schemaHasRulesForType)(e,t[0]));if(s){let a=Zf(t,n,o.strictNumbers,Io.Wrong);r.if(a,()=>{i.length?hC(e,t,i):Lf(e)})}return s}at.coerceAndCheckDataType=pC;var Ib=new Set(["string","number","integer","boolean","null"]);function mC(e,t){return t?e.filter(r=>Ib.has(r)||t==="array"&&r==="array"):[]}function hC(e,t,r){let{gen:n,data:o,opts:i}=e,s=n.let("dataType",(0,X._)`typeof ${o}`),a=n.let("coerced",(0,X._)`undefined`);i.coerceTypes==="array"&&n.if((0,X._)`${s} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,X._)`${o}[0]`).assign(s,(0,X._)`typeof ${o}`).if(Zf(t,o,i.strictNumbers),()=>n.assign(a,o))),n.if((0,X._)`${a} !== undefined`);for(let u of r)(Ib.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Lf(e),n.endIf(),n.if((0,X._)`${a} !== undefined`,()=>{n.assign(o,a),gC(e,a)});function c(u){switch(u){case"string":n.elseIf((0,X._)`${s} == "number" || ${s} == "boolean"`).assign(a,(0,X._)`"" + ${o}`).elseIf((0,X._)`${o} === null`).assign(a,(0,X._)`""`);return;case"number":n.elseIf((0,X._)`${s} == "boolean" || ${o} === null
|
|
5
5
|
|| (${s} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,X._)`+${o}`);return;case"integer":n.elseIf((0,X._)`${s} === "boolean" || ${o} === null
|
|
6
6
|
|| (${s} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,X._)`+${o}`);return;case"boolean":n.elseIf((0,X._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,X._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,X._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,X._)`${s} === "string" || ${s} === "number"
|
|
7
|
-
|| ${s} === "boolean" || ${o} === null`).assign(a,(0,X._)`[${o}]`)}}}function gC({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,X._)`${t} !== undefined`,()=>e.assign((0,X._)`${t}[${r}]`,n))}function qf(e,t,r,n=Mo.Correct){let o=n===Mo.Correct?X.operators.EQ:X.operators.NEQ,i;switch(e){case"null":return(0,X._)`${t} ${o} null`;case"array":i=(0,X._)`Array.isArray(${t})`;break;case"object":i=(0,X._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s((0,X._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return(0,X._)`typeof ${t} ${o} ${e}`}return n===Mo.Correct?i:(0,X.not)(i);function s(a=X.nil){return(0,X.and)((0,X._)`typeof ${t} == "number"`,a,r?(0,X._)`isFinite(${t})`:X.nil)}}at.checkDataType=qf;function Zf(e,t,r,n){if(e.length===1)return qf(e[0],t,r,n);let o,i=(0,Ib.toHash)(e);if(i.array&&i.object){let s=(0,X._)`typeof ${t} != "object"`;o=i.null?s:(0,X._)`!${t} || ${s}`,delete i.null,delete i.array,delete i.object}else o=X.nil;i.number&&delete i.integer;for(let s in i)o=(0,X.and)(o,qf(s,t,r,n));return o}at.checkDataTypes=Zf;var yC={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,X._)`{type: ${e}}`:(0,X._)`{type: ${t}}`};function Lf(e){let t=_C(e);(0,dC.reportError)(t,yC)}at.reportTypeError=Lf;function _C(e){let{gen:t,data:r,schema:n}=e,o=(0,Ib.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Ab=k(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.assignDefaults=void 0;var Do=Q(),vC=ce();function bC(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Db(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Db(e,i,o.default))}cc.assignDefaults=bC;function Db(e,t,r){let{gen:n,compositeRule:o,data:i,opts:s}=e;if(r===void 0)return;let a=(0,Do._)`${i}${(0,Do.getProperty)(t)}`;if(o){(0,vC.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,Do._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Do._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Do._)`${a} = ${(0,Do.stringify)(r)}`)}});var Ft=k(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.validateUnion=ye.validateArray=ye.usePattern=ye.callValidateCode=ye.schemaProperties=ye.allSchemaProperties=ye.noPropertyInData=ye.propertyInData=ye.isOwnProperty=ye.hasPropFunc=ye.reportMissingProp=ye.checkMissingProp=ye.checkReportMissingProp=void 0;var Pe=Q(),Ff=ce(),Qr=Rr(),wC=ce();function xC(e,t){let{gen:r,data:n,it:o}=e;r.if(Vf(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Pe._)`${t}`},!0),e.error()})}ye.checkReportMissingProp=xC;function $C({gen:e,data:t,it:{opts:r}},n,o){return(0,Pe.or)(...n.map(i=>(0,Pe.and)(Vf(e,t,i,r.ownProperties),(0,Pe._)`${o} = ${i}`)))}ye.checkMissingProp=$C;function SC(e,t){e.setParams({missingProperty:t},!0),e.error()}ye.reportMissingProp=SC;function qb(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Pe._)`Object.prototype.hasOwnProperty`})}ye.hasPropFunc=qb;function Uf(e,t,r){return(0,Pe._)`${qb(e)}.call(${t}, ${r})`}ye.isOwnProperty=Uf;function kC(e,t,r,n){let o=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} !== undefined`;return n?(0,Pe._)`${o} && ${Uf(e,t,r)}`:o}ye.propertyInData=kC;function Vf(e,t,r,n){let o=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} === undefined`;return n?(0,Pe.or)(o,(0,Pe.not)(Uf(e,t,r))):o}ye.noPropertyInData=Vf;function Zb(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ye.allSchemaProperties=Zb;function PC(e,t){return Zb(t).filter(r=>!(0,Ff.alwaysValidSchema)(e,t[r]))}ye.schemaProperties=PC;function TC({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,Pe._)`${e}, ${t}, ${n}${o}`:t,d=[[Qr.default.instancePath,(0,Pe.strConcat)(Qr.default.instancePath,i)],[Qr.default.parentData,s.parentData],[Qr.default.parentDataProperty,s.parentDataProperty],[Qr.default.rootData,Qr.default.rootData]];s.opts.dynamicRef&&d.push([Qr.default.dynamicAnchors,Qr.default.dynamicAnchors]);let h=(0,Pe._)`${l}, ${r.object(...d)}`;return c!==Pe.nil?(0,Pe._)`${a}.call(${c}, ${h})`:(0,Pe._)`${a}(${h})`}ye.callValidateCode=TC;var RC=(0,Pe._)`new RegExp`;function zC({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,Pe._)`${o.code==="new RegExp"?RC:(0,wC.useFunc)(e,o)}(${r}, ${n})`})}ye.usePattern=zC;function EC(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(i,!0),s(()=>t.break()),i;function s(a){let c=t.const("len",(0,Pe._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Ff.Type.Num},i),t.if((0,Pe.not)(i),a)})}}ye.validateArray=EC;function OC(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ff.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(s,(0,Pe._)`${s} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,Pe.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}ye.validateUnion=OC});var Ub=k(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.validateKeywordUsage=dr.validSchemaType=dr.funcKeywordCode=dr.macroKeywordCode=void 0;var _t=Q(),Kn=Rr(),CC=Ft(),jC=as();function IC(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=e,a=t.macro.call(s.self,o,i,s),c=Fb(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:_t.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}dr.macroKeywordCode=IC;function NC(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=e;DC(c,t);let u=!a&&t.compile?t.compile.call(c.self,i,s,c):t.validate,l=Fb(n,o,u),d=n.let("valid");e.block$data(d,h),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function h(){if(t.errors===!1)y(),t.modifying&&Lb(e),v(()=>e.error());else{let P=t.async?m():p();t.modifying&&Lb(e),v(()=>MC(e,P))}}function m(){let P=n.let("ruleErrs",null);return n.try(()=>y((0,_t._)`await `),T=>n.assign(d,!1).if((0,_t._)`${T} instanceof ${c.ValidationError}`,()=>n.assign(P,(0,_t._)`${T}.errors`),()=>n.throw(T))),P}function p(){let P=(0,_t._)`${l}.errors`;return n.assign(P,null),y(_t.nil),P}function y(P=t.async?(0,_t._)`await `:_t.nil){let T=c.opts.passContext?Kn.default.this:Kn.default.self,z=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,_t._)`${P}${(0,CC.callValidateCode)(e,l,T,z)}`,t.modifying)}function v(P){var T;n.if((0,_t.not)((T=t.valid)!==null&&T!==void 0?T:d),P)}}dr.funcKeywordCode=NC;function Lb(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,_t._)`${n.parentData}[${n.parentDataProperty}]`))}function MC(e,t){let{gen:r}=e;r.if((0,_t._)`Array.isArray(${t})`,()=>{r.assign(Kn.default.vErrors,(0,_t._)`${Kn.default.vErrors} === null ? ${t} : ${Kn.default.vErrors}.concat(${t})`).assign(Kn.default.errors,(0,_t._)`${Kn.default.vErrors}.length`),(0,jC.extendErrors)(e)},()=>e.error())}function DC({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Fb(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,_t.stringify)(r)})}function AC(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}dr.validSchemaType=AC;function qC({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}dr.validateKeywordUsage=qC});var Hb=k(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.extendSubschemaMode=en.extendSubschemaData=en.getSubschema=void 0;var fr=Q(),Vb=ce();function ZC(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,fr._)`${e.schemaPath}${(0,fr.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,fr._)`${e.schemaPath}${(0,fr.getProperty)(t)}${(0,fr.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Vb.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}en.getSubschema=ZC;function LC(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,h=a.let("data",(0,fr._)`${t.data}${(0,fr.getProperty)(r)}`,!0);c(h),e.errorPath=(0,fr.str)`${u}${(0,Vb.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,fr._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof fr.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(e.propertyName=s)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}en.extendSubschemaData=LC;function FC(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}en.extendSubschemaMode=FC});var Hf=k((f9,Bb)=>{"use strict";Bb.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var Jb=k((p9,Wb)=>{"use strict";var tn=Wb.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};uc(t,n,o,e,"",e)};tn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};tn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};tn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};tn.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 uc(e,t,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in tn.arrayKeywords)for(var h=0;h<d.length;h++)uc(e,t,r,d[h],o+"/"+l+"/"+h,i,o,l,n,h)}else if(l in tn.propsKeywords){if(d&&typeof d=="object")for(var m in d)uc(e,t,r,d[m],o+"/"+l+"/"+UC(m),i,o,l,n,m)}else(l in tn.keywords||e.allKeys&&!(l in tn.skipKeywords))&&uc(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,s,a,c,u)}}function UC(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var us=k(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.getSchemaRefs=kt.resolveUrl=kt.normalizeId=kt._getFullPath=kt.getFullPath=kt.inlineRef=void 0;var VC=ce(),HC=Hf(),BC=Jb(),WC=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function JC(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Bf(e):t?Gb(e)<=t:!1}kt.inlineRef=JC;var GC=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Bf(e){for(let t in e){if(GC.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Bf)||typeof r=="object"&&Bf(r))return!0}return!1}function Gb(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!WC.has(r)&&(typeof e[r]=="object"&&(0,VC.eachItem)(e[r],n=>t+=Gb(n)),t===1/0))return 1/0}return t}function Kb(e,t="",r){r!==!1&&(t=Ao(t));let n=e.parse(t);return Xb(e,n)}kt.getFullPath=Kb;function Xb(e,t){return e.serialize(t).split("#")[0]+"#"}kt._getFullPath=Xb;var KC=/#\/?$/;function Ao(e){return e?e.replace(KC,""):""}kt.normalizeId=Ao;function XC(e,t,r){return r=Ao(r),e.resolve(t,r)}kt.resolveUrl=XC;var YC=/^[a-z_][-a-z0-9._]*$/i;function QC(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ao(e[r]||t),i={"":o},s=Kb(n,o,!1),a={},c=new Set;return BC(e,{allKeys:!0},(d,h,m,p)=>{if(p===void 0)return;let y=s+h,v=i[p];typeof d[r]=="string"&&(v=P.call(this,d[r])),T.call(this,d.$anchor),T.call(this,d.$dynamicAnchor),i[h]=v;function P(z){let M=this.opts.uriResolver.resolve;if(z=Ao(v?M(v,z):z),c.has(z))throw l(z);c.add(z);let C=this.refs[z];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?u(d,C.schema,z):z!==Ao(y)&&(z[0]==="#"?(u(d,a[z],z),a[z]=d):this.refs[z]=y),z}function T(z){if(typeof z=="string"){if(!YC.test(z))throw new Error(`invalid anchor "${z}"`);P.call(this,`#${z}`)}}}),a;function u(d,h,m){if(h!==void 0&&!HC(d,h))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}kt.getSchemaRefs=QC});var fs=k(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.getData=rn.KeywordCxt=rn.validateFunctionCode=void 0;var rw=Ob(),Yb=cs(),Jf=Af(),lc=cs(),ej=Ab(),ds=Ub(),Wf=Hb(),F=Q(),J=Rr(),tj=us(),zr=ce(),ls=as();function rj(e){if(iw(e)&&(sw(e),ow(e))){ij(e);return}nw(e,()=>(0,rw.topBoolOrEmptySchema)(e))}rn.validateFunctionCode=rj;function nw({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,F._)`${J.default.data}, ${J.default.valCxt}`,n.$async,()=>{e.code((0,F._)`"use strict"; ${Qb(r,o)}`),oj(e,o),e.code(i)}):e.func(t,(0,F._)`${J.default.data}, ${nj(o)}`,n.$async,()=>e.code(Qb(r,o)).code(i))}function nj(e){return(0,F._)`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${e.dynamicRef?(0,F._)`, ${J.default.dynamicAnchors}={}`:F.nil}}={}`}function oj(e,t){e.if(J.default.valCxt,()=>{e.var(J.default.instancePath,(0,F._)`${J.default.valCxt}.${J.default.instancePath}`),e.var(J.default.parentData,(0,F._)`${J.default.valCxt}.${J.default.parentData}`),e.var(J.default.parentDataProperty,(0,F._)`${J.default.valCxt}.${J.default.parentDataProperty}`),e.var(J.default.rootData,(0,F._)`${J.default.valCxt}.${J.default.rootData}`),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,F._)`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{e.var(J.default.instancePath,(0,F._)`""`),e.var(J.default.parentData,(0,F._)`undefined`),e.var(J.default.parentDataProperty,(0,F._)`undefined`),e.var(J.default.rootData,J.default.data),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,F._)`{}`)})}function ij(e){let{schema:t,opts:r,gen:n}=e;nw(e,()=>{r.$comment&&t.$comment&&cw(e),lj(e),n.let(J.default.vErrors,null),n.let(J.default.errors,0),r.unevaluated&&sj(e),aw(e),pj(e)})}function sj(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,F._)`${r}.evaluated`),t.if((0,F._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,F._)`${e.evaluated}.props`,(0,F._)`undefined`)),t.if((0,F._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,F._)`${e.evaluated}.items`,(0,F._)`undefined`))}function Qb(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,F._)`/*# sourceURL=${r} */`:F.nil}function aj(e,t){if(iw(e)&&(sw(e),ow(e))){cj(e,t);return}(0,rw.boolOrEmptySchema)(e,t)}function ow({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function iw(e){return typeof e.schema!="boolean"}function cj(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&cw(e),dj(e),fj(e);let i=n.const("_errs",J.default.errors);aw(e,i),n.var(t,(0,F._)`${i} === ${J.default.errors}`)}function sw(e){(0,zr.checkUnknownRules)(e),uj(e)}function aw(e,t){if(e.opts.jtd)return ew(e,[],!1,t);let r=(0,Yb.getSchemaTypes)(e.schema),n=(0,Yb.coerceAndCheckDataType)(e,r);ew(e,r,!n,t)}function uj(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,zr.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function lj(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,zr.checkStrictMode)(e,"default is ignored in the schema root")}function dj(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,tj.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function fj(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function cw({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,F._)`${J.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,F.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,F._)`${J.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function pj(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,F._)`${J.default.errors} === 0`,()=>t.return(J.default.data),()=>t.throw((0,F._)`new ${o}(${J.default.vErrors})`)):(t.assign((0,F._)`${n}.errors`,J.default.vErrors),i.unevaluated&&mj(e),t.return((0,F._)`${J.default.errors} === 0`))}function mj({gen:e,evaluated:t,props:r,items:n}){r instanceof F.Name&&e.assign((0,F._)`${t}.props`,r),n instanceof F.Name&&e.assign((0,F._)`${t}.items`,n)}function ew(e,t,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,zr.schemaHasRulesButRef)(i,l))){o.block(()=>lw(e,"$ref",l.all.$ref.definition));return}c.jtd||hj(e,t),o.block(()=>{for(let h of l.rules)d(h);d(l.post)});function d(h){(0,Jf.shouldUseGroup)(i,h)&&(h.type?(o.if((0,lc.checkDataType)(h.type,s,c.strictNumbers)),tw(e,h),t.length===1&&t[0]===h.type&&r&&(o.else(),(0,lc.reportTypeError)(e)),o.endIf()):tw(e,h),a||o.if((0,F._)`${J.default.errors} === ${n||0}`))}}function tw(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,ej.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,Jf.shouldUseRule)(n,i)&&lw(e,i.keyword,i.definition,t.type)})}function hj(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(gj(e,t),e.opts.allowUnionTypes||yj(e,t),_j(e,e.dataTypes))}function gj(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{uw(e.dataTypes,r)||Gf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),bj(e,t)}}function yj(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Gf(e,"use allowUnionTypes to allow union type keyword")}function _j(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Jf.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>vj(t,s))&&Gf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function vj(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function uw(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function bj(e,t){let r=[];for(let n of e.dataTypes)uw(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Gf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,zr.checkStrictMode)(e,t,e.opts.strictTypes)}var dc=class{constructor(t,r,n){if((0,ds.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,zr.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",dw(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,ds.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",J.default.errors))}result(t,r,n){this.failResult((0,F.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,F.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,F._)`${r} !== undefined && (${(0,F.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?ls.reportExtraError:ls.reportError)(this,this.def.error,r)}$dataError(){(0,ls.reportError)(this,this.def.$dataError||ls.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ls.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=F.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=F.nil,r=F.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,F.or)((0,F._)`${o} === undefined`,r)),t!==F.nil&&n.assign(t,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==F.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,F.or)(s(),a());function s(){if(n.length){if(!(r instanceof F.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,F._)`${(0,lc.checkDataTypes)(c,r,i.opts.strictNumbers,lc.DataType.Wrong)}`}return F.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,F._)`!${c}(${r})`}return F.nil}}subschema(t,r){let n=(0,Wf.getSubschema)(this.it,t);(0,Wf.extendSubschemaData)(n,this.it,t),(0,Wf.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return aj(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=zr.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=zr.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,F.Name)),!0}};rn.KeywordCxt=dc;function lw(e,t,r,n){let o=new dc(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,ds.funcKeywordCode)(o,r):"macro"in r?(0,ds.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,ds.funcKeywordCode)(o,r)}var wj=/^\/(?:[^~]|~0|~1)*$/,xj=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dw(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return J.default.rootData;if(e[0]==="/"){if(!wj.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=J.default.rootData}else{let u=xj.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,F._)`${i}${(0,F.getProperty)((0,zr.unescapeJsonPointer)(u))}`,s=(0,F._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}rn.getData=dw});var fc=k(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});var Kf=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Xf.default=Kf});var ps=k(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});var Yf=us(),Qf=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Yf.resolveUrl)(t,r,n),this.missingSchema=(0,Yf.normalizeId)((0,Yf.getFullPath)(t,this.missingRef))}};ep.default=Qf});var mc=k(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.resolveSchema=Ut.getCompilingSchema=Ut.resolveRef=Ut.compileSchema=Ut.SchemaEnv=void 0;var Yt=Q(),$j=fc(),Xn=Rr(),Qt=us(),fw=ce(),Sj=fs(),qo=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Qt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Ut.SchemaEnv=qo;function rp(e){let t=pw.call(this,e);if(t)return t;let r=(0,Qt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;e.$async&&(a=s.scopeValue("Error",{ref:$j.default,code:(0,Yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:Xn.default.data,parentData:Xn.default.parentData,parentDataProperty:Xn.default.parentDataProperty,dataNames:[Xn.default.data],dataPathArr:[Yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Sj.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(Xn.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${Xn.default.self}`,`${Xn.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:p,items:y}=u;m.evaluated={props:p instanceof Yt.Name?void 0:p,items:y instanceof Yt.Name?void 0:y,dynamicProps:p instanceof Yt.Name,dynamicItems:y instanceof Yt.Name},m.source&&(m.source.evaluated=(0,Yt.stringify)(m.evaluated))}return e.validate=m,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}Ut.compileSchema=rp;function kj(e,t,r){var n;r=(0,Qt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=Rj.call(this,e,r);if(i===void 0){let s=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new qo({schema:s,schemaId:a,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=Pj.call(this,i)}Ut.resolveRef=kj;function Pj(e){return(0,Qt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:rp.call(this,e)}function pw(e){for(let t of this._compilations)if(Tj(t,e))return t}Ut.getCompilingSchema=pw;function Tj(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Rj(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||pc.call(this,e,t)}function pc(e,t){let r=this.opts.uriResolver.parse(t),n=(0,Qt._getFullPath)(this.opts.uriResolver,r),o=(0,Qt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return tp.call(this,r,e);let i=(0,Qt.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=pc.call(this,e,s);return typeof a?.schema!="object"?void 0:tp.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||rp.call(this,s),i===(0,Qt.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qt.resolveUrl)(this.opts.uriResolver,o,u)),new qo({schema:a,schemaId:c,root:e,baseId:o})}return tp.call(this,r,s)}}Ut.resolveSchema=pc;var zj=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function tp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,fw.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!zj.has(a)&&u&&(t=(0,Qt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,fw.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=pc.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new qo({schema:r,schemaId:s,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var mw=k((v9,Ej)=>{Ej.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 ip=k((b9,bw)=>{"use strict";var Oj=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),gw=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),np=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),yw=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Cj=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function op(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var jj=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function hw(e){return e.length=0,!0}function Ij(e,t,r){if(e.length){let n=op(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function Nj(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=Ij;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(s=!0),!a(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=hw}else{o.push(u);continue}}return o.length&&(a===hw?r.zone=o.join(""):s?n.push(o.join("")):n.push(op(o))),r.address=n.join(""),r}function _w(e){if(Mj(e,":")<2)return{host:e,isIPV6:!1};let t=Nj(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Mj(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Dj(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var Aj={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},qj=/[@/?#:]/g,Zj=/[@/?#]/g;function vw(e,t){let r=t?Zj:qj;return r.lastIndex=0,e.replace(r,n=>Aj[n])}function Lj(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(np(o)){let i=o.toUpperCase(),s=String.fromCharCode(parseInt(i,16));t&&yw(s)?r+=s:r+="%"+i,n+=2;continue}}r+=e[n]}return r}function Fj(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(np(n)){let o=n.toUpperCase(),i=String.fromCharCode(parseInt(o,16));i!=="."&&yw(i)?t+=i:t+="%"+o,r+=2;continue}}Cj(e[r])?t+=e[r]:t+=escape(e[r])}return t}function Uj(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(np(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Vj(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!gw(r)){let n=_w(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=vw(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}bw.exports={nonSimpleDomain:jj,recomposeAuthority:Vj,reescapeHostDelimiters:vw,normalizePercentEncoding:Lj,normalizePathEncoding:Fj,escapePreservingEscapes:Uj,removeDotSegments:Dj,isIPv4:gw,isUUID:Oj,normalizeIPv6:_w,stringArrayToHexStripped:op}});var kw=k((w9,Sw)=>{"use strict";var{isUUID:Hj}=ip(),Bj=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Wj=["http","https","ws","wss","urn","urn:uuid"];function Jj(e){return Wj.indexOf(e)!==-1}function sp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function ww(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function xw(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Gj(e){return e.secure=sp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Kj(e){if((e.port===(sp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Xj(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Bj);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=ap(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Yj(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=ap(o);i&&(e=i.serialize(e,t));let s=e,a=e.nss;return s.path=`${n||t.nid}:${a}`,t.skipEscape=!0,s}function Qj(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Hj(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function eI(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var $w={scheme:"http",domainHost:!0,parse:ww,serialize:xw},tI={scheme:"https",domainHost:$w.domainHost,parse:ww,serialize:xw},hc={scheme:"ws",domainHost:!0,parse:Gj,serialize:Kj},rI={scheme:"wss",domainHost:hc.domainHost,parse:hc.parse,serialize:hc.serialize},nI={scheme:"urn",parse:Xj,serialize:Yj,skipNormalize:!0},oI={scheme:"urn:uuid",parse:Qj,serialize:eI,skipNormalize:!0},gc={http:$w,https:tI,ws:hc,wss:rI,urn:nI,"urn:uuid":oI};Object.setPrototypeOf(gc,null);function ap(e){return e&&(gc[e]||gc[e.toLowerCase()])||void 0}Sw.exports={wsIsSecure:sp,SCHEMES:gc,isValidSchemeName:Jj,getSchemeHandler:ap}});var Ow=k((x9,yc)=>{"use strict";var{normalizeIPv6:iI,removeDotSegments:ms,recomposeAuthority:sI,normalizePercentEncoding:aI,normalizePathEncoding:cI,escapePreservingEscapes:uI,reescapeHostDelimiters:lI,isIPv4:dI,nonSimpleDomain:fI}=ip(),{SCHEMES:pI,getSchemeHandler:Tw}=kw();function mI(e,t){return typeof e=="string"?e=vI(e,t):typeof e=="object"&&(e=Zo(Yn(e,t),t)),e}function hI(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Rw(Zo(e,n),Zo(t,n),n,!0);return n.skipEscape=!0,Yn(o,n)}function Rw(e,t,r,n){let o={};return n||(e=Zo(Yn(e,r),r),t=Zo(Yn(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ms(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ms(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=ms(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=ms(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function gI(e,t,r){let n=Pw(e,r),o=Pw(t,r);return n!==void 0&&o!==void 0&&n.toLowerCase()===o.toLowerCase()}function Yn(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],i=Tw(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=aI(r.path):(r.path=uI(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=sI(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=ms(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var yI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function _I(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function zw(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,i=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let s=e.match(yI);if(s){n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]);let a=_I(n,s);if(a!==void 0&&(n.error=n.error||a,o=!0),n.host)if(dI(n.host)===!1){let l=iI(n.host);n.host=l.host.toLowerCase(),i=l.isIPV6}else i=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=Tw(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&i===!1&&fI(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(u){n.error=n.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=lI(unescape(n.host),i))),n.path&&(n.path=cI(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function Zo(e,t){return zw(e,t).parsed}function vI(e,t){return Ew(e,t).normalized}function Ew(e,t){let{parsed:r,malformedAuthorityOrPort:n}=zw(e,t);return{normalized:n?e:Yn(r,t),malformedAuthorityOrPort:n}}function Pw(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:n}=Ew(e,t);return n?void 0:r}if(typeof e=="object")return Yn(e,t)}var cp={SCHEMES:pI,normalize:mI,resolve:hI,resolveComponent:Rw,equal:gI,serialize:Yn,parse:Zo};yc.exports=cp;yc.exports.default=cp;yc.exports.fastUri=cp});var jw=k(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});var Cw=Ow();Cw.code='require("ajv/dist/runtime/uri").default';up.default=Cw});var Lw=k(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.CodeGen=tt.Name=tt.nil=tt.stringify=tt.str=tt._=tt.KeywordCxt=void 0;var bI=fs();Object.defineProperty(tt,"KeywordCxt",{enumerable:!0,get:function(){return bI.KeywordCxt}});var Lo=Q();Object.defineProperty(tt,"_",{enumerable:!0,get:function(){return Lo._}});Object.defineProperty(tt,"str",{enumerable:!0,get:function(){return Lo.str}});Object.defineProperty(tt,"stringify",{enumerable:!0,get:function(){return Lo.stringify}});Object.defineProperty(tt,"nil",{enumerable:!0,get:function(){return Lo.nil}});Object.defineProperty(tt,"Name",{enumerable:!0,get:function(){return Lo.Name}});Object.defineProperty(tt,"CodeGen",{enumerable:!0,get:function(){return Lo.CodeGen}});var wI=fc(),Aw=ps(),xI=Df(),hs=mc(),$I=Q(),gs=us(),_c=cs(),dp=ce(),Iw=mw(),SI=jw(),qw=(e,t)=>new RegExp(e,t);qw.code="new RegExp";var kI=["removeAdditional","useDefaults","coerceTypes"],PI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),TI={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."},RI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Nw=200;function zI(e){var t,r,n,o,i,s,a,c,u,l,d,h,m,p,y,v,P,T,z,M,C,Ie,de,mt,vn;let Ar=e.strict,lo=(t=e.code)===null||t===void 0?void 0:t.optimize,bi=lo===!0||lo===void 0?1:lo||0,wi=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:qw,ir=(o=e.uriResolver)!==null&&o!==void 0?o:SI.default;return{strictSchema:(s=(i=e.strictSchema)!==null&&i!==void 0?i:Ar)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Ar)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ar)!==null&&l!==void 0?l:"log",strictTuples:(h=(d=e.strictTuples)!==null&&d!==void 0?d:Ar)!==null&&h!==void 0?h:"log",strictRequired:(p=(m=e.strictRequired)!==null&&m!==void 0?m:Ar)!==null&&p!==void 0?p:!1,code:e.code?{...e.code,optimize:bi,regExp:wi}:{optimize:bi,regExp:wi},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:Nw,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:Nw,meta:(P=e.meta)!==null&&P!==void 0?P:!0,messages:(T=e.messages)!==null&&T!==void 0?T:!0,inlineRefs:(z=e.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(M=e.schemaId)!==null&&M!==void 0?M:"$id",addUsedSchema:(C=e.addUsedSchema)!==null&&C!==void 0?C:!0,validateSchema:(Ie=e.validateSchema)!==null&&Ie!==void 0?Ie:!0,validateFormats:(de=e.validateFormats)!==null&&de!==void 0?de:!0,unicodeRegExp:(mt=e.unicodeRegExp)!==null&&mt!==void 0?mt:!0,int32range:(vn=e.int32range)!==null&&vn!==void 0?vn:!0,uriResolver:ir}}var ys=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...zI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new $I.ValueScope({scope:{},prefixes:PI,es5:r,lines:n}),this.logger=NI(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,xI.getRules)(),Mw.call(this,TI,t,"NOT SUPPORTED"),Mw.call(this,RI,t,"DEPRECATED","warn"),this._metaOpts=jI.call(this),t.formats&&OI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&CI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),EI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Iw;n==="id"&&(o={...Iw},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let h=this._addSchema(l,d);return h.validate||s.call(this,h)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Aw.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.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 i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let s of t)this.addSchema(s,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:s}=this.opts;if(i=t[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,gs.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=Dw.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new hs.SchemaEnv({schema:{},schemaId:n});if(r=hs.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Dw.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,gs.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(DI.call(this,n,r),!r)return(0,dp.eachItem)(n,i=>lp.call(this,i)),this;qI.call(this,r);let o={...r,type:(0,_c.getJSONTypes)(r.type),schemaType:(0,_c.getJSONTypes)(r.schemaType)};return(0,dp.eachItem)(n,o.type.length===0?i=>lp.call(this,i,o):i=>o.type.forEach(s=>lp.call(this,i,o,s))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),s=t;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=Zw(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof t=="object")s=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,gs.normalizeId)(s||n);let u=gs.getSchemaRefs.call(this,t,n);return c=new hs.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):hs.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{hs.compileSchema.call(this,t)}finally{this.opts=r}}};ys.ValidationError=wI.default;ys.MissingRefError=Aw.default;tt.default=ys;function Mw(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function Dw(e){return e=(0,gs.normalizeId)(e),this.schemas[e]||this.refs[e]}function EI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function OI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function CI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function jI(){let e={...this.opts};for(let t of kI)delete e[t];return e}var II={log(){},warn(){},error(){}};function NI(e){if(e===!1)return II;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var MI=/^[a-z_$][a-z0-9_$:-]*$/i;function DI(e,t){let{RULES:r}=this;if((0,dp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!MI.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function lp(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,_c.getJSONTypes)(t.type),schemaType:(0,_c.getJSONTypes)(t.schemaType)}};t.before?AI.call(this,s,a,t.before):s.rules.push(a),i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function AI(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function qI(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Zw(t)),e.validateSchema=this.compile(t,!0))}var ZI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Zw(e){return{anyOf:[e,ZI]}}});var Fw=k(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var LI={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};fp.default=LI});var Bw=k(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.callRef=Qn.getValidate=void 0;var FI=ps(),Uw=Ft(),Pt=Q(),Fo=Rr(),Vw=mc(),vc=ce(),UI={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Vw.resolveRef.call(c,u,o,r);if(l===void 0)throw new FI.default(n.opts.uriResolver,o,r);if(l instanceof Vw.SchemaEnv)return h(l);return m(l);function d(){if(i===u)return bc(e,s,i,i.$async);let p=t.scopeValue("root",{ref:u});return bc(e,(0,Pt._)`${p}.validate`,u,u.$async)}function h(p){let y=Hw(e,p);bc(e,y,p,p.$async)}function m(p){let y=t.scopeValue("schema",a.code.source===!0?{ref:p,code:(0,Pt.stringify)(p)}:{ref:p}),v=t.name("valid"),P=e.subschema({schema:p,dataTypes:[],schemaPath:Pt.nil,topSchemaRef:y,errSchemaPath:r},v);e.mergeEvaluated(P),e.ok(v)}}};function Hw(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Pt._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Qn.getValidate=Hw;function bc(e,t,r,n){let{gen:o,it:i}=e,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Fo.default.this:Pt.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{o.code((0,Pt._)`await ${(0,Uw.callValidateCode)(e,t,u)}`),m(t),s||o.assign(p,!0)},y=>{o.if((0,Pt._)`!(${y} instanceof ${i.ValidationError})`,()=>o.throw(y)),h(y),s||o.assign(p,!1)}),e.ok(p)}function d(){e.result((0,Uw.callValidateCode)(e,t,u),()=>m(t),()=>h(t))}function h(p){let y=(0,Pt._)`${p}.errors`;o.assign(Fo.default.vErrors,(0,Pt._)`${Fo.default.vErrors} === null ? ${y} : ${Fo.default.vErrors}.concat(${y})`),o.assign(Fo.default.errors,(0,Pt._)`${Fo.default.vErrors}.length`)}function m(p){var y;if(!i.opts.unevaluated)return;let v=(y=r?.validate)===null||y===void 0?void 0:y.evaluated;if(i.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(i.props=vc.mergeEvaluated.props(o,v.props,i.props));else{let P=o.var("props",(0,Pt._)`${p}.evaluated.props`);i.props=vc.mergeEvaluated.props(o,P,i.props,Pt.Name)}if(i.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(i.items=vc.mergeEvaluated.items(o,v.items,i.items));else{let P=o.var("items",(0,Pt._)`${p}.evaluated.items`);i.items=vc.mergeEvaluated.items(o,P,i.items,Pt.Name)}}}Qn.callRef=bc;Qn.default=UI});var Ww=k(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var VI=Fw(),HI=Bw(),BI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",VI.default,HI.default];pp.default=BI});var Jw=k(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var wc=Q(),nn=wc.operators,xc={maximum:{okStr:"<=",ok:nn.LTE,fail:nn.GT},minimum:{okStr:">=",ok:nn.GTE,fail:nn.LT},exclusiveMaximum:{okStr:"<",ok:nn.LT,fail:nn.GTE},exclusiveMinimum:{okStr:">",ok:nn.GT,fail:nn.LTE}},WI={message:({keyword:e,schemaCode:t})=>(0,wc.str)`must be ${xc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,wc._)`{comparison: ${xc[e].okStr}, limit: ${t}}`},JI={keyword:Object.keys(xc),type:"number",schemaType:"number",$data:!0,error:WI,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,wc._)`${r} ${xc[t].fail} ${n} || isNaN(${r})`)}};mp.default=JI});var Gw=k(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var _s=Q(),GI={message:({schemaCode:e})=>(0,_s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,_s._)`{multipleOf: ${e}}`},KI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:GI,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,s=t.let("res"),a=i?(0,_s._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,_s._)`${s} !== parseInt(${s})`;e.fail$data((0,_s._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};hp.default=KI});var Xw=k(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});function Kw(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}gp.default=Kw;Kw.code='require("ajv/dist/runtime/ucs2length").default'});var Yw=k(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var eo=Q(),XI=ce(),YI=Xw(),QI={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,eo.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,eo._)`{limit: ${e}}`},eN={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:QI,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?eo.operators.GT:eo.operators.LT,s=o.opts.unicode===!1?(0,eo._)`${r}.length`:(0,eo._)`${(0,XI.useFunc)(e.gen,YI.default)}(${r})`;e.fail$data((0,eo._)`${s} ${i} ${n}`)}};yp.default=eN});var Qw=k(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var tN=Ft(),rN=ce(),Uo=Q(),nN={message:({schemaCode:e})=>(0,Uo.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Uo._)`{pattern: ${e}}`},oN={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:nN,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?(0,Uo._)`new RegExp`:(0,rN.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,Uo._)`${u}(${i}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,Uo._)`!${l}`)}else{let c=(0,tN.usePattern)(e,o);e.fail$data((0,Uo._)`!${c}.test(${r})`)}}};_p.default=oN});var ex=k(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});var vs=Q(),iN={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,vs.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,vs._)`{limit: ${e}}`},sN={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:iN,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?vs.operators.GT:vs.operators.LT;e.fail$data((0,vs._)`Object.keys(${r}).length ${o} ${n}`)}};vp.default=sN});var tx=k(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var bs=Ft(),ws=Q(),aN=ce(),cN={message:({params:{missingProperty:e}})=>(0,ws.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ws._)`{missingProperty: ${e}}`},uN={keyword:"required",type:"object",schemaType:"array",$data:!0,error:cN,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:s}=e,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let m=e.parentSchema.properties,{definedProperties:p}=e.it;for(let y of r)if(m?.[y]===void 0&&!p.has(y)){let v=s.schemaEnv.baseId+s.errSchemaPath,P=`required property "${y}" is not defined at "${v}" (strictRequired)`;(0,aN.checkStrictMode)(s,P,s.opts.strictRequired)}}function u(){if(c||i)e.block$data(ws.nil,d);else for(let m of r)(0,bs.checkReportMissingProp)(e,m)}function l(){let m=t.let("missing");if(c||i){let p=t.let("valid",!0);e.block$data(p,()=>h(m,p)),e.ok(p)}else t.if((0,bs.checkMissingProp)(e,r,m)),(0,bs.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m}),t.if((0,bs.noPropertyInData)(t,o,m,a.ownProperties),()=>e.error())})}function h(m,p){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(p,(0,bs.propertyInData)(t,o,m,a.ownProperties)),t.if((0,ws.not)(p),()=>{e.error(),t.break()})},ws.nil)}}};bp.default=uN});var rx=k(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});var xs=Q(),lN={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,xs.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,xs._)`{limit: ${e}}`},dN={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:lN,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?xs.operators.GT:xs.operators.LT;e.fail$data((0,xs._)`${r}.length ${o} ${n}`)}};wp.default=dN});var $c=k(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var nx=Hf();nx.code='require("ajv/dist/runtime/equal").default';xp.default=nx});var ox=k(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var $p=cs(),rt=Q(),fN=ce(),pN=$c(),mN={message:({params:{i:e,j:t}})=>(0,rt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,rt._)`{i: ${e}, j: ${t}}`},hN={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mN,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,$p.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,rt._)`${s} === false`),e.ok(c);function l(){let p=t.let("i",(0,rt._)`${r}.length`),y=t.let("j");e.setParams({i:p,j:y}),t.assign(c,!0),t.if((0,rt._)`${p} > 1`,()=>(d()?h:m)(p,y))}function d(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function h(p,y){let v=t.name("item"),P=(0,$p.checkDataTypes)(u,v,a.opts.strictNumbers,$p.DataType.Wrong),T=t.const("indices",(0,rt._)`{}`);t.for((0,rt._)`;${p}--;`,()=>{t.let(v,(0,rt._)`${r}[${p}]`),t.if(P,(0,rt._)`continue`),u.length>1&&t.if((0,rt._)`typeof ${v} == "string"`,(0,rt._)`${v} += "_"`),t.if((0,rt._)`typeof ${T}[${v}] == "number"`,()=>{t.assign(y,(0,rt._)`${T}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,rt._)`${T}[${v}] = ${p}`)})}function m(p,y){let v=(0,fN.useFunc)(t,pN.default),P=t.name("outer");t.label(P).for((0,rt._)`;${p}--;`,()=>t.for((0,rt._)`${y} = ${p}; ${y}--;`,()=>t.if((0,rt._)`${v}(${r}[${p}], ${r}[${y}])`,()=>{e.error(),t.assign(c,!1).break(P)})))}}};Sp.default=hN});var ix=k(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var kp=Q(),gN=ce(),yN=$c(),_N={message:"must be equal to constant",params:({schemaCode:e})=>(0,kp._)`{allowedValue: ${e}}`},vN={keyword:"const",$data:!0,error:_N,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,kp._)`!${(0,gN.useFunc)(t,yN.default)}(${r}, ${o})`):e.fail((0,kp._)`${i} !== ${r}`)}};Pp.default=vN});var sx=k(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var $s=Q(),bN=ce(),wN=$c(),xN={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,$s._)`{allowedValues: ${e}}`},$N={keyword:"enum",schemaType:"array",$data:!0,error:xN,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:s}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,bN.useFunc)(t,wN.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=t.const("vSchema",i);l=(0,$s.or)(...o.map((p,y)=>h(m,y)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,m=>t.if((0,$s._)`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function h(m,p){let y=o[p];return typeof y=="object"&&y!==null?(0,$s._)`${u()}(${r}, ${m}[${p}])`:(0,$s._)`${r} === ${y}`}}};Tp.default=$N});var ax=k(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var SN=Jw(),kN=Gw(),PN=Yw(),TN=Qw(),RN=ex(),zN=tx(),EN=rx(),ON=ox(),CN=ix(),jN=sx(),IN=[SN.default,kN.default,PN.default,TN.default,RN.default,zN.default,EN.default,ON.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CN.default,jN.default];Rp.default=IN});var Ep=k(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.validateAdditionalItems=void 0;var to=Q(),zp=ce(),NN={message:({params:{len:e}})=>(0,to.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,to._)`{limit: ${e}}`},MN={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:NN,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,zp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}cx(e,n)}};function cx(e,t){let{gen:r,schema:n,data:o,keyword:i,it:s}=e;s.items=!0;let a=r.const("len",(0,to._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,to._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,zp.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,to._)`${a} <= ${t.length}`);r.if((0,to.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:zp.Type.Num},u),s.allErrors||r.if((0,to.not)(u),()=>r.break())})}}Ss.validateAdditionalItems=cx;Ss.default=MN});var Op=k(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.validateTuple=void 0;var ux=Q(),Sc=ce(),DN=Ft(),AN={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return lx(e,"additionalItems",t);r.items=!0,!(0,Sc.alwaysValidSchema)(r,t)&&e.ok((0,DN.validateArray)(e))}};function lx(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Sc.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,ux._)`${i}.length`);r.forEach((d,h)=>{(0,Sc.alwaysValidSchema)(a,d)||(n.if((0,ux._)`${u} > ${h}`,()=>e.subschema({keyword:s,schemaProp:h,dataProp:h},c)),e.ok(c))});function l(d){let{opts:h,errSchemaPath:m}=a,p=r.length,y=p===d.minItems&&(p===d.maxItems||d[t]===!1);if(h.strictTuples&&!y){let v=`"${s}" is ${p}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,Sc.checkStrictMode)(a,v,h.strictTuples)}}}ks.validateTuple=lx;ks.default=AN});var dx=k(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var qN=Op(),ZN={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,qN.validateTuple)(e,"items")};Cp.default=ZN});var px=k(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var fx=Q(),LN=ce(),FN=Ft(),UN=Ep(),VN={message:({params:{len:e}})=>(0,fx.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,fx._)`{limit: ${e}}`},HN={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:VN,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,LN.alwaysValidSchema)(n,t)&&(o?(0,UN.validateAdditionalItems)(e,o):e.ok((0,FN.validateArray)(e)))}};jp.default=HN});var mx=k(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var Vt=Q(),kc=ce(),BN={message:({params:{min:e,max:t}})=>t===void 0?(0,Vt.str)`must contain at least ${e} valid item(s)`:(0,Vt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Vt._)`{minContains: ${e}}`:(0,Vt._)`{minContains: ${e}, maxContains: ${t}}`},WN={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:BN,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=t.const("len",(0,Vt._)`${o}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,kc.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,kc.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,kc.alwaysValidSchema)(i,r)){let y=(0,Vt._)`${l} >= ${s}`;a!==void 0&&(y=(0,Vt._)`${y} && ${l} <= ${a}`),e.pass(y);return}i.items=!0;let d=t.name("valid");a===void 0&&s===1?m(d,()=>t.if(d,()=>t.break())):s===0?(t.let(d,!0),a!==void 0&&t.if((0,Vt._)`${o}.length > 0`,h)):(t.let(d,!1),h()),e.result(d,()=>e.reset());function h(){let y=t.name("_valid"),v=t.let("count",0);m(y,()=>t.if(y,()=>p(v)))}function m(y,v){t.forRange("i",0,l,P=>{e.subschema({keyword:"contains",dataProp:P,dataPropType:kc.Type.Num,compositeRule:!0},y),v()})}function p(y){t.code((0,Vt._)`${y}++`),a===void 0?t.if((0,Vt._)`${y} >= ${s}`,()=>t.assign(d,!0).break()):(t.if((0,Vt._)`${y} > ${a}`,()=>t.assign(d,!1).break()),s===1?t.assign(d,!0):t.if((0,Vt._)`${y} >= ${s}`,()=>t.assign(d,!0)))}}};Ip.default=WN});var yx=k(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.validateSchemaDeps=pr.validatePropertyDeps=pr.error=void 0;var Np=Q(),JN=ce(),Ps=Ft();pr.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Np.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Np._)`{property: ${e},
|
|
7
|
+
|| ${s} === "boolean" || ${o} === null`).assign(a,(0,X._)`[${o}]`)}}}function gC({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,X._)`${t} !== undefined`,()=>e.assign((0,X._)`${t}[${r}]`,n))}function qf(e,t,r,n=Io.Correct){let o=n===Io.Correct?X.operators.EQ:X.operators.NEQ,i;switch(e){case"null":return(0,X._)`${t} ${o} null`;case"array":i=(0,X._)`Array.isArray(${t})`;break;case"object":i=(0,X._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=s((0,X._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=s();break;default:return(0,X._)`typeof ${t} ${o} ${e}`}return n===Io.Correct?i:(0,X.not)(i);function s(a=X.nil){return(0,X.and)((0,X._)`typeof ${t} == "number"`,a,r?(0,X._)`isFinite(${t})`:X.nil)}}at.checkDataType=qf;function Zf(e,t,r,n){if(e.length===1)return qf(e[0],t,r,n);let o,i=(0,Mb.toHash)(e);if(i.array&&i.object){let s=(0,X._)`typeof ${t} != "object"`;o=i.null?s:(0,X._)`!${t} || ${s}`,delete i.null,delete i.array,delete i.object}else o=X.nil;i.number&&delete i.integer;for(let s in i)o=(0,X.and)(o,qf(s,t,r,n));return o}at.checkDataTypes=Zf;var yC={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,X._)`{type: ${e}}`:(0,X._)`{type: ${t}}`};function Lf(e){let t=_C(e);(0,dC.reportError)(t,yC)}at.reportTypeError=Lf;function _C(e){let{gen:t,data:r,schema:n}=e,o=(0,Mb.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Ab=k(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});cc.assignDefaults=void 0;var Do=Q(),vC=ce();function bC(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Db(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Db(e,i,o.default))}cc.assignDefaults=bC;function Db(e,t,r){let{gen:n,compositeRule:o,data:i,opts:s}=e;if(r===void 0)return;let a=(0,Do._)`${i}${(0,Do.getProperty)(t)}`;if(o){(0,vC.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,Do._)`${a} === undefined`;s.useDefaults==="empty"&&(c=(0,Do._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Do._)`${a} = ${(0,Do.stringify)(r)}`)}});var Ft=k(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.validateUnion=ye.validateArray=ye.usePattern=ye.callValidateCode=ye.schemaProperties=ye.allSchemaProperties=ye.noPropertyInData=ye.propertyInData=ye.isOwnProperty=ye.hasPropFunc=ye.reportMissingProp=ye.checkMissingProp=ye.checkReportMissingProp=void 0;var Pe=Q(),Ff=ce(),Qr=zr(),wC=ce();function xC(e,t){let{gen:r,data:n,it:o}=e;r.if(Vf(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Pe._)`${t}`},!0),e.error()})}ye.checkReportMissingProp=xC;function $C({gen:e,data:t,it:{opts:r}},n,o){return(0,Pe.or)(...n.map(i=>(0,Pe.and)(Vf(e,t,i,r.ownProperties),(0,Pe._)`${o} = ${i}`)))}ye.checkMissingProp=$C;function SC(e,t){e.setParams({missingProperty:t},!0),e.error()}ye.reportMissingProp=SC;function qb(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Pe._)`Object.prototype.hasOwnProperty`})}ye.hasPropFunc=qb;function Uf(e,t,r){return(0,Pe._)`${qb(e)}.call(${t}, ${r})`}ye.isOwnProperty=Uf;function kC(e,t,r,n){let o=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} !== undefined`;return n?(0,Pe._)`${o} && ${Uf(e,t,r)}`:o}ye.propertyInData=kC;function Vf(e,t,r,n){let o=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} === undefined`;return n?(0,Pe.or)(o,(0,Pe.not)(Uf(e,t,r))):o}ye.noPropertyInData=Vf;function Zb(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ye.allSchemaProperties=Zb;function PC(e,t){return Zb(t).filter(r=>!(0,Ff.alwaysValidSchema)(e,t[r]))}ye.schemaProperties=PC;function TC({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:s},a,c,u){let l=u?(0,Pe._)`${e}, ${t}, ${n}${o}`:t,d=[[Qr.default.instancePath,(0,Pe.strConcat)(Qr.default.instancePath,i)],[Qr.default.parentData,s.parentData],[Qr.default.parentDataProperty,s.parentDataProperty],[Qr.default.rootData,Qr.default.rootData]];s.opts.dynamicRef&&d.push([Qr.default.dynamicAnchors,Qr.default.dynamicAnchors]);let h=(0,Pe._)`${l}, ${r.object(...d)}`;return c!==Pe.nil?(0,Pe._)`${a}.call(${c}, ${h})`:(0,Pe._)`${a}(${h})`}ye.callValidateCode=TC;var zC=(0,Pe._)`new RegExp`;function RC({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,Pe._)`${o.code==="new RegExp"?zC:(0,wC.useFunc)(e,o)}(${r}, ${n})`})}ye.usePattern=RC;function EC(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return s(()=>t.assign(a,!1)),a}return t.var(i,!0),s(()=>t.break()),i;function s(a){let c=t.const("len",(0,Pe._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Ff.Type.Num},i),t.if((0,Pe.not)(i),a)})}}ye.validateArray=EC;function OC(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ff.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let s=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(s,(0,Pe._)`${s} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,Pe.not)(s))})),e.result(s,()=>e.reset(),()=>e.error(!0))}ye.validateUnion=OC});var Ub=k(dr=>{"use strict";Object.defineProperty(dr,"__esModule",{value:!0});dr.validateKeywordUsage=dr.validSchemaType=dr.funcKeywordCode=dr.macroKeywordCode=void 0;var _t=Q(),Kn=zr(),CC=Ft(),jC=as();function MC(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:s}=e,a=t.macro.call(s.self,o,i,s),c=Fb(r,n,a);s.opts.validateSchema!==!1&&s.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:_t.nil,errSchemaPath:`${s.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}dr.macroKeywordCode=MC;function NC(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:s,$data:a,it:c}=e;DC(c,t);let u=!a&&t.compile?t.compile.call(c.self,i,s,c):t.validate,l=Fb(n,o,u),d=n.let("valid");e.block$data(d,h),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function h(){if(t.errors===!1)y(),t.modifying&&Lb(e),v(()=>e.error());else{let P=t.async?m():p();t.modifying&&Lb(e),v(()=>IC(e,P))}}function m(){let P=n.let("ruleErrs",null);return n.try(()=>y((0,_t._)`await `),T=>n.assign(d,!1).if((0,_t._)`${T} instanceof ${c.ValidationError}`,()=>n.assign(P,(0,_t._)`${T}.errors`),()=>n.throw(T))),P}function p(){let P=(0,_t._)`${l}.errors`;return n.assign(P,null),y(_t.nil),P}function y(P=t.async?(0,_t._)`await `:_t.nil){let T=c.opts.passContext?Kn.default.this:Kn.default.self,R=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,_t._)`${P}${(0,CC.callValidateCode)(e,l,T,R)}`,t.modifying)}function v(P){var T;n.if((0,_t.not)((T=t.valid)!==null&&T!==void 0?T:d),P)}}dr.funcKeywordCode=NC;function Lb(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,_t._)`${n.parentData}[${n.parentDataProperty}]`))}function IC(e,t){let{gen:r}=e;r.if((0,_t._)`Array.isArray(${t})`,()=>{r.assign(Kn.default.vErrors,(0,_t._)`${Kn.default.vErrors} === null ? ${t} : ${Kn.default.vErrors}.concat(${t})`).assign(Kn.default.errors,(0,_t._)`${Kn.default.vErrors}.length`),(0,jC.extendErrors)(e)},()=>e.error())}function DC({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Fb(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,_t.stringify)(r)})}function AC(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}dr.validSchemaType=AC;function qC({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let s=o.dependencies;if(s?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}dr.validateKeywordUsage=qC});var Hb=k(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.extendSubschemaMode=en.extendSubschemaData=en.getSubschema=void 0;var fr=Q(),Vb=ce();function ZC(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:s}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,fr._)`${e.schemaPath}${(0,fr.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,fr._)`${e.schemaPath}${(0,fr.getProperty)(t)}${(0,fr.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Vb.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||s===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:s,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}en.getSubschema=ZC;function LC(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:s}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,h=a.let("data",(0,fr._)`${t.data}${(0,fr.getProperty)(r)}`,!0);c(h),e.errorPath=(0,fr.str)`${u}${(0,Vb.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,fr._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof fr.Name?o:a.let("data",o,!0);c(u),s!==void 0&&(e.propertyName=s)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}en.extendSubschemaData=LC;function FC(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}en.extendSubschemaMode=FC});var Hf=k((f9,Bb)=>{"use strict";Bb.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!==t&&r!==r}});var Jb=k((p9,Wb)=>{"use strict";var tn=Wb.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};uc(t,n,o,e,"",e)};tn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};tn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};tn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};tn.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 uc(e,t,r,n,o,i,s,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,s,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in tn.arrayKeywords)for(var h=0;h<d.length;h++)uc(e,t,r,d[h],o+"/"+l+"/"+h,i,o,l,n,h)}else if(l in tn.propsKeywords){if(d&&typeof d=="object")for(var m in d)uc(e,t,r,d[m],o+"/"+l+"/"+UC(m),i,o,l,n,m)}else(l in tn.keywords||e.allKeys&&!(l in tn.skipKeywords))&&uc(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,s,a,c,u)}}function UC(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var us=k(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.getSchemaRefs=kt.resolveUrl=kt.normalizeId=kt._getFullPath=kt.getFullPath=kt.inlineRef=void 0;var VC=ce(),HC=Hf(),BC=Jb(),WC=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function JC(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Bf(e):t?Gb(e)<=t:!1}kt.inlineRef=JC;var GC=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Bf(e){for(let t in e){if(GC.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Bf)||typeof r=="object"&&Bf(r))return!0}return!1}function Gb(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!WC.has(r)&&(typeof e[r]=="object"&&(0,VC.eachItem)(e[r],n=>t+=Gb(n)),t===1/0))return 1/0}return t}function Kb(e,t="",r){r!==!1&&(t=Ao(t));let n=e.parse(t);return Xb(e,n)}kt.getFullPath=Kb;function Xb(e,t){return e.serialize(t).split("#")[0]+"#"}kt._getFullPath=Xb;var KC=/#\/?$/;function Ao(e){return e?e.replace(KC,""):""}kt.normalizeId=Ao;function XC(e,t,r){return r=Ao(r),e.resolve(t,r)}kt.resolveUrl=XC;var YC=/^[a-z_][-a-z0-9._]*$/i;function QC(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ao(e[r]||t),i={"":o},s=Kb(n,o,!1),a={},c=new Set;return BC(e,{allKeys:!0},(d,h,m,p)=>{if(p===void 0)return;let y=s+h,v=i[p];typeof d[r]=="string"&&(v=P.call(this,d[r])),T.call(this,d.$anchor),T.call(this,d.$dynamicAnchor),i[h]=v;function P(R){let I=this.opts.uriResolver.resolve;if(R=Ao(v?I(v,R):R),c.has(R))throw l(R);c.add(R);let C=this.refs[R];return typeof C=="string"&&(C=this.refs[C]),typeof C=="object"?u(d,C.schema,R):R!==Ao(y)&&(R[0]==="#"?(u(d,a[R],R),a[R]=d):this.refs[R]=y),R}function T(R){if(typeof R=="string"){if(!YC.test(R))throw new Error(`invalid anchor "${R}"`);P.call(this,`#${R}`)}}}),a;function u(d,h,m){if(h!==void 0&&!HC(d,h))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}kt.getSchemaRefs=QC});var fs=k(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.getData=rn.KeywordCxt=rn.validateFunctionCode=void 0;var rw=Ob(),Yb=cs(),Jf=Af(),lc=cs(),ej=Ab(),ds=Ub(),Wf=Hb(),F=Q(),J=zr(),tj=us(),Rr=ce(),ls=as();function rj(e){if(iw(e)&&(sw(e),ow(e))){ij(e);return}nw(e,()=>(0,rw.topBoolOrEmptySchema)(e))}rn.validateFunctionCode=rj;function nw({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,F._)`${J.default.data}, ${J.default.valCxt}`,n.$async,()=>{e.code((0,F._)`"use strict"; ${Qb(r,o)}`),oj(e,o),e.code(i)}):e.func(t,(0,F._)`${J.default.data}, ${nj(o)}`,n.$async,()=>e.code(Qb(r,o)).code(i))}function nj(e){return(0,F._)`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${e.dynamicRef?(0,F._)`, ${J.default.dynamicAnchors}={}`:F.nil}}={}`}function oj(e,t){e.if(J.default.valCxt,()=>{e.var(J.default.instancePath,(0,F._)`${J.default.valCxt}.${J.default.instancePath}`),e.var(J.default.parentData,(0,F._)`${J.default.valCxt}.${J.default.parentData}`),e.var(J.default.parentDataProperty,(0,F._)`${J.default.valCxt}.${J.default.parentDataProperty}`),e.var(J.default.rootData,(0,F._)`${J.default.valCxt}.${J.default.rootData}`),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,F._)`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{e.var(J.default.instancePath,(0,F._)`""`),e.var(J.default.parentData,(0,F._)`undefined`),e.var(J.default.parentDataProperty,(0,F._)`undefined`),e.var(J.default.rootData,J.default.data),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,F._)`{}`)})}function ij(e){let{schema:t,opts:r,gen:n}=e;nw(e,()=>{r.$comment&&t.$comment&&cw(e),lj(e),n.let(J.default.vErrors,null),n.let(J.default.errors,0),r.unevaluated&&sj(e),aw(e),pj(e)})}function sj(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,F._)`${r}.evaluated`),t.if((0,F._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,F._)`${e.evaluated}.props`,(0,F._)`undefined`)),t.if((0,F._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,F._)`${e.evaluated}.items`,(0,F._)`undefined`))}function Qb(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,F._)`/*# sourceURL=${r} */`:F.nil}function aj(e,t){if(iw(e)&&(sw(e),ow(e))){cj(e,t);return}(0,rw.boolOrEmptySchema)(e,t)}function ow({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function iw(e){return typeof e.schema!="boolean"}function cj(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&cw(e),dj(e),fj(e);let i=n.const("_errs",J.default.errors);aw(e,i),n.var(t,(0,F._)`${i} === ${J.default.errors}`)}function sw(e){(0,Rr.checkUnknownRules)(e),uj(e)}function aw(e,t){if(e.opts.jtd)return ew(e,[],!1,t);let r=(0,Yb.getSchemaTypes)(e.schema),n=(0,Yb.coerceAndCheckDataType)(e,r);ew(e,r,!n,t)}function uj(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Rr.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function lj(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Rr.checkStrictMode)(e,"default is ignored in the schema root")}function dj(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,tj.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function fj(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function cw({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,F._)`${J.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let s=(0,F.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,F._)`${J.default.self}.opts.$comment(${i}, ${s}, ${a}.schema)`)}}function pj(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,F._)`${J.default.errors} === 0`,()=>t.return(J.default.data),()=>t.throw((0,F._)`new ${o}(${J.default.vErrors})`)):(t.assign((0,F._)`${n}.errors`,J.default.vErrors),i.unevaluated&&mj(e),t.return((0,F._)`${J.default.errors} === 0`))}function mj({gen:e,evaluated:t,props:r,items:n}){r instanceof F.Name&&e.assign((0,F._)`${t}.props`,r),n instanceof F.Name&&e.assign((0,F._)`${t}.items`,n)}function ew(e,t,r,n){let{gen:o,schema:i,data:s,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Rr.schemaHasRulesButRef)(i,l))){o.block(()=>lw(e,"$ref",l.all.$ref.definition));return}c.jtd||hj(e,t),o.block(()=>{for(let h of l.rules)d(h);d(l.post)});function d(h){(0,Jf.shouldUseGroup)(i,h)&&(h.type?(o.if((0,lc.checkDataType)(h.type,s,c.strictNumbers)),tw(e,h),t.length===1&&t[0]===h.type&&r&&(o.else(),(0,lc.reportTypeError)(e)),o.endIf()):tw(e,h),a||o.if((0,F._)`${J.default.errors} === ${n||0}`))}}function tw(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,ej.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,Jf.shouldUseRule)(n,i)&&lw(e,i.keyword,i.definition,t.type)})}function hj(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(gj(e,t),e.opts.allowUnionTypes||yj(e,t),_j(e,e.dataTypes))}function gj(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{uw(e.dataTypes,r)||Gf(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),bj(e,t)}}function yj(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Gf(e,"use allowUnionTypes to allow union type keyword")}function _j(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Jf.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(s=>vj(t,s))&&Gf(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function vj(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function uw(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function bj(e,t){let r=[];for(let n of e.dataTypes)uw(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Gf(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Rr.checkStrictMode)(e,t,e.opts.strictTypes)}var dc=class{constructor(t,r,n){if((0,ds.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Rr.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",dw(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,ds.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",J.default.errors))}result(t,r,n){this.failResult((0,F.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,F.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,F._)`${r} !== undefined && (${(0,F.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?ls.reportExtraError:ls.reportError)(this,this.def.error,r)}$dataError(){(0,ls.reportError)(this,this.def.$dataError||ls.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ls.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=F.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=F.nil,r=F.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:s}=this;n.if((0,F.or)((0,F._)`${o} === undefined`,r)),t!==F.nil&&n.assign(t,!0),(i.length||s.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==F.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,F.or)(s(),a());function s(){if(n.length){if(!(r instanceof F.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,F._)`${(0,lc.checkDataTypes)(c,r,i.opts.strictNumbers,lc.DataType.Wrong)}`}return F.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,F._)`!${c}(${r})`}return F.nil}}subschema(t,r){let n=(0,Wf.getSubschema)(this.it,t);(0,Wf.extendSubschemaData)(n,this.it,t),(0,Wf.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return aj(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Rr.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Rr.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,F.Name)),!0}};rn.KeywordCxt=dc;function lw(e,t,r,n){let o=new dc(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,ds.funcKeywordCode)(o,r):"macro"in r?(0,ds.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,ds.funcKeywordCode)(o,r)}var wj=/^\/(?:[^~]|~0|~1)*$/,xj=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dw(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return J.default.rootData;if(e[0]==="/"){if(!wj.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=J.default.rootData}else{let u=xj.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let s=i,a=o.split("/");for(let u of a)u&&(i=(0,F._)`${i}${(0,F.getProperty)((0,Rr.unescapeJsonPointer)(u))}`,s=(0,F._)`${s} && ${i}`);return s;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}rn.getData=dw});var fc=k(Xf=>{"use strict";Object.defineProperty(Xf,"__esModule",{value:!0});var Kf=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Xf.default=Kf});var ps=k(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});var Yf=us(),Qf=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Yf.resolveUrl)(t,r,n),this.missingSchema=(0,Yf.normalizeId)((0,Yf.getFullPath)(t,this.missingRef))}};ep.default=Qf});var mc=k(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.resolveSchema=Ut.getCompilingSchema=Ut.resolveRef=Ut.compileSchema=Ut.SchemaEnv=void 0;var Yt=Q(),$j=fc(),Xn=zr(),Qt=us(),fw=ce(),Sj=fs(),qo=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Qt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Ut.SchemaEnv=qo;function rp(e){let t=pw.call(this,e);if(t)return t;let r=(0,Qt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,s=new Yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),a;e.$async&&(a=s.scopeValue("Error",{ref:$j.default,code:(0,Yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=s.scopeName("validate");e.validateName=c;let u={gen:s,allErrors:this.opts.allErrors,data:Xn.default.data,parentData:Xn.default.parentData,parentDataProperty:Xn.default.parentDataProperty,dataNames:[Xn.default.data],dataPathArr:[Yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:s.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Sj.validateFunctionCode)(u),s.optimize(this.opts.code.optimize);let d=s.toString();l=`${s.scopeRefs(Xn.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let m=new Function(`${Xn.default.self}`,`${Xn.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:s._values}),this.opts.unevaluated){let{props:p,items:y}=u;m.evaluated={props:p instanceof Yt.Name?void 0:p,items:y instanceof Yt.Name?void 0:y,dynamicProps:p instanceof Yt.Name,dynamicItems:y instanceof Yt.Name},m.source&&(m.source.evaluated=(0,Yt.stringify)(m.evaluated))}return e.validate=m,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}Ut.compileSchema=rp;function kj(e,t,r){var n;r=(0,Qt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=zj.call(this,e,r);if(i===void 0){let s=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;s&&(i=new qo({schema:s,schemaId:a,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=Pj.call(this,i)}Ut.resolveRef=kj;function Pj(e){return(0,Qt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:rp.call(this,e)}function pw(e){for(let t of this._compilations)if(Tj(t,e))return t}Ut.getCompilingSchema=pw;function Tj(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function zj(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||pc.call(this,e,t)}function pc(e,t){let r=this.opts.uriResolver.parse(t),n=(0,Qt._getFullPath)(this.opts.uriResolver,r),o=(0,Qt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return tp.call(this,r,e);let i=(0,Qt.normalizeId)(n),s=this.refs[i]||this.schemas[i];if(typeof s=="string"){let a=pc.call(this,e,s);return typeof a?.schema!="object"?void 0:tp.call(this,r,a)}if(typeof s?.schema=="object"){if(s.validate||rp.call(this,s),i===(0,Qt.normalizeId)(t)){let{schema:a}=s,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Qt.resolveUrl)(this.opts.uriResolver,o,u)),new qo({schema:a,schemaId:c,root:e,baseId:o})}return tp.call(this,r,s)}}Ut.resolveSchema=pc;var Rj=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function tp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,fw.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Rj.has(a)&&u&&(t=(0,Qt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,fw.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Qt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=pc.call(this,n,a)}let{schemaId:s}=this.opts;if(i=i||new qo({schema:r,schemaId:s,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var mw=k((v9,Ej)=>{Ej.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 ip=k((b9,bw)=>{"use strict";var Oj=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),gw=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),np=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),yw=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Cj=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function op(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var jj=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function hw(e){return e.length=0,!0}function Mj(e,t,r){if(e.length){let n=op(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function Nj(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,s=!1,a=Mj;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(s=!0),!a(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=hw}else{o.push(u);continue}}return o.length&&(a===hw?r.zone=o.join(""):s?n.push(o.join("")):n.push(op(o))),r.address=n.join(""),r}function _w(e){if(Ij(e,":")<2)return{host:e,isIPV6:!1};let t=Nj(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Ij(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Dj(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var Aj={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},qj=/[@/?#:]/g,Zj=/[@/?#]/g;function vw(e,t){let r=t?Zj:qj;return r.lastIndex=0,e.replace(r,n=>Aj[n])}function Lj(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(np(o)){let i=o.toUpperCase(),s=String.fromCharCode(parseInt(i,16));t&&yw(s)?r+=s:r+="%"+i,n+=2;continue}}r+=e[n]}return r}function Fj(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(np(n)){let o=n.toUpperCase(),i=String.fromCharCode(parseInt(o,16));i!=="."&&yw(i)?t+=i:t+="%"+o,r+=2;continue}}Cj(e[r])?t+=e[r]:t+=escape(e[r])}return t}function Uj(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(np(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function Vj(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!gw(r)){let n=_w(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=vw(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}bw.exports={nonSimpleDomain:jj,recomposeAuthority:Vj,reescapeHostDelimiters:vw,normalizePercentEncoding:Lj,normalizePathEncoding:Fj,escapePreservingEscapes:Uj,removeDotSegments:Dj,isIPv4:gw,isUUID:Oj,normalizeIPv6:_w,stringArrayToHexStripped:op}});var kw=k((w9,Sw)=>{"use strict";var{isUUID:Hj}=ip(),Bj=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Wj=["http","https","ws","wss","urn","urn:uuid"];function Jj(e){return Wj.indexOf(e)!==-1}function sp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function ww(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function xw(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Gj(e){return e.secure=sp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Kj(e){if((e.port===(sp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Xj(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Bj);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=ap(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Yj(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=ap(o);i&&(e=i.serialize(e,t));let s=e,a=e.nss;return s.path=`${n||t.nid}:${a}`,t.skipEscape=!0,s}function Qj(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Hj(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function eM(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var $w={scheme:"http",domainHost:!0,parse:ww,serialize:xw},tM={scheme:"https",domainHost:$w.domainHost,parse:ww,serialize:xw},hc={scheme:"ws",domainHost:!0,parse:Gj,serialize:Kj},rM={scheme:"wss",domainHost:hc.domainHost,parse:hc.parse,serialize:hc.serialize},nM={scheme:"urn",parse:Xj,serialize:Yj,skipNormalize:!0},oM={scheme:"urn:uuid",parse:Qj,serialize:eM,skipNormalize:!0},gc={http:$w,https:tM,ws:hc,wss:rM,urn:nM,"urn:uuid":oM};Object.setPrototypeOf(gc,null);function ap(e){return e&&(gc[e]||gc[e.toLowerCase()])||void 0}Sw.exports={wsIsSecure:sp,SCHEMES:gc,isValidSchemeName:Jj,getSchemeHandler:ap}});var Ow=k((x9,yc)=>{"use strict";var{normalizeIPv6:iM,removeDotSegments:ms,recomposeAuthority:sM,normalizePercentEncoding:aM,normalizePathEncoding:cM,escapePreservingEscapes:uM,reescapeHostDelimiters:lM,isIPv4:dM,nonSimpleDomain:fM}=ip(),{SCHEMES:pM,getSchemeHandler:Tw}=kw();function mM(e,t){return typeof e=="string"?e=vM(e,t):typeof e=="object"&&(e=Zo(Yn(e,t),t)),e}function hM(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=zw(Zo(e,n),Zo(t,n),n,!0);return n.skipEscape=!0,Yn(o,n)}function zw(e,t,r,n){let o={};return n||(e=Zo(Yn(e,r),r),t=Zo(Yn(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ms(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ms(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=ms(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=ms(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function gM(e,t,r){let n=Pw(e,r),o=Pw(t,r);return n!==void 0&&o!==void 0&&n.toLowerCase()===o.toLowerCase()}function Yn(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],i=Tw(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=aM(r.path):(r.path=uM(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let s=sM(r);if(s!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(s),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(a=ms(a)),s===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var yM=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function _M(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function Rw(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,i=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let s=e.match(yM);if(s){n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]);let a=_M(n,s);if(a!==void 0&&(n.error=n.error||a,o=!0),n.host)if(dM(n.host)===!1){let l=iM(n.host);n.host=l.host.toLowerCase(),i=l.isIPV6}else i=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=Tw(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&i===!1&&fM(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(u){n.error=n.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=lM(unescape(n.host),i))),n.path&&(n.path=cM(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function Zo(e,t){return Rw(e,t).parsed}function vM(e,t){return Ew(e,t).normalized}function Ew(e,t){let{parsed:r,malformedAuthorityOrPort:n}=Rw(e,t);return{normalized:n?e:Yn(r,t),malformedAuthorityOrPort:n}}function Pw(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:n}=Ew(e,t);return n?void 0:r}if(typeof e=="object")return Yn(e,t)}var cp={SCHEMES:pM,normalize:mM,resolve:hM,resolveComponent:zw,equal:gM,serialize:Yn,parse:Zo};yc.exports=cp;yc.exports.default=cp;yc.exports.fastUri=cp});var jw=k(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});var Cw=Ow();Cw.code='require("ajv/dist/runtime/uri").default';up.default=Cw});var Lw=k(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.CodeGen=tt.Name=tt.nil=tt.stringify=tt.str=tt._=tt.KeywordCxt=void 0;var bM=fs();Object.defineProperty(tt,"KeywordCxt",{enumerable:!0,get:function(){return bM.KeywordCxt}});var Lo=Q();Object.defineProperty(tt,"_",{enumerable:!0,get:function(){return Lo._}});Object.defineProperty(tt,"str",{enumerable:!0,get:function(){return Lo.str}});Object.defineProperty(tt,"stringify",{enumerable:!0,get:function(){return Lo.stringify}});Object.defineProperty(tt,"nil",{enumerable:!0,get:function(){return Lo.nil}});Object.defineProperty(tt,"Name",{enumerable:!0,get:function(){return Lo.Name}});Object.defineProperty(tt,"CodeGen",{enumerable:!0,get:function(){return Lo.CodeGen}});var wM=fc(),Aw=ps(),xM=Df(),hs=mc(),$M=Q(),gs=us(),_c=cs(),dp=ce(),Mw=mw(),SM=jw(),qw=(e,t)=>new RegExp(e,t);qw.code="new RegExp";var kM=["removeAdditional","useDefaults","coerceTypes"],PM=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),TM={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."},zM={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Nw=200;function RM(e){var t,r,n,o,i,s,a,c,u,l,d,h,m,p,y,v,P,T,R,I,C,Me,de,mt,vn;let Ar=e.strict,lo=(t=e.code)===null||t===void 0?void 0:t.optimize,bi=lo===!0||lo===void 0?1:lo||0,wi=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:qw,ir=(o=e.uriResolver)!==null&&o!==void 0?o:SM.default;return{strictSchema:(s=(i=e.strictSchema)!==null&&i!==void 0?i:Ar)!==null&&s!==void 0?s:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:Ar)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Ar)!==null&&l!==void 0?l:"log",strictTuples:(h=(d=e.strictTuples)!==null&&d!==void 0?d:Ar)!==null&&h!==void 0?h:"log",strictRequired:(p=(m=e.strictRequired)!==null&&m!==void 0?m:Ar)!==null&&p!==void 0?p:!1,code:e.code?{...e.code,optimize:bi,regExp:wi}:{optimize:bi,regExp:wi},loopRequired:(y=e.loopRequired)!==null&&y!==void 0?y:Nw,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:Nw,meta:(P=e.meta)!==null&&P!==void 0?P:!0,messages:(T=e.messages)!==null&&T!==void 0?T:!0,inlineRefs:(R=e.inlineRefs)!==null&&R!==void 0?R:!0,schemaId:(I=e.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(C=e.addUsedSchema)!==null&&C!==void 0?C:!0,validateSchema:(Me=e.validateSchema)!==null&&Me!==void 0?Me:!0,validateFormats:(de=e.validateFormats)!==null&&de!==void 0?de:!0,unicodeRegExp:(mt=e.unicodeRegExp)!==null&&mt!==void 0?mt:!0,int32range:(vn=e.int32range)!==null&&vn!==void 0?vn:!0,uriResolver:ir}}var ys=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...RM(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new $M.ValueScope({scope:{},prefixes:PM,es5:r,lines:n}),this.logger=NM(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,xM.getRules)(),Iw.call(this,TM,t,"NOT SUPPORTED"),Iw.call(this,zM,t,"DEPRECATED","warn"),this._metaOpts=jM.call(this),t.formats&&OM.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&CM.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),EM.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Mw;n==="id"&&(o={...Mw},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let h=this._addSchema(l,d);return h.validate||s.call(this,h)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function s(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Aw.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),s.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 i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let s of t)this.addSchema(s,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:s}=this.opts;if(i=t[s],i!==void 0&&typeof i!="string")throw new Error(`schema ${s} must be string`)}return r=(0,gs.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=Dw.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new hs.SchemaEnv({schema:{},schemaId:n});if(r=hs.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Dw.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,gs.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(DM.call(this,n,r),!r)return(0,dp.eachItem)(n,i=>lp.call(this,i)),this;qM.call(this,r);let o={...r,type:(0,_c.getJSONTypes)(r.type),schemaType:(0,_c.getJSONTypes)(r.schemaType)};return(0,dp.eachItem)(n,o.type.length===0?i=>lp.call(this,i,o):i=>o.type.forEach(s=>lp.call(this,i,o,s))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),s=t;for(let a of i)s=s[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=s[a];u&&l&&(s[a]=Zw(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let s,{schemaId:a}=this.opts;if(typeof t=="object")s=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,gs.normalizeId)(s||n);let u=gs.getSchemaRefs.call(this,t,n);return c=new hs.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):hs.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{hs.compileSchema.call(this,t)}finally{this.opts=r}}};ys.ValidationError=wM.default;ys.MissingRefError=Aw.default;tt.default=ys;function Iw(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function Dw(e){return e=(0,gs.normalizeId)(e),this.schemas[e]||this.refs[e]}function EM(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function OM(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function CM(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function jM(){let e={...this.opts};for(let t of kM)delete e[t];return e}var MM={log(){},warn(){},error(){}};function NM(e){if(e===!1)return MM;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var IM=/^[a-z_$][a-z0-9_$:-]*$/i;function DM(e,t){let{RULES:r}=this;if((0,dp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!IM.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function lp(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,s=o?i.post:i.rules.find(({type:c})=>c===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,_c.getJSONTypes)(t.type),schemaType:(0,_c.getJSONTypes)(t.schemaType)}};t.before?AM.call(this,s,a,t.before):s.rules.push(a),i.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function AM(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function qM(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Zw(t)),e.validateSchema=this.compile(t,!0))}var ZM={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Zw(e){return{anyOf:[e,ZM]}}});var Fw=k(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var LM={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};fp.default=LM});var Bw=k(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.callRef=Qn.getValidate=void 0;var FM=ps(),Uw=Ft(),Pt=Q(),Fo=zr(),Vw=mc(),vc=ce(),UM={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:s,opts:a,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Vw.resolveRef.call(c,u,o,r);if(l===void 0)throw new FM.default(n.opts.uriResolver,o,r);if(l instanceof Vw.SchemaEnv)return h(l);return m(l);function d(){if(i===u)return bc(e,s,i,i.$async);let p=t.scopeValue("root",{ref:u});return bc(e,(0,Pt._)`${p}.validate`,u,u.$async)}function h(p){let y=Hw(e,p);bc(e,y,p,p.$async)}function m(p){let y=t.scopeValue("schema",a.code.source===!0?{ref:p,code:(0,Pt.stringify)(p)}:{ref:p}),v=t.name("valid"),P=e.subschema({schema:p,dataTypes:[],schemaPath:Pt.nil,topSchemaRef:y,errSchemaPath:r},v);e.mergeEvaluated(P),e.ok(v)}}};function Hw(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Pt._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Qn.getValidate=Hw;function bc(e,t,r,n){let{gen:o,it:i}=e,{allErrors:s,schemaEnv:a,opts:c}=i,u=c.passContext?Fo.default.this:Pt.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{o.code((0,Pt._)`await ${(0,Uw.callValidateCode)(e,t,u)}`),m(t),s||o.assign(p,!0)},y=>{o.if((0,Pt._)`!(${y} instanceof ${i.ValidationError})`,()=>o.throw(y)),h(y),s||o.assign(p,!1)}),e.ok(p)}function d(){e.result((0,Uw.callValidateCode)(e,t,u),()=>m(t),()=>h(t))}function h(p){let y=(0,Pt._)`${p}.errors`;o.assign(Fo.default.vErrors,(0,Pt._)`${Fo.default.vErrors} === null ? ${y} : ${Fo.default.vErrors}.concat(${y})`),o.assign(Fo.default.errors,(0,Pt._)`${Fo.default.vErrors}.length`)}function m(p){var y;if(!i.opts.unevaluated)return;let v=(y=r?.validate)===null||y===void 0?void 0:y.evaluated;if(i.props!==!0)if(v&&!v.dynamicProps)v.props!==void 0&&(i.props=vc.mergeEvaluated.props(o,v.props,i.props));else{let P=o.var("props",(0,Pt._)`${p}.evaluated.props`);i.props=vc.mergeEvaluated.props(o,P,i.props,Pt.Name)}if(i.items!==!0)if(v&&!v.dynamicItems)v.items!==void 0&&(i.items=vc.mergeEvaluated.items(o,v.items,i.items));else{let P=o.var("items",(0,Pt._)`${p}.evaluated.items`);i.items=vc.mergeEvaluated.items(o,P,i.items,Pt.Name)}}}Qn.callRef=bc;Qn.default=UM});var Ww=k(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var VM=Fw(),HM=Bw(),BM=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",VM.default,HM.default];pp.default=BM});var Jw=k(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var wc=Q(),nn=wc.operators,xc={maximum:{okStr:"<=",ok:nn.LTE,fail:nn.GT},minimum:{okStr:">=",ok:nn.GTE,fail:nn.LT},exclusiveMaximum:{okStr:"<",ok:nn.LT,fail:nn.GTE},exclusiveMinimum:{okStr:">",ok:nn.GT,fail:nn.LTE}},WM={message:({keyword:e,schemaCode:t})=>(0,wc.str)`must be ${xc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,wc._)`{comparison: ${xc[e].okStr}, limit: ${t}}`},JM={keyword:Object.keys(xc),type:"number",schemaType:"number",$data:!0,error:WM,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,wc._)`${r} ${xc[t].fail} ${n} || isNaN(${r})`)}};mp.default=JM});var Gw=k(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var _s=Q(),GM={message:({schemaCode:e})=>(0,_s.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,_s._)`{multipleOf: ${e}}`},KM={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:GM,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,s=t.let("res"),a=i?(0,_s._)`Math.abs(Math.round(${s}) - ${s}) > 1e-${i}`:(0,_s._)`${s} !== parseInt(${s})`;e.fail$data((0,_s._)`(${n} === 0 || (${s} = ${r}/${n}, ${a}))`)}};hp.default=KM});var Xw=k(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});function Kw(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}gp.default=Kw;Kw.code='require("ajv/dist/runtime/ucs2length").default'});var Yw=k(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var eo=Q(),XM=ce(),YM=Xw(),QM={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,eo.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,eo._)`{limit: ${e}}`},eN={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:QM,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?eo.operators.GT:eo.operators.LT,s=o.opts.unicode===!1?(0,eo._)`${r}.length`:(0,eo._)`${(0,XM.useFunc)(e.gen,YM.default)}(${r})`;e.fail$data((0,eo._)`${s} ${i} ${n}`)}};yp.default=eN});var Qw=k(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var tN=Ft(),rN=ce(),Uo=Q(),nN={message:({schemaCode:e})=>(0,Uo.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Uo._)`{pattern: ${e}}`},oN={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:nN,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:s}=e,a=s.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=s.opts.code,u=c.code==="new RegExp"?(0,Uo._)`new RegExp`:(0,rN.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,Uo._)`${u}(${i}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,Uo._)`!${l}`)}else{let c=(0,tN.usePattern)(e,o);e.fail$data((0,Uo._)`!${c}.test(${r})`)}}};_p.default=oN});var ex=k(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});var vs=Q(),iN={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,vs.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,vs._)`{limit: ${e}}`},sN={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:iN,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?vs.operators.GT:vs.operators.LT;e.fail$data((0,vs._)`Object.keys(${r}).length ${o} ${n}`)}};vp.default=sN});var tx=k(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var bs=Ft(),ws=Q(),aN=ce(),cN={message:({params:{missingProperty:e}})=>(0,ws.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ws._)`{missingProperty: ${e}}`},uN={keyword:"required",type:"object",schemaType:"array",$data:!0,error:cN,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:s}=e,{opts:a}=s;if(!i&&r.length===0)return;let c=r.length>=a.loopRequired;if(s.allErrors?u():l(),a.strictRequired){let m=e.parentSchema.properties,{definedProperties:p}=e.it;for(let y of r)if(m?.[y]===void 0&&!p.has(y)){let v=s.schemaEnv.baseId+s.errSchemaPath,P=`required property "${y}" is not defined at "${v}" (strictRequired)`;(0,aN.checkStrictMode)(s,P,s.opts.strictRequired)}}function u(){if(c||i)e.block$data(ws.nil,d);else for(let m of r)(0,bs.checkReportMissingProp)(e,m)}function l(){let m=t.let("missing");if(c||i){let p=t.let("valid",!0);e.block$data(p,()=>h(m,p)),e.ok(p)}else t.if((0,bs.checkMissingProp)(e,r,m)),(0,bs.reportMissingProp)(e,m),t.else()}function d(){t.forOf("prop",n,m=>{e.setParams({missingProperty:m}),t.if((0,bs.noPropertyInData)(t,o,m,a.ownProperties),()=>e.error())})}function h(m,p){e.setParams({missingProperty:m}),t.forOf(m,n,()=>{t.assign(p,(0,bs.propertyInData)(t,o,m,a.ownProperties)),t.if((0,ws.not)(p),()=>{e.error(),t.break()})},ws.nil)}}};bp.default=uN});var rx=k(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});var xs=Q(),lN={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,xs.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,xs._)`{limit: ${e}}`},dN={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:lN,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?xs.operators.GT:xs.operators.LT;e.fail$data((0,xs._)`${r}.length ${o} ${n}`)}};wp.default=dN});var $c=k(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var nx=Hf();nx.code='require("ajv/dist/runtime/equal").default';xp.default=nx});var ox=k(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var $p=cs(),rt=Q(),fN=ce(),pN=$c(),mN={message:({params:{i:e,j:t}})=>(0,rt.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,rt._)`{i: ${e}, j: ${t}}`},hN={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mN,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:s,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,$p.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,rt._)`${s} === false`),e.ok(c);function l(){let p=t.let("i",(0,rt._)`${r}.length`),y=t.let("j");e.setParams({i:p,j:y}),t.assign(c,!0),t.if((0,rt._)`${p} > 1`,()=>(d()?h:m)(p,y))}function d(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function h(p,y){let v=t.name("item"),P=(0,$p.checkDataTypes)(u,v,a.opts.strictNumbers,$p.DataType.Wrong),T=t.const("indices",(0,rt._)`{}`);t.for((0,rt._)`;${p}--;`,()=>{t.let(v,(0,rt._)`${r}[${p}]`),t.if(P,(0,rt._)`continue`),u.length>1&&t.if((0,rt._)`typeof ${v} == "string"`,(0,rt._)`${v} += "_"`),t.if((0,rt._)`typeof ${T}[${v}] == "number"`,()=>{t.assign(y,(0,rt._)`${T}[${v}]`),e.error(),t.assign(c,!1).break()}).code((0,rt._)`${T}[${v}] = ${p}`)})}function m(p,y){let v=(0,fN.useFunc)(t,pN.default),P=t.name("outer");t.label(P).for((0,rt._)`;${p}--;`,()=>t.for((0,rt._)`${y} = ${p}; ${y}--;`,()=>t.if((0,rt._)`${v}(${r}[${p}], ${r}[${y}])`,()=>{e.error(),t.assign(c,!1).break(P)})))}}};Sp.default=hN});var ix=k(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var kp=Q(),gN=ce(),yN=$c(),_N={message:"must be equal to constant",params:({schemaCode:e})=>(0,kp._)`{allowedValue: ${e}}`},vN={keyword:"const",$data:!0,error:_N,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,kp._)`!${(0,gN.useFunc)(t,yN.default)}(${r}, ${o})`):e.fail((0,kp._)`${i} !== ${r}`)}};Pp.default=vN});var sx=k(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var $s=Q(),bN=ce(),wN=$c(),xN={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,$s._)`{allowedValues: ${e}}`},$N={keyword:"enum",schemaType:"array",$data:!0,error:xN,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:s}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=s.opts.loopEnum,c,u=()=>c??(c=(0,bN.useFunc)(t,wN.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=t.const("vSchema",i);l=(0,$s.or)(...o.map((p,y)=>h(m,y)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,m=>t.if((0,$s._)`${u()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function h(m,p){let y=o[p];return typeof y=="object"&&y!==null?(0,$s._)`${u()}(${r}, ${m}[${p}])`:(0,$s._)`${r} === ${y}`}}};Tp.default=$N});var ax=k(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var SN=Jw(),kN=Gw(),PN=Yw(),TN=Qw(),zN=ex(),RN=tx(),EN=rx(),ON=ox(),CN=ix(),jN=sx(),MN=[SN.default,kN.default,PN.default,TN.default,zN.default,RN.default,EN.default,ON.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CN.default,jN.default];zp.default=MN});var Ep=k(Ss=>{"use strict";Object.defineProperty(Ss,"__esModule",{value:!0});Ss.validateAdditionalItems=void 0;var to=Q(),Rp=ce(),NN={message:({params:{len:e}})=>(0,to.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,to._)`{limit: ${e}}`},IN={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:NN,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Rp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}cx(e,n)}};function cx(e,t){let{gen:r,schema:n,data:o,keyword:i,it:s}=e;s.items=!0;let a=r.const("len",(0,to._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,to._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,Rp.alwaysValidSchema)(s,n)){let u=r.var("valid",(0,to._)`${a} <= ${t.length}`);r.if((0,to.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Rp.Type.Num},u),s.allErrors||r.if((0,to.not)(u),()=>r.break())})}}Ss.validateAdditionalItems=cx;Ss.default=IN});var Op=k(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.validateTuple=void 0;var ux=Q(),Sc=ce(),DN=Ft(),AN={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return lx(e,"additionalItems",t);r.items=!0,!(0,Sc.alwaysValidSchema)(r,t)&&e.ok((0,DN.validateArray)(e))}};function lx(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:s,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Sc.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,ux._)`${i}.length`);r.forEach((d,h)=>{(0,Sc.alwaysValidSchema)(a,d)||(n.if((0,ux._)`${u} > ${h}`,()=>e.subschema({keyword:s,schemaProp:h,dataProp:h},c)),e.ok(c))});function l(d){let{opts:h,errSchemaPath:m}=a,p=r.length,y=p===d.minItems&&(p===d.maxItems||d[t]===!1);if(h.strictTuples&&!y){let v=`"${s}" is ${p}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;(0,Sc.checkStrictMode)(a,v,h.strictTuples)}}}ks.validateTuple=lx;ks.default=AN});var dx=k(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var qN=Op(),ZN={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,qN.validateTuple)(e,"items")};Cp.default=ZN});var px=k(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var fx=Q(),LN=ce(),FN=Ft(),UN=Ep(),VN={message:({params:{len:e}})=>(0,fx.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,fx._)`{limit: ${e}}`},HN={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:VN,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,LN.alwaysValidSchema)(n,t)&&(o?(0,UN.validateAdditionalItems)(e,o):e.ok((0,FN.validateArray)(e)))}};jp.default=HN});var mx=k(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var Vt=Q(),kc=ce(),BN={message:({params:{min:e,max:t}})=>t===void 0?(0,Vt.str)`must contain at least ${e} valid item(s)`:(0,Vt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Vt._)`{minContains: ${e}}`:(0,Vt._)`{minContains: ${e}, maxContains: ${t}}`},WN={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:BN,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,s,a,{minContains:c,maxContains:u}=n;i.opts.next?(s=c===void 0?1:c,a=u):s=1;let l=t.const("len",(0,Vt._)`${o}.length`);if(e.setParams({min:s,max:a}),a===void 0&&s===0){(0,kc.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&s>a){(0,kc.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,kc.alwaysValidSchema)(i,r)){let y=(0,Vt._)`${l} >= ${s}`;a!==void 0&&(y=(0,Vt._)`${y} && ${l} <= ${a}`),e.pass(y);return}i.items=!0;let d=t.name("valid");a===void 0&&s===1?m(d,()=>t.if(d,()=>t.break())):s===0?(t.let(d,!0),a!==void 0&&t.if((0,Vt._)`${o}.length > 0`,h)):(t.let(d,!1),h()),e.result(d,()=>e.reset());function h(){let y=t.name("_valid"),v=t.let("count",0);m(y,()=>t.if(y,()=>p(v)))}function m(y,v){t.forRange("i",0,l,P=>{e.subschema({keyword:"contains",dataProp:P,dataPropType:kc.Type.Num,compositeRule:!0},y),v()})}function p(y){t.code((0,Vt._)`${y}++`),a===void 0?t.if((0,Vt._)`${y} >= ${s}`,()=>t.assign(d,!0).break()):(t.if((0,Vt._)`${y} > ${a}`,()=>t.assign(d,!1).break()),s===1?t.assign(d,!0):t.if((0,Vt._)`${y} >= ${s}`,()=>t.assign(d,!0)))}}};Mp.default=WN});var yx=k(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.validateSchemaDeps=pr.validatePropertyDeps=pr.error=void 0;var Np=Q(),JN=ce(),Ps=Ft();pr.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Np.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Np._)`{property: ${e},
|
|
8
8
|
missingProperty: ${n},
|
|
9
9
|
depsCount: ${t},
|
|
10
|
-
deps: ${r}}`};var GN={keyword:"dependencies",type:"object",schemaType:"object",error:pr.error,code(e){let[t,r]=KN(e);hx(e,t),gx(e,r)}};function KN({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function hx(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,Ps.propertyInData)(r,n,s,o.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Ps.checkReportMissingProp)(e,u)}):(r.if((0,Np._)`${c} && (${(0,Ps.checkMissingProp)(e,a,i)})`),(0,Ps.reportMissingProp)(e,i),r.else())}}pr.validatePropertyDeps=hx;function gx(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,s=r.name("valid");for(let a in t)(0,JN.alwaysValidSchema)(i,t[a])||(r.if((0,Ps.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}pr.validateSchemaDeps=gx;pr.default=GN});var vx=k(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var _x=Q(),XN=ce(),YN={message:"property name must be valid",params:({params:e})=>(0,_x._)`{propertyName: ${e.propertyName}}`},QN={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:YN,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,XN.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),t.if((0,_x.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Mp.default=QN});var Ap=k(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var Pc=Ft(),er=Q(),eM=Rr(),Tc=ce(),tM={message:"must NOT have additional properties",params:({params:e})=>(0,er._)`{additionalProperty: ${e.additionalProperty}}`},rM={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tM,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Tc.alwaysValidSchema)(s,r))return;let u=(0,Pc.allSchemaProperties)(n.properties),l=(0,Pc.allSchemaProperties)(n.patternProperties);d(),e.ok((0,er._)`${i} === ${eM.default.errors}`);function d(){t.forIn("key",o,v=>{!u.length&&!l.length?p(v):t.if(h(v),()=>p(v))})}function h(v){let P;if(u.length>8){let T=(0,Tc.schemaRefOrVal)(s,n.properties,"properties");P=(0,Pc.isOwnProperty)(t,T,v)}else u.length?P=(0,er.or)(...u.map(T=>(0,er._)`${v} === ${T}`)):P=er.nil;return l.length&&(P=(0,er.or)(P,...l.map(T=>(0,er._)`${(0,Pc.usePattern)(e,T)}.test(${v})`))),(0,er.not)(P)}function m(v){t.code((0,er._)`delete ${o}[${v}]`)}function p(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Tc.alwaysValidSchema)(s,r)){let P=t.name("valid");c.removeAdditional==="failing"?(y(v,P,!1),t.if((0,er.not)(P),()=>{e.reset(),m(v)})):(y(v,P),a||t.if((0,er.not)(P),()=>t.break()))}}function y(v,P,T){let z={keyword:"additionalProperties",dataProp:v,dataPropType:Tc.Type.Str};T===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(z,P)}}};Dp.default=rM});var xx=k(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var nM=fs(),bx=Ft(),qp=ce(),wx=Ap(),oM={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&wx.default.code(new nM.KeywordCxt(i,wx.default,"additionalProperties"));let s=(0,bx.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=qp.mergeEvaluated.props(t,(0,qp.toHash)(s),i.props));let a=s.filter(d=>!(0,qp.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,bx.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Zp.default=oM});var Px=k(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var $x=Ft(),Rc=Q(),Sx=ce(),kx=ce(),iM={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:s}=i,a=(0,$x.allSchemaProperties)(r),c=a.filter(y=>(0,Sx.alwaysValidSchema)(i,r[y]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof Rc.Name)&&(i.props=(0,kx.evaluatedPropsToName)(t,i.props));let{props:d}=i;h();function h(){for(let y of a)u&&m(y),i.allErrors?p(y):(t.var(l,!0),p(y),t.if(l))}function m(y){for(let v in u)new RegExp(y).test(v)&&(0,Sx.checkStrictMode)(i,`property ${v} matches pattern ${y} (use allowMatchingProperties)`)}function p(y){t.forIn("key",n,v=>{t.if((0,Rc._)`${(0,$x.usePattern)(e,y)}.test(${v})`,()=>{let P=c.includes(y);P||e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:v,dataPropType:kx.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,Rc._)`${d}[${v}]`,!0):!P&&!i.allErrors&&t.if((0,Rc.not)(l),()=>t.break())})})}}};Lp.default=iM});var Tx=k(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var sM=ce(),aM={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,sM.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Fp.default=aM});var Rx=k(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var cM=Ft(),uM={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cM.validateUnion,error:{message:"must match a schema in anyOf"}};Up.default=uM});var zx=k(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var zc=Q(),lM=ce(),dM={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,zc._)`{passingSchemas: ${e.passing}}`},fM={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:dM,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let h;(0,lM.alwaysValidSchema)(o,l)?t.var(c,!0):h=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,zc._)`${c} && ${s}`).assign(s,!1).assign(a,(0,zc._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),h&&e.mergeEvaluated(h,zc.Name)})})}}};Vp.default=fM});var Ex=k(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var pM=ce(),mM={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,s)=>{if((0,pM.alwaysValidSchema)(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:s},o);e.ok(o),e.mergeEvaluated(a)})}};Hp.default=mM});var jx=k(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var Ec=Q(),Cx=ce(),hM={message:({params:e})=>(0,Ec.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Ec._)`{failingKeyword: ${e.ifClause}}`},gM={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:hM,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Cx.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Ox(n,"then"),i=Ox(n,"else");if(!o&&!i)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,Ec.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let h=e.subschema({keyword:l},a);t.assign(s,a),e.mergeValidEvaluated(h,s),d?t.assign(d,(0,Ec._)`${l}`):e.setParams({ifClause:l})}}}};function Ox(e,t){let r=e.schema[t];return r!==void 0&&!(0,Cx.alwaysValidSchema)(e,r)}Bp.default=gM});var Ix=k(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var yM=ce(),_M={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,yM.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Wp.default=_M});var Nx=k(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var vM=Ep(),bM=dx(),wM=Op(),xM=px(),$M=mx(),SM=yx(),kM=vx(),PM=Ap(),TM=xx(),RM=Px(),zM=Tx(),EM=Rx(),OM=zx(),CM=Ex(),jM=jx(),IM=Ix();function NM(e=!1){let t=[zM.default,EM.default,OM.default,CM.default,jM.default,IM.default,kM.default,PM.default,SM.default,TM.default,RM.default];return e?t.push(bM.default,xM.default):t.push(vM.default,wM.default),t.push($M.default),t}Jp.default=NM});var Mx=k(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var Le=Q(),MM={message:({schemaCode:e})=>(0,Le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Le._)`{format: ${e}}`},DM={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:MM,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?h():m();function h(){let p=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),y=r.const("fDef",(0,Le._)`${p}[${s}]`),v=r.let("fType"),P=r.let("format");r.if((0,Le._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign(v,(0,Le._)`${y}.type || "string"`).assign(P,(0,Le._)`${y}.validate`),()=>r.assign(v,(0,Le._)`"string"`).assign(P,y)),e.fail$data((0,Le.or)(T(),z()));function T(){return c.strictSchema===!1?Le.nil:(0,Le._)`${s} && !${P}`}function z(){let M=l.$async?(0,Le._)`(${y}.async ? await ${P}(${n}) : ${P}(${n}))`:(0,Le._)`${P}(${n})`,C=(0,Le._)`(typeof ${P} == "function" ? ${M} : ${P}.test(${n}))`;return(0,Le._)`${P} && ${P} !== true && ${v} === ${t} && !${C}`}}function m(){let p=d.formats[i];if(!p){T();return}if(p===!0)return;let[y,v,P]=z(p);y===t&&e.pass(M());function T(){if(c.strictSchema===!1){d.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function z(C){let Ie=C instanceof RegExp?(0,Le.regexpCode)(C):c.code.formats?(0,Le._)`${c.code.formats}${(0,Le.getProperty)(i)}`:void 0,de=r.scopeValue("formats",{key:i,ref:C,code:Ie});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,Le._)`${de}.validate`]:["string",C,de]}function M(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Le._)`await ${P}(${n})`}return typeof v=="function"?(0,Le._)`${P}(${n})`:(0,Le._)`${P}.test(${n})`}}}};Gp.default=DM});var Dx=k(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var AM=Mx(),qM=[AM.default];Kp.default=qM});var Ax=k(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.contentVocabulary=Vo.metadataVocabulary=void 0;Vo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Zx=k(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var ZM=Ww(),LM=ax(),FM=Nx(),UM=Dx(),qx=Ax(),VM=[ZM.default,LM.default,(0,FM.default)(),UM.default,qx.metadataVocabulary,qx.contentVocabulary];Xp.default=VM});var Fx=k(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.DiscrError=void 0;var Lx;(function(e){e.Tag="tag",e.Mapping="mapping"})(Lx||(Oc.DiscrError=Lx={}))});var Vx=k(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Ho=Q(),Yp=Fx(),Ux=mc(),HM=ps(),BM=ce(),WM={message:({params:{discrError:e,tagName:t}})=>e===Yp.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Ho._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},JM={keyword:"discriminator",type:"object",schemaType:"object",error:WM,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:s}=o;if(!i.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(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Ho._)`${r}${(0,Ho.getProperty)(a)}`);t.if((0,Ho._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Yp.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let m=h();t.if(!1);for(let p in m)t.elseIf((0,Ho._)`${u} === ${p}`),t.assign(c,d(m[p]));t.else(),e.error(!1,{discrError:Yp.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(m){let p=t.name("valid"),y=e.subschema({keyword:"oneOf",schemaProp:m},p);return e.mergeEvaluated(y,Ho.Name),p}function h(){var m;let p={},y=P(o),v=!0;for(let M=0;M<s.length;M++){let C=s[M];if(C?.$ref&&!(0,BM.schemaHasRulesButRef)(C,i.self.RULES)){let de=C.$ref;if(C=Ux.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,de),C instanceof Ux.SchemaEnv&&(C=C.schema),C===void 0)throw new HM.default(i.opts.uriResolver,i.baseId,de)}let Ie=(m=C?.properties)===null||m===void 0?void 0:m[a];if(typeof Ie!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(y||P(C)),T(Ie,M)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return p;function P({required:M}){return Array.isArray(M)&&M.includes(a)}function T(M,C){if(M.const)z(M.const,C);else if(M.enum)for(let Ie of M.enum)z(Ie,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(M,C){if(typeof M!="string"||M in p)throw new Error(`discriminator: "${a}" values must be unique strings`);p[M]=C}}}};Qp.default=JM});var Hx=k((lF,GM)=>{GM.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 tm=k((Te,em)=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.MissingRefError=Te.ValidationError=Te.CodeGen=Te.Name=Te.nil=Te.stringify=Te.str=Te._=Te.KeywordCxt=Te.Ajv=void 0;var KM=Lw(),XM=Zx(),YM=Vx(),Bx=Hx(),QM=["/properties"],Cc="http://json-schema.org/draft-07/schema",Bo=class extends KM.default{_addVocabularies(){super._addVocabularies(),XM.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(YM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Bx,QM):Bx;this.addMetaSchema(t,Cc,!1),this.refs["http://json-schema.org/schema"]=Cc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Cc)?Cc:void 0)}};Te.Ajv=Bo;em.exports=Te=Bo;em.exports.Ajv=Bo;Object.defineProperty(Te,"__esModule",{value:!0});Te.default=Bo;var e1=fs();Object.defineProperty(Te,"KeywordCxt",{enumerable:!0,get:function(){return e1.KeywordCxt}});var Wo=Q();Object.defineProperty(Te,"_",{enumerable:!0,get:function(){return Wo._}});Object.defineProperty(Te,"str",{enumerable:!0,get:function(){return Wo.str}});Object.defineProperty(Te,"stringify",{enumerable:!0,get:function(){return Wo.stringify}});Object.defineProperty(Te,"nil",{enumerable:!0,get:function(){return Wo.nil}});Object.defineProperty(Te,"Name",{enumerable:!0,get:function(){return Wo.Name}});Object.defineProperty(Te,"CodeGen",{enumerable:!0,get:function(){return Wo.CodeGen}});var t1=fc();Object.defineProperty(Te,"ValidationError",{enumerable:!0,get:function(){return t1.default}});var r1=ps();Object.defineProperty(Te,"MissingRefError",{enumerable:!0,get:function(){return r1.default}})});var e$=k(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.formatNames=hr.fastFormats=hr.fullFormats=void 0;function mr(e,t){return{validate:e,compare:t}}hr.fullFormats={date:mr(Kx,im),time:mr(nm(!0),sm),"date-time":mr(Wx(!0),Yx),"iso-time":mr(nm(),Xx),"iso-date-time":mr(Wx(),Qx),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:c1,"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:h1,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:u1,int32:{type:"number",validate:f1},int64:{type:"number",validate:p1},float:{type:"number",validate:Gx},double:{type:"number",validate:Gx},password:!0,binary:!0};hr.fastFormats={...hr.fullFormats,date:mr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,im),time:mr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,sm),"date-time":mr(/^\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,Yx),"iso-time":mr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Xx),"iso-date-time":mr(/^\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,Qx),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};hr.formatNames=Object.keys(hr.fullFormats);function n1(e){return e%4===0&&(e%100!==0||e%400===0)}var o1=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i1=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Kx(e){let t=o1.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&n1(r)?29:i1[n])}function im(e,t){if(e&&t)return e>t?1:e<t?-1:0}var rm=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function nm(e){return function(r){let n=rm.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],s=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,h=o-u*c-(d<0?1:0);return(h===23||h===-1)&&(d===59||d===-1)&&s<61}}function sm(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function Xx(e,t){if(!(e&&t))return;let r=rm.exec(e),n=rm.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var om=/t|\s/i;function Wx(e){let t=nm(e);return function(n){let o=n.split(om);return o.length===2&&Kx(o[0])&&t(o[1])}}function Yx(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Qx(e,t){if(!(e&&t))return;let[r,n]=e.split(om),[o,i]=t.split(om),s=im(r,o);if(s!==void 0)return s||sm(n,i)}var s1=/\/|:/,a1=/^(?:[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 c1(e){return s1.test(e)&&a1.test(e)}var Jx=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function u1(e){return Jx.lastIndex=0,Jx.test(e)}var l1=-(2**31),d1=2**31-1;function f1(e){return Number.isInteger(e)&&e<=d1&&e>=l1}function p1(e){return Number.isInteger(e)}function Gx(){return!0}var m1=/[^\\]\\Z/;function h1(e){if(m1.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var t$=k(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.formatLimitDefinition=void 0;var g1=tm(),tr=Q(),on=tr.operators,jc={formatMaximum:{okStr:"<=",ok:on.LTE,fail:on.GT},formatMinimum:{okStr:">=",ok:on.GTE,fail:on.LT},formatExclusiveMaximum:{okStr:"<",ok:on.LT,fail:on.GTE},formatExclusiveMinimum:{okStr:">",ok:on.GT,fail:on.LTE}},y1={message:({keyword:e,schemaCode:t})=>(0,tr.str)`should be ${jc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,tr._)`{comparison: ${jc[e].okStr}, limit: ${t}}`};Jo.formatLimitDefinition={keyword:Object.keys(jc),type:"string",schemaType:"string",$data:!0,error:y1,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new g1.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let h=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),m=t.const("fmt",(0,tr._)`${h}[${c.schemaCode}]`);e.fail$data((0,tr.or)((0,tr._)`typeof ${m} != "object"`,(0,tr._)`${m} instanceof RegExp`,(0,tr._)`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 p=t.scopeValue("formats",{key:h,ref:m,code:s.code.formats?(0,tr._)`${s.code.formats}${(0,tr.getProperty)(h)}`:void 0});e.fail$data(d(p))}function d(h){return(0,tr._)`${h}.compare(${r}, ${n}) ${jc[o].fail} 0`}},dependencies:["format"]};var _1=e=>(e.addKeyword(Jo.formatLimitDefinition),e);Jo.default=_1});var i$=k((Ts,o$)=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var Go=e$(),v1=t$(),am=Q(),r$=new am.Name("fullFormats"),b1=new am.Name("fastFormats"),cm=(e,t={keywords:!0})=>{if(Array.isArray(t))return n$(e,t,Go.fullFormats,r$),e;let[r,n]=t.mode==="fast"?[Go.fastFormats,b1]:[Go.fullFormats,r$],o=t.formats||Go.formatNames;return n$(e,o,r,n),t.keywords&&(0,v1.default)(e),e};cm.get=(e,t="full")=>{let n=(t==="fast"?Go.fastFormats:Go.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function n$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,am._)`require("ajv-formats/dist/formats").${n}`);for(let s of t)e.addFormat(s,r[s])}o$.exports=Ts=cm;Object.defineProperty(Ts,"__esModule",{value:!0});Ts.default=cm});var Xo=k(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.boolean=tD;Er.string=E$;Er.number=rD;Er.error=nD;Er.func=oD;Er.array=O$;Er.stringArray=iD;function tD(e){return e===!0||e===!1}function E$(e){return typeof e=="string"||e instanceof String}function rD(e){return typeof e=="number"||e instanceof Number}function nD(e){return e instanceof Error}function oD(e){return typeof e=="function"}function O$(e){return Array.isArray(e)}function iD(e){return O$(e)&&e.every(t=>E$(t))}});var Zm=k(D=>{"use strict";var sD=D&&D.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),aD=D&&D.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),cD=D&&D.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&sD(r,t,n[o]);return aD(r,t),r}})();Object.defineProperty(D,"__esModule",{value:!0});D.Message=D.NotificationType9=D.NotificationType8=D.NotificationType7=D.NotificationType6=D.NotificationType5=D.NotificationType4=D.NotificationType3=D.NotificationType2=D.NotificationType1=D.NotificationType0=D.NotificationType=D.RequestType9=D.RequestType8=D.RequestType7=D.RequestType6=D.RequestType5=D.RequestType4=D.RequestType3=D.RequestType2=D.RequestType1=D.RequestType=D.RequestType0=D.AbstractMessageSignature=D.ParameterStructures=D.ResponseError=D.ErrorCodes=void 0;var oo=cD(Xo()),gm;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(gm||(D.ErrorCodes=gm={}));var ym=class e extends Error{code;data;constructor(t,r,n){super(r),this.code=oo.number(t)?t:gm.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,e.prototype)}toJson(){let t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),t}};D.ResponseError=ym;var cn=class e{kind;static auto=new e("auto");static byPosition=new e("byPosition");static byName=new e("byName");constructor(t){this.kind=t}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};D.ParameterStructures=cn;var Re=class{method;numberOfParams;constructor(t,r){this.method=t,this.numberOfParams=r}get parameterStructures(){return cn.auto}};D.AbstractMessageSignature=Re;var _m=class extends Re{_;constructor(t){super(t,0)}};D.RequestType0=_m;var vm=class extends Re{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.RequestType=vm;var bm=class extends Re{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.RequestType1=bm;var wm=class extends Re{_;constructor(t){super(t,2)}};D.RequestType2=wm;var xm=class extends Re{_;constructor(t){super(t,3)}};D.RequestType3=xm;var $m=class extends Re{_;constructor(t){super(t,4)}};D.RequestType4=$m;var Sm=class extends Re{_;constructor(t){super(t,5)}};D.RequestType5=Sm;var km=class extends Re{_;constructor(t){super(t,6)}};D.RequestType6=km;var Pm=class extends Re{_;constructor(t){super(t,7)}};D.RequestType7=Pm;var Tm=class extends Re{_;constructor(t){super(t,8)}};D.RequestType8=Tm;var Rm=class extends Re{_;constructor(t){super(t,9)}};D.RequestType9=Rm;var zm=class extends Re{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.NotificationType=zm;var Em=class extends Re{_;constructor(t){super(t,0)}};D.NotificationType0=Em;var Om=class extends Re{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.NotificationType1=Om;var Cm=class extends Re{_;constructor(t){super(t,2)}};D.NotificationType2=Cm;var jm=class extends Re{_;constructor(t){super(t,3)}};D.NotificationType3=jm;var Im=class extends Re{_;constructor(t){super(t,4)}};D.NotificationType4=Im;var Nm=class extends Re{_;constructor(t){super(t,5)}};D.NotificationType5=Nm;var Mm=class extends Re{_;constructor(t){super(t,6)}};D.NotificationType6=Mm;var Dm=class extends Re{_;constructor(t){super(t,7)}};D.NotificationType7=Dm;var Am=class extends Re{_;constructor(t){super(t,8)}};D.NotificationType8=Am;var qm=class extends Re{_;constructor(t){super(t,9)}};D.NotificationType9=qm;var C$;(function(e){function t(o){let i=o;return i&&oo.string(i.method)&&(oo.string(i.id)||oo.number(i.id))}e.isRequest=t;function r(o){let i=o;return i&&oo.string(i.method)&&o.id===void 0}e.isNotification=r;function n(o){let i=o;return i&&(i.result!==void 0||!!i.error)&&(oo.string(i.id)||oo.number(i.id)||i.id===null)}e.isResponse=n})(C$||(D.Message=C$={}))});var Fm=k(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.LRUCache=un.LinkedMap=un.Touch=void 0;var ct;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(ct||(un.Touch=ct={}));var Uc=class{[Symbol.toStringTag]="LinkedMap";_map;_head;_tail;_size;_state;constructor(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}before(t){let r=this._map.get(t);return r?r.previous?.value:void 0}after(t){let r=this._map.get(t);return r?r.next?.value:void 0}has(t){return this._map.has(t)}get(t,r=ct.None){let n=this._map.get(t);if(n)return r!==ct.None&&this.touch(n,r),n.value}set(t,r,n=ct.None){let o=this._map.get(t);if(o)o.value=r,n!==ct.None&&this.touch(o,n);else{switch(o={key:t,value:r,next:void 0,previous:void 0},n){case ct.None:this.addItemLast(o);break;case ct.First:this.addItemFirst(o);break;case ct.Last:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(t,o),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let r=this._map.get(t);if(r)return this._map.delete(t),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,r){let n=this._state,o=this._head;for(;o;){if(r?t.bind(r)(o.value,o.key,this):t(o.value,o.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let t=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.key,done:!1};return r=r.next,o}else return{value:void 0,done:!0}}};return n}values(){let t=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.value,done:!1};return r=r.next,o}else return{value:void 0,done:!0}}};return n}entries(){let t=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:[r.key,r.value],done:!1};return r=r.next,o}else return{value:void 0,done:!0}}};return n}[Symbol.iterator](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>t;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let r=t.next,n=t.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}t.next=void 0,t.previous=void 0,this._state++}touch(t,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==ct.First&&r!==ct.Last)){if(r===ct.First){if(t===this._head)return;let n=t.next,o=t.previous;t===this._tail?(o.next=void 0,this._tail=o):(n.previous=o,o.next=n),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(r===ct.Last){if(t===this._tail)return;let n=t.next,o=t.previous;t===this._head?(n.previous=void 0,this._head=n):(n.previous=o,o.next=n),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((r,n)=>{t.push([n,r])}),t}fromJSON(t){this.clear();for(let[r,n]of t)this.set(r,n)}};un.LinkedMap=Uc;var Lm=class extends Uc{_limit;_ratio;constructor(t,r=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,r),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,r=ct.AsNew){return super.get(t,r)}peek(t){return super.get(t,ct.None)}set(t,r){return super.set(t,r,ct.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};un.LRUCache=Lm});var I$=k(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.Disposable=void 0;var j$;(function(e){function t(r){return{dispose:r}}e.create=t})(j$||(Vc.Disposable=j$={}))});var ln=k(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});var Um;function Vm(){if(Um===void 0)throw new Error("No runtime abstraction layer installed");return Um}(function(e){function t(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");Um=r}e.install=t})(Vm||(Vm={}));Hm.default=Vm});var Yo=k(dn=>{"use strict";var uD=dn&&dn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(dn,"__esModule",{value:!0});dn.Emitter=dn.Event=void 0;var lD=uD(ln()),N$;(function(e){let t={dispose(){}};e.None=function(){return t}})(N$||(dn.Event=N$={}));var Bm=class{_callbacks;_contexts;add(t,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(t,r)})}remove(t,r=null){if(!this._callbacks)return;let n=!1;for(let o=0,i=this._callbacks.length;o<i;o++)if(this._callbacks[o]===t)if(this._contexts[o]===r){this._callbacks.splice(o,1),this._contexts.splice(o,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];let r=[],n=this._callbacks.slice(0),o=this._contexts.slice(0);for(let i=0,s=n.length;i<s;i++)try{r.push(n[i].apply(o[i],t))}catch(a){(0,lD.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Wm=class e{_options;static _noop=function(){};_event;_callbacks;constructor(t){this._options=t}get event(){return this._event||(this._event=(t,r,n)=>{this._callbacks||(this._callbacks=new Bm),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,r);let o={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,r),o.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(o),o}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};dn.Emitter=Wm});var Wc=k(Tt=>{"use strict";var dD=Tt&&Tt.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),fD=Tt&&Tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pD=Tt&&Tt.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&dD(r,t,n[o]);return fD(r,t),r}})(),mD=Tt&&Tt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CancellationTokenSource=Tt.CancellationToken=void 0;var hD=mD(ln()),gD=pD(Xo()),Jm=Yo(),Hc;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Jm.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Jm.Event.None});function t(r){let n=r;return n&&(n===e.None||n===e.Cancelled||gD.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}e.is=t})(Hc||(Tt.CancellationToken=Hc={}));var yD=Object.freeze(function(e,t){let r=(0,hD.default)().timer.setTimeout(e.bind(t),0);return{dispose(){r.dispose()}}}),Bc=class{_isCancelled=!1;_emitter;cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?yD:(this._emitter||(this._emitter=new Jm.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Gm=class{_token;get token(){return this._token||(this._token=new Bc),this._token}cancel(){this._token?this._token.cancel():this._token=Hc.Cancelled}dispose(){this._token?this._token instanceof Bc&&this._token.dispose():this._token=Hc.None}};Tt.CancellationTokenSource=Gm});var M$=k(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.SharedArrayReceiverStrategy=Qo.SharedArraySenderStrategy=void 0;var _D=Wc(),Os;(function(e){e.Continue=0,e.Cancelled=1})(Os||(Os={}));var Km=class{buffers;constructor(){this.buffers=new Map}enableCancellation(t){if(t.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=Os.Continue,this.buffers.set(t.id,r),t.$cancellationData=r}async sendCancellation(t,r){let n=this.buffers.get(r);if(n===void 0)return;let o=new Int32Array(n,0,1);Atomics.store(o,0,Os.Cancelled)}cleanup(t){this.buffers.delete(t)}dispose(){this.buffers.clear()}};Qo.SharedArraySenderStrategy=Km;var Xm=class{data;constructor(t){this.data=new Int32Array(t,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Os.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Ym=class{token;constructor(t){this.token=new Xm(t)}cancel(){}dispose(){}},Qm=class{kind="request";createCancellationTokenSource(t){let r=t.$cancellationData;return r===void 0?new _D.CancellationTokenSource:new Ym(r)}};Qo.SharedArrayReceiverStrategy=Qm});var th=k(ei=>{"use strict";var vD=ei&&ei.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ei,"__esModule",{value:!0});ei.Semaphore=void 0;var bD=vD(ln()),eh=class{_capacity;_active;_waiting;constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((r,n)=>{this._waiting.push({thunk:t,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,bD.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("Too many thunks active");try{let r=t.thunk();r instanceof Promise?r.then(n=>{this._active--,t.resolve(n),this.runNext()},n=>{this._active--,t.reject(n),this.runNext()}):(this._active--,t.resolve(r),this.runNext())}catch(r){this._active--,t.reject(r),this.runNext()}}};ei.Semaphore=eh});var A$=k(ut=>{"use strict";var wD=ut&&ut.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),xD=ut&&ut.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$D=ut&&ut.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&wD(r,t,n[o]);return xD(r,t),r}})(),SD=ut&&ut.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ut,"__esModule",{value:!0});ut.ReadableStreamMessageReader=ut.AbstractMessageReader=ut.MessageReader=void 0;var nh=SD(ln()),ti=$D(Xo()),rh=Yo(),kD=th(),D$;(function(e){function t(r){let n=r;return n&&ti.func(n.listen)&&ti.func(n.dispose)&&ti.func(n.onError)&&ti.func(n.onClose)&&ti.func(n.onPartialMessage)}e.is=t})(D$||(ut.MessageReader=D$={}));var Jc=class{errorEmitter;closeEmitter;partialMessageEmitter;constructor(){this.errorEmitter=new rh.Emitter,this.closeEmitter=new rh.Emitter,this.partialMessageEmitter=new rh.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose(),this.partialMessageEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t){this.errorEmitter.fire(this.asError(t))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(t){this.partialMessageEmitter.fire(t)}asError(t){return t instanceof Error?t:new Error(`Reader received error. Reason: ${ti.string(t.message)?t.message:"unknown"}`)}};ut.AbstractMessageReader=Jc;var oh;(function(e){function t(r){let n,o,i,s=new Map,a,c=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(i=r.contentDecoder,s.set(i.name,i)),r.contentDecoders!==void 0)for(let u of r.contentDecoders)s.set(u.name,u);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let u of r.contentTypeDecoders)c.set(u.name,u)}return a===void 0&&(a=(0,nh.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:i,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}e.fromOptions=t})(oh||(oh={}));var ih=class extends Jc{readable;options;callback;nextMessageLength;messageToken;buffer;partialMessageTimer;_partialMessageTimeout;readSemaphore;constructor(t,r){super(),this.readable=t,this.options=oh.fromOptions(r),this.buffer=(0,nh.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new kD.Semaphore(1)}set partialMessageTimeout(t){this._partialMessageTimeout=t}get partialMessageTimeout(){return this._partialMessageTimeout}listen(t){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=t;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(t){try{for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let o=n.get("content-length");if(!o){this.fireError(new Error(`Header must provide a Content-Length property.
|
|
11
|
-
${JSON.stringify(Object.fromEntries(n))}`));return}let i=parseInt(o);if(isNaN(i)){this.fireError(new Error(`Content-Length value must be a number. Got ${o}`));return}this.nextMessageLength=i}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,o=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(o)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,nh.default)().timer.setTimeout((t,r)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};ut.ReadableStreamMessageReader=ih});var U$=k(lt=>{"use strict";var PD=lt&<.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),TD=lt&<.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),
|
|
12
|
-
`,F$;(function(e){function t(r){let n=r;return n&&Cs.func(n.dispose)&&Cs.func(n.onClose)&&Cs.func(n.onError)&&Cs.func(n.write)}e.is=t})(F$||(lt.MessageWriter=F$={}));var Gc=class{errorEmitter;closeEmitter;constructor(){this.errorEmitter=new Z$.Emitter,this.closeEmitter=new Z$.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,r,n){this.errorEmitter.fire([this.asError(t),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:new Error(`Writer received error. Reason: ${Cs.string(t.message)?t.message:"unknown"}`)}};lt.AbstractMessageWriter=Gc;var sh;(function(e){function t(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,q$.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,q$.default)().applicationJson.encoder}}e.fromOptions=t})(sh||(sh={}));var ah=class extends Gc{writable;options;errorCount;writeSemaphore;constructor(t,r){super(),this.writable=t,this.options=sh.fromOptions(r),this.errorCount=0,this.writeSemaphore=new ED.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let o=[];return o.push(OD,n.byteLength.toString(),L$),o.push(L$),this.doWrite(t,o,n)},n=>{throw this.fireError(n),n}))}async doWrite(t,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(o){return this.handleError(o,t),Promise.reject(o)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){this.writable.end()}};lt.WriteableStreamMessageWriter=ah});var V$=k(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.AbstractMessageBuffer=void 0;var CD=13,jD=10,
|
|
13
|
-
`,ch=class{_encoding;_chunks;_totalLength;constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let r=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(t=!1){if(this._chunks.length===0)return;let r=0,n=0,o=0,i=0;e:for(;n<this._chunks.length;){let u=this._chunks[n];for(o=0;o<u.length;){switch(u[o]){case CD:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case jD:switch(r){case 1:r=2;break;case 3:r=4,o++;break e;default:r=0}break;default:r=0}o++}i+=u.byteLength,n++}if(r!==4)return;let s=this._read(i+o),a=new Map,c=this.toString(s,"ascii").split(
|
|
14
|
-
${l}`);let h=l.substr(0,d),m=l.substr(d+1).trim();a.set(t?h.toLowerCase():h,m)}return a}tryReadBody(t){if(!(this._totalLength<t))return this._read(t)}get numberOfBytes(){return this._totalLength}_read(t){if(t===0)return this.emptyBuffer();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let i=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(i)}if(this._chunks[0].byteLength>t){let i=this._chunks[0],s=this.asNative(i,t);return this._chunks[0]=i.slice(t),this._totalLength-=t,s}let r=this.allocNative(t),n=0,o=0;for(;t>0;){let i=this._chunks[o];if(i.byteLength>t){let s=i.slice(0,t);r.set(s,n),n+=t,this._chunks[o]=i.slice(t),this._totalLength-=t,t-=t}else r.set(i,n),n+=i.byteLength,this._chunks.shift(),this._totalLength-=i.byteLength,t-=i.byteLength}return r}};Kc.AbstractMessageBuffer=ch});var J$=k(V=>{"use strict";var ND=V&&V.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),MD=V&&V.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),DD=V&&V.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&ND(r,t,n[o]);return MD(r,t),r}})(),AD=V&&V.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(V,"__esModule",{value:!0});V.ConnectionOptions=V.MessageStrategy=V.CancellationStrategy=V.CancellationSenderStrategy=V.CancellationReceiverStrategy=V.RequestCancellationReceiverStrategy=V.IdCancellationReceiverStrategy=V.ConnectionStrategy=V.ConnectionError=V.ConnectionErrors=V.LogTraceNotification=V.SetTraceNotification=V.TraceFormat=V.TraceValues=V.TraceValue=V.Trace=V.NullLogger=V.ProgressType=V.ProgressToken=void 0;V.createMessageConnection=qD;var H$=AD(ln()),De=DD(Xo()),G=Zm(),B$=Fm(),js=Yo(),uh=Wc(),Ms;(function(e){e.type=new G.NotificationType("$/cancelRequest")})(Ms||(Ms={}));var lh;(function(e){function t(r){return typeof r=="string"||typeof r=="number"}e.is=t})(lh||(V.ProgressToken=lh={}));var Is;(function(e){e.type=new G.NotificationType("$/progress")})(Is||(Is={}));var dh=class{__;_pr;constructor(){}};V.ProgressType=dh;var fh;(function(e){function t(r){return De.func(r)}e.is=t})(fh||(fh={}));V.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var pe;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"})(pe||(V.Trace=pe={}));var ph;(function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"})(ph||(V.TraceValue=ph={}));V.TraceValues=ph;(function(e){function t(n){if(!De.string(n))return e.Off;switch(n=n.toLowerCase(),n){case"off":return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose;default:return e.Off}}e.fromString=t;function r(n){switch(n){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}e.toString=r})(pe||(V.Trace=pe={}));var jt;(function(e){e.Text="text",e.JSON="json"})(jt||(V.TraceFormat=jt={}));(function(e){function t(r){return De.string(r)?(r=r.toLowerCase(),r==="json"?e.JSON:e.Text):e.Text}e.fromString=t})(jt||(V.TraceFormat=jt={}));var mh;(function(e){e.type=new G.NotificationType("$/setTrace")})(mh||(V.SetTraceNotification=mh={}));var Xc;(function(e){e.type=new G.NotificationType("$/logTrace")})(Xc||(V.LogTraceNotification=Xc={}));var Ns;(function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"})(Ns||(V.ConnectionErrors=Ns={}));var ri=class e extends Error{code;constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,e.prototype)}};V.ConnectionError=ri;var hh;(function(e){function t(r){let n=r;return n&&De.func(n.cancelUndispatched)}e.is=t})(hh||(V.ConnectionStrategy=hh={}));var Yc;(function(e){function t(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&De.func(n.createCancellationTokenSource)&&(n.dispose===void 0||De.func(n.dispose))}e.is=t})(Yc||(V.IdCancellationReceiverStrategy=Yc={}));var gh;(function(e){function t(r){let n=r;return n&&n.kind==="request"&&De.func(n.createCancellationTokenSource)&&(n.dispose===void 0||De.func(n.dispose))}e.is=t})(gh||(V.RequestCancellationReceiverStrategy=gh={}));var Qc;(function(e){e.Message=Object.freeze({createCancellationTokenSource(r){return new uh.CancellationTokenSource}});function t(r){return Yc.is(r)||gh.is(r)}e.is=t})(Qc||(V.CancellationReceiverStrategy=Qc={}));var eu;(function(e){e.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(Ms.type,{id:n})},cleanup(r){}});function t(r){let n=r;return n&&De.func(n.sendCancellation)&&De.func(n.cleanup)}e.is=t})(eu||(V.CancellationSenderStrategy=eu={}));var tu;(function(e){e.Message=Object.freeze({receiver:Qc.Message,sender:eu.Message});function t(r){let n=r;return n&&Qc.is(n.receiver)&&eu.is(n.sender)}e.is=t})(tu||(V.CancellationStrategy=tu={}));var ru;(function(e){function t(r){let n=r;return n&&De.func(n.handleMessage)}e.is=t})(ru||(V.MessageStrategy=ru={}));var W$;(function(e){function t(r){let n=r;return n&&(tu.is(n.cancellationStrategy)||hh.is(n.connectionStrategy)||ru.is(n.messageStrategy)||De.number(n.maxParallelism))}e.is=t})(W$||(V.ConnectionOptions=W$={}));var rr;(function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"})(rr||(rr={}));function qD(e,t,r,n){let o=r!==void 0?r:V.NullLogger,i=0,s=0,a=0,c="2.0",u=n?.maxParallelism??-1,l=0,d,h=new Map,m,p=new Map,y=new Map,v,P=new B$.LinkedMap,T=new Map,z=new Set,M=new Map,C=pe.Off,Ie=jt.Text,de,mt=rr.New,vn=new js.Emitter,Ar=new js.Emitter,lo=new js.Emitter,bi=new js.Emitter,wi=new js.Emitter,ir=n&&n.cancellationStrategy?n.cancellationStrategy:tu.Message;function eP(g){}function dy(){return mt===rr.Listening}function fy(){return mt===rr.Closed}function fo(){return mt===rr.Disposed}function py(){(mt===rr.New||mt===rr.Listening)&&(mt=rr.Closed,Ar.fire(void 0))}function tP(g){vn.fire([g,void 0,void 0])}function rP(g){vn.fire(g)}e.onClose(py),e.onError(tP),t.onClose(py),t.onError(rP);function my(g){if(g===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+g.toString()}function nP(g){return g===null?"res-unknown-"+(++a).toString():"res-"+g.toString()}function oP(){return"not-"+(++s).toString()}function iP(g,S){G.Message.isRequest(S)?g.set(my(S.id),S):G.Message.isResponse(S)?u===-1?g.set(nP(S.id),S):gy(S):g.set(oP(),S)}function Eu(){v||P.size===0||u!==-1&&l>=u||(v=(0,H$.default)().timer.setImmediate(async()=>{if(v=void 0,P.size===0||u!==-1&&l>=u)return;let g=P.shift(),S;try{l++;let O=n?.messageStrategy;ru.is(O)?S=O.handleMessage(g,hy):S=hy(g)}catch(O){o.error(`Processing message queue failed: ${O.toString()}`)}finally{S instanceof Promise?S.then(()=>{l--,Eu()}).catch(O=>{o.error(`Processing message queue failed: ${O.toString()}`)}):l--,Eu()}}))}async function hy(g){return G.Message.isRequest(g)?aP(g):G.Message.isNotification(g)?cP(g):G.Message.isResponse(g)?gy(g):uP(g)}let sP=g=>{try{if(G.Message.isNotification(g)&&g.method===Ms.type.method){let S=g.params.id,O=my(S),A=P.get(O);if(G.Message.isRequest(A)){let Ne=n?.connectionStrategy,he=Ne&&Ne.cancelUndispatched?Ne.cancelUndispatched(A,eP):void 0;if(he&&(he.error!==void 0||he.result!==void 0)){P.delete(O),M.delete(S),he.id=A.id,Ou(he,g.method,Date.now()),t.write(he).catch(()=>o.error("Sending response for canceled message failed."));return}}let fe=M.get(S);if(fe!==void 0){fe.cancel(),Cu(g);return}else z.add(S)}iP(P,g)}finally{Eu()}};async function aP(g){if(fo())return Promise.resolve();function S(He,nt,qe){let Ze={jsonrpc:c,id:g.id};return He instanceof G.ResponseError?Ze.error=He.toJson():Ze.result=He===void 0?null:He,Ou(Ze,nt,qe),t.write(Ze)}function O(He,nt,qe){let Ze={jsonrpc:c,id:g.id,error:He.toJson()};return Ou(Ze,nt,qe),t.write(Ze)}fP(g);let A=h.get(g.method),fe,Ne;A&&(fe=A.type,Ne=A.handler);let he=Date.now();if(Ne||d){let He=g.id??String(Date.now()),nt=Yc.is(ir.receiver)?ir.receiver.createCancellationTokenSource(He):ir.receiver.createCancellationTokenSource(g);g.id!==null&&z.has(g.id)&&nt.cancel(),g.id!==null&&M.set(He,nt);try{let qe;if(Ne)if(g.params===void 0){if(fe!==void 0&&fe.numberOfParams!==0)return O(new G.ResponseError(G.ErrorCodes.InvalidParams,`Request ${g.method} defines ${fe.numberOfParams} params but received none.`),g.method,he);qe=Ne(nt.token)}else if(Array.isArray(g.params)){if(fe!==void 0&&fe.parameterStructures===G.ParameterStructures.byName)return O(new G.ResponseError(G.ErrorCodes.InvalidParams,`Request ${g.method} defines parameters by name but received parameters by position`),g.method,he);qe=Ne(...g.params,nt.token)}else{if(fe!==void 0&&fe.parameterStructures===G.ParameterStructures.byPosition)return O(new G.ResponseError(G.ErrorCodes.InvalidParams,`Request ${g.method} defines parameters by position but received parameters by name`),g.method,he);qe=Ne(g.params,nt.token)}else d&&(qe=d(g.method,g.params,nt.token));let Ze=await qe;await S(Ze,g.method,he)}catch(qe){qe instanceof G.ResponseError?await S(qe,g.method,he):qe&&De.string(qe.message)?await O(new G.ResponseError(G.ErrorCodes.InternalError,`Request ${g.method} failed with message: ${qe.message}`),g.method,he):await O(new G.ResponseError(G.ErrorCodes.InternalError,`Request ${g.method} failed unexpectedly without providing any details.`),g.method,he)}finally{M.delete(He)}}else await O(new G.ResponseError(G.ErrorCodes.MethodNotFound,`Unhandled method ${g.method}`),g.method,he)}function gy(g){if(!fo())if(g.id===null)g.error?o.error(`Received response message without id: Error is:
|
|
15
|
-
${JSON.stringify(g.error,void 0,4)}`):o.error("Received response message without id. No further error information provided.");else{let S=g.id,O=T.get(S);if(pP(g,O),O!==void 0){T.delete(S);try{if(g.error){let A=g.error;O.reject(new G.ResponseError(A.code,A.message,A.data))}else if(g.result!==void 0)O.resolve(g.result);else throw new Error("Should never happen.")}catch(A){A.message?o.error(`Response handler '${O.method}' failed with message: ${A.message}`):o.error(`Response handler '${O.method}' failed unexpectedly.`)}}}}async function cP(g){if(fo())return;let S,O;if(g.method===
|
|
16
|
-
${JSON.stringify(g,null,4)}`);let S=g;if(De.string(S.id)||De.number(S.id)){let O=S.id,A=T.get(O);A&&A.reject(new Error("The received response has neither a result nor an error property."))}}function qr(g){if(g!=null)switch(C){case pe.Verbose:return JSON.stringify(g,null,4);case pe.Compact:return JSON.stringify(g);default:return}}function lP(g){if(!(C===pe.Off||!de))if(Ie===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&g.params&&(S=`Params: ${qr(g.params)}`),de.log(`Sending request '${g.method} - (${g.id})'.`,S)}else po("send-request",g)}function dP(g){if(!(C===pe.Off||!de))if(Ie===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&(g.params?S=`Params: ${qr(g.params)}`:S="No parameters provided."),de.log(`Sending notification '${g.method}'.`,S)}else po("send-notification",g)}function Ou(g,S,O){if(!(C===pe.Off||!de))if(Ie===jt.Text){let A;(C===pe.Verbose||C===pe.Compact)&&(g.error&&g.error.data?A=`Error data: ${qr(g.error.data)}`:g.result?A=`Result: ${qr(g.result)}`:g.error===void 0&&(A="No result returned.")),de.log(`Sending response '${S} - (${g.id})'. Processing request took ${Date.now()-O}ms`,A)}else po("send-response",g)}function fP(g){if(!(C===pe.Off||!de))if(Ie===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&g.params&&(S=`Params: ${qr(g.params)}`),de.log(`Received request '${g.method} - (${g.id})'.`,S)}else po("receive-request",g)}function Cu(g){if(!(C===pe.Off||!de||g.method===Xc.type.method))if(Ie===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&(g.params?S=`Params: ${qr(g.params)}`:S="No parameters provided."),de.log(`Received notification '${g.method}'.`,S)}else po("receive-notification",g)}function pP(g,S){if(!(C===pe.Off||!de))if(Ie===jt.Text){let O;if((C===pe.Verbose||C===pe.Compact)&&(g.error&&g.error.data?O=`Error data: ${qr(g.error.data)}`:g.result?O=`Result: ${qr(g.result)}`:g.error===void 0&&(O="No result returned.")),S){let A=g.error?` Request failed: ${g.error.message} (${g.error.code}).`:"";de.log(`Received response '${S.method} - (${g.id})' in ${Date.now()-S.timerStart}ms.${A}`,O)}else de.log(`Received response ${g.id} without active response promise.`,O)}else po("receive-response",g)}function po(g,S){if(!de||C===pe.Off)return;let O={isLSPMessage:!0,type:g,message:S,timestamp:Date.now()};de.log(O)}function xi(){if(fy())throw new ri(Ns.Closed,"Connection is closed.");if(fo())throw new ri(Ns.Disposed,"Connection is disposed.")}function mP(){if(dy())throw new ri(Ns.AlreadyListening,"Connection is already listening")}function hP(){if(!dy())throw new Error("Call listen() first.")}function $i(g){return g===void 0?null:g}function yy(g){if(g!==null)return g}function _y(g){return g!=null&&!Array.isArray(g)&&typeof g=="object"}function ju(g,S){switch(g){case G.ParameterStructures.auto:return _y(S)?yy(S):[$i(S)];case G.ParameterStructures.byName:if(!_y(S))throw new Error("Received parameters by name but param is not an object literal.");return yy(S);case G.ParameterStructures.byPosition:return[$i(S)];default:throw new Error(`Unknown parameter structure ${g.toString()}`)}}function vy(g,S){let O,A=g.numberOfParams;switch(A){case 0:O=void 0;break;case 1:O=ju(g.parameterStructures,S[0]);break;default:O=[];for(let fe=0;fe<S.length&&fe<A;fe++)O.push($i(S[fe]));if(S.length<A)for(let fe=S.length;fe<A;fe++)O.push(null);break}return O}let bn={sendNotification:(g,...S)=>{xi();let O,A;if(De.string(g)){O=g;let Ne=S[0],he=0,He=G.ParameterStructures.auto;G.ParameterStructures.is(Ne)&&(he=1,He=Ne);let nt=S.length,qe=nt-he;switch(qe){case 0:A=void 0;break;case 1:A=ju(He,S[he]);break;default:if(He===G.ParameterStructures.byName)throw new Error(`Received ${qe} parameters for 'by Name' notification parameter structure.`);A=S.slice(he,nt).map(Ze=>$i(Ze));break}}else{let Ne=S;O=g.method,A=vy(g,Ne)}let fe={jsonrpc:c,method:O,params:A};return dP(fe),t.write(fe).catch(Ne=>{throw o.error("Sending notification failed."),Ne})},onNotification:(g,S)=>{xi();let O;return De.func(g)?m=g:S&&(De.string(g)?(O=g,p.set(g,{type:void 0,handler:S})):(O=g.method,p.set(g.method,{type:g,handler:S}))),{dispose:()=>{O!==void 0?p.get(O)?.handler===S&&p.delete(O):m===g&&(m=void 0)}}},onProgress:(g,S,O)=>{if(y.has(S))throw new Error(`Progress handler for token ${S} already registered`);return y.set(S,O),{dispose:()=>{y.get(S)===O&&y.delete(S)}}},sendProgress:(g,S,O)=>bn.sendNotification(Is.type,{token:S,value:O}),onUnhandledProgress:bi.event,sendRequest:(g,...S)=>{xi(),hP();function O(Ze,Bt){let br=ir.sender.sendCancellation(Ze,Bt);br===void 0?o.log(`Received no promise from cancellation strategy when cancelling id ${Bt}`):br.catch(()=>{o.log(`Sending cancellation messages for id ${Bt} failed.`)})}let A,fe,Ne;if(De.string(g)){A=g;let Ze=S[0],Bt=S[S.length-1],br=0,Si=G.ParameterStructures.auto;G.ParameterStructures.is(Ze)&&(br=1,Si=Ze);let wn=S.length;uh.CancellationToken.is(Bt)&&(wn=wn-1,Ne=Bt);let sr=wn-br;switch(sr){case 0:fe=void 0;break;case 1:fe=ju(Si,S[br]);break;default:if(Si===G.ParameterStructures.byName)throw new Error(`Received ${sr} parameters for 'by Name' request parameter structure.`);fe=S.slice(br,wn).map(gP=>$i(gP));break}}else{let Ze=S;A=g.method,fe=vy(g,Ze);let Bt=g.numberOfParams;Ne=uh.CancellationToken.is(Ze[Bt])?Ze[Bt]:void 0}let he=i++,He,nt=!1;Ne!==void 0&&(Ne.isCancellationRequested?nt=!0:He=Ne.onCancellationRequested(()=>{O(bn,he)}));let qe={jsonrpc:c,id:he,method:A,params:fe};return lP(qe),typeof ir.sender.enableCancellation=="function"&&ir.sender.enableCancellation(qe),new Promise(async(Ze,Bt)=>{let br=sr=>{Ze(sr),ir.sender.cleanup(he),He?.dispose()},Si=sr=>{Bt(sr),ir.sender.cleanup(he),He?.dispose()},wn={method:A,timerStart:Date.now(),resolve:br,reject:Si};try{T.set(he,wn),await t.write(qe),nt&&O(bn,he)}catch(sr){throw T.delete(he),wn.reject(new G.ResponseError(G.ErrorCodes.MessageWriteError,sr.message?sr.message:"Unknown reason")),o.error("Sending request failed."),sr}})},onRequest:(g,S)=>{xi();let O=null;return fh.is(g)?(O=void 0,d=g):De.string(g)?(O=null,S!==void 0&&(O=g,h.set(g,{handler:S,type:void 0}))):S!==void 0&&(O=g.method,h.set(g.method,{type:g,handler:S})),{dispose:()=>{O!==null&&(O!==void 0?h.get(O)?.handler===S&&h.delete(O):d===g&&(d=void 0))}}},hasPendingResponse:()=>T.size>0,trace:async(g,S,O)=>{let A=!1,fe=jt.Text;O!==void 0&&(De.boolean(O)?A=O:(A=O.sendNotification||!1,fe=O.traceFormat||jt.Text)),C=g,Ie=fe,C===pe.Off?de=void 0:de=S,A&&!fy()&&!fo()&&await bn.sendNotification(mh.type,{value:pe.toString(g)})},onError:vn.event,onClose:Ar.event,onUnhandledNotification:lo.event,onDispose:wi.event,end:()=>{t.end()},dispose:()=>{if(fo())return;mt=rr.Disposed,wi.fire(void 0);let g=new G.ResponseError(G.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let S of T.values())S.reject(g);T=new Map,M=new Map,z=new Set,P=new B$.LinkedMap,De.func(t.dispose)&&t.dispose(),De.func(e.dispose)&&e.dispose()},listen:()=>{xi(),mP(),mt=rr.Listening,e.listen(sP)},inspect:()=>{(0,H$.default)().console.log("inspect")}};return bn.onNotification(Xc.type,g=>{if(C===pe.Off||!de)return;let S=C===pe.Verbose||C===pe.Compact;de.log(g.message,S?g.verbose:void 0)}),bn.onNotification(Is.type,async g=>{let S=y.get(g.token);S?await S(g.value):bi.fire(g)}),bn}});var Or=k(w=>{"use strict";var ZD=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(w,"__esModule",{value:!0});w.ProgressType=w.ProgressToken=w.createMessageConnection=w.NullLogger=w.ConnectionOptions=w.ConnectionStrategy=w.AbstractMessageBuffer=w.WriteableStreamMessageWriter=w.AbstractMessageWriter=w.MessageWriter=w.ReadableStreamMessageReader=w.AbstractMessageReader=w.MessageReader=w.SharedArrayReceiverStrategy=w.SharedArraySenderStrategy=w.CancellationToken=w.CancellationTokenSource=w.Emitter=w.Event=w.Disposable=w.LRUCache=w.Touch=w.LinkedMap=w.ParameterStructures=w.NotificationType9=w.NotificationType8=w.NotificationType7=w.NotificationType6=w.NotificationType5=w.NotificationType4=w.NotificationType3=w.NotificationType2=w.NotificationType1=w.NotificationType0=w.NotificationType=w.ErrorCodes=w.ResponseError=w.RequestType9=w.RequestType8=w.RequestType7=w.RequestType6=w.RequestType5=w.RequestType4=w.RequestType3=w.RequestType2=w.RequestType1=w.RequestType0=w.RequestType=w.Message=w.RAL=void 0;w.MessageStrategy=w.CancellationStrategy=w.CancellationSenderStrategy=w.RequestCancellationReceiverStrategy=w.IdCancellationReceiverStrategy=w.CancellationReceiverStrategy=w.ConnectionError=w.ConnectionErrors=w.LogTraceNotification=w.SetTraceNotification=w.TraceFormat=w.TraceValues=w.TraceValue=w.Trace=void 0;var Se=Zm();Object.defineProperty(w,"Message",{enumerable:!0,get:function(){return Se.Message}});Object.defineProperty(w,"RequestType",{enumerable:!0,get:function(){return Se.RequestType}});Object.defineProperty(w,"RequestType0",{enumerable:!0,get:function(){return Se.RequestType0}});Object.defineProperty(w,"RequestType1",{enumerable:!0,get:function(){return Se.RequestType1}});Object.defineProperty(w,"RequestType2",{enumerable:!0,get:function(){return Se.RequestType2}});Object.defineProperty(w,"RequestType3",{enumerable:!0,get:function(){return Se.RequestType3}});Object.defineProperty(w,"RequestType4",{enumerable:!0,get:function(){return Se.RequestType4}});Object.defineProperty(w,"RequestType5",{enumerable:!0,get:function(){return Se.RequestType5}});Object.defineProperty(w,"RequestType6",{enumerable:!0,get:function(){return Se.RequestType6}});Object.defineProperty(w,"RequestType7",{enumerable:!0,get:function(){return Se.RequestType7}});Object.defineProperty(w,"RequestType8",{enumerable:!0,get:function(){return Se.RequestType8}});Object.defineProperty(w,"RequestType9",{enumerable:!0,get:function(){return Se.RequestType9}});Object.defineProperty(w,"ResponseError",{enumerable:!0,get:function(){return Se.ResponseError}});Object.defineProperty(w,"ErrorCodes",{enumerable:!0,get:function(){return Se.ErrorCodes}});Object.defineProperty(w,"NotificationType",{enumerable:!0,get:function(){return Se.NotificationType}});Object.defineProperty(w,"NotificationType0",{enumerable:!0,get:function(){return Se.NotificationType0}});Object.defineProperty(w,"NotificationType1",{enumerable:!0,get:function(){return Se.NotificationType1}});Object.defineProperty(w,"NotificationType2",{enumerable:!0,get:function(){return Se.NotificationType2}});Object.defineProperty(w,"NotificationType3",{enumerable:!0,get:function(){return Se.NotificationType3}});Object.defineProperty(w,"NotificationType4",{enumerable:!0,get:function(){return Se.NotificationType4}});Object.defineProperty(w,"NotificationType5",{enumerable:!0,get:function(){return Se.NotificationType5}});Object.defineProperty(w,"NotificationType6",{enumerable:!0,get:function(){return Se.NotificationType6}});Object.defineProperty(w,"NotificationType7",{enumerable:!0,get:function(){return Se.NotificationType7}});Object.defineProperty(w,"NotificationType8",{enumerable:!0,get:function(){return Se.NotificationType8}});Object.defineProperty(w,"NotificationType9",{enumerable:!0,get:function(){return Se.NotificationType9}});Object.defineProperty(w,"ParameterStructures",{enumerable:!0,get:function(){return Se.ParameterStructures}});var yh=Fm();Object.defineProperty(w,"LinkedMap",{enumerable:!0,get:function(){return yh.LinkedMap}});Object.defineProperty(w,"LRUCache",{enumerable:!0,get:function(){return yh.LRUCache}});Object.defineProperty(w,"Touch",{enumerable:!0,get:function(){return yh.Touch}});var LD=I$();Object.defineProperty(w,"Disposable",{enumerable:!0,get:function(){return LD.Disposable}});var G$=Yo();Object.defineProperty(w,"Event",{enumerable:!0,get:function(){return G$.Event}});Object.defineProperty(w,"Emitter",{enumerable:!0,get:function(){return G$.Emitter}});var K$=Wc();Object.defineProperty(w,"CancellationTokenSource",{enumerable:!0,get:function(){return K$.CancellationTokenSource}});Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return K$.CancellationToken}});var X$=M$();Object.defineProperty(w,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return X$.SharedArraySenderStrategy}});Object.defineProperty(w,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return X$.SharedArrayReceiverStrategy}});var _h=A$();Object.defineProperty(w,"MessageReader",{enumerable:!0,get:function(){return _h.MessageReader}});Object.defineProperty(w,"AbstractMessageReader",{enumerable:!0,get:function(){return _h.AbstractMessageReader}});Object.defineProperty(w,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return _h.ReadableStreamMessageReader}});var vh=U$();Object.defineProperty(w,"MessageWriter",{enumerable:!0,get:function(){return vh.MessageWriter}});Object.defineProperty(w,"AbstractMessageWriter",{enumerable:!0,get:function(){return vh.AbstractMessageWriter}});Object.defineProperty(w,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return vh.WriteableStreamMessageWriter}});var FD=V$();Object.defineProperty(w,"AbstractMessageBuffer",{enumerable:!0,get:function(){return FD.AbstractMessageBuffer}});var Fe=J$();Object.defineProperty(w,"ConnectionStrategy",{enumerable:!0,get:function(){return Fe.ConnectionStrategy}});Object.defineProperty(w,"ConnectionOptions",{enumerable:!0,get:function(){return Fe.ConnectionOptions}});Object.defineProperty(w,"NullLogger",{enumerable:!0,get:function(){return Fe.NullLogger}});Object.defineProperty(w,"createMessageConnection",{enumerable:!0,get:function(){return Fe.createMessageConnection}});Object.defineProperty(w,"ProgressToken",{enumerable:!0,get:function(){return Fe.ProgressToken}});Object.defineProperty(w,"ProgressType",{enumerable:!0,get:function(){return Fe.ProgressType}});Object.defineProperty(w,"Trace",{enumerable:!0,get:function(){return Fe.Trace}});Object.defineProperty(w,"TraceValue",{enumerable:!0,get:function(){return Fe.TraceValue}});Object.defineProperty(w,"TraceFormat",{enumerable:!0,get:function(){return Fe.TraceFormat}});Object.defineProperty(w,"SetTraceNotification",{enumerable:!0,get:function(){return Fe.SetTraceNotification}});Object.defineProperty(w,"LogTraceNotification",{enumerable:!0,get:function(){return Fe.LogTraceNotification}});Object.defineProperty(w,"ConnectionErrors",{enumerable:!0,get:function(){return Fe.ConnectionErrors}});Object.defineProperty(w,"ConnectionError",{enumerable:!0,get:function(){return Fe.ConnectionError}});Object.defineProperty(w,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Fe.CancellationReceiverStrategy}});Object.defineProperty(w,"IdCancellationReceiverStrategy",{enumerable:!0,get:function(){return Fe.IdCancellationReceiverStrategy}});Object.defineProperty(w,"RequestCancellationReceiverStrategy",{enumerable:!0,get:function(){return Fe.RequestCancellationReceiverStrategy}});Object.defineProperty(w,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Fe.CancellationSenderStrategy}});Object.defineProperty(w,"CancellationStrategy",{enumerable:!0,get:function(){return Fe.CancellationStrategy}});Object.defineProperty(w,"MessageStrategy",{enumerable:!0,get:function(){return Fe.MessageStrategy}});Object.defineProperty(w,"TraceValues",{enumerable:!0,get:function(){return Fe.TraceValues}});var UD=ZD(ln());w.RAL=UD.default});var e0=k(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});var Y$=mo("util"),Cr=Or(),bh=class e extends Cr.AbstractMessageBuffer{static emptyBuffer=Buffer.allocUnsafe(0);constructor(t="utf-8"){super(t)}emptyBuffer(){return e.emptyBuffer}fromString(t,r){return Buffer.from(t,r)}toString(t,r){return t instanceof Buffer?t.toString(r):new Y$.TextDecoder(r).decode(t)}asNative(t,r){return r===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,r):Buffer.from(t,0,r)}allocNative(t){return Buffer.allocUnsafe(t)}},wh=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Cr.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Cr.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Cr.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),Cr.Disposable.create(()=>this.stream.off("data",t))}},xh=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Cr.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Cr.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Cr.Disposable.create(()=>this.stream.off("end",t))}write(t,r){return new Promise((n,o)=>{let i=s=>{s==null?n():o(s)};typeof t=="string"?this.stream.write(t,r,i):this.stream.write(t,i)})}end(){this.stream.end()}},Q$=Object.freeze({messageBuffer:Object.freeze({create:e=>new bh(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new Y$.TextDecoder(t.charset).decode(e)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:e=>new wh(e),asWritableStream:e=>new xh(e)}),console,timer:Object.freeze({setTimeout(e,t,...r){let n=setTimeout(e,t,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(e,...t){let r=setImmediate(e,...t);return{dispose:()=>clearImmediate(r)}},setInterval(e,t,...r){let n=setInterval(e,t,...r);return{dispose:()=>clearInterval(n)}}})});function $h(){return Q$}(function(e){function t(){Cr.RAL.install(Q$)}e.install=t})($h||($h={}));Sh.default=$h});var Eh=k(ae=>{"use strict";var r0=ae&&ae.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),VD=ae&&ae.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),zh=ae&&ae.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&r0(r,t,n[o]);return VD(r,t),r}})(),HD=ae&&ae.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&r0(t,e,r)},BD=ae&&ae.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ae,"__esModule",{value:!0});ae.StreamMessageWriter=ae.StreamMessageReader=ae.SocketMessageWriter=ae.SocketMessageReader=ae.PortMessageWriter=ae.PortMessageReader=ae.IPCMessageWriter=ae.IPCMessageReader=void 0;ae.generateRandomPipeName=YD;ae.createClientPipeTransport=QD;ae.createServerPipeTransport=eA;ae.createClientSocketTransport=tA;ae.createServerSocketTransport=rA;ae.createMessageConnection=iA;var Ds=BD(e0());Ds.default.install();var WD=zh(mo("path")),JD=zh(mo("os")),GD=zh(mo("fs")),t0=mo("crypto"),iu=mo("net"),It=Or();HD(Or(),ae);var kh=class extends It.AbstractMessageReader{process;constructor(t){super(),this.process=t;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(t){return this.process.on("message",t),It.Disposable.create(()=>this.process.off("message",t))}};ae.IPCMessageReader=kh;var Ph=class extends It.AbstractMessageWriter{process;errorCount;constructor(t){super(),this.process=t,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(t){try{return typeof this.process.send=="function"&&this.process.send(t,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,t)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,t),Promise.reject(r)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){}};ae.IPCMessageWriter=Ph;var Th=class extends It.AbstractMessageReader{onData;constructor(t){super(),this.onData=new It.Emitter,t.on("close",()=>this.fireClose),t.on("error",r=>this.fireError(r)),t.on("message",r=>{this.onData.fire(r)})}listen(t){return this.onData.event(t)}};ae.PortMessageReader=Th;var Rh=class extends It.AbstractMessageWriter{port;errorCount;constructor(t){super(),this.port=t,this.errorCount=0,t.on("close",()=>this.fireClose()),t.on("error",r=>this.fireError(r))}write(t){try{return this.port.postMessage(t),Promise.resolve()}catch(r){return this.handleError(r,t),Promise.reject(r)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){}};ae.PortMessageWriter=Rh;var io=class extends It.ReadableStreamMessageReader{constructor(t,r="utf-8"){super((0,Ds.default)().stream.asReadableStream(t),r)}};ae.SocketMessageReader=io;var so=class extends It.WriteableStreamMessageWriter{socket;constructor(t,r){super((0,Ds.default)().stream.asWritableStream(t),r),this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};ae.SocketMessageWriter=so;var nu=class extends It.ReadableStreamMessageReader{constructor(t,r){super((0,Ds.default)().stream.asReadableStream(t),r)}};ae.StreamMessageReader=nu;var ou=class extends It.WriteableStreamMessageWriter{constructor(t,r){super((0,Ds.default)().stream.asWritableStream(t),r)}};ae.StreamMessageWriter=ou;var KD=process.env.XDG_RUNTIME_DIR,XD=new Map([["linux",107],["darwin",102]]);function YD(){if(process.platform==="win32")return`\\\\.\\pipe\\lsp-${(0,t0.randomBytes)(16).toString("hex")}-sock`;let e=32,t=10,r=GD.realpathSync(KD??JD.tmpdir()),n=XD.get(process.platform);if(n!==void 0&&(e=Math.min(n-r.length-t,e)),e<16)throw new Error(`Unable to generate a random pipe name with ${e} characters.`);let o=(0,t0.randomBytes)(Math.floor(e/2)).toString("hex");return WD.join(r,`lsp-${o}.sock`)}function QD(e,t="utf-8"){let r,n=new Promise((o,i)=>{r=o});return new Promise((o,i)=>{let s=(0,iu.createServer)(a=>{s.close(),r([new io(a,t),new so(a,t)])});s.on("error",i),s.listen(e,()=>{s.removeListener("error",i),o({onConnected:()=>n})})})}function eA(e,t="utf-8"){let r=(0,iu.createConnection)(e);return[new io(r,t),new so(r,t)]}function tA(e,t="utf-8"){let r,n=new Promise((o,i)=>{r=o});return new Promise((o,i)=>{let s=(0,iu.createServer)(a=>{s.close(),r([new io(a,t),new so(a,t)])});s.on("error",i),s.listen(e,"127.0.0.1",()=>{s.removeListener("error",i),o({onConnected:()=>n})})})}function rA(e,t="utf-8"){let r=(0,iu.createConnection)(e,"127.0.0.1");return[new io(r,t),new so(r,t)]}function nA(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function oA(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function iA(e,t,r,n){r||(r=It.NullLogger);let o=nA(e)?new nu(e):e,i=oA(t)?new ou(t):t;return It.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,It.createMessageConnection)(o,i,r,n)}});var gu={};Ys(gu,{AnnotatedTextEdit:()=>jr,ApplyKind:()=>Yh,ChangeAnnotation:()=>fn,ChangeAnnotationIdentifier:()=>We,CodeAction:()=>mg,CodeActionContext:()=>pg,CodeActionKind:()=>fg,CodeActionTag:()=>fu,CodeActionTriggerKind:()=>Vs,CodeDescription:()=>Zh,CodeLens:()=>hg,Color:()=>au,ColorInformation:()=>Ih,ColorPresentation:()=>Nh,Command:()=>ao,CompletionItem:()=>eg,CompletionItemKind:()=>Wh,CompletionItemLabelDetails:()=>Qh,CompletionItemTag:()=>Gh,CompletionList:()=>tg,CreateFile:()=>oi,DeleteFile:()=>si,Diagnostic:()=>Zs,DiagnosticRelatedInformation:()=>cu,DiagnosticSeverity:()=>Ah,DiagnosticTag:()=>qh,DocumentHighlight:()=>sg,DocumentHighlightKind:()=>ig,DocumentLink:()=>yg,DocumentSymbol:()=>dg,DocumentUri:()=>Oh,EOL:()=>sA,FoldingRange:()=>Dh,FoldingRangeKind:()=>Mh,FormattingOptions:()=>gg,Hover:()=>rg,InlayHint:()=>Pg,InlayHintKind:()=>pu,InlayHintLabelPart:()=>mu,InlineCompletionContext:()=>Og,InlineCompletionItem:()=>Tg,InlineCompletionList:()=>Rg,InlineCompletionTriggerKind:()=>zg,InlineValueContext:()=>kg,InlineValueEvaluatableExpression:()=>Sg,InlineValueText:()=>xg,InlineValueVariableLookup:()=>$g,InsertReplaceEdit:()=>Kh,InsertTextFormat:()=>Jh,InsertTextMode:()=>Xh,LanguageKind:()=>Hh,Location:()=>qs,LocationLink:()=>jh,MarkedString:()=>Us,MarkupContent:()=>pn,MarkupKind:()=>du,OptionalVersionedTextDocumentIdentifier:()=>Fs,ParameterInformation:()=>ng,Position:()=>Ht,Range:()=>Ae,RenameFile:()=>ii,SelectedCompletionInfo:()=>Eg,SelectionRange:()=>_g,SemanticTokenModifiers:()=>bg,SemanticTokenTypes:()=>vg,SemanticTokens:()=>wg,SignatureInformation:()=>og,SnippetTextEdit:()=>Lh,StringValue:()=>hu,SymbolInformation:()=>ug,SymbolKind:()=>ag,SymbolTag:()=>cg,TextDocument:()=>jg,TextDocumentEdit:()=>Ls,TextDocumentIdentifier:()=>Uh,TextDocumentItem:()=>Bh,TextEdit:()=>gr,URI:()=>su,VersionedTextDocumentIdentifier:()=>Vh,WorkspaceChange:()=>Fh,WorkspaceEdit:()=>uu,WorkspaceFolder:()=>Cg,WorkspaceSymbol:()=>lg,integer:()=>Ch,uinteger:()=>As});var Oh,su,Ch,As,Ht,Ae,qs,jh,au,Ih,Nh,Mh,Dh,cu,Ah,qh,Zh,Zs,ao,gr,fn,We,jr,Ls,oi,ii,si,uu,ni,Lh,lu,Fh,Uh,Vh,Fs,Hh,Bh,du,pn,Wh,Jh,Gh,Kh,Xh,Yh,Qh,eg,tg,Us,rg,ng,og,ig,sg,ag,cg,ug,lg,dg,fg,Vs,pg,fu,mg,hg,gg,yg,_g,vg,bg,wg,xg,$g,Sg,kg,pu,mu,Pg,hu,Tg,Rg,zg,Eg,Og,Cg,sA,jg,Ig,_,yu=xP(()=>{"use strict";(function(e){function t(r){return typeof r=="string"}e.is=t})(Oh||(Oh={}));(function(e){function t(r){return typeof r=="string"}e.is=t})(su||(su={}));(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}e.is=t})(Ch||(Ch={}));(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}e.is=t})(As||(As={}));(function(e){function t(n,o){return n===Number.MAX_VALUE&&(n=As.MAX_VALUE),o===Number.MAX_VALUE&&(o=As.MAX_VALUE),{line:n,character:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.uinteger(o.line)&&_.uinteger(o.character)}e.is=r})(Ht||(Ht={}));(function(e){function t(n,o,i,s){if(_.uinteger(n)&&_.uinteger(o)&&_.uinteger(i)&&_.uinteger(s))return{start:Ht.create(n,o),end:Ht.create(i,s)};if(Ht.is(n)&&Ht.is(o))return{start:n,end:o};throw new Error(`Range#create called with invalid arguments[${n}, ${o}, ${i}, ${s}]`)}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ht.is(o.start)&&Ht.is(o.end)}e.is=r})(Ae||(Ae={}));(function(e){function t(n,o){return{uri:n,range:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.range)&&(_.string(o.uri)||_.undefined(o.uri))}e.is=r})(qs||(qs={}));(function(e){function t(n,o,i,s){return{targetUri:n,targetRange:o,targetSelectionRange:i,originSelectionRange:s}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.targetRange)&&_.string(o.targetUri)&&Ae.is(o.targetSelectionRange)&&(Ae.is(o.originSelectionRange)||_.undefined(o.originSelectionRange))}e.is=r})(jh||(jh={}));(function(e){function t(n,o,i,s){return{red:n,green:o,blue:i,alpha:s}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.numberRange(o.red,0,1)&&_.numberRange(o.green,0,1)&&_.numberRange(o.blue,0,1)&&_.numberRange(o.alpha,0,1)}e.is=r})(au||(au={}));(function(e){function t(n,o){return{range:n,color:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.range)&&au.is(o.color)}e.is=r})(Ih||(Ih={}));(function(e){function t(n,o,i){return{label:n,textEdit:o,additionalTextEdits:i}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.string(o.label)&&(_.undefined(o.textEdit)||gr.is(o))&&(_.undefined(o.additionalTextEdits)||_.typedArray(o.additionalTextEdits,gr.is))}e.is=r})(Nh||(Nh={}));(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Mh||(Mh={}));(function(e){function t(n,o,i,s,a,c){let u={startLine:n,endLine:o};return _.defined(i)&&(u.startCharacter=i),_.defined(s)&&(u.endCharacter=s),_.defined(a)&&(u.kind=a),_.defined(c)&&(u.collapsedText=c),u}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.uinteger(o.startLine)&&_.uinteger(o.startLine)&&(_.undefined(o.startCharacter)||_.uinteger(o.startCharacter))&&(_.undefined(o.endCharacter)||_.uinteger(o.endCharacter))&&(_.undefined(o.kind)||_.string(o.kind))}e.is=r})(Dh||(Dh={}));(function(e){function t(n,o){return{location:n,message:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&qs.is(o.location)&&_.string(o.message)}e.is=r})(cu||(cu={}));(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(Ah||(Ah={}));(function(e){e.Unnecessary=1,e.Deprecated=2})(qh||(qh={}));(function(e){function t(r){let n=r;return _.objectLiteral(n)&&_.string(n.href)}e.is=t})(Zh||(Zh={}));(function(e){function t(i,s,a,c,u,l){let d={range:i,message:s};return _.defined(a)&&(d.severity=a),_.defined(c)&&(d.code=c),_.defined(u)&&(d.source=u),_.defined(l)&&(d.relatedInformation=l),d}e.create=t;function r(i){var s;let a=i;return _.defined(a)&&Ae.is(a.range)&&(_.string(a.message)||pn.is(a.message))&&(_.number(a.severity)||_.undefined(a.severity))&&(_.integer(a.code)||_.string(a.code)||_.undefined(a.code))&&(_.undefined(a.codeDescription)||_.string((s=a.codeDescription)===null||s===void 0?void 0:s.href))&&(_.string(a.source)||_.undefined(a.source))&&(_.undefined(a.relatedInformation)||_.typedArray(a.relatedInformation,cu.is))}e.is=r;function n(i){return _.string(i.message)}e.is3_17=n;function o(i){if(_.string(i.message))return i.message;if(pn.is(i.message))return i.message.value;throw new Error(`Unknown message type ${typeof i.message}`)}e.getMessageString=o})(Zs||(Zs={}));(function(e){function t(n,o,...i){let s={title:n,command:o};return _.defined(i)&&i.length>0&&(s.arguments=i),s}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.title)&&(o.tooltip===void 0||_.string(o.tooltip))&&_.string(o.command)}e.is=r})(ao||(ao={}));(function(e){function t(i,s){return{range:i,newText:s}}e.replace=t;function r(i,s){return{range:{start:i,end:i},newText:s}}e.insert=r;function n(i){return{range:i,newText:""}}e.del=n;function o(i){let s=i;return _.objectLiteral(s)&&_.string(s.newText)&&Ae.is(s.range)}e.is=o})(gr||(gr={}));(function(e){function t(n,o,i){let s={label:n};return o!==void 0&&(s.needsConfirmation=o),i!==void 0&&(s.description=i),s}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.string(o.label)&&(_.boolean(o.needsConfirmation)||o.needsConfirmation===void 0)&&(_.string(o.description)||o.description===void 0)}e.is=r})(fn||(fn={}));(function(e){function t(r){let n=r;return _.string(n)}e.is=t})(We||(We={}));(function(e){function t(i,s,a){return{range:i,newText:s,annotationId:a}}e.replace=t;function r(i,s,a){return{range:{start:i,end:i},newText:s,annotationId:a}}e.insert=r;function n(i,s){return{range:i,newText:"",annotationId:s}}e.del=n;function o(i){let s=i;return gr.is(s)&&(fn.is(s.annotationId)||We.is(s.annotationId))}e.is=o})(jr||(jr={}));(function(e){function t(n,o){return{textDocument:n,edits:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&Fs.is(o.textDocument)&&Array.isArray(o.edits)}e.is=r})(Ls||(Ls={}));(function(e){function t(n,o,i){let s={kind:"create",uri:n};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(s.options=o),i!==void 0&&(s.annotationId=i),s}e.create=t;function r(n){let o=n;return o&&o.kind==="create"&&_.string(o.uri)&&(o.options===void 0||(o.options.overwrite===void 0||_.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||_.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||We.is(o.annotationId))}e.is=r})(oi||(oi={}));(function(e){function t(n,o,i,s){let a={kind:"rename",oldUri:n,newUri:o};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}e.create=t;function r(n){let o=n;return o&&o.kind==="rename"&&_.string(o.oldUri)&&_.string(o.newUri)&&(o.options===void 0||(o.options.overwrite===void 0||_.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||_.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||We.is(o.annotationId))}e.is=r})(ii||(ii={}));(function(e){function t(n,o,i){let s={kind:"delete",uri:n};return o!==void 0&&(o.recursive!==void 0||o.ignoreIfNotExists!==void 0)&&(s.options=o),i!==void 0&&(s.annotationId=i),s}e.create=t;function r(n){let o=n;return o&&o.kind==="delete"&&_.string(o.uri)&&(o.options===void 0||(o.options.recursive===void 0||_.boolean(o.options.recursive))&&(o.options.ignoreIfNotExists===void 0||_.boolean(o.options.ignoreIfNotExists)))&&(o.annotationId===void 0||We.is(o.annotationId))}e.is=r})(si||(si={}));(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(o=>_.string(o.kind)?oi.is(o)||ii.is(o)||si.is(o):Ls.is(o)))}e.is=t})(uu||(uu={}));ni=class{constructor(t,r){this.edits=t,this.changeAnnotations=r}insert(t,r,n){let o,i;if(n===void 0?o=gr.insert(t,r):We.is(n)?(i=n,o=jr.insert(t,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),o=jr.insert(t,r,i)),this.edits.push(o),i!==void 0)return i}replace(t,r,n){let o,i;if(n===void 0?o=gr.replace(t,r):We.is(n)?(i=n,o=jr.replace(t,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),o=jr.replace(t,r,i)),this.edits.push(o),i!==void 0)return i}delete(t,r){let n,o;if(r===void 0?n=gr.del(t):We.is(r)?(o=r,n=jr.del(t,r)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(r),n=jr.del(t,o)),this.edits.push(n),o!==void 0)return o}add(t){this.edits.push(t)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(t){if(t===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}};(function(e){function t(r){let n=r;return _.objectLiteral(n)&&Ae.is(n.range)&&hu.isSnippet(n.snippet)&&(n.annotationId===void 0||fn.is(n.annotationId)||We.is(n.annotationId))}e.is=t})(Lh||(Lh={}));lu=class{constructor(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(t,r){let n;if(We.is(t)?n=t:(n=this.nextId(),r=t),this._annotations[n]!==void 0)throw new Error(`Id ${n} is already in use.`);if(r===void 0)throw new Error(`No annotation provided for id ${n}`);return this._annotations[n]=r,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},Fh=class{constructor(t){this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new lu(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(r=>{if(Ls.is(r)){let n=new ni(r.edits,this._changeAnnotations);this._textEditChanges[r.textDocument.uri]=n}})):t.changes&&Object.keys(t.changes).forEach(r=>{let n=new ni(t.changes[r]);this._textEditChanges[r]=n})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(t){if(Fs.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let r={uri:t.uri,version:t.version},n=this._textEditChanges[r.uri];if(!n){let o=[],i={textDocument:r,edits:o};this._workspaceEdit.documentChanges.push(i),n=new ni(o,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let r=this._textEditChanges[t];if(!r){let n=[];this._workspaceEdit.changes[t]=n,r=new ni(n),this._textEditChanges[t]=r}return r}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new lu,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;fn.is(r)||We.is(r)?o=r:n=r;let i,s;if(o===void 0?i=oi.create(t,n):(s=We.is(o)?o:this._changeAnnotations.manage(o),i=oi.create(t,n,s)),this._workspaceEdit.documentChanges.push(i),s!==void 0)return s}renameFile(t,r,n,o){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;fn.is(n)||We.is(n)?i=n:o=n;let s,a;if(i===void 0?s=ii.create(t,r,o):(a=We.is(i)?i:this._changeAnnotations.manage(i),s=ii.create(t,r,o,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}deleteFile(t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;fn.is(r)||We.is(r)?o=r:n=r;let i,s;if(o===void 0?i=si.create(t,n):(s=We.is(o)?o:this._changeAnnotations.manage(o),i=si.create(t,n,s)),this._workspaceEdit.documentChanges.push(i),s!==void 0)return s}};(function(e){function t(n){return{uri:n}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)}e.is=r})(Uh||(Uh={}));(function(e){function t(n,o){return{uri:n,version:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)&&_.integer(o.version)}e.is=r})(Vh||(Vh={}));(function(e){function t(n,o){return{uri:n,version:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)&&(o.version===null||_.integer(o.version))}e.is=r})(Fs||(Fs={}));(function(e){e.ABAP="abap",e.WindowsBat="bat",e.BibTeX="bibtex",e.Clojure="clojure",e.Coffeescript="coffeescript",e.C="c",e.CPP="cpp",e.CSharp="csharp",e.CSS="css",e.D="d",e.Delphi="pascal",e.Diff="diff",e.Dart="dart",e.Dockerfile="dockerfile",e.Elixir="elixir",e.Erlang="erlang",e.FSharp="fsharp",e.GitCommit="git-commit",e.GitRebase="git-rebase",e.Go="go",e.Groovy="groovy",e.Handlebars="handlebars",e.Haskell="haskell",e.HTML="html",e.Ini="ini",e.Java="java",e.JavaScript="javascript",e.JavaScriptReact="javascriptreact",e.JSON="json",e.LaTeX="latex",e.Less="less",e.Lua="lua",e.Makefile="makefile",e.Markdown="markdown",e.ObjectiveC="objective-c",e.ObjectiveCPP="objective-cpp",e.Pascal="pascal",e.Perl="perl",e.Perl6="perl6",e.PHP="php",e.Plaintext="plaintext",e.Powershell="powershell",e.Pug="jade",e.Python="python",e.R="r",e.Razor="razor",e.Ruby="ruby",e.Rust="rust",e.SCSS="scss",e.SASS="sass",e.Scala="scala",e.ShaderLab="shaderlab",e.ShellScript="shellscript",e.SQL="sql",e.Swift="swift",e.TypeScript="typescript",e.TypeScriptReact="typescriptreact",e.TeX="tex",e.VisualBasic="vb",e.XML="xml",e.XSL="xsl",e.YAML="yaml"})(Hh||(Hh={}));(function(e){function t(n,o,i,s){return{uri:n,languageId:o,version:i,text:s}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)&&_.string(o.languageId)&&_.integer(o.version)&&_.string(o.text)}e.is=r})(Bh||(Bh={}));(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){let n=r;return n===e.PlainText||n===e.Markdown}e.is=t})(du||(du={}));(function(e){function t(r){let n=r;return _.objectLiteral(r)&&du.is(n.kind)&&_.string(n.value)}e.is=t})(pn||(pn={}));(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Wh||(Wh={}));(function(e){e.PlainText=1,e.Snippet=2})(Jh||(Jh={}));(function(e){e.Deprecated=1})(Gh||(Gh={}));(function(e){function t(n,o,i){return{newText:n,insert:o,replace:i}}e.create=t;function r(n){let o=n;return o&&_.string(o.newText)&&Ae.is(o.insert)&&Ae.is(o.replace)}e.is=r})(Kh||(Kh={}));(function(e){e.asIs=1,e.adjustIndentation=2})(Xh||(Xh={}));(function(e){e.Replace=1,e.Merge=2})(Yh||(Yh={}));(function(e){function t(r){let n=r;return n&&(_.string(n.detail)||n.detail===void 0)&&(_.string(n.description)||n.description===void 0)}e.is=t})(Qh||(Qh={}));(function(e){function t(r){return{label:r}}e.create=t})(eg||(eg={}));(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}e.create=t})(tg||(tg={}));(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function r(n){let o=n;return _.string(o)||_.objectLiteral(o)&&_.string(o.language)&&_.string(o.value)}e.is=r})(Us||(Us={}));(function(e){function t(r){let n=r;return!!n&&_.objectLiteral(n)&&(pn.is(n.contents)||Us.is(n.contents)||_.typedArray(n.contents,Us.is))&&(r.range===void 0||Ae.is(r.range))}e.is=t})(rg||(rg={}));(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}e.create=t})(ng||(ng={}));(function(e){function t(r,n,...o){let i={label:r};return _.defined(n)&&(i.documentation=n),_.defined(o)?i.parameters=o:i.parameters=[],i}e.create=t})(og||(og={}));(function(e){e.Text=1,e.Read=2,e.Write=3})(ig||(ig={}));(function(e){function t(r,n){let o={range:r};return _.number(n)&&(o.kind=n),o}e.create=t})(sg||(sg={}));(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(ag||(ag={}));(function(e){e.Deprecated=1})(cg||(cg={}));(function(e){function t(r,n,o,i,s){let a={name:r,kind:n,location:{uri:i,range:o}};return s&&(a.containerName=s),a}e.create=t})(ug||(ug={}));(function(e){function t(r,n,o,i){return i!==void 0?{name:r,kind:n,location:{uri:o,range:i}}:{name:r,kind:n,location:{uri:o}}}e.create=t})(lg||(lg={}));(function(e){function t(n,o,i,s,a,c){let u={name:n,detail:o,kind:i,range:s,selectionRange:a};return c!==void 0&&(u.children=c),u}e.create=t;function r(n){let o=n;return o&&_.string(o.name)&&_.number(o.kind)&&Ae.is(o.range)&&Ae.is(o.selectionRange)&&(o.detail===void 0||_.string(o.detail))&&(o.deprecated===void 0||_.boolean(o.deprecated))&&(o.children===void 0||Array.isArray(o.children))&&(o.tags===void 0||Array.isArray(o.tags))}e.is=r})(dg||(dg={}));(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorMove="refactor.move",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll",e.Notebook="notebook"})(fg||(fg={}));(function(e){e.Invoked=1,e.Automatic=2})(Vs||(Vs={}));(function(e){function t(n,o,i){let s={diagnostics:n};return o!=null&&(s.only=o),i!=null&&(s.triggerKind=i),s}e.create=t;function r(n){let o=n;return _.defined(o)&&_.typedArray(o.diagnostics,Zs.is)&&(o.only===void 0||_.typedArray(o.only,_.string))&&(o.triggerKind===void 0||o.triggerKind===Vs.Invoked||o.triggerKind===Vs.Automatic)}e.is=r})(pg||(pg={}));(function(e){e.LLMGenerated=1;function t(r){return _.defined(r)&&r===e.LLMGenerated}e.is=t})(fu||(fu={}));(function(e){function t(n,o,i){let s={title:n},a=!0;return typeof o=="string"?(a=!1,s.kind=o):ao.is(o)?s.command=o:s.edit=o,a&&i!==void 0&&(s.kind=i),s}e.create=t;function r(n){let o=n;return o&&_.string(o.title)&&(o.diagnostics===void 0||_.typedArray(o.diagnostics,Zs.is))&&(o.kind===void 0||_.string(o.kind))&&(o.edit!==void 0||o.command!==void 0)&&(o.command===void 0||ao.is(o.command))&&(o.isPreferred===void 0||_.boolean(o.isPreferred))&&(o.edit===void 0||uu.is(o.edit))&&(o.tags===void 0||_.typedArray(o.tags,fu.is))}e.is=r})(mg||(mg={}));(function(e){function t(n,o){let i={range:n};return _.defined(o)&&(i.data=o),i}e.create=t;function r(n){let o=n;return _.defined(o)&&Ae.is(o.range)&&(_.undefined(o.command)||ao.is(o.command))}e.is=r})(hg||(hg={}));(function(e){function t(n,o){return{tabSize:n,insertSpaces:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.uinteger(o.tabSize)&&_.boolean(o.insertSpaces)}e.is=r})(gg||(gg={}));(function(e){function t(n,o,i){return{range:n,target:o,data:i}}e.create=t;function r(n){let o=n;return _.defined(o)&&Ae.is(o.range)&&(_.undefined(o.target)||_.string(o.target))}e.is=r})(yg||(yg={}));(function(e){function t(n,o){return{range:n,parent:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.range)&&(o.parent===void 0||e.is(o.parent))}e.is=r})(_g||(_g={}));(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator",e.label="label"})(vg||(vg={}));(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(bg||(bg={}));(function(e){function t(r){let n=r;return _.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}e.is=t})(wg||(wg={}));(function(e){function t(n,o){return{range:n,text:o}}e.create=t;function r(n){let o=n;return o!=null&&Ae.is(o.range)&&_.string(o.text)}e.is=r})(xg||(xg={}));(function(e){function t(n,o,i){return{range:n,variableName:o,caseSensitiveLookup:i}}e.create=t;function r(n){let o=n;return o!=null&&Ae.is(o.range)&&_.boolean(o.caseSensitiveLookup)&&(_.string(o.variableName)||o.variableName===void 0)}e.is=r})($g||($g={}));(function(e){function t(n,o){return{range:n,expression:o}}e.create=t;function r(n){let o=n;return o!=null&&Ae.is(o.range)&&(_.string(o.expression)||o.expression===void 0)}e.is=r})(Sg||(Sg={}));(function(e){function t(n,o){return{frameId:n,stoppedLocation:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&Ae.is(n.stoppedLocation)}e.is=r})(kg||(kg={}));(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}e.is=t})(pu||(pu={}));(function(e){function t(n){return{value:n}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&(o.tooltip===void 0||_.string(o.tooltip)||pn.is(o.tooltip))&&(o.location===void 0||qs.is(o.location))&&(o.command===void 0||ao.is(o.command))}e.is=r})(mu||(mu={}));(function(e){function t(n,o,i){let s={position:n,label:o};return i!==void 0&&(s.kind=i),s}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ht.is(o.position)&&(_.string(o.label)||_.typedArray(o.label,mu.is))&&(o.kind===void 0||pu.is(o.kind))&&o.textEdits===void 0||_.typedArray(o.textEdits,gr.is)&&(o.tooltip===void 0||_.string(o.tooltip)||pn.is(o.tooltip))&&(o.paddingLeft===void 0||_.boolean(o.paddingLeft))&&(o.paddingRight===void 0||_.boolean(o.paddingRight))}e.is=r})(Pg||(Pg={}));(function(e){function t(n){return{kind:"snippet",value:n}}e.createSnippet=t;function r(n){let o=n;return _.objectLiteral(o)&&o.kind==="snippet"&&_.string(o.value)}e.isSnippet=r})(hu||(hu={}));(function(e){function t(r,n,o,i){return{insertText:r,filterText:n,range:o,command:i}}e.create=t})(Tg||(Tg={}));(function(e){function t(r){return{items:r}}e.create=t})(Rg||(Rg={}));(function(e){e.Invoked=1,e.Automatic=2})(zg||(zg={}));(function(e){function t(r,n){return{range:r,text:n}}e.create=t})(Eg||(Eg={}));(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}e.create=t})(Og||(Og={}));(function(e){function t(r){let n=r;return _.objectLiteral(n)&&su.is(n.uri)&&_.string(n.name)}e.is=t})(Cg||(Cg={}));sA=[`
|
|
10
|
+
deps: ${r}}`};var GN={keyword:"dependencies",type:"object",schemaType:"object",error:pr.error,code(e){let[t,r]=KN(e);hx(e,t),gx(e,r)}};function KN({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function hx(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let s in t){let a=t[s];if(a.length===0)continue;let c=(0,Ps.propertyInData)(r,n,s,o.opts.ownProperties);e.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Ps.checkReportMissingProp)(e,u)}):(r.if((0,Np._)`${c} && (${(0,Ps.checkMissingProp)(e,a,i)})`),(0,Ps.reportMissingProp)(e,i),r.else())}}pr.validatePropertyDeps=hx;function gx(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,s=r.name("valid");for(let a in t)(0,JN.alwaysValidSchema)(i,t[a])||(r.if((0,Ps.propertyInData)(r,n,a,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},s);e.mergeValidEvaluated(c,s)},()=>r.var(s,!0)),e.ok(s))}pr.validateSchemaDeps=gx;pr.default=GN});var vx=k(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var _x=Q(),XN=ce(),YN={message:"property name must be valid",params:({params:e})=>(0,_x._)`{propertyName: ${e.propertyName}}`},QN={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:YN,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,XN.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,s=>{e.setParams({propertyName:s}),e.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),t.if((0,_x.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Ip.default=QN});var Ap=k(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var Pc=Ft(),er=Q(),eI=zr(),Tc=ce(),tI={message:"must NOT have additional properties",params:({params:e})=>(0,er._)`{additionalProperty: ${e.additionalProperty}}`},rI={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tI,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:s}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=s;if(s.props=!0,c.removeAdditional!=="all"&&(0,Tc.alwaysValidSchema)(s,r))return;let u=(0,Pc.allSchemaProperties)(n.properties),l=(0,Pc.allSchemaProperties)(n.patternProperties);d(),e.ok((0,er._)`${i} === ${eI.default.errors}`);function d(){t.forIn("key",o,v=>{!u.length&&!l.length?p(v):t.if(h(v),()=>p(v))})}function h(v){let P;if(u.length>8){let T=(0,Tc.schemaRefOrVal)(s,n.properties,"properties");P=(0,Pc.isOwnProperty)(t,T,v)}else u.length?P=(0,er.or)(...u.map(T=>(0,er._)`${v} === ${T}`)):P=er.nil;return l.length&&(P=(0,er.or)(P,...l.map(T=>(0,er._)`${(0,Pc.usePattern)(e,T)}.test(${v})`))),(0,er.not)(P)}function m(v){t.code((0,er._)`delete ${o}[${v}]`)}function p(v){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(v);return}if(r===!1){e.setParams({additionalProperty:v}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Tc.alwaysValidSchema)(s,r)){let P=t.name("valid");c.removeAdditional==="failing"?(y(v,P,!1),t.if((0,er.not)(P),()=>{e.reset(),m(v)})):(y(v,P),a||t.if((0,er.not)(P),()=>t.break()))}}function y(v,P,T){let R={keyword:"additionalProperties",dataProp:v,dataPropType:Tc.Type.Str};T===!1&&Object.assign(R,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(R,P)}}};Dp.default=rI});var xx=k(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var nI=fs(),bx=Ft(),qp=ce(),wx=Ap(),oI={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&wx.default.code(new nI.KeywordCxt(i,wx.default,"additionalProperties"));let s=(0,bx.allSchemaProperties)(r);for(let d of s)i.definedProperties.add(d);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=qp.mergeEvaluated.props(t,(0,qp.toHash)(s),i.props));let a=s.filter(d=>!(0,qp.alwaysValidSchema)(i,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,bx.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Zp.default=oI});var Px=k(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var $x=Ft(),zc=Q(),Sx=ce(),kx=ce(),iI={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:s}=i,a=(0,$x.allSchemaProperties)(r),c=a.filter(y=>(0,Sx.alwaysValidSchema)(i,r[y]));if(a.length===0||c.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let u=s.strictSchema&&!s.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof zc.Name)&&(i.props=(0,kx.evaluatedPropsToName)(t,i.props));let{props:d}=i;h();function h(){for(let y of a)u&&m(y),i.allErrors?p(y):(t.var(l,!0),p(y),t.if(l))}function m(y){for(let v in u)new RegExp(y).test(v)&&(0,Sx.checkStrictMode)(i,`property ${v} matches pattern ${y} (use allowMatchingProperties)`)}function p(y){t.forIn("key",n,v=>{t.if((0,zc._)`${(0,$x.usePattern)(e,y)}.test(${v})`,()=>{let P=c.includes(y);P||e.subschema({keyword:"patternProperties",schemaProp:y,dataProp:v,dataPropType:kx.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,zc._)`${d}[${v}]`,!0):!P&&!i.allErrors&&t.if((0,zc.not)(l),()=>t.break())})})}}};Lp.default=iI});var Tx=k(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var sI=ce(),aI={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,sI.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Fp.default=aI});var zx=k(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var cI=Ft(),uI={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cI.validateUnion,error:{message:"must match a schema in anyOf"}};Up.default=uI});var Rx=k(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var Rc=Q(),lI=ce(),dI={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Rc._)`{passingSchemas: ${e.passing}}`},fI={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:dI,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,s=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(s,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let h;(0,lI.alwaysValidSchema)(o,l)?t.var(c,!0):h=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Rc._)`${c} && ${s}`).assign(s,!1).assign(a,(0,Rc._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(s,!0),t.assign(a,d),h&&e.mergeEvaluated(h,Rc.Name)})})}}};Vp.default=fI});var Ex=k(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var pI=ce(),mI={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,s)=>{if((0,pI.alwaysValidSchema)(n,i))return;let a=e.subschema({keyword:"allOf",schemaProp:s},o);e.ok(o),e.mergeEvaluated(a)})}};Hp.default=mI});var jx=k(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var Ec=Q(),Cx=ce(),hI={message:({params:e})=>(0,Ec.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Ec._)`{failingKeyword: ${e.ifClause}}`},gI={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:hI,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Cx.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Ox(n,"then"),i=Ox(n,"else");if(!o&&!i)return;let s=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,Ec.not)(a),u("else"));e.pass(s,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let h=e.subschema({keyword:l},a);t.assign(s,a),e.mergeValidEvaluated(h,s),d?t.assign(d,(0,Ec._)`${l}`):e.setParams({ifClause:l})}}}};function Ox(e,t){let r=e.schema[t];return r!==void 0&&!(0,Cx.alwaysValidSchema)(e,r)}Bp.default=gI});var Mx=k(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var yI=ce(),_I={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,yI.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Wp.default=_I});var Nx=k(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var vI=Ep(),bI=dx(),wI=Op(),xI=px(),$I=mx(),SI=yx(),kI=vx(),PI=Ap(),TI=xx(),zI=Px(),RI=Tx(),EI=zx(),OI=Rx(),CI=Ex(),jI=jx(),MI=Mx();function NI(e=!1){let t=[RI.default,EI.default,OI.default,CI.default,jI.default,MI.default,kI.default,PI.default,SI.default,TI.default,zI.default];return e?t.push(bI.default,xI.default):t.push(vI.default,wI.default),t.push($I.default),t}Jp.default=NI});var Ix=k(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var Le=Q(),II={message:({schemaCode:e})=>(0,Le.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Le._)`{format: ${e}}`},DI={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:II,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:s,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?h():m();function h(){let p=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),y=r.const("fDef",(0,Le._)`${p}[${s}]`),v=r.let("fType"),P=r.let("format");r.if((0,Le._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign(v,(0,Le._)`${y}.type || "string"`).assign(P,(0,Le._)`${y}.validate`),()=>r.assign(v,(0,Le._)`"string"`).assign(P,y)),e.fail$data((0,Le.or)(T(),R()));function T(){return c.strictSchema===!1?Le.nil:(0,Le._)`${s} && !${P}`}function R(){let I=l.$async?(0,Le._)`(${y}.async ? await ${P}(${n}) : ${P}(${n}))`:(0,Le._)`${P}(${n})`,C=(0,Le._)`(typeof ${P} == "function" ? ${I} : ${P}.test(${n}))`;return(0,Le._)`${P} && ${P} !== true && ${v} === ${t} && !${C}`}}function m(){let p=d.formats[i];if(!p){T();return}if(p===!0)return;let[y,v,P]=R(p);y===t&&e.pass(I());function T(){if(c.strictSchema===!1){d.logger.warn(C());return}throw new Error(C());function C(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function R(C){let Me=C instanceof RegExp?(0,Le.regexpCode)(C):c.code.formats?(0,Le._)`${c.code.formats}${(0,Le.getProperty)(i)}`:void 0,de=r.scopeValue("formats",{key:i,ref:C,code:Me});return typeof C=="object"&&!(C instanceof RegExp)?[C.type||"string",C.validate,(0,Le._)`${de}.validate`]:["string",C,de]}function I(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Le._)`await ${P}(${n})`}return typeof v=="function"?(0,Le._)`${P}(${n})`:(0,Le._)`${P}.test(${n})`}}}};Gp.default=DI});var Dx=k(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var AI=Ix(),qI=[AI.default];Kp.default=qI});var Ax=k(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.contentVocabulary=Vo.metadataVocabulary=void 0;Vo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Zx=k(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var ZI=Ww(),LI=ax(),FI=Nx(),UI=Dx(),qx=Ax(),VI=[ZI.default,LI.default,(0,FI.default)(),UI.default,qx.metadataVocabulary,qx.contentVocabulary];Xp.default=VI});var Fx=k(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:!0});Oc.DiscrError=void 0;var Lx;(function(e){e.Tag="tag",e.Mapping="mapping"})(Lx||(Oc.DiscrError=Lx={}))});var Vx=k(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Ho=Q(),Yp=Fx(),Ux=mc(),HI=ps(),BI=ce(),WI={message:({params:{discrError:e,tagName:t}})=>e===Yp.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Ho._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},JI={keyword:"discriminator",type:"object",schemaType:"object",error:WI,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:s}=o;if(!i.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(!s)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,Ho._)`${r}${(0,Ho.getProperty)(a)}`);t.if((0,Ho._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Yp.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let m=h();t.if(!1);for(let p in m)t.elseIf((0,Ho._)`${u} === ${p}`),t.assign(c,d(m[p]));t.else(),e.error(!1,{discrError:Yp.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(m){let p=t.name("valid"),y=e.subschema({keyword:"oneOf",schemaProp:m},p);return e.mergeEvaluated(y,Ho.Name),p}function h(){var m;let p={},y=P(o),v=!0;for(let I=0;I<s.length;I++){let C=s[I];if(C?.$ref&&!(0,BI.schemaHasRulesButRef)(C,i.self.RULES)){let de=C.$ref;if(C=Ux.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,de),C instanceof Ux.SchemaEnv&&(C=C.schema),C===void 0)throw new HI.default(i.opts.uriResolver,i.baseId,de)}let Me=(m=C?.properties)===null||m===void 0?void 0:m[a];if(typeof Me!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(y||P(C)),T(Me,I)}if(!v)throw new Error(`discriminator: "${a}" must be required`);return p;function P({required:I}){return Array.isArray(I)&&I.includes(a)}function T(I,C){if(I.const)R(I.const,C);else if(I.enum)for(let Me of I.enum)R(Me,C);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function R(I,C){if(typeof I!="string"||I in p)throw new Error(`discriminator: "${a}" values must be unique strings`);p[I]=C}}}};Qp.default=JI});var Hx=k((lF,GI)=>{GI.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 tm=k((Te,em)=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.MissingRefError=Te.ValidationError=Te.CodeGen=Te.Name=Te.nil=Te.stringify=Te.str=Te._=Te.KeywordCxt=Te.Ajv=void 0;var KI=Lw(),XI=Zx(),YI=Vx(),Bx=Hx(),QI=["/properties"],Cc="http://json-schema.org/draft-07/schema",Bo=class extends KI.default{_addVocabularies(){super._addVocabularies(),XI.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(YI.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Bx,QI):Bx;this.addMetaSchema(t,Cc,!1),this.refs["http://json-schema.org/schema"]=Cc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Cc)?Cc:void 0)}};Te.Ajv=Bo;em.exports=Te=Bo;em.exports.Ajv=Bo;Object.defineProperty(Te,"__esModule",{value:!0});Te.default=Bo;var e1=fs();Object.defineProperty(Te,"KeywordCxt",{enumerable:!0,get:function(){return e1.KeywordCxt}});var Wo=Q();Object.defineProperty(Te,"_",{enumerable:!0,get:function(){return Wo._}});Object.defineProperty(Te,"str",{enumerable:!0,get:function(){return Wo.str}});Object.defineProperty(Te,"stringify",{enumerable:!0,get:function(){return Wo.stringify}});Object.defineProperty(Te,"nil",{enumerable:!0,get:function(){return Wo.nil}});Object.defineProperty(Te,"Name",{enumerable:!0,get:function(){return Wo.Name}});Object.defineProperty(Te,"CodeGen",{enumerable:!0,get:function(){return Wo.CodeGen}});var t1=fc();Object.defineProperty(Te,"ValidationError",{enumerable:!0,get:function(){return t1.default}});var r1=ps();Object.defineProperty(Te,"MissingRefError",{enumerable:!0,get:function(){return r1.default}})});var e$=k(hr=>{"use strict";Object.defineProperty(hr,"__esModule",{value:!0});hr.formatNames=hr.fastFormats=hr.fullFormats=void 0;function mr(e,t){return{validate:e,compare:t}}hr.fullFormats={date:mr(Kx,im),time:mr(nm(!0),sm),"date-time":mr(Wx(!0),Yx),"iso-time":mr(nm(),Xx),"iso-date-time":mr(Wx(),Qx),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:c1,"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:h1,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:u1,int32:{type:"number",validate:f1},int64:{type:"number",validate:p1},float:{type:"number",validate:Gx},double:{type:"number",validate:Gx},password:!0,binary:!0};hr.fastFormats={...hr.fullFormats,date:mr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,im),time:mr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,sm),"date-time":mr(/^\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,Yx),"iso-time":mr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Xx),"iso-date-time":mr(/^\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,Qx),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};hr.formatNames=Object.keys(hr.fullFormats);function n1(e){return e%4===0&&(e%100!==0||e%400===0)}var o1=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i1=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Kx(e){let t=o1.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&n1(r)?29:i1[n])}function im(e,t){if(e&&t)return e>t?1:e<t?-1:0}var rm=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function nm(e){return function(r){let n=rm.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],s=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&i<=59&&s<60)return!0;let d=i-l*c,h=o-u*c-(d<0?1:0);return(h===23||h===-1)&&(d===59||d===-1)&&s<61}}function sm(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function Xx(e,t){if(!(e&&t))return;let r=rm.exec(e),n=rm.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var om=/t|\s/i;function Wx(e){let t=nm(e);return function(n){let o=n.split(om);return o.length===2&&Kx(o[0])&&t(o[1])}}function Yx(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function Qx(e,t){if(!(e&&t))return;let[r,n]=e.split(om),[o,i]=t.split(om),s=im(r,o);if(s!==void 0)return s||sm(n,i)}var s1=/\/|:/,a1=/^(?:[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 c1(e){return s1.test(e)&&a1.test(e)}var Jx=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function u1(e){return Jx.lastIndex=0,Jx.test(e)}var l1=-(2**31),d1=2**31-1;function f1(e){return Number.isInteger(e)&&e<=d1&&e>=l1}function p1(e){return Number.isInteger(e)}function Gx(){return!0}var m1=/[^\\]\\Z/;function h1(e){if(m1.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var t$=k(Jo=>{"use strict";Object.defineProperty(Jo,"__esModule",{value:!0});Jo.formatLimitDefinition=void 0;var g1=tm(),tr=Q(),on=tr.operators,jc={formatMaximum:{okStr:"<=",ok:on.LTE,fail:on.GT},formatMinimum:{okStr:">=",ok:on.GTE,fail:on.LT},formatExclusiveMaximum:{okStr:"<",ok:on.LT,fail:on.GTE},formatExclusiveMinimum:{okStr:">",ok:on.GT,fail:on.LTE}},y1={message:({keyword:e,schemaCode:t})=>(0,tr.str)`should be ${jc[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,tr._)`{comparison: ${jc[e].okStr}, limit: ${t}}`};Jo.formatLimitDefinition={keyword:Object.keys(jc),type:"string",schemaType:"string",$data:!0,error:y1,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:s,self:a}=i;if(!s.validateFormats)return;let c=new g1.KeywordCxt(i,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let h=t.scopeValue("formats",{ref:a.formats,code:s.code.formats}),m=t.const("fmt",(0,tr._)`${h}[${c.schemaCode}]`);e.fail$data((0,tr.or)((0,tr._)`typeof ${m} != "object"`,(0,tr._)`${m} instanceof RegExp`,(0,tr._)`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 p=t.scopeValue("formats",{key:h,ref:m,code:s.code.formats?(0,tr._)`${s.code.formats}${(0,tr.getProperty)(h)}`:void 0});e.fail$data(d(p))}function d(h){return(0,tr._)`${h}.compare(${r}, ${n}) ${jc[o].fail} 0`}},dependencies:["format"]};var _1=e=>(e.addKeyword(Jo.formatLimitDefinition),e);Jo.default=_1});var i$=k((Ts,o$)=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var Go=e$(),v1=t$(),am=Q(),r$=new am.Name("fullFormats"),b1=new am.Name("fastFormats"),cm=(e,t={keywords:!0})=>{if(Array.isArray(t))return n$(e,t,Go.fullFormats,r$),e;let[r,n]=t.mode==="fast"?[Go.fastFormats,b1]:[Go.fullFormats,r$],o=t.formats||Go.formatNames;return n$(e,o,r,n),t.keywords&&(0,v1.default)(e),e};cm.get=(e,t="full")=>{let n=(t==="fast"?Go.fastFormats:Go.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function n$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,am._)`require("ajv-formats/dist/formats").${n}`);for(let s of t)e.addFormat(s,r[s])}o$.exports=Ts=cm;Object.defineProperty(Ts,"__esModule",{value:!0});Ts.default=cm});var Xo=k(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.boolean=tD;Er.string=E$;Er.number=rD;Er.error=nD;Er.func=oD;Er.array=O$;Er.stringArray=iD;function tD(e){return e===!0||e===!1}function E$(e){return typeof e=="string"||e instanceof String}function rD(e){return typeof e=="number"||e instanceof Number}function nD(e){return e instanceof Error}function oD(e){return typeof e=="function"}function O$(e){return Array.isArray(e)}function iD(e){return O$(e)&&e.every(t=>E$(t))}});var Zm=k(D=>{"use strict";var sD=D&&D.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),aD=D&&D.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),cD=D&&D.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&sD(r,t,n[o]);return aD(r,t),r}})();Object.defineProperty(D,"__esModule",{value:!0});D.Message=D.NotificationType9=D.NotificationType8=D.NotificationType7=D.NotificationType6=D.NotificationType5=D.NotificationType4=D.NotificationType3=D.NotificationType2=D.NotificationType1=D.NotificationType0=D.NotificationType=D.RequestType9=D.RequestType8=D.RequestType7=D.RequestType6=D.RequestType5=D.RequestType4=D.RequestType3=D.RequestType2=D.RequestType1=D.RequestType=D.RequestType0=D.AbstractMessageSignature=D.ParameterStructures=D.ResponseError=D.ErrorCodes=void 0;var oo=cD(Xo()),gm;(function(e){e.ParseError=-32700,e.InvalidRequest=-32600,e.MethodNotFound=-32601,e.InvalidParams=-32602,e.InternalError=-32603,e.jsonrpcReservedErrorRangeStart=-32099,e.serverErrorStart=-32099,e.MessageWriteError=-32099,e.MessageReadError=-32098,e.PendingResponseRejected=-32097,e.ConnectionInactive=-32096,e.ServerNotInitialized=-32002,e.UnknownErrorCode=-32001,e.jsonrpcReservedErrorRangeEnd=-32e3,e.serverErrorEnd=-32e3})(gm||(D.ErrorCodes=gm={}));var ym=class e extends Error{code;data;constructor(t,r,n){super(r),this.code=oo.number(t)?t:gm.UnknownErrorCode,this.data=n,Object.setPrototypeOf(this,e.prototype)}toJson(){let t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),t}};D.ResponseError=ym;var cn=class e{kind;static auto=new e("auto");static byPosition=new e("byPosition");static byName=new e("byName");constructor(t){this.kind=t}static is(t){return t===e.auto||t===e.byName||t===e.byPosition}toString(){return this.kind}};D.ParameterStructures=cn;var ze=class{method;numberOfParams;constructor(t,r){this.method=t,this.numberOfParams=r}get parameterStructures(){return cn.auto}};D.AbstractMessageSignature=ze;var _m=class extends ze{_;constructor(t){super(t,0)}};D.RequestType0=_m;var vm=class extends ze{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.RequestType=vm;var bm=class extends ze{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.RequestType1=bm;var wm=class extends ze{_;constructor(t){super(t,2)}};D.RequestType2=wm;var xm=class extends ze{_;constructor(t){super(t,3)}};D.RequestType3=xm;var $m=class extends ze{_;constructor(t){super(t,4)}};D.RequestType4=$m;var Sm=class extends ze{_;constructor(t){super(t,5)}};D.RequestType5=Sm;var km=class extends ze{_;constructor(t){super(t,6)}};D.RequestType6=km;var Pm=class extends ze{_;constructor(t){super(t,7)}};D.RequestType7=Pm;var Tm=class extends ze{_;constructor(t){super(t,8)}};D.RequestType8=Tm;var zm=class extends ze{_;constructor(t){super(t,9)}};D.RequestType9=zm;var Rm=class extends ze{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.NotificationType=Rm;var Em=class extends ze{_;constructor(t){super(t,0)}};D.NotificationType0=Em;var Om=class extends ze{_parameterStructures;_;constructor(t,r=cn.auto){super(t,1),this._parameterStructures=r}get parameterStructures(){return this._parameterStructures}};D.NotificationType1=Om;var Cm=class extends ze{_;constructor(t){super(t,2)}};D.NotificationType2=Cm;var jm=class extends ze{_;constructor(t){super(t,3)}};D.NotificationType3=jm;var Mm=class extends ze{_;constructor(t){super(t,4)}};D.NotificationType4=Mm;var Nm=class extends ze{_;constructor(t){super(t,5)}};D.NotificationType5=Nm;var Im=class extends ze{_;constructor(t){super(t,6)}};D.NotificationType6=Im;var Dm=class extends ze{_;constructor(t){super(t,7)}};D.NotificationType7=Dm;var Am=class extends ze{_;constructor(t){super(t,8)}};D.NotificationType8=Am;var qm=class extends ze{_;constructor(t){super(t,9)}};D.NotificationType9=qm;var C$;(function(e){function t(o){let i=o;return i&&oo.string(i.method)&&(oo.string(i.id)||oo.number(i.id))}e.isRequest=t;function r(o){let i=o;return i&&oo.string(i.method)&&o.id===void 0}e.isNotification=r;function n(o){let i=o;return i&&(i.result!==void 0||!!i.error)&&(oo.string(i.id)||oo.number(i.id)||i.id===null)}e.isResponse=n})(C$||(D.Message=C$={}))});var Fm=k(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.LRUCache=un.LinkedMap=un.Touch=void 0;var ct;(function(e){e.None=0,e.First=1,e.AsOld=e.First,e.Last=2,e.AsNew=e.Last})(ct||(un.Touch=ct={}));var Uc=class{[Symbol.toStringTag]="LinkedMap";_map;_head;_tail;_size;_state;constructor(){this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}before(t){let r=this._map.get(t);return r?r.previous?.value:void 0}after(t){let r=this._map.get(t);return r?r.next?.value:void 0}has(t){return this._map.has(t)}get(t,r=ct.None){let n=this._map.get(t);if(n)return r!==ct.None&&this.touch(n,r),n.value}set(t,r,n=ct.None){let o=this._map.get(t);if(o)o.value=r,n!==ct.None&&this.touch(o,n);else{switch(o={key:t,value:r,next:void 0,previous:void 0},n){case ct.None:this.addItemLast(o);break;case ct.First:this.addItemFirst(o);break;case ct.Last:this.addItemLast(o);break;default:this.addItemLast(o);break}this._map.set(t,o),this._size++}return this}delete(t){return!!this.remove(t)}remove(t){let r=this._map.get(t);if(r)return this._map.delete(t),this.removeItem(r),this._size--,r.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let t=this._head;return this._map.delete(t.key),this.removeItem(t),this._size--,t.value}forEach(t,r){let n=this._state,o=this._head;for(;o;){if(r?t.bind(r)(o.value,o.key,this):t(o.value,o.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let t=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.key,done:!1};return r=r.next,o}else return{value:void 0,done:!0}}};return n}values(){let t=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:r.value,done:!1};return r=r.next,o}else return{value:void 0,done:!0}}};return n}entries(){let t=this._state,r=this._head,n={[Symbol.iterator]:()=>n,next:()=>{if(this._state!==t)throw new Error("LinkedMap got modified during iteration.");if(r){let o={value:[r.key,r.value],done:!1};return r=r.next,o}else return{value:void 0,done:!0}}};return n}[Symbol.iterator](){return this.entries()}trimOld(t){if(t>=this.size)return;if(t===0){this.clear();return}let r=this._head,n=this.size;for(;r&&n>t;)this._map.delete(r.key),r=r.next,n--;this._head=r,this._size=n,r&&(r.previous=void 0),this._state++}addItemFirst(t){if(!this._head&&!this._tail)this._tail=t;else if(this._head)t.next=this._head,this._head.previous=t;else throw new Error("Invalid list");this._head=t,this._state++}addItemLast(t){if(!this._head&&!this._tail)this._head=t;else if(this._tail)t.previous=this._tail,this._tail.next=t;else throw new Error("Invalid list");this._tail=t,this._state++}removeItem(t){if(t===this._head&&t===this._tail)this._head=void 0,this._tail=void 0;else if(t===this._head){if(!t.next)throw new Error("Invalid list");t.next.previous=void 0,this._head=t.next}else if(t===this._tail){if(!t.previous)throw new Error("Invalid list");t.previous.next=void 0,this._tail=t.previous}else{let r=t.next,n=t.previous;if(!r||!n)throw new Error("Invalid list");r.previous=n,n.next=r}t.next=void 0,t.previous=void 0,this._state++}touch(t,r){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(r!==ct.First&&r!==ct.Last)){if(r===ct.First){if(t===this._head)return;let n=t.next,o=t.previous;t===this._tail?(o.next=void 0,this._tail=o):(n.previous=o,o.next=n),t.previous=void 0,t.next=this._head,this._head.previous=t,this._head=t,this._state++}else if(r===ct.Last){if(t===this._tail)return;let n=t.next,o=t.previous;t===this._head?(n.previous=void 0,this._head=n):(n.previous=o,o.next=n),t.next=void 0,t.previous=this._tail,this._tail.next=t,this._tail=t,this._state++}}}toJSON(){let t=[];return this.forEach((r,n)=>{t.push([n,r])}),t}fromJSON(t){this.clear();for(let[r,n]of t)this.set(r,n)}};un.LinkedMap=Uc;var Lm=class extends Uc{_limit;_ratio;constructor(t,r=1){super(),this._limit=t,this._ratio=Math.min(Math.max(0,r),1)}get limit(){return this._limit}set limit(t){this._limit=t,this.checkTrim()}get ratio(){return this._ratio}set ratio(t){this._ratio=Math.min(Math.max(0,t),1),this.checkTrim()}get(t,r=ct.AsNew){return super.get(t,r)}peek(t){return super.get(t,ct.None)}set(t,r){return super.set(t,r,ct.Last),this.checkTrim(),this}checkTrim(){this.size>this._limit&&this.trimOld(Math.round(this._limit*this._ratio))}};un.LRUCache=Lm});var M$=k(Vc=>{"use strict";Object.defineProperty(Vc,"__esModule",{value:!0});Vc.Disposable=void 0;var j$;(function(e){function t(r){return{dispose:r}}e.create=t})(j$||(Vc.Disposable=j$={}))});var ln=k(Hm=>{"use strict";Object.defineProperty(Hm,"__esModule",{value:!0});var Um;function Vm(){if(Um===void 0)throw new Error("No runtime abstraction layer installed");return Um}(function(e){function t(r){if(r===void 0)throw new Error("No runtime abstraction layer provided");Um=r}e.install=t})(Vm||(Vm={}));Hm.default=Vm});var Yo=k(dn=>{"use strict";var uD=dn&&dn.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(dn,"__esModule",{value:!0});dn.Emitter=dn.Event=void 0;var lD=uD(ln()),N$;(function(e){let t={dispose(){}};e.None=function(){return t}})(N$||(dn.Event=N$={}));var Bm=class{_callbacks;_contexts;add(t,r=null,n){this._callbacks||(this._callbacks=[],this._contexts=[]),this._callbacks.push(t),this._contexts.push(r),Array.isArray(n)&&n.push({dispose:()=>this.remove(t,r)})}remove(t,r=null){if(!this._callbacks)return;let n=!1;for(let o=0,i=this._callbacks.length;o<i;o++)if(this._callbacks[o]===t)if(this._contexts[o]===r){this._callbacks.splice(o,1),this._contexts.splice(o,1);return}else n=!0;if(n)throw new Error("When adding a listener with a context, you should remove it with the same context")}invoke(...t){if(!this._callbacks)return[];let r=[],n=this._callbacks.slice(0),o=this._contexts.slice(0);for(let i=0,s=n.length;i<s;i++)try{r.push(n[i].apply(o[i],t))}catch(a){(0,lD.default)().console.error(a)}return r}isEmpty(){return!this._callbacks||this._callbacks.length===0}dispose(){this._callbacks=void 0,this._contexts=void 0}},Wm=class e{_options;static _noop=function(){};_event;_callbacks;constructor(t){this._options=t}get event(){return this._event||(this._event=(t,r,n)=>{this._callbacks||(this._callbacks=new Bm),this._options&&this._options.onFirstListenerAdd&&this._callbacks.isEmpty()&&this._options.onFirstListenerAdd(this),this._callbacks.add(t,r);let o={dispose:()=>{this._callbacks&&(this._callbacks.remove(t,r),o.dispose=e._noop,this._options&&this._options.onLastListenerRemove&&this._callbacks.isEmpty()&&this._options.onLastListenerRemove(this))}};return Array.isArray(n)&&n.push(o),o}),this._event}fire(t){this._callbacks&&this._callbacks.invoke.call(this._callbacks,t)}dispose(){this._callbacks&&(this._callbacks.dispose(),this._callbacks=void 0)}};dn.Emitter=Wm});var Wc=k(Tt=>{"use strict";var dD=Tt&&Tt.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),fD=Tt&&Tt.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),pD=Tt&&Tt.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&dD(r,t,n[o]);return fD(r,t),r}})(),mD=Tt&&Tt.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.CancellationTokenSource=Tt.CancellationToken=void 0;var hD=mD(ln()),gD=pD(Xo()),Jm=Yo(),Hc;(function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Jm.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Jm.Event.None});function t(r){let n=r;return n&&(n===e.None||n===e.Cancelled||gD.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}e.is=t})(Hc||(Tt.CancellationToken=Hc={}));var yD=Object.freeze(function(e,t){let r=(0,hD.default)().timer.setTimeout(e.bind(t),0);return{dispose(){r.dispose()}}}),Bc=class{_isCancelled=!1;_emitter;cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?yD:(this._emitter||(this._emitter=new Jm.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}},Gm=class{_token;get token(){return this._token||(this._token=new Bc),this._token}cancel(){this._token?this._token.cancel():this._token=Hc.Cancelled}dispose(){this._token?this._token instanceof Bc&&this._token.dispose():this._token=Hc.None}};Tt.CancellationTokenSource=Gm});var I$=k(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.SharedArrayReceiverStrategy=Qo.SharedArraySenderStrategy=void 0;var _D=Wc(),Os;(function(e){e.Continue=0,e.Cancelled=1})(Os||(Os={}));var Km=class{buffers;constructor(){this.buffers=new Map}enableCancellation(t){if(t.id===null)return;let r=new SharedArrayBuffer(4),n=new Int32Array(r,0,1);n[0]=Os.Continue,this.buffers.set(t.id,r),t.$cancellationData=r}async sendCancellation(t,r){let n=this.buffers.get(r);if(n===void 0)return;let o=new Int32Array(n,0,1);Atomics.store(o,0,Os.Cancelled)}cleanup(t){this.buffers.delete(t)}dispose(){this.buffers.clear()}};Qo.SharedArraySenderStrategy=Km;var Xm=class{data;constructor(t){this.data=new Int32Array(t,0,1)}get isCancellationRequested(){return Atomics.load(this.data,0)===Os.Cancelled}get onCancellationRequested(){throw new Error("Cancellation over SharedArrayBuffer doesn't support cancellation events")}},Ym=class{token;constructor(t){this.token=new Xm(t)}cancel(){}dispose(){}},Qm=class{kind="request";createCancellationTokenSource(t){let r=t.$cancellationData;return r===void 0?new _D.CancellationTokenSource:new Ym(r)}};Qo.SharedArrayReceiverStrategy=Qm});var th=k(ei=>{"use strict";var vD=ei&&ei.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ei,"__esModule",{value:!0});ei.Semaphore=void 0;var bD=vD(ln()),eh=class{_capacity;_active;_waiting;constructor(t=1){if(t<=0)throw new Error("Capacity must be greater than 0");this._capacity=t,this._active=0,this._waiting=[]}lock(t){return new Promise((r,n)=>{this._waiting.push({thunk:t,resolve:r,reject:n}),this.runNext()})}get active(){return this._active}runNext(){this._waiting.length===0||this._active===this._capacity||(0,bD.default)().timer.setImmediate(()=>this.doRunNext())}doRunNext(){if(this._waiting.length===0||this._active===this._capacity)return;let t=this._waiting.shift();if(this._active++,this._active>this._capacity)throw new Error("Too many thunks active");try{let r=t.thunk();r instanceof Promise?r.then(n=>{this._active--,t.resolve(n),this.runNext()},n=>{this._active--,t.reject(n),this.runNext()}):(this._active--,t.resolve(r),this.runNext())}catch(r){this._active--,t.reject(r),this.runNext()}}};ei.Semaphore=eh});var A$=k(ut=>{"use strict";var wD=ut&&ut.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),xD=ut&&ut.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),$D=ut&&ut.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&wD(r,t,n[o]);return xD(r,t),r}})(),SD=ut&&ut.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ut,"__esModule",{value:!0});ut.ReadableStreamMessageReader=ut.AbstractMessageReader=ut.MessageReader=void 0;var nh=SD(ln()),ti=$D(Xo()),rh=Yo(),kD=th(),D$;(function(e){function t(r){let n=r;return n&&ti.func(n.listen)&&ti.func(n.dispose)&&ti.func(n.onError)&&ti.func(n.onClose)&&ti.func(n.onPartialMessage)}e.is=t})(D$||(ut.MessageReader=D$={}));var Jc=class{errorEmitter;closeEmitter;partialMessageEmitter;constructor(){this.errorEmitter=new rh.Emitter,this.closeEmitter=new rh.Emitter,this.partialMessageEmitter=new rh.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose(),this.partialMessageEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t){this.errorEmitter.fire(this.asError(t))}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}get onPartialMessage(){return this.partialMessageEmitter.event}firePartialMessage(t){this.partialMessageEmitter.fire(t)}asError(t){return t instanceof Error?t:new Error(`Reader received error. Reason: ${ti.string(t.message)?t.message:"unknown"}`)}};ut.AbstractMessageReader=Jc;var oh;(function(e){function t(r){let n,o,i,s=new Map,a,c=new Map;if(r===void 0||typeof r=="string")n=r??"utf-8";else{if(n=r.charset??"utf-8",r.contentDecoder!==void 0&&(i=r.contentDecoder,s.set(i.name,i)),r.contentDecoders!==void 0)for(let u of r.contentDecoders)s.set(u.name,u);if(r.contentTypeDecoder!==void 0&&(a=r.contentTypeDecoder,c.set(a.name,a)),r.contentTypeDecoders!==void 0)for(let u of r.contentTypeDecoders)c.set(u.name,u)}return a===void 0&&(a=(0,nh.default)().applicationJson.decoder,c.set(a.name,a)),{charset:n,contentDecoder:i,contentDecoders:s,contentTypeDecoder:a,contentTypeDecoders:c}}e.fromOptions=t})(oh||(oh={}));var ih=class extends Jc{readable;options;callback;nextMessageLength;messageToken;buffer;partialMessageTimer;_partialMessageTimeout;readSemaphore;constructor(t,r){super(),this.readable=t,this.options=oh.fromOptions(r),this.buffer=(0,nh.default)().messageBuffer.create(this.options.charset),this._partialMessageTimeout=1e4,this.nextMessageLength=-1,this.messageToken=0,this.readSemaphore=new kD.Semaphore(1)}set partialMessageTimeout(t){this._partialMessageTimeout=t}get partialMessageTimeout(){return this._partialMessageTimeout}listen(t){this.nextMessageLength=-1,this.messageToken=0,this.partialMessageTimer=void 0,this.callback=t;let r=this.readable.onData(n=>{this.onData(n)});return this.readable.onError(n=>this.fireError(n)),this.readable.onClose(()=>this.fireClose()),r}onData(t){try{for(this.buffer.append(t);;){if(this.nextMessageLength===-1){let n=this.buffer.tryReadHeaders(!0);if(!n)return;let o=n.get("content-length");if(!o){this.fireError(new Error(`Header must provide a Content-Length property.
|
|
11
|
+
${JSON.stringify(Object.fromEntries(n))}`));return}let i=parseInt(o);if(isNaN(i)){this.fireError(new Error(`Content-Length value must be a number. Got ${o}`));return}this.nextMessageLength=i}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,o=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(o)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,nh.default)().timer.setTimeout((t,r)=>{this.partialMessageTimer=void 0,t===this.messageToken&&(this.firePartialMessage({messageToken:t,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};ut.ReadableStreamMessageReader=ih});var U$=k(lt=>{"use strict";var PD=lt&<.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),TD=lt&<.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),zD=lt&<.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&PD(r,t,n[o]);return TD(r,t),r}})(),RD=lt&<.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lt,"__esModule",{value:!0});lt.WriteableStreamMessageWriter=lt.AbstractMessageWriter=lt.MessageWriter=void 0;var q$=RD(ln()),Cs=zD(Xo()),ED=th(),Z$=Yo(),OD="Content-Length: ",L$=`\r
|
|
12
|
+
`,F$;(function(e){function t(r){let n=r;return n&&Cs.func(n.dispose)&&Cs.func(n.onClose)&&Cs.func(n.onError)&&Cs.func(n.write)}e.is=t})(F$||(lt.MessageWriter=F$={}));var Gc=class{errorEmitter;closeEmitter;constructor(){this.errorEmitter=new Z$.Emitter,this.closeEmitter=new Z$.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(t,r,n){this.errorEmitter.fire([this.asError(t),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(t){return t instanceof Error?t:new Error(`Writer received error. Reason: ${Cs.string(t.message)?t.message:"unknown"}`)}};lt.AbstractMessageWriter=Gc;var sh;(function(e){function t(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,q$.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,q$.default)().applicationJson.encoder}}e.fromOptions=t})(sh||(sh={}));var ah=class extends Gc{writable;options;errorCount;writeSemaphore;constructor(t,r){super(),this.writable=t,this.options=sh.fromOptions(r),this.errorCount=0,this.writeSemaphore=new ED.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(t){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(t,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let o=[];return o.push(OD,n.byteLength.toString(),L$),o.push(L$),this.doWrite(t,o,n)},n=>{throw this.fireError(n),n}))}async doWrite(t,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(o){return this.handleError(o,t),Promise.reject(o)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){this.writable.end()}};lt.WriteableStreamMessageWriter=ah});var V$=k(Kc=>{"use strict";Object.defineProperty(Kc,"__esModule",{value:!0});Kc.AbstractMessageBuffer=void 0;var CD=13,jD=10,MD=`\r
|
|
13
|
+
`,ch=class{_encoding;_chunks;_totalLength;constructor(t="utf-8"){this._encoding=t,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(t){let r=typeof t=="string"?this.fromString(t,this._encoding):t;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(t=!1){if(this._chunks.length===0)return;let r=0,n=0,o=0,i=0;e:for(;n<this._chunks.length;){let u=this._chunks[n];for(o=0;o<u.length;){switch(u[o]){case CD:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case jD:switch(r){case 1:r=2;break;case 3:r=4,o++;break e;default:r=0}break;default:r=0}o++}i+=u.byteLength,n++}if(r!==4)return;let s=this._read(i+o),a=new Map,c=this.toString(s,"ascii").split(MD);if(c.length<2)return a;for(let u=0;u<c.length-2;u++){let l=c[u],d=l.indexOf(":");if(d===-1)throw new Error(`Message header must separate key and value using ':'
|
|
14
|
+
${l}`);let h=l.substr(0,d),m=l.substr(d+1).trim();a.set(t?h.toLowerCase():h,m)}return a}tryReadBody(t){if(!(this._totalLength<t))return this._read(t)}get numberOfBytes(){return this._totalLength}_read(t){if(t===0)return this.emptyBuffer();if(t>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===t){let i=this._chunks[0];return this._chunks.shift(),this._totalLength-=t,this.asNative(i)}if(this._chunks[0].byteLength>t){let i=this._chunks[0],s=this.asNative(i,t);return this._chunks[0]=i.slice(t),this._totalLength-=t,s}let r=this.allocNative(t),n=0,o=0;for(;t>0;){let i=this._chunks[o];if(i.byteLength>t){let s=i.slice(0,t);r.set(s,n),n+=t,this._chunks[o]=i.slice(t),this._totalLength-=t,t-=t}else r.set(i,n),n+=i.byteLength,this._chunks.shift(),this._totalLength-=i.byteLength,t-=i.byteLength}return r}};Kc.AbstractMessageBuffer=ch});var J$=k(V=>{"use strict";var ND=V&&V.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),ID=V&&V.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),DD=V&&V.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&ND(r,t,n[o]);return ID(r,t),r}})(),AD=V&&V.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(V,"__esModule",{value:!0});V.ConnectionOptions=V.MessageStrategy=V.CancellationStrategy=V.CancellationSenderStrategy=V.CancellationReceiverStrategy=V.RequestCancellationReceiverStrategy=V.IdCancellationReceiverStrategy=V.ConnectionStrategy=V.ConnectionError=V.ConnectionErrors=V.LogTraceNotification=V.SetTraceNotification=V.TraceFormat=V.TraceValues=V.TraceValue=V.Trace=V.NullLogger=V.ProgressType=V.ProgressToken=void 0;V.createMessageConnection=qD;var H$=AD(ln()),De=DD(Xo()),G=Zm(),B$=Fm(),js=Yo(),uh=Wc(),Is;(function(e){e.type=new G.NotificationType("$/cancelRequest")})(Is||(Is={}));var lh;(function(e){function t(r){return typeof r=="string"||typeof r=="number"}e.is=t})(lh||(V.ProgressToken=lh={}));var Ms;(function(e){e.type=new G.NotificationType("$/progress")})(Ms||(Ms={}));var dh=class{__;_pr;constructor(){}};V.ProgressType=dh;var fh;(function(e){function t(r){return De.func(r)}e.is=t})(fh||(fh={}));V.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var pe;(function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Compact=2]="Compact",e[e.Verbose=3]="Verbose"})(pe||(V.Trace=pe={}));var ph;(function(e){e.Off="off",e.Messages="messages",e.Compact="compact",e.Verbose="verbose"})(ph||(V.TraceValue=ph={}));V.TraceValues=ph;(function(e){function t(n){if(!De.string(n))return e.Off;switch(n=n.toLowerCase(),n){case"off":return e.Off;case"messages":return e.Messages;case"compact":return e.Compact;case"verbose":return e.Verbose;default:return e.Off}}e.fromString=t;function r(n){switch(n){case e.Off:return"off";case e.Messages:return"messages";case e.Compact:return"compact";case e.Verbose:return"verbose";default:return"off"}}e.toString=r})(pe||(V.Trace=pe={}));var jt;(function(e){e.Text="text",e.JSON="json"})(jt||(V.TraceFormat=jt={}));(function(e){function t(r){return De.string(r)?(r=r.toLowerCase(),r==="json"?e.JSON:e.Text):e.Text}e.fromString=t})(jt||(V.TraceFormat=jt={}));var mh;(function(e){e.type=new G.NotificationType("$/setTrace")})(mh||(V.SetTraceNotification=mh={}));var Xc;(function(e){e.type=new G.NotificationType("$/logTrace")})(Xc||(V.LogTraceNotification=Xc={}));var Ns;(function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"})(Ns||(V.ConnectionErrors=Ns={}));var ri=class e extends Error{code;constructor(t,r){super(r),this.code=t,Object.setPrototypeOf(this,e.prototype)}};V.ConnectionError=ri;var hh;(function(e){function t(r){let n=r;return n&&De.func(n.cancelUndispatched)}e.is=t})(hh||(V.ConnectionStrategy=hh={}));var Yc;(function(e){function t(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&De.func(n.createCancellationTokenSource)&&(n.dispose===void 0||De.func(n.dispose))}e.is=t})(Yc||(V.IdCancellationReceiverStrategy=Yc={}));var gh;(function(e){function t(r){let n=r;return n&&n.kind==="request"&&De.func(n.createCancellationTokenSource)&&(n.dispose===void 0||De.func(n.dispose))}e.is=t})(gh||(V.RequestCancellationReceiverStrategy=gh={}));var Qc;(function(e){e.Message=Object.freeze({createCancellationTokenSource(r){return new uh.CancellationTokenSource}});function t(r){return Yc.is(r)||gh.is(r)}e.is=t})(Qc||(V.CancellationReceiverStrategy=Qc={}));var eu;(function(e){e.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(Is.type,{id:n})},cleanup(r){}});function t(r){let n=r;return n&&De.func(n.sendCancellation)&&De.func(n.cleanup)}e.is=t})(eu||(V.CancellationSenderStrategy=eu={}));var tu;(function(e){e.Message=Object.freeze({receiver:Qc.Message,sender:eu.Message});function t(r){let n=r;return n&&Qc.is(n.receiver)&&eu.is(n.sender)}e.is=t})(tu||(V.CancellationStrategy=tu={}));var ru;(function(e){function t(r){let n=r;return n&&De.func(n.handleMessage)}e.is=t})(ru||(V.MessageStrategy=ru={}));var W$;(function(e){function t(r){let n=r;return n&&(tu.is(n.cancellationStrategy)||hh.is(n.connectionStrategy)||ru.is(n.messageStrategy)||De.number(n.maxParallelism))}e.is=t})(W$||(V.ConnectionOptions=W$={}));var rr;(function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"})(rr||(rr={}));function qD(e,t,r,n){let o=r!==void 0?r:V.NullLogger,i=0,s=0,a=0,c="2.0",u=n?.maxParallelism??-1,l=0,d,h=new Map,m,p=new Map,y=new Map,v,P=new B$.LinkedMap,T=new Map,R=new Set,I=new Map,C=pe.Off,Me=jt.Text,de,mt=rr.New,vn=new js.Emitter,Ar=new js.Emitter,lo=new js.Emitter,bi=new js.Emitter,wi=new js.Emitter,ir=n&&n.cancellationStrategy?n.cancellationStrategy:tu.Message;function eP(g){}function dy(){return mt===rr.Listening}function fy(){return mt===rr.Closed}function fo(){return mt===rr.Disposed}function py(){(mt===rr.New||mt===rr.Listening)&&(mt=rr.Closed,Ar.fire(void 0))}function tP(g){vn.fire([g,void 0,void 0])}function rP(g){vn.fire(g)}e.onClose(py),e.onError(tP),t.onClose(py),t.onError(rP);function my(g){if(g===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+g.toString()}function nP(g){return g===null?"res-unknown-"+(++a).toString():"res-"+g.toString()}function oP(){return"not-"+(++s).toString()}function iP(g,S){G.Message.isRequest(S)?g.set(my(S.id),S):G.Message.isResponse(S)?u===-1?g.set(nP(S.id),S):gy(S):g.set(oP(),S)}function Eu(){v||P.size===0||u!==-1&&l>=u||(v=(0,H$.default)().timer.setImmediate(async()=>{if(v=void 0,P.size===0||u!==-1&&l>=u)return;let g=P.shift(),S;try{l++;let O=n?.messageStrategy;ru.is(O)?S=O.handleMessage(g,hy):S=hy(g)}catch(O){o.error(`Processing message queue failed: ${O.toString()}`)}finally{S instanceof Promise?S.then(()=>{l--,Eu()}).catch(O=>{o.error(`Processing message queue failed: ${O.toString()}`)}):l--,Eu()}}))}async function hy(g){return G.Message.isRequest(g)?aP(g):G.Message.isNotification(g)?cP(g):G.Message.isResponse(g)?gy(g):uP(g)}let sP=g=>{try{if(G.Message.isNotification(g)&&g.method===Is.type.method){let S=g.params.id,O=my(S),A=P.get(O);if(G.Message.isRequest(A)){let Ne=n?.connectionStrategy,he=Ne&&Ne.cancelUndispatched?Ne.cancelUndispatched(A,eP):void 0;if(he&&(he.error!==void 0||he.result!==void 0)){P.delete(O),I.delete(S),he.id=A.id,Ou(he,g.method,Date.now()),t.write(he).catch(()=>o.error("Sending response for canceled message failed."));return}}let fe=I.get(S);if(fe!==void 0){fe.cancel(),Cu(g);return}else R.add(S)}iP(P,g)}finally{Eu()}};async function aP(g){if(fo())return Promise.resolve();function S(He,nt,qe){let Ze={jsonrpc:c,id:g.id};return He instanceof G.ResponseError?Ze.error=He.toJson():Ze.result=He===void 0?null:He,Ou(Ze,nt,qe),t.write(Ze)}function O(He,nt,qe){let Ze={jsonrpc:c,id:g.id,error:He.toJson()};return Ou(Ze,nt,qe),t.write(Ze)}fP(g);let A=h.get(g.method),fe,Ne;A&&(fe=A.type,Ne=A.handler);let he=Date.now();if(Ne||d){let He=g.id??String(Date.now()),nt=Yc.is(ir.receiver)?ir.receiver.createCancellationTokenSource(He):ir.receiver.createCancellationTokenSource(g);g.id!==null&&R.has(g.id)&&nt.cancel(),g.id!==null&&I.set(He,nt);try{let qe;if(Ne)if(g.params===void 0){if(fe!==void 0&&fe.numberOfParams!==0)return O(new G.ResponseError(G.ErrorCodes.InvalidParams,`Request ${g.method} defines ${fe.numberOfParams} params but received none.`),g.method,he);qe=Ne(nt.token)}else if(Array.isArray(g.params)){if(fe!==void 0&&fe.parameterStructures===G.ParameterStructures.byName)return O(new G.ResponseError(G.ErrorCodes.InvalidParams,`Request ${g.method} defines parameters by name but received parameters by position`),g.method,he);qe=Ne(...g.params,nt.token)}else{if(fe!==void 0&&fe.parameterStructures===G.ParameterStructures.byPosition)return O(new G.ResponseError(G.ErrorCodes.InvalidParams,`Request ${g.method} defines parameters by position but received parameters by name`),g.method,he);qe=Ne(g.params,nt.token)}else d&&(qe=d(g.method,g.params,nt.token));let Ze=await qe;await S(Ze,g.method,he)}catch(qe){qe instanceof G.ResponseError?await S(qe,g.method,he):qe&&De.string(qe.message)?await O(new G.ResponseError(G.ErrorCodes.InternalError,`Request ${g.method} failed with message: ${qe.message}`),g.method,he):await O(new G.ResponseError(G.ErrorCodes.InternalError,`Request ${g.method} failed unexpectedly without providing any details.`),g.method,he)}finally{I.delete(He)}}else await O(new G.ResponseError(G.ErrorCodes.MethodNotFound,`Unhandled method ${g.method}`),g.method,he)}function gy(g){if(!fo())if(g.id===null)g.error?o.error(`Received response message without id: Error is:
|
|
15
|
+
${JSON.stringify(g.error,void 0,4)}`):o.error("Received response message without id. No further error information provided.");else{let S=g.id,O=T.get(S);if(pP(g,O),O!==void 0){T.delete(S);try{if(g.error){let A=g.error;O.reject(new G.ResponseError(A.code,A.message,A.data))}else if(g.result!==void 0)O.resolve(g.result);else throw new Error("Should never happen.")}catch(A){A.message?o.error(`Response handler '${O.method}' failed with message: ${A.message}`):o.error(`Response handler '${O.method}' failed unexpectedly.`)}}}}async function cP(g){if(fo())return;let S,O;if(g.method===Is.type.method){let A=g.params.id;R.delete(A),Cu(g);return}else{let A=p.get(g.method);A&&(O=A.handler,S=A.type)}if(O||m)try{if(Cu(g),O)if(g.params===void 0)S!==void 0&&S.numberOfParams!==0&&S.parameterStructures!==G.ParameterStructures.byName&&o.error(`Notification ${g.method} defines ${S.numberOfParams} params but received none.`),await O();else if(Array.isArray(g.params)){let A=g.params;g.method===Ms.type.method&&A.length===2&&lh.is(A[0])?await O({token:A[0],value:A[1]}):(S!==void 0&&(S.parameterStructures===G.ParameterStructures.byName&&o.error(`Notification ${g.method} defines parameters by name but received parameters by position`),S.numberOfParams!==g.params.length&&o.error(`Notification ${g.method} defines ${S.numberOfParams} params but received ${A.length} arguments`)),await O(...A))}else S!==void 0&&S.parameterStructures===G.ParameterStructures.byPosition&&o.error(`Notification ${g.method} defines parameters by position but received parameters by name`),await O(g.params);else m&&await m(g.method,g.params)}catch(A){A.message?o.error(`Notification handler '${g.method}' failed with message: ${A.message}`):o.error(`Notification handler '${g.method}' failed unexpectedly.`)}else lo.fire(g)}function uP(g){if(!g){o.error("Received empty message.");return}o.error(`Received message which is neither a response nor a notification message:
|
|
16
|
+
${JSON.stringify(g,null,4)}`);let S=g;if(De.string(S.id)||De.number(S.id)){let O=S.id,A=T.get(O);A&&A.reject(new Error("The received response has neither a result nor an error property."))}}function qr(g){if(g!=null)switch(C){case pe.Verbose:return JSON.stringify(g,null,4);case pe.Compact:return JSON.stringify(g);default:return}}function lP(g){if(!(C===pe.Off||!de))if(Me===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&g.params&&(S=`Params: ${qr(g.params)}`),de.log(`Sending request '${g.method} - (${g.id})'.`,S)}else po("send-request",g)}function dP(g){if(!(C===pe.Off||!de))if(Me===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&(g.params?S=`Params: ${qr(g.params)}`:S="No parameters provided."),de.log(`Sending notification '${g.method}'.`,S)}else po("send-notification",g)}function Ou(g,S,O){if(!(C===pe.Off||!de))if(Me===jt.Text){let A;(C===pe.Verbose||C===pe.Compact)&&(g.error&&g.error.data?A=`Error data: ${qr(g.error.data)}`:g.result?A=`Result: ${qr(g.result)}`:g.error===void 0&&(A="No result returned.")),de.log(`Sending response '${S} - (${g.id})'. Processing request took ${Date.now()-O}ms`,A)}else po("send-response",g)}function fP(g){if(!(C===pe.Off||!de))if(Me===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&g.params&&(S=`Params: ${qr(g.params)}`),de.log(`Received request '${g.method} - (${g.id})'.`,S)}else po("receive-request",g)}function Cu(g){if(!(C===pe.Off||!de||g.method===Xc.type.method))if(Me===jt.Text){let S;(C===pe.Verbose||C===pe.Compact)&&(g.params?S=`Params: ${qr(g.params)}`:S="No parameters provided."),de.log(`Received notification '${g.method}'.`,S)}else po("receive-notification",g)}function pP(g,S){if(!(C===pe.Off||!de))if(Me===jt.Text){let O;if((C===pe.Verbose||C===pe.Compact)&&(g.error&&g.error.data?O=`Error data: ${qr(g.error.data)}`:g.result?O=`Result: ${qr(g.result)}`:g.error===void 0&&(O="No result returned.")),S){let A=g.error?` Request failed: ${g.error.message} (${g.error.code}).`:"";de.log(`Received response '${S.method} - (${g.id})' in ${Date.now()-S.timerStart}ms.${A}`,O)}else de.log(`Received response ${g.id} without active response promise.`,O)}else po("receive-response",g)}function po(g,S){if(!de||C===pe.Off)return;let O={isLSPMessage:!0,type:g,message:S,timestamp:Date.now()};de.log(O)}function xi(){if(fy())throw new ri(Ns.Closed,"Connection is closed.");if(fo())throw new ri(Ns.Disposed,"Connection is disposed.")}function mP(){if(dy())throw new ri(Ns.AlreadyListening,"Connection is already listening")}function hP(){if(!dy())throw new Error("Call listen() first.")}function $i(g){return g===void 0?null:g}function yy(g){if(g!==null)return g}function _y(g){return g!=null&&!Array.isArray(g)&&typeof g=="object"}function ju(g,S){switch(g){case G.ParameterStructures.auto:return _y(S)?yy(S):[$i(S)];case G.ParameterStructures.byName:if(!_y(S))throw new Error("Received parameters by name but param is not an object literal.");return yy(S);case G.ParameterStructures.byPosition:return[$i(S)];default:throw new Error(`Unknown parameter structure ${g.toString()}`)}}function vy(g,S){let O,A=g.numberOfParams;switch(A){case 0:O=void 0;break;case 1:O=ju(g.parameterStructures,S[0]);break;default:O=[];for(let fe=0;fe<S.length&&fe<A;fe++)O.push($i(S[fe]));if(S.length<A)for(let fe=S.length;fe<A;fe++)O.push(null);break}return O}let bn={sendNotification:(g,...S)=>{xi();let O,A;if(De.string(g)){O=g;let Ne=S[0],he=0,He=G.ParameterStructures.auto;G.ParameterStructures.is(Ne)&&(he=1,He=Ne);let nt=S.length,qe=nt-he;switch(qe){case 0:A=void 0;break;case 1:A=ju(He,S[he]);break;default:if(He===G.ParameterStructures.byName)throw new Error(`Received ${qe} parameters for 'by Name' notification parameter structure.`);A=S.slice(he,nt).map(Ze=>$i(Ze));break}}else{let Ne=S;O=g.method,A=vy(g,Ne)}let fe={jsonrpc:c,method:O,params:A};return dP(fe),t.write(fe).catch(Ne=>{throw o.error("Sending notification failed."),Ne})},onNotification:(g,S)=>{xi();let O;return De.func(g)?m=g:S&&(De.string(g)?(O=g,p.set(g,{type:void 0,handler:S})):(O=g.method,p.set(g.method,{type:g,handler:S}))),{dispose:()=>{O!==void 0?p.get(O)?.handler===S&&p.delete(O):m===g&&(m=void 0)}}},onProgress:(g,S,O)=>{if(y.has(S))throw new Error(`Progress handler for token ${S} already registered`);return y.set(S,O),{dispose:()=>{y.get(S)===O&&y.delete(S)}}},sendProgress:(g,S,O)=>bn.sendNotification(Ms.type,{token:S,value:O}),onUnhandledProgress:bi.event,sendRequest:(g,...S)=>{xi(),hP();function O(Ze,Bt){let br=ir.sender.sendCancellation(Ze,Bt);br===void 0?o.log(`Received no promise from cancellation strategy when cancelling id ${Bt}`):br.catch(()=>{o.log(`Sending cancellation messages for id ${Bt} failed.`)})}let A,fe,Ne;if(De.string(g)){A=g;let Ze=S[0],Bt=S[S.length-1],br=0,Si=G.ParameterStructures.auto;G.ParameterStructures.is(Ze)&&(br=1,Si=Ze);let wn=S.length;uh.CancellationToken.is(Bt)&&(wn=wn-1,Ne=Bt);let sr=wn-br;switch(sr){case 0:fe=void 0;break;case 1:fe=ju(Si,S[br]);break;default:if(Si===G.ParameterStructures.byName)throw new Error(`Received ${sr} parameters for 'by Name' request parameter structure.`);fe=S.slice(br,wn).map(gP=>$i(gP));break}}else{let Ze=S;A=g.method,fe=vy(g,Ze);let Bt=g.numberOfParams;Ne=uh.CancellationToken.is(Ze[Bt])?Ze[Bt]:void 0}let he=i++,He,nt=!1;Ne!==void 0&&(Ne.isCancellationRequested?nt=!0:He=Ne.onCancellationRequested(()=>{O(bn,he)}));let qe={jsonrpc:c,id:he,method:A,params:fe};return lP(qe),typeof ir.sender.enableCancellation=="function"&&ir.sender.enableCancellation(qe),new Promise(async(Ze,Bt)=>{let br=sr=>{Ze(sr),ir.sender.cleanup(he),He?.dispose()},Si=sr=>{Bt(sr),ir.sender.cleanup(he),He?.dispose()},wn={method:A,timerStart:Date.now(),resolve:br,reject:Si};try{T.set(he,wn),await t.write(qe),nt&&O(bn,he)}catch(sr){throw T.delete(he),wn.reject(new G.ResponseError(G.ErrorCodes.MessageWriteError,sr.message?sr.message:"Unknown reason")),o.error("Sending request failed."),sr}})},onRequest:(g,S)=>{xi();let O=null;return fh.is(g)?(O=void 0,d=g):De.string(g)?(O=null,S!==void 0&&(O=g,h.set(g,{handler:S,type:void 0}))):S!==void 0&&(O=g.method,h.set(g.method,{type:g,handler:S})),{dispose:()=>{O!==null&&(O!==void 0?h.get(O)?.handler===S&&h.delete(O):d===g&&(d=void 0))}}},hasPendingResponse:()=>T.size>0,trace:async(g,S,O)=>{let A=!1,fe=jt.Text;O!==void 0&&(De.boolean(O)?A=O:(A=O.sendNotification||!1,fe=O.traceFormat||jt.Text)),C=g,Me=fe,C===pe.Off?de=void 0:de=S,A&&!fy()&&!fo()&&await bn.sendNotification(mh.type,{value:pe.toString(g)})},onError:vn.event,onClose:Ar.event,onUnhandledNotification:lo.event,onDispose:wi.event,end:()=>{t.end()},dispose:()=>{if(fo())return;mt=rr.Disposed,wi.fire(void 0);let g=new G.ResponseError(G.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let S of T.values())S.reject(g);T=new Map,I=new Map,R=new Set,P=new B$.LinkedMap,De.func(t.dispose)&&t.dispose(),De.func(e.dispose)&&e.dispose()},listen:()=>{xi(),mP(),mt=rr.Listening,e.listen(sP)},inspect:()=>{(0,H$.default)().console.log("inspect")}};return bn.onNotification(Xc.type,g=>{if(C===pe.Off||!de)return;let S=C===pe.Verbose||C===pe.Compact;de.log(g.message,S?g.verbose:void 0)}),bn.onNotification(Ms.type,async g=>{let S=y.get(g.token);S?await S(g.value):bi.fire(g)}),bn}});var Or=k(w=>{"use strict";var ZD=w&&w.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(w,"__esModule",{value:!0});w.ProgressType=w.ProgressToken=w.createMessageConnection=w.NullLogger=w.ConnectionOptions=w.ConnectionStrategy=w.AbstractMessageBuffer=w.WriteableStreamMessageWriter=w.AbstractMessageWriter=w.MessageWriter=w.ReadableStreamMessageReader=w.AbstractMessageReader=w.MessageReader=w.SharedArrayReceiverStrategy=w.SharedArraySenderStrategy=w.CancellationToken=w.CancellationTokenSource=w.Emitter=w.Event=w.Disposable=w.LRUCache=w.Touch=w.LinkedMap=w.ParameterStructures=w.NotificationType9=w.NotificationType8=w.NotificationType7=w.NotificationType6=w.NotificationType5=w.NotificationType4=w.NotificationType3=w.NotificationType2=w.NotificationType1=w.NotificationType0=w.NotificationType=w.ErrorCodes=w.ResponseError=w.RequestType9=w.RequestType8=w.RequestType7=w.RequestType6=w.RequestType5=w.RequestType4=w.RequestType3=w.RequestType2=w.RequestType1=w.RequestType0=w.RequestType=w.Message=w.RAL=void 0;w.MessageStrategy=w.CancellationStrategy=w.CancellationSenderStrategy=w.RequestCancellationReceiverStrategy=w.IdCancellationReceiverStrategy=w.CancellationReceiverStrategy=w.ConnectionError=w.ConnectionErrors=w.LogTraceNotification=w.SetTraceNotification=w.TraceFormat=w.TraceValues=w.TraceValue=w.Trace=void 0;var Se=Zm();Object.defineProperty(w,"Message",{enumerable:!0,get:function(){return Se.Message}});Object.defineProperty(w,"RequestType",{enumerable:!0,get:function(){return Se.RequestType}});Object.defineProperty(w,"RequestType0",{enumerable:!0,get:function(){return Se.RequestType0}});Object.defineProperty(w,"RequestType1",{enumerable:!0,get:function(){return Se.RequestType1}});Object.defineProperty(w,"RequestType2",{enumerable:!0,get:function(){return Se.RequestType2}});Object.defineProperty(w,"RequestType3",{enumerable:!0,get:function(){return Se.RequestType3}});Object.defineProperty(w,"RequestType4",{enumerable:!0,get:function(){return Se.RequestType4}});Object.defineProperty(w,"RequestType5",{enumerable:!0,get:function(){return Se.RequestType5}});Object.defineProperty(w,"RequestType6",{enumerable:!0,get:function(){return Se.RequestType6}});Object.defineProperty(w,"RequestType7",{enumerable:!0,get:function(){return Se.RequestType7}});Object.defineProperty(w,"RequestType8",{enumerable:!0,get:function(){return Se.RequestType8}});Object.defineProperty(w,"RequestType9",{enumerable:!0,get:function(){return Se.RequestType9}});Object.defineProperty(w,"ResponseError",{enumerable:!0,get:function(){return Se.ResponseError}});Object.defineProperty(w,"ErrorCodes",{enumerable:!0,get:function(){return Se.ErrorCodes}});Object.defineProperty(w,"NotificationType",{enumerable:!0,get:function(){return Se.NotificationType}});Object.defineProperty(w,"NotificationType0",{enumerable:!0,get:function(){return Se.NotificationType0}});Object.defineProperty(w,"NotificationType1",{enumerable:!0,get:function(){return Se.NotificationType1}});Object.defineProperty(w,"NotificationType2",{enumerable:!0,get:function(){return Se.NotificationType2}});Object.defineProperty(w,"NotificationType3",{enumerable:!0,get:function(){return Se.NotificationType3}});Object.defineProperty(w,"NotificationType4",{enumerable:!0,get:function(){return Se.NotificationType4}});Object.defineProperty(w,"NotificationType5",{enumerable:!0,get:function(){return Se.NotificationType5}});Object.defineProperty(w,"NotificationType6",{enumerable:!0,get:function(){return Se.NotificationType6}});Object.defineProperty(w,"NotificationType7",{enumerable:!0,get:function(){return Se.NotificationType7}});Object.defineProperty(w,"NotificationType8",{enumerable:!0,get:function(){return Se.NotificationType8}});Object.defineProperty(w,"NotificationType9",{enumerable:!0,get:function(){return Se.NotificationType9}});Object.defineProperty(w,"ParameterStructures",{enumerable:!0,get:function(){return Se.ParameterStructures}});var yh=Fm();Object.defineProperty(w,"LinkedMap",{enumerable:!0,get:function(){return yh.LinkedMap}});Object.defineProperty(w,"LRUCache",{enumerable:!0,get:function(){return yh.LRUCache}});Object.defineProperty(w,"Touch",{enumerable:!0,get:function(){return yh.Touch}});var LD=M$();Object.defineProperty(w,"Disposable",{enumerable:!0,get:function(){return LD.Disposable}});var G$=Yo();Object.defineProperty(w,"Event",{enumerable:!0,get:function(){return G$.Event}});Object.defineProperty(w,"Emitter",{enumerable:!0,get:function(){return G$.Emitter}});var K$=Wc();Object.defineProperty(w,"CancellationTokenSource",{enumerable:!0,get:function(){return K$.CancellationTokenSource}});Object.defineProperty(w,"CancellationToken",{enumerable:!0,get:function(){return K$.CancellationToken}});var X$=I$();Object.defineProperty(w,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return X$.SharedArraySenderStrategy}});Object.defineProperty(w,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return X$.SharedArrayReceiverStrategy}});var _h=A$();Object.defineProperty(w,"MessageReader",{enumerable:!0,get:function(){return _h.MessageReader}});Object.defineProperty(w,"AbstractMessageReader",{enumerable:!0,get:function(){return _h.AbstractMessageReader}});Object.defineProperty(w,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return _h.ReadableStreamMessageReader}});var vh=U$();Object.defineProperty(w,"MessageWriter",{enumerable:!0,get:function(){return vh.MessageWriter}});Object.defineProperty(w,"AbstractMessageWriter",{enumerable:!0,get:function(){return vh.AbstractMessageWriter}});Object.defineProperty(w,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return vh.WriteableStreamMessageWriter}});var FD=V$();Object.defineProperty(w,"AbstractMessageBuffer",{enumerable:!0,get:function(){return FD.AbstractMessageBuffer}});var Fe=J$();Object.defineProperty(w,"ConnectionStrategy",{enumerable:!0,get:function(){return Fe.ConnectionStrategy}});Object.defineProperty(w,"ConnectionOptions",{enumerable:!0,get:function(){return Fe.ConnectionOptions}});Object.defineProperty(w,"NullLogger",{enumerable:!0,get:function(){return Fe.NullLogger}});Object.defineProperty(w,"createMessageConnection",{enumerable:!0,get:function(){return Fe.createMessageConnection}});Object.defineProperty(w,"ProgressToken",{enumerable:!0,get:function(){return Fe.ProgressToken}});Object.defineProperty(w,"ProgressType",{enumerable:!0,get:function(){return Fe.ProgressType}});Object.defineProperty(w,"Trace",{enumerable:!0,get:function(){return Fe.Trace}});Object.defineProperty(w,"TraceValue",{enumerable:!0,get:function(){return Fe.TraceValue}});Object.defineProperty(w,"TraceFormat",{enumerable:!0,get:function(){return Fe.TraceFormat}});Object.defineProperty(w,"SetTraceNotification",{enumerable:!0,get:function(){return Fe.SetTraceNotification}});Object.defineProperty(w,"LogTraceNotification",{enumerable:!0,get:function(){return Fe.LogTraceNotification}});Object.defineProperty(w,"ConnectionErrors",{enumerable:!0,get:function(){return Fe.ConnectionErrors}});Object.defineProperty(w,"ConnectionError",{enumerable:!0,get:function(){return Fe.ConnectionError}});Object.defineProperty(w,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return Fe.CancellationReceiverStrategy}});Object.defineProperty(w,"IdCancellationReceiverStrategy",{enumerable:!0,get:function(){return Fe.IdCancellationReceiverStrategy}});Object.defineProperty(w,"RequestCancellationReceiverStrategy",{enumerable:!0,get:function(){return Fe.RequestCancellationReceiverStrategy}});Object.defineProperty(w,"CancellationSenderStrategy",{enumerable:!0,get:function(){return Fe.CancellationSenderStrategy}});Object.defineProperty(w,"CancellationStrategy",{enumerable:!0,get:function(){return Fe.CancellationStrategy}});Object.defineProperty(w,"MessageStrategy",{enumerable:!0,get:function(){return Fe.MessageStrategy}});Object.defineProperty(w,"TraceValues",{enumerable:!0,get:function(){return Fe.TraceValues}});var UD=ZD(ln());w.RAL=UD.default});var e0=k(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});var Y$=mo("util"),Cr=Or(),bh=class e extends Cr.AbstractMessageBuffer{static emptyBuffer=Buffer.allocUnsafe(0);constructor(t="utf-8"){super(t)}emptyBuffer(){return e.emptyBuffer}fromString(t,r){return Buffer.from(t,r)}toString(t,r){return t instanceof Buffer?t.toString(r):new Y$.TextDecoder(r).decode(t)}asNative(t,r){return r===void 0?t instanceof Buffer?t:Buffer.from(t):t instanceof Buffer?t.slice(0,r):Buffer.from(t,0,r)}allocNative(t){return Buffer.allocUnsafe(t)}},wh=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Cr.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Cr.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Cr.Disposable.create(()=>this.stream.off("end",t))}onData(t){return this.stream.on("data",t),Cr.Disposable.create(()=>this.stream.off("data",t))}},xh=class{stream;constructor(t){this.stream=t}onClose(t){return this.stream.on("close",t),Cr.Disposable.create(()=>this.stream.off("close",t))}onError(t){return this.stream.on("error",t),Cr.Disposable.create(()=>this.stream.off("error",t))}onEnd(t){return this.stream.on("end",t),Cr.Disposable.create(()=>this.stream.off("end",t))}write(t,r){return new Promise((n,o)=>{let i=s=>{s==null?n():o(s)};typeof t=="string"?this.stream.write(t,r,i):this.stream.write(t,i)})}end(){this.stream.end()}},Q$=Object.freeze({messageBuffer:Object.freeze({create:e=>new bh(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(e,void 0,0),t.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{try{return e instanceof Buffer?Promise.resolve(JSON.parse(e.toString(t.charset))):Promise.resolve(JSON.parse(new Y$.TextDecoder(t.charset).decode(e)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:e=>new wh(e),asWritableStream:e=>new xh(e)}),console,timer:Object.freeze({setTimeout(e,t,...r){let n=setTimeout(e,t,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(e,...t){let r=setImmediate(e,...t);return{dispose:()=>clearImmediate(r)}},setInterval(e,t,...r){let n=setInterval(e,t,...r);return{dispose:()=>clearInterval(n)}}})});function $h(){return Q$}(function(e){function t(){Cr.RAL.install(Q$)}e.install=t})($h||($h={}));Sh.default=$h});var Eh=k(ae=>{"use strict";var r0=ae&&ae.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),VD=ae&&ae.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),Rh=ae&&ae.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&r0(r,t,n[o]);return VD(r,t),r}})(),HD=ae&&ae.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&r0(t,e,r)},BD=ae&&ae.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ae,"__esModule",{value:!0});ae.StreamMessageWriter=ae.StreamMessageReader=ae.SocketMessageWriter=ae.SocketMessageReader=ae.PortMessageWriter=ae.PortMessageReader=ae.IPCMessageWriter=ae.IPCMessageReader=void 0;ae.generateRandomPipeName=YD;ae.createClientPipeTransport=QD;ae.createServerPipeTransport=eA;ae.createClientSocketTransport=tA;ae.createServerSocketTransport=rA;ae.createMessageConnection=iA;var Ds=BD(e0());Ds.default.install();var WD=Rh(mo("path")),JD=Rh(mo("os")),GD=Rh(mo("fs")),t0=mo("crypto"),iu=mo("net"),Mt=Or();HD(Or(),ae);var kh=class extends Mt.AbstractMessageReader{process;constructor(t){super(),this.process=t;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(t){return this.process.on("message",t),Mt.Disposable.create(()=>this.process.off("message",t))}};ae.IPCMessageReader=kh;var Ph=class extends Mt.AbstractMessageWriter{process;errorCount;constructor(t){super(),this.process=t,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(t){try{return typeof this.process.send=="function"&&this.process.send(t,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,t)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,t),Promise.reject(r)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){}};ae.IPCMessageWriter=Ph;var Th=class extends Mt.AbstractMessageReader{onData;constructor(t){super(),this.onData=new Mt.Emitter,t.on("close",()=>this.fireClose),t.on("error",r=>this.fireError(r)),t.on("message",r=>{this.onData.fire(r)})}listen(t){return this.onData.event(t)}};ae.PortMessageReader=Th;var zh=class extends Mt.AbstractMessageWriter{port;errorCount;constructor(t){super(),this.port=t,this.errorCount=0,t.on("close",()=>this.fireClose()),t.on("error",r=>this.fireError(r))}write(t){try{return this.port.postMessage(t),Promise.resolve()}catch(r){return this.handleError(r,t),Promise.reject(r)}}handleError(t,r){this.errorCount++,this.fireError(t,r,this.errorCount)}end(){}};ae.PortMessageWriter=zh;var io=class extends Mt.ReadableStreamMessageReader{constructor(t,r="utf-8"){super((0,Ds.default)().stream.asReadableStream(t),r)}};ae.SocketMessageReader=io;var so=class extends Mt.WriteableStreamMessageWriter{socket;constructor(t,r){super((0,Ds.default)().stream.asWritableStream(t),r),this.socket=t}dispose(){super.dispose(),this.socket.destroy()}};ae.SocketMessageWriter=so;var nu=class extends Mt.ReadableStreamMessageReader{constructor(t,r){super((0,Ds.default)().stream.asReadableStream(t),r)}};ae.StreamMessageReader=nu;var ou=class extends Mt.WriteableStreamMessageWriter{constructor(t,r){super((0,Ds.default)().stream.asWritableStream(t),r)}};ae.StreamMessageWriter=ou;var KD=process.env.XDG_RUNTIME_DIR,XD=new Map([["linux",107],["darwin",102]]);function YD(){if(process.platform==="win32")return`\\\\.\\pipe\\lsp-${(0,t0.randomBytes)(16).toString("hex")}-sock`;let e=32,t=10,r=GD.realpathSync(KD??JD.tmpdir()),n=XD.get(process.platform);if(n!==void 0&&(e=Math.min(n-r.length-t,e)),e<16)throw new Error(`Unable to generate a random pipe name with ${e} characters.`);let o=(0,t0.randomBytes)(Math.floor(e/2)).toString("hex");return WD.join(r,`lsp-${o}.sock`)}function QD(e,t="utf-8"){let r,n=new Promise((o,i)=>{r=o});return new Promise((o,i)=>{let s=(0,iu.createServer)(a=>{s.close(),r([new io(a,t),new so(a,t)])});s.on("error",i),s.listen(e,()=>{s.removeListener("error",i),o({onConnected:()=>n})})})}function eA(e,t="utf-8"){let r=(0,iu.createConnection)(e);return[new io(r,t),new so(r,t)]}function tA(e,t="utf-8"){let r,n=new Promise((o,i)=>{r=o});return new Promise((o,i)=>{let s=(0,iu.createServer)(a=>{s.close(),r([new io(a,t),new so(a,t)])});s.on("error",i),s.listen(e,"127.0.0.1",()=>{s.removeListener("error",i),o({onConnected:()=>n})})})}function rA(e,t="utf-8"){let r=(0,iu.createConnection)(e,"127.0.0.1");return[new io(r,t),new so(r,t)]}function nA(e){let t=e;return t.read!==void 0&&t.addListener!==void 0}function oA(e){let t=e;return t.write!==void 0&&t.addListener!==void 0}function iA(e,t,r,n){r||(r=Mt.NullLogger);let o=nA(e)?new nu(e):e,i=oA(t)?new ou(t):t;return Mt.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Mt.createMessageConnection)(o,i,r,n)}});var gu={};Ys(gu,{AnnotatedTextEdit:()=>jr,ApplyKind:()=>Yh,ChangeAnnotation:()=>fn,ChangeAnnotationIdentifier:()=>We,CodeAction:()=>mg,CodeActionContext:()=>pg,CodeActionKind:()=>fg,CodeActionTag:()=>fu,CodeActionTriggerKind:()=>Vs,CodeDescription:()=>Zh,CodeLens:()=>hg,Color:()=>au,ColorInformation:()=>Mh,ColorPresentation:()=>Nh,Command:()=>ao,CompletionItem:()=>eg,CompletionItemKind:()=>Wh,CompletionItemLabelDetails:()=>Qh,CompletionItemTag:()=>Gh,CompletionList:()=>tg,CreateFile:()=>oi,DeleteFile:()=>si,Diagnostic:()=>Zs,DiagnosticRelatedInformation:()=>cu,DiagnosticSeverity:()=>Ah,DiagnosticTag:()=>qh,DocumentHighlight:()=>sg,DocumentHighlightKind:()=>ig,DocumentLink:()=>yg,DocumentSymbol:()=>dg,DocumentUri:()=>Oh,EOL:()=>sA,FoldingRange:()=>Dh,FoldingRangeKind:()=>Ih,FormattingOptions:()=>gg,Hover:()=>rg,InlayHint:()=>Pg,InlayHintKind:()=>pu,InlayHintLabelPart:()=>mu,InlineCompletionContext:()=>Og,InlineCompletionItem:()=>Tg,InlineCompletionList:()=>zg,InlineCompletionTriggerKind:()=>Rg,InlineValueContext:()=>kg,InlineValueEvaluatableExpression:()=>Sg,InlineValueText:()=>xg,InlineValueVariableLookup:()=>$g,InsertReplaceEdit:()=>Kh,InsertTextFormat:()=>Jh,InsertTextMode:()=>Xh,LanguageKind:()=>Hh,Location:()=>qs,LocationLink:()=>jh,MarkedString:()=>Us,MarkupContent:()=>pn,MarkupKind:()=>du,OptionalVersionedTextDocumentIdentifier:()=>Fs,ParameterInformation:()=>ng,Position:()=>Ht,Range:()=>Ae,RenameFile:()=>ii,SelectedCompletionInfo:()=>Eg,SelectionRange:()=>_g,SemanticTokenModifiers:()=>bg,SemanticTokenTypes:()=>vg,SemanticTokens:()=>wg,SignatureInformation:()=>og,SnippetTextEdit:()=>Lh,StringValue:()=>hu,SymbolInformation:()=>ug,SymbolKind:()=>ag,SymbolTag:()=>cg,TextDocument:()=>jg,TextDocumentEdit:()=>Ls,TextDocumentIdentifier:()=>Uh,TextDocumentItem:()=>Bh,TextEdit:()=>gr,URI:()=>su,VersionedTextDocumentIdentifier:()=>Vh,WorkspaceChange:()=>Fh,WorkspaceEdit:()=>uu,WorkspaceFolder:()=>Cg,WorkspaceSymbol:()=>lg,integer:()=>Ch,uinteger:()=>As});var Oh,su,Ch,As,Ht,Ae,qs,jh,au,Mh,Nh,Ih,Dh,cu,Ah,qh,Zh,Zs,ao,gr,fn,We,jr,Ls,oi,ii,si,uu,ni,Lh,lu,Fh,Uh,Vh,Fs,Hh,Bh,du,pn,Wh,Jh,Gh,Kh,Xh,Yh,Qh,eg,tg,Us,rg,ng,og,ig,sg,ag,cg,ug,lg,dg,fg,Vs,pg,fu,mg,hg,gg,yg,_g,vg,bg,wg,xg,$g,Sg,kg,pu,mu,Pg,hu,Tg,zg,Rg,Eg,Og,Cg,sA,jg,Mg,_,yu=xP(()=>{"use strict";(function(e){function t(r){return typeof r=="string"}e.is=t})(Oh||(Oh={}));(function(e){function t(r){return typeof r=="string"}e.is=t})(su||(su={}));(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}e.is=t})(Ch||(Ch={}));(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}e.is=t})(As||(As={}));(function(e){function t(n,o){return n===Number.MAX_VALUE&&(n=As.MAX_VALUE),o===Number.MAX_VALUE&&(o=As.MAX_VALUE),{line:n,character:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.uinteger(o.line)&&_.uinteger(o.character)}e.is=r})(Ht||(Ht={}));(function(e){function t(n,o,i,s){if(_.uinteger(n)&&_.uinteger(o)&&_.uinteger(i)&&_.uinteger(s))return{start:Ht.create(n,o),end:Ht.create(i,s)};if(Ht.is(n)&&Ht.is(o))return{start:n,end:o};throw new Error(`Range#create called with invalid arguments[${n}, ${o}, ${i}, ${s}]`)}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ht.is(o.start)&&Ht.is(o.end)}e.is=r})(Ae||(Ae={}));(function(e){function t(n,o){return{uri:n,range:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.range)&&(_.string(o.uri)||_.undefined(o.uri))}e.is=r})(qs||(qs={}));(function(e){function t(n,o,i,s){return{targetUri:n,targetRange:o,targetSelectionRange:i,originSelectionRange:s}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.targetRange)&&_.string(o.targetUri)&&Ae.is(o.targetSelectionRange)&&(Ae.is(o.originSelectionRange)||_.undefined(o.originSelectionRange))}e.is=r})(jh||(jh={}));(function(e){function t(n,o,i,s){return{red:n,green:o,blue:i,alpha:s}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.numberRange(o.red,0,1)&&_.numberRange(o.green,0,1)&&_.numberRange(o.blue,0,1)&&_.numberRange(o.alpha,0,1)}e.is=r})(au||(au={}));(function(e){function t(n,o){return{range:n,color:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.range)&&au.is(o.color)}e.is=r})(Mh||(Mh={}));(function(e){function t(n,o,i){return{label:n,textEdit:o,additionalTextEdits:i}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.string(o.label)&&(_.undefined(o.textEdit)||gr.is(o))&&(_.undefined(o.additionalTextEdits)||_.typedArray(o.additionalTextEdits,gr.is))}e.is=r})(Nh||(Nh={}));(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(Ih||(Ih={}));(function(e){function t(n,o,i,s,a,c){let u={startLine:n,endLine:o};return _.defined(i)&&(u.startCharacter=i),_.defined(s)&&(u.endCharacter=s),_.defined(a)&&(u.kind=a),_.defined(c)&&(u.collapsedText=c),u}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.uinteger(o.startLine)&&_.uinteger(o.startLine)&&(_.undefined(o.startCharacter)||_.uinteger(o.startCharacter))&&(_.undefined(o.endCharacter)||_.uinteger(o.endCharacter))&&(_.undefined(o.kind)||_.string(o.kind))}e.is=r})(Dh||(Dh={}));(function(e){function t(n,o){return{location:n,message:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&qs.is(o.location)&&_.string(o.message)}e.is=r})(cu||(cu={}));(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(Ah||(Ah={}));(function(e){e.Unnecessary=1,e.Deprecated=2})(qh||(qh={}));(function(e){function t(r){let n=r;return _.objectLiteral(n)&&_.string(n.href)}e.is=t})(Zh||(Zh={}));(function(e){function t(i,s,a,c,u,l){let d={range:i,message:s};return _.defined(a)&&(d.severity=a),_.defined(c)&&(d.code=c),_.defined(u)&&(d.source=u),_.defined(l)&&(d.relatedInformation=l),d}e.create=t;function r(i){var s;let a=i;return _.defined(a)&&Ae.is(a.range)&&(_.string(a.message)||pn.is(a.message))&&(_.number(a.severity)||_.undefined(a.severity))&&(_.integer(a.code)||_.string(a.code)||_.undefined(a.code))&&(_.undefined(a.codeDescription)||_.string((s=a.codeDescription)===null||s===void 0?void 0:s.href))&&(_.string(a.source)||_.undefined(a.source))&&(_.undefined(a.relatedInformation)||_.typedArray(a.relatedInformation,cu.is))}e.is=r;function n(i){return _.string(i.message)}e.is3_17=n;function o(i){if(_.string(i.message))return i.message;if(pn.is(i.message))return i.message.value;throw new Error(`Unknown message type ${typeof i.message}`)}e.getMessageString=o})(Zs||(Zs={}));(function(e){function t(n,o,...i){let s={title:n,command:o};return _.defined(i)&&i.length>0&&(s.arguments=i),s}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.title)&&(o.tooltip===void 0||_.string(o.tooltip))&&_.string(o.command)}e.is=r})(ao||(ao={}));(function(e){function t(i,s){return{range:i,newText:s}}e.replace=t;function r(i,s){return{range:{start:i,end:i},newText:s}}e.insert=r;function n(i){return{range:i,newText:""}}e.del=n;function o(i){let s=i;return _.objectLiteral(s)&&_.string(s.newText)&&Ae.is(s.range)}e.is=o})(gr||(gr={}));(function(e){function t(n,o,i){let s={label:n};return o!==void 0&&(s.needsConfirmation=o),i!==void 0&&(s.description=i),s}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&_.string(o.label)&&(_.boolean(o.needsConfirmation)||o.needsConfirmation===void 0)&&(_.string(o.description)||o.description===void 0)}e.is=r})(fn||(fn={}));(function(e){function t(r){let n=r;return _.string(n)}e.is=t})(We||(We={}));(function(e){function t(i,s,a){return{range:i,newText:s,annotationId:a}}e.replace=t;function r(i,s,a){return{range:{start:i,end:i},newText:s,annotationId:a}}e.insert=r;function n(i,s){return{range:i,newText:"",annotationId:s}}e.del=n;function o(i){let s=i;return gr.is(s)&&(fn.is(s.annotationId)||We.is(s.annotationId))}e.is=o})(jr||(jr={}));(function(e){function t(n,o){return{textDocument:n,edits:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&Fs.is(o.textDocument)&&Array.isArray(o.edits)}e.is=r})(Ls||(Ls={}));(function(e){function t(n,o,i){let s={kind:"create",uri:n};return o!==void 0&&(o.overwrite!==void 0||o.ignoreIfExists!==void 0)&&(s.options=o),i!==void 0&&(s.annotationId=i),s}e.create=t;function r(n){let o=n;return o&&o.kind==="create"&&_.string(o.uri)&&(o.options===void 0||(o.options.overwrite===void 0||_.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||_.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||We.is(o.annotationId))}e.is=r})(oi||(oi={}));(function(e){function t(n,o,i,s){let a={kind:"rename",oldUri:n,newUri:o};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(a.options=i),s!==void 0&&(a.annotationId=s),a}e.create=t;function r(n){let o=n;return o&&o.kind==="rename"&&_.string(o.oldUri)&&_.string(o.newUri)&&(o.options===void 0||(o.options.overwrite===void 0||_.boolean(o.options.overwrite))&&(o.options.ignoreIfExists===void 0||_.boolean(o.options.ignoreIfExists)))&&(o.annotationId===void 0||We.is(o.annotationId))}e.is=r})(ii||(ii={}));(function(e){function t(n,o,i){let s={kind:"delete",uri:n};return o!==void 0&&(o.recursive!==void 0||o.ignoreIfNotExists!==void 0)&&(s.options=o),i!==void 0&&(s.annotationId=i),s}e.create=t;function r(n){let o=n;return o&&o.kind==="delete"&&_.string(o.uri)&&(o.options===void 0||(o.options.recursive===void 0||_.boolean(o.options.recursive))&&(o.options.ignoreIfNotExists===void 0||_.boolean(o.options.ignoreIfNotExists)))&&(o.annotationId===void 0||We.is(o.annotationId))}e.is=r})(si||(si={}));(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(o=>_.string(o.kind)?oi.is(o)||ii.is(o)||si.is(o):Ls.is(o)))}e.is=t})(uu||(uu={}));ni=class{constructor(t,r){this.edits=t,this.changeAnnotations=r}insert(t,r,n){let o,i;if(n===void 0?o=gr.insert(t,r):We.is(n)?(i=n,o=jr.insert(t,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),o=jr.insert(t,r,i)),this.edits.push(o),i!==void 0)return i}replace(t,r,n){let o,i;if(n===void 0?o=gr.replace(t,r):We.is(n)?(i=n,o=jr.replace(t,r,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),o=jr.replace(t,r,i)),this.edits.push(o),i!==void 0)return i}delete(t,r){let n,o;if(r===void 0?n=gr.del(t):We.is(r)?(o=r,n=jr.del(t,r)):(this.assertChangeAnnotations(this.changeAnnotations),o=this.changeAnnotations.manage(r),n=jr.del(t,o)),this.edits.push(n),o!==void 0)return o}add(t){this.edits.push(t)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(t){if(t===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}};(function(e){function t(r){let n=r;return _.objectLiteral(n)&&Ae.is(n.range)&&hu.isSnippet(n.snippet)&&(n.annotationId===void 0||fn.is(n.annotationId)||We.is(n.annotationId))}e.is=t})(Lh||(Lh={}));lu=class{constructor(t){this._annotations=t===void 0?Object.create(null):t,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(t,r){let n;if(We.is(t)?n=t:(n=this.nextId(),r=t),this._annotations[n]!==void 0)throw new Error(`Id ${n} is already in use.`);if(r===void 0)throw new Error(`No annotation provided for id ${n}`);return this._annotations[n]=r,this._size++,n}nextId(){return this._counter++,this._counter.toString()}},Fh=class{constructor(t){this._textEditChanges=Object.create(null),t!==void 0?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new lu(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach(r=>{if(Ls.is(r)){let n=new ni(r.edits,this._changeAnnotations);this._textEditChanges[r.textDocument.uri]=n}})):t.changes&&Object.keys(t.changes).forEach(r=>{let n=new ni(t.changes[r]);this._textEditChanges[r]=n})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(t){if(Fs.is(t)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let r={uri:t.uri,version:t.version},n=this._textEditChanges[r.uri];if(!n){let o=[],i={textDocument:r,edits:o};this._workspaceEdit.documentChanges.push(i),n=new ni(o,this._changeAnnotations),this._textEditChanges[r.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let r=this._textEditChanges[t];if(!r){let n=[];this._workspaceEdit.changes[t]=n,r=new ni(n),this._textEditChanges[t]=r}return r}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new lu,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;fn.is(r)||We.is(r)?o=r:n=r;let i,s;if(o===void 0?i=oi.create(t,n):(s=We.is(o)?o:this._changeAnnotations.manage(o),i=oi.create(t,n,s)),this._workspaceEdit.documentChanges.push(i),s!==void 0)return s}renameFile(t,r,n,o){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let i;fn.is(n)||We.is(n)?i=n:o=n;let s,a;if(i===void 0?s=ii.create(t,r,o):(a=We.is(i)?i:this._changeAnnotations.manage(i),s=ii.create(t,r,o,a)),this._workspaceEdit.documentChanges.push(s),a!==void 0)return a}deleteFile(t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let o;fn.is(r)||We.is(r)?o=r:n=r;let i,s;if(o===void 0?i=si.create(t,n):(s=We.is(o)?o:this._changeAnnotations.manage(o),i=si.create(t,n,s)),this._workspaceEdit.documentChanges.push(i),s!==void 0)return s}};(function(e){function t(n){return{uri:n}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)}e.is=r})(Uh||(Uh={}));(function(e){function t(n,o){return{uri:n,version:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)&&_.integer(o.version)}e.is=r})(Vh||(Vh={}));(function(e){function t(n,o){return{uri:n,version:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)&&(o.version===null||_.integer(o.version))}e.is=r})(Fs||(Fs={}));(function(e){e.ABAP="abap",e.WindowsBat="bat",e.BibTeX="bibtex",e.Clojure="clojure",e.Coffeescript="coffeescript",e.C="c",e.CPP="cpp",e.CSharp="csharp",e.CSS="css",e.D="d",e.Delphi="pascal",e.Diff="diff",e.Dart="dart",e.Dockerfile="dockerfile",e.Elixir="elixir",e.Erlang="erlang",e.FSharp="fsharp",e.GitCommit="git-commit",e.GitRebase="git-rebase",e.Go="go",e.Groovy="groovy",e.Handlebars="handlebars",e.Haskell="haskell",e.HTML="html",e.Ini="ini",e.Java="java",e.JavaScript="javascript",e.JavaScriptReact="javascriptreact",e.JSON="json",e.LaTeX="latex",e.Less="less",e.Lua="lua",e.Makefile="makefile",e.Markdown="markdown",e.ObjectiveC="objective-c",e.ObjectiveCPP="objective-cpp",e.Pascal="pascal",e.Perl="perl",e.Perl6="perl6",e.PHP="php",e.Plaintext="plaintext",e.Powershell="powershell",e.Pug="jade",e.Python="python",e.R="r",e.Razor="razor",e.Ruby="ruby",e.Rust="rust",e.SCSS="scss",e.SASS="sass",e.Scala="scala",e.ShaderLab="shaderlab",e.ShellScript="shellscript",e.SQL="sql",e.Swift="swift",e.TypeScript="typescript",e.TypeScriptReact="typescriptreact",e.TeX="tex",e.VisualBasic="vb",e.XML="xml",e.XSL="xsl",e.YAML="yaml"})(Hh||(Hh={}));(function(e){function t(n,o,i,s){return{uri:n,languageId:o,version:i,text:s}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.string(o.uri)&&_.string(o.languageId)&&_.integer(o.version)&&_.string(o.text)}e.is=r})(Bh||(Bh={}));(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){let n=r;return n===e.PlainText||n===e.Markdown}e.is=t})(du||(du={}));(function(e){function t(r){let n=r;return _.objectLiteral(r)&&du.is(n.kind)&&_.string(n.value)}e.is=t})(pn||(pn={}));(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Wh||(Wh={}));(function(e){e.PlainText=1,e.Snippet=2})(Jh||(Jh={}));(function(e){e.Deprecated=1})(Gh||(Gh={}));(function(e){function t(n,o,i){return{newText:n,insert:o,replace:i}}e.create=t;function r(n){let o=n;return o&&_.string(o.newText)&&Ae.is(o.insert)&&Ae.is(o.replace)}e.is=r})(Kh||(Kh={}));(function(e){e.asIs=1,e.adjustIndentation=2})(Xh||(Xh={}));(function(e){e.Replace=1,e.Merge=2})(Yh||(Yh={}));(function(e){function t(r){let n=r;return n&&(_.string(n.detail)||n.detail===void 0)&&(_.string(n.description)||n.description===void 0)}e.is=t})(Qh||(Qh={}));(function(e){function t(r){return{label:r}}e.create=t})(eg||(eg={}));(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}e.create=t})(tg||(tg={}));(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}e.fromPlainText=t;function r(n){let o=n;return _.string(o)||_.objectLiteral(o)&&_.string(o.language)&&_.string(o.value)}e.is=r})(Us||(Us={}));(function(e){function t(r){let n=r;return!!n&&_.objectLiteral(n)&&(pn.is(n.contents)||Us.is(n.contents)||_.typedArray(n.contents,Us.is))&&(r.range===void 0||Ae.is(r.range))}e.is=t})(rg||(rg={}));(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}e.create=t})(ng||(ng={}));(function(e){function t(r,n,...o){let i={label:r};return _.defined(n)&&(i.documentation=n),_.defined(o)?i.parameters=o:i.parameters=[],i}e.create=t})(og||(og={}));(function(e){e.Text=1,e.Read=2,e.Write=3})(ig||(ig={}));(function(e){function t(r,n){let o={range:r};return _.number(n)&&(o.kind=n),o}e.create=t})(sg||(sg={}));(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(ag||(ag={}));(function(e){e.Deprecated=1})(cg||(cg={}));(function(e){function t(r,n,o,i,s){let a={name:r,kind:n,location:{uri:i,range:o}};return s&&(a.containerName=s),a}e.create=t})(ug||(ug={}));(function(e){function t(r,n,o,i){return i!==void 0?{name:r,kind:n,location:{uri:o,range:i}}:{name:r,kind:n,location:{uri:o}}}e.create=t})(lg||(lg={}));(function(e){function t(n,o,i,s,a,c){let u={name:n,detail:o,kind:i,range:s,selectionRange:a};return c!==void 0&&(u.children=c),u}e.create=t;function r(n){let o=n;return o&&_.string(o.name)&&_.number(o.kind)&&Ae.is(o.range)&&Ae.is(o.selectionRange)&&(o.detail===void 0||_.string(o.detail))&&(o.deprecated===void 0||_.boolean(o.deprecated))&&(o.children===void 0||Array.isArray(o.children))&&(o.tags===void 0||Array.isArray(o.tags))}e.is=r})(dg||(dg={}));(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorMove="refactor.move",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll",e.Notebook="notebook"})(fg||(fg={}));(function(e){e.Invoked=1,e.Automatic=2})(Vs||(Vs={}));(function(e){function t(n,o,i){let s={diagnostics:n};return o!=null&&(s.only=o),i!=null&&(s.triggerKind=i),s}e.create=t;function r(n){let o=n;return _.defined(o)&&_.typedArray(o.diagnostics,Zs.is)&&(o.only===void 0||_.typedArray(o.only,_.string))&&(o.triggerKind===void 0||o.triggerKind===Vs.Invoked||o.triggerKind===Vs.Automatic)}e.is=r})(pg||(pg={}));(function(e){e.LLMGenerated=1;function t(r){return _.defined(r)&&r===e.LLMGenerated}e.is=t})(fu||(fu={}));(function(e){function t(n,o,i){let s={title:n},a=!0;return typeof o=="string"?(a=!1,s.kind=o):ao.is(o)?s.command=o:s.edit=o,a&&i!==void 0&&(s.kind=i),s}e.create=t;function r(n){let o=n;return o&&_.string(o.title)&&(o.diagnostics===void 0||_.typedArray(o.diagnostics,Zs.is))&&(o.kind===void 0||_.string(o.kind))&&(o.edit!==void 0||o.command!==void 0)&&(o.command===void 0||ao.is(o.command))&&(o.isPreferred===void 0||_.boolean(o.isPreferred))&&(o.edit===void 0||uu.is(o.edit))&&(o.tags===void 0||_.typedArray(o.tags,fu.is))}e.is=r})(mg||(mg={}));(function(e){function t(n,o){let i={range:n};return _.defined(o)&&(i.data=o),i}e.create=t;function r(n){let o=n;return _.defined(o)&&Ae.is(o.range)&&(_.undefined(o.command)||ao.is(o.command))}e.is=r})(hg||(hg={}));(function(e){function t(n,o){return{tabSize:n,insertSpaces:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&_.uinteger(o.tabSize)&&_.boolean(o.insertSpaces)}e.is=r})(gg||(gg={}));(function(e){function t(n,o,i){return{range:n,target:o,data:i}}e.create=t;function r(n){let o=n;return _.defined(o)&&Ae.is(o.range)&&(_.undefined(o.target)||_.string(o.target))}e.is=r})(yg||(yg={}));(function(e){function t(n,o){return{range:n,parent:o}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ae.is(o.range)&&(o.parent===void 0||e.is(o.parent))}e.is=r})(_g||(_g={}));(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator",e.label="label"})(vg||(vg={}));(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(bg||(bg={}));(function(e){function t(r){let n=r;return _.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}e.is=t})(wg||(wg={}));(function(e){function t(n,o){return{range:n,text:o}}e.create=t;function r(n){let o=n;return o!=null&&Ae.is(o.range)&&_.string(o.text)}e.is=r})(xg||(xg={}));(function(e){function t(n,o,i){return{range:n,variableName:o,caseSensitiveLookup:i}}e.create=t;function r(n){let o=n;return o!=null&&Ae.is(o.range)&&_.boolean(o.caseSensitiveLookup)&&(_.string(o.variableName)||o.variableName===void 0)}e.is=r})($g||($g={}));(function(e){function t(n,o){return{range:n,expression:o}}e.create=t;function r(n){let o=n;return o!=null&&Ae.is(o.range)&&(_.string(o.expression)||o.expression===void 0)}e.is=r})(Sg||(Sg={}));(function(e){function t(n,o){return{frameId:n,stoppedLocation:o}}e.create=t;function r(n){let o=n;return _.defined(o)&&Ae.is(n.stoppedLocation)}e.is=r})(kg||(kg={}));(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}e.is=t})(pu||(pu={}));(function(e){function t(n){return{value:n}}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&(o.tooltip===void 0||_.string(o.tooltip)||pn.is(o.tooltip))&&(o.location===void 0||qs.is(o.location))&&(o.command===void 0||ao.is(o.command))}e.is=r})(mu||(mu={}));(function(e){function t(n,o,i){let s={position:n,label:o};return i!==void 0&&(s.kind=i),s}e.create=t;function r(n){let o=n;return _.objectLiteral(o)&&Ht.is(o.position)&&(_.string(o.label)||_.typedArray(o.label,mu.is))&&(o.kind===void 0||pu.is(o.kind))&&o.textEdits===void 0||_.typedArray(o.textEdits,gr.is)&&(o.tooltip===void 0||_.string(o.tooltip)||pn.is(o.tooltip))&&(o.paddingLeft===void 0||_.boolean(o.paddingLeft))&&(o.paddingRight===void 0||_.boolean(o.paddingRight))}e.is=r})(Pg||(Pg={}));(function(e){function t(n){return{kind:"snippet",value:n}}e.createSnippet=t;function r(n){let o=n;return _.objectLiteral(o)&&o.kind==="snippet"&&_.string(o.value)}e.isSnippet=r})(hu||(hu={}));(function(e){function t(r,n,o,i){return{insertText:r,filterText:n,range:o,command:i}}e.create=t})(Tg||(Tg={}));(function(e){function t(r){return{items:r}}e.create=t})(zg||(zg={}));(function(e){e.Invoked=1,e.Automatic=2})(Rg||(Rg={}));(function(e){function t(r,n){return{range:r,text:n}}e.create=t})(Eg||(Eg={}));(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}e.create=t})(Og||(Og={}));(function(e){function t(r){let n=r;return _.objectLiteral(n)&&su.is(n.uri)&&_.string(n.name)}e.is=t})(Cg||(Cg={}));sA=[`
|
|
17
17
|
`,`\r
|
|
18
|
-
`,"\r"];(function(e){function t(i,s,a,c){return new
|
|
18
|
+
`,"\r"];(function(e){function t(i,s,a,c){return new Mg(i,s,a,c)}e.create=t;function r(i){let s=i;return!!(_.defined(s)&&_.string(s.uri)&&(_.undefined(s.languageId)||_.string(s.languageId))&&_.uinteger(s.lineCount)&&_.func(s.getText)&&_.func(s.positionAt)&&_.func(s.offsetAt))}e.is=r;function n(i,s){let a=i.getText(),c=o(s,(l,d)=>{let h=l.range.start.line-d.range.start.line;return h===0?l.range.start.character-d.range.start.character:h}),u=a.length;for(let l=c.length-1;l>=0;l--){let d=c[l],h=i.offsetAt(d.range.start),m=i.offsetAt(d.range.end);if(m<=u)a=a.substring(0,h)+d.newText+a.substring(m,a.length);else throw new Error("Overlapping edit");u=h}return a}e.applyEdits=n;function o(i,s){if(i.length<=1)return i;let a=i.length/2|0,c=i.slice(0,a),u=i.slice(a);o(c,s),o(u,s);let l=0,d=0,h=0;for(;l<c.length&&d<u.length;)s(c[l],u[d])<=0?i[h++]=c[l++]:i[h++]=u[d++];for(;l<c.length;)i[h++]=c[l++];for(;d<u.length;)i[h++]=u[d++];return i}})(jg||(jg={}));Mg=class{constructor(t,r,n,o){this._uri=t,this._languageId=r,this._version=n,this._content=o,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){let r=this.offsetAt(t.start),n=this.offsetAt(t.end);return this._content.substring(r,n)}return this._content}update(t,r){this._content=t.text,this._version=r,this._lineOffsets=void 0}getLineOffsets(){if(this._lineOffsets===void 0){let t=[],r=this._content,n=!0;for(let o=0;o<r.length;o++){n&&(t.push(o),n=!1);let i=r.charAt(o);n=i==="\r"||i===`
|
|
19
19
|
`,i==="\r"&&o+1<r.length&&r.charAt(o+1)===`
|
|
20
|
-
`&&o++}n&&r.length>0&&t.push(r.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let r=this.getLineOffsets(),n=0,o=r.length;if(o===0)return Ht.create(0,t);for(;n<o;){let s=Math.floor((n+o)/2);r[s]>t?o=s:n=s+1}let i=n-1;return Ht.create(i,t-r[i])}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line],o=t.line+1<r.length?r[t.line+1]:this._content.length;return Math.max(Math.min(n+t.character,o),n)}get lineCount(){return this.getLineOffsets().length}};(function(e){let t=Object.prototype.toString;function r(m){return typeof m<"u"}e.defined=r;function n(m){return typeof m>"u"}e.undefined=n;function o(m){return m===!0||m===!1}e.boolean=o;function i(m){return t.call(m)==="[object String]"}e.string=i;function s(m){return t.call(m)==="[object Number]"}e.number=s;function a(m,p,y){return t.call(m)==="[object Number]"&&p<=m&&m<=y}e.numberRange=a;function c(m){return t.call(m)==="[object Number]"&&-2147483648<=m&&m<=2147483647}e.integer=c;function u(m){return t.call(m)==="[object Number]"&&0<=m&&m<=2147483647}e.uinteger=u;function l(m){return t.call(m)==="[object Function]"}e.func=l;function d(m){return m!==null&&typeof m=="object"}e.objectLiteral=d;function h(m,p){return Array.isArray(m)&&m.every(p)}e.typedArray=h})(_||(_={}))});var ze=k(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.CM=dt.ProtocolNotificationType=dt.ProtocolNotificationType0=dt.ProtocolRequestType=dt.ProtocolRequestType0=dt.RegistrationType=dt.MessageDirection=void 0;var ai=Or(),n0;(function(e){e.clientToServer="clientToServer",e.serverToClient="serverToClient",e.both="both"})(n0||(dt.MessageDirection=n0={}));var Ng=class{____;method;constructor(t){this.method=t}};dt.RegistrationType=Ng;var Mg=class extends ai.RequestType0{__;___;____;_pr;constructor(t){super(t)}};dt.ProtocolRequestType0=Mg;var Dg=class extends ai.RequestType{__;___;____;_pr;constructor(t){super(t,ai.ParameterStructures.byName)}};dt.ProtocolRequestType=Dg;var Ag=class extends ai.NotificationType0{___;____;constructor(t){super(t)}};dt.ProtocolNotificationType0=Ag;var qg=class extends ai.NotificationType{___;____;constructor(t){super(t,ai.ParameterStructures.byName)}};dt.ProtocolNotificationType=qg;var o0;(function(e){function t(r,n){return{client:r,server:n}}e.create=t})(o0||(dt.CM=o0={}))});var _u=k(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.boolean=aA;nr.string=i0;nr.number=cA;nr.error=uA;nr.func=lA;nr.array=s0;nr.stringArray=dA;nr.typedArray=fA;nr.objectLiteral=pA;function aA(e){return e===!0||e===!1}function i0(e){return typeof e=="string"||e instanceof String}function cA(e){return typeof e=="number"||e instanceof Number}function uA(e){return e instanceof Error}function lA(e){return typeof e=="function"}function s0(e){return Array.isArray(e)}function dA(e){return s0(e)&&e.every(t=>i0(t))}function fA(e,t){return Array.isArray(e)&&e.every(t)}function pA(e){return e!==null&&typeof e=="object"}});var c0=k(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.ImplementationRequest=void 0;var Zg=ze(),a0;(function(e){e.method="textDocument/implementation",e.messageDirection=Zg.MessageDirection.clientToServer,e.type=new Zg.ProtocolRequestType(e.method),e.capabilities=Zg.CM.create("textDocument.implementation","implementationProvider")})(a0||(vu.ImplementationRequest=a0={}))});var l0=k(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.TypeDefinitionRequest=void 0;var Lg=ze(),u0;(function(e){e.method="textDocument/typeDefinition",e.messageDirection=Lg.MessageDirection.clientToServer,e.type=new Lg.ProtocolRequestType(e.method),e.capabilities=Lg.CM.create("textDocument.typeDefinition","typeDefinitionProvider")})(u0||(bu.TypeDefinitionRequest=u0={}))});var p0=k(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.DidChangeWorkspaceFoldersNotification=ui.WorkspaceFoldersRequest=void 0;var ci=ze(),d0;(function(e){e.method="workspace/workspaceFolders",e.messageDirection=ci.MessageDirection.serverToClient,e.type=new ci.ProtocolRequestType0(e.method),e.capabilities=ci.CM.create("workspace.workspaceFolders","workspace.workspaceFolders")})(d0||(ui.WorkspaceFoldersRequest=d0={}));var f0;(function(e){e.method="workspace/didChangeWorkspaceFolders",e.messageDirection=ci.MessageDirection.clientToServer,e.type=new ci.ProtocolNotificationType(e.method),e.capabilities=ci.CM.create(void 0,"workspace.workspaceFolders.changeNotifications")})(f0||(ui.DidChangeWorkspaceFoldersNotification=f0={}))});var h0=k(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.ConfigurationRequest=void 0;var Fg=ze(),m0;(function(e){e.method="workspace/configuration",e.messageDirection=Fg.MessageDirection.serverToClient,e.type=new Fg.ProtocolRequestType(e.method),e.capabilities=Fg.CM.create("workspace.configuration",void 0)})(m0||(wu.ConfigurationRequest=m0={}))});var _0=k(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.ColorPresentationRequest=di.DocumentColorRequest=void 0;var li=ze(),g0;(function(e){e.method="textDocument/documentColor",e.messageDirection=li.MessageDirection.clientToServer,e.type=new li.ProtocolRequestType(e.method),e.capabilities=li.CM.create("textDocument.colorProvider","colorProvider")})(g0||(di.DocumentColorRequest=g0={}));var y0;(function(e){e.method="textDocument/colorPresentation",e.messageDirection=li.MessageDirection.clientToServer,e.type=new li.ProtocolRequestType(e.method),e.capabilities=li.CM.create("textDocument.colorProvider","colorProvider")})(y0||(di.ColorPresentationRequest=y0={}))});var w0=k(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.FoldingRangeRefreshRequest=pi.FoldingRangeRequest=void 0;var fi=ze(),v0;(function(e){e.method="textDocument/foldingRange",e.messageDirection=fi.MessageDirection.clientToServer,e.type=new fi.ProtocolRequestType(e.method),e.capabilities=fi.CM.create("textDocument.foldingRange","foldingRangeProvider")})(v0||(pi.FoldingRangeRequest=v0={}));var b0;(function(e){e.method="workspace/foldingRange/refresh",e.messageDirection=fi.MessageDirection.serverToClient,e.type=new fi.ProtocolRequestType0(e.method),e.capabilities=fi.CM.create("workspace.foldingRange.refreshSupport",void 0)})(b0||(pi.FoldingRangeRefreshRequest=b0={}))});var $0=k(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.DeclarationRequest=void 0;var Ug=ze(),x0;(function(e){e.method="textDocument/declaration",e.messageDirection=Ug.MessageDirection.clientToServer,e.type=new Ug.ProtocolRequestType(e.method),e.capabilities=Ug.CM.create("textDocument.declaration","declarationProvider")})(x0||(xu.DeclarationRequest=x0={}))});var k0=k($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.SelectionRangeRequest=void 0;var Vg=ze(),S0;(function(e){e.method="textDocument/selectionRange",e.messageDirection=Vg.MessageDirection.clientToServer,e.type=new Vg.ProtocolRequestType(e.method),e.capabilities=Vg.CM.create("textDocument.selectionRange","selectionRangeProvider")})(S0||($u.SelectionRangeRequest=S0={}))});var z0=k(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.WorkDoneProgressCancelNotification=mn.WorkDoneProgressCreateRequest=mn.WorkDoneProgress=void 0;var mA=Or(),Hs=ze(),P0;(function(e){e.type=new mA.ProgressType;function t(r){return r===e.type}e.is=t})(P0||(mn.WorkDoneProgress=P0={}));var T0;(function(e){e.method="window/workDoneProgress/create",e.messageDirection=Hs.MessageDirection.serverToClient,e.type=new Hs.ProtocolRequestType(e.method),e.capabilities=Hs.CM.create("window.workDoneProgress",void 0)})(T0||(mn.WorkDoneProgressCreateRequest=T0={}));var R0;(function(e){e.method="window/workDoneProgress/cancel",e.messageDirection=Hs.MessageDirection.clientToServer,e.type=new Hs.ProtocolNotificationType(e.method)})(R0||(mn.WorkDoneProgressCancelNotification=R0={}))});var j0=k(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.CallHierarchyOutgoingCallsRequest=hn.CallHierarchyIncomingCallsRequest=hn.CallHierarchyPrepareRequest=void 0;var Ir=ze(),E0;(function(e){e.method="textDocument/prepareCallHierarchy",e.messageDirection=Ir.MessageDirection.clientToServer,e.type=new Ir.ProtocolRequestType(e.method),e.capabilities=Ir.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(E0||(hn.CallHierarchyPrepareRequest=E0={}));var O0;(function(e){e.method="callHierarchy/incomingCalls",e.messageDirection=Ir.MessageDirection.clientToServer,e.type=new Ir.ProtocolRequestType(e.method),e.capabilities=Ir.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(O0||(hn.CallHierarchyIncomingCallsRequest=O0={}));var C0;(function(e){e.method="callHierarchy/outgoingCalls",e.messageDirection=Ir.MessageDirection.clientToServer,e.type=new Ir.ProtocolRequestType(e.method),e.capabilities=Ir.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(C0||(hn.CallHierarchyOutgoingCallsRequest=C0={}))});var q0=k(Rt=>{"use strict";Object.defineProperty(Rt,"__esModule",{value:!0});Rt.SemanticTokensRefreshRequest=Rt.SemanticTokensRangeRequest=Rt.SemanticTokensDeltaRequest=Rt.SemanticTokensRequest=Rt.SemanticTokensRegistrationType=Rt.TokenFormat=void 0;var Nt=ze(),I0;(function(e){e.Relative="relative"})(I0||(Rt.TokenFormat=I0={}));var Bs;(function(e){e.method="textDocument/semanticTokens",e.type=new Nt.RegistrationType(e.method)})(Bs||(Rt.SemanticTokensRegistrationType=Bs={}));var N0;(function(e){e.method="textDocument/semanticTokens/full",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method),e.registrationMethod=Bs.method,e.capabilities=Nt.CM.create("textDocument.semanticTokens","semanticTokensProvider")})(N0||(Rt.SemanticTokensRequest=N0={}));var M0;(function(e){e.method="textDocument/semanticTokens/full/delta",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method),e.registrationMethod=Bs.method,e.capabilities=Nt.CM.create("textDocument.semanticTokens.requests.full.delta","semanticTokensProvider.full.delta")})(M0||(Rt.SemanticTokensDeltaRequest=M0={}));var D0;(function(e){e.method="textDocument/semanticTokens/range",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method),e.registrationMethod=Bs.method,e.capabilities=Nt.CM.create("textDocument.semanticTokens.requests.range","semanticTokensProvider.range")})(D0||(Rt.SemanticTokensRangeRequest=D0={}));var A0;(function(e){e.method="workspace/semanticTokens/refresh",e.messageDirection=Nt.MessageDirection.serverToClient,e.type=new Nt.ProtocolRequestType0(e.method),e.capabilities=Nt.CM.create("workspace.semanticTokens.refreshSupport",void 0)})(A0||(Rt.SemanticTokensRefreshRequest=A0={}))});var L0=k(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.ShowDocumentRequest=void 0;var Hg=ze(),Z0;(function(e){e.method="window/showDocument",e.messageDirection=Hg.MessageDirection.serverToClient,e.type=new Hg.ProtocolRequestType(e.method),e.capabilities=Hg.CM.create("window.showDocument.support",void 0)})(Z0||(Su.ShowDocumentRequest=Z0={}))});var U0=k(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.LinkedEditingRangeRequest=void 0;var Bg=ze(),F0;(function(e){e.method="textDocument/linkedEditingRange",e.messageDirection=Bg.MessageDirection.clientToServer,e.type=new Bg.ProtocolRequestType(e.method),e.capabilities=Bg.CM.create("textDocument.linkedEditingRange","linkedEditingRangeProvider")})(F0||(ku.LinkedEditingRangeRequest=F0={}))});var X0=k(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.WillDeleteFilesRequest=ft.DidDeleteFilesNotification=ft.DidRenameFilesNotification=ft.WillRenameFilesRequest=ft.DidCreateFilesNotification=ft.WillCreateFilesRequest=ft.FileOperationPatternKind=void 0;var Je=ze(),V0;(function(e){e.file="file",e.folder="folder"})(V0||(ft.FileOperationPatternKind=V0={}));var H0;(function(e){e.method="workspace/willCreateFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolRequestType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.willCreate","workspace.fileOperations.willCreate")})(H0||(ft.WillCreateFilesRequest=H0={}));var B0;(function(e){e.method="workspace/didCreateFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolNotificationType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.didCreate","workspace.fileOperations.didCreate")})(B0||(ft.DidCreateFilesNotification=B0={}));var W0;(function(e){e.method="workspace/willRenameFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolRequestType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.willRename","workspace.fileOperations.willRename")})(W0||(ft.WillRenameFilesRequest=W0={}));var J0;(function(e){e.method="workspace/didRenameFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolNotificationType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.didRename","workspace.fileOperations.didRename")})(J0||(ft.DidRenameFilesNotification=J0={}));var G0;(function(e){e.method="workspace/didDeleteFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolNotificationType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.didDelete","workspace.fileOperations.didDelete")})(G0||(ft.DidDeleteFilesNotification=G0={}));var K0;(function(e){e.method="workspace/willDeleteFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolRequestType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.willDelete","workspace.fileOperations.willDelete")})(K0||(ft.WillDeleteFilesRequest=K0={}))});var tS=k(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.MonikerRequest=gn.MonikerKind=gn.UniquenessLevel=void 0;var Wg=ze(),Y0;(function(e){e.document="document",e.project="project",e.group="group",e.scheme="scheme",e.global="global"})(Y0||(gn.UniquenessLevel=Y0={}));var Q0;(function(e){e.$import="import",e.$export="export",e.local="local"})(Q0||(gn.MonikerKind=Q0={}));var eS;(function(e){e.method="textDocument/moniker",e.messageDirection=Wg.MessageDirection.clientToServer,e.type=new Wg.ProtocolRequestType(e.method),e.capabilities=Wg.CM.create("textDocument.moniker","monikerProvider")})(eS||(gn.MonikerRequest=eS={}))});var iS=k(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.TypeHierarchySubtypesRequest=yn.TypeHierarchySupertypesRequest=yn.TypeHierarchyPrepareRequest=void 0;var co=ze(),rS;(function(e){e.method="textDocument/prepareTypeHierarchy",e.messageDirection=co.MessageDirection.clientToServer,e.type=new co.ProtocolRequestType(e.method),e.capabilities=co.CM.create("textDocument.typeHierarchy","typeHierarchyProvider")})(rS||(yn.TypeHierarchyPrepareRequest=rS={}));var nS;(function(e){e.method="typeHierarchy/supertypes",e.messageDirection=co.MessageDirection.clientToServer,e.type=new co.ProtocolRequestType(e.method)})(nS||(yn.TypeHierarchySupertypesRequest=nS={}));var oS;(function(e){e.method="typeHierarchy/subtypes",e.messageDirection=co.MessageDirection.clientToServer,e.type=new co.ProtocolRequestType(e.method)})(oS||(yn.TypeHierarchySubtypesRequest=oS={}))});var cS=k(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.InlineValueRefreshRequest=hi.InlineValueRequest=void 0;var mi=ze(),sS;(function(e){e.method="textDocument/inlineValue",e.messageDirection=mi.MessageDirection.clientToServer,e.type=new mi.ProtocolRequestType(e.method),e.capabilities=mi.CM.create("textDocument.inlineValue","inlineValueProvider")})(sS||(hi.InlineValueRequest=sS={}));var aS;(function(e){e.method="workspace/inlineValue/refresh",e.messageDirection=mi.MessageDirection.serverToClient,e.type=new mi.ProtocolRequestType0(e.method),e.capabilities=mi.CM.create("workspace.inlineValue.refreshSupport",void 0)})(aS||(hi.InlineValueRefreshRequest=aS={}))});var fS=k(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.InlayHintRefreshRequest=_n.InlayHintResolveRequest=_n.InlayHintRequest=void 0;var Nr=ze(),uS;(function(e){e.method="textDocument/inlayHint",e.messageDirection=Nr.MessageDirection.clientToServer,e.type=new Nr.ProtocolRequestType(e.method),e.capabilities=Nr.CM.create("textDocument.inlayHint","inlayHintProvider")})(uS||(_n.InlayHintRequest=uS={}));var lS;(function(e){e.method="inlayHint/resolve",e.messageDirection=Nr.MessageDirection.clientToServer,e.type=new Nr.ProtocolRequestType(e.method),e.capabilities=Nr.CM.create("textDocument.inlayHint.resolveSupport","inlayHintProvider.resolveProvider")})(lS||(_n.InlayHintResolveRequest=lS={}));var dS;(function(e){e.method="workspace/inlayHint/refresh",e.messageDirection=Nr.MessageDirection.serverToClient,e.type=new Nr.ProtocolRequestType0(e.method),e.capabilities=Nr.CM.create("workspace.inlayHint.refreshSupport",void 0)})(dS||(_n.InlayHintRefreshRequest=dS={}))});var vS=k(Ge=>{"use strict";var hA=Ge&&Ge.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),gA=Ge&&Ge.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),yA=Ge&&Ge.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&hA(r,t,n[o]);return gA(r,t),r}})();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.DiagnosticRefreshRequest=Ge.WorkspaceDiagnosticRequest=Ge.DocumentDiagnosticRequest=Ge.DocumentDiagnosticReportKind=Ge.DiagnosticServerCancellationData=void 0;var _S=Or(),_A=yA(_u()),Mr=ze(),pS;(function(e){function t(r){let n=r;return n&&_A.boolean(n.retriggerRequest)}e.is=t})(pS||(Ge.DiagnosticServerCancellationData=pS={}));var mS;(function(e){e.Full="full",e.Unchanged="unchanged"})(mS||(Ge.DocumentDiagnosticReportKind=mS={}));var hS;(function(e){e.method="textDocument/diagnostic",e.messageDirection=Mr.MessageDirection.clientToServer,e.type=new Mr.ProtocolRequestType(e.method),e.partialResult=new _S.ProgressType,e.capabilities=Mr.CM.create("textDocument.diagnostic","diagnosticProvider")})(hS||(Ge.DocumentDiagnosticRequest=hS={}));var gS;(function(e){e.method="workspace/diagnostic",e.messageDirection=Mr.MessageDirection.clientToServer,e.type=new Mr.ProtocolRequestType(e.method),e.partialResult=new _S.ProgressType,e.capabilities=Mr.CM.create("workspace.diagnostics","diagnosticProvider.workspaceDiagnostics")})(gS||(Ge.WorkspaceDiagnosticRequest=gS={}));var yS;(function(e){e.method="workspace/diagnostic/refresh",e.messageDirection=Mr.MessageDirection.serverToClient,e.type=new Mr.ProtocolRequestType0(e.method),e.capabilities=Mr.CM.create("workspace.diagnostics.refreshSupport",void 0)})(yS||(Ge.DiagnosticRefreshRequest=yS={}))});var PS=k(_e=>{"use strict";var vA=_e&&_e.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),bA=_e&&_e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),wA=_e&&_e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&vA(r,t,n[o]);return bA(r,t),r}})();Object.defineProperty(_e,"__esModule",{value:!0});_e.DidCloseNotebookDocumentNotification=_e.DidSaveNotebookDocumentNotification=_e.DidChangeNotebookDocumentNotification=_e.NotebookCellArrayChange=_e.DidOpenNotebookDocumentNotification=_e.NotebookDocumentSyncRegistrationType=_e.NotebookDocument=_e.NotebookCell=_e.ExecutionSummary=_e.NotebookCellKind=void 0;var Ws=(yu(),Iu(gu)),or=wA(_u()),yr=ze(),Jg;(function(e){e.Markup=1,e.Code=2;function t(r){return r===1||r===2}e.is=t})(Jg||(_e.NotebookCellKind=Jg={}));var Gg;(function(e){function t(o,i){let s={executionOrder:o};return(i===!0||i===!1)&&(s.success=i),s}e.create=t;function r(o){let i=o;return or.objectLiteral(i)&&Ws.uinteger.is(i.executionOrder)&&(i.success===void 0||or.boolean(i.success))}e.is=r;function n(o,i){return o===i?!0:o==null||i===null||i===void 0?!1:o.executionOrder===i.executionOrder&&o.success===i.success}e.equals=n})(Gg||(_e.ExecutionSummary=Gg={}));var Pu;(function(e){function t(i,s){return{kind:i,document:s}}e.create=t;function r(i){let s=i;return or.objectLiteral(s)&&Jg.is(s.kind)&&Ws.DocumentUri.is(s.document)&&(s.metadata===void 0||or.objectLiteral(s.metadata))}e.is=r;function n(i,s){let a=new Set;return i.document!==s.document&&a.add("document"),i.kind!==s.kind&&a.add("kind"),i.executionSummary!==s.executionSummary&&a.add("executionSummary"),(i.metadata!==void 0||s.metadata!==void 0)&&!o(i.metadata,s.metadata)&&a.add("metadata"),(i.executionSummary!==void 0||s.executionSummary!==void 0)&&!Gg.equals(i.executionSummary,s.executionSummary)&&a.add("executionSummary"),a}e.diff=n;function o(i,s){if(i===s)return!0;if(i==null||s===null||s===void 0||typeof i!=typeof s||typeof i!="object")return!1;let a=Array.isArray(i),c=Array.isArray(s);if(a!==c)return!1;if(a&&c){if(i.length!==s.length)return!1;for(let u=0;u<i.length;u++)if(!o(i[u],s[u]))return!1}if(or.objectLiteral(i)&&or.objectLiteral(s)){let u=Object.keys(i),l=Object.keys(s);if(u.length!==l.length||(u.sort(),l.sort(),!o(u,l)))return!1;for(let d=0;d<u.length;d++){let h=u[d];if(!o(i[h],s[h]))return!1}}return!0}})(Pu||(_e.NotebookCell=Pu={}));var bS;(function(e){function t(n,o,i,s){return{uri:n,notebookType:o,version:i,cells:s}}e.create=t;function r(n){let o=n;return or.objectLiteral(o)&&or.string(o.uri)&&Ws.integer.is(o.version)&&or.typedArray(o.cells,Pu.is)}e.is=r})(bS||(_e.NotebookDocument=bS={}));var gi;(function(e){e.method="notebookDocument/sync",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.RegistrationType(e.method)})(gi||(_e.NotebookDocumentSyncRegistrationType=gi={}));var wS;(function(e){e.method="notebookDocument/didOpen",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})(wS||(_e.DidOpenNotebookDocumentNotification=wS={}));var xS;(function(e){function t(n){let o=n;return or.objectLiteral(o)&&Ws.uinteger.is(o.start)&&Ws.uinteger.is(o.deleteCount)&&(o.cells===void 0||or.typedArray(o.cells,Pu.is))}e.is=t;function r(n,o,i){let s={start:n,deleteCount:o};return i!==void 0&&(s.cells=i),s}e.create=r})(xS||(_e.NotebookCellArrayChange=xS={}));var $S;(function(e){e.method="notebookDocument/didChange",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})($S||(_e.DidChangeNotebookDocumentNotification=$S={}));var SS;(function(e){e.method="notebookDocument/didSave",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})(SS||(_e.DidSaveNotebookDocumentNotification=SS={}));var kS;(function(e){e.method="notebookDocument/didClose",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})(kS||(_e.DidCloseNotebookDocumentNotification=kS={}))});var RS=k(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.InlineCompletionRequest=void 0;var Kg=ze(),TS;(function(e){e.method="textDocument/inlineCompletion",e.messageDirection=Kg.MessageDirection.clientToServer,e.type=new Kg.ProtocolRequestType(e.method),e.capabilities=Kg.CM.create("textDocument.inlineCompletion","inlineCompletionProvider")})(TS||(Tu.InlineCompletionRequest=TS={}))});var OS=k(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.TextDocumentContentRefreshRequest=yi.TextDocumentContentRequest=void 0;var Js=ze(),zS;(function(e){e.method="workspace/textDocumentContent",e.messageDirection=Js.MessageDirection.clientToServer,e.type=new Js.ProtocolRequestType(e.method),e.capabilities=Js.CM.create("workspace.textDocumentContent","workspace.textDocumentContent")})(zS||(yi.TextDocumentContentRequest=zS={}));var ES;(function(e){e.method="workspace/textDocumentContent/refresh",e.messageDirection=Js.MessageDirection.serverToClient,e.type=new Js.ProtocolRequestType(e.method)})(ES||(yi.TextDocumentContentRefreshRequest=ES={}))});var Hk=k(f=>{"use strict";var xA=f&&f.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),$A=f&&f.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),SA=f&&f.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&xA(r,t,n[o]);return $A(r,t),r}})();Object.defineProperty(f,"__esModule",{value:!0});f.CodeActionRequest=f.DocumentSymbolRequest=f.DocumentHighlightRequest=f.ReferencesRequest=f.DefinitionRequest=f.SignatureHelpRequest=f.SignatureHelpTriggerKind=f.HoverRequest=f.CompletionResolveRequest=f.CompletionRequest=f.CompletionTriggerKind=f.PublishDiagnosticsNotification=f.WatchKind=f.GlobPattern=f.RelativePattern=f.FileChangeType=f.DidChangeWatchedFilesNotification=f.WillSaveTextDocumentWaitUntilRequest=f.WillSaveTextDocumentNotification=f.TextDocumentSaveReason=f.DidSaveTextDocumentNotification=f.DidCloseTextDocumentNotification=f.DidChangeTextDocumentNotification=f.TextDocumentContentChangeEvent=f.DidOpenTextDocumentNotification=f.TextDocumentSyncKind=f.TelemetryEventNotification=f.LogMessageNotification=f.ShowMessageRequest=f.ShowMessageNotification=f.MessageType=f.DidChangeConfigurationNotification=f.ExitNotification=f.ShutdownRequest=f.InitializedNotification=f.InitializeErrorCodes=f.InitializeRequest=f.WorkDoneProgressOptions=f.TextDocumentRegistrationOptions=f.StaticRegistrationOptions=f.PositionEncodingKind=f.RegularExpressionEngineKind=f.FailureHandlingKind=f.ResourceOperationKind=f.UnregistrationRequest=f.RegistrationRequest=f.DocumentSelector=f.NotebookCellTextDocumentFilter=f.NotebookDocumentFilter=f.TextDocumentFilter=void 0;f.UniquenessLevel=f.WillDeleteFilesRequest=f.DidDeleteFilesNotification=f.WillRenameFilesRequest=f.DidRenameFilesNotification=f.WillCreateFilesRequest=f.DidCreateFilesNotification=f.FileOperationPatternKind=f.LinkedEditingRangeRequest=f.ShowDocumentRequest=f.SemanticTokensRegistrationType=f.SemanticTokensRefreshRequest=f.SemanticTokensRangeRequest=f.SemanticTokensDeltaRequest=f.SemanticTokensRequest=f.TokenFormat=f.CallHierarchyPrepareRequest=f.CallHierarchyOutgoingCallsRequest=f.CallHierarchyIncomingCallsRequest=f.WorkDoneProgressCancelNotification=f.WorkDoneProgressCreateRequest=f.WorkDoneProgress=f.SelectionRangeRequest=f.DeclarationRequest=f.FoldingRangeRefreshRequest=f.FoldingRangeRequest=f.ColorPresentationRequest=f.DocumentColorRequest=f.ConfigurationRequest=f.DidChangeWorkspaceFoldersNotification=f.WorkspaceFoldersRequest=f.TypeDefinitionRequest=f.ImplementationRequest=f.ApplyWorkspaceEditRequest=f.ExecuteCommandRequest=f.PrepareRenameRequest=f.RenameRequest=f.PrepareSupportDefaultBehavior=f.DocumentOnTypeFormattingRequest=f.DocumentRangesFormattingRequest=f.DocumentRangeFormattingRequest=f.DocumentFormattingRequest=f.DocumentLinkResolveRequest=f.DocumentLinkRequest=f.CodeLensRefreshRequest=f.CodeLensResolveRequest=f.CodeLensRequest=f.WorkspaceSymbolResolveRequest=f.WorkspaceSymbolRequest=f.CodeActionResolveRequest=void 0;f.TextDocumentContentRefreshRequest=f.TextDocumentContentRequest=f.InlineCompletionRequest=f.DidCloseNotebookDocumentNotification=f.DidSaveNotebookDocumentNotification=f.DidChangeNotebookDocumentNotification=f.NotebookCellArrayChange=f.DidOpenNotebookDocumentNotification=f.NotebookDocumentSyncRegistrationType=f.NotebookDocument=f.NotebookCell=f.ExecutionSummary=f.NotebookCellKind=f.DiagnosticRefreshRequest=f.WorkspaceDiagnosticRequest=f.DocumentDiagnosticRequest=f.DocumentDiagnosticReportKind=f.DiagnosticServerCancellationData=f.InlayHintRefreshRequest=f.InlayHintResolveRequest=f.InlayHintRequest=f.InlineValueRefreshRequest=f.InlineValueRequest=f.TypeHierarchySupertypesRequest=f.TypeHierarchySubtypesRequest=f.TypeHierarchyPrepareRequest=f.MonikerRequest=f.MonikerKind=void 0;var $=ze(),CS=(yu(),Iu(gu)),Ke=SA(_u()),kA=c0();Object.defineProperty(f,"ImplementationRequest",{enumerable:!0,get:function(){return kA.ImplementationRequest}});var PA=l0();Object.defineProperty(f,"TypeDefinitionRequest",{enumerable:!0,get:function(){return PA.TypeDefinitionRequest}});var Zk=p0();Object.defineProperty(f,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return Zk.WorkspaceFoldersRequest}});Object.defineProperty(f,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return Zk.DidChangeWorkspaceFoldersNotification}});var TA=h0();Object.defineProperty(f,"ConfigurationRequest",{enumerable:!0,get:function(){return TA.ConfigurationRequest}});var Lk=_0();Object.defineProperty(f,"DocumentColorRequest",{enumerable:!0,get:function(){return Lk.DocumentColorRequest}});Object.defineProperty(f,"ColorPresentationRequest",{enumerable:!0,get:function(){return Lk.ColorPresentationRequest}});var Fk=w0();Object.defineProperty(f,"FoldingRangeRequest",{enumerable:!0,get:function(){return Fk.FoldingRangeRequest}});Object.defineProperty(f,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return Fk.FoldingRangeRefreshRequest}});var RA=$0();Object.defineProperty(f,"DeclarationRequest",{enumerable:!0,get:function(){return RA.DeclarationRequest}});var zA=k0();Object.defineProperty(f,"SelectionRangeRequest",{enumerable:!0,get:function(){return zA.SelectionRangeRequest}});var ny=z0();Object.defineProperty(f,"WorkDoneProgress",{enumerable:!0,get:function(){return ny.WorkDoneProgress}});Object.defineProperty(f,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return ny.WorkDoneProgressCreateRequest}});Object.defineProperty(f,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return ny.WorkDoneProgressCancelNotification}});var oy=j0();Object.defineProperty(f,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(f,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(f,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return oy.CallHierarchyPrepareRequest}});var _i=q0();Object.defineProperty(f,"TokenFormat",{enumerable:!0,get:function(){return _i.TokenFormat}});Object.defineProperty(f,"SemanticTokensRequest",{enumerable:!0,get:function(){return _i.SemanticTokensRequest}});Object.defineProperty(f,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return _i.SemanticTokensDeltaRequest}});Object.defineProperty(f,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return _i.SemanticTokensRangeRequest}});Object.defineProperty(f,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return _i.SemanticTokensRefreshRequest}});Object.defineProperty(f,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return _i.SemanticTokensRegistrationType}});var EA=L0();Object.defineProperty(f,"ShowDocumentRequest",{enumerable:!0,get:function(){return EA.ShowDocumentRequest}});var OA=U0();Object.defineProperty(f,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return OA.LinkedEditingRangeRequest}});var uo=X0();Object.defineProperty(f,"FileOperationPatternKind",{enumerable:!0,get:function(){return uo.FileOperationPatternKind}});Object.defineProperty(f,"DidCreateFilesNotification",{enumerable:!0,get:function(){return uo.DidCreateFilesNotification}});Object.defineProperty(f,"WillCreateFilesRequest",{enumerable:!0,get:function(){return uo.WillCreateFilesRequest}});Object.defineProperty(f,"DidRenameFilesNotification",{enumerable:!0,get:function(){return uo.DidRenameFilesNotification}});Object.defineProperty(f,"WillRenameFilesRequest",{enumerable:!0,get:function(){return uo.WillRenameFilesRequest}});Object.defineProperty(f,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return uo.DidDeleteFilesNotification}});Object.defineProperty(f,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return uo.WillDeleteFilesRequest}});var iy=tS();Object.defineProperty(f,"UniquenessLevel",{enumerable:!0,get:function(){return iy.UniquenessLevel}});Object.defineProperty(f,"MonikerKind",{enumerable:!0,get:function(){return iy.MonikerKind}});Object.defineProperty(f,"MonikerRequest",{enumerable:!0,get:function(){return iy.MonikerRequest}});var sy=iS();Object.defineProperty(f,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return sy.TypeHierarchyPrepareRequest}});Object.defineProperty(f,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return sy.TypeHierarchySubtypesRequest}});Object.defineProperty(f,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return sy.TypeHierarchySupertypesRequest}});var Uk=cS();Object.defineProperty(f,"InlineValueRequest",{enumerable:!0,get:function(){return Uk.InlineValueRequest}});Object.defineProperty(f,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return Uk.InlineValueRefreshRequest}});var ay=fS();Object.defineProperty(f,"InlayHintRequest",{enumerable:!0,get:function(){return ay.InlayHintRequest}});Object.defineProperty(f,"InlayHintResolveRequest",{enumerable:!0,get:function(){return ay.InlayHintResolveRequest}});Object.defineProperty(f,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return ay.InlayHintRefreshRequest}});var Gs=vS();Object.defineProperty(f,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Gs.DiagnosticServerCancellationData}});Object.defineProperty(f,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Gs.DocumentDiagnosticReportKind}});Object.defineProperty(f,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Gs.DocumentDiagnosticRequest}});Object.defineProperty(f,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Gs.WorkspaceDiagnosticRequest}});Object.defineProperty(f,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Gs.DiagnosticRefreshRequest}});var _r=PS();Object.defineProperty(f,"NotebookCellKind",{enumerable:!0,get:function(){return _r.NotebookCellKind}});Object.defineProperty(f,"ExecutionSummary",{enumerable:!0,get:function(){return _r.ExecutionSummary}});Object.defineProperty(f,"NotebookCell",{enumerable:!0,get:function(){return _r.NotebookCell}});Object.defineProperty(f,"NotebookDocument",{enumerable:!0,get:function(){return _r.NotebookDocument}});Object.defineProperty(f,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return _r.NotebookDocumentSyncRegistrationType}});Object.defineProperty(f,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidOpenNotebookDocumentNotification}});Object.defineProperty(f,"NotebookCellArrayChange",{enumerable:!0,get:function(){return _r.NotebookCellArrayChange}});Object.defineProperty(f,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidChangeNotebookDocumentNotification}});Object.defineProperty(f,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidSaveNotebookDocumentNotification}});Object.defineProperty(f,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidCloseNotebookDocumentNotification}});var CA=RS();Object.defineProperty(f,"InlineCompletionRequest",{enumerable:!0,get:function(){return CA.InlineCompletionRequest}});var Vk=OS();Object.defineProperty(f,"TextDocumentContentRequest",{enumerable:!0,get:function(){return Vk.TextDocumentContentRequest}});Object.defineProperty(f,"TextDocumentContentRefreshRequest",{enumerable:!0,get:function(){return Vk.TextDocumentContentRefreshRequest}});var Xg;(function(e){function t(r){let n=r;return Ke.string(n)||Ke.string(n.language)||Ke.string(n.scheme)||ry.is(n.pattern)}e.is=t})(Xg||(f.TextDocumentFilter=Xg={}));var Yg;(function(e){function t(r){let n=r;return Ke.objectLiteral(n)&&(Ke.string(n.notebookType)||Ke.string(n.scheme)||Ke.string(n.pattern))}e.is=t})(Yg||(f.NotebookDocumentFilter=Yg={}));var Qg;(function(e){function t(r){let n=r;return Ke.objectLiteral(n)&&(Ke.string(n.notebook)||Yg.is(n.notebook))&&(n.language===void 0||Ke.string(n.language))}e.is=t})(Qg||(f.NotebookCellTextDocumentFilter=Qg={}));var ey;(function(e){function t(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Ke.string(n)&&!Xg.is(n)&&!Qg.is(n))return!1;return!0}e.is=t})(ey||(f.DocumentSelector=ey={}));var jS;(function(e){e.method="client/registerCapability",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType(e.method)})(jS||(f.RegistrationRequest=jS={}));var IS;(function(e){e.method="client/unregisterCapability",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType(e.method)})(IS||(f.UnregistrationRequest=IS={}));var NS;(function(e){e.Create="create",e.Rename="rename",e.Delete="delete"})(NS||(f.ResourceOperationKind=NS={}));var MS;(function(e){e.Abort="abort",e.Transactional="transactional",e.TextOnlyTransactional="textOnlyTransactional",e.Undo="undo"})(MS||(f.FailureHandlingKind=MS={}));var DS;(function(e){e.ES2020="ES2020"})(DS||(f.RegularExpressionEngineKind=DS={}));var AS;(function(e){e.UTF8="utf-8",e.UTF16="utf-16",e.UTF32="utf-32"})(AS||(f.PositionEncodingKind=AS={}));var qS;(function(e){function t(r){let n=r;return n&&Ke.string(n.id)&&n.id.length>0}e.hasId=t})(qS||(f.StaticRegistrationOptions=qS={}));var ZS;(function(e){function t(r){let n=r;return n&&(n.documentSelector===null||ey.is(n.documentSelector))}e.is=t})(ZS||(f.TextDocumentRegistrationOptions=ZS={}));var LS;(function(e){function t(n){let o=n;return Ke.objectLiteral(o)&&(o.workDoneProgress===void 0||Ke.boolean(o.workDoneProgress))}e.is=t;function r(n){let o=n;return o&&Ke.boolean(o.workDoneProgress)}e.hasWorkDoneProgress=r})(LS||(f.WorkDoneProgressOptions=LS={}));var FS;(function(e){e.method="initialize",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method)})(FS||(f.InitializeRequest=FS={}));var US;(function(e){e.unknownProtocolVersion=1})(US||(f.InitializeErrorCodes=US={}));var VS;(function(e){e.method="initialized",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method)})(VS||(f.InitializedNotification=VS={}));var HS;(function(e){e.method="shutdown",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType0(e.method)})(HS||(f.ShutdownRequest=HS={}));var BS;(function(e){e.method="exit",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType0(e.method)})(BS||(f.ExitNotification=BS={}));var WS;(function(e){e.method="workspace/didChangeConfiguration",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("workspace.didChangeConfiguration",void 0)})(WS||(f.DidChangeConfigurationNotification=WS={}));var JS;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(JS||(f.MessageType=JS={}));var GS;(function(e){e.method="window/showMessage",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("window.showMessage",void 0)})(GS||(f.ShowMessageNotification=GS={}));var KS;(function(e){e.method="window/showMessageRequest",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("window.showMessage",void 0)})(KS||(f.ShowMessageRequest=KS={}));var XS;(function(e){e.method="window/logMessage",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method)})(XS||(f.LogMessageNotification=XS={}));var YS;(function(e){e.method="telemetry/event",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method)})(YS||(f.TelemetryEventNotification=YS={}));var QS;(function(e){e.None=0,e.Full=1,e.Incremental=2})(QS||(f.TextDocumentSyncKind=QS={}));var ek;(function(e){e.method="textDocument/didOpen",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(ek||(f.DidOpenTextDocumentNotification=ek={}));var tk;(function(e){function t(n){let o=n;return o!=null&&typeof o.text=="string"&&o.range!==void 0&&(o.rangeLength===void 0||typeof o.rangeLength=="number")}e.isIncremental=t;function r(n){let o=n;return o!=null&&typeof o.text=="string"&&o.range===void 0&&o.rangeLength===void 0}e.isFull=r})(tk||(f.TextDocumentContentChangeEvent=tk={}));var rk;(function(e){e.method="textDocument/didChange",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization","textDocumentSync")})(rk||(f.DidChangeTextDocumentNotification=rk={}));var nk;(function(e){e.method="textDocument/didClose",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(nk||(f.DidCloseTextDocumentNotification=nk={}));var ok;(function(e){e.method="textDocument/didSave",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization.didSave","textDocumentSync.save")})(ok||(f.DidSaveTextDocumentNotification=ok={}));var ik;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(ik||(f.TextDocumentSaveReason=ik={}));var sk;(function(e){e.method="textDocument/willSave",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization.willSave","textDocumentSync.willSave")})(sk||(f.WillSaveTextDocumentNotification=sk={}));var ak;(function(e){e.method="textDocument/willSaveWaitUntil",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.synchronization.willSaveWaitUntil","textDocumentSync.willSaveWaitUntil")})(ak||(f.WillSaveTextDocumentWaitUntilRequest=ak={}));var ck;(function(e){e.method="workspace/didChangeWatchedFiles",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("workspace.didChangeWatchedFiles",void 0)})(ck||(f.DidChangeWatchedFilesNotification=ck={}));var uk;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(uk||(f.FileChangeType=uk={}));var ty;(function(e){function t(r){let n=r;return Ke.objectLiteral(n)&&(CS.URI.is(n.baseUri)||CS.WorkspaceFolder.is(n.baseUri))&&Ke.string(n.pattern)}e.is=t})(ty||(f.RelativePattern=ty={}));var ry;(function(e){function t(r){let n=r;return Ke.string(n)||ty.is(n)}e.is=t})(ry||(f.GlobPattern=ry={}));var lk;(function(e){e.Create=1,e.Change=2,e.Delete=4})(lk||(f.WatchKind=lk={}));var dk;(function(e){e.method="textDocument/publishDiagnostics",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.publishDiagnostics",void 0)})(dk||(f.PublishDiagnosticsNotification=dk={}));var fk;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(fk||(f.CompletionTriggerKind=fk={}));var pk;(function(e){e.method="textDocument/completion",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.completion","completionProvider")})(pk||(f.CompletionRequest=pk={}));var mk;(function(e){e.method="completionItem/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.completion.completionItem.resolveSupport","completionProvider.resolveProvider")})(mk||(f.CompletionResolveRequest=mk={}));var hk;(function(e){e.method="textDocument/hover",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.hover","hoverProvider")})(hk||(f.HoverRequest=hk={}));var gk;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(gk||(f.SignatureHelpTriggerKind=gk={}));var yk;(function(e){e.method="textDocument/signatureHelp",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.signatureHelp","signatureHelpProvider")})(yk||(f.SignatureHelpRequest=yk={}));var _k;(function(e){e.method="textDocument/definition",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.definition","definitionProvider")})(_k||(f.DefinitionRequest=_k={}));var vk;(function(e){e.method="textDocument/references",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.references","referencesProvider")})(vk||(f.ReferencesRequest=vk={}));var bk;(function(e){e.method="textDocument/documentHighlight",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentHighlight","documentHighlightProvider")})(bk||(f.DocumentHighlightRequest=bk={}));var wk;(function(e){e.method="textDocument/documentSymbol",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentSymbol","documentSymbolProvider")})(wk||(f.DocumentSymbolRequest=wk={}));var xk;(function(e){e.method="textDocument/codeAction",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeAction","codeActionProvider")})(xk||(f.CodeActionRequest=xk={}));var $k;(function(e){e.method="codeAction/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeAction.resolveSupport","codeActionProvider.resolveProvider")})($k||(f.CodeActionResolveRequest=$k={}));var Sk;(function(e){e.method="workspace/symbol",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("workspace.symbol","workspaceSymbolProvider")})(Sk||(f.WorkspaceSymbolRequest=Sk={}));var kk;(function(e){e.method="workspaceSymbol/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("workspace.symbol.resolveSupport","workspaceSymbolProvider.resolveProvider")})(kk||(f.WorkspaceSymbolResolveRequest=kk={}));var Pk;(function(e){e.method="textDocument/codeLens",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeLens","codeLensProvider")})(Pk||(f.CodeLensRequest=Pk={}));var Tk;(function(e){e.method="codeLens/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeLens.resolveSupport","codeLensProvider.resolveProvider")})(Tk||(f.CodeLensResolveRequest=Tk={}));var Rk;(function(e){e.method="workspace/codeLens/refresh",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType0(e.method),e.capabilities=$.CM.create("workspace.codeLens",void 0)})(Rk||(f.CodeLensRefreshRequest=Rk={}));var zk;(function(e){e.method="textDocument/documentLink",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentLink","documentLinkProvider")})(zk||(f.DocumentLinkRequest=zk={}));var Ek;(function(e){e.method="documentLink/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentLink","documentLinkProvider.resolveProvider")})(Ek||(f.DocumentLinkResolveRequest=Ek={}));var Ok;(function(e){e.method="textDocument/formatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.formatting","documentFormattingProvider")})(Ok||(f.DocumentFormattingRequest=Ok={}));var Ck;(function(e){e.method="textDocument/rangeFormatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rangeFormatting","documentRangeFormattingProvider")})(Ck||(f.DocumentRangeFormattingRequest=Ck={}));var jk;(function(e){e.method="textDocument/rangesFormatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rangeFormatting.rangesSupport","documentRangeFormattingProvider.rangesSupport")})(jk||(f.DocumentRangesFormattingRequest=jk={}));var Ik;(function(e){e.method="textDocument/onTypeFormatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.onTypeFormatting","documentOnTypeFormattingProvider")})(Ik||(f.DocumentOnTypeFormattingRequest=Ik={}));var Nk;(function(e){e.Identifier=1})(Nk||(f.PrepareSupportDefaultBehavior=Nk={}));var Mk;(function(e){e.method="textDocument/rename",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rename","renameProvider")})(Mk||(f.RenameRequest=Mk={}));var Dk;(function(e){e.method="textDocument/prepareRename",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rename.prepareSupport","renameProvider.prepareProvider")})(Dk||(f.PrepareRenameRequest=Dk={}));var Ak;(function(e){e.method="workspace/executeCommand",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("workspace.executeCommand","executeCommandProvider")})(Ak||(f.ExecuteCommandRequest=Ak={}));var qk;(function(e){e.method="workspace/applyEdit",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType("workspace/applyEdit"),e.capabilities=$.CM.create("workspace.applyEdit",void 0)})(qk||(f.ApplyWorkspaceEditRequest=qk={}))});var Wk=k(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});cy.createProtocolConnection=jA;var Bk=Or();function jA(e,t,r,n){return Bk.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Bk.createMessageConnection)(e,t,r,n)}});var uy=k(zt=>{"use strict";var IA=zt&&zt.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Ru=zt&&zt.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&IA(t,e,r)};Object.defineProperty(zt,"__esModule",{value:!0});zt.LSPErrorCodes=zt.createProtocolConnection=void 0;Ru(Or(),zt);Ru((yu(),Iu(gu)),zt);Ru(ze(),zt);Ru(Hk(),zt);var NA=Wk();Object.defineProperty(zt,"createProtocolConnection",{enumerable:!0,get:function(){return NA.createProtocolConnection}});var Jk;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(Jk||(zt.LSPErrorCodes=Jk={}))});var Kk=k(Dr=>{"use strict";var MA=Dr&&Dr.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Gk=Dr&&Dr.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&MA(t,e,r)};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.createProtocolConnection=AA;var DA=Eh();Gk(Eh(),Dr);Gk(uy(),Dr);function AA(e,t,r,n){return(0,DA.createMessageConnection)(e,t,r,n)}});import{extname as VA}from"node:path";var Vr={};Ys(Vr,{BRAND:()=>JP,DIRTY:()=>xn,EMPTY_PATH:()=>PP,INVALID:()=>H,NEVER:()=>OT,OK:()=>ot,ParseStatus:()=>Xe,Schema:()=>Y,ZodAny:()=>Fr,ZodArray:()=>Sr,ZodBigInt:()=>Sn,ZodBoolean:()=>kn,ZodBranded:()=>Pi,ZodCatch:()=>Mn,ZodDate:()=>Pn,ZodDefault:()=>Nn,ZodDiscriminatedUnion:()=>ra,ZodEffects:()=>Dt,ZodEnum:()=>jn,ZodError:()=>vt,ZodFirstPartyTypeKind:()=>E,ZodFunction:()=>oa,ZodIntersection:()=>En,ZodIssueCode:()=>R,ZodLazy:()=>On,ZodLiteral:()=>Cn,ZodMap:()=>bo,ZodNaN:()=>xo,ZodNativeEnum:()=>In,ZodNever:()=>Wt,ZodNull:()=>Rn,ZodNullable:()=>ur,ZodNumber:()=>$n,ZodObject:()=>wt,ZodOptional:()=>bt,ZodParsedType:()=>I,ZodPipeline:()=>Ti,ZodPromise:()=>Ur,ZodReadonly:()=>Dn,ZodRecord:()=>na,ZodSchema:()=>Y,ZodSet:()=>wo,ZodString:()=>Lr,ZodSymbol:()=>_o,ZodTransformer:()=>Dt,ZodTuple:()=>cr,ZodType:()=>Y,ZodUndefined:()=>Tn,ZodUnion:()=>zn,ZodUnknown:()=>$r,ZodVoid:()=>vo,addIssueToContext:()=>j,any:()=>nT,array:()=>aT,bigint:()=>YP,boolean:()=>Oy,coerce:()=>ET,custom:()=>Ry,date:()=>QP,datetimeRegex:()=>Py,defaultErrorMap:()=>wr,discriminatedUnion:()=>lT,effect:()=>xT,enum:()=>vT,function:()=>gT,getErrorMap:()=>ho,getParsedType:()=>ar,instanceof:()=>KP,intersection:()=>dT,isAborted:()=>ea,isAsync:()=>go,isDirty:()=>ta,isValid:()=>Zr,late:()=>GP,lazy:()=>yT,literal:()=>_T,makeIssue:()=>ki,map:()=>mT,nan:()=>XP,nativeEnum:()=>bT,never:()=>iT,null:()=>rT,nullable:()=>ST,number:()=>Ey,object:()=>Au,objectUtil:()=>Nu,oboolean:()=>zT,onumber:()=>RT,optional:()=>$T,ostring:()=>TT,pipeline:()=>PT,preprocess:()=>kT,promise:()=>wT,quotelessJson:()=>$P,record:()=>pT,set:()=>hT,setErrorMap:()=>kP,strictObject:()=>cT,string:()=>zy,symbol:()=>eT,transformer:()=>xT,tuple:()=>fT,undefined:()=>tT,union:()=>uT,unknown:()=>oT,util:()=>re,void:()=>sT});var re;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(re||(re={}));var Nu;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Nu||(Nu={}));var I=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=e=>{switch(typeof e){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(e)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(e)?I.array:e===null?I.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?I.promise:typeof Map<"u"&&e instanceof Map?I.map:typeof Set<"u"&&e instanceof Set?I.set:typeof Date<"u"&&e instanceof Date?I.date:I.object;default:return I.unknown}};var R=re.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"]),$P=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),vt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};vt.create=e=>new vt(e);var SP=(e,t)=>{let r;switch(e.code){case R.invalid_type:e.received===I.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case R.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,re.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:r=`Unrecognized key(s) in object: ${re.joinValues(e.keys,", ")}`;break;case R.invalid_union:r="Invalid input";break;case R.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${re.joinValues(e.options)}`;break;case R.invalid_enum_value:r=`Invalid enum value. Expected ${re.joinValues(e.options)}, received '${e.received}'`;break;case R.invalid_arguments:r="Invalid function arguments";break;case R.invalid_return_type:r="Invalid function return type";break;case R.invalid_date:r="Invalid date";break;case R.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:re.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case R.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case R.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case R.custom:r="Invalid input";break;case R.invalid_intersection_types:r="Intersection results could not be merged";break;case R.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case R.not_finite:r="Number must be finite";break;default:r=t.defaultError,re.assertNever(e)}return{message:r}},wr=SP;var wy=wr;function kP(e){wy=e}function ho(){return wy}var ki=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},PP=[];function j(e,t){let r=ho(),n=ki({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===wr?void 0:wr].filter(o=>!!o)});e.common.issues.push(n)}var Xe=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return H;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return H;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},H=Object.freeze({status:"aborted"}),xn=e=>({status:"dirty",value:e}),ot=e=>({status:"valid",value:e}),ea=e=>e.status==="aborted",ta=e=>e.status==="dirty",Zr=e=>e.status==="valid",go=e=>typeof Promise<"u"&&e instanceof Promise;var q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(q||(q={}));var Mt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xy=(e,t)=>{if(Zr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new vt(e.common.issues);return this._error=r,this._error}}};function K(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Y=class{get description(){return this._def.description}_getType(t){return ar(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xe,ctx:{common:t.parent.common,data:t.data,parsedType:ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(go(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)},o=this._parseSync({data:t,path:n.path,parent:n});return xy(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Zr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Zr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(go(o)?o:Promise.resolve(o));return xy(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:R.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Dt({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return bt.create(this,this._def)}nullable(){return ur.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this)}promise(){return Ur.create(this,this._def)}or(t){return zn.create([this,t],this._def)}and(t){return En.create(this,t,this._def)}transform(t){return new Dt({...K(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Nn({...K(this._def),innerType:this,defaultValue:r,typeName:E.ZodDefault})}brand(){return new Pi({typeName:E.ZodBranded,type:this,...K(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Mn({...K(this._def),innerType:this,catchValue:r,typeName:E.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ti.create(this,t)}readonly(){return Dn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},TP=/^c[^\s-]{8,}$/i,RP=/^[0-9a-z]+$/,zP=/^[0-9A-HJKMNP-TV-Z]{26}$/i,EP=/^[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,OP=/^[a-z0-9_-]{21}$/i,CP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jP=/^[-+]?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)?)??$/,IP=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,NP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Mu,MP=/^(?:(?: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])$/,DP=/^(?:(?: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])$/,AP=/^(([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]))$/,qP=/^(([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])$/,ZP=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LP=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sy="((\\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])))",FP=new RegExp(`^${Sy}$`);function ky(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function UP(e){return new RegExp(`^${ky(e)}$`)}function Py(e){let t=`${Sy}T${ky(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function VP(e,t){return!!((t==="v4"||!t)&&MP.test(e)||(t==="v6"||!t)&&AP.test(e))}function HP(e,t){if(!CP.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function BP(e,t){return!!((t==="v4"||!t)&&DP.test(e)||(t==="v6"||!t)&&qP.test(e))}var Lr=class e extends Y{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==I.string){let i=this._getOrReturnCtx(t);return j(i,{code:R.invalid_type,expected:I.string,received:i.parsedType}),H}let n=new Xe,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:R.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:R.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?j(o,{code:R.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&j(o,{code:R.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")IP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"email",code:R.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Mu||(Mu=new RegExp(NP,"u")),Mu.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"emoji",code:R.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")EP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"uuid",code:R.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")OP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"nanoid",code:R.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")TP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"cuid",code:R.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")RP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"cuid2",code:R.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")zP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"ulid",code:R.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),j(o,{validation:"url",code:R.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"regex",code:R.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),j(o,{code:R.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),j(o,{code:R.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),j(o,{code:R.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Py(i).test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{code:R.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?FP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{code:R.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?UP(i).test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{code:R.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?jP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"duration",code:R.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?VP(t.data,i.version)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"ip",code:R.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?HP(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"jwt",code:R.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?BP(t.data,i.version)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"cidr",code:R.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ZP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"base64",code:R.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?LP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"base64url",code:R.invalid_string,message:i.message}),n.dirty()):re.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:R.invalid_string,...q.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...q.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...q.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...q.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...q.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...q.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...q.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...q.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...q.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...q.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...q.errToObj(r)})}nonempty(t){return this.min(1,q.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Lr.create=e=>new Lr({checks:[],typeName:E.ZodString,coerce:e?.coerce??!1,...K(e)});function WP(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var $n=class e extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==I.number){let i=this._getOrReturnCtx(t);return j(i,{code:R.invalid_type,expected:I.number,received:i.parsedType}),H}let n,o=new Xe;for(let i of this._def.checks)i.kind==="int"?re.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),j(n,{code:R.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:R.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:R.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?WP(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),j(n,{code:R.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),j(n,{code:R.not_finite,message:i.message}),o.dirty()):re.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,q.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:q.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&re.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};$n.create=e=>new $n({checks:[],typeName:E.ZodNumber,coerce:e?.coerce||!1,...K(e)});var Sn=class e extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==I.bigint)return this._getInvalidInput(t);let n,o=new Xe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:R.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:R.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),j(n,{code:R.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):re.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:I.bigint,received:r.parsedType}),H}gte(t,r){return this.setLimit("min",t,!0,q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,q.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:q.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Sn.create=e=>new Sn({checks:[],typeName:E.ZodBigInt,coerce:e?.coerce??!1,...K(e)});var kn=class extends Y{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==I.boolean){let n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:I.boolean,received:n.parsedType}),H}return ot(t.data)}};kn.create=e=>new kn({typeName:E.ZodBoolean,coerce:e?.coerce||!1,...K(e)});var Pn=class e extends Y{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==I.date){let i=this._getOrReturnCtx(t);return j(i,{code:R.invalid_type,expected:I.date,received:i.parsedType}),H}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return j(i,{code:R.invalid_date}),H}let n=new Xe,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:R.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:R.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):re.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:q.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:q.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Pn.create=e=>new Pn({checks:[],coerce:e?.coerce||!1,typeName:E.ZodDate,...K(e)});var _o=class extends Y{_parse(t){if(this._getType(t)!==I.symbol){let n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:I.symbol,received:n.parsedType}),H}return ot(t.data)}};_o.create=e=>new _o({typeName:E.ZodSymbol,...K(e)});var Tn=class extends Y{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:I.undefined,received:n.parsedType}),H}return ot(t.data)}};Tn.create=e=>new Tn({typeName:E.ZodUndefined,...K(e)});var Rn=class extends Y{_parse(t){if(this._getType(t)!==I.null){let n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:I.null,received:n.parsedType}),H}return ot(t.data)}};Rn.create=e=>new Rn({typeName:E.ZodNull,...K(e)});var Fr=class extends Y{constructor(){super(...arguments),this._any=!0}_parse(t){return ot(t.data)}};Fr.create=e=>new Fr({typeName:E.ZodAny,...K(e)});var $r=class extends Y{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ot(t.data)}};$r.create=e=>new $r({typeName:E.ZodUnknown,...K(e)});var Wt=class extends Y{_parse(t){let r=this._getOrReturnCtx(t);return j(r,{code:R.invalid_type,expected:I.never,received:r.parsedType}),H}};Wt.create=e=>new Wt({typeName:E.ZodNever,...K(e)});var vo=class extends Y{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:I.void,received:n.parsedType}),H}return ot(t.data)}};vo.create=e=>new vo({typeName:E.ZodVoid,...K(e)});var Sr=class e extends Y{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==I.array)return j(r,{code:R.invalid_type,expected:I.array,received:r.parsedType}),H;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(j(r,{code:s?R.too_big:R.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?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&&(j(r,{code:R.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&&(j(r,{code:R.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((s,a)=>o.type._parseAsync(new Mt(r,s,r.path,a)))).then(s=>Xe.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Mt(r,s,r.path,a)));return Xe.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:q.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:q.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:q.toString(r)}})}nonempty(t){return this.min(1,t)}};Sr.create=(e,t)=>new Sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...K(t)});function yo(e){if(e instanceof wt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=bt.create(yo(n))}return new wt({...e._def,shape:()=>t})}else return e instanceof Sr?new Sr({...e._def,type:yo(e.element)}):e instanceof bt?bt.create(yo(e.unwrap())):e instanceof ur?ur.create(yo(e.unwrap())):e instanceof cr?cr.create(e.items.map(t=>yo(t))):e}var wt=class e extends Y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=re.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==I.object){let u=this._getOrReturnCtx(t);return j(u,{code:R.invalid_type,expected:I.object,received:u.parsedType}),H}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Wt&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Mt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Wt){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&&(j(o,{code:R.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 Mt(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=>Xe.mergeObjectSync(n,u)):Xe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return q.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:q.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:E.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of re.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of re.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return yo(this)}partial(t){let r={};for(let n of re.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of re.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof bt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Ty(re.objectKeys(this.shape))}};wt.create=(e,t)=>new wt({shape:()=>e,unknownKeys:"strip",catchall:Wt.create(),typeName:E.ZodObject,...K(t)});wt.strictCreate=(e,t)=>new wt({shape:()=>e,unknownKeys:"strict",catchall:Wt.create(),typeName:E.ZodObject,...K(t)});wt.lazycreate=(e,t)=>new wt({shape:e,unknownKeys:"strip",catchall:Wt.create(),typeName:E.ZodObject,...K(t)});var zn=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new vt(a.ctx.common.issues));return j(r,{code:R.invalid_union,unionErrors:s}),H}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new vt(c));return j(r,{code:R.invalid_union,unionErrors:a}),H}}get options(){return this._def.options}};zn.create=(e,t)=>new zn({options:e,typeName:E.ZodUnion,...K(t)});var xr=e=>e instanceof On?xr(e.schema):e instanceof Dt?xr(e.innerType()):e instanceof Cn?[e.value]:e instanceof jn?e.options:e instanceof In?re.objectValues(e.enum):e instanceof Nn?xr(e._def.innerType):e instanceof Tn?[void 0]:e instanceof Rn?[null]:e instanceof bt?[void 0,...xr(e.unwrap())]:e instanceof ur?[null,...xr(e.unwrap())]:e instanceof Pi||e instanceof Dn?xr(e.unwrap()):e instanceof Mn?xr(e._def.innerType):[],ra=class e extends Y{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.object)return j(r,{code:R.invalid_type,expected:I.object,received:r.parsedType}),H;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(j(r,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),H)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=xr(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:E.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...K(n)})}};function Du(e,t){let r=ar(e),n=ar(t);if(e===t)return{valid:!0,data:e};if(r===I.object&&n===I.object){let o=re.objectKeys(t),i=re.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let c=Du(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===I.array&&n===I.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],c=Du(s,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===I.date&&n===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var En=class extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(ea(i)||ea(s))return H;let a=Du(i.value,s.value);return a.valid?((ta(i)||ta(s))&&r.dirty(),{status:r.value,value:a.data}):(j(n,{code:R.invalid_intersection_types}),H)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):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}))}};En.create=(e,t,r)=>new En({left:e,right:t,typeName:E.ZodIntersection,...K(r)});var cr=class e extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.array)return j(n,{code:R.invalid_type,expected:I.array,received:n.parsedType}),H;if(n.data.length<this._def.items.length)return j(n,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;!this._def.rest&&n.data.length>this._def.items.length&&(j(n,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Mt(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Xe.mergeArray(r,s)):Xe.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};cr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cr({items:e,typeName:E.ZodTuple,rest:null,...K(t)})};var na=class e extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.object)return j(n,{code:R.invalid_type,expected:I.object,received:n.parsedType}),H;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Mt(n,a,n.path,a)),value:s._parse(new Mt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Xe.mergeObjectAsync(r,o):Xe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Y?new e({keyType:t,valueType:r,typeName:E.ZodRecord,...K(n)}):new e({keyType:Lr.create(),valueType:t,typeName:E.ZodRecord,...K(r)})}},bo=class extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.map)return j(n,{code:R.invalid_type,expected:I.map,received:n.parsedType}),H;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new Mt(n,a,n.path,[u,"key"])),value:i._parse(new Mt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return H;(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 s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return H;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};bo.create=(e,t,r)=>new bo({valueType:t,keyType:e,typeName:E.ZodMap,...K(r)});var wo=class e extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.set)return j(n,{code:R.invalid_type,expected:I.set,received:n.parsedType}),H;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(j(n,{code:R.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&&(j(n,{code:R.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return H;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new Mt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:q.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:q.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};wo.create=(e,t)=>new wo({valueType:e,minSize:null,maxSize:null,typeName:E.ZodSet,...K(t)});var oa=class e extends Y{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.function)return j(r,{code:R.invalid_type,expected:I.function,received:r.parsedType}),H;function n(a,c){return ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ho(),wr].filter(u=>!!u),issueData:{code:R.invalid_arguments,argumentsError:c}})}function o(a,c){return ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ho(),wr].filter(u=>!!u),issueData:{code:R.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ur){let a=this;return ot(async function(...c){let u=new vt([]),l=await a._def.args.parseAsync(c,i).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let a=this;return ot(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new vt([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new vt([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:cr.create(t).rest($r.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||cr.create([]).rest($r.create()),returns:r||$r.create(),typeName:E.ZodFunction,...K(n)})}},On=class extends Y{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};On.create=(e,t)=>new On({getter:e,typeName:E.ZodLazy,...K(t)});var Cn=class extends Y{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return j(r,{received:r.data,code:R.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:t.data}}get value(){return this._def.value}};Cn.create=(e,t)=>new Cn({value:e,typeName:E.ZodLiteral,...K(t)});function Ty(e,t){return new jn({values:e,typeName:E.ZodEnum,...K(t)})}var jn=class e extends Y{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return j(r,{expected:re.joinValues(n),received:r.parsedType,code:R.invalid_type}),H}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return j(r,{received:r.data,code:R.invalid_enum_value,options:n}),H}return ot(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};jn.create=Ty;var In=class extends Y{_parse(t){let r=re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==I.string&&n.parsedType!==I.number){let o=re.objectValues(r);return j(n,{expected:re.joinValues(o),received:n.parsedType,code:R.invalid_type}),H}if(this._cache||(this._cache=new Set(re.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=re.objectValues(r);return j(n,{received:n.data,code:R.invalid_enum_value,options:o}),H}return ot(t.data)}get enum(){return this._def.values}};In.create=(e,t)=>new In({values:e,typeName:E.ZodNativeEnum,...K(t)});var Ur=class extends Y{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.promise&&r.common.async===!1)return j(r,{code:R.invalid_type,expected:I.promise,received:r.parsedType}),H;let n=r.parsedType===I.promise?r.data:Promise.resolve(r.data);return ot(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ur.create=(e,t)=>new Ur({type:e,typeName:E.ZodPromise,...K(t)});var Dt=class extends Y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{j(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return H;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?H:c.status==="dirty"?xn(c.value):r.value==="dirty"?xn(c.value):c});{if(r.value==="aborted")return H;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?H:a.status==="dirty"?xn(a.value):r.value==="dirty"?xn(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?H:(a.status==="dirty"&&r.dirty(),s(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"?H:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Zr(s))return H;let a=o.transform(s.value,i);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(s=>Zr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):H);re.assertNever(o)}};Dt.create=(e,t,r)=>new Dt({schema:e,typeName:E.ZodEffects,effect:t,...K(r)});Dt.createWithPreprocess=(e,t,r)=>new Dt({schema:t,effect:{type:"preprocess",transform:e},typeName:E.ZodEffects,...K(r)});var bt=class extends Y{_parse(t){return this._getType(t)===I.undefined?ot(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};bt.create=(e,t)=>new bt({innerType:e,typeName:E.ZodOptional,...K(t)});var ur=class extends Y{_parse(t){return this._getType(t)===I.null?ot(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ur.create=(e,t)=>new ur({innerType:e,typeName:E.ZodNullable,...K(t)});var Nn=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===I.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Nn.create=(e,t)=>new Nn({innerType:e,typeName:E.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...K(t)});var Mn=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return go(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Mn.create=(e,t)=>new Mn({innerType:e,typeName:E.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...K(t)});var xo=class extends Y{_parse(t){if(this._getType(t)!==I.nan){let n=this._getOrReturnCtx(t);return j(n,{code:R.invalid_type,expected:I.nan,received:n.parsedType}),H}return{status:"valid",value:t.data}}};xo.create=e=>new xo({typeName:E.ZodNaN,...K(e)});var JP=Symbol("zod_brand"),Pi=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ti=class e extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?H:i.status==="dirty"?(r.dirty(),xn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?H:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:E.ZodPipeline})}},Dn=class extends Y{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Zr(o)&&(o.value=Object.freeze(o.value)),o);return go(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Dn.create=(e,t)=>new Dn({innerType:e,typeName:E.ZodReadonly,...K(t)});function $y(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function Ry(e,t={},r){return e?Fr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=$y(t,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=$y(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Fr.create()}var GP={object:wt.lazycreate},E;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(E||(E={}));var KP=(e,t={message:`Input not instance of ${e.name}`})=>Ry(r=>r instanceof e,t),zy=Lr.create,Ey=$n.create,XP=xo.create,YP=Sn.create,Oy=kn.create,QP=Pn.create,eT=_o.create,tT=Tn.create,rT=Rn.create,nT=Fr.create,oT=$r.create,iT=Wt.create,sT=vo.create,aT=Sr.create,Au=wt.create,cT=wt.strictCreate,uT=zn.create,lT=ra.create,dT=En.create,fT=cr.create,pT=na.create,mT=bo.create,hT=wo.create,gT=oa.create,yT=On.create,_T=Cn.create,vT=jn.create,bT=In.create,wT=Ur.create,xT=Dt.create,$T=bt.create,ST=ur.create,kT=Dt.createWithPreprocess,PT=Ti.create,TT=()=>zy().optional(),RT=()=>Ey().optional(),zT=()=>Oy().optional(),ET={string:(e=>Lr.create({...e,coerce:!0})),number:(e=>$n.create({...e,coerce:!0})),boolean:(e=>kn.create({...e,coerce:!0})),bigint:(e=>Sn.create({...e,coerce:!0})),date:(e=>Pn.create({...e,coerce:!0}))};var OT=H;var CT=Object.freeze({status:"aborted"});function x(e,t,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(e),t(a,c);for(let l in s.prototype)l in a||Object.defineProperty(a,l,{value:s.prototype[l].bind(a)});a._zod.constr=s,a._zod.def=c}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let u=r?.Parent?new i:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var kr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ia={};function Et(e){return e&&Object.assign(ia,e),ia}var ne={};Ys(ne,{BIGINT_FORMAT_RANGES:()=>jy,Class:()=>Zu,NUMBER_FORMAT_RANGES:()=>Wu,aborted:()=>qn,allowsEval:()=>Vu,assert:()=>DT,assertEqual:()=>jT,assertIs:()=>NT,assertNever:()=>MT,assertNotEqual:()=>IT,assignProp:()=>Uu,cached:()=>Ei,captureStackTrace:()=>aa,cleanEnum:()=>KT,cleanRegex:()=>Ci,clone:()=>Ot,createTransparentProxy:()=>UT,defineLazy:()=>be,esc:()=>An,escapeRegex:()=>Hr,extend:()=>BT,finalizeIssue:()=>Jt,floatSafeRemainder:()=>Fu,getElementAtPath:()=>AT,getEnumValues:()=>zi,getLengthableOrigin:()=>ji,getParsedType:()=>FT,getSizableOrigin:()=>Iy,isObject:()=>$o,isPlainObject:()=>So,issue:()=>Ju,joinValues:()=>sa,jsonStringifyReplacer:()=>Lu,merge:()=>WT,normalizeParams:()=>B,nullish:()=>Oi,numKeys:()=>LT,omit:()=>HT,optionalKeys:()=>Bu,partial:()=>JT,pick:()=>VT,prefixIssues:()=>lr,primitiveTypes:()=>Cy,promiseAllObject:()=>qT,propertyKeyTypes:()=>Hu,randomString:()=>ZT,required:()=>GT,stringifyPrimitive:()=>ca,unwrapMessage:()=>Ri});function jT(e){return e}function IT(e){return e}function NT(e){}function MT(e){throw new Error}function DT(e){}function zi(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function sa(e,t="|"){return e.map(r=>ca(r)).join(t)}function Lu(e,t){return typeof t=="bigint"?t.toString():t}function Ei(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Oi(e){return e==null}function Ci(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fu(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function be(e,t,r){Object.defineProperty(e,t,{get(){{let o=r();return e[t]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Uu(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function AT(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function qT(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function ZT(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function An(e){return JSON.stringify(e)}var aa=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Vu=Ei(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function So(e){if($o(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!($o(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function LT(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var FT=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Hu=new Set(["string","number","symbol"]),Cy=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Hr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ot(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function B(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function UT(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function ca(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Bu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Wu={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]},jy={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function VT(e,t){let r={},n=e._zod.def;for(let o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(r[o]=n.shape[o])}return Ot(e,{...e._zod.def,shape:r,checks:[]})}function HT(e,t){let r={...e._zod.def.shape},n=e._zod.def;for(let o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete r[o]}return Ot(e,{...e._zod.def,shape:r,checks:[]})}function BT(e,t){if(!So(t))throw new Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Uu(this,"shape",n),n},checks:[]};return Ot(e,r)}function WT(e,t){return Ot(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Uu(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function JT(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=e?new e({type:"optional",innerType:n[i]}):n[i])}else for(let i in n)o[i]=e?new e({type:"optional",innerType:n[i]}):n[i];return Ot(t,{...t._zod.def,shape:o,checks:[]})}function GT(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)o[i]=new e({type:"nonoptional",innerType:n[i]});return Ot(t,{...t._zod.def,shape:o,checks:[]})}function qn(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function lr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Ri(e){return typeof e=="string"?e:e?.message}function Jt(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Ri(e.inst?._zod.def?.error?.(e))??Ri(t?.error?.(e))??Ri(r.customError?.(e))??Ri(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Iy(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ji(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ju(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function KT(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var Zu=class{constructor(...t){}};var Ny=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Lu,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ua=x("$ZodError",Ny),Ii=x("$ZodError",Ny,{Parent:Error});function Gu(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ku(e,t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(e),n}var Xu=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new kr;if(s.issues.length){let a=new(o?.Err??e)(s.issues.map(c=>Jt(c,i,Et())));throw aa(a,o?.callee),a}return s.value},Yu=Xu(Ii),Qu=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??e)(s.issues.map(c=>Jt(c,i,Et())));throw aa(a,o?.callee),a}return s.value},el=Qu(Ii),tl=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kr;return i.issues.length?{success:!1,error:new(e??ua)(i.issues.map(s=>Jt(s,o,Et())))}:{success:!0,data:i.value}},Zn=tl(Ii),rl=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Jt(s,o,Et())))}:{success:!0,data:i.value}},Ln=rl(Ii);var My=/^[cC][^\s-]{8,}$/,Dy=/^[0-9a-z]+$/,Ay=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qy=/^[0-9a-vA-V]{20}$/,Zy=/^[A-Za-z0-9]{27}$/,Ly=/^[a-zA-Z0-9_-]{21}$/,Fy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Uy=/^([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})$/,nl=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var Vy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var YT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hy(){return new RegExp(YT,"u")}var By=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Wy=/^(([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})$/,Jy=/^((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])$/,Gy=/^(([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])$/,Ky=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ol=/^[A-Za-z0-9_-]*$/,Xy=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Yy=/^\+(?:[0-9]){6,14}[0-9]$/,Qy="(?:(?:\\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])))",e_=new RegExp(`^${Qy}$`);function t_(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function r_(e){return new RegExp(`^${t_(e)}$`)}function n_(e){let t=t_({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Qy}T(?:${n})$`)}var o_=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var i_=/^\d+$/,s_=/^-?\d+(?:\.\d+)?/i,a_=/true|false/i,c_=/null/i;var u_=/^[^A-Z]*$/,l_=/^[^a-z]*$/;var Ye=x("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),d_={number:"number",bigint:"bigint",object:"date"},il=x("$ZodCheckLessThan",(e,t)=>{Ye.init(e,t);let r=d_[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sl=x("$ZodCheckGreaterThan",(e,t)=>{Ye.init(e,t);let r=d_[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),f_=x("$ZodCheckMultipleOf",(e,t)=>{Ye.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Fu(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),p_=x("$ZodCheckNumberFormat",(e,t)=>{Ye.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Wu[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,r&&(a.pattern=i_)}),e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}});var m_=x("$ZodCheckMaxLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Oi(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let s=ji(o);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),h_=x("$ZodCheckMinLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Oi(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let s=ji(o);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),g_=x("$ZodCheckLengthEquals",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Oi(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let s=ji(o),a=i>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ni=x("$ZodCheckStringFormat",(e,t)=>{var r,n;Ye.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),y_=x("$ZodCheckRegex",(e,t)=>{Ni.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),__=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=u_),Ni.init(e,t)}),v_=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=l_),Ni.init(e,t)}),b_=x("$ZodCheckIncludes",(e,t)=>{Ye.init(e,t);let r=Hr(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),w_=x("$ZodCheckStartsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`^${Hr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),x_=x("$ZodCheckEndsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`.*${Hr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var $_=x("$ZodCheckOverwrite",(e,t)=>{Ye.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var da=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
20
|
+
`&&o++}n&&r.length>0&&t.push(r.length),this._lineOffsets=t}return this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let r=this.getLineOffsets(),n=0,o=r.length;if(o===0)return Ht.create(0,t);for(;n<o;){let s=Math.floor((n+o)/2);r[s]>t?o=s:n=s+1}let i=n-1;return Ht.create(i,t-r[i])}offsetAt(t){let r=this.getLineOffsets();if(t.line>=r.length)return this._content.length;if(t.line<0)return 0;let n=r[t.line],o=t.line+1<r.length?r[t.line+1]:this._content.length;return Math.max(Math.min(n+t.character,o),n)}get lineCount(){return this.getLineOffsets().length}};(function(e){let t=Object.prototype.toString;function r(m){return typeof m<"u"}e.defined=r;function n(m){return typeof m>"u"}e.undefined=n;function o(m){return m===!0||m===!1}e.boolean=o;function i(m){return t.call(m)==="[object String]"}e.string=i;function s(m){return t.call(m)==="[object Number]"}e.number=s;function a(m,p,y){return t.call(m)==="[object Number]"&&p<=m&&m<=y}e.numberRange=a;function c(m){return t.call(m)==="[object Number]"&&-2147483648<=m&&m<=2147483647}e.integer=c;function u(m){return t.call(m)==="[object Number]"&&0<=m&&m<=2147483647}e.uinteger=u;function l(m){return t.call(m)==="[object Function]"}e.func=l;function d(m){return m!==null&&typeof m=="object"}e.objectLiteral=d;function h(m,p){return Array.isArray(m)&&m.every(p)}e.typedArray=h})(_||(_={}))});var Re=k(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.CM=dt.ProtocolNotificationType=dt.ProtocolNotificationType0=dt.ProtocolRequestType=dt.ProtocolRequestType0=dt.RegistrationType=dt.MessageDirection=void 0;var ai=Or(),n0;(function(e){e.clientToServer="clientToServer",e.serverToClient="serverToClient",e.both="both"})(n0||(dt.MessageDirection=n0={}));var Ng=class{____;method;constructor(t){this.method=t}};dt.RegistrationType=Ng;var Ig=class extends ai.RequestType0{__;___;____;_pr;constructor(t){super(t)}};dt.ProtocolRequestType0=Ig;var Dg=class extends ai.RequestType{__;___;____;_pr;constructor(t){super(t,ai.ParameterStructures.byName)}};dt.ProtocolRequestType=Dg;var Ag=class extends ai.NotificationType0{___;____;constructor(t){super(t)}};dt.ProtocolNotificationType0=Ag;var qg=class extends ai.NotificationType{___;____;constructor(t){super(t,ai.ParameterStructures.byName)}};dt.ProtocolNotificationType=qg;var o0;(function(e){function t(r,n){return{client:r,server:n}}e.create=t})(o0||(dt.CM=o0={}))});var _u=k(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.boolean=aA;nr.string=i0;nr.number=cA;nr.error=uA;nr.func=lA;nr.array=s0;nr.stringArray=dA;nr.typedArray=fA;nr.objectLiteral=pA;function aA(e){return e===!0||e===!1}function i0(e){return typeof e=="string"||e instanceof String}function cA(e){return typeof e=="number"||e instanceof Number}function uA(e){return e instanceof Error}function lA(e){return typeof e=="function"}function s0(e){return Array.isArray(e)}function dA(e){return s0(e)&&e.every(t=>i0(t))}function fA(e,t){return Array.isArray(e)&&e.every(t)}function pA(e){return e!==null&&typeof e=="object"}});var c0=k(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});vu.ImplementationRequest=void 0;var Zg=Re(),a0;(function(e){e.method="textDocument/implementation",e.messageDirection=Zg.MessageDirection.clientToServer,e.type=new Zg.ProtocolRequestType(e.method),e.capabilities=Zg.CM.create("textDocument.implementation","implementationProvider")})(a0||(vu.ImplementationRequest=a0={}))});var l0=k(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});bu.TypeDefinitionRequest=void 0;var Lg=Re(),u0;(function(e){e.method="textDocument/typeDefinition",e.messageDirection=Lg.MessageDirection.clientToServer,e.type=new Lg.ProtocolRequestType(e.method),e.capabilities=Lg.CM.create("textDocument.typeDefinition","typeDefinitionProvider")})(u0||(bu.TypeDefinitionRequest=u0={}))});var p0=k(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.DidChangeWorkspaceFoldersNotification=ui.WorkspaceFoldersRequest=void 0;var ci=Re(),d0;(function(e){e.method="workspace/workspaceFolders",e.messageDirection=ci.MessageDirection.serverToClient,e.type=new ci.ProtocolRequestType0(e.method),e.capabilities=ci.CM.create("workspace.workspaceFolders","workspace.workspaceFolders")})(d0||(ui.WorkspaceFoldersRequest=d0={}));var f0;(function(e){e.method="workspace/didChangeWorkspaceFolders",e.messageDirection=ci.MessageDirection.clientToServer,e.type=new ci.ProtocolNotificationType(e.method),e.capabilities=ci.CM.create(void 0,"workspace.workspaceFolders.changeNotifications")})(f0||(ui.DidChangeWorkspaceFoldersNotification=f0={}))});var h0=k(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});wu.ConfigurationRequest=void 0;var Fg=Re(),m0;(function(e){e.method="workspace/configuration",e.messageDirection=Fg.MessageDirection.serverToClient,e.type=new Fg.ProtocolRequestType(e.method),e.capabilities=Fg.CM.create("workspace.configuration",void 0)})(m0||(wu.ConfigurationRequest=m0={}))});var _0=k(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.ColorPresentationRequest=di.DocumentColorRequest=void 0;var li=Re(),g0;(function(e){e.method="textDocument/documentColor",e.messageDirection=li.MessageDirection.clientToServer,e.type=new li.ProtocolRequestType(e.method),e.capabilities=li.CM.create("textDocument.colorProvider","colorProvider")})(g0||(di.DocumentColorRequest=g0={}));var y0;(function(e){e.method="textDocument/colorPresentation",e.messageDirection=li.MessageDirection.clientToServer,e.type=new li.ProtocolRequestType(e.method),e.capabilities=li.CM.create("textDocument.colorProvider","colorProvider")})(y0||(di.ColorPresentationRequest=y0={}))});var w0=k(pi=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});pi.FoldingRangeRefreshRequest=pi.FoldingRangeRequest=void 0;var fi=Re(),v0;(function(e){e.method="textDocument/foldingRange",e.messageDirection=fi.MessageDirection.clientToServer,e.type=new fi.ProtocolRequestType(e.method),e.capabilities=fi.CM.create("textDocument.foldingRange","foldingRangeProvider")})(v0||(pi.FoldingRangeRequest=v0={}));var b0;(function(e){e.method="workspace/foldingRange/refresh",e.messageDirection=fi.MessageDirection.serverToClient,e.type=new fi.ProtocolRequestType0(e.method),e.capabilities=fi.CM.create("workspace.foldingRange.refreshSupport",void 0)})(b0||(pi.FoldingRangeRefreshRequest=b0={}))});var $0=k(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});xu.DeclarationRequest=void 0;var Ug=Re(),x0;(function(e){e.method="textDocument/declaration",e.messageDirection=Ug.MessageDirection.clientToServer,e.type=new Ug.ProtocolRequestType(e.method),e.capabilities=Ug.CM.create("textDocument.declaration","declarationProvider")})(x0||(xu.DeclarationRequest=x0={}))});var k0=k($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});$u.SelectionRangeRequest=void 0;var Vg=Re(),S0;(function(e){e.method="textDocument/selectionRange",e.messageDirection=Vg.MessageDirection.clientToServer,e.type=new Vg.ProtocolRequestType(e.method),e.capabilities=Vg.CM.create("textDocument.selectionRange","selectionRangeProvider")})(S0||($u.SelectionRangeRequest=S0={}))});var R0=k(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.WorkDoneProgressCancelNotification=mn.WorkDoneProgressCreateRequest=mn.WorkDoneProgress=void 0;var mA=Or(),Hs=Re(),P0;(function(e){e.type=new mA.ProgressType;function t(r){return r===e.type}e.is=t})(P0||(mn.WorkDoneProgress=P0={}));var T0;(function(e){e.method="window/workDoneProgress/create",e.messageDirection=Hs.MessageDirection.serverToClient,e.type=new Hs.ProtocolRequestType(e.method),e.capabilities=Hs.CM.create("window.workDoneProgress",void 0)})(T0||(mn.WorkDoneProgressCreateRequest=T0={}));var z0;(function(e){e.method="window/workDoneProgress/cancel",e.messageDirection=Hs.MessageDirection.clientToServer,e.type=new Hs.ProtocolNotificationType(e.method)})(z0||(mn.WorkDoneProgressCancelNotification=z0={}))});var j0=k(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.CallHierarchyOutgoingCallsRequest=hn.CallHierarchyIncomingCallsRequest=hn.CallHierarchyPrepareRequest=void 0;var Mr=Re(),E0;(function(e){e.method="textDocument/prepareCallHierarchy",e.messageDirection=Mr.MessageDirection.clientToServer,e.type=new Mr.ProtocolRequestType(e.method),e.capabilities=Mr.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(E0||(hn.CallHierarchyPrepareRequest=E0={}));var O0;(function(e){e.method="callHierarchy/incomingCalls",e.messageDirection=Mr.MessageDirection.clientToServer,e.type=new Mr.ProtocolRequestType(e.method),e.capabilities=Mr.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(O0||(hn.CallHierarchyIncomingCallsRequest=O0={}));var C0;(function(e){e.method="callHierarchy/outgoingCalls",e.messageDirection=Mr.MessageDirection.clientToServer,e.type=new Mr.ProtocolRequestType(e.method),e.capabilities=Mr.CM.create("textDocument.callHierarchy","callHierarchyProvider")})(C0||(hn.CallHierarchyOutgoingCallsRequest=C0={}))});var q0=k(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.SemanticTokensRefreshRequest=zt.SemanticTokensRangeRequest=zt.SemanticTokensDeltaRequest=zt.SemanticTokensRequest=zt.SemanticTokensRegistrationType=zt.TokenFormat=void 0;var Nt=Re(),M0;(function(e){e.Relative="relative"})(M0||(zt.TokenFormat=M0={}));var Bs;(function(e){e.method="textDocument/semanticTokens",e.type=new Nt.RegistrationType(e.method)})(Bs||(zt.SemanticTokensRegistrationType=Bs={}));var N0;(function(e){e.method="textDocument/semanticTokens/full",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method),e.registrationMethod=Bs.method,e.capabilities=Nt.CM.create("textDocument.semanticTokens","semanticTokensProvider")})(N0||(zt.SemanticTokensRequest=N0={}));var I0;(function(e){e.method="textDocument/semanticTokens/full/delta",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method),e.registrationMethod=Bs.method,e.capabilities=Nt.CM.create("textDocument.semanticTokens.requests.full.delta","semanticTokensProvider.full.delta")})(I0||(zt.SemanticTokensDeltaRequest=I0={}));var D0;(function(e){e.method="textDocument/semanticTokens/range",e.messageDirection=Nt.MessageDirection.clientToServer,e.type=new Nt.ProtocolRequestType(e.method),e.registrationMethod=Bs.method,e.capabilities=Nt.CM.create("textDocument.semanticTokens.requests.range","semanticTokensProvider.range")})(D0||(zt.SemanticTokensRangeRequest=D0={}));var A0;(function(e){e.method="workspace/semanticTokens/refresh",e.messageDirection=Nt.MessageDirection.serverToClient,e.type=new Nt.ProtocolRequestType0(e.method),e.capabilities=Nt.CM.create("workspace.semanticTokens.refreshSupport",void 0)})(A0||(zt.SemanticTokensRefreshRequest=A0={}))});var L0=k(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});Su.ShowDocumentRequest=void 0;var Hg=Re(),Z0;(function(e){e.method="window/showDocument",e.messageDirection=Hg.MessageDirection.serverToClient,e.type=new Hg.ProtocolRequestType(e.method),e.capabilities=Hg.CM.create("window.showDocument.support",void 0)})(Z0||(Su.ShowDocumentRequest=Z0={}))});var U0=k(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});ku.LinkedEditingRangeRequest=void 0;var Bg=Re(),F0;(function(e){e.method="textDocument/linkedEditingRange",e.messageDirection=Bg.MessageDirection.clientToServer,e.type=new Bg.ProtocolRequestType(e.method),e.capabilities=Bg.CM.create("textDocument.linkedEditingRange","linkedEditingRangeProvider")})(F0||(ku.LinkedEditingRangeRequest=F0={}))});var X0=k(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.WillDeleteFilesRequest=ft.DidDeleteFilesNotification=ft.DidRenameFilesNotification=ft.WillRenameFilesRequest=ft.DidCreateFilesNotification=ft.WillCreateFilesRequest=ft.FileOperationPatternKind=void 0;var Je=Re(),V0;(function(e){e.file="file",e.folder="folder"})(V0||(ft.FileOperationPatternKind=V0={}));var H0;(function(e){e.method="workspace/willCreateFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolRequestType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.willCreate","workspace.fileOperations.willCreate")})(H0||(ft.WillCreateFilesRequest=H0={}));var B0;(function(e){e.method="workspace/didCreateFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolNotificationType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.didCreate","workspace.fileOperations.didCreate")})(B0||(ft.DidCreateFilesNotification=B0={}));var W0;(function(e){e.method="workspace/willRenameFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolRequestType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.willRename","workspace.fileOperations.willRename")})(W0||(ft.WillRenameFilesRequest=W0={}));var J0;(function(e){e.method="workspace/didRenameFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolNotificationType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.didRename","workspace.fileOperations.didRename")})(J0||(ft.DidRenameFilesNotification=J0={}));var G0;(function(e){e.method="workspace/didDeleteFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolNotificationType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.didDelete","workspace.fileOperations.didDelete")})(G0||(ft.DidDeleteFilesNotification=G0={}));var K0;(function(e){e.method="workspace/willDeleteFiles",e.messageDirection=Je.MessageDirection.clientToServer,e.type=new Je.ProtocolRequestType(e.method),e.capabilities=Je.CM.create("workspace.fileOperations.willDelete","workspace.fileOperations.willDelete")})(K0||(ft.WillDeleteFilesRequest=K0={}))});var tS=k(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.MonikerRequest=gn.MonikerKind=gn.UniquenessLevel=void 0;var Wg=Re(),Y0;(function(e){e.document="document",e.project="project",e.group="group",e.scheme="scheme",e.global="global"})(Y0||(gn.UniquenessLevel=Y0={}));var Q0;(function(e){e.$import="import",e.$export="export",e.local="local"})(Q0||(gn.MonikerKind=Q0={}));var eS;(function(e){e.method="textDocument/moniker",e.messageDirection=Wg.MessageDirection.clientToServer,e.type=new Wg.ProtocolRequestType(e.method),e.capabilities=Wg.CM.create("textDocument.moniker","monikerProvider")})(eS||(gn.MonikerRequest=eS={}))});var iS=k(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.TypeHierarchySubtypesRequest=yn.TypeHierarchySupertypesRequest=yn.TypeHierarchyPrepareRequest=void 0;var co=Re(),rS;(function(e){e.method="textDocument/prepareTypeHierarchy",e.messageDirection=co.MessageDirection.clientToServer,e.type=new co.ProtocolRequestType(e.method),e.capabilities=co.CM.create("textDocument.typeHierarchy","typeHierarchyProvider")})(rS||(yn.TypeHierarchyPrepareRequest=rS={}));var nS;(function(e){e.method="typeHierarchy/supertypes",e.messageDirection=co.MessageDirection.clientToServer,e.type=new co.ProtocolRequestType(e.method)})(nS||(yn.TypeHierarchySupertypesRequest=nS={}));var oS;(function(e){e.method="typeHierarchy/subtypes",e.messageDirection=co.MessageDirection.clientToServer,e.type=new co.ProtocolRequestType(e.method)})(oS||(yn.TypeHierarchySubtypesRequest=oS={}))});var cS=k(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.InlineValueRefreshRequest=hi.InlineValueRequest=void 0;var mi=Re(),sS;(function(e){e.method="textDocument/inlineValue",e.messageDirection=mi.MessageDirection.clientToServer,e.type=new mi.ProtocolRequestType(e.method),e.capabilities=mi.CM.create("textDocument.inlineValue","inlineValueProvider")})(sS||(hi.InlineValueRequest=sS={}));var aS;(function(e){e.method="workspace/inlineValue/refresh",e.messageDirection=mi.MessageDirection.serverToClient,e.type=new mi.ProtocolRequestType0(e.method),e.capabilities=mi.CM.create("workspace.inlineValue.refreshSupport",void 0)})(aS||(hi.InlineValueRefreshRequest=aS={}))});var fS=k(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.InlayHintRefreshRequest=_n.InlayHintResolveRequest=_n.InlayHintRequest=void 0;var Nr=Re(),uS;(function(e){e.method="textDocument/inlayHint",e.messageDirection=Nr.MessageDirection.clientToServer,e.type=new Nr.ProtocolRequestType(e.method),e.capabilities=Nr.CM.create("textDocument.inlayHint","inlayHintProvider")})(uS||(_n.InlayHintRequest=uS={}));var lS;(function(e){e.method="inlayHint/resolve",e.messageDirection=Nr.MessageDirection.clientToServer,e.type=new Nr.ProtocolRequestType(e.method),e.capabilities=Nr.CM.create("textDocument.inlayHint.resolveSupport","inlayHintProvider.resolveProvider")})(lS||(_n.InlayHintResolveRequest=lS={}));var dS;(function(e){e.method="workspace/inlayHint/refresh",e.messageDirection=Nr.MessageDirection.serverToClient,e.type=new Nr.ProtocolRequestType0(e.method),e.capabilities=Nr.CM.create("workspace.inlayHint.refreshSupport",void 0)})(dS||(_n.InlayHintRefreshRequest=dS={}))});var vS=k(Ge=>{"use strict";var hA=Ge&&Ge.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),gA=Ge&&Ge.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),yA=Ge&&Ge.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&hA(r,t,n[o]);return gA(r,t),r}})();Object.defineProperty(Ge,"__esModule",{value:!0});Ge.DiagnosticRefreshRequest=Ge.WorkspaceDiagnosticRequest=Ge.DocumentDiagnosticRequest=Ge.DocumentDiagnosticReportKind=Ge.DiagnosticServerCancellationData=void 0;var _S=Or(),_A=yA(_u()),Ir=Re(),pS;(function(e){function t(r){let n=r;return n&&_A.boolean(n.retriggerRequest)}e.is=t})(pS||(Ge.DiagnosticServerCancellationData=pS={}));var mS;(function(e){e.Full="full",e.Unchanged="unchanged"})(mS||(Ge.DocumentDiagnosticReportKind=mS={}));var hS;(function(e){e.method="textDocument/diagnostic",e.messageDirection=Ir.MessageDirection.clientToServer,e.type=new Ir.ProtocolRequestType(e.method),e.partialResult=new _S.ProgressType,e.capabilities=Ir.CM.create("textDocument.diagnostic","diagnosticProvider")})(hS||(Ge.DocumentDiagnosticRequest=hS={}));var gS;(function(e){e.method="workspace/diagnostic",e.messageDirection=Ir.MessageDirection.clientToServer,e.type=new Ir.ProtocolRequestType(e.method),e.partialResult=new _S.ProgressType,e.capabilities=Ir.CM.create("workspace.diagnostics","diagnosticProvider.workspaceDiagnostics")})(gS||(Ge.WorkspaceDiagnosticRequest=gS={}));var yS;(function(e){e.method="workspace/diagnostic/refresh",e.messageDirection=Ir.MessageDirection.serverToClient,e.type=new Ir.ProtocolRequestType0(e.method),e.capabilities=Ir.CM.create("workspace.diagnostics.refreshSupport",void 0)})(yS||(Ge.DiagnosticRefreshRequest=yS={}))});var PS=k(_e=>{"use strict";var vA=_e&&_e.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),bA=_e&&_e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),wA=_e&&_e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&vA(r,t,n[o]);return bA(r,t),r}})();Object.defineProperty(_e,"__esModule",{value:!0});_e.DidCloseNotebookDocumentNotification=_e.DidSaveNotebookDocumentNotification=_e.DidChangeNotebookDocumentNotification=_e.NotebookCellArrayChange=_e.DidOpenNotebookDocumentNotification=_e.NotebookDocumentSyncRegistrationType=_e.NotebookDocument=_e.NotebookCell=_e.ExecutionSummary=_e.NotebookCellKind=void 0;var Ws=(yu(),Mu(gu)),or=wA(_u()),yr=Re(),Jg;(function(e){e.Markup=1,e.Code=2;function t(r){return r===1||r===2}e.is=t})(Jg||(_e.NotebookCellKind=Jg={}));var Gg;(function(e){function t(o,i){let s={executionOrder:o};return(i===!0||i===!1)&&(s.success=i),s}e.create=t;function r(o){let i=o;return or.objectLiteral(i)&&Ws.uinteger.is(i.executionOrder)&&(i.success===void 0||or.boolean(i.success))}e.is=r;function n(o,i){return o===i?!0:o==null||i===null||i===void 0?!1:o.executionOrder===i.executionOrder&&o.success===i.success}e.equals=n})(Gg||(_e.ExecutionSummary=Gg={}));var Pu;(function(e){function t(i,s){return{kind:i,document:s}}e.create=t;function r(i){let s=i;return or.objectLiteral(s)&&Jg.is(s.kind)&&Ws.DocumentUri.is(s.document)&&(s.metadata===void 0||or.objectLiteral(s.metadata))}e.is=r;function n(i,s){let a=new Set;return i.document!==s.document&&a.add("document"),i.kind!==s.kind&&a.add("kind"),i.executionSummary!==s.executionSummary&&a.add("executionSummary"),(i.metadata!==void 0||s.metadata!==void 0)&&!o(i.metadata,s.metadata)&&a.add("metadata"),(i.executionSummary!==void 0||s.executionSummary!==void 0)&&!Gg.equals(i.executionSummary,s.executionSummary)&&a.add("executionSummary"),a}e.diff=n;function o(i,s){if(i===s)return!0;if(i==null||s===null||s===void 0||typeof i!=typeof s||typeof i!="object")return!1;let a=Array.isArray(i),c=Array.isArray(s);if(a!==c)return!1;if(a&&c){if(i.length!==s.length)return!1;for(let u=0;u<i.length;u++)if(!o(i[u],s[u]))return!1}if(or.objectLiteral(i)&&or.objectLiteral(s)){let u=Object.keys(i),l=Object.keys(s);if(u.length!==l.length||(u.sort(),l.sort(),!o(u,l)))return!1;for(let d=0;d<u.length;d++){let h=u[d];if(!o(i[h],s[h]))return!1}}return!0}})(Pu||(_e.NotebookCell=Pu={}));var bS;(function(e){function t(n,o,i,s){return{uri:n,notebookType:o,version:i,cells:s}}e.create=t;function r(n){let o=n;return or.objectLiteral(o)&&or.string(o.uri)&&Ws.integer.is(o.version)&&or.typedArray(o.cells,Pu.is)}e.is=r})(bS||(_e.NotebookDocument=bS={}));var gi;(function(e){e.method="notebookDocument/sync",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.RegistrationType(e.method)})(gi||(_e.NotebookDocumentSyncRegistrationType=gi={}));var wS;(function(e){e.method="notebookDocument/didOpen",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})(wS||(_e.DidOpenNotebookDocumentNotification=wS={}));var xS;(function(e){function t(n){let o=n;return or.objectLiteral(o)&&Ws.uinteger.is(o.start)&&Ws.uinteger.is(o.deleteCount)&&(o.cells===void 0||or.typedArray(o.cells,Pu.is))}e.is=t;function r(n,o,i){let s={start:n,deleteCount:o};return i!==void 0&&(s.cells=i),s}e.create=r})(xS||(_e.NotebookCellArrayChange=xS={}));var $S;(function(e){e.method="notebookDocument/didChange",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})($S||(_e.DidChangeNotebookDocumentNotification=$S={}));var SS;(function(e){e.method="notebookDocument/didSave",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})(SS||(_e.DidSaveNotebookDocumentNotification=SS={}));var kS;(function(e){e.method="notebookDocument/didClose",e.messageDirection=yr.MessageDirection.clientToServer,e.type=new yr.ProtocolNotificationType(e.method),e.registrationMethod=gi.method})(kS||(_e.DidCloseNotebookDocumentNotification=kS={}))});var zS=k(Tu=>{"use strict";Object.defineProperty(Tu,"__esModule",{value:!0});Tu.InlineCompletionRequest=void 0;var Kg=Re(),TS;(function(e){e.method="textDocument/inlineCompletion",e.messageDirection=Kg.MessageDirection.clientToServer,e.type=new Kg.ProtocolRequestType(e.method),e.capabilities=Kg.CM.create("textDocument.inlineCompletion","inlineCompletionProvider")})(TS||(Tu.InlineCompletionRequest=TS={}))});var OS=k(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.TextDocumentContentRefreshRequest=yi.TextDocumentContentRequest=void 0;var Js=Re(),RS;(function(e){e.method="workspace/textDocumentContent",e.messageDirection=Js.MessageDirection.clientToServer,e.type=new Js.ProtocolRequestType(e.method),e.capabilities=Js.CM.create("workspace.textDocumentContent","workspace.textDocumentContent")})(RS||(yi.TextDocumentContentRequest=RS={}));var ES;(function(e){e.method="workspace/textDocumentContent/refresh",e.messageDirection=Js.MessageDirection.serverToClient,e.type=new Js.ProtocolRequestType(e.method)})(ES||(yi.TextDocumentContentRefreshRequest=ES={}))});var Hk=k(f=>{"use strict";var xA=f&&f.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),$A=f&&f.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),SA=f&&f.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(r){var n=[];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(n[n.length]=o);return n},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(t!=null)for(var n=e(t),o=0;o<n.length;o++)n[o]!=="default"&&xA(r,t,n[o]);return $A(r,t),r}})();Object.defineProperty(f,"__esModule",{value:!0});f.CodeActionRequest=f.DocumentSymbolRequest=f.DocumentHighlightRequest=f.ReferencesRequest=f.DefinitionRequest=f.SignatureHelpRequest=f.SignatureHelpTriggerKind=f.HoverRequest=f.CompletionResolveRequest=f.CompletionRequest=f.CompletionTriggerKind=f.PublishDiagnosticsNotification=f.WatchKind=f.GlobPattern=f.RelativePattern=f.FileChangeType=f.DidChangeWatchedFilesNotification=f.WillSaveTextDocumentWaitUntilRequest=f.WillSaveTextDocumentNotification=f.TextDocumentSaveReason=f.DidSaveTextDocumentNotification=f.DidCloseTextDocumentNotification=f.DidChangeTextDocumentNotification=f.TextDocumentContentChangeEvent=f.DidOpenTextDocumentNotification=f.TextDocumentSyncKind=f.TelemetryEventNotification=f.LogMessageNotification=f.ShowMessageRequest=f.ShowMessageNotification=f.MessageType=f.DidChangeConfigurationNotification=f.ExitNotification=f.ShutdownRequest=f.InitializedNotification=f.InitializeErrorCodes=f.InitializeRequest=f.WorkDoneProgressOptions=f.TextDocumentRegistrationOptions=f.StaticRegistrationOptions=f.PositionEncodingKind=f.RegularExpressionEngineKind=f.FailureHandlingKind=f.ResourceOperationKind=f.UnregistrationRequest=f.RegistrationRequest=f.DocumentSelector=f.NotebookCellTextDocumentFilter=f.NotebookDocumentFilter=f.TextDocumentFilter=void 0;f.UniquenessLevel=f.WillDeleteFilesRequest=f.DidDeleteFilesNotification=f.WillRenameFilesRequest=f.DidRenameFilesNotification=f.WillCreateFilesRequest=f.DidCreateFilesNotification=f.FileOperationPatternKind=f.LinkedEditingRangeRequest=f.ShowDocumentRequest=f.SemanticTokensRegistrationType=f.SemanticTokensRefreshRequest=f.SemanticTokensRangeRequest=f.SemanticTokensDeltaRequest=f.SemanticTokensRequest=f.TokenFormat=f.CallHierarchyPrepareRequest=f.CallHierarchyOutgoingCallsRequest=f.CallHierarchyIncomingCallsRequest=f.WorkDoneProgressCancelNotification=f.WorkDoneProgressCreateRequest=f.WorkDoneProgress=f.SelectionRangeRequest=f.DeclarationRequest=f.FoldingRangeRefreshRequest=f.FoldingRangeRequest=f.ColorPresentationRequest=f.DocumentColorRequest=f.ConfigurationRequest=f.DidChangeWorkspaceFoldersNotification=f.WorkspaceFoldersRequest=f.TypeDefinitionRequest=f.ImplementationRequest=f.ApplyWorkspaceEditRequest=f.ExecuteCommandRequest=f.PrepareRenameRequest=f.RenameRequest=f.PrepareSupportDefaultBehavior=f.DocumentOnTypeFormattingRequest=f.DocumentRangesFormattingRequest=f.DocumentRangeFormattingRequest=f.DocumentFormattingRequest=f.DocumentLinkResolveRequest=f.DocumentLinkRequest=f.CodeLensRefreshRequest=f.CodeLensResolveRequest=f.CodeLensRequest=f.WorkspaceSymbolResolveRequest=f.WorkspaceSymbolRequest=f.CodeActionResolveRequest=void 0;f.TextDocumentContentRefreshRequest=f.TextDocumentContentRequest=f.InlineCompletionRequest=f.DidCloseNotebookDocumentNotification=f.DidSaveNotebookDocumentNotification=f.DidChangeNotebookDocumentNotification=f.NotebookCellArrayChange=f.DidOpenNotebookDocumentNotification=f.NotebookDocumentSyncRegistrationType=f.NotebookDocument=f.NotebookCell=f.ExecutionSummary=f.NotebookCellKind=f.DiagnosticRefreshRequest=f.WorkspaceDiagnosticRequest=f.DocumentDiagnosticRequest=f.DocumentDiagnosticReportKind=f.DiagnosticServerCancellationData=f.InlayHintRefreshRequest=f.InlayHintResolveRequest=f.InlayHintRequest=f.InlineValueRefreshRequest=f.InlineValueRequest=f.TypeHierarchySupertypesRequest=f.TypeHierarchySubtypesRequest=f.TypeHierarchyPrepareRequest=f.MonikerRequest=f.MonikerKind=void 0;var $=Re(),CS=(yu(),Mu(gu)),Ke=SA(_u()),kA=c0();Object.defineProperty(f,"ImplementationRequest",{enumerable:!0,get:function(){return kA.ImplementationRequest}});var PA=l0();Object.defineProperty(f,"TypeDefinitionRequest",{enumerable:!0,get:function(){return PA.TypeDefinitionRequest}});var Zk=p0();Object.defineProperty(f,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return Zk.WorkspaceFoldersRequest}});Object.defineProperty(f,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return Zk.DidChangeWorkspaceFoldersNotification}});var TA=h0();Object.defineProperty(f,"ConfigurationRequest",{enumerable:!0,get:function(){return TA.ConfigurationRequest}});var Lk=_0();Object.defineProperty(f,"DocumentColorRequest",{enumerable:!0,get:function(){return Lk.DocumentColorRequest}});Object.defineProperty(f,"ColorPresentationRequest",{enumerable:!0,get:function(){return Lk.ColorPresentationRequest}});var Fk=w0();Object.defineProperty(f,"FoldingRangeRequest",{enumerable:!0,get:function(){return Fk.FoldingRangeRequest}});Object.defineProperty(f,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return Fk.FoldingRangeRefreshRequest}});var zA=$0();Object.defineProperty(f,"DeclarationRequest",{enumerable:!0,get:function(){return zA.DeclarationRequest}});var RA=k0();Object.defineProperty(f,"SelectionRangeRequest",{enumerable:!0,get:function(){return RA.SelectionRangeRequest}});var ny=R0();Object.defineProperty(f,"WorkDoneProgress",{enumerable:!0,get:function(){return ny.WorkDoneProgress}});Object.defineProperty(f,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return ny.WorkDoneProgressCreateRequest}});Object.defineProperty(f,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return ny.WorkDoneProgressCancelNotification}});var oy=j0();Object.defineProperty(f,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(f,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return oy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(f,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return oy.CallHierarchyPrepareRequest}});var _i=q0();Object.defineProperty(f,"TokenFormat",{enumerable:!0,get:function(){return _i.TokenFormat}});Object.defineProperty(f,"SemanticTokensRequest",{enumerable:!0,get:function(){return _i.SemanticTokensRequest}});Object.defineProperty(f,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return _i.SemanticTokensDeltaRequest}});Object.defineProperty(f,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return _i.SemanticTokensRangeRequest}});Object.defineProperty(f,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return _i.SemanticTokensRefreshRequest}});Object.defineProperty(f,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return _i.SemanticTokensRegistrationType}});var EA=L0();Object.defineProperty(f,"ShowDocumentRequest",{enumerable:!0,get:function(){return EA.ShowDocumentRequest}});var OA=U0();Object.defineProperty(f,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return OA.LinkedEditingRangeRequest}});var uo=X0();Object.defineProperty(f,"FileOperationPatternKind",{enumerable:!0,get:function(){return uo.FileOperationPatternKind}});Object.defineProperty(f,"DidCreateFilesNotification",{enumerable:!0,get:function(){return uo.DidCreateFilesNotification}});Object.defineProperty(f,"WillCreateFilesRequest",{enumerable:!0,get:function(){return uo.WillCreateFilesRequest}});Object.defineProperty(f,"DidRenameFilesNotification",{enumerable:!0,get:function(){return uo.DidRenameFilesNotification}});Object.defineProperty(f,"WillRenameFilesRequest",{enumerable:!0,get:function(){return uo.WillRenameFilesRequest}});Object.defineProperty(f,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return uo.DidDeleteFilesNotification}});Object.defineProperty(f,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return uo.WillDeleteFilesRequest}});var iy=tS();Object.defineProperty(f,"UniquenessLevel",{enumerable:!0,get:function(){return iy.UniquenessLevel}});Object.defineProperty(f,"MonikerKind",{enumerable:!0,get:function(){return iy.MonikerKind}});Object.defineProperty(f,"MonikerRequest",{enumerable:!0,get:function(){return iy.MonikerRequest}});var sy=iS();Object.defineProperty(f,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return sy.TypeHierarchyPrepareRequest}});Object.defineProperty(f,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return sy.TypeHierarchySubtypesRequest}});Object.defineProperty(f,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return sy.TypeHierarchySupertypesRequest}});var Uk=cS();Object.defineProperty(f,"InlineValueRequest",{enumerable:!0,get:function(){return Uk.InlineValueRequest}});Object.defineProperty(f,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return Uk.InlineValueRefreshRequest}});var ay=fS();Object.defineProperty(f,"InlayHintRequest",{enumerable:!0,get:function(){return ay.InlayHintRequest}});Object.defineProperty(f,"InlayHintResolveRequest",{enumerable:!0,get:function(){return ay.InlayHintResolveRequest}});Object.defineProperty(f,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return ay.InlayHintRefreshRequest}});var Gs=vS();Object.defineProperty(f,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return Gs.DiagnosticServerCancellationData}});Object.defineProperty(f,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return Gs.DocumentDiagnosticReportKind}});Object.defineProperty(f,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return Gs.DocumentDiagnosticRequest}});Object.defineProperty(f,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return Gs.WorkspaceDiagnosticRequest}});Object.defineProperty(f,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return Gs.DiagnosticRefreshRequest}});var _r=PS();Object.defineProperty(f,"NotebookCellKind",{enumerable:!0,get:function(){return _r.NotebookCellKind}});Object.defineProperty(f,"ExecutionSummary",{enumerable:!0,get:function(){return _r.ExecutionSummary}});Object.defineProperty(f,"NotebookCell",{enumerable:!0,get:function(){return _r.NotebookCell}});Object.defineProperty(f,"NotebookDocument",{enumerable:!0,get:function(){return _r.NotebookDocument}});Object.defineProperty(f,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return _r.NotebookDocumentSyncRegistrationType}});Object.defineProperty(f,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidOpenNotebookDocumentNotification}});Object.defineProperty(f,"NotebookCellArrayChange",{enumerable:!0,get:function(){return _r.NotebookCellArrayChange}});Object.defineProperty(f,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidChangeNotebookDocumentNotification}});Object.defineProperty(f,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidSaveNotebookDocumentNotification}});Object.defineProperty(f,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return _r.DidCloseNotebookDocumentNotification}});var CA=zS();Object.defineProperty(f,"InlineCompletionRequest",{enumerable:!0,get:function(){return CA.InlineCompletionRequest}});var Vk=OS();Object.defineProperty(f,"TextDocumentContentRequest",{enumerable:!0,get:function(){return Vk.TextDocumentContentRequest}});Object.defineProperty(f,"TextDocumentContentRefreshRequest",{enumerable:!0,get:function(){return Vk.TextDocumentContentRefreshRequest}});var Xg;(function(e){function t(r){let n=r;return Ke.string(n)||Ke.string(n.language)||Ke.string(n.scheme)||ry.is(n.pattern)}e.is=t})(Xg||(f.TextDocumentFilter=Xg={}));var Yg;(function(e){function t(r){let n=r;return Ke.objectLiteral(n)&&(Ke.string(n.notebookType)||Ke.string(n.scheme)||Ke.string(n.pattern))}e.is=t})(Yg||(f.NotebookDocumentFilter=Yg={}));var Qg;(function(e){function t(r){let n=r;return Ke.objectLiteral(n)&&(Ke.string(n.notebook)||Yg.is(n.notebook))&&(n.language===void 0||Ke.string(n.language))}e.is=t})(Qg||(f.NotebookCellTextDocumentFilter=Qg={}));var ey;(function(e){function t(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Ke.string(n)&&!Xg.is(n)&&!Qg.is(n))return!1;return!0}e.is=t})(ey||(f.DocumentSelector=ey={}));var jS;(function(e){e.method="client/registerCapability",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType(e.method)})(jS||(f.RegistrationRequest=jS={}));var MS;(function(e){e.method="client/unregisterCapability",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType(e.method)})(MS||(f.UnregistrationRequest=MS={}));var NS;(function(e){e.Create="create",e.Rename="rename",e.Delete="delete"})(NS||(f.ResourceOperationKind=NS={}));var IS;(function(e){e.Abort="abort",e.Transactional="transactional",e.TextOnlyTransactional="textOnlyTransactional",e.Undo="undo"})(IS||(f.FailureHandlingKind=IS={}));var DS;(function(e){e.ES2020="ES2020"})(DS||(f.RegularExpressionEngineKind=DS={}));var AS;(function(e){e.UTF8="utf-8",e.UTF16="utf-16",e.UTF32="utf-32"})(AS||(f.PositionEncodingKind=AS={}));var qS;(function(e){function t(r){let n=r;return n&&Ke.string(n.id)&&n.id.length>0}e.hasId=t})(qS||(f.StaticRegistrationOptions=qS={}));var ZS;(function(e){function t(r){let n=r;return n&&(n.documentSelector===null||ey.is(n.documentSelector))}e.is=t})(ZS||(f.TextDocumentRegistrationOptions=ZS={}));var LS;(function(e){function t(n){let o=n;return Ke.objectLiteral(o)&&(o.workDoneProgress===void 0||Ke.boolean(o.workDoneProgress))}e.is=t;function r(n){let o=n;return o&&Ke.boolean(o.workDoneProgress)}e.hasWorkDoneProgress=r})(LS||(f.WorkDoneProgressOptions=LS={}));var FS;(function(e){e.method="initialize",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method)})(FS||(f.InitializeRequest=FS={}));var US;(function(e){e.unknownProtocolVersion=1})(US||(f.InitializeErrorCodes=US={}));var VS;(function(e){e.method="initialized",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method)})(VS||(f.InitializedNotification=VS={}));var HS;(function(e){e.method="shutdown",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType0(e.method)})(HS||(f.ShutdownRequest=HS={}));var BS;(function(e){e.method="exit",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType0(e.method)})(BS||(f.ExitNotification=BS={}));var WS;(function(e){e.method="workspace/didChangeConfiguration",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("workspace.didChangeConfiguration",void 0)})(WS||(f.DidChangeConfigurationNotification=WS={}));var JS;(function(e){e.Error=1,e.Warning=2,e.Info=3,e.Log=4,e.Debug=5})(JS||(f.MessageType=JS={}));var GS;(function(e){e.method="window/showMessage",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("window.showMessage",void 0)})(GS||(f.ShowMessageNotification=GS={}));var KS;(function(e){e.method="window/showMessageRequest",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("window.showMessage",void 0)})(KS||(f.ShowMessageRequest=KS={}));var XS;(function(e){e.method="window/logMessage",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method)})(XS||(f.LogMessageNotification=XS={}));var YS;(function(e){e.method="telemetry/event",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method)})(YS||(f.TelemetryEventNotification=YS={}));var QS;(function(e){e.None=0,e.Full=1,e.Incremental=2})(QS||(f.TextDocumentSyncKind=QS={}));var ek;(function(e){e.method="textDocument/didOpen",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(ek||(f.DidOpenTextDocumentNotification=ek={}));var tk;(function(e){function t(n){let o=n;return o!=null&&typeof o.text=="string"&&o.range!==void 0&&(o.rangeLength===void 0||typeof o.rangeLength=="number")}e.isIncremental=t;function r(n){let o=n;return o!=null&&typeof o.text=="string"&&o.range===void 0&&o.rangeLength===void 0}e.isFull=r})(tk||(f.TextDocumentContentChangeEvent=tk={}));var rk;(function(e){e.method="textDocument/didChange",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization","textDocumentSync")})(rk||(f.DidChangeTextDocumentNotification=rk={}));var nk;(function(e){e.method="textDocument/didClose",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization","textDocumentSync.openClose")})(nk||(f.DidCloseTextDocumentNotification=nk={}));var ok;(function(e){e.method="textDocument/didSave",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization.didSave","textDocumentSync.save")})(ok||(f.DidSaveTextDocumentNotification=ok={}));var ik;(function(e){e.Manual=1,e.AfterDelay=2,e.FocusOut=3})(ik||(f.TextDocumentSaveReason=ik={}));var sk;(function(e){e.method="textDocument/willSave",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.synchronization.willSave","textDocumentSync.willSave")})(sk||(f.WillSaveTextDocumentNotification=sk={}));var ak;(function(e){e.method="textDocument/willSaveWaitUntil",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.synchronization.willSaveWaitUntil","textDocumentSync.willSaveWaitUntil")})(ak||(f.WillSaveTextDocumentWaitUntilRequest=ak={}));var ck;(function(e){e.method="workspace/didChangeWatchedFiles",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("workspace.didChangeWatchedFiles",void 0)})(ck||(f.DidChangeWatchedFilesNotification=ck={}));var uk;(function(e){e.Created=1,e.Changed=2,e.Deleted=3})(uk||(f.FileChangeType=uk={}));var ty;(function(e){function t(r){let n=r;return Ke.objectLiteral(n)&&(CS.URI.is(n.baseUri)||CS.WorkspaceFolder.is(n.baseUri))&&Ke.string(n.pattern)}e.is=t})(ty||(f.RelativePattern=ty={}));var ry;(function(e){function t(r){let n=r;return Ke.string(n)||ty.is(n)}e.is=t})(ry||(f.GlobPattern=ry={}));var lk;(function(e){e.Create=1,e.Change=2,e.Delete=4})(lk||(f.WatchKind=lk={}));var dk;(function(e){e.method="textDocument/publishDiagnostics",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolNotificationType(e.method),e.capabilities=$.CM.create("textDocument.publishDiagnostics",void 0)})(dk||(f.PublishDiagnosticsNotification=dk={}));var fk;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.TriggerForIncompleteCompletions=3})(fk||(f.CompletionTriggerKind=fk={}));var pk;(function(e){e.method="textDocument/completion",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.completion","completionProvider")})(pk||(f.CompletionRequest=pk={}));var mk;(function(e){e.method="completionItem/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.completion.completionItem.resolveSupport","completionProvider.resolveProvider")})(mk||(f.CompletionResolveRequest=mk={}));var hk;(function(e){e.method="textDocument/hover",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.hover","hoverProvider")})(hk||(f.HoverRequest=hk={}));var gk;(function(e){e.Invoked=1,e.TriggerCharacter=2,e.ContentChange=3})(gk||(f.SignatureHelpTriggerKind=gk={}));var yk;(function(e){e.method="textDocument/signatureHelp",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.signatureHelp","signatureHelpProvider")})(yk||(f.SignatureHelpRequest=yk={}));var _k;(function(e){e.method="textDocument/definition",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.definition","definitionProvider")})(_k||(f.DefinitionRequest=_k={}));var vk;(function(e){e.method="textDocument/references",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.references","referencesProvider")})(vk||(f.ReferencesRequest=vk={}));var bk;(function(e){e.method="textDocument/documentHighlight",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentHighlight","documentHighlightProvider")})(bk||(f.DocumentHighlightRequest=bk={}));var wk;(function(e){e.method="textDocument/documentSymbol",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentSymbol","documentSymbolProvider")})(wk||(f.DocumentSymbolRequest=wk={}));var xk;(function(e){e.method="textDocument/codeAction",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeAction","codeActionProvider")})(xk||(f.CodeActionRequest=xk={}));var $k;(function(e){e.method="codeAction/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeAction.resolveSupport","codeActionProvider.resolveProvider")})($k||(f.CodeActionResolveRequest=$k={}));var Sk;(function(e){e.method="workspace/symbol",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("workspace.symbol","workspaceSymbolProvider")})(Sk||(f.WorkspaceSymbolRequest=Sk={}));var kk;(function(e){e.method="workspaceSymbol/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("workspace.symbol.resolveSupport","workspaceSymbolProvider.resolveProvider")})(kk||(f.WorkspaceSymbolResolveRequest=kk={}));var Pk;(function(e){e.method="textDocument/codeLens",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeLens","codeLensProvider")})(Pk||(f.CodeLensRequest=Pk={}));var Tk;(function(e){e.method="codeLens/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.codeLens.resolveSupport","codeLensProvider.resolveProvider")})(Tk||(f.CodeLensResolveRequest=Tk={}));var zk;(function(e){e.method="workspace/codeLens/refresh",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType0(e.method),e.capabilities=$.CM.create("workspace.codeLens",void 0)})(zk||(f.CodeLensRefreshRequest=zk={}));var Rk;(function(e){e.method="textDocument/documentLink",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentLink","documentLinkProvider")})(Rk||(f.DocumentLinkRequest=Rk={}));var Ek;(function(e){e.method="documentLink/resolve",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.documentLink","documentLinkProvider.resolveProvider")})(Ek||(f.DocumentLinkResolveRequest=Ek={}));var Ok;(function(e){e.method="textDocument/formatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.formatting","documentFormattingProvider")})(Ok||(f.DocumentFormattingRequest=Ok={}));var Ck;(function(e){e.method="textDocument/rangeFormatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rangeFormatting","documentRangeFormattingProvider")})(Ck||(f.DocumentRangeFormattingRequest=Ck={}));var jk;(function(e){e.method="textDocument/rangesFormatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rangeFormatting.rangesSupport","documentRangeFormattingProvider.rangesSupport")})(jk||(f.DocumentRangesFormattingRequest=jk={}));var Mk;(function(e){e.method="textDocument/onTypeFormatting",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.onTypeFormatting","documentOnTypeFormattingProvider")})(Mk||(f.DocumentOnTypeFormattingRequest=Mk={}));var Nk;(function(e){e.Identifier=1})(Nk||(f.PrepareSupportDefaultBehavior=Nk={}));var Ik;(function(e){e.method="textDocument/rename",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rename","renameProvider")})(Ik||(f.RenameRequest=Ik={}));var Dk;(function(e){e.method="textDocument/prepareRename",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("textDocument.rename.prepareSupport","renameProvider.prepareProvider")})(Dk||(f.PrepareRenameRequest=Dk={}));var Ak;(function(e){e.method="workspace/executeCommand",e.messageDirection=$.MessageDirection.clientToServer,e.type=new $.ProtocolRequestType(e.method),e.capabilities=$.CM.create("workspace.executeCommand","executeCommandProvider")})(Ak||(f.ExecuteCommandRequest=Ak={}));var qk;(function(e){e.method="workspace/applyEdit",e.messageDirection=$.MessageDirection.serverToClient,e.type=new $.ProtocolRequestType("workspace/applyEdit"),e.capabilities=$.CM.create("workspace.applyEdit",void 0)})(qk||(f.ApplyWorkspaceEditRequest=qk={}))});var Wk=k(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});cy.createProtocolConnection=jA;var Bk=Or();function jA(e,t,r,n){return Bk.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Bk.createMessageConnection)(e,t,r,n)}});var uy=k(Rt=>{"use strict";var MA=Rt&&Rt.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),zu=Rt&&Rt.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&MA(t,e,r)};Object.defineProperty(Rt,"__esModule",{value:!0});Rt.LSPErrorCodes=Rt.createProtocolConnection=void 0;zu(Or(),Rt);zu((yu(),Mu(gu)),Rt);zu(Re(),Rt);zu(Hk(),Rt);var NA=Wk();Object.defineProperty(Rt,"createProtocolConnection",{enumerable:!0,get:function(){return NA.createProtocolConnection}});var Jk;(function(e){e.lspReservedErrorRangeStart=-32899,e.RequestFailed=-32803,e.ServerCancelled=-32802,e.ContentModified=-32801,e.RequestCancelled=-32800,e.lspReservedErrorRangeEnd=-32800})(Jk||(Rt.LSPErrorCodes=Jk={}))});var Kk=k(Dr=>{"use strict";var IA=Dr&&Dr.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),Gk=Dr&&Dr.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&IA(t,e,r)};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.createProtocolConnection=AA;var DA=Eh();Gk(Eh(),Dr);Gk(uy(),Dr);function AA(e,t,r,n){return(0,DA.createMessageConnection)(e,t,r,n)}});import{extname as VA}from"node:path";var Vr={};Ys(Vr,{BRAND:()=>JP,DIRTY:()=>xn,EMPTY_PATH:()=>PP,INVALID:()=>H,NEVER:()=>OT,OK:()=>ot,ParseStatus:()=>Xe,Schema:()=>Y,ZodAny:()=>Fr,ZodArray:()=>Sr,ZodBigInt:()=>Sn,ZodBoolean:()=>kn,ZodBranded:()=>Pi,ZodCatch:()=>In,ZodDate:()=>Pn,ZodDefault:()=>Nn,ZodDiscriminatedUnion:()=>ra,ZodEffects:()=>Dt,ZodEnum:()=>jn,ZodError:()=>vt,ZodFirstPartyTypeKind:()=>E,ZodFunction:()=>oa,ZodIntersection:()=>En,ZodIssueCode:()=>z,ZodLazy:()=>On,ZodLiteral:()=>Cn,ZodMap:()=>bo,ZodNaN:()=>xo,ZodNativeEnum:()=>Mn,ZodNever:()=>Wt,ZodNull:()=>zn,ZodNullable:()=>ur,ZodNumber:()=>$n,ZodObject:()=>wt,ZodOptional:()=>bt,ZodParsedType:()=>M,ZodPipeline:()=>Ti,ZodPromise:()=>Ur,ZodReadonly:()=>Dn,ZodRecord:()=>na,ZodSchema:()=>Y,ZodSet:()=>wo,ZodString:()=>Lr,ZodSymbol:()=>_o,ZodTransformer:()=>Dt,ZodTuple:()=>cr,ZodType:()=>Y,ZodUndefined:()=>Tn,ZodUnion:()=>Rn,ZodUnknown:()=>$r,ZodVoid:()=>vo,addIssueToContext:()=>j,any:()=>nT,array:()=>aT,bigint:()=>YP,boolean:()=>Oy,coerce:()=>ET,custom:()=>zy,date:()=>QP,datetimeRegex:()=>Py,defaultErrorMap:()=>wr,discriminatedUnion:()=>lT,effect:()=>xT,enum:()=>vT,function:()=>gT,getErrorMap:()=>ho,getParsedType:()=>ar,instanceof:()=>KP,intersection:()=>dT,isAborted:()=>ea,isAsync:()=>go,isDirty:()=>ta,isValid:()=>Zr,late:()=>GP,lazy:()=>yT,literal:()=>_T,makeIssue:()=>ki,map:()=>mT,nan:()=>XP,nativeEnum:()=>bT,never:()=>iT,null:()=>rT,nullable:()=>ST,number:()=>Ey,object:()=>Au,objectUtil:()=>Nu,oboolean:()=>RT,onumber:()=>zT,optional:()=>$T,ostring:()=>TT,pipeline:()=>PT,preprocess:()=>kT,promise:()=>wT,quotelessJson:()=>$P,record:()=>pT,set:()=>hT,setErrorMap:()=>kP,strictObject:()=>cT,string:()=>Ry,symbol:()=>eT,transformer:()=>xT,tuple:()=>fT,undefined:()=>tT,union:()=>uT,unknown:()=>oT,util:()=>re,void:()=>sT});var re;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(re||(re={}));var Nu;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Nu||(Nu={}));var M=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ar=e=>{switch(typeof e){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN(e)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":return Array.isArray(e)?M.array:e===null?M.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?M.promise:typeof Map<"u"&&e instanceof Map?M.map:typeof Set<"u"&&e instanceof Set?M.set:typeof Date<"u"&&e instanceof Date?M.date:M.object;default:return M.unknown}};var z=re.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"]),$P=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),vt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};vt.create=e=>new vt(e);var SP=(e,t)=>{let r;switch(e.code){case z.invalid_type:e.received===M.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case z.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,re.jsonStringifyReplacer)}`;break;case z.unrecognized_keys:r=`Unrecognized key(s) in object: ${re.joinValues(e.keys,", ")}`;break;case z.invalid_union:r="Invalid input";break;case z.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${re.joinValues(e.options)}`;break;case z.invalid_enum_value:r=`Invalid enum value. Expected ${re.joinValues(e.options)}, received '${e.received}'`;break;case z.invalid_arguments:r="Invalid function arguments";break;case z.invalid_return_type:r="Invalid function return type";break;case z.invalid_date:r="Invalid date";break;case z.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:re.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case z.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case z.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case z.custom:r="Invalid input";break;case z.invalid_intersection_types:r="Intersection results could not be merged";break;case z.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case z.not_finite:r="Number must be finite";break;default:r=t.defaultError,re.assertNever(e)}return{message:r}},wr=SP;var wy=wr;function kP(e){wy=e}function ho(){return wy}var ki=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},PP=[];function j(e,t){let r=ho(),n=ki({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===wr?void 0:wr].filter(o=>!!o)});e.common.issues.push(n)}var Xe=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return H;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return H;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},H=Object.freeze({status:"aborted"}),xn=e=>({status:"dirty",value:e}),ot=e=>({status:"valid",value:e}),ea=e=>e.status==="aborted",ta=e=>e.status==="dirty",Zr=e=>e.status==="valid",go=e=>typeof Promise<"u"&&e instanceof Promise;var q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(q||(q={}));var It=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},xy=(e,t)=>{if(Zr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new vt(e.common.issues);return this._error=r,this._error}}};function K(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:c}=e;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var Y=class{get description(){return this._def.description}_getType(t){return ar(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xe,ctx:{common:t.parent.common,data:t.data,parsedType:ar(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(go(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)},o=this._parseSync({data:t,path:n.path,parent:n});return xy(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return Zr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>Zr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ar(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(go(o)?o:Promise.resolve(o));return xy(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:z.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Dt({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return bt.create(this,this._def)}nullable(){return ur.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sr.create(this)}promise(){return Ur.create(this,this._def)}or(t){return Rn.create([this,t],this._def)}and(t){return En.create(this,t,this._def)}transform(t){return new Dt({...K(this._def),schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Nn({...K(this._def),innerType:this,defaultValue:r,typeName:E.ZodDefault})}brand(){return new Pi({typeName:E.ZodBranded,type:this,...K(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new In({...K(this._def),innerType:this,catchValue:r,typeName:E.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Ti.create(this,t)}readonly(){return Dn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},TP=/^c[^\s-]{8,}$/i,zP=/^[0-9a-z]+$/,RP=/^[0-9A-HJKMNP-TV-Z]{26}$/i,EP=/^[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,OP=/^[a-z0-9_-]{21}$/i,CP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,jP=/^[-+]?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)?)??$/,MP=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,NP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Iu,IP=/^(?:(?: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])$/,DP=/^(?:(?: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])$/,AP=/^(([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]))$/,qP=/^(([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])$/,ZP=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,LP=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Sy="((\\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])))",FP=new RegExp(`^${Sy}$`);function ky(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function UP(e){return new RegExp(`^${ky(e)}$`)}function Py(e){let t=`${Sy}T${ky(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function VP(e,t){return!!((t==="v4"||!t)&&IP.test(e)||(t==="v6"||!t)&&AP.test(e))}function HP(e,t){if(!CP.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function BP(e,t){return!!((t==="v4"||!t)&&DP.test(e)||(t==="v6"||!t)&&qP.test(e))}var Lr=class e extends Y{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==M.string){let i=this._getOrReturnCtx(t);return j(i,{code:z.invalid_type,expected:M.string,received:i.parsedType}),H}let n=new Xe,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?j(o,{code:z.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&j(o,{code:z.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")MP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"email",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Iu||(Iu=new RegExp(NP,"u")),Iu.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"emoji",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")EP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"uuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")OP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"nanoid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")TP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"cuid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")zP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"cuid2",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")RP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"ulid",code:z.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),j(o,{validation:"url",code:z.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"regex",code:z.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),j(o,{code:z.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),j(o,{code:z.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),j(o,{code:z.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Py(i).test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{code:z.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?FP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{code:z.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?UP(i).test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{code:z.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?jP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"duration",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?VP(t.data,i.version)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"ip",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?HP(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"jwt",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?BP(t.data,i.version)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"cidr",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?ZP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"base64",code:z.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?LP.test(t.data)||(o=this._getOrReturnCtx(t,o),j(o,{validation:"base64url",code:z.invalid_string,message:i.message}),n.dirty()):re.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:z.invalid_string,...q.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...q.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...q.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...q.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...q.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...q.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...q.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...q.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...q.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...q.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...q.errToObj(r)})}nonempty(t){return this.min(1,q.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Lr.create=e=>new Lr({checks:[],typeName:E.ZodString,coerce:e?.coerce??!1,...K(e)});function WP(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var $n=class e extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==M.number){let i=this._getOrReturnCtx(t);return j(i,{code:z.invalid_type,expected:M.number,received:i.parsedType}),H}let n,o=new Xe;for(let i of this._def.checks)i.kind==="int"?re.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),j(n,{code:z.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:z.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:z.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?WP(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),j(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),j(n,{code:z.not_finite,message:i.message}),o.dirty()):re.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,q.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:q.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:q.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&re.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};$n.create=e=>new $n({checks:[],typeName:E.ZodNumber,coerce:e?.coerce||!1,...K(e)});var Sn=class e extends Y{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==M.bigint)return this._getInvalidInput(t);let n,o=new Xe;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:z.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),j(n,{code:z.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),j(n,{code:z.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):re.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return j(r,{code:z.invalid_type,expected:M.bigint,received:r.parsedType}),H}gte(t,r){return this.setLimit("min",t,!0,q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,q.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:q.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:q.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Sn.create=e=>new Sn({checks:[],typeName:E.ZodBigInt,coerce:e?.coerce??!1,...K(e)});var kn=class extends Y{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==M.boolean){let n=this._getOrReturnCtx(t);return j(n,{code:z.invalid_type,expected:M.boolean,received:n.parsedType}),H}return ot(t.data)}};kn.create=e=>new kn({typeName:E.ZodBoolean,coerce:e?.coerce||!1,...K(e)});var Pn=class e extends Y{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==M.date){let i=this._getOrReturnCtx(t);return j(i,{code:z.invalid_type,expected:M.date,received:i.parsedType}),H}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return j(i,{code:z.invalid_date}),H}let n=new Xe,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:z.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),j(o,{code:z.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):re.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:q.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:q.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Pn.create=e=>new Pn({checks:[],coerce:e?.coerce||!1,typeName:E.ZodDate,...K(e)});var _o=class extends Y{_parse(t){if(this._getType(t)!==M.symbol){let n=this._getOrReturnCtx(t);return j(n,{code:z.invalid_type,expected:M.symbol,received:n.parsedType}),H}return ot(t.data)}};_o.create=e=>new _o({typeName:E.ZodSymbol,...K(e)});var Tn=class extends Y{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return j(n,{code:z.invalid_type,expected:M.undefined,received:n.parsedType}),H}return ot(t.data)}};Tn.create=e=>new Tn({typeName:E.ZodUndefined,...K(e)});var zn=class extends Y{_parse(t){if(this._getType(t)!==M.null){let n=this._getOrReturnCtx(t);return j(n,{code:z.invalid_type,expected:M.null,received:n.parsedType}),H}return ot(t.data)}};zn.create=e=>new zn({typeName:E.ZodNull,...K(e)});var Fr=class extends Y{constructor(){super(...arguments),this._any=!0}_parse(t){return ot(t.data)}};Fr.create=e=>new Fr({typeName:E.ZodAny,...K(e)});var $r=class extends Y{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ot(t.data)}};$r.create=e=>new $r({typeName:E.ZodUnknown,...K(e)});var Wt=class extends Y{_parse(t){let r=this._getOrReturnCtx(t);return j(r,{code:z.invalid_type,expected:M.never,received:r.parsedType}),H}};Wt.create=e=>new Wt({typeName:E.ZodNever,...K(e)});var vo=class extends Y{_parse(t){if(this._getType(t)!==M.undefined){let n=this._getOrReturnCtx(t);return j(n,{code:z.invalid_type,expected:M.void,received:n.parsedType}),H}return ot(t.data)}};vo.create=e=>new vo({typeName:E.ZodVoid,...K(e)});var Sr=class e extends Y{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==M.array)return j(r,{code:z.invalid_type,expected:M.array,received:r.parsedType}),H;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(j(r,{code:s?z.too_big:z.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?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&&(j(r,{code:z.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&&(j(r,{code:z.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((s,a)=>o.type._parseAsync(new It(r,s,r.path,a)))).then(s=>Xe.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new It(r,s,r.path,a)));return Xe.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:q.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:q.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:q.toString(r)}})}nonempty(t){return this.min(1,t)}};Sr.create=(e,t)=>new Sr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray,...K(t)});function yo(e){if(e instanceof wt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=bt.create(yo(n))}return new wt({...e._def,shape:()=>t})}else return e instanceof Sr?new Sr({...e._def,type:yo(e.element)}):e instanceof bt?bt.create(yo(e.unwrap())):e instanceof ur?ur.create(yo(e.unwrap())):e instanceof cr?cr.create(e.items.map(t=>yo(t))):e}var wt=class e extends Y{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=re.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==M.object){let u=this._getOrReturnCtx(t);return j(u,{code:z.invalid_type,expected:M.object,received:u.parsedType}),H}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof Wt&&this._def.unknownKeys==="strip"))for(let u in o.data)s.includes(u)||a.push(u);let c=[];for(let u of s){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new It(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Wt){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&&(j(o,{code:z.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 It(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=>Xe.mergeObjectSync(n,u)):Xe.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return q.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:q.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:E.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of re.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of re.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return yo(this)}partial(t){let r={};for(let n of re.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of re.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof bt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Ty(re.objectKeys(this.shape))}};wt.create=(e,t)=>new wt({shape:()=>e,unknownKeys:"strip",catchall:Wt.create(),typeName:E.ZodObject,...K(t)});wt.strictCreate=(e,t)=>new wt({shape:()=>e,unknownKeys:"strict",catchall:Wt.create(),typeName:E.ZodObject,...K(t)});wt.lazycreate=(e,t)=>new wt({shape:e,unknownKeys:"strip",catchall:Wt.create(),typeName:E.ZodObject,...K(t)});var Rn=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new vt(a.ctx.common.issues));return j(r,{code:z.invalid_union,unionErrors:s}),H}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(c=>new vt(c));return j(r,{code:z.invalid_union,unionErrors:a}),H}}get options(){return this._def.options}};Rn.create=(e,t)=>new Rn({options:e,typeName:E.ZodUnion,...K(t)});var xr=e=>e instanceof On?xr(e.schema):e instanceof Dt?xr(e.innerType()):e instanceof Cn?[e.value]:e instanceof jn?e.options:e instanceof Mn?re.objectValues(e.enum):e instanceof Nn?xr(e._def.innerType):e instanceof Tn?[void 0]:e instanceof zn?[null]:e instanceof bt?[void 0,...xr(e.unwrap())]:e instanceof ur?[null,...xr(e.unwrap())]:e instanceof Pi||e instanceof Dn?xr(e.unwrap()):e instanceof In?xr(e._def.innerType):[],ra=class e extends Y{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.object)return j(r,{code:z.invalid_type,expected:M.object,received:r.parsedType}),H;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(j(r,{code:z.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),H)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=xr(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:E.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...K(n)})}};function Du(e,t){let r=ar(e),n=ar(t);if(e===t)return{valid:!0,data:e};if(r===M.object&&n===M.object){let o=re.objectKeys(t),i=re.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let c=Du(e[a],t[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(r===M.array&&n===M.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],c=Du(s,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===M.date&&n===M.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var En=class extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(ea(i)||ea(s))return H;let a=Du(i.value,s.value);return a.valid?((ta(i)||ta(s))&&r.dirty(),{status:r.value,value:a.data}):(j(n,{code:z.invalid_intersection_types}),H)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):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}))}};En.create=(e,t,r)=>new En({left:e,right:t,typeName:E.ZodIntersection,...K(r)});var cr=class e extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.array)return j(n,{code:z.invalid_type,expected:M.array,received:n.parsedType}),H;if(n.data.length<this._def.items.length)return j(n,{code:z.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;!this._def.rest&&n.data.length>this._def.items.length&&(j(n,{code:z.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new It(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>Xe.mergeArray(r,s)):Xe.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};cr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new cr({items:e,typeName:E.ZodTuple,rest:null,...K(t)})};var na=class e extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.object)return j(n,{code:z.invalid_type,expected:M.object,received:n.parsedType}),H;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new It(n,a,n.path,a)),value:s._parse(new It(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Xe.mergeObjectAsync(r,o):Xe.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Y?new e({keyType:t,valueType:r,typeName:E.ZodRecord,...K(n)}):new e({keyType:Lr.create(),valueType:t,typeName:E.ZodRecord,...K(r)})}},bo=class extends Y{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.map)return j(n,{code:z.invalid_type,expected:M.map,received:n.parsedType}),H;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new It(n,a,n.path,[u,"key"])),value:i._parse(new It(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of s){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return H;(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 s){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return H;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};bo.create=(e,t,r)=>new bo({valueType:t,keyType:e,typeName:E.ZodMap,...K(r)});var wo=class e extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==M.set)return j(n,{code:z.invalid_type,expected:M.set,received:n.parsedType}),H;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(j(n,{code:z.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&&(j(n,{code:z.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(c){let u=new Set;for(let l of c){if(l.status==="aborted")return H;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>i._parse(new It(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:q.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:q.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};wo.create=(e,t)=>new wo({valueType:e,minSize:null,maxSize:null,typeName:E.ZodSet,...K(t)});var oa=class e extends Y{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.function)return j(r,{code:z.invalid_type,expected:M.function,received:r.parsedType}),H;function n(a,c){return ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ho(),wr].filter(u=>!!u),issueData:{code:z.invalid_arguments,argumentsError:c}})}function o(a,c){return ki({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ho(),wr].filter(u=>!!u),issueData:{code:z.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof Ur){let a=this;return ot(async function(...c){let u=new vt([]),l=await a._def.args.parseAsync(c,i).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(s,this,l);return await a._def.returns._def.type.parseAsync(d,i).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let a=this;return ot(function(...c){let u=a._def.args.safeParse(c,i);if(!u.success)throw new vt([n(c,u.error)]);let l=Reflect.apply(s,this,u.data),d=a._def.returns.safeParse(l,i);if(!d.success)throw new vt([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:cr.create(t).rest($r.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||cr.create([]).rest($r.create()),returns:r||$r.create(),typeName:E.ZodFunction,...K(n)})}},On=class extends Y{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};On.create=(e,t)=>new On({getter:e,typeName:E.ZodLazy,...K(t)});var Cn=class extends Y{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return j(r,{received:r.data,code:z.invalid_literal,expected:this._def.value}),H}return{status:"valid",value:t.data}}get value(){return this._def.value}};Cn.create=(e,t)=>new Cn({value:e,typeName:E.ZodLiteral,...K(t)});function Ty(e,t){return new jn({values:e,typeName:E.ZodEnum,...K(t)})}var jn=class e extends Y{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return j(r,{expected:re.joinValues(n),received:r.parsedType,code:z.invalid_type}),H}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return j(r,{received:r.data,code:z.invalid_enum_value,options:n}),H}return ot(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};jn.create=Ty;var Mn=class extends Y{_parse(t){let r=re.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==M.string&&n.parsedType!==M.number){let o=re.objectValues(r);return j(n,{expected:re.joinValues(o),received:n.parsedType,code:z.invalid_type}),H}if(this._cache||(this._cache=new Set(re.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=re.objectValues(r);return j(n,{received:n.data,code:z.invalid_enum_value,options:o}),H}return ot(t.data)}get enum(){return this._def.values}};Mn.create=(e,t)=>new Mn({values:e,typeName:E.ZodNativeEnum,...K(t)});var Ur=class extends Y{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==M.promise&&r.common.async===!1)return j(r,{code:z.invalid_type,expected:M.promise,received:r.parsedType}),H;let n=r.parsedType===M.promise?r.data:Promise.resolve(r.data);return ot(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ur.create=(e,t)=>new Ur({type:e,typeName:E.ZodPromise,...K(t)});var Dt=class extends Y{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{j(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return H;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?H:c.status==="dirty"?xn(c.value):r.value==="dirty"?xn(c.value):c});{if(r.value==="aborted")return H;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?H:a.status==="dirty"?xn(a.value):r.value==="dirty"?xn(a.value):a}}if(o.type==="refinement"){let s=a=>{let c=o.refinement(a,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?H:(a.status==="dirty"&&r.dirty(),s(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"?H:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Zr(s))return H;let a=o.transform(s.value,i);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(s=>Zr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):H);re.assertNever(o)}};Dt.create=(e,t,r)=>new Dt({schema:e,typeName:E.ZodEffects,effect:t,...K(r)});Dt.createWithPreprocess=(e,t,r)=>new Dt({schema:t,effect:{type:"preprocess",transform:e},typeName:E.ZodEffects,...K(r)});var bt=class extends Y{_parse(t){return this._getType(t)===M.undefined?ot(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};bt.create=(e,t)=>new bt({innerType:e,typeName:E.ZodOptional,...K(t)});var ur=class extends Y{_parse(t){return this._getType(t)===M.null?ot(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ur.create=(e,t)=>new ur({innerType:e,typeName:E.ZodNullable,...K(t)});var Nn=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===M.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Nn.create=(e,t)=>new Nn({innerType:e,typeName:E.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...K(t)});var In=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return go(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new vt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new vt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};In.create=(e,t)=>new In({innerType:e,typeName:E.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...K(t)});var xo=class extends Y{_parse(t){if(this._getType(t)!==M.nan){let n=this._getOrReturnCtx(t);return j(n,{code:z.invalid_type,expected:M.nan,received:n.parsedType}),H}return{status:"valid",value:t.data}}};xo.create=e=>new xo({typeName:E.ZodNaN,...K(e)});var JP=Symbol("zod_brand"),Pi=class extends Y{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ti=class e extends Y{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?H:i.status==="dirty"?(r.dirty(),xn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?H:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:E.ZodPipeline})}},Dn=class extends Y{_parse(t){let r=this._def.innerType._parse(t),n=o=>(Zr(o)&&(o.value=Object.freeze(o.value)),o);return go(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Dn.create=(e,t)=>new Dn({innerType:e,typeName:E.ZodReadonly,...K(t)});function $y(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function zy(e,t={},r){return e?Fr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=$y(t,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!i){let s=$y(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):Fr.create()}var GP={object:wt.lazycreate},E;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(E||(E={}));var KP=(e,t={message:`Input not instance of ${e.name}`})=>zy(r=>r instanceof e,t),Ry=Lr.create,Ey=$n.create,XP=xo.create,YP=Sn.create,Oy=kn.create,QP=Pn.create,eT=_o.create,tT=Tn.create,rT=zn.create,nT=Fr.create,oT=$r.create,iT=Wt.create,sT=vo.create,aT=Sr.create,Au=wt.create,cT=wt.strictCreate,uT=Rn.create,lT=ra.create,dT=En.create,fT=cr.create,pT=na.create,mT=bo.create,hT=wo.create,gT=oa.create,yT=On.create,_T=Cn.create,vT=jn.create,bT=Mn.create,wT=Ur.create,xT=Dt.create,$T=bt.create,ST=ur.create,kT=Dt.createWithPreprocess,PT=Ti.create,TT=()=>Ry().optional(),zT=()=>Ey().optional(),RT=()=>Oy().optional(),ET={string:(e=>Lr.create({...e,coerce:!0})),number:(e=>$n.create({...e,coerce:!0})),boolean:(e=>kn.create({...e,coerce:!0})),bigint:(e=>Sn.create({...e,coerce:!0})),date:(e=>Pn.create({...e,coerce:!0}))};var OT=H;var CT=Object.freeze({status:"aborted"});function x(e,t,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(e),t(a,c);for(let l in s.prototype)l in a||Object.defineProperty(a,l,{value:s.prototype[l].bind(a)});a._zod.constr=s,a._zod.def=c}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var c;let u=r?.Parent?new i:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var kr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ia={};function Et(e){return e&&Object.assign(ia,e),ia}var ne={};Ys(ne,{BIGINT_FORMAT_RANGES:()=>jy,Class:()=>Zu,NUMBER_FORMAT_RANGES:()=>Wu,aborted:()=>qn,allowsEval:()=>Vu,assert:()=>DT,assertEqual:()=>jT,assertIs:()=>NT,assertNever:()=>IT,assertNotEqual:()=>MT,assignProp:()=>Uu,cached:()=>Ei,captureStackTrace:()=>aa,cleanEnum:()=>KT,cleanRegex:()=>Ci,clone:()=>Ot,createTransparentProxy:()=>UT,defineLazy:()=>be,esc:()=>An,escapeRegex:()=>Hr,extend:()=>BT,finalizeIssue:()=>Jt,floatSafeRemainder:()=>Fu,getElementAtPath:()=>AT,getEnumValues:()=>Ri,getLengthableOrigin:()=>ji,getParsedType:()=>FT,getSizableOrigin:()=>My,isObject:()=>$o,isPlainObject:()=>So,issue:()=>Ju,joinValues:()=>sa,jsonStringifyReplacer:()=>Lu,merge:()=>WT,normalizeParams:()=>B,nullish:()=>Oi,numKeys:()=>LT,omit:()=>HT,optionalKeys:()=>Bu,partial:()=>JT,pick:()=>VT,prefixIssues:()=>lr,primitiveTypes:()=>Cy,promiseAllObject:()=>qT,propertyKeyTypes:()=>Hu,randomString:()=>ZT,required:()=>GT,stringifyPrimitive:()=>ca,unwrapMessage:()=>zi});function jT(e){return e}function MT(e){return e}function NT(e){}function IT(e){throw new Error}function DT(e){}function Ri(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function sa(e,t="|"){return e.map(r=>ca(r)).join(t)}function Lu(e,t){return typeof t=="bigint"?t.toString():t}function Ei(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Oi(e){return e==null}function Ci(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fu(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function be(e,t,r){Object.defineProperty(e,t,{get(){{let o=r();return e[t]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Uu(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function AT(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function qT(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function ZT(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function An(e){return JSON.stringify(e)}var aa=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function $o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Vu=Ei(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function So(e){if($o(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!($o(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function LT(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var FT=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Hu=new Set(["string","number","symbol"]),Cy=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Hr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ot(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function B(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function UT(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function ca(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Bu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Wu={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]},jy={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function VT(e,t){let r={},n=e._zod.def;for(let o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(r[o]=n.shape[o])}return Ot(e,{...e._zod.def,shape:r,checks:[]})}function HT(e,t){let r={...e._zod.def.shape},n=e._zod.def;for(let o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete r[o]}return Ot(e,{...e._zod.def,shape:r,checks:[]})}function BT(e,t){if(!So(t))throw new Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Uu(this,"shape",n),n},checks:[]};return Ot(e,r)}function WT(e,t){return Ot(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Uu(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function JT(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=e?new e({type:"optional",innerType:n[i]}):n[i])}else for(let i in n)o[i]=e?new e({type:"optional",innerType:n[i]}):n[i];return Ot(t,{...t._zod.def,shape:o,checks:[]})}function GT(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let i in r){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(o[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)o[i]=new e({type:"nonoptional",innerType:n[i]});return Ot(t,{...t._zod.def,shape:o,checks:[]})}function qn(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function lr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function zi(e){return typeof e=="string"?e:e?.message}function Jt(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=zi(e.inst?._zod.def?.error?.(e))??zi(t?.error?.(e))??zi(r.customError?.(e))??zi(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function My(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ji(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ju(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function KT(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var Zu=class{constructor(...t){}};var Ny=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Lu,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ua=x("$ZodError",Ny),Mi=x("$ZodError",Ny,{Parent:Error});function Gu(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ku(e,t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)n._errors.push(r(s));else{let a=n,c=0;for(;c<s.path.length;){let u=s.path[c];c===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(s))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(e),n}var Xu=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new kr;if(s.issues.length){let a=new(o?.Err??e)(s.issues.map(c=>Jt(c,i,Et())));throw aa(a,o?.callee),a}return s.value},Yu=Xu(Mi),Qu=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){let a=new(o?.Err??e)(s.issues.map(c=>Jt(c,i,Et())));throw aa(a,o?.callee),a}return s.value},el=Qu(Mi),tl=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kr;return i.issues.length?{success:!1,error:new(e??ua)(i.issues.map(s=>Jt(s,o,Et())))}:{success:!0,data:i.value}},Zn=tl(Mi),rl=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Jt(s,o,Et())))}:{success:!0,data:i.value}},Ln=rl(Mi);var Iy=/^[cC][^\s-]{8,}$/,Dy=/^[0-9a-z]+$/,Ay=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qy=/^[0-9a-vA-V]{20}$/,Zy=/^[A-Za-z0-9]{27}$/,Ly=/^[a-zA-Z0-9_-]{21}$/,Fy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Uy=/^([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})$/,nl=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var Vy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var YT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hy(){return new RegExp(YT,"u")}var By=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Wy=/^(([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})$/,Jy=/^((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])$/,Gy=/^(([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])$/,Ky=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ol=/^[A-Za-z0-9_-]*$/,Xy=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Yy=/^\+(?:[0-9]){6,14}[0-9]$/,Qy="(?:(?:\\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])))",e_=new RegExp(`^${Qy}$`);function t_(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function r_(e){return new RegExp(`^${t_(e)}$`)}function n_(e){let t=t_({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Qy}T(?:${n})$`)}var o_=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var i_=/^\d+$/,s_=/^-?\d+(?:\.\d+)?/i,a_=/true|false/i,c_=/null/i;var u_=/^[^A-Z]*$/,l_=/^[^a-z]*$/;var Ye=x("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),d_={number:"number",bigint:"bigint",object:"date"},il=x("$ZodCheckLessThan",(e,t)=>{Ye.init(e,t);let r=d_[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sl=x("$ZodCheckGreaterThan",(e,t)=>{Ye.init(e,t);let r=d_[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),f_=x("$ZodCheckMultipleOf",(e,t)=>{Ye.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Fu(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),p_=x("$ZodCheckNumberFormat",(e,t)=>{Ye.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Wu[t.format];e._zod.onattach.push(s=>{let a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,r&&(a.pattern=i_)}),e._zod.check=s=>{let a=s.value;if(r){if(!Number.isInteger(a)){s.issues.push({expected:n,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inst:e})}});var m_=x("$ZodCheckMaxLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Oi(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let s=ji(o);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),h_=x("$ZodCheckMinLength",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Oi(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let s=ji(o);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),g_=x("$ZodCheckLengthEquals",(e,t)=>{var r;Ye.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Oi(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let s=ji(o),a=i>t.length;n.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ni=x("$ZodCheckStringFormat",(e,t)=>{var r,n;Ye.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),y_=x("$ZodCheckRegex",(e,t)=>{Ni.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),__=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=u_),Ni.init(e,t)}),v_=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=l_),Ni.init(e,t)}),b_=x("$ZodCheckIncludes",(e,t)=>{Ye.init(e,t);let r=Hr(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),w_=x("$ZodCheckStartsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`^${Hr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),x_=x("$ZodCheckEndsWith",(e,t)=>{Ye.init(e,t);let r=new RegExp(`.*${Hr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var $_=x("$ZodCheckOverwrite",(e,t)=>{Ye.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var da=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
21
21
|
`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
22
|
-
`))}};var k_={major:4,minor:0,patch:0};var ge=x("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=k_;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,s,a)=>{let c=qn(i),u;for(let l of s){if(l._zod.def.when){if(!l._zod.def.when(i))continue}else if(c)continue;let d=i.issues.length,h=l._zod.check(i);if(h instanceof Promise&&a?.async===!1)throw new kr;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,i.issues.length!==d&&(c||(c=qn(i,d)))});else{if(i.issues.length===d)continue;c||(c=qn(i,d))}}return u?u.then(()=>i):i};e._zod.run=(i,s)=>{let a=e._zod.parse(i,s);if(a instanceof Promise){if(s.async===!1)throw new kr;return a.then(c=>o(c,n,s))}return o(a,n,s)}}e["~standard"]={validate:o=>{try{let i=Zn(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ln(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),
|
|
23
|
-
if (${
|
|
24
|
-
if (input[${
|
|
25
|
-
if (${
|
|
26
|
-
newResult[${
|
|
22
|
+
`))}};var k_={major:4,minor:0,patch:0};var ge=x("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=k_;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,s,a)=>{let c=qn(i),u;for(let l of s){if(l._zod.def.when){if(!l._zod.def.when(i))continue}else if(c)continue;let d=i.issues.length,h=l._zod.check(i);if(h instanceof Promise&&a?.async===!1)throw new kr;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,i.issues.length!==d&&(c||(c=qn(i,d)))});else{if(i.issues.length===d)continue;c||(c=qn(i,d))}}return u?u.then(()=>i):i};e._zod.run=(i,s)=>{let a=e._zod.parse(i,s);if(a instanceof Promise){if(s.async===!1)throw new kr;return a.then(c=>o(c,n,s))}return o(a,n,s)}}e["~standard"]={validate:o=>{try{let i=Zn(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ln(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Ii=x("$ZodString",(e,t)=>{ge.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??o_(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),we=x("$ZodStringFormat",(e,t)=>{Ni.init(e,t),Ii.init(e,t)}),cl=x("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Uy),we.init(e,t)}),ul=x("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=nl(n))}else t.pattern??(t.pattern=nl());we.init(e,t)}),ll=x("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Vy),we.init(e,t)}),dl=x("$ZodURL",(e,t)=>{we.init(e,t),e._zod.check=r=>{try{let n=r.value,o=new URL(n),i=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Xy.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!n.endsWith("/")&&i.endsWith("/")?r.value=i.slice(0,-1):r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),fl=x("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Hy()),we.init(e,t)}),pl=x("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ly),we.init(e,t)}),ml=x("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Iy),we.init(e,t)}),hl=x("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Dy),we.init(e,t)}),gl=x("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ay),we.init(e,t)}),yl=x("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qy),we.init(e,t)}),_l=x("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Zy),we.init(e,t)}),N_=x("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=n_(t)),we.init(e,t)}),I_=x("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=e_),we.init(e,t)}),D_=x("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=r_(t)),we.init(e,t)}),A_=x("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Fy),we.init(e,t)}),vl=x("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=By),we.init(e,t),e._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),bl=x("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Wy),we.init(e,t),e._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),wl=x("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Jy),we.init(e,t)}),xl=x("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Gy),we.init(e,t),e._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function q_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var $l=x("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ky),we.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{q_(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function QT(e){if(!ol.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return q_(r)}var Sl=x("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ol),we.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{QT(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),kl=x("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Yy),we.init(e,t)});function ez(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Pl=x("$ZodJWT",(e,t)=>{we.init(e,t),e._zod.check=r=>{ez(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var pa=x("$ZodNumber",(e,t)=>{ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??s_,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Tl=x("$ZodNumber",(e,t)=>{p_.init(e,t),pa.init(e,t)}),zl=x("$ZodBoolean",(e,t)=>{ge.init(e,t),e._zod.pattern=a_,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Rl=x("$ZodNull",(e,t)=>{ge.init(e,t),e._zod.pattern=c_,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var El=x("$ZodUnknown",(e,t)=>{ge.init(e,t),e._zod.parse=r=>r}),Ol=x("$ZodNever",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function P_(e,t,r){e.issues.length&&t.issues.push(...lr(r,e.issues)),t.value[r]=e.value}var Cl=x("$ZodArray",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let s=0;s<o.length;s++){let a=o[s],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?i.push(c.then(u=>P_(u,r,s))):P_(c,r,s)}return i.length?Promise.all(i).then(()=>r):r}});function fa(e,t,r){e.issues.length&&t.issues.push(...lr(r,e.issues)),t.value[r]=e.value}function T_(e,t,r,n){e.issues.length?n[r]===void 0?r in n?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...lr(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}var ma=x("$ZodObject",(e,t)=>{ge.init(e,t);let r=Ei(()=>{let d=Object.keys(t.shape);for(let m of d)if(!(t.shape[m]instanceof ge))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);let h=Bu(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(h)}});be(e._zod,"propValues",()=>{let d=t.shape,h={};for(let m in d){let p=d[m]._zod;if(p.values){h[m]??(h[m]=new Set);for(let y of p.values)h[m].add(y)}}return h});let n=d=>{let h=new da(["shape","payload","ctx"]),m=r.value,p=T=>{let R=An(T);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};h.write("const input = payload.value;");let y=Object.create(null),v=0;for(let T of m.keys)y[T]=`key_${v++}`;h.write("const newResult = {}");for(let T of m.keys)if(m.optionalKeys.has(T)){let R=y[T];h.write(`const ${R} = ${p(T)};`);let I=An(T);h.write(`
|
|
23
|
+
if (${R}.issues.length) {
|
|
24
|
+
if (input[${I}] === undefined) {
|
|
25
|
+
if (${I} in input) {
|
|
26
|
+
newResult[${I}] = undefined;
|
|
27
27
|
}
|
|
28
28
|
} else {
|
|
29
29
|
payload.issues = payload.issues.concat(
|
|
30
|
-
${
|
|
30
|
+
${R}.issues.map((iss) => ({
|
|
31
31
|
...iss,
|
|
32
|
-
path: iss.path ? [${
|
|
32
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}],
|
|
33
33
|
}))
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
|
-
} else if (${
|
|
37
|
-
if (${
|
|
36
|
+
} else if (${R}.value === undefined) {
|
|
37
|
+
if (${I} in input) newResult[${I}] = undefined;
|
|
38
38
|
} else {
|
|
39
|
-
newResult[${
|
|
39
|
+
newResult[${I}] = ${R}.value;
|
|
40
40
|
}
|
|
41
|
-
`)}else{let
|
|
42
|
-
if (${
|
|
41
|
+
`)}else{let R=y[T];h.write(`const ${R} = ${p(T)};`),h.write(`
|
|
42
|
+
if (${R}.issues.length) payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
43
43
|
...iss,
|
|
44
44
|
path: iss.path ? [${An(T)}, ...iss.path] : [${An(T)}]
|
|
45
|
-
})));`),h.write(`newResult[${An(T)}] = ${z}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");let P=h.compile();return(T,z)=>P(d,T,z)},o,i=$o,s=!ia.jitless,c=s&&Vu.value,u=t.catchall,l;e._zod.parse=(d,h)=>{l??(l=r.value);let m=d.value;if(!i(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;let p=[];if(s&&c&&h?.async===!1&&h.jitless!==!0)o||(o=n(t.shape)),d=o(d,h);else{d.value={};let z=l.shape;for(let M of l.keys){let C=z[M],Ie=C._zod.run({value:m[M],issues:[]},h),de=C._zod.optin==="optional"&&C._zod.optout==="optional";Ie instanceof Promise?p.push(Ie.then(mt=>de?T_(mt,d,M,m):fa(mt,d,M))):de?T_(Ie,d,M,m):fa(Ie,d,M)}}if(!u)return p.length?Promise.all(p).then(()=>d):d;let y=[],v=l.keySet,P=u._zod,T=P.def.type;for(let z of Object.keys(m)){if(v.has(z))continue;if(T==="never"){y.push(z);continue}let M=P.run({value:m[z],issues:[]},h);M instanceof Promise?p.push(M.then(C=>fa(C,d,z))):fa(M,d,z)}return y.length&&d.issues.push({code:"unrecognized_keys",keys:y,input:m,inst:e}),p.length?Promise.all(p).then(()=>d):d}});function R_(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(i=>Jt(i,n,Et())))}),t}var ha=x("$ZodUnion",(e,t)=>{ge.init(e,t),be(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),be(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),be(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),be(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Ci(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let o=!1,i=[];for(let s of t.options){let a=s._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)i.push(a),o=!0;else{if(a.issues.length===0)return a;i.push(a)}}return o?Promise.all(i).then(s=>R_(s,r,e,n)):R_(i,r,e,n)}}),jl=x("$ZodDiscriminatedUnion",(e,t)=>{ha.init(e,t);let r=e._zod.parse;be(e._zod,"propValues",()=>{let o={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Ei(()=>{let o=t.options,i=new Map;for(let s of o){let a=s._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(o,i)=>{let s=o.value;if(!$o(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=n.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),o)}}),Il=x("$ZodIntersection",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>z_(r,c,u)):z_(r,i,s)}});function al(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(So(e)&&So(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let s=al(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=al(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function z_(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),qn(e))return e;let n=al(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}var Nl=x("$ZodRecord",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!So(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;r.value={};for(let c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=t.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...lr(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...lr(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)s.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,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=>Jt(u,n,Et())),input:s,path:[s],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:o[s],issues:[]},n);c instanceof Promise?i.push(c.then(u=>{u.issues.length&&r.issues.push(...lr(s,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...lr(s,c.issues)),r.value[a.value]=c.value)}}return i.length?Promise.all(i).then(()=>r):r}});var Ml=x("$ZodEnum",(e,t)=>{ge.init(e,t);let r=zi(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(n=>Hu.has(typeof n)).map(n=>typeof n=="string"?Hr(n):n.toString()).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),Dl=x("$ZodLiteral",(e,t)=>{ge.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Hr(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}});var Al=x("$ZodTransform",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>{let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new kr;return r.value=o,r}}),ql=x("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ci(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,n):r.value===void 0?r:t.innerType._zod.run(r,n)}),Zl=x("$ZodNullable",(e,t)=>{ge.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ci(r.source)}|null)$`):void 0}),be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Ll=x("$ZodDefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>E_(i,t)):E_(o,t)}});function E_(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Fl=x("$ZodPrefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Ul=x("$ZodNonOptional",(e,t)=>{ge.init(e,t),be(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>O_(i,e)):O_(o,e)}});function O_(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Vl=x("$ZodCatch",(e,t)=>{ge.init(e,t),e._zod.optin="optional",be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Jt(s,n,Et()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Jt(i,n,Et()))},input:r.value}),r.issues=[]),r)}});var Hl=x("$ZodPipe",(e,t)=>{ge.init(e,t),be(e._zod,"values",()=>t.in._zod.values),be(e._zod,"optin",()=>t.in._zod.optin),be(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,n)=>{let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>C_(i,t,n)):C_(o,t,n)}});function C_(e,t,r){return qn(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}var Bl=x("$ZodReadonly",(e,t)=>{ge.init(e,t),be(e._zod,"propValues",()=>t.innerType._zod.propValues),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(j_):j_(o)}});function j_(e){return e.value=Object.freeze(e.value),e}var Wl=x("$ZodCustom",(e,t)=>{Ye.init(e,t),ge.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>I_(i,r,n,e));I_(o,r,n,e)}});function I_(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ju(o))}}var tR=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},rR=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(n){return e[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 ${tR(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${ca(n.values[0])}`:`Invalid option: expected one of ${sa(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${sa(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 Z_(){return{localeError:rR()}}var Di=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){let n=r[0];if(this._map.set(t,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,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function L_(){return new Di}var Br=L_();function Jl(e,t){return new e({type:"string",...B(t)})}function Gl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...B(t)})}function ga(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...B(t)})}function Kl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...B(t)})}function Xl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(t)})}function Yl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(t)})}function Ql(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(t)})}function ed(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...B(t)})}function td(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...B(t)})}function rd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(t)})}function nd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...B(t)})}function od(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(t)})}function id(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...B(t)})}function sd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...B(t)})}function ad(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(t)})}function cd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(t)})}function ud(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(t)})}function ld(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(t)})}function dd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(t)})}function fd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...B(t)})}function pd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...B(t)})}function md(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...B(t)})}function hd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...B(t)})}function F_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(t)})}function U_(e,t){return new e({type:"string",format:"date",check:"string_format",...B(t)})}function V_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...B(t)})}function H_(e,t){return new e({type:"string",format:"duration",check:"string_format",...B(t)})}function gd(e,t){return new e({type:"number",checks:[],...B(t)})}function yd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...B(t)})}function _d(e,t){return new e({type:"boolean",...B(t)})}function vd(e,t){return new e({type:"null",...B(t)})}function bd(e){return new e({type:"unknown"})}function wd(e,t){return new e({type:"never",...B(t)})}function ya(e,t){return new il({check:"less_than",...B(t),value:e,inclusive:!1})}function Ai(e,t){return new il({check:"less_than",...B(t),value:e,inclusive:!0})}function _a(e,t){return new sl({check:"greater_than",...B(t),value:e,inclusive:!1})}function qi(e,t){return new sl({check:"greater_than",...B(t),value:e,inclusive:!0})}function va(e,t){return new f_({check:"multiple_of",...B(t),value:e})}function ba(e,t){return new m_({check:"max_length",...B(t),maximum:e})}function ko(e,t){return new h_({check:"min_length",...B(t),minimum:e})}function wa(e,t){return new g_({check:"length_equals",...B(t),length:e})}function xd(e,t){return new y_({check:"string_format",format:"regex",...B(t),pattern:e})}function $d(e){return new __({check:"string_format",format:"lowercase",...B(e)})}function Sd(e){return new v_({check:"string_format",format:"uppercase",...B(e)})}function kd(e,t){return new b_({check:"string_format",format:"includes",...B(t),includes:e})}function Pd(e,t){return new w_({check:"string_format",format:"starts_with",...B(t),prefix:e})}function Td(e,t){return new x_({check:"string_format",format:"ends_with",...B(t),suffix:e})}function Fn(e){return new $_({check:"overwrite",tx:e})}function Rd(e){return Fn(t=>t.normalize(e))}function zd(){return Fn(e=>e.trim())}function Ed(){return Fn(e=>e.toLowerCase())}function Od(){return Fn(e=>e.toUpperCase())}function B_(e,t,r){return new e({type:"array",element:t,...B(r)})}function Cd(e,t,r){let n=B(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function jd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...B(r)})}var xa=class{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??Br,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(t,a);let c=t._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,t],path:r.path},h=t._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 p=m;p.type="string";let{minimum:y,maximum:v,format:P,patterns:T,contentEncoding:z}=t._zod.bag;if(typeof y=="number"&&(p.minLength=y),typeof v=="number"&&(p.maxLength=v),P&&(p.format=i[P]??P,p.format===""&&delete p.format),z&&(p.contentEncoding=z),T&&T.size>0){let M=[...T];M.length===1?p.pattern=M[0].source:M.length>1&&(a.schema.allOf=[...M.map(C=>({...this.target==="draft-7"?{type:"string"}:{},pattern:C.source}))])}break}case"number":{let p=m,{minimum:y,maximum:v,format:P,multipleOf:T,exclusiveMaximum:z,exclusiveMinimum:M}=t._zod.bag;typeof P=="string"&&P.includes("int")?p.type="integer":p.type="number",typeof M=="number"&&(p.exclusiveMinimum=M),typeof y=="number"&&(p.minimum=y,typeof M=="number"&&(M>=y?delete p.minimum:delete p.exclusiveMinimum)),typeof z=="number"&&(p.exclusiveMaximum=z),typeof v=="number"&&(p.maximum=v,typeof z=="number"&&(z<=v?delete p.maximum:delete p.exclusiveMaximum)),typeof T=="number"&&(p.multipleOf=T);break}case"boolean":{let p=m;p.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 p=m,{minimum:y,maximum:v}=t._zod.bag;typeof y=="number"&&(p.minItems=y),typeof v=="number"&&(p.maxItems=v),p.type="array",p.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let p=m;p.type="object",p.properties={};let y=o.shape;for(let T in y)p.properties[T]=this.process(y[T],{...d,path:[...d.path,"properties",T]});let v=new Set(Object.keys(y)),P=new Set([...v].filter(T=>{let z=o.shape[T]._zod;return this.io==="input"?z.optin===void 0:z.optout===void 0}));P.size>0&&(p.required=Array.from(P)),o.catchall?._zod.def.type==="never"?p.additionalProperties=!1:o.catchall?o.catchall&&(p.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{let p=m;p.anyOf=o.options.map((y,v)=>this.process(y,{...d,path:[...d.path,"anyOf",v]}));break}case"intersection":{let p=m,y=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),v=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),P=z=>"allOf"in z&&Object.keys(z).length===1,T=[...P(y)?y.allOf:[y],...P(v)?v.allOf:[v]];p.allOf=T;break}case"tuple":{let p=m;p.type="array";let y=o.items.map((T,z)=>this.process(T,{...d,path:[...d.path,"prefixItems",z]}));if(this.target==="draft-2020-12"?p.prefixItems=y:p.items=y,o.rest){let T=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?p.items=T:p.additionalItems=T}o.rest&&(p.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:v,maximum:P}=t._zod.bag;typeof v=="number"&&(p.minItems=v),typeof P=="number"&&(p.maxItems=P);break}case"record":{let p=m;p.type="object",p.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),p.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 p=m,y=zi(o.entries);y.every(v=>typeof v=="number")&&(p.type="number"),y.every(v=>typeof v=="string")&&(p.type="string"),p.enum=y;break}case"literal":{let p=m,y=[];for(let v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");y.push(Number(v))}else y.push(v);if(y.length!==0)if(y.length===1){let v=y[0];p.type=v===null?"null":typeof v,p.const=v}else y.every(v=>typeof v=="number")&&(p.type="number"),y.every(v=>typeof v=="string")&&(p.type="string"),y.every(v=>typeof v=="boolean")&&(p.type="string"),y.every(v=>v===null)&&(p.type="null"),p.enum=y;break}case"file":{let p=m,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:P,mime:T}=t._zod.bag;v!==void 0&&(y.minLength=v),P!==void 0&&(y.maxLength=P),T?T.length===1?(y.contentMediaType=T[0],Object.assign(p,y)):p.anyOf=T.map(z=>({...y,contentMediaType:z})):Object.assign(p,y);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(o.innerType,d);m.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let p=m;p.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 p;try{p=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=m,y=t._zod.pattern;if(!y)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=y.source;break}case"pipe":{let p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,d),a.ref=p;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 p=t._zod.innerType;this.process(p,d),a.ref=p;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(t);return u&&Object.assign(a.schema,u),this.io==="input"&&Ue(t)&&(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(t).schema}emit(t,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let y=n.external.registry.get(l[0])?.id,v=n.external.uri??(T=>T);if(y)return{ref:v(y)};let P=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=P,{defId:P,ref:`${v("__shared")}#/${d}/${P}`}}if(l[1]===o)return{ref:"#"};let m=`#/${d}/`,p=l[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:m+p}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:h,defId:m}=i(l);d.def={...d.schema},m&&(d.defId=m);let p=d.schema;for(let y in p)delete p[y];p.$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>
|
|
45
|
+
})));`),h.write(`newResult[${An(T)}] = ${R}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");let P=h.compile();return(T,R)=>P(d,T,R)},o,i=$o,s=!ia.jitless,c=s&&Vu.value,u=t.catchall,l;e._zod.parse=(d,h)=>{l??(l=r.value);let m=d.value;if(!i(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;let p=[];if(s&&c&&h?.async===!1&&h.jitless!==!0)o||(o=n(t.shape)),d=o(d,h);else{d.value={};let R=l.shape;for(let I of l.keys){let C=R[I],Me=C._zod.run({value:m[I],issues:[]},h),de=C._zod.optin==="optional"&&C._zod.optout==="optional";Me instanceof Promise?p.push(Me.then(mt=>de?T_(mt,d,I,m):fa(mt,d,I))):de?T_(Me,d,I,m):fa(Me,d,I)}}if(!u)return p.length?Promise.all(p).then(()=>d):d;let y=[],v=l.keySet,P=u._zod,T=P.def.type;for(let R of Object.keys(m)){if(v.has(R))continue;if(T==="never"){y.push(R);continue}let I=P.run({value:m[R],issues:[]},h);I instanceof Promise?p.push(I.then(C=>fa(C,d,R))):fa(I,d,R)}return y.length&&d.issues.push({code:"unrecognized_keys",keys:y,input:m,inst:e}),p.length?Promise.all(p).then(()=>d):d}});function z_(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(i=>Jt(i,n,Et())))}),t}var ha=x("$ZodUnion",(e,t)=>{ge.init(e,t),be(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),be(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),be(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),be(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Ci(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let o=!1,i=[];for(let s of t.options){let a=s._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)i.push(a),o=!0;else{if(a.issues.length===0)return a;i.push(a)}}return o?Promise.all(i).then(s=>z_(s,r,e,n)):z_(i,r,e,n)}}),jl=x("$ZodDiscriminatedUnion",(e,t)=>{ha.init(e,t);let r=e._zod.parse;be(e._zod,"propValues",()=>{let o={};for(let i of t.options){let s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Ei(()=>{let o=t.options,i=new Map;for(let s of o){let a=s._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(o,i)=>{let s=o.value;if(!$o(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=n.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:s,path:[t.discriminator],inst:e}),o)}}),Ml=x("$ZodIntersection",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>R_(r,c,u)):R_(r,i,s)}});function al(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(So(e)&&So(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let s=al(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=al(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function R_(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),qn(e))return e;let n=al(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}var Nl=x("$ZodRecord",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!So(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[];if(t.keyType._zod.values){let s=t.keyType._zod.values;r.value={};for(let c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=t.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...lr(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...lr(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)s.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let a=t.keyType._zod.run({value:s,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=>Jt(u,n,Et())),input:s,path:[s],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:o[s],issues:[]},n);c instanceof Promise?i.push(c.then(u=>{u.issues.length&&r.issues.push(...lr(s,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...lr(s,c.issues)),r.value[a.value]=c.value)}}return i.length?Promise.all(i).then(()=>r):r}});var Il=x("$ZodEnum",(e,t)=>{ge.init(e,t);let r=Ri(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(n=>Hu.has(typeof n)).map(n=>typeof n=="string"?Hr(n):n.toString()).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),Dl=x("$ZodLiteral",(e,t)=>{ge.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Hr(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}});var Al=x("$ZodTransform",(e,t)=>{ge.init(e,t),e._zod.parse=(r,n)=>{let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new kr;return r.value=o,r}}),ql=x("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ci(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,n):r.value===void 0?r:t.innerType._zod.run(r,n)}),Zl=x("$ZodNullable",(e,t)=>{ge.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ci(r.source)}|null)$`):void 0}),be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Ll=x("$ZodDefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>E_(i,t)):E_(o,t)}});function E_(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Fl=x("$ZodPrefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Ul=x("$ZodNonOptional",(e,t)=>{ge.init(e,t),be(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>O_(i,e)):O_(o,e)}});function O_(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Vl=x("$ZodCatch",(e,t)=>{ge.init(e,t),e._zod.optin="optional",be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>Jt(s,n,Et()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Jt(i,n,Et()))},input:r.value}),r.issues=[]),r)}});var Hl=x("$ZodPipe",(e,t)=>{ge.init(e,t),be(e._zod,"values",()=>t.in._zod.values),be(e._zod,"optin",()=>t.in._zod.optin),be(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,n)=>{let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>C_(i,t,n)):C_(o,t,n)}});function C_(e,t,r){return qn(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}var Bl=x("$ZodReadonly",(e,t)=>{ge.init(e,t),be(e._zod,"propValues",()=>t.innerType._zod.propValues),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(j_):j_(o)}});function j_(e){return e.value=Object.freeze(e.value),e}var Wl=x("$ZodCustom",(e,t)=>{Ye.init(e,t),ge.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>M_(i,r,n,e));M_(o,r,n,e)}});function M_(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ju(o))}}var tz=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},rz=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(n){return e[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 ${tz(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${ca(n.values[0])}`:`Invalid option: expected one of ${sa(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${sa(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 Z_(){return{localeError:rz()}}var Di=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){let n=r[0];if(this._map.set(t,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,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function L_(){return new Di}var Br=L_();function Jl(e,t){return new e({type:"string",...B(t)})}function Gl(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...B(t)})}function ga(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...B(t)})}function Kl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...B(t)})}function Xl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...B(t)})}function Yl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...B(t)})}function Ql(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...B(t)})}function ed(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...B(t)})}function td(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...B(t)})}function rd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...B(t)})}function nd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...B(t)})}function od(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...B(t)})}function id(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...B(t)})}function sd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...B(t)})}function ad(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...B(t)})}function cd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...B(t)})}function ud(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...B(t)})}function ld(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...B(t)})}function dd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...B(t)})}function fd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...B(t)})}function pd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...B(t)})}function md(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...B(t)})}function hd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...B(t)})}function F_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...B(t)})}function U_(e,t){return new e({type:"string",format:"date",check:"string_format",...B(t)})}function V_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...B(t)})}function H_(e,t){return new e({type:"string",format:"duration",check:"string_format",...B(t)})}function gd(e,t){return new e({type:"number",checks:[],...B(t)})}function yd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...B(t)})}function _d(e,t){return new e({type:"boolean",...B(t)})}function vd(e,t){return new e({type:"null",...B(t)})}function bd(e){return new e({type:"unknown"})}function wd(e,t){return new e({type:"never",...B(t)})}function ya(e,t){return new il({check:"less_than",...B(t),value:e,inclusive:!1})}function Ai(e,t){return new il({check:"less_than",...B(t),value:e,inclusive:!0})}function _a(e,t){return new sl({check:"greater_than",...B(t),value:e,inclusive:!1})}function qi(e,t){return new sl({check:"greater_than",...B(t),value:e,inclusive:!0})}function va(e,t){return new f_({check:"multiple_of",...B(t),value:e})}function ba(e,t){return new m_({check:"max_length",...B(t),maximum:e})}function ko(e,t){return new h_({check:"min_length",...B(t),minimum:e})}function wa(e,t){return new g_({check:"length_equals",...B(t),length:e})}function xd(e,t){return new y_({check:"string_format",format:"regex",...B(t),pattern:e})}function $d(e){return new __({check:"string_format",format:"lowercase",...B(e)})}function Sd(e){return new v_({check:"string_format",format:"uppercase",...B(e)})}function kd(e,t){return new b_({check:"string_format",format:"includes",...B(t),includes:e})}function Pd(e,t){return new w_({check:"string_format",format:"starts_with",...B(t),prefix:e})}function Td(e,t){return new x_({check:"string_format",format:"ends_with",...B(t),suffix:e})}function Fn(e){return new $_({check:"overwrite",tx:e})}function zd(e){return Fn(t=>t.normalize(e))}function Rd(){return Fn(e=>e.trim())}function Ed(){return Fn(e=>e.toLowerCase())}function Od(){return Fn(e=>e.toUpperCase())}function B_(e,t,r){return new e({type:"array",element:t,...B(r)})}function Cd(e,t,r){let n=B(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function jd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...B(r)})}var xa=class{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??Br,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(t,a);let c=t._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,t],path:r.path},h=t._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 p=m;p.type="string";let{minimum:y,maximum:v,format:P,patterns:T,contentEncoding:R}=t._zod.bag;if(typeof y=="number"&&(p.minLength=y),typeof v=="number"&&(p.maxLength=v),P&&(p.format=i[P]??P,p.format===""&&delete p.format),R&&(p.contentEncoding=R),T&&T.size>0){let I=[...T];I.length===1?p.pattern=I[0].source:I.length>1&&(a.schema.allOf=[...I.map(C=>({...this.target==="draft-7"?{type:"string"}:{},pattern:C.source}))])}break}case"number":{let p=m,{minimum:y,maximum:v,format:P,multipleOf:T,exclusiveMaximum:R,exclusiveMinimum:I}=t._zod.bag;typeof P=="string"&&P.includes("int")?p.type="integer":p.type="number",typeof I=="number"&&(p.exclusiveMinimum=I),typeof y=="number"&&(p.minimum=y,typeof I=="number"&&(I>=y?delete p.minimum:delete p.exclusiveMinimum)),typeof R=="number"&&(p.exclusiveMaximum=R),typeof v=="number"&&(p.maximum=v,typeof R=="number"&&(R<=v?delete p.maximum:delete p.exclusiveMaximum)),typeof T=="number"&&(p.multipleOf=T);break}case"boolean":{let p=m;p.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 p=m,{minimum:y,maximum:v}=t._zod.bag;typeof y=="number"&&(p.minItems=y),typeof v=="number"&&(p.maxItems=v),p.type="array",p.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let p=m;p.type="object",p.properties={};let y=o.shape;for(let T in y)p.properties[T]=this.process(y[T],{...d,path:[...d.path,"properties",T]});let v=new Set(Object.keys(y)),P=new Set([...v].filter(T=>{let R=o.shape[T]._zod;return this.io==="input"?R.optin===void 0:R.optout===void 0}));P.size>0&&(p.required=Array.from(P)),o.catchall?._zod.def.type==="never"?p.additionalProperties=!1:o.catchall?o.catchall&&(p.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{let p=m;p.anyOf=o.options.map((y,v)=>this.process(y,{...d,path:[...d.path,"anyOf",v]}));break}case"intersection":{let p=m,y=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),v=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),P=R=>"allOf"in R&&Object.keys(R).length===1,T=[...P(y)?y.allOf:[y],...P(v)?v.allOf:[v]];p.allOf=T;break}case"tuple":{let p=m;p.type="array";let y=o.items.map((T,R)=>this.process(T,{...d,path:[...d.path,"prefixItems",R]}));if(this.target==="draft-2020-12"?p.prefixItems=y:p.items=y,o.rest){let T=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?p.items=T:p.additionalItems=T}o.rest&&(p.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:v,maximum:P}=t._zod.bag;typeof v=="number"&&(p.minItems=v),typeof P=="number"&&(p.maxItems=P);break}case"record":{let p=m;p.type="object",p.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),p.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 p=m,y=Ri(o.entries);y.every(v=>typeof v=="number")&&(p.type="number"),y.every(v=>typeof v=="string")&&(p.type="string"),p.enum=y;break}case"literal":{let p=m,y=[];for(let v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");y.push(Number(v))}else y.push(v);if(y.length!==0)if(y.length===1){let v=y[0];p.type=v===null?"null":typeof v,p.const=v}else y.every(v=>typeof v=="number")&&(p.type="number"),y.every(v=>typeof v=="string")&&(p.type="string"),y.every(v=>typeof v=="boolean")&&(p.type="string"),y.every(v=>v===null)&&(p.type="null"),p.enum=y;break}case"file":{let p=m,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:P,mime:T}=t._zod.bag;v!==void 0&&(y.minLength=v),P!==void 0&&(y.maxLength=P),T?T.length===1?(y.contentMediaType=T[0],Object.assign(p,y)):p.anyOf=T.map(R=>({...y,contentMediaType:R})):Object.assign(p,y);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(o.innerType,d);m.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let p=m;p.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 p;try{p=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=m,y=t._zod.pattern;if(!y)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=y.source;break}case"pipe":{let p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,d),a.ref=p;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 p=t._zod.innerType;this.process(p,d),a.ref=p;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(t);return u&&Object.assign(a.schema,u),this.io==="input"&&Ue(t)&&(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(t).schema}emit(t,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let i=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let y=n.external.registry.get(l[0])?.id,v=n.external.uri??(T=>T);if(y)return{ref:v(y)};let P=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=P,{defId:P,ref:`${v("__shared")}#/${d}/${P}`}}if(l[1]===o)return{ref:"#"};let m=`#/${d}/`,p=l[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:m+p}},s=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:h,defId:m}=i(l);d.def={...d.schema},m&&(d.defId=m);let p=d.schema;for(let y in p)delete p[y];p.$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>
|
|
46
46
|
|
|
47
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(t===l[0]){s(l);continue}if(n.external){let m=n.external.registry.get(l[0])?.id;if(t!==l[0]&&m){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let h=this.seen.get(l),m=h.def??h.schema,p={...m};if(h.ref===null)return;let y=h.ref;if(h.ref=null,y){a(y,d);let v=this.seen.get(y).schema;v.$ref&&d.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(v)):(Object.assign(m,v),Object.assign(m,p))}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(t)?.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 Id(e,t){if(e instanceof Di){let n=new xa(t),o={};for(let a of e._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:e,uri:t?.uri,defs:o};for(let a of e._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...t,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new xa(t);return r.process(e),r.emit(e,t)}function Ue(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._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 Ue(o.element,r);case"object":{for(let i in o.shape)if(Ue(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(Ue(i,r))return!0;return!1}case"intersection":return Ue(o.left,r)||Ue(o.right,r);case"tuple":{for(let i of o.items)if(Ue(i,r))return!0;return!!(o.rest&&Ue(o.rest,r))}case"record":return Ue(o.keyType,r)||Ue(o.valueType,r);case"map":return Ue(o.keyType,r)||Ue(o.valueType,r);case"set":return Ue(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ue(o.innerType,r);case"lazy":return Ue(o.getter(),r);case"default":return Ue(o.innerType,r);case"prefault":return Ue(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Ue(o.in,r)||Ue(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var DR=x("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ge.init(e,t),e.def=t,e.parse=(r,n)=>Yu(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Zn(e,r,n),e.parseAsync=async(r,n)=>el(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ln(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>Ot(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e))});var AR=x("ZodMiniObject",(e,t)=>{ma.init(e,t),DR.init(e,t),ne.defineLazy(e,"shape",()=>t.shape)});function Nd(e,t){let r={type:"object",get shape(){return ne.assignProp(this,"shape",{...e}),this.shape},...ne.normalizeParams(t)};return new AR(r)}function At(e){return!!e._zod}function Vn(e){let t=Object.values(e);if(t.length===0)return Nd({});let r=t.every(At),n=t.every(o=>!At(o));if(r)return Nd(e);if(n)return Au(e);throw new Error("Mixed Zod versions detected in object shape.")}function Wr(e,t){return At(e)?Zn(e,t):e.safeParse(t)}async function $a(e,t){return At(e)?await Ln(e,t):await e.safeParseAsync(t)}function Jr(e){if(!e)return;let t;if(At(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Po(e){if(e){if(typeof e=="object"){let t=e,r=e;if(!t._def&&!r._zod){let n=Object.values(e);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 Vn(e)}}if(At(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function Sa(e){if(e&&typeof e=="object"){if("message"in e&&typeof e.message=="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t=="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function J_(e){return e.description}function G_(e){if(At(e))return e._zod?.def?.type==="optional";let t=e;return typeof e.isOptional=="function"?e.isOptional():t._def?.typeName==="ZodOptional"}function ka(e){if(At(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var Zi={};Ys(Zi,{ZodISODate:()=>X_,ZodISODateTime:()=>K_,ZodISODuration:()=>Q_,ZodISOTime:()=>Y_,date:()=>Dd,datetime:()=>Md,duration:()=>qd,time:()=>Ad});var K_=x("ZodISODateTime",(e,t)=>{N_.init(e,t),Ee.init(e,t)});function Md(e){return F_(K_,e)}var X_=x("ZodISODate",(e,t)=>{M_.init(e,t),Ee.init(e,t)});function Dd(e){return U_(X_,e)}var Y_=x("ZodISOTime",(e,t)=>{D_.init(e,t),Ee.init(e,t)});function Ad(e){return V_(Y_,e)}var Q_=x("ZodISODuration",(e,t)=>{A_.init(e,t),Ee.init(e,t)});function qd(e){return H_(Q_,e)}var ev=(e,t)=>{ua.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ku(e,r)},flatten:{value:r=>Gu(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},PZ=x("ZodError",ev),Li=x("ZodError",ev,{Parent:Error});var tv=Xu(Li),rv=Qu(Li),nv=tl(Li),ov=rl(Li);var Me=x("ZodType",(e,t)=>(ge.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>Ot(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>tv(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>nv(e,r,n),e.parseAsync=async(r,n)=>rv(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ov(e,r,n),e.spa=e.safeParseAsync,e.refine=(r,n)=>e.check(Nz(r,n)),e.superRefine=r=>e.check(Mz(r)),e.overwrite=r=>e.check(Fn(r)),e.optional=()=>Ce(e),e.nullable=()=>av(e),e.nullish=()=>Ce(av(e)),e.nonoptional=r=>Rz(e,r),e.array=()=>oe(e),e.or=r=>ke([e,r]),e.and=r=>Ta(e,r),e.transform=r=>Ld(e,pv(r)),e.default=r=>kz(e,r),e.prefault=r=>Tz(e,r),e.catch=r=>Ez(e,r),e.pipe=r=>Ld(e,r),e.readonly=()=>jz(e),e.describe=r=>{let n=e.clone();return Br.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Br.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Br.get(e);let n=e.clone();return Br.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),cv=x("_ZodString",(e,t)=>{Mi.init(e,t),Me.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(xd(...n)),e.includes=(...n)=>e.check(kd(...n)),e.startsWith=(...n)=>e.check(Pd(...n)),e.endsWith=(...n)=>e.check(Td(...n)),e.min=(...n)=>e.check(ko(...n)),e.max=(...n)=>e.check(ba(...n)),e.length=(...n)=>e.check(wa(...n)),e.nonempty=(...n)=>e.check(ko(1,...n)),e.lowercase=n=>e.check($d(n)),e.uppercase=n=>e.check(Sd(n)),e.trim=()=>e.check(zd()),e.normalize=(...n)=>e.check(Rd(...n)),e.toLowerCase=()=>e.check(Ed()),e.toUpperCase=()=>e.check(Od())}),WR=x("ZodString",(e,t)=>{Mi.init(e,t),cv.init(e,t),e.email=r=>e.check(Gl(JR,r)),e.url=r=>e.check(ed(GR,r)),e.jwt=r=>e.check(hd(lz,r)),e.emoji=r=>e.check(td(KR,r)),e.guid=r=>e.check(ga(iv,r)),e.uuid=r=>e.check(Kl(Pa,r)),e.uuidv4=r=>e.check(Xl(Pa,r)),e.uuidv6=r=>e.check(Yl(Pa,r)),e.uuidv7=r=>e.check(Ql(Pa,r)),e.nanoid=r=>e.check(rd(XR,r)),e.guid=r=>e.check(ga(iv,r)),e.cuid=r=>e.check(nd(YR,r)),e.cuid2=r=>e.check(od(QR,r)),e.ulid=r=>e.check(id(ez,r)),e.base64=r=>e.check(fd(az,r)),e.base64url=r=>e.check(pd(cz,r)),e.xid=r=>e.check(sd(tz,r)),e.ksuid=r=>e.check(ad(rz,r)),e.ipv4=r=>e.check(cd(nz,r)),e.ipv6=r=>e.check(ud(oz,r)),e.cidrv4=r=>e.check(ld(iz,r)),e.cidrv6=r=>e.check(dd(sz,r)),e.e164=r=>e.check(md(uz,r)),e.datetime=r=>e.check(Md(r)),e.date=r=>e.check(Dd(r)),e.time=r=>e.check(Ad(r)),e.duration=r=>e.check(qd(r))});function b(e){return Jl(WR,e)}var Ee=x("ZodStringFormat",(e,t)=>{we.init(e,t),cv.init(e,t)}),JR=x("ZodEmail",(e,t)=>{ll.init(e,t),Ee.init(e,t)});var iv=x("ZodGUID",(e,t)=>{cl.init(e,t),Ee.init(e,t)});var Pa=x("ZodUUID",(e,t)=>{ul.init(e,t),Ee.init(e,t)});var GR=x("ZodURL",(e,t)=>{dl.init(e,t),Ee.init(e,t)});var KR=x("ZodEmoji",(e,t)=>{fl.init(e,t),Ee.init(e,t)});var XR=x("ZodNanoID",(e,t)=>{pl.init(e,t),Ee.init(e,t)});var YR=x("ZodCUID",(e,t)=>{ml.init(e,t),Ee.init(e,t)});var QR=x("ZodCUID2",(e,t)=>{hl.init(e,t),Ee.init(e,t)});var ez=x("ZodULID",(e,t)=>{gl.init(e,t),Ee.init(e,t)});var tz=x("ZodXID",(e,t)=>{yl.init(e,t),Ee.init(e,t)});var rz=x("ZodKSUID",(e,t)=>{_l.init(e,t),Ee.init(e,t)});var nz=x("ZodIPv4",(e,t)=>{vl.init(e,t),Ee.init(e,t)});var oz=x("ZodIPv6",(e,t)=>{bl.init(e,t),Ee.init(e,t)});var iz=x("ZodCIDRv4",(e,t)=>{wl.init(e,t),Ee.init(e,t)});var sz=x("ZodCIDRv6",(e,t)=>{xl.init(e,t),Ee.init(e,t)});var az=x("ZodBase64",(e,t)=>{$l.init(e,t),Ee.init(e,t)});var cz=x("ZodBase64URL",(e,t)=>{Sl.init(e,t),Ee.init(e,t)});var uz=x("ZodE164",(e,t)=>{kl.init(e,t),Ee.init(e,t)});var lz=x("ZodJWT",(e,t)=>{Pl.init(e,t),Ee.init(e,t)});var uv=x("ZodNumber",(e,t)=>{pa.init(e,t),Me.init(e,t),e.gt=(n,o)=>e.check(_a(n,o)),e.gte=(n,o)=>e.check(qi(n,o)),e.min=(n,o)=>e.check(qi(n,o)),e.lt=(n,o)=>e.check(ya(n,o)),e.lte=(n,o)=>e.check(Ai(n,o)),e.max=(n,o)=>e.check(Ai(n,o)),e.int=n=>e.check(sv(n)),e.safe=n=>e.check(sv(n)),e.positive=n=>e.check(_a(0,n)),e.nonnegative=n=>e.check(qi(0,n)),e.negative=n=>e.check(ya(0,n)),e.nonpositive=n=>e.check(Ai(0,n)),e.multipleOf=(n,o)=>e.check(va(n,o)),e.step=(n,o)=>e.check(va(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function me(e){return gd(uv,e)}var dz=x("ZodNumberFormat",(e,t)=>{Tl.init(e,t),uv.init(e,t)});function sv(e){return yd(dz,e)}var fz=x("ZodBoolean",(e,t)=>{Rl.init(e,t),Me.init(e,t)});function Be(e){return _d(fz,e)}var pz=x("ZodNull",(e,t)=>{zl.init(e,t),Me.init(e,t)});function lv(e){return vd(pz,e)}var mz=x("ZodUnknown",(e,t)=>{El.init(e,t),Me.init(e,t)});function Oe(){return bd(mz)}var hz=x("ZodNever",(e,t)=>{Ol.init(e,t),Me.init(e,t)});function gz(e){return wd(hz,e)}var yz=x("ZodArray",(e,t)=>{Cl.init(e,t),Me.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(ko(r,n)),e.nonempty=r=>e.check(ko(1,r)),e.max=(r,n)=>e.check(ba(r,n)),e.length=(r,n)=>e.check(wa(r,n)),e.unwrap=()=>e.element});function oe(e,t){return B_(yz,e,t)}var dv=x("ZodObject",(e,t)=>{ma.init(e,t),Me.init(e,t),ne.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>xt(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Oe()}),e.loose=()=>e.clone({...e._zod.def,catchall:Oe()}),e.strict=()=>e.clone({...e._zod.def,catchall:gz()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>ne.extend(e,r),e.merge=r=>ne.merge(e,r),e.pick=r=>ne.pick(e,r),e.omit=r=>ne.omit(e,r),e.partial=(...r)=>ne.partial(mv,e,r[0]),e.required=(...r)=>ne.required(hv,e,r[0])});function N(e,t){let r={type:"object",get shape(){return ne.assignProp(this,"shape",{...e}),this.shape},...ne.normalizeParams(t)};return new dv(r)}function ht(e,t){return new dv({type:"object",get shape(){return ne.assignProp(this,"shape",{...e}),this.shape},catchall:Oe(),...ne.normalizeParams(t)})}var fv=x("ZodUnion",(e,t)=>{ha.init(e,t),Me.init(e,t),e.options=t.options});function ke(e,t){return new fv({type:"union",options:e,...ne.normalizeParams(t)})}var _z=x("ZodDiscriminatedUnion",(e,t)=>{fv.init(e,t),jl.init(e,t)});function Fd(e,t,r){return new _z({type:"union",options:t,discriminator:e,...ne.normalizeParams(r)})}var vz=x("ZodIntersection",(e,t)=>{Il.init(e,t),Me.init(e,t)});function Ta(e,t){return new vz({type:"intersection",left:e,right:t})}var bz=x("ZodRecord",(e,t)=>{Nl.init(e,t),Me.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function xe(e,t,r){return new bz({type:"record",keyType:e,valueType:t,...ne.normalizeParams(r)})}var Zd=x("ZodEnum",(e,t)=>{Ml.init(e,t),Me.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...t,checks:[],...ne.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...t,checks:[],...ne.normalizeParams(o),entries:i})}});function xt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Zd({type:"enum",entries:r,...ne.normalizeParams(t)})}var wz=x("ZodLiteral",(e,t)=>{Dl.init(e,t),Me.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function L(e,t){return new wz({type:"literal",values:Array.isArray(e)?e:[e],...ne.normalizeParams(t)})}var xz=x("ZodTransform",(e,t)=>{Al.init(e,t),Me.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(ne.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),r.issues.push(ne.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function pv(e){return new xz({type:"transform",transform:e})}var mv=x("ZodOptional",(e,t)=>{ql.init(e,t),Me.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ce(e){return new mv({type:"optional",innerType:e})}var $z=x("ZodNullable",(e,t)=>{Zl.init(e,t),Me.init(e,t),e.unwrap=()=>e._zod.def.innerType});function av(e){return new $z({type:"nullable",innerType:e})}var Sz=x("ZodDefault",(e,t)=>{Ll.init(e,t),Me.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kz(e,t){return new Sz({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var Pz=x("ZodPrefault",(e,t)=>{Fl.init(e,t),Me.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Tz(e,t){return new Pz({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var hv=x("ZodNonOptional",(e,t)=>{Ul.init(e,t),Me.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Rz(e,t){return new hv({type:"nonoptional",innerType:e,...ne.normalizeParams(t)})}var zz=x("ZodCatch",(e,t)=>{Vl.init(e,t),Me.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ez(e,t){return new zz({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Oz=x("ZodPipe",(e,t)=>{Hl.init(e,t),Me.init(e,t),e.in=t.in,e.out=t.out});function Ld(e,t){return new Oz({type:"pipe",in:e,out:t})}var Cz=x("ZodReadonly",(e,t)=>{Bl.init(e,t),Me.init(e,t)});function jz(e){return new Cz({type:"readonly",innerType:e})}var gv=x("ZodCustom",(e,t)=>{Wl.init(e,t),Me.init(e,t)});function Iz(e){let t=new Ye({check:"custom"});return t._zod.check=e,t}function yv(e,t){return Cd(gv,e??(()=>!0),t)}function Nz(e,t={}){return jd(gv,e,t)}function Mz(e){let t=Iz(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(ne.issue(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(ne.issue(o))}},e(r.value,r)));return t}function Ud(e,t){return Ld(pv(e),t)}Et(Z_());var Hd="2025-11-25";var _v=[Hd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Gr="io.modelcontextprotocol/related-task",za="2.0",Ve=yv(e=>e!==null&&(typeof e=="object"||typeof e=="function")),vv=ke([b(),me().int()]),bv=b(),ZZ=ht({ttl:me().optional(),pollInterval:me().optional()}),Dz=N({ttl:me().optional()}),Az=N({taskId:b()}),Bd=ht({progressToken:vv.optional(),[Gr]:Az.optional()}),Ct=N({_meta:Bd.optional()}),Fi=Ct.extend({task:Dz.optional()}),wv=e=>Fi.safeParse(e).success,Qe=N({method:b(),params:Ct.loose().optional()}),qt=N({_meta:Bd.optional()}),Zt=N({method:b(),params:qt.loose().optional()}),et=ht({_meta:Bd.optional()}),Ea=ke([b(),me().int()]),xv=N({jsonrpc:L(za),id:Ea,...Qe.shape}).strict(),Wd=e=>xv.safeParse(e).success,$v=N({jsonrpc:L(za),...Zt.shape}).strict(),Sv=e=>$v.safeParse(e).success,Jd=N({jsonrpc:L(za),id:Ea,result:et}).strict(),Ui=e=>Jd.safeParse(e).success;var U;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(U||(U={}));var Gd=N({jsonrpc:L(za),id:Ea.optional(),error:N({code:me().int(),message:b(),data:Oe().optional()})}).strict();var kv=e=>Gd.safeParse(e).success;var Pv=ke([xv,$v,Jd,Gd]),LZ=ke([Jd,Gd]),Oa=et.strict(),qz=qt.extend({requestId:Ea.optional(),reason:b().optional()}),Ca=Zt.extend({method:L("notifications/cancelled"),params:qz}),Zz=N({src:b(),mimeType:b().optional(),sizes:oe(b()).optional(),theme:xt(["light","dark"]).optional()}),Vi=N({icons:oe(Zz).optional()}),To=N({name:b(),title:b().optional()}),Tv=To.extend({...To.shape,...Vi.shape,version:b(),websiteUrl:b().optional(),description:b().optional()}),Lz=Ta(N({applyDefaults:Be().optional()}),xe(b(),Oe())),Fz=Ud(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ta(N({form:Lz.optional(),url:Ve.optional()}),xe(b(),Oe()).optional())),Uz=ht({list:Ve.optional(),cancel:Ve.optional(),requests:ht({sampling:ht({createMessage:Ve.optional()}).optional(),elicitation:ht({create:Ve.optional()}).optional()}).optional()}),Vz=ht({list:Ve.optional(),cancel:Ve.optional(),requests:ht({tools:ht({call:Ve.optional()}).optional()}).optional()}),Hz=N({experimental:xe(b(),Ve).optional(),sampling:N({context:Ve.optional(),tools:Ve.optional()}).optional(),elicitation:Fz.optional(),roots:N({listChanged:Be().optional()}).optional(),tasks:Uz.optional(),extensions:xe(b(),Ve).optional()}),Bz=Ct.extend({protocolVersion:b(),capabilities:Hz,clientInfo:Tv}),Kd=Qe.extend({method:L("initialize"),params:Bz});var Wz=N({experimental:xe(b(),Ve).optional(),logging:Ve.optional(),completions:Ve.optional(),prompts:N({listChanged:Be().optional()}).optional(),resources:N({subscribe:Be().optional(),listChanged:Be().optional()}).optional(),tools:N({listChanged:Be().optional()}).optional(),tasks:Vz.optional(),extensions:xe(b(),Ve).optional()}),Jz=et.extend({protocolVersion:b(),capabilities:Wz,serverInfo:Tv,instructions:b().optional()}),Xd=Zt.extend({method:L("notifications/initialized"),params:qt.optional()});var ja=Qe.extend({method:L("ping"),params:Ct.optional()}),Gz=N({progress:me(),total:Ce(me()),message:Ce(b())}),Kz=N({...qt.shape,...Gz.shape,progressToken:vv}),Ia=Zt.extend({method:L("notifications/progress"),params:Kz}),Xz=Ct.extend({cursor:bv.optional()}),Hi=Qe.extend({params:Xz.optional()}),Bi=et.extend({nextCursor:bv.optional()}),Yz=xt(["working","input_required","completed","failed","cancelled"]),Wi=N({taskId:b(),status:Yz,ttl:ke([me(),lv()]),createdAt:b(),lastUpdatedAt:b(),pollInterval:Ce(me()),statusMessage:Ce(b())}),Ro=et.extend({task:Wi}),Qz=qt.merge(Wi),Ji=Zt.extend({method:L("notifications/tasks/status"),params:Qz}),Na=Qe.extend({method:L("tasks/get"),params:Ct.extend({taskId:b()})}),Ma=et.merge(Wi),Da=Qe.extend({method:L("tasks/result"),params:Ct.extend({taskId:b()})}),FZ=et.loose(),Aa=Hi.extend({method:L("tasks/list")}),qa=Bi.extend({tasks:oe(Wi)}),Za=Qe.extend({method:L("tasks/cancel"),params:Ct.extend({taskId:b()})}),Rv=et.merge(Wi),zv=N({uri:b(),mimeType:Ce(b()),_meta:xe(b(),Oe()).optional()}),Ev=zv.extend({text:b()}),Yd=b().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ov=zv.extend({blob:Yd}),Gi=xt(["user","assistant"]),zo=N({audience:oe(Gi).optional(),priority:me().min(0).max(1).optional(),lastModified:Zi.datetime({offset:!0}).optional()}),Cv=N({...To.shape,...Vi.shape,uri:b(),description:Ce(b()),mimeType:Ce(b()),size:Ce(me()),annotations:zo.optional(),_meta:Ce(ht({}))}),eE=N({...To.shape,...Vi.shape,uriTemplate:b(),description:Ce(b()),mimeType:Ce(b()),annotations:zo.optional(),_meta:Ce(ht({}))}),La=Hi.extend({method:L("resources/list")}),tE=Bi.extend({resources:oe(Cv)}),Fa=Hi.extend({method:L("resources/templates/list")}),rE=Bi.extend({resourceTemplates:oe(eE)}),Qd=Ct.extend({uri:b()}),nE=Qd,Ua=Qe.extend({method:L("resources/read"),params:nE}),oE=et.extend({contents:oe(ke([Ev,Ov]))}),iE=Zt.extend({method:L("notifications/resources/list_changed"),params:qt.optional()}),sE=Qd,aE=Qe.extend({method:L("resources/subscribe"),params:sE}),cE=Qd,uE=Qe.extend({method:L("resources/unsubscribe"),params:cE}),lE=qt.extend({uri:b()}),dE=Zt.extend({method:L("notifications/resources/updated"),params:lE}),fE=N({name:b(),description:Ce(b()),required:Ce(Be())}),pE=N({...To.shape,...Vi.shape,description:Ce(b()),arguments:Ce(oe(fE)),_meta:Ce(ht({}))}),Va=Hi.extend({method:L("prompts/list")}),mE=Bi.extend({prompts:oe(pE)}),hE=Ct.extend({name:b(),arguments:xe(b(),b()).optional()}),Ha=Qe.extend({method:L("prompts/get"),params:hE}),ef=N({type:L("text"),text:b(),annotations:zo.optional(),_meta:xe(b(),Oe()).optional()}),tf=N({type:L("image"),data:Yd,mimeType:b(),annotations:zo.optional(),_meta:xe(b(),Oe()).optional()}),rf=N({type:L("audio"),data:Yd,mimeType:b(),annotations:zo.optional(),_meta:xe(b(),Oe()).optional()}),gE=N({type:L("tool_use"),name:b(),id:b(),input:xe(b(),Oe()),_meta:xe(b(),Oe()).optional()}),yE=N({type:L("resource"),resource:ke([Ev,Ov]),annotations:zo.optional(),_meta:xe(b(),Oe()).optional()}),_E=Cv.extend({type:L("resource_link")}),nf=ke([ef,tf,rf,_E,yE]),vE=N({role:Gi,content:nf}),bE=et.extend({description:b().optional(),messages:oe(vE)}),wE=Zt.extend({method:L("notifications/prompts/list_changed"),params:qt.optional()}),xE=N({title:b().optional(),readOnlyHint:Be().optional(),destructiveHint:Be().optional(),idempotentHint:Be().optional(),openWorldHint:Be().optional()}),$E=N({taskSupport:xt(["required","optional","forbidden"]).optional()}),jv=N({...To.shape,...Vi.shape,description:b().optional(),inputSchema:N({type:L("object"),properties:xe(b(),Ve).optional(),required:oe(b()).optional()}).catchall(Oe()),outputSchema:N({type:L("object"),properties:xe(b(),Ve).optional(),required:oe(b()).optional()}).catchall(Oe()).optional(),annotations:xE.optional(),execution:$E.optional(),_meta:xe(b(),Oe()).optional()}),Ba=Hi.extend({method:L("tools/list")}),SE=Bi.extend({tools:oe(jv)}),Wa=et.extend({content:oe(nf).default([]),structuredContent:xe(b(),Oe()).optional(),isError:Be().optional()}),UZ=Wa.or(et.extend({toolResult:Oe()})),kE=Fi.extend({name:b(),arguments:xe(b(),Oe()).optional()}),Eo=Qe.extend({method:L("tools/call"),params:kE}),PE=Zt.extend({method:L("notifications/tools/list_changed"),params:qt.optional()}),VZ=N({autoRefresh:Be().default(!0),debounceMs:me().int().nonnegative().default(300)}),Ki=xt(["debug","info","notice","warning","error","critical","alert","emergency"]),TE=Ct.extend({level:Ki}),of=Qe.extend({method:L("logging/setLevel"),params:TE}),RE=qt.extend({level:Ki,logger:b().optional(),data:Oe()}),zE=Zt.extend({method:L("notifications/message"),params:RE}),EE=N({name:b().optional()}),OE=N({hints:oe(EE).optional(),costPriority:me().min(0).max(1).optional(),speedPriority:me().min(0).max(1).optional(),intelligencePriority:me().min(0).max(1).optional()}),CE=N({mode:xt(["auto","required","none"]).optional()}),jE=N({type:L("tool_result"),toolUseId:b().describe("The unique identifier for the corresponding tool call."),content:oe(nf).default([]),structuredContent:N({}).loose().optional(),isError:Be().optional(),_meta:xe(b(),Oe()).optional()}),IE=Fd("type",[ef,tf,rf]),Ra=Fd("type",[ef,tf,rf,gE,jE]),NE=N({role:Gi,content:ke([Ra,oe(Ra)]),_meta:xe(b(),Oe()).optional()}),ME=Fi.extend({messages:oe(NE),modelPreferences:OE.optional(),systemPrompt:b().optional(),includeContext:xt(["none","thisServer","allServers"]).optional(),temperature:me().optional(),maxTokens:me().int(),stopSequences:oe(b()).optional(),metadata:Ve.optional(),tools:oe(jv).optional(),toolChoice:CE.optional()}),DE=Qe.extend({method:L("sampling/createMessage"),params:ME}),Xi=et.extend({model:b(),stopReason:Ce(xt(["endTurn","stopSequence","maxTokens"]).or(b())),role:Gi,content:IE}),sf=et.extend({model:b(),stopReason:Ce(xt(["endTurn","stopSequence","maxTokens","toolUse"]).or(b())),role:Gi,content:ke([Ra,oe(Ra)])}),AE=N({type:L("boolean"),title:b().optional(),description:b().optional(),default:Be().optional()}),qE=N({type:L("string"),title:b().optional(),description:b().optional(),minLength:me().optional(),maxLength:me().optional(),format:xt(["email","uri","date","date-time"]).optional(),default:b().optional()}),ZE=N({type:xt(["number","integer"]),title:b().optional(),description:b().optional(),minimum:me().optional(),maximum:me().optional(),default:me().optional()}),LE=N({type:L("string"),title:b().optional(),description:b().optional(),enum:oe(b()),default:b().optional()}),FE=N({type:L("string"),title:b().optional(),description:b().optional(),oneOf:oe(N({const:b(),title:b()})),default:b().optional()}),UE=N({type:L("string"),title:b().optional(),description:b().optional(),enum:oe(b()),enumNames:oe(b()).optional(),default:b().optional()}),VE=ke([LE,FE]),HE=N({type:L("array"),title:b().optional(),description:b().optional(),minItems:me().optional(),maxItems:me().optional(),items:N({type:L("string"),enum:oe(b())}),default:oe(b()).optional()}),BE=N({type:L("array"),title:b().optional(),description:b().optional(),minItems:me().optional(),maxItems:me().optional(),items:N({anyOf:oe(N({const:b(),title:b()}))}),default:oe(b()).optional()}),WE=ke([HE,BE]),JE=ke([UE,VE,WE]),GE=ke([JE,AE,qE,ZE]),KE=Fi.extend({mode:L("form").optional(),message:b(),requestedSchema:N({type:L("object"),properties:xe(b(),GE),required:oe(b()).optional()})}),XE=Fi.extend({mode:L("url"),message:b(),elicitationId:b(),url:b().url()}),YE=ke([KE,XE]),QE=Qe.extend({method:L("elicitation/create"),params:YE}),eO=qt.extend({elicitationId:b()}),tO=Zt.extend({method:L("notifications/elicitation/complete"),params:eO}),Oo=et.extend({action:xt(["accept","decline","cancel"]),content:Ud(e=>e===null?void 0:e,xe(b(),ke([b(),me(),Be(),oe(b())])).optional())}),rO=N({type:L("ref/resource"),uri:b()});var nO=N({type:L("ref/prompt"),name:b()}),oO=Ct.extend({ref:ke([nO,rO]),argument:N({name:b(),value:b()}),context:N({arguments:xe(b(),b()).optional()}).optional()}),Ja=Qe.extend({method:L("completion/complete"),params:oO});function Iv(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Nv(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var iO=et.extend({completion:ht({values:oe(b()).max(100),total:Ce(me().int()),hasMore:Ce(Be())})}),sO=N({uri:b().startsWith("file://"),name:b().optional(),_meta:xe(b(),Oe()).optional()}),aO=Qe.extend({method:L("roots/list"),params:Ct.optional()}),af=et.extend({roots:oe(sO)}),cO=Zt.extend({method:L("notifications/roots/list_changed"),params:qt.optional()}),HZ=ke([ja,Kd,Ja,of,Ha,Va,La,Fa,Ua,aE,uE,Eo,Ba,Na,Da,Aa,Za]),BZ=ke([Ca,Ia,Xd,cO,Ji]),WZ=ke([Oa,Xi,sf,Oo,af,Ma,qa,Ro]),JZ=ke([ja,DE,QE,aO,Na,Da,Aa,Za]),GZ=ke([Ca,Ia,zE,dE,iE,PE,wE,Ji,tO]),KZ=ke([Oa,Jz,iO,bE,mE,tE,rE,oE,Wa,SE,Ma,qa,Ro]),Z=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===U.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Vd(o.elicitations,r)}return new e(t,r,n)}},Vd=class extends Z{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(U.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Kr(e){return e==="completed"||e==="failed"||e==="cancelled"}var Dv=Symbol("Let zodToJsonSchema decide on which parser to use");var Mv={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"},Av=e=>typeof e=="string"?{...Mv,name:e}:{...Mv,...e};var qv=e=>{let t=Av(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function cf(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function ie(e,t,r,n,o){e[t]=r,cf(e,t,n,o)}var Ga=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function je(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Ga(t,e.currentPath):t.join("/")}}function Zv(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==E.ZodAny&&(r.items=W(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&ie(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&ie(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(ie(r,"minItems",e.exactLength.value,e.exactLength.message,t),ie(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function Lv(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?ie(r,"minimum",n.value,n.message,t):ie(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),ie(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?ie(r,"maximum",n.value,n.message,t):ie(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),ie(r,"maximum",n.value,n.message,t));break;case"multipleOf":ie(r,"multipleOf",n.value,n.message,t);break}return r}function Fv(){return{type:"boolean"}}function Ka(e,t){return W(e.type._def,t)}var Uv=(e,t)=>W(e.innerType._def,t);function uf(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>uf(e,t,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 uO(e,t)}}var uO=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":ie(r,"minimum",n.value,n.message,t);break;case"max":ie(r,"maximum",n.value,n.message,t);break}return r};function Vv(e,t){return{...W(e.innerType._def,t),default:e.defaultValue()}}function Hv(e,t){return t.effectStrategy==="input"?W(e.schema._def,t):je(t)}function Bv(e){return{type:"string",enum:Array.from(e.values)}}var lO=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Wv(e,t){let r=[W(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),W(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(lO(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function Jv(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var lf,Gt={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:()=>(lf===void 0&&(lf=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),lf),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 Xa(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Kt(r,"email",n.message,t);break;case"format:idn-email":Kt(r,"idn-email",n.message,t);break;case"pattern:zod":gt(r,Gt.email,n.message,t);break}break;case"url":Kt(r,"uri",n.message,t);break;case"uuid":Kt(r,"uuid",n.message,t);break;case"regex":gt(r,n.regex,n.message,t);break;case"cuid":gt(r,Gt.cuid,n.message,t);break;case"cuid2":gt(r,Gt.cuid2,n.message,t);break;case"startsWith":gt(r,RegExp(`^${df(n.value,t)}`),n.message,t);break;case"endsWith":gt(r,RegExp(`${df(n.value,t)}$`),n.message,t);break;case"datetime":Kt(r,"date-time",n.message,t);break;case"date":Kt(r,"date",n.message,t);break;case"time":Kt(r,"time",n.message,t);break;case"duration":Kt(r,"duration",n.message,t);break;case"length":ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{gt(r,RegExp(df(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Kt(r,"ipv4",n.message,t),n.version!=="v4"&&Kt(r,"ipv6",n.message,t);break}case"base64url":gt(r,Gt.base64url,n.message,t);break;case"jwt":gt(r,Gt.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&>(r,Gt.ipv4Cidr,n.message,t),n.version!=="v4"&>(r,Gt.ipv6Cidr,n.message,t);break}case"emoji":gt(r,Gt.emoji(),n.message,t);break;case"ulid":{gt(r,Gt.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Kt(r,"binary",n.message,t);break}case"contentEncoding:base64":{ie(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{gt(r,Gt.base64,n.message,t);break}}break}case"nanoid":gt(r,Gt.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function df(e,t){return t.patternStrategy==="escape"?fO(e):e}var dO=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fO(e){let t="";for(let r=0;r<e.length;r++)dO.has(e[r])||(t+="\\"),t+=e[r];return t}function Kt(e,t,r,n){e.format||e.anyOf?.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):ie(e,"format",t,r,n)}function gt(e,t,r,n){e.pattern||e.allOf?.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:Gv(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):ie(e,"pattern",Gv(t,n),r,n)}function Gv(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",i=!1,s=!1,a=!1;for(let c=0;c<n.length;c++){if(i){o+=n[c],i=!1;continue}if(r.i){if(s){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
|
|
47
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(t===l[0]){s(l);continue}if(n.external){let m=n.external.registry.get(l[0])?.id;if(t!==l[0]&&m){s(l);continue}}if(this.metadataRegistry.get(l[0])?.id){s(l);continue}if(d.cycle){s(l);continue}if(d.count>1&&n.reused==="ref"){s(l);continue}}let a=(l,d)=>{let h=this.seen.get(l),m=h.def??h.schema,p={...m};if(h.ref===null)return;let y=h.ref;if(h.ref=null,y){a(y,d);let v=this.seen.get(y).schema;v.$ref&&d.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(v)):(Object.assign(m,v),Object.assign(m,p))}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(t)?.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 Md(e,t){if(e instanceof Di){let n=new xa(t),o={};for(let a of e._idmap.entries()){let[c,u]=a;n.process(u)}let i={},s={registry:e,uri:t?.uri,defs:o};for(let a of e._idmap.entries()){let[c,u]=a;i[c]=n.emit(u,{...t,external:s})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}let r=new xa(t);return r.process(e),r.emit(e,t)}function Ue(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._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 Ue(o.element,r);case"object":{for(let i in o.shape)if(Ue(o.shape[i],r))return!0;return!1}case"union":{for(let i of o.options)if(Ue(i,r))return!0;return!1}case"intersection":return Ue(o.left,r)||Ue(o.right,r);case"tuple":{for(let i of o.items)if(Ue(i,r))return!0;return!!(o.rest&&Ue(o.rest,r))}case"record":return Ue(o.keyType,r)||Ue(o.valueType,r);case"map":return Ue(o.keyType,r)||Ue(o.valueType,r);case"set":return Ue(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ue(o.innerType,r);case"lazy":return Ue(o.getter(),r);case"default":return Ue(o.innerType,r);case"prefault":return Ue(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Ue(o.in,r)||Ue(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var Dz=x("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");ge.init(e,t),e.def=t,e.parse=(r,n)=>Yu(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Zn(e,r,n),e.parseAsync=async(r,n)=>el(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ln(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>Ot(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e))});var Az=x("ZodMiniObject",(e,t)=>{ma.init(e,t),Dz.init(e,t),ne.defineLazy(e,"shape",()=>t.shape)});function Nd(e,t){let r={type:"object",get shape(){return ne.assignProp(this,"shape",{...e}),this.shape},...ne.normalizeParams(t)};return new Az(r)}function At(e){return!!e._zod}function Vn(e){let t=Object.values(e);if(t.length===0)return Nd({});let r=t.every(At),n=t.every(o=>!At(o));if(r)return Nd(e);if(n)return Au(e);throw new Error("Mixed Zod versions detected in object shape.")}function Wr(e,t){return At(e)?Zn(e,t):e.safeParse(t)}async function $a(e,t){return At(e)?await Ln(e,t):await e.safeParseAsync(t)}function Jr(e){if(!e)return;let t;if(At(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Po(e){if(e){if(typeof e=="object"){let t=e,r=e;if(!t._def&&!r._zod){let n=Object.values(e);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 Vn(e)}}if(At(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function Sa(e){if(e&&typeof e=="object"){if("message"in e&&typeof e.message=="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t=="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function J_(e){return e.description}function G_(e){if(At(e))return e._zod?.def?.type==="optional";let t=e;return typeof e.isOptional=="function"?e.isOptional():t._def?.typeName==="ZodOptional"}function ka(e){if(At(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var Zi={};Ys(Zi,{ZodISODate:()=>X_,ZodISODateTime:()=>K_,ZodISODuration:()=>Q_,ZodISOTime:()=>Y_,date:()=>Dd,datetime:()=>Id,duration:()=>qd,time:()=>Ad});var K_=x("ZodISODateTime",(e,t)=>{N_.init(e,t),Ee.init(e,t)});function Id(e){return F_(K_,e)}var X_=x("ZodISODate",(e,t)=>{I_.init(e,t),Ee.init(e,t)});function Dd(e){return U_(X_,e)}var Y_=x("ZodISOTime",(e,t)=>{D_.init(e,t),Ee.init(e,t)});function Ad(e){return V_(Y_,e)}var Q_=x("ZodISODuration",(e,t)=>{A_.init(e,t),Ee.init(e,t)});function qd(e){return H_(Q_,e)}var ev=(e,t)=>{ua.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ku(e,r)},flatten:{value:r=>Gu(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},PZ=x("ZodError",ev),Li=x("ZodError",ev,{Parent:Error});var tv=Xu(Li),rv=Qu(Li),nv=tl(Li),ov=rl(Li);var Ie=x("ZodType",(e,t)=>(ge.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>Ot(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>tv(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>nv(e,r,n),e.parseAsync=async(r,n)=>rv(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ov(e,r,n),e.spa=e.safeParseAsync,e.refine=(r,n)=>e.check(NR(r,n)),e.superRefine=r=>e.check(IR(r)),e.overwrite=r=>e.check(Fn(r)),e.optional=()=>Ce(e),e.nullable=()=>av(e),e.nullish=()=>Ce(av(e)),e.nonoptional=r=>zR(e,r),e.array=()=>oe(e),e.or=r=>ke([e,r]),e.and=r=>Ta(e,r),e.transform=r=>Ld(e,pv(r)),e.default=r=>kR(e,r),e.prefault=r=>TR(e,r),e.catch=r=>ER(e,r),e.pipe=r=>Ld(e,r),e.readonly=()=>jR(e),e.describe=r=>{let n=e.clone();return Br.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Br.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Br.get(e);let n=e.clone();return Br.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),cv=x("_ZodString",(e,t)=>{Ii.init(e,t),Ie.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(xd(...n)),e.includes=(...n)=>e.check(kd(...n)),e.startsWith=(...n)=>e.check(Pd(...n)),e.endsWith=(...n)=>e.check(Td(...n)),e.min=(...n)=>e.check(ko(...n)),e.max=(...n)=>e.check(ba(...n)),e.length=(...n)=>e.check(wa(...n)),e.nonempty=(...n)=>e.check(ko(1,...n)),e.lowercase=n=>e.check($d(n)),e.uppercase=n=>e.check(Sd(n)),e.trim=()=>e.check(Rd()),e.normalize=(...n)=>e.check(zd(...n)),e.toLowerCase=()=>e.check(Ed()),e.toUpperCase=()=>e.check(Od())}),Wz=x("ZodString",(e,t)=>{Ii.init(e,t),cv.init(e,t),e.email=r=>e.check(Gl(Jz,r)),e.url=r=>e.check(ed(Gz,r)),e.jwt=r=>e.check(hd(lR,r)),e.emoji=r=>e.check(td(Kz,r)),e.guid=r=>e.check(ga(iv,r)),e.uuid=r=>e.check(Kl(Pa,r)),e.uuidv4=r=>e.check(Xl(Pa,r)),e.uuidv6=r=>e.check(Yl(Pa,r)),e.uuidv7=r=>e.check(Ql(Pa,r)),e.nanoid=r=>e.check(rd(Xz,r)),e.guid=r=>e.check(ga(iv,r)),e.cuid=r=>e.check(nd(Yz,r)),e.cuid2=r=>e.check(od(Qz,r)),e.ulid=r=>e.check(id(eR,r)),e.base64=r=>e.check(fd(aR,r)),e.base64url=r=>e.check(pd(cR,r)),e.xid=r=>e.check(sd(tR,r)),e.ksuid=r=>e.check(ad(rR,r)),e.ipv4=r=>e.check(cd(nR,r)),e.ipv6=r=>e.check(ud(oR,r)),e.cidrv4=r=>e.check(ld(iR,r)),e.cidrv6=r=>e.check(dd(sR,r)),e.e164=r=>e.check(md(uR,r)),e.datetime=r=>e.check(Id(r)),e.date=r=>e.check(Dd(r)),e.time=r=>e.check(Ad(r)),e.duration=r=>e.check(qd(r))});function b(e){return Jl(Wz,e)}var Ee=x("ZodStringFormat",(e,t)=>{we.init(e,t),cv.init(e,t)}),Jz=x("ZodEmail",(e,t)=>{ll.init(e,t),Ee.init(e,t)});var iv=x("ZodGUID",(e,t)=>{cl.init(e,t),Ee.init(e,t)});var Pa=x("ZodUUID",(e,t)=>{ul.init(e,t),Ee.init(e,t)});var Gz=x("ZodURL",(e,t)=>{dl.init(e,t),Ee.init(e,t)});var Kz=x("ZodEmoji",(e,t)=>{fl.init(e,t),Ee.init(e,t)});var Xz=x("ZodNanoID",(e,t)=>{pl.init(e,t),Ee.init(e,t)});var Yz=x("ZodCUID",(e,t)=>{ml.init(e,t),Ee.init(e,t)});var Qz=x("ZodCUID2",(e,t)=>{hl.init(e,t),Ee.init(e,t)});var eR=x("ZodULID",(e,t)=>{gl.init(e,t),Ee.init(e,t)});var tR=x("ZodXID",(e,t)=>{yl.init(e,t),Ee.init(e,t)});var rR=x("ZodKSUID",(e,t)=>{_l.init(e,t),Ee.init(e,t)});var nR=x("ZodIPv4",(e,t)=>{vl.init(e,t),Ee.init(e,t)});var oR=x("ZodIPv6",(e,t)=>{bl.init(e,t),Ee.init(e,t)});var iR=x("ZodCIDRv4",(e,t)=>{wl.init(e,t),Ee.init(e,t)});var sR=x("ZodCIDRv6",(e,t)=>{xl.init(e,t),Ee.init(e,t)});var aR=x("ZodBase64",(e,t)=>{$l.init(e,t),Ee.init(e,t)});var cR=x("ZodBase64URL",(e,t)=>{Sl.init(e,t),Ee.init(e,t)});var uR=x("ZodE164",(e,t)=>{kl.init(e,t),Ee.init(e,t)});var lR=x("ZodJWT",(e,t)=>{Pl.init(e,t),Ee.init(e,t)});var uv=x("ZodNumber",(e,t)=>{pa.init(e,t),Ie.init(e,t),e.gt=(n,o)=>e.check(_a(n,o)),e.gte=(n,o)=>e.check(qi(n,o)),e.min=(n,o)=>e.check(qi(n,o)),e.lt=(n,o)=>e.check(ya(n,o)),e.lte=(n,o)=>e.check(Ai(n,o)),e.max=(n,o)=>e.check(Ai(n,o)),e.int=n=>e.check(sv(n)),e.safe=n=>e.check(sv(n)),e.positive=n=>e.check(_a(0,n)),e.nonnegative=n=>e.check(qi(0,n)),e.negative=n=>e.check(ya(0,n)),e.nonpositive=n=>e.check(Ai(0,n)),e.multipleOf=(n,o)=>e.check(va(n,o)),e.step=(n,o)=>e.check(va(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function me(e){return gd(uv,e)}var dR=x("ZodNumberFormat",(e,t)=>{Tl.init(e,t),uv.init(e,t)});function sv(e){return yd(dR,e)}var fR=x("ZodBoolean",(e,t)=>{zl.init(e,t),Ie.init(e,t)});function Be(e){return _d(fR,e)}var pR=x("ZodNull",(e,t)=>{Rl.init(e,t),Ie.init(e,t)});function lv(e){return vd(pR,e)}var mR=x("ZodUnknown",(e,t)=>{El.init(e,t),Ie.init(e,t)});function Oe(){return bd(mR)}var hR=x("ZodNever",(e,t)=>{Ol.init(e,t),Ie.init(e,t)});function gR(e){return wd(hR,e)}var yR=x("ZodArray",(e,t)=>{Cl.init(e,t),Ie.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(ko(r,n)),e.nonempty=r=>e.check(ko(1,r)),e.max=(r,n)=>e.check(ba(r,n)),e.length=(r,n)=>e.check(wa(r,n)),e.unwrap=()=>e.element});function oe(e,t){return B_(yR,e,t)}var dv=x("ZodObject",(e,t)=>{ma.init(e,t),Ie.init(e,t),ne.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>xt(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Oe()}),e.loose=()=>e.clone({...e._zod.def,catchall:Oe()}),e.strict=()=>e.clone({...e._zod.def,catchall:gR()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>ne.extend(e,r),e.merge=r=>ne.merge(e,r),e.pick=r=>ne.pick(e,r),e.omit=r=>ne.omit(e,r),e.partial=(...r)=>ne.partial(mv,e,r[0]),e.required=(...r)=>ne.required(hv,e,r[0])});function N(e,t){let r={type:"object",get shape(){return ne.assignProp(this,"shape",{...e}),this.shape},...ne.normalizeParams(t)};return new dv(r)}function ht(e,t){return new dv({type:"object",get shape(){return ne.assignProp(this,"shape",{...e}),this.shape},catchall:Oe(),...ne.normalizeParams(t)})}var fv=x("ZodUnion",(e,t)=>{ha.init(e,t),Ie.init(e,t),e.options=t.options});function ke(e,t){return new fv({type:"union",options:e,...ne.normalizeParams(t)})}var _R=x("ZodDiscriminatedUnion",(e,t)=>{fv.init(e,t),jl.init(e,t)});function Fd(e,t,r){return new _R({type:"union",options:t,discriminator:e,...ne.normalizeParams(r)})}var vR=x("ZodIntersection",(e,t)=>{Ml.init(e,t),Ie.init(e,t)});function Ta(e,t){return new vR({type:"intersection",left:e,right:t})}var bR=x("ZodRecord",(e,t)=>{Nl.init(e,t),Ie.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function xe(e,t,r){return new bR({type:"record",keyType:e,valueType:t,...ne.normalizeParams(r)})}var Zd=x("ZodEnum",(e,t)=>{Il.init(e,t),Ie.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...t,checks:[],...ne.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Zd({...t,checks:[],...ne.normalizeParams(o),entries:i})}});function xt(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Zd({type:"enum",entries:r,...ne.normalizeParams(t)})}var wR=x("ZodLiteral",(e,t)=>{Dl.init(e,t),Ie.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function L(e,t){return new wR({type:"literal",values:Array.isArray(e)?e:[e],...ne.normalizeParams(t)})}var xR=x("ZodTransform",(e,t)=>{Al.init(e,t),Ie.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=i=>{if(typeof i=="string")r.issues.push(ne.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),r.issues.push(ne.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function pv(e){return new xR({type:"transform",transform:e})}var mv=x("ZodOptional",(e,t)=>{ql.init(e,t),Ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ce(e){return new mv({type:"optional",innerType:e})}var $R=x("ZodNullable",(e,t)=>{Zl.init(e,t),Ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function av(e){return new $R({type:"nullable",innerType:e})}var SR=x("ZodDefault",(e,t)=>{Ll.init(e,t),Ie.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kR(e,t){return new SR({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var PR=x("ZodPrefault",(e,t)=>{Fl.init(e,t),Ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function TR(e,t){return new PR({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var hv=x("ZodNonOptional",(e,t)=>{Ul.init(e,t),Ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zR(e,t){return new hv({type:"nonoptional",innerType:e,...ne.normalizeParams(t)})}var RR=x("ZodCatch",(e,t)=>{Vl.init(e,t),Ie.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ER(e,t){return new RR({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var OR=x("ZodPipe",(e,t)=>{Hl.init(e,t),Ie.init(e,t),e.in=t.in,e.out=t.out});function Ld(e,t){return new OR({type:"pipe",in:e,out:t})}var CR=x("ZodReadonly",(e,t)=>{Bl.init(e,t),Ie.init(e,t)});function jR(e){return new CR({type:"readonly",innerType:e})}var gv=x("ZodCustom",(e,t)=>{Wl.init(e,t),Ie.init(e,t)});function MR(e){let t=new Ye({check:"custom"});return t._zod.check=e,t}function yv(e,t){return Cd(gv,e??(()=>!0),t)}function NR(e,t={}){return jd(gv,e,t)}function IR(e){let t=MR(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(ne.issue(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(ne.issue(o))}},e(r.value,r)));return t}function Ud(e,t){return Ld(pv(e),t)}Et(Z_());var Hd="2025-11-25";var _v=[Hd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Gr="io.modelcontextprotocol/related-task",Ra="2.0",Ve=yv(e=>e!==null&&(typeof e=="object"||typeof e=="function")),vv=ke([b(),me().int()]),bv=b(),ZZ=ht({ttl:me().optional(),pollInterval:me().optional()}),DR=N({ttl:me().optional()}),AR=N({taskId:b()}),Bd=ht({progressToken:vv.optional(),[Gr]:AR.optional()}),Ct=N({_meta:Bd.optional()}),Fi=Ct.extend({task:DR.optional()}),wv=e=>Fi.safeParse(e).success,Qe=N({method:b(),params:Ct.loose().optional()}),qt=N({_meta:Bd.optional()}),Zt=N({method:b(),params:qt.loose().optional()}),et=ht({_meta:Bd.optional()}),Ea=ke([b(),me().int()]),xv=N({jsonrpc:L(Ra),id:Ea,...Qe.shape}).strict(),Wd=e=>xv.safeParse(e).success,$v=N({jsonrpc:L(Ra),...Zt.shape}).strict(),Sv=e=>$v.safeParse(e).success,Jd=N({jsonrpc:L(Ra),id:Ea,result:et}).strict(),Ui=e=>Jd.safeParse(e).success;var U;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(U||(U={}));var Gd=N({jsonrpc:L(Ra),id:Ea.optional(),error:N({code:me().int(),message:b(),data:Oe().optional()})}).strict();var kv=e=>Gd.safeParse(e).success;var Pv=ke([xv,$v,Jd,Gd]),LZ=ke([Jd,Gd]),Oa=et.strict(),qR=qt.extend({requestId:Ea.optional(),reason:b().optional()}),Ca=Zt.extend({method:L("notifications/cancelled"),params:qR}),ZR=N({src:b(),mimeType:b().optional(),sizes:oe(b()).optional(),theme:xt(["light","dark"]).optional()}),Vi=N({icons:oe(ZR).optional()}),To=N({name:b(),title:b().optional()}),Tv=To.extend({...To.shape,...Vi.shape,version:b(),websiteUrl:b().optional(),description:b().optional()}),LR=Ta(N({applyDefaults:Be().optional()}),xe(b(),Oe())),FR=Ud(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ta(N({form:LR.optional(),url:Ve.optional()}),xe(b(),Oe()).optional())),UR=ht({list:Ve.optional(),cancel:Ve.optional(),requests:ht({sampling:ht({createMessage:Ve.optional()}).optional(),elicitation:ht({create:Ve.optional()}).optional()}).optional()}),VR=ht({list:Ve.optional(),cancel:Ve.optional(),requests:ht({tools:ht({call:Ve.optional()}).optional()}).optional()}),HR=N({experimental:xe(b(),Ve).optional(),sampling:N({context:Ve.optional(),tools:Ve.optional()}).optional(),elicitation:FR.optional(),roots:N({listChanged:Be().optional()}).optional(),tasks:UR.optional(),extensions:xe(b(),Ve).optional()}),BR=Ct.extend({protocolVersion:b(),capabilities:HR,clientInfo:Tv}),Kd=Qe.extend({method:L("initialize"),params:BR});var WR=N({experimental:xe(b(),Ve).optional(),logging:Ve.optional(),completions:Ve.optional(),prompts:N({listChanged:Be().optional()}).optional(),resources:N({subscribe:Be().optional(),listChanged:Be().optional()}).optional(),tools:N({listChanged:Be().optional()}).optional(),tasks:VR.optional(),extensions:xe(b(),Ve).optional()}),JR=et.extend({protocolVersion:b(),capabilities:WR,serverInfo:Tv,instructions:b().optional()}),Xd=Zt.extend({method:L("notifications/initialized"),params:qt.optional()});var ja=Qe.extend({method:L("ping"),params:Ct.optional()}),GR=N({progress:me(),total:Ce(me()),message:Ce(b())}),KR=N({...qt.shape,...GR.shape,progressToken:vv}),Ma=Zt.extend({method:L("notifications/progress"),params:KR}),XR=Ct.extend({cursor:bv.optional()}),Hi=Qe.extend({params:XR.optional()}),Bi=et.extend({nextCursor:bv.optional()}),YR=xt(["working","input_required","completed","failed","cancelled"]),Wi=N({taskId:b(),status:YR,ttl:ke([me(),lv()]),createdAt:b(),lastUpdatedAt:b(),pollInterval:Ce(me()),statusMessage:Ce(b())}),zo=et.extend({task:Wi}),QR=qt.merge(Wi),Ji=Zt.extend({method:L("notifications/tasks/status"),params:QR}),Na=Qe.extend({method:L("tasks/get"),params:Ct.extend({taskId:b()})}),Ia=et.merge(Wi),Da=Qe.extend({method:L("tasks/result"),params:Ct.extend({taskId:b()})}),FZ=et.loose(),Aa=Hi.extend({method:L("tasks/list")}),qa=Bi.extend({tasks:oe(Wi)}),Za=Qe.extend({method:L("tasks/cancel"),params:Ct.extend({taskId:b()})}),zv=et.merge(Wi),Rv=N({uri:b(),mimeType:Ce(b()),_meta:xe(b(),Oe()).optional()}),Ev=Rv.extend({text:b()}),Yd=b().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ov=Rv.extend({blob:Yd}),Gi=xt(["user","assistant"]),Ro=N({audience:oe(Gi).optional(),priority:me().min(0).max(1).optional(),lastModified:Zi.datetime({offset:!0}).optional()}),Cv=N({...To.shape,...Vi.shape,uri:b(),description:Ce(b()),mimeType:Ce(b()),size:Ce(me()),annotations:Ro.optional(),_meta:Ce(ht({}))}),eE=N({...To.shape,...Vi.shape,uriTemplate:b(),description:Ce(b()),mimeType:Ce(b()),annotations:Ro.optional(),_meta:Ce(ht({}))}),La=Hi.extend({method:L("resources/list")}),tE=Bi.extend({resources:oe(Cv)}),Fa=Hi.extend({method:L("resources/templates/list")}),rE=Bi.extend({resourceTemplates:oe(eE)}),Qd=Ct.extend({uri:b()}),nE=Qd,Ua=Qe.extend({method:L("resources/read"),params:nE}),oE=et.extend({contents:oe(ke([Ev,Ov]))}),iE=Zt.extend({method:L("notifications/resources/list_changed"),params:qt.optional()}),sE=Qd,aE=Qe.extend({method:L("resources/subscribe"),params:sE}),cE=Qd,uE=Qe.extend({method:L("resources/unsubscribe"),params:cE}),lE=qt.extend({uri:b()}),dE=Zt.extend({method:L("notifications/resources/updated"),params:lE}),fE=N({name:b(),description:Ce(b()),required:Ce(Be())}),pE=N({...To.shape,...Vi.shape,description:Ce(b()),arguments:Ce(oe(fE)),_meta:Ce(ht({}))}),Va=Hi.extend({method:L("prompts/list")}),mE=Bi.extend({prompts:oe(pE)}),hE=Ct.extend({name:b(),arguments:xe(b(),b()).optional()}),Ha=Qe.extend({method:L("prompts/get"),params:hE}),ef=N({type:L("text"),text:b(),annotations:Ro.optional(),_meta:xe(b(),Oe()).optional()}),tf=N({type:L("image"),data:Yd,mimeType:b(),annotations:Ro.optional(),_meta:xe(b(),Oe()).optional()}),rf=N({type:L("audio"),data:Yd,mimeType:b(),annotations:Ro.optional(),_meta:xe(b(),Oe()).optional()}),gE=N({type:L("tool_use"),name:b(),id:b(),input:xe(b(),Oe()),_meta:xe(b(),Oe()).optional()}),yE=N({type:L("resource"),resource:ke([Ev,Ov]),annotations:Ro.optional(),_meta:xe(b(),Oe()).optional()}),_E=Cv.extend({type:L("resource_link")}),nf=ke([ef,tf,rf,_E,yE]),vE=N({role:Gi,content:nf}),bE=et.extend({description:b().optional(),messages:oe(vE)}),wE=Zt.extend({method:L("notifications/prompts/list_changed"),params:qt.optional()}),xE=N({title:b().optional(),readOnlyHint:Be().optional(),destructiveHint:Be().optional(),idempotentHint:Be().optional(),openWorldHint:Be().optional()}),$E=N({taskSupport:xt(["required","optional","forbidden"]).optional()}),jv=N({...To.shape,...Vi.shape,description:b().optional(),inputSchema:N({type:L("object"),properties:xe(b(),Ve).optional(),required:oe(b()).optional()}).catchall(Oe()),outputSchema:N({type:L("object"),properties:xe(b(),Ve).optional(),required:oe(b()).optional()}).catchall(Oe()).optional(),annotations:xE.optional(),execution:$E.optional(),_meta:xe(b(),Oe()).optional()}),Ba=Hi.extend({method:L("tools/list")}),SE=Bi.extend({tools:oe(jv)}),Wa=et.extend({content:oe(nf).default([]),structuredContent:xe(b(),Oe()).optional(),isError:Be().optional()}),UZ=Wa.or(et.extend({toolResult:Oe()})),kE=Fi.extend({name:b(),arguments:xe(b(),Oe()).optional()}),Eo=Qe.extend({method:L("tools/call"),params:kE}),PE=Zt.extend({method:L("notifications/tools/list_changed"),params:qt.optional()}),VZ=N({autoRefresh:Be().default(!0),debounceMs:me().int().nonnegative().default(300)}),Ki=xt(["debug","info","notice","warning","error","critical","alert","emergency"]),TE=Ct.extend({level:Ki}),of=Qe.extend({method:L("logging/setLevel"),params:TE}),zE=qt.extend({level:Ki,logger:b().optional(),data:Oe()}),RE=Zt.extend({method:L("notifications/message"),params:zE}),EE=N({name:b().optional()}),OE=N({hints:oe(EE).optional(),costPriority:me().min(0).max(1).optional(),speedPriority:me().min(0).max(1).optional(),intelligencePriority:me().min(0).max(1).optional()}),CE=N({mode:xt(["auto","required","none"]).optional()}),jE=N({type:L("tool_result"),toolUseId:b().describe("The unique identifier for the corresponding tool call."),content:oe(nf).default([]),structuredContent:N({}).loose().optional(),isError:Be().optional(),_meta:xe(b(),Oe()).optional()}),ME=Fd("type",[ef,tf,rf]),za=Fd("type",[ef,tf,rf,gE,jE]),NE=N({role:Gi,content:ke([za,oe(za)]),_meta:xe(b(),Oe()).optional()}),IE=Fi.extend({messages:oe(NE),modelPreferences:OE.optional(),systemPrompt:b().optional(),includeContext:xt(["none","thisServer","allServers"]).optional(),temperature:me().optional(),maxTokens:me().int(),stopSequences:oe(b()).optional(),metadata:Ve.optional(),tools:oe(jv).optional(),toolChoice:CE.optional()}),DE=Qe.extend({method:L("sampling/createMessage"),params:IE}),Xi=et.extend({model:b(),stopReason:Ce(xt(["endTurn","stopSequence","maxTokens"]).or(b())),role:Gi,content:ME}),sf=et.extend({model:b(),stopReason:Ce(xt(["endTurn","stopSequence","maxTokens","toolUse"]).or(b())),role:Gi,content:ke([za,oe(za)])}),AE=N({type:L("boolean"),title:b().optional(),description:b().optional(),default:Be().optional()}),qE=N({type:L("string"),title:b().optional(),description:b().optional(),minLength:me().optional(),maxLength:me().optional(),format:xt(["email","uri","date","date-time"]).optional(),default:b().optional()}),ZE=N({type:xt(["number","integer"]),title:b().optional(),description:b().optional(),minimum:me().optional(),maximum:me().optional(),default:me().optional()}),LE=N({type:L("string"),title:b().optional(),description:b().optional(),enum:oe(b()),default:b().optional()}),FE=N({type:L("string"),title:b().optional(),description:b().optional(),oneOf:oe(N({const:b(),title:b()})),default:b().optional()}),UE=N({type:L("string"),title:b().optional(),description:b().optional(),enum:oe(b()),enumNames:oe(b()).optional(),default:b().optional()}),VE=ke([LE,FE]),HE=N({type:L("array"),title:b().optional(),description:b().optional(),minItems:me().optional(),maxItems:me().optional(),items:N({type:L("string"),enum:oe(b())}),default:oe(b()).optional()}),BE=N({type:L("array"),title:b().optional(),description:b().optional(),minItems:me().optional(),maxItems:me().optional(),items:N({anyOf:oe(N({const:b(),title:b()}))}),default:oe(b()).optional()}),WE=ke([HE,BE]),JE=ke([UE,VE,WE]),GE=ke([JE,AE,qE,ZE]),KE=Fi.extend({mode:L("form").optional(),message:b(),requestedSchema:N({type:L("object"),properties:xe(b(),GE),required:oe(b()).optional()})}),XE=Fi.extend({mode:L("url"),message:b(),elicitationId:b(),url:b().url()}),YE=ke([KE,XE]),QE=Qe.extend({method:L("elicitation/create"),params:YE}),eO=qt.extend({elicitationId:b()}),tO=Zt.extend({method:L("notifications/elicitation/complete"),params:eO}),Oo=et.extend({action:xt(["accept","decline","cancel"]),content:Ud(e=>e===null?void 0:e,xe(b(),ke([b(),me(),Be(),oe(b())])).optional())}),rO=N({type:L("ref/resource"),uri:b()});var nO=N({type:L("ref/prompt"),name:b()}),oO=Ct.extend({ref:ke([nO,rO]),argument:N({name:b(),value:b()}),context:N({arguments:xe(b(),b()).optional()}).optional()}),Ja=Qe.extend({method:L("completion/complete"),params:oO});function Mv(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Nv(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var iO=et.extend({completion:ht({values:oe(b()).max(100),total:Ce(me().int()),hasMore:Ce(Be())})}),sO=N({uri:b().startsWith("file://"),name:b().optional(),_meta:xe(b(),Oe()).optional()}),aO=Qe.extend({method:L("roots/list"),params:Ct.optional()}),af=et.extend({roots:oe(sO)}),cO=Zt.extend({method:L("notifications/roots/list_changed"),params:qt.optional()}),HZ=ke([ja,Kd,Ja,of,Ha,Va,La,Fa,Ua,aE,uE,Eo,Ba,Na,Da,Aa,Za]),BZ=ke([Ca,Ma,Xd,cO,Ji]),WZ=ke([Oa,Xi,sf,Oo,af,Ia,qa,zo]),JZ=ke([ja,DE,QE,aO,Na,Da,Aa,Za]),GZ=ke([Ca,Ma,RE,dE,iE,PE,wE,Ji,tO]),KZ=ke([Oa,JR,iO,bE,mE,tE,rE,oE,Wa,SE,Ia,qa,zo]),Z=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===U.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Vd(o.elicitations,r)}return new e(t,r,n)}},Vd=class extends Z{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(U.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Kr(e){return e==="completed"||e==="failed"||e==="cancelled"}var Dv=Symbol("Let zodToJsonSchema decide on which parser to use");var Iv={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"},Av=e=>typeof e=="string"?{...Iv,name:e}:{...Iv,...e};var qv=e=>{let t=Av(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function cf(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function ie(e,t,r,n,o){e[t]=r,cf(e,t,n,o)}var Ga=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function je(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Ga(t,e.currentPath):t.join("/")}}function Zv(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==E.ZodAny&&(r.items=W(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&ie(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&ie(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(ie(r,"minItems",e.exactLength.value,e.exactLength.message,t),ie(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function Lv(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?ie(r,"minimum",n.value,n.message,t):ie(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),ie(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?ie(r,"maximum",n.value,n.message,t):ie(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),ie(r,"maximum",n.value,n.message,t));break;case"multipleOf":ie(r,"multipleOf",n.value,n.message,t);break}return r}function Fv(){return{type:"boolean"}}function Ka(e,t){return W(e.type._def,t)}var Uv=(e,t)=>W(e.innerType._def,t);function uf(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,i)=>uf(e,t,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 uO(e,t)}}var uO=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":ie(r,"minimum",n.value,n.message,t);break;case"max":ie(r,"maximum",n.value,n.message,t);break}return r};function Vv(e,t){return{...W(e.innerType._def,t),default:e.defaultValue()}}function Hv(e,t){return t.effectStrategy==="input"?W(e.schema._def,t):je(t)}function Bv(e){return{type:"string",enum:Array.from(e.values)}}var lO=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Wv(e,t){let r=[W(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),W(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(i=>{if(lO(i))o.push(...i.allOf),i.unevaluatedProperties===void 0&&(n=void 0);else{let s=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:a,...c}=i;s=c}else n=void 0;o.push(s)}}),o.length?{allOf:o,...n}:void 0}function Jv(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var lf,Gt={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:()=>(lf===void 0&&(lf=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),lf),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 Xa(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Kt(r,"email",n.message,t);break;case"format:idn-email":Kt(r,"idn-email",n.message,t);break;case"pattern:zod":gt(r,Gt.email,n.message,t);break}break;case"url":Kt(r,"uri",n.message,t);break;case"uuid":Kt(r,"uuid",n.message,t);break;case"regex":gt(r,n.regex,n.message,t);break;case"cuid":gt(r,Gt.cuid,n.message,t);break;case"cuid2":gt(r,Gt.cuid2,n.message,t);break;case"startsWith":gt(r,RegExp(`^${df(n.value,t)}`),n.message,t);break;case"endsWith":gt(r,RegExp(`${df(n.value,t)}$`),n.message,t);break;case"datetime":Kt(r,"date-time",n.message,t);break;case"date":Kt(r,"date",n.message,t);break;case"time":Kt(r,"time",n.message,t);break;case"duration":Kt(r,"duration",n.message,t);break;case"length":ie(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),ie(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{gt(r,RegExp(df(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Kt(r,"ipv4",n.message,t),n.version!=="v4"&&Kt(r,"ipv6",n.message,t);break}case"base64url":gt(r,Gt.base64url,n.message,t);break;case"jwt":gt(r,Gt.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&>(r,Gt.ipv4Cidr,n.message,t),n.version!=="v4"&>(r,Gt.ipv6Cidr,n.message,t);break}case"emoji":gt(r,Gt.emoji(),n.message,t);break;case"ulid":{gt(r,Gt.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Kt(r,"binary",n.message,t);break}case"contentEncoding:base64":{ie(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{gt(r,Gt.base64,n.message,t);break}}break}case"nanoid":gt(r,Gt.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function df(e,t){return t.patternStrategy==="escape"?fO(e):e}var dO=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function fO(e){let t="";for(let r=0;r<e.length;r++)dO.has(e[r])||(t+="\\"),t+=e[r];return t}function Kt(e,t,r,n){e.format||e.anyOf?.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):ie(e,"format",t,r,n)}function gt(e,t,r,n){e.pattern||e.allOf?.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:Gv(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):ie(e,"pattern",Gv(t,n),r,n)}function Gv(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",i=!1,s=!1,a=!1;for(let c=0;c<n.length;c++){if(i){o+=n[c],i=!1;continue}if(r.i){if(s){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
|
|
48
48
|
]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
|
|
49
49
|
]))`;continue}}if(r.s&&n[c]==="."){o+=s?`${n[c]}\r
|
|
50
50
|
`:`[${n[c]}\r
|
|
51
|
-
]`;continue}o+=n[c],n[c]==="\\"?i=!0:s&&n[c]==="]"?s=!1:!s&&n[c]==="["&&(s=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function Ya(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===E.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:W(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??je(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:W(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===E.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=Xa(e.keyType._def,t);return{...r,propertyNames:o}}else{if(e.keyType?._def.typeName===E.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===E.ZodBranded&&e.keyType._def.type._def.typeName===E.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=Ka(e.keyType._def,t);return{...r,propertyNames:o}}}return r}function Kv(e,t){if(t.mapStrategy==="record")return Ya(e,t);let r=W(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||je(t),n=W(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||je(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Xv(e){let t=e.values,n=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Yv(e){return e.target==="openAi"?void 0:{not:je({...e,currentPath:[...e.currentPath,"not"]})}}function Qv(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Yi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tb(e,t){if(t.target==="openApi3")return eb(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in Yi&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Yi[i._def.typeName];return s&&!o.includes(s)?[...o,s]: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,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return eb(e,t)}var eb=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>W(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function rb(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:Yi[e.innerType._def.typeName],nullable:!0}:{type:[Yi[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=W(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=W(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function nb(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",cf(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?ie(r,"minimum",n.value,n.message,t):ie(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),ie(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?ie(r,"maximum",n.value,n.message,t):ie(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),ie(r,"maximum",n.value,n.message,t));break;case"multipleOf":ie(r,"multipleOf",n.value,n.message,t);break}return r}function ob(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},o=[],i=e.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=mO(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=W(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=pO(e,t);return s!==void 0&&(n.additionalProperties=s),n}function pO(e,t){if(e.catchall._def.typeName!=="ZodNever")return W(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function mO(e){try{return e.isOptional()}catch{return!0}}var ib=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return W(e.innerType._def,t);let r=W(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:je(t)},r]}:je(t)};var sb=(e,t)=>{if(t.pipeStrategy==="input")return W(e.in._def,t);if(t.pipeStrategy==="output")return W(e.out._def,t);let r=W(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=W(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function ab(e,t){return W(e.type._def,t)}function cb(e,t){let n={type:"array",uniqueItems:!0,items:W(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&ie(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&ie(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}function ub(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>W(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:W(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>W(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function lb(e){return{not:je(e)}}function db(e){return je(e)}var fb=(e,t)=>W(e.innerType._def,t);var pb=(e,t,r)=>{switch(t){case E.ZodString:return Xa(e,r);case E.ZodNumber:return nb(e,r);case E.ZodObject:return ob(e,r);case E.ZodBigInt:return Lv(e,r);case E.ZodBoolean:return Fv();case E.ZodDate:return uf(e,r);case E.ZodUndefined:return lb(r);case E.ZodNull:return Qv(r);case E.ZodArray:return Zv(e,r);case E.ZodUnion:case E.ZodDiscriminatedUnion:return tb(e,r);case E.ZodIntersection:return Wv(e,r);case E.ZodTuple:return ub(e,r);case E.ZodRecord:return Ya(e,r);case E.ZodLiteral:return Jv(e,r);case E.ZodEnum:return Bv(e);case E.ZodNativeEnum:return Xv(e);case E.ZodNullable:return rb(e,r);case E.ZodOptional:return ib(e,r);case E.ZodMap:return Kv(e,r);case E.ZodSet:return cb(e,r);case E.ZodLazy:return()=>e.getter()._def;case E.ZodPromise:return ab(e,r);case E.ZodNaN:case E.ZodNever:return Yv(r);case E.ZodEffects:return Hv(e,r);case E.ZodAny:return je(r);case E.ZodUnknown:return db(r);case E.ZodDefault:return Vv(e,r);case E.ZodBranded:return Ka(e,r);case E.ZodReadonly:return fb(e,r);case E.ZodCatch:return Uv(e,r);case E.ZodPipeline:return sb(e,r);case E.ZodFunction:case E.ZodVoid:case E.ZodSymbol:return;default:return(n=>{})(t)}};function W(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==Dv)return a}if(n&&!r){let a=hO(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let i=pb(e,e.typeName,t),s=typeof i=="function"?W(i(),t):i;if(s&&gO(e,t,s),t.postProcess){let a=t.postProcess(s,e,t);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var hO=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ga(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),je(t)):t.$refStrategy==="seen"?je(t):void 0}},gO=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var ff=(e,t)=>{let r=qv(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:W(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??je(r)}),{}):void 0,o=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=W(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??je(r),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(i.title=s),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?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};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 yO(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function pf(e,t){return At(e)?Id(e,{target:yO(t?.target),io:t?.pipeStrategy??"input"}):ff(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function mf(e){let r=Jr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=ka(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function hf(e,t){let r=Wr(e,t);if(!r.success)throw r.error;return r.data}var _O=6e4,Qa=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ca,r=>{this._oncancel(r)}),this.setNotificationHandler(Ia,r=>{this._onprogress(r)}),this.setRequestHandler(ja,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Na,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(U.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Da,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(i,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 Z(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 s=await this._taskStore.getTask(i,n.sessionId);if(!s)throw new Z(U.InvalidParams,`Task not found: ${i}`);if(!Kr(s.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Kr(s.status)){let a=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...a,_meta:{...a._meta,[Gr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Aa,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new Z(U.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Za,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(U.InvalidParams,`Task not found: ${r.params.taskId}`);if(Kr(o.status))throw new Z(U.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Z(U.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof Z?o:new Z(U.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),Z.fromError(U.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s),Ui(i)||kv(i)?this._onresponse(i):Wd(i)?this._onrequest(i,s):Sv(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=Z.fromError(U.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[Gr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:U.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);let a=wv(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(s.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,h)=>{if(s.signal.aborted)throw new Z(U.ConnectionClosed,"Request was cancelled");let m={...h,relatedRequestId:t.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let p=m.relatedTask?.taskId??i;return p&&c&&await c.updateTaskStatus(p,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(s.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:U.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Ui(t))n(t);else{let s=new Z(t.error.code,t.error.message,t.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(Ui(t)&&t.result&&typeof t.result=="object"){let s=t.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),Ui(t))o(t);else{let s=Z.fromError(t.error.code,t.error.message,t.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(s){yield{type:"error",error:s instanceof Z?s:new Z(U.InternalError,String(s))}}return}let i;try{let s=await this.request(t,Ro,n);if(s.task)i=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new Z(U.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:a},Kr(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:a.status==="failed"?yield{type:"error",error:new Z(U.InternalError,`Task ${i} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new Z(U.InternalError,`Task ${i} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof Z?s:new Z(U.InternalError,String(s))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=T=>{l(T)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(T){d(T);return}n?.signal?.throwIfAborted();let h=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:h};n?.onprogress&&(this._progressHandlers.set(h,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:h}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Gr]:c}});let p=T=>{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(T)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(M=>this._onerror(new Error(`Failed to send cancellation: ${M}`)));let z=T instanceof Z?T:new Z(U.RequestTimeout,String(T));l(z)};this._responseHandlers.set(h,T=>{if(!n?.signal?.aborted){if(T instanceof Error)return l(T);try{let z=Wr(r,T.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),n?.signal?.addEventListener("abort",()=>{p(n?.signal?.reason)});let y=n?.timeout??_O,v=()=>p(Z.fromError(U.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(h,y,n?.maxTotalTimeout,v,n?.resetTimeoutOnProgress??!1);let P=c?.taskId;if(P){let T=z=>{let M=this._responseHandlers.get(h);M?M(z):this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))};this._requestResolvers.set(h,T),this._enqueueTaskMessage(P,{type:"request",message:m,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(h),l(z)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(T=>{this._cleanupTimeout(h),l(T)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ma,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},qa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Rv,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Gr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Gr]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Gr]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(t,r){let n=mf(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=hf(t,o);return Promise.resolve(r(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=mf(t);this._notificationHandlers.set(n,o=>{let i=hf(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Wd(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new Z(U.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new Z(U.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(s),i(new Z(U.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new Z(U.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ji.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Kr(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new Z(U.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Kr(a.status))throw new Z(U.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ji.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Kr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function mb(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function hb(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let s=r[o];mb(s)&&mb(i)?r[o]={...s,...i}:r[o]=i}return r}var s$=Qs(tm(),1),a$=Qs(i$(),1);function w1(){let e=new s$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,a$.default)(e),e}var Ic=class{constructor(t){this._ajv=t??w1()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Nc=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],i=Array.isArray(o.content)?o.content:[o.content],s=i.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(s){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(h=>h.type==="tool_use").map(h=>h.id)),d=new Set(i.filter(h=>h.type==="tool_result").map(h=>h.toolUseId));if(l.size!==d.size||![...l].every(h=>d.has(h)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Xi,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:i},Oo,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function c$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function u$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Mc=class extends Qa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ki.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Ic,this.setRequestHandler(Kd,n=>this._oninitialize(n)),this.setNotificationHandler(Xd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(of,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=n.params,a=Ki.safeParse(s);return a.success&&this._loggingLevels.set(i,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Nc(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=hb(this._capabilities,t)}setRequestHandler(t,r){let o=Jr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(At(o)){let a=o;i=a._zod?.def?.value??a.value}else{let a=o;i=a._def?.value??a.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let a=async(c,u)=>{let l=Wr(Eo,c);if(!l.success){let p=l.error instanceof Error?l.error.message:String(l.error);throw new Z(U.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:d}=l.data,h=await Promise.resolve(r(c,u));if(d.task){let p=Wr(Ro,h);if(!p.success){let y=p.error instanceof Error?p.error.message:String(p.error);throw new Z(U.InvalidParams,`Invalid task creation result: ${y}`)}return p.data}let m=Wr(Wa,h);if(!m.success){let p=m.error instanceof Error?m.error.message:String(m.error);throw new Z(U.InvalidParams,`Invalid tools/call result: ${p}`)}return m.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){u$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&c$(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:_v.includes(r)?r:Hd,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"},Oa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(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 t.tools?this.request({method:"sampling/createMessage",params:t},sf,r):this.request({method:"sampling/createMessage",params:t},Xi,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Oo,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},Oo,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!a.valid)throw new Z(U.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof Z?s:new Z(U.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},af,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var d$=Symbol.for("mcp.completable");function um(e){return!!e&&typeof e=="object"&&d$ in e}function f$(e){return e[d$]?.complete}var l$;(function(e){e.Completable="McpCompletable"})(l$||(l$={}));var x1=/^[A-Za-z0-9._-]{1,128}$/;function $1(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!x1.test(e)){let r=e.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,i)=>i.indexOf(n)===o);return t.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:t}}return{isValid:!0,warnings:t}}function S1(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)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 lm(e){let t=$1(e);return S1(e,t.warnings),t.isValid}var Dc=class{constructor(t){this._mcpServer=t}registerToolTask(t,r,n){let o={taskSupport:"required",...r.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,o,r._meta,n)}};var Ac=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Mc(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Dc(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(sn(Ba)),this.server.assertCanSetRequestHandler(sn(Eo)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Ba,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let n={name:t,title:r.title,description:r.description,inputSchema:(()=>{let o=Po(r.inputSchema);return o?pf(o,{strictUnions:!0,pipeStrategy:"input"}):k1})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let o=Po(r.outputSchema);o&&(n.outputSchema=pf(o,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Eo,async(t,r)=>{try{let n=this._registeredTools[t.params.name];if(!n)throw new Z(U.InvalidParams,`Tool ${t.params.name} not found`);if(!n.enabled)throw new Z(U.InvalidParams,`Tool ${t.params.name} disabled`);let o=!!t.params.task,i=n.execution?.taskSupport,s="createTask"in n.handler;if((i==="required"||i==="optional")&&!s)throw new Z(U.InternalError,`Tool ${t.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if(i==="required"&&!o)throw new Z(U.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(i==="optional"&&!o&&s)return await this.handleAutomaticTaskPolling(n,t,r);let a=await this.validateToolInput(n,t.params.arguments,t.params.name),c=await this.executeToolHandler(n,a,r);return o||await this.validateToolOutput(n,c,t.params.name),c}catch(n){if(n instanceof Z&&n.code===U.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,n){if(!t.inputSchema)return;let i=Po(t.inputSchema)??t.inputSchema,s=await $a(i,r);if(!s.success){let a="error"in s?s.error:"Unknown error",c=Sa(a);throw new Z(U.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return s.data}async validateToolOutput(t,r,n){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new Z(U.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let o=Po(t.outputSchema),i=await $a(o,r.structuredContent);if(!i.success){let s="error"in i?i.error:"Unknown error",a=Sa(s);throw new Z(U.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(t,r,n){let o=t.handler;if("createTask"in o){if(!n.taskStore)throw new Error("No task store provided.");let s={...n,taskStore:n.taskStore};if(t.inputSchema){let a=o;return await Promise.resolve(a.createTask(r,s))}else{let a=o;return await Promise.resolve(a.createTask(s))}}if(t.inputSchema){let s=o;return await Promise.resolve(s(r,n))}else{let s=o;return await Promise.resolve(s(n))}}async handleAutomaticTaskPolling(t,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(t,r.params.arguments,r.params.name),i=t.handler,s={...n,taskStore:n.taskStore},a=o?await Promise.resolve(i.createTask(o,s)):await Promise.resolve(i.createTask(s)),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 Z(U.InternalError,`Task ${c} not found during polling`);u=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(sn(Ja)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ja,async t=>{switch(t.params.ref.type){case"ref/prompt":return Iv(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Nv(t),this.handleResourceCompletion(t,t.params.ref);default:throw new Z(U.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let n=this._registeredPrompts[r.name];if(!n)throw new Z(U.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new Z(U.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Rs;let i=Jr(n.argsSchema)?.[t.params.argument.name];if(!um(i))return Rs;let s=f$(i);if(!s)return Rs;let a=await s(t.params.argument.value,t.params.context);return m$(a)}async handleResourceCompletion(t,r){let n=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Rs;throw new Z(U.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(t.params.argument.name);if(!o)return Rs;let i=await o(t.params.argument.value,t.params.context);return m$(i)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(sn(La)),this.server.assertCanSetRequestHandler(sn(Fa)),this.server.assertCanSetRequestHandler(sn(Ua)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(La,async(t,r)=>{let n=Object.entries(this._registeredResources).filter(([i,s])=>s.enabled).map(([i,s])=>({uri:i,name:s.name,...s.metadata})),o=[];for(let i of Object.values(this._registeredResourceTemplates)){if(!i.resourceTemplate.listCallback)continue;let s=await i.resourceTemplate.listCallback(r);for(let a of s.resources)o.push({...i.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler(Fa,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Ua,async(t,r)=>{let n=new URL(t.params.uri),o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new Z(U.InvalidParams,`Resource ${n} disabled`);return o.readCallback(n,r)}for(let i of Object.values(this._registeredResourceTemplates)){let s=i.resourceTemplate.uriTemplate.match(n.toString());if(s)return i.readCallback(n,s,r)}throw new Z(U.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(sn(Va)),this.server.assertCanSetRequestHandler(sn(Ha)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Va,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?P1(r.argsSchema):void 0}))})),this.server.setRequestHandler(Ha,async(t,r)=>{let n=this._registeredPrompts[t.params.name];if(!n)throw new Z(U.InvalidParams,`Prompt ${t.params.name} not found`);if(!n.enabled)throw new Z(U.InvalidParams,`Prompt ${t.params.name} disabled`);if(n.argsSchema){let o=Po(n.argsSchema),i=await $a(o,t.params.arguments);if(!i.success){let c="error"in i?i.error:"Unknown error",u=Sa(c);throw new Z(U.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${u}`)}let s=i.data,a=n.callback;return await Promise.resolve(a(s,r))}else{let o=n.callback;return await Promise.resolve(o(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...n){let o;typeof n[0]=="object"&&(o=n.shift());let i=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,n,o){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(t,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let i=this._createRegisteredResourceTemplate(t,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(t,r,n,o,i){let s={name:t,title:r,metadata:o,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=s,s}_createRegisteredResourceTemplate(t,r,n,o,i){let s={resourceTemplate:n,title:r,metadata:o,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==t&&(delete this._registeredResourceTemplates[t],u.name&&(this._registeredResourceTemplates[u.name]=s)),typeof u.title<"u"&&(s.title=u.title),typeof u.template<"u"&&(s.resourceTemplate=u.template),typeof u.metadata<"u"&&(s.metadata=u.metadata),typeof u.callback<"u"&&(s.readCallback=u.callback),typeof u.enabled<"u"&&(s.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=s;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!n.completeCallback(u))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,n,o,i){let s={title:r,description:n,argsSchema:o===void 0?void 0:Vn(o),callback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=Vn(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=s,o&&Object.values(o).some(c=>{let u=c instanceof bt?c._def?.innerType:c;return um(u)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,n,o,i,s,a,c,u){lm(t);let l={title:r,description:n,inputSchema:p$(o),outputSchema:p$(i),annotations:s,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!==t&&(typeof d.name=="string"&&lm(d.name),delete this._registeredTools[t],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=Vn(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Vn(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[t]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let n,o,i,s;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(dm(c))o=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!dm(r[0])&&(s=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let a=r[0];return this._createRegisteredTool(t,void 0,n,o,i,s,{taskSupport:"forbidden"},void 0,a)}registerTool(t,r,n){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:o,description:i,inputSchema:s,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(t,o,i,s,a,c,{taskSupport:"forbidden"},u,n)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let o;r.length>1&&(o=r.shift());let i=r[0],s=this._createRegisteredPrompt(t,void 0,n,o,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,n){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:o,description:i,argsSchema:s}=r,a=this._createRegisteredPrompt(t,o,i,s,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var k1={type:"object",properties:{}};function h$(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function g$(e){return"_def"in e||"_zod"in e||h$(e)}function dm(e){return typeof e!="object"||e===null||g$(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(h$)}function p$(e){if(e){if(dm(e))return Vn(e);if(!g$(e))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}}function P1(e){let t=Jr(e);return t?Object.entries(t).map(([r,n])=>{let o=J_(n),i=G_(n);return{name:r,description:o,required:!i}}):[]}function sn(e){let r=Jr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=ka(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function m$(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Rs={completion:{values:[],hasMore:!1}};import _$ from"node:process";var qc=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
51
|
+
]`;continue}o+=n[c],n[c]==="\\"?i=!0:s&&n[c]==="]"?s=!1:!s&&n[c]==="["&&(s=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function Ya(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===E.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:W(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??je(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:W(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===E.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=Xa(e.keyType._def,t);return{...r,propertyNames:o}}else{if(e.keyType?._def.typeName===E.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===E.ZodBranded&&e.keyType._def.type._def.typeName===E.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=Ka(e.keyType._def,t);return{...r,propertyNames:o}}}return r}function Kv(e,t){if(t.mapStrategy==="record")return Ya(e,t);let r=W(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||je(t),n=W(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||je(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Xv(e){let t=e.values,n=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),o=Array.from(new Set(n.map(i=>typeof i)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Yv(e){return e.target==="openAi"?void 0:{not:je({...e,currentPath:[...e.currentPath,"not"]})}}function Qv(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Yi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tb(e,t){if(t.target==="openApi3")return eb(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in Yi&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,i)=>{let s=Yi[i._def.typeName];return s&&!o.includes(s)?[...o,s]: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,i)=>{let s=typeof i._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":if(i._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){let o=n.filter((i,s,a)=>a.indexOf(i)===s);return{type:o.length>1?o:o[0],enum:r.reduce((i,s)=>i.includes(s._def.value)?i:[...i,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(i=>!n.includes(i))],[])};return eb(e,t)}var eb=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>W(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function rb(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:Yi[e.innerType._def.typeName],nullable:!0}:{type:[Yi[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=W(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=W(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function nb(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",cf(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?ie(r,"minimum",n.value,n.message,t):ie(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),ie(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?ie(r,"maximum",n.value,n.message,t):ie(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),ie(r,"maximum",n.value,n.message,t));break;case"multipleOf":ie(r,"multipleOf",n.value,n.message,t);break}return r}function ob(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},o=[],i=e.shape();for(let a in i){let c=i[a];if(c===void 0||c._def===void 0)continue;let u=mO(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=W(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let s=pO(e,t);return s!==void 0&&(n.additionalProperties=s),n}function pO(e,t){if(e.catchall._def.typeName!=="ZodNever")return W(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function mO(e){try{return e.isOptional()}catch{return!0}}var ib=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return W(e.innerType._def,t);let r=W(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:je(t)},r]}:je(t)};var sb=(e,t)=>{if(t.pipeStrategy==="input")return W(e.in._def,t);if(t.pipeStrategy==="output")return W(e.out._def,t);let r=W(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=W(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function ab(e,t){return W(e.type._def,t)}function cb(e,t){let n={type:"array",uniqueItems:!0,items:W(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&ie(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&ie(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}function ub(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>W(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:W(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>W(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function lb(e){return{not:je(e)}}function db(e){return je(e)}var fb=(e,t)=>W(e.innerType._def,t);var pb=(e,t,r)=>{switch(t){case E.ZodString:return Xa(e,r);case E.ZodNumber:return nb(e,r);case E.ZodObject:return ob(e,r);case E.ZodBigInt:return Lv(e,r);case E.ZodBoolean:return Fv();case E.ZodDate:return uf(e,r);case E.ZodUndefined:return lb(r);case E.ZodNull:return Qv(r);case E.ZodArray:return Zv(e,r);case E.ZodUnion:case E.ZodDiscriminatedUnion:return tb(e,r);case E.ZodIntersection:return Wv(e,r);case E.ZodTuple:return ub(e,r);case E.ZodRecord:return Ya(e,r);case E.ZodLiteral:return Jv(e,r);case E.ZodEnum:return Bv(e);case E.ZodNativeEnum:return Xv(e);case E.ZodNullable:return rb(e,r);case E.ZodOptional:return ib(e,r);case E.ZodMap:return Kv(e,r);case E.ZodSet:return cb(e,r);case E.ZodLazy:return()=>e.getter()._def;case E.ZodPromise:return ab(e,r);case E.ZodNaN:case E.ZodNever:return Yv(r);case E.ZodEffects:return Hv(e,r);case E.ZodAny:return je(r);case E.ZodUnknown:return db(r);case E.ZodDefault:return Vv(e,r);case E.ZodBranded:return Ka(e,r);case E.ZodReadonly:return fb(e,r);case E.ZodCatch:return Uv(e,r);case E.ZodPipeline:return sb(e,r);case E.ZodFunction:case E.ZodVoid:case E.ZodSymbol:return;default:return(n=>{})(t)}};function W(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==Dv)return a}if(n&&!r){let a=hO(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let i=pb(e,e.typeName,t),s=typeof i=="function"?W(i(),t):i;if(s&&gO(e,t,s),t.postProcess){let a=t.postProcess(s,e,t);return o.jsonSchema=s,a}return o.jsonSchema=s,s}var hO=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ga(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),je(t)):t.$refStrategy==="seen"?je(t):void 0}},gO=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var ff=(e,t)=>{let r=qv(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:W(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??je(r)}),{}):void 0,o=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=W(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??je(r),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(i.title=s),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?{...i,[r.definitionPath]:n}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:i}};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 yO(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function pf(e,t){return At(e)?Md(e,{target:yO(t?.target),io:t?.pipeStrategy??"input"}):ff(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function mf(e){let r=Jr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=ka(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function hf(e,t){let r=Wr(e,t);if(!r.success)throw r.error;return r.data}var _O=6e4,Qa=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ca,r=>{this._oncancel(r)}),this.setNotificationHandler(Ma,r=>{this._onprogress(r)}),this.setRequestHandler(ja,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Na,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(U.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Da,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(i,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 Z(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 s=await this._taskStore.getTask(i,n.sessionId);if(!s)throw new Z(U.InvalidParams,`Task not found: ${i}`);if(!Kr(s.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Kr(s.status)){let a=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...a,_meta:{...a._meta,[Gr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Aa,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new Z(U.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Za,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(U.InvalidParams,`Task not found: ${r.params.taskId}`);if(Kr(o.status))throw new Z(U.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Z(U.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof Z?o:new Z(U.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),Z.fromError(U.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,s)=>{o?.(i,s),Ui(i)||kv(i)?this._onresponse(i):Wd(i)?this._onrequest(i,s):Sv(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=Z.fromError(U.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[Gr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:U.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(t.id,s);let a=wv(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(s.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,h)=>{if(s.signal.aborted)throw new Z(U.ConnectionClosed,"Request was cancelled");let m={...h,relatedRequestId:t.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let p=m.relatedTask?.taskId??i;return p&&c&&await c.updateTaskStatus(p,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(s.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(s.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:U.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===s&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let s=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Ui(t))n(t);else{let s=new Z(t.error.code,t.error.message,t.error.data);n(s)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(Ui(t)&&t.result&&typeof t.result=="object"){let s=t.result;if(s.task&&typeof s.task=="object"){let a=s.task;typeof a.taskId=="string"&&(i=!0,this._taskProgressTokens.set(a.taskId,r))}}if(i||this._progressHandlers.delete(r),Ui(t))o(t);else{let s=Z.fromError(t.error.code,t.error.message,t.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(s){yield{type:"error",error:s instanceof Z?s:new Z(U.InternalError,String(s))}}return}let i;try{let s=await this.request(t,zo,n);if(s.task)i=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new Z(U.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:a},Kr(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:a.status==="failed"?yield{type:"error",error:new Z(U.InternalError,`Task ${i} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new Z(U.InternalError,`Task ${i} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof Z?s:new Z(U.InternalError,String(s))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=T=>{l(T)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(T){d(T);return}n?.signal?.throwIfAborted();let h=this._requestMessageId++,m={...t,jsonrpc:"2.0",id:h};n?.onprogress&&(this._progressHandlers.set(h,n.onprogress),m.params={...t.params,_meta:{...t.params?._meta||{},progressToken:h}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Gr]:c}});let p=T=>{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(T)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`)));let R=T instanceof Z?T:new Z(U.RequestTimeout,String(T));l(R)};this._responseHandlers.set(h,T=>{if(!n?.signal?.aborted){if(T instanceof Error)return l(T);try{let R=Wr(r,T.result);R.success?u(R.data):l(R.error)}catch(R){l(R)}}}),n?.signal?.addEventListener("abort",()=>{p(n?.signal?.reason)});let y=n?.timeout??_O,v=()=>p(Z.fromError(U.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(h,y,n?.maxTotalTimeout,v,n?.resetTimeoutOnProgress??!1);let P=c?.taskId;if(P){let T=R=>{let I=this._responseHandlers.get(h);I?I(R):this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))};this._requestResolvers.set(h,T),this._enqueueTaskMessage(P,{type:"request",message:m,timestamp:Date.now()}).catch(R=>{this._cleanupTimeout(h),l(R)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:s}).catch(T=>{this._cleanupTimeout(h),l(T)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ia,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},qa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},zv,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Gr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Gr]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Gr]:r.relatedTask}}}),await this._transport.send(s,r)}setRequestHandler(t,r){let n=mf(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let s=hf(t,o);return Promise.resolve(r(s,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=mf(t);this._notificationHandlers.set(n,o=>{let i=hf(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Wd(o.message)){let i=o.message.id,s=this._requestResolvers.get(i);s?(s(new Z(U.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new Z(U.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(s),i(new Z(U.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new Z(U.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,s)=>{await n.storeTaskResult(o,i,s,r);let a=await n.getTask(o,r);if(a){let c=Ji.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Kr(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,s)=>{let a=await n.getTask(o,r);if(!a)throw new Z(U.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Kr(a.status))throw new Z(U.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,s,r);let c=await n.getTask(o,r);if(c){let u=Ji.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Kr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function mb(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function hb(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let s=r[o];mb(s)&&mb(i)?r[o]={...s,...i}:r[o]=i}return r}var s$=Qs(tm(),1),a$=Qs(i$(),1);function w1(){let e=new s$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,a$.default)(e),e}var Mc=class{constructor(t){this._ajv=t??w1()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Nc=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],i=Array.isArray(o.content)?o.content:[o.content],s=i.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(s){if(i.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(h=>h.type==="tool_use").map(h=>h.id)),d=new Set(i.filter(h=>h.type==="tool_result").map(h=>h.toolUseId));if(l.size!==d.size||![...l].every(h=>d.has(h)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},Xi,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let i=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:i},Oo,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function c$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function u$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Ic=class extends Qa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ki.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Mc,this.setRequestHandler(Kd,n=>this._oninitialize(n)),this.setNotificationHandler(Xd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(of,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=n.params,a=Ki.safeParse(s);return a.success&&this._loggingLevels.set(i,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Nc(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=hb(this._capabilities,t)}setRequestHandler(t,r){let o=Jr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(At(o)){let a=o;i=a._zod?.def?.value??a.value}else{let a=o;i=a._def?.value??a.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let a=async(c,u)=>{let l=Wr(Eo,c);if(!l.success){let p=l.error instanceof Error?l.error.message:String(l.error);throw new Z(U.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:d}=l.data,h=await Promise.resolve(r(c,u));if(d.task){let p=Wr(zo,h);if(!p.success){let y=p.error instanceof Error?p.error.message:String(p.error);throw new Z(U.InvalidParams,`Invalid task creation result: ${y}`)}return p.data}let m=Wr(Wa,h);if(!m.success){let p=m.error instanceof Error?m.error.message:String(m.error);throw new Z(U.InvalidParams,`Invalid tools/call result: ${p}`)}return m.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){u$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&c$(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:_v.includes(r)?r:Hd,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"},Oa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),s=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=s?Array.isArray(s.content)?s.content:[s.content]:[],c=a.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(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 t.tools?this.request({method:"sampling/createMessage",params:t},sf,r):this.request({method:"sampling/createMessage",params:t},Xi,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Oo,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},Oo,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!a.valid)throw new Z(U.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(s){throw s instanceof Z?s:new Z(U.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},af,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var d$=Symbol.for("mcp.completable");function um(e){return!!e&&typeof e=="object"&&d$ in e}function f$(e){return e[d$]?.complete}var l$;(function(e){e.Completable="McpCompletable"})(l$||(l$={}));var x1=/^[A-Za-z0-9._-]{1,128}$/;function $1(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!x1.test(e)){let r=e.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,i)=>i.indexOf(n)===o);return t.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:t}}return{isValid:!0,warnings:t}}function S1(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)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 lm(e){let t=$1(e);return S1(e,t.warnings),t.isValid}var Dc=class{constructor(t){this._mcpServer=t}registerToolTask(t,r,n){let o={taskSupport:"required",...r.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,o,r._meta,n)}};var Ac=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Ic(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Dc(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(sn(Ba)),this.server.assertCanSetRequestHandler(sn(Eo)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Ba,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let n={name:t,title:r.title,description:r.description,inputSchema:(()=>{let o=Po(r.inputSchema);return o?pf(o,{strictUnions:!0,pipeStrategy:"input"}):k1})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let o=Po(r.outputSchema);o&&(n.outputSchema=pf(o,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Eo,async(t,r)=>{try{let n=this._registeredTools[t.params.name];if(!n)throw new Z(U.InvalidParams,`Tool ${t.params.name} not found`);if(!n.enabled)throw new Z(U.InvalidParams,`Tool ${t.params.name} disabled`);let o=!!t.params.task,i=n.execution?.taskSupport,s="createTask"in n.handler;if((i==="required"||i==="optional")&&!s)throw new Z(U.InternalError,`Tool ${t.params.name} has taskSupport '${i}' but was not registered with registerToolTask`);if(i==="required"&&!o)throw new Z(U.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(i==="optional"&&!o&&s)return await this.handleAutomaticTaskPolling(n,t,r);let a=await this.validateToolInput(n,t.params.arguments,t.params.name),c=await this.executeToolHandler(n,a,r);return o||await this.validateToolOutput(n,c,t.params.name),c}catch(n){if(n instanceof Z&&n.code===U.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,n){if(!t.inputSchema)return;let i=Po(t.inputSchema)??t.inputSchema,s=await $a(i,r);if(!s.success){let a="error"in s?s.error:"Unknown error",c=Sa(a);throw new Z(U.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return s.data}async validateToolOutput(t,r,n){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new Z(U.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let o=Po(t.outputSchema),i=await $a(o,r.structuredContent);if(!i.success){let s="error"in i?i.error:"Unknown error",a=Sa(s);throw new Z(U.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(t,r,n){let o=t.handler;if("createTask"in o){if(!n.taskStore)throw new Error("No task store provided.");let s={...n,taskStore:n.taskStore};if(t.inputSchema){let a=o;return await Promise.resolve(a.createTask(r,s))}else{let a=o;return await Promise.resolve(a.createTask(s))}}if(t.inputSchema){let s=o;return await Promise.resolve(s(r,n))}else{let s=o;return await Promise.resolve(s(n))}}async handleAutomaticTaskPolling(t,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(t,r.params.arguments,r.params.name),i=t.handler,s={...n,taskStore:n.taskStore},a=o?await Promise.resolve(i.createTask(o,s)):await Promise.resolve(i.createTask(s)),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 Z(U.InternalError,`Task ${c} not found during polling`);u=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(sn(Ja)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ja,async t=>{switch(t.params.ref.type){case"ref/prompt":return Mv(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Nv(t),this.handleResourceCompletion(t,t.params.ref);default:throw new Z(U.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let n=this._registeredPrompts[r.name];if(!n)throw new Z(U.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new Z(U.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return zs;let i=Jr(n.argsSchema)?.[t.params.argument.name];if(!um(i))return zs;let s=f$(i);if(!s)return zs;let a=await s(t.params.argument.value,t.params.context);return m$(a)}async handleResourceCompletion(t,r){let n=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return zs;throw new Z(U.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(t.params.argument.name);if(!o)return zs;let i=await o(t.params.argument.value,t.params.context);return m$(i)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(sn(La)),this.server.assertCanSetRequestHandler(sn(Fa)),this.server.assertCanSetRequestHandler(sn(Ua)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(La,async(t,r)=>{let n=Object.entries(this._registeredResources).filter(([i,s])=>s.enabled).map(([i,s])=>({uri:i,name:s.name,...s.metadata})),o=[];for(let i of Object.values(this._registeredResourceTemplates)){if(!i.resourceTemplate.listCallback)continue;let s=await i.resourceTemplate.listCallback(r);for(let a of s.resources)o.push({...i.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler(Fa,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Ua,async(t,r)=>{let n=new URL(t.params.uri),o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new Z(U.InvalidParams,`Resource ${n} disabled`);return o.readCallback(n,r)}for(let i of Object.values(this._registeredResourceTemplates)){let s=i.resourceTemplate.uriTemplate.match(n.toString());if(s)return i.readCallback(n,s,r)}throw new Z(U.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(sn(Va)),this.server.assertCanSetRequestHandler(sn(Ha)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Va,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?P1(r.argsSchema):void 0}))})),this.server.setRequestHandler(Ha,async(t,r)=>{let n=this._registeredPrompts[t.params.name];if(!n)throw new Z(U.InvalidParams,`Prompt ${t.params.name} not found`);if(!n.enabled)throw new Z(U.InvalidParams,`Prompt ${t.params.name} disabled`);if(n.argsSchema){let o=Po(n.argsSchema),i=await $a(o,t.params.arguments);if(!i.success){let c="error"in i?i.error:"Unknown error",u=Sa(c);throw new Z(U.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${u}`)}let s=i.data,a=n.callback;return await Promise.resolve(a(s,r))}else{let o=n.callback;return await Promise.resolve(o(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...n){let o;typeof n[0]=="object"&&(o=n.shift());let i=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,n,o){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(t,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let i=this._createRegisteredResourceTemplate(t,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}_createRegisteredResource(t,r,n,o,i){let s={name:t,title:r,metadata:o,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=s)),typeof a.name<"u"&&(s.name=a.name),typeof a.title<"u"&&(s.title=a.title),typeof a.metadata<"u"&&(s.metadata=a.metadata),typeof a.callback<"u"&&(s.readCallback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=s,s}_createRegisteredResourceTemplate(t,r,n,o,i){let s={resourceTemplate:n,title:r,metadata:o,readCallback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==t&&(delete this._registeredResourceTemplates[t],u.name&&(this._registeredResourceTemplates[u.name]=s)),typeof u.title<"u"&&(s.title=u.title),typeof u.template<"u"&&(s.resourceTemplate=u.template),typeof u.metadata<"u"&&(s.metadata=u.metadata),typeof u.callback<"u"&&(s.readCallback=u.callback),typeof u.enabled<"u"&&(s.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=s;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!n.completeCallback(u))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,n,o,i){let s={title:r,description:n,argsSchema:o===void 0?void 0:Vn(o),callback:i,enabled:!0,disable:()=>s.update({enabled:!1}),enable:()=>s.update({enabled:!0}),remove:()=>s.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=s)),typeof a.title<"u"&&(s.title=a.title),typeof a.description<"u"&&(s.description=a.description),typeof a.argsSchema<"u"&&(s.argsSchema=Vn(a.argsSchema)),typeof a.callback<"u"&&(s.callback=a.callback),typeof a.enabled<"u"&&(s.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=s,o&&Object.values(o).some(c=>{let u=c instanceof bt?c._def?.innerType:c;return um(u)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,n,o,i,s,a,c,u){lm(t);let l={title:r,description:n,inputSchema:p$(o),outputSchema:p$(i),annotations:s,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!==t&&(typeof d.name=="string"&&lm(d.name),delete this._registeredTools[t],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=Vn(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Vn(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[t]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let n,o,i,s;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(dm(c))o=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!dm(r[0])&&(s=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let a=r[0];return this._createRegisteredTool(t,void 0,n,o,i,s,{taskSupport:"forbidden"},void 0,a)}registerTool(t,r,n){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:o,description:i,inputSchema:s,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(t,o,i,s,a,c,{taskSupport:"forbidden"},u,n)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let o;r.length>1&&(o=r.shift());let i=r[0],s=this._createRegisteredPrompt(t,void 0,n,o,i);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,n){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:o,description:i,argsSchema:s}=r,a=this._createRegisteredPrompt(t,o,i,s,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var k1={type:"object",properties:{}};function h$(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function g$(e){return"_def"in e||"_zod"in e||h$(e)}function dm(e){return typeof e!="object"||e===null||g$(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(h$)}function p$(e){if(e){if(dm(e))return Vn(e);if(!g$(e))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}}function P1(e){let t=Jr(e);return t?Object.entries(t).map(([r,n])=>{let o=J_(n),i=G_(n);return{name:r,description:o,required:!i}}):[]}function sn(e){let r=Jr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=ka(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function m$(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var zs={completion:{values:[],hasMore:!1}};import _$ from"node:process";var qc=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
52
52
|
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),T1(r)}clear(){this._buffer=void 0}};function T1(e){return Pv.parse(JSON.parse(e))}function y$(e){return JSON.stringify(e)+`
|
|
53
|
-
`}var Zc=class{constructor(t=_$.stdin,r=_$.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new qc,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=y$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};function fm(e){let t={app:e,version:
|
|
53
|
+
`}var Zc=class{constructor(t=_$.stdin,r=_$.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new qc,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=y$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};function fm(e){let t={app:e,version:z1(Ko("__RED_BUILD_VERSION__",()=>"3.2.0")??"0.0.0-dev"),gitSha:Ko("__RED_BUILD_GIT_SHA__",()=>"bc031bb41bb2483b8b2f83d2f3e0d77120904fe4")??"unknown",buildTime:Ko("__RED_BUILD_TIME__",()=>"2026-08-01T11:57:11Z")??"unknown",bundleAsset:Ko("__RED_BUNDLE_ASSET__",()=>"code-nav.bundle.min.mjs")??"unknown"},r=Ko("__REDDB_SDK_VERSION__",()=>""),n=Ko("__REDDB_BINARY_TAG__",()=>"");return r&&(t.reddbSdkVersion=r),n&&(t.reddbBinaryTag=n),t}function z1(e){return e.startsWith("v")?e.slice(1):e}function v$(e){return`${e.app} ${e.version} ${e.gitSha}`}function Ko(e,t){try{let r=t();return typeof r=="string"&&r.length>0?r:void 0}catch{return process.env[e.replace(/^__|__$/g,"")]}}var b$={"=":"data",":=":{to:"data",typed:!0},":":"meta"},R1=/^[a-z][a-z0-9+.-]*:\/\//i;function E1(e,t){return typeof t=="string"?{separator:e,to:t,typed:!1,prefix:!1}:{separator:e,to:t.to,typed:t.typed??!1,prefix:t.prefix??!1}}function O1(e=b$){return Object.entries(e).map(([t,r])=>E1(t,r)).sort((t,r)=>r.separator.length-t.separator.length)}function C1(e){return/^-\d+(\.\d+)?$/.test(e)}function Rs(e){return!(!e||e.startsWith("-")&&!C1(e))}function Lc(e){if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;let t=Number(e);return!Number.isNaN(t)&&Number.isFinite(t)&&e.trim()!==""?t:e}function w$(e){if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}"))try{return JSON.parse(e)}catch{}let t=Number(e);return!Number.isNaN(t)&&Number.isFinite(t)&&e.trim()!==""?t:e.includes(",")?e.split(",").map(r=>w$(r.trim())):e}function ro(e,t){switch(t){case"boolean":return j1(e);case"number":return M1(e);case"array":return e.split(",").map(r=>Lc(r.trim()));default:return e}}function j1(e){let t=e.toLowerCase().trim();return t==="true"||t==="yes"||t==="1"||t==="on"}function M1(e){if(e.trim()==="")throw new TypeError(`Cannot convert "${e}" to number`);let t=Number(e);if(Number.isNaN(t))throw new TypeError(`Cannot convert "${e}" to number`);return t}function an(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}function N1(e,t={}){return e.map(r=>{let n=t[r.type];return n?n(r.value):r.value}).join("")}function $e(e,t){return{type:e,value:t}}function I1(e){let t=[],r=A1(e);if(t.push($e("section-header","Usage:"),$e("text"," "),$e("usage-text",r),$e("newline",`
|
|
54
54
|
`),$e("newline",`
|
|
55
55
|
`)),e.positional&&e.positional.length>0){t.push($e("section-header","Arguments:"),$e("newline",`
|
|
56
56
|
`));for(let n of e.positional)if(n.description){let o=n.variadic?`${n.name}...`:n.name;t.push($e("indent"," "),$e("positional-name",`<${o}>`)),n.required||t.push($e("positional-optional"," (optional)")),t.push($e("newline",`
|
|
57
57
|
`),$e("indent"," "),$e("option-description",n.description),$e("newline",`
|
|
58
58
|
`))}t.push($e("newline",`
|
|
59
59
|
`))}if(e.options&&Object.keys(e.options).length>0){t.push($e("section-header","Options:"),$e("newline",`
|
|
60
|
-
`));let n=q1(e.options);t.push(...n)}return t}function D1(e,t){let r=
|
|
61
|
-
`))}return r}function x$(e){let t=B1(e.options??{},e.autoShort??!1),r=O1(e.separators??b$);return{schema:e,parse(n){return Z1(n,e,t,r)},help(){return D1(e,e.formatter)}}}function Z1(e,t,r,n){let o={positional:{},options:{},errors:[],rest:[]},i=new Set(n.map(l=>l.to));for(let l of i)o[l]={};let s=0,a=t.positional??[],c=0,u=!1;for(;c<e.length;){let l=e[c];if(t.stopEarly&&s>0){o.rest=e.slice(c);break}if(l==="--"&&!u){u=!0,c++;continue}if(u){if(s<a.length){let h=a[s];if(h.variadic){let m=[];for(;c<e.length;){let p=e[c];m.push(h.type?ro(p,h.type):p),c++}o.positional[h.name]=m,s++}else{let m=h.type?ro(l,h.type):l;o.positional[h.name]=m,s++,c++}}else t.allowUnknown!==!1&&(o.rest=o.rest??[],o.rest.push(l)),c++;continue}if(l.startsWith("--")){c=V1(l,c,e,o,r,t);continue}if(l.startsWith("-")&&l.length>1&&!X1(l)){c=H1(l,c,e,o,r,t);continue}let d=L1(l,n);if(d){let{key:h,value:m,config:p}=d,y=o,v=y[p.to]??(y[p.to]={});v[h]=p.typed?w$(m):an(m),c++;continue}if(s<a.length){let h=a[s];if(h.variadic){let p=[];for(;c<e.length&&!e[c].startsWith("-");){let y=e[c];p.push(h.type?ro(y,h.type):y),c++}o.positional[h.name]=p,s++;continue}let m=h.type?ro(l,h.type):l;o.positional[h.name]=m,s++}else t.allowUnknown!==!1?o.rest.push(l):o.errors.push(`Unexpected positional argument: ${l}`);c++}return J1(o,t,r),G1(o,t,a),K1(o,t,r),o}function L1(e,t){if(
|
|
60
|
+
`));let n=q1(e.options);t.push(...n)}return t}function D1(e,t){let r=I1(e);return N1(r,t)}function A1(e){let t=["[options]"];if(e.positional)for(let r of e.positional)r.variadic?t.push(r.required?`<${r.name}...>`:`[${r.name}...]`):t.push(r.required?`<${r.name}>`:`[${r.name}]`);return t.join(" ")}function q1(e,t=!1){let r=[],n=[],o=t?"global-option-flag":"option-flag",i=t?"global-option-type":"option-type",s=t?"global-option-default":"option-default",a=t?"global-option-description":"option-description";for(let[u,l]of Object.entries(e)){if(l.hidden)continue;let d=[],h=y=>{d.includes(y)||d.push(y)};l.short&&h(`-${l.short}`),h(`--${u}`);for(let y of l.aliases??[])y.length===1?h(`-${y}`):h(`--${y}`);let m=d.join(", "),p=l.type&&l.type!=="boolean"?`<${l.type}>`:void 0;n.push({flags:m,type:p,desc:l.description??"",default:l.default!==void 0?String(l.default):void 0})}let c=Math.max(...n.map(u=>u.flags.length+(u.type?u.type.length+1:0)),20);for(let u of n){let l=u.flags.length+(u.type?u.type.length+1:0),d=" ".repeat(c-l+2);r.push($e("indent"," ")),r.push($e(o,u.flags)),u.type&&(r.push($e("text"," ")),r.push($e(i,u.type))),r.push($e("text",d)),r.push($e(a,u.desc)),u.default!==void 0&&(r.push($e("text"," ")),r.push($e(s,`(default: ${u.default})`))),r.push($e("newline",`
|
|
61
|
+
`))}return r}function x$(e){let t=B1(e.options??{},e.autoShort??!1),r=O1(e.separators??b$);return{schema:e,parse(n){return Z1(n,e,t,r)},help(){return D1(e,e.formatter)}}}function Z1(e,t,r,n){let o={positional:{},options:{},errors:[],rest:[]},i=new Set(n.map(l=>l.to));for(let l of i)o[l]={};let s=0,a=t.positional??[],c=0,u=!1;for(;c<e.length;){let l=e[c];if(t.stopEarly&&s>0){o.rest=e.slice(c);break}if(l==="--"&&!u){u=!0,c++;continue}if(u){if(s<a.length){let h=a[s];if(h.variadic){let m=[];for(;c<e.length;){let p=e[c];m.push(h.type?ro(p,h.type):p),c++}o.positional[h.name]=m,s++}else{let m=h.type?ro(l,h.type):l;o.positional[h.name]=m,s++,c++}}else t.allowUnknown!==!1&&(o.rest=o.rest??[],o.rest.push(l)),c++;continue}if(l.startsWith("--")){c=V1(l,c,e,o,r,t);continue}if(l.startsWith("-")&&l.length>1&&!X1(l)){c=H1(l,c,e,o,r,t);continue}let d=L1(l,n);if(d){let{key:h,value:m,config:p}=d,y=o,v=y[p.to]??(y[p.to]={});v[h]=p.typed?w$(m):an(m),c++;continue}if(s<a.length){let h=a[s];if(h.variadic){let p=[];for(;c<e.length&&!e[c].startsWith("-");){let y=e[c];p.push(h.type?ro(y,h.type):y),c++}o.positional[h.name]=p,s++;continue}let m=h.type?ro(l,h.type):l;o.positional[h.name]=m,s++}else t.allowUnknown!==!1?o.rest.push(l):o.errors.push(`Unexpected positional argument: ${l}`);c++}return J1(o,t,r),G1(o,t,a),K1(o,t,r),o}function L1(e,t){if(R1.test(e))return null;for(let r of t){if(r.prefix&&e.startsWith(r.separator)){let o=e.slice(r.separator.length),i=o.indexOf(":");if(i>0){let s=o.slice(0,i),a=o.slice(i+1);if(F1(s))return{key:s,value:a,config:r}}continue}let n=e.indexOf(r.separator);if(n>0){let o=e.slice(0,n),i=e.slice(n+r.separator.length);if(U1(o,i,r))return{key:o,value:i,config:r}}}return null}function F1(e){return e?/^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(e):!1}function U1(e,t,r){return e?r.separator===":"?e.includes("/")||e.includes(".")||/^\d+$/.test(t)?!1:/^[A-Z][a-zA-Z0-9-]*$/.test(e):!((r.separator==="="||r.separator===":=")&&e.includes("/")):!1}function V1(e,t,r,n,o,i){let s=e.slice(2);if(s.startsWith("no-")){let c=s.slice(3),u=o.get(c);if(u?.negatable!==!1&&u?.type==="boolean")return n.options[u.name]=!1,t+1}if(s.includes("=")){let c=s.indexOf("="),u=s.slice(0,c),l=s.slice(c+1);return Fc(u,l,t+1,n,o,i)}let a=o.get(s);if(a){if(a.type!=="boolean"){let c=r[t+1];return Rs(c)?Fc(a.name,c,t+2,n,o,i):(n.errors.push(`Option --${s} requires a value`),t+1)}return n.options[a.name]=!0,t+1}return i.strict?n.errors.push(`Unknown option: --${s}`):i.allowUnknown!==!1&&(n.options[s]=!0),t+1}function H1(e,t,r,n,o,i){let s=e.slice(1);if(s.includes("=")){let a=s.indexOf("="),c=s.slice(0,a),u=s.slice(a+1),l=pm(c,o);return l?Fc(l.name,u,t+1,n,o,i):(i.strict?n.errors.push(`Unknown option: -${c}`):i.allowUnknown!==!1&&(n.options[c]=Lc(an(u))),t+1)}if(s.length===1){let a=pm(s,o);if(a){if(a.type!=="boolean"){let c=r[t+1];return Rs(c)?Fc(a.name,c,t+2,n,o,i):(n.errors.push(`Option -${s} requires a value`),t+1)}return n.options[a.name]=!0,t+1}if(i.strict)n.errors.push(`Unknown option: -${s}`);else if(i.allowUnknown!==!1){let c=r[t+1];if(Rs(c))return n.options[s]=Lc(an(c)),t+2;n.options[s]=!0}return t+1}for(let a of s){let c=pm(a,o);c?c.type==="boolean"?n.options[c.name]=!0:n.errors.push(`Option -${a} requires a value`):i.strict?n.errors.push(`Unknown option: -${a}`):i.allowUnknown!==!1&&(n.options[a]=!0)}return t+1}function Fc(e,t,r,n,o,i){let s=o.get(e);if(s){if(s.choices){let c=s.type?ro(an(t),s.type):an(t);if(!s.choices.includes(c))return n.errors.push(`Invalid value for '${e}': '${t}'. Allowed: ${s.choices.join(", ")}`),r}let a=s.type?ro(an(t),s.type):an(t);if(s.type==="array"){let c=n.options[e];Array.isArray(c)?c.push(...a):n.options[e]=a}else n.options[e]=a}else i.strict?n.errors.push(`Unknown option: --${e}`):i.allowUnknown!==!1&&(n.options[e]=Lc(an(t)));return r}function B1(e,t=!1){let r=new Map,n=Object.entries(e).sort(([i],[s])=>i.localeCompare(s)),o=new Set;for(let[,i]of n)i.short&&o.add(i.short);for(let[i,s]of n){let a=s.short??"";t&&!a&&(a=W1(i,o),a&&o.add(a));let c={name:i,short:a,aliases:s.aliases??[],type:s.type??"string",description:s.description??"",required:s.required??!1,hidden:s.hidden??!1,negatable:s.negatable??!0,default:s.default,choices:s.choices,env:s.env,validate:s.validate};r.set(i,c);for(let u of c.aliases)r.set(u,c)}return r}function W1(e,t){for(let r of e){if(!/[a-zA-Z]/.test(r))continue;let n=r.toLowerCase();if(!t.has(n))return n;let o=r.toUpperCase();if(!t.has(o))return o}return""}function pm(e,t){for(let r of t.values())if(r.short===e||r.aliases.includes(e))return r}function J1(e,t,r){for(let n of r.values())if(e.options[n.name]===void 0)if(n.env&&process.env[n.env]!==void 0){let o=process.env[n.env];e.options[n.name]=n.type?ro(o,n.type):o}else n.default!==void 0&&(e.options[n.name]=n.default);for(let n of t.positional??[])e.positional[n.name]===void 0&&n.default!==void 0&&(e.positional[n.name]=n.default)}function G1(e,t,r){if(t.options)for(let[n,o]of Object.entries(t.options))o.required&&e.options[n]===void 0&&e.errors.push(`Missing required option: --${n}`);for(let n of r)n.required&&e.positional[n.name]===void 0&&e.errors.push(`Missing required argument: <${n.name}>`)}function K1(e,t,r){for(let n of r.values()){let o=e.options[n.name];if(n.validate&&o!==void 0){let i=n.validate(o);i!==!0&&e.errors.push(i)}}for(let n of t.positional??[]){let o=e.positional[n.name];if(n.validate&&o!==void 0){let i=n.validate(o);i!==!0&&e.errors.push(i)}}}function X1(e){return/^-\d+(\.\d+)?$/.test(e)}var mm=class extends Error{flag;known;constructor(t,r){super(`unknown flag '${t}'; expected one of: ${r.join(", ")}`),this.name="UnknownFlagError",this.flag=t,this.known=r}};function Y1(e){let t={};for(let[r,n]of Object.entries(e))t[r]={type:n.kind==="boolean"?"boolean":"string",...r.length===1?{short:r}:{},...n.aliases===void 0?{}:{aliases:n.aliases}};return t}function Q1(e,t){let r=new Map;for(let[o,i]of Object.entries(t))if(!(i.kind!=="value"||i.type!=="array")){r.set(o,o);for(let s of i.aliases??[])r.set(s,o)}let n=new Map;for(let o=0;o<e.length;o+=1){let i=e[o];if(i==="--")break;let s=i.match(/^--([^=]+)(?:=(.*))?$/)??i.match(/^-([^=])(?:=(.*))?$/);if(s===null)continue;let a=r.get(s[1]);if(a===void 0)continue;let c=s[2];if(c===void 0&&Rs(e[o+1])&&(c=e[o+1],o+=1),c===void 0)continue;let u=n.get(a)??[];u.push(c),n.set(a,u)}return n}function $$(e,t,r={}){let o=x$({options:Y1(t),separators:{},allowUnknown:!0}).parse([...e]),i={},s=Q1(e,t),a=o.errors.find(c=>/^Option --?\S+ requires a value$/.test(c));if(a!==void 0)throw new Error(a.replace(/^Option /,""));if(o.errors.length>0)throw new Error(o.errors[0]);if(r.unknownFlags==="error"){let c=new Set(Object.keys(t));for(let u of Object.keys(o.options))if(!c.has(u))throw new mm(u.length===1?`-${u}`:`--${u}`,Object.keys(t).map(l=>l.length===1?`-${l}`:`--${l}`))}for(let[c,u]of Object.entries(t)){let l=o.options[c];l!==void 0&&(u.kind==="boolean"?i[c]=l:u.type==="array"?i[c]=(s.get(c)??[]).map(d=>u.coerce(d)):i[c]=u.coerce(String(l)))}return{values:i,positionals:o.rest}}var Es=class extends Error{token;known;constructor(t,r){super(`unknown command '${t}'; expected one of: ${r.join(", ")}`),this.name="UnknownCommandError",this.token=t,this.known=r}};function S$(e,t){let[r,...n]=e;if(r!==void 0){for(let[i,s]of Object.entries(t.commands))if(r===i||(s.aliases??[]).includes(r))return{command:i,args:n};if(t.errorOnUnknownCommand&&!r.startsWith("-"))throw new Es(r,Object.keys(t.commands))}let o=t.keepArgvOnDefault??!0;return{command:t.default,args:o?[...e]:n}}var eD={help:{kind:"boolean",aliases:["h"]},version:{kind:"boolean",aliases:["v"]},json:{kind:"boolean"}},no=class extends Error{constructor(t){super(t),this.name="CodeNavUsageError"}};function k$(e){return e[0]==="--version"||e[0]==="-v"||e[0]==="version"}function P$(e){let t;try{t=S$(e,{commands:{serve:{},version:{}},default:"serve",errorOnUnknownCommand:!0})}catch(i){throw i instanceof Es?new no(i.message):i}let r;try{r=$$(t.args,eD,{unknownFlags:"error"})}catch(i){throw new no(i.message)}let n=r.positionals[0];if(n!==void 0)throw new no(`unexpected argument '${n}'`);let{values:o}=r;return{command:t.command,showHelp:o.help??!1,showVersion:t.command==="version"||(o.version??!1),versionJson:o.json??!1}}function T$(){return`code-nav \u2014 LSP-backed code navigation as an MCP server
|
|
62
62
|
|
|
63
63
|
Serves goto-definition, find-references, document/workspace symbols and hover
|
|
64
64
|
over stdio, so a code agent resolves symbols instead of grepping for names.
|
|
@@ -82,11 +82,11 @@ Exit codes:
|
|
|
82
82
|
0 served until the transport closed, or printed the version/help
|
|
83
83
|
1 fatal error while serving
|
|
84
84
|
2 usage error
|
|
85
|
-
`}var hm={typescript:{command:"typescript-language-server",args:["--stdio"],extensions:[".ts",".tsx",".js",".jsx",".mts",".cts",".mjs",".cjs"],languageId:"typescript"},go:{command:"gopls",args:[],extensions:[".go"],languageId:"go"},rust:{command:"rust-analyzer",args:[],extensions:[".rs"],languageId:"rust"},python:{command:"pyright-langserver",args:["--stdio"],extensions:[".py",".pyi"],languageId:"python"}};function
|
|
86
|
-
`),hm}}function
|
|
87
|
-
`))}),c.registerTool("find_references",{title:"Find references",description:"Find every reference to the symbol at a file position across the workspace. Semantic \u2014 matches the actual symbol, not text.",inputSchema:{...
|
|
85
|
+
`}var hm={typescript:{command:"typescript-language-server",args:["--stdio"],extensions:[".ts",".tsx",".js",".jsx",".mts",".cts",".mjs",".cjs"],languageId:"typescript"},go:{command:"gopls",args:[],extensions:[".go"],languageId:"go"},rust:{command:"rust-analyzer",args:[],extensions:[".rs"],languageId:"rust"},python:{command:"pyright-langserver",args:["--stdio"],extensions:[".py",".pyi"],languageId:"python"}};function z$(){let e=process.env.CODE_NAV_SERVERS;if(!e)return hm;try{let t=JSON.parse(e),r={...hm};for(let[n,o]of Object.entries(t))r[n]={...r[n]??{},...o};return r}catch(t){return process.stderr.write(`navigator: failed to parse CODE_NAV_SERVERS, using defaults: ${String(t)}
|
|
86
|
+
`),hm}}function R$(e){let t=new Map;for(let[r,n]of Object.entries(e))for(let o of n.extensions)t.set(o,r);return t}var vi=Qs(Kk(),1),pt=Qs(uy(),1);import{spawn as qA}from"node:child_process";import{readFile as ZA}from"node:fs/promises";import{pathToFileURL as Xk,fileURLToPath as LA}from"node:url";import{resolve as FA}from"node:path";var Ks=class{constructor(t,r){this.spec=t;this.rootPath=r}spec;rootPath;proc;conn;ready;openDocs=new Set;async ensureStarted(){return this.ready?this.ready:(this.ready=this.start(),this.ready)}async start(){let t=qA(this.spec.command,this.spec.args,{cwd:this.rootPath,stdio:["pipe","pipe","pipe"]});this.proc=t,await new Promise((i,s)=>{t.once("spawn",()=>i()),t.once("error",a=>s(new Error(`failed to spawn '${this.spec.command}': ${a.message}`)))}),t.stderr.on("data",i=>{process.stderr.write(`[${this.spec.command}] ${i.toString()}`)}),t.once("exit",()=>{try{this.conn?.dispose()}catch{}});let r=(0,vi.createProtocolConnection)(new vi.StreamMessageReader(t.stdout),new vi.StreamMessageWriter(t.stdin));this.conn=r,r.listen();let n=Xk(this.rootPath).toString(),o={processId:process.pid,rootUri:n,workspaceFolders:[{uri:n,name:"workspace"}],capabilities:{textDocument:{definition:{linkSupport:!0},references:{},documentSymbol:{hierarchicalDocumentSymbolSupport:!0},hover:{contentFormat:["markdown","plaintext"]}},workspace:{symbol:{}}}};await r.sendRequest(pt.InitializeRequest.type,o),await r.sendNotification(pt.InitializedNotification.type,{})}async ensureOpen(t){let r=FA(this.rootPath,t),n=Xk(r).toString();if(this.openDocs.has(n))return n;let o=await ZA(r,"utf8");return await this.conn.sendNotification(pt.DidOpenTextDocumentNotification.type,{textDocument:{uri:n,languageId:this.spec.languageId,version:1,text:o}}),this.openDocs.add(n),n}async definition(t,r,n){await this.ensureStarted();let o=await this.ensureOpen(t),i=await this.conn.sendRequest(pt.DefinitionRequest.type,{textDocument:{uri:o},position:{line:r,character:n}});return UA(i)}async references(t,r,n,o){await this.ensureStarted();let i=await this.ensureOpen(t);return await this.conn.sendRequest(pt.ReferencesRequest.type,{textDocument:{uri:i},position:{line:r,character:n},context:{includeDeclaration:o}})??[]}async documentSymbols(t){await this.ensureStarted();let r=await this.ensureOpen(t);return await this.conn.sendRequest(pt.DocumentSymbolRequest.type,{textDocument:{uri:r}})??[]}async hover(t,r,n){await this.ensureStarted();let o=await this.ensureOpen(t);return this.conn.sendRequest(pt.HoverRequest.type,{textDocument:{uri:o},position:{line:r,character:n}})}async workspaceSymbols(t){return await this.ensureStarted(),await this.conn.sendRequest(pt.WorkspaceSymbolRequest.type,{query:t})??[]}dispose(){try{this.conn?.dispose()}catch{}this.proc?.kill()}};function UA(e){return e?(Array.isArray(e)?e:[e]).map(r=>"targetUri"in r?{uri:r.targetUri,range:r.targetSelectionRange}:r):[]}function ly(e,t){try{let r=LA(e);return(r.startsWith(t)?r.slice(t.length).replace(/^[/\\]/,""):r)||r}catch{return e}}var Ru={file:Vr.string().describe("Workspace-relative path to the source file."),line:Vr.number().int().describe("Zero-based line number."),character:Vr.number().int().describe("Zero-based character offset on the line.")};function HA(){let e=process.env.CODE_NAV_ROOT??process.cwd(),t=z$(),r=R$(t),n=new Map;function o(u){let l=VA(u),d=r.get(l);if(!d)throw new Error(`no language server configured for '${l}'. Configured extensions: ${[...r.keys()].join(", ")||"(none)"}.`);let h=n.get(d);return h||(h=new Ks(t[d],e),n.set(d,h)),h}function i(){for(let u of Object.keys(t))n.has(u)||n.set(u,new Ks(t[u],e));return[...n.values()]}function s(u,l){return`${ly(u,e)}:${l.start.line+1}:${l.start.character+1}`}let a=fm("navigator"),c=new Ac({name:"navigator",version:a.version});return c.registerTool("goto_definition",{title:"Go to definition",description:"Resolve the symbol at a file position to its definition(s). Returns file:line:column locations. Use this instead of grepping for a name.",inputSchema:Ru},async({file:u,line:l,character:d})=>{let h=await o(u).definition(u,l,d);return h.length===0?vr("No definition found."):vr(h.map(m=>s(m.uri,m.range)).join(`
|
|
87
|
+
`))}),c.registerTool("find_references",{title:"Find references",description:"Find every reference to the symbol at a file position across the workspace. Semantic \u2014 matches the actual symbol, not text.",inputSchema:{...Ru,includeDeclaration:Vr.boolean().optional().describe("Include the declaration itself (default true).")}},async({file:u,line:l,character:d,includeDeclaration:h})=>{let m=await o(u).references(u,l,d,h??!0);return m.length===0?vr("No references found."):vr(`${m.length} reference(s):
|
|
88
88
|
`+m.map(p=>s(p.uri,p.range)).join(`
|
|
89
|
-
`))}),c.registerTool("document_symbols",{title:"Document symbols",description:"List the symbols (functions, types, methods, \u2026) defined in a file, with their positions. A semantic outline of the file.",inputSchema:{file:
|
|
89
|
+
`))}),c.registerTool("document_symbols",{title:"Document symbols",description:"List the symbols (functions, types, methods, \u2026) defined in a file, with their positions. A semantic outline of the file.",inputSchema:{file:Ru.file}},async({file:u})=>{let l=await o(u).documentSymbols(u);return l.length===0?vr("No symbols found."):vr(Qk(l))}),c.registerTool("hover",{title:"Hover (type / docs)",description:"Get the type signature and documentation for the symbol at a file position, as the IDE hover card would show.",inputSchema:Ru},async({file:u,line:l,character:d})=>{let h=await o(u).hover(u,l,d);if(!h||!h.contents)return vr("No hover information.");let m=h.contents,p=typeof m=="string"?m:Array.isArray(m)?m.map(y=>typeof y=="string"?y:y.value).join(`
|
|
90
90
|
`):m.value;return vr(p)}),c.registerTool("workspace_symbols",{title:"Search symbols by name",description:"Find symbols by name across the whole workspace. Start here when you know a name but not where it lives, then use goto_definition / find_references from the returned position.",inputSchema:{query:Vr.string().describe("Symbol name or fragment to search for.")}},async({query:u})=>{let d=(await Promise.all(i().map(m=>m.workspaceSymbols(u).catch(()=>[])))).flat();if(d.length===0)return vr(`No symbols matching '${u}'.`);let h=d.slice(0,100).map(m=>{let p=m.location,y=p?.range?s(p.uri,p.range):ly(p?.uri??"",e);return`${m.name} ${y}`});return vr(h.join(`
|
|
91
91
|
`))}),{server:c,root:e,languages:Object.keys(t),dispose:()=>{for(let u of n.values())u.dispose()}}}function vr(e){return{content:[{type:"text",text:e}]}}function Qk(e,t=0){let r=" ".repeat(t);return e.map(n=>{let o=n.selectionRange??n.range??n.location?.range,i=o?`:${o.start.line+1}`:"",s=`${r}${n.name}${i}`,a=n.children?.length?`
|
|
92
92
|
`+Qk(n.children,t+1):"";return s+a}).join(`
|