@neurynae/toolcairn-mcp 0.10.19 → 0.10.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +188 -138
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
1
|
import { createRequire as __nodeCreateRequire } from 'module'; const require = __nodeCreateRequire(import.meta.url);
|
|
2
|
-
var Yj=Object.create;var Sp=Object.defineProperty;var Xj=Object.getOwnPropertyDescriptor;var Qj=Object.getOwnPropertyNames;var ez=Object.getPrototypeOf,tz=Object.prototype.hasOwnProperty;var Te=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var rz=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kp=(t,e)=>{for(var r in e)Sp(t,r,{get:e[r],enumerable:!0})},nz=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Qj(e))!tz.call(t,s)&&s!==r&&Sp(t,s,{get:()=>e[s],enumerable:!(n=Xj(e,s))||n.enumerable});return t};var se=(t,e,r)=>(r=t!=null?Yj(ez(t)):{},nz(e||!t||!t.__esModule?Sp(r,"default",{value:t,enumerable:!0}):r,t));import sz from"path";import{fileURLToPath as oz}from"url";var w0,iz,y,v,f=rz(()=>{"use strict";w0=()=>oz(import.meta.url),iz=()=>sz.dirname(w0()),y=iz(),v=w0()});var Pa=S($e=>{"use strict";f();Object.defineProperty($e,"__esModule",{value:!0});$e.regexpCode=$e.getEsmExportName=$e.getProperty=$e.safeStringify=$e.stringify=$e.strConcat=$e.addCodeArg=$e.str=$e._=$e.nil=$e._Code=$e.Name=$e.IDENTIFIER=$e._CodeOrName=void 0;var $a=class{};$e._CodeOrName=$a;$e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ns=class extends $a{constructor(e){if(super(),!$e.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$e.Name=Ns;var rr=class extends $a{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ns&&(r[n.str]=(r[n.str]||0)+1),r),{})}};$e._Code=rr;$e.nil=new rr("");function mk(t,...e){let r=[t[0]],n=0;for(;n<e.length;)og(r,e[n]),r.push(t[++n]);return new rr(r)}$e._=mk;var sg=new rr("+");function gk(t,...e){let r=[Ia(t[0])],n=0;for(;n<e.length;)r.push(sg),og(r,e[n]),r.push(sg,Ia(t[++n]));return nD(r),new rr(r)}$e.str=gk;function og(t,e){e instanceof rr?t.push(...e._items):e instanceof Ns?t.push(e):t.push(iD(e))}$e.addCodeArg=og;function nD(t){let e=1;for(;e<t.length-1;){if(t[e]===sg){let r=sD(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function sD(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ns||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ns))return`"${t}${e.slice(1)}`}function oD(t,e){return e.emptyStr()?t:t.emptyStr()?e:gk`${t}${e}`}$e.strConcat=oD;function iD(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ia(Array.isArray(t)?t.join(","):t)}function aD(t){return new rr(Ia(t))}$e.stringify=aD;function Ia(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$e.safeStringify=Ia;function cD(t){return typeof t=="string"&&$e.IDENTIFIER.test(t)?new rr(`.${t}`):mk`[${t}]`}$e.getProperty=cD;function uD(t){if(typeof t=="string"&&$e.IDENTIFIER.test(t))return new rr(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}$e.getEsmExportName=uD;function lD(t){return new rr(t.toString())}$e.regexpCode=lD});var cg=S(jt=>{"use strict";f();Object.defineProperty(jt,"__esModule",{value:!0});jt.ValueScope=jt.ValueScopeName=jt.Scope=jt.varKinds=jt.UsedValueState=void 0;var Rt=Pa(),ig=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},fl;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(fl||(jt.UsedValueState=fl={}));jt.varKinds={const:new Rt.Name("const"),let:new Rt.Name("let"),var:new Rt.Name("var")};var pl=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Rt.Name?e:this.name(e)}name(e){return new Rt.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};jt.Scope=pl;var hl=class extends Rt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Rt._)`.${new Rt.Name(r)}[${n}]`}};jt.ValueScopeName=hl;var dD=(0,Rt._)`\n`,ag=class extends pl{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?dD:Rt.nil}}get(){return this._scope}name(e){return new hl(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let l=a.get(i);if(l)return l}else a=this._values[o]=new Map;a.set(i,s);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,s.setValue(r,{property:o,itemIndex:u}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Rt._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=Rt.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,fl.Started);let l=r(u);if(l){let d=this.opts.es5?jt.varKinds.var:jt.varKinds.const;o=(0,Rt._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=s?.(u))o=(0,Rt._)`${o}${l}${this.opts._n}`;else throw new ig(u);c.set(u,fl.Completed)})}return o}};jt.ValueScope=ag});var me=S(ge=>{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.or=ge.and=ge.not=ge.CodeGen=ge.operators=ge.varKinds=ge.ValueScopeName=ge.ValueScope=ge.Scope=ge.Name=ge.regexpCode=ge.stringify=ge.getProperty=ge.nil=ge.strConcat=ge.str=ge._=void 0;var xe=Pa(),wr=cg(),Nn=Pa();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return Nn._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return Nn.str}});Object.defineProperty(ge,"strConcat",{enumerable:!0,get:function(){return Nn.strConcat}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return Nn.nil}});Object.defineProperty(ge,"getProperty",{enumerable:!0,get:function(){return Nn.getProperty}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return Nn.stringify}});Object.defineProperty(ge,"regexpCode",{enumerable:!0,get:function(){return Nn.regexpCode}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return Nn.Name}});var _l=cg();Object.defineProperty(ge,"Scope",{enumerable:!0,get:function(){return _l.Scope}});Object.defineProperty(ge,"ValueScope",{enumerable:!0,get:function(){return _l.ValueScope}});Object.defineProperty(ge,"ValueScopeName",{enumerable:!0,get:function(){return _l.ValueScopeName}});Object.defineProperty(ge,"varKinds",{enumerable:!0,get:function(){return _l.varKinds}});ge.operators={GT:new xe._Code(">"),GTE:new xe._Code(">="),LT:new xe._Code("<"),LTE:new xe._Code("<="),EQ:new xe._Code("==="),NEQ:new xe._Code("!=="),NOT:new xe._Code("!"),OR:new xe._Code("||"),AND:new xe._Code("&&"),ADD:new xe._Code("+")};var cn=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ug=class extends cn{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?wr.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Yo(this.rhs,e,r)),this}get names(){return this.rhs instanceof xe._CodeOrName?this.rhs.names:{}}},ml=class extends cn{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof xe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Yo(this.rhs,e,r),this}get names(){let e=this.lhs instanceof xe.Name?{}:{...this.lhs.names};return yl(e,this.rhs)}},lg=class extends ml{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},dg=class extends cn{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},fg=class extends cn{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},pg=class extends cn{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},hg=class extends cn{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Yo(this.code,e,r),this}get names(){return this.code instanceof xe._CodeOrName?this.code.names:{}}},Oa=class extends cn{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(fD(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>zs(e,r.names),{})}},un=class extends Oa{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},mg=class extends Oa{},Wo=class extends un{};Wo.kind="else";var Rs=class t extends un{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Wo(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(yk(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Yo(this.condition,e,r),this}get names(){let e=super.names;return yl(e,this.condition),this.else&&zs(e,this.else.names),e}};Rs.kind="if";var js=class extends un{};js.kind="for";var gg=class extends js{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Yo(this.iteration,e,r),this}get names(){return zs(super.names,this.iteration.names)}},yg=class extends js{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?wr.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=yl(super.names,this.from);return yl(e,this.to)}},gl=class extends js{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Yo(this.iterable,e,r),this}get names(){return zs(super.names,this.iterable.names)}},Ca=class extends un{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Ca.kind="func";var Aa=class extends Oa{render(e){return"return "+super.render(e)}};Aa.kind="return";var _g=class extends un{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&zs(e,this.catch.names),this.finally&&zs(e,this.finally.names),e}},Na=class extends un{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Na.kind="catch";var Ra=class extends un{render(e){return"finally"+super.render(e)}};Ra.kind="finally";var vg=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=e,this._scope=new wr.Scope({parent:e}),this._nodes=[new mg]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new ug(e,o,n)),o}const(e,r,n){return this._def(wr.varKinds.const,e,r,n)}let(e,r,n){return this._def(wr.varKinds.let,e,r,n)}var(e,r,n){return this._def(wr.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ml(e,r,n))}add(e,r){return this._leafNode(new lg(e,ge.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==xe.nil&&this._leafNode(new hg(e)),this}object(...e){let r=["{"];for(let[n,s]of e)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0,xe.addCodeArg)(r,s));return r.push("}"),new xe._Code(r)}if(e,r,n){if(this._blockNode(new Rs(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Rs(e))}else(){return this._elseNode(new Wo)}endIf(){return this._endBlockNode(Rs,Wo)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new gg(e),r)}forRange(e,r,n,s,o=this.opts.es5?wr.varKinds.var:wr.varKinds.let){let i=this._scope.toName(e);return this._for(new yg(o,i,r,n),()=>s(i))}forOf(e,r,n,s=wr.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let i=r instanceof xe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,xe._)`${i}.length`,a=>{this.var(o,(0,xe._)`${i}[${a}]`),n(o)})}return this._for(new gl("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?wr.varKinds.var:wr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,xe._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new gl("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(js)}label(e){return this._leafNode(new dg(e))}break(e){return this._leafNode(new fg(e))}return(e){let r=new Aa;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Aa)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new _g;if(this._blockNode(s),this.code(e),r){let o=this.name("e");this._currNode=s.catch=new Na(o),r(o)}return n&&(this._currNode=s.finally=new Ra,this.code(n)),this._endBlockNode(Na,Ra)}throw(e){return this._leafNode(new pg(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=xe.nil,n,s){return this._blockNode(new Ca(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Ca)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Rs))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};ge.CodeGen=vg;function zs(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function yl(t,e){return e instanceof xe._CodeOrName?zs(t,e.names):t}function Yo(t,e,r){if(t instanceof xe.Name)return n(t);if(!s(t))return t;return new xe._Code(t._items.reduce((o,i)=>(i instanceof xe.Name&&(i=n(i)),i instanceof xe._Code?o.push(...i._items):o.push(i),o),[]));function n(o){let i=r[o.str];return i===void 0||e[o.str]!==1?o:(delete e[o.str],i)}function s(o){return o instanceof xe._Code&&o._items.some(i=>i instanceof xe.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function fD(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function yk(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,xe._)`!${bg(t)}`}ge.not=yk;var pD=_k(ge.operators.AND);function hD(...t){return t.reduce(pD)}ge.and=hD;var mD=_k(ge.operators.OR);function gD(...t){return t.reduce(mD)}ge.or=gD;function _k(t){return(e,r)=>e===xe.nil?r:r===xe.nil?e:(0,xe._)`${bg(e)} ${t} ${bg(r)}`}function bg(t){return t instanceof xe.Name?t:(0,xe._)`(${t})`}});var Se=S(ye=>{"use strict";f();Object.defineProperty(ye,"__esModule",{value:!0});ye.checkStrictMode=ye.getErrorPath=ye.Type=ye.useFunc=ye.setEvaluated=ye.evaluatedPropsToName=ye.mergeEvaluated=ye.eachItem=ye.unescapeJsonPointer=ye.escapeJsonPointer=ye.escapeFragment=ye.unescapeFragment=ye.schemaRefOrVal=ye.schemaHasRulesButRef=ye.schemaHasRules=ye.checkUnknownRules=ye.alwaysValidSchema=ye.toHash=void 0;var Me=me(),yD=Pa();function _D(t){let e={};for(let r of t)e[r]=!0;return e}ye.toHash=_D;function vD(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(wk(t,e),!xk(e,t.self.RULES.all))}ye.alwaysValidSchema=vD;function wk(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let s=n.RULES.keywords;for(let o in e)s[o]||Ek(t,`unknown keyword: "${o}"`)}ye.checkUnknownRules=wk;function xk(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ye.schemaHasRules=xk;function bD(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ye.schemaHasRulesButRef=bD;function wD({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Me._)`${r}`}return(0,Me._)`${t}${e}${(0,Me.getProperty)(n)}`}ye.schemaRefOrVal=wD;function xD(t){return Sk(decodeURIComponent(t))}ye.unescapeFragment=xD;function SD(t){return encodeURIComponent(xg(t))}ye.escapeFragment=SD;function xg(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ye.escapeJsonPointer=xg;function Sk(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ye.unescapeJsonPointer=Sk;function kD(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ye.eachItem=kD;function vk({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof Me.Name?(o instanceof Me.Name?t(s,o,i):e(s,o,i),i):o instanceof Me.Name?(e(s,i,o),o):r(o,i);return a===Me.Name&&!(c instanceof Me.Name)?n(s,c):c}}ye.mergeEvaluated={props:vk({mergeNames:(t,e,r)=>t.if((0,Me._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Me._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Me._)`${r} || {}`).code((0,Me._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Me._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Me._)`${r} || {}`),Sg(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:kk}),items:vk({mergeNames:(t,e,r)=>t.if((0,Me._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Me._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Me._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Me._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function kk(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Me._)`{}`);return e!==void 0&&Sg(t,r,e),r}ye.evaluatedPropsToName=kk;function Sg(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Me._)`${e}${(0,Me.getProperty)(n)}`,!0))}ye.setEvaluated=Sg;var bk={};function ED(t,e){return t.scopeValue("func",{ref:e,code:bk[e.code]||(bk[e.code]=new yD._Code(e.code))})}ye.useFunc=ED;var wg;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(wg||(ye.Type=wg={}));function TD(t,e,r){if(t instanceof Me.Name){let n=e===wg.Num;return r?n?(0,Me._)`"[" + ${t} + "]"`:(0,Me._)`"['" + ${t} + "']"`:n?(0,Me._)`"/" + ${t}`:(0,Me._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Me.getProperty)(t).toString():"/"+xg(t)}ye.getErrorPath=TD;function Ek(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ye.checkStrictMode=Ek});var ln=S(kg=>{"use strict";f();Object.defineProperty(kg,"__esModule",{value:!0});var wt=me(),$D={data:new wt.Name("data"),valCxt:new wt.Name("valCxt"),instancePath:new wt.Name("instancePath"),parentData:new wt.Name("parentData"),parentDataProperty:new wt.Name("parentDataProperty"),rootData:new wt.Name("rootData"),dynamicAnchors:new wt.Name("dynamicAnchors"),vErrors:new wt.Name("vErrors"),errors:new wt.Name("errors"),this:new wt.Name("this"),self:new wt.Name("self"),scope:new wt.Name("scope"),json:new wt.Name("json"),jsonPos:new wt.Name("jsonPos"),jsonLen:new wt.Name("jsonLen"),jsonPart:new wt.Name("jsonPart")};kg.default=$D});var ja=S(xt=>{"use strict";f();Object.defineProperty(xt,"__esModule",{value:!0});xt.extendErrors=xt.resetErrorsCount=xt.reportExtraError=xt.reportError=xt.keyword$DataError=xt.keywordError=void 0;var ke=me(),vl=Se(),$t=ln();xt.keywordError={message:({keyword:t})=>(0,ke.str)`must pass "${t}" keyword validation`};xt.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ke.str)`"${t}" keyword must be ${e} ($data)`:(0,ke.str)`"${t}" keyword is invalid ($data)`};function ID(t,e=xt.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:i,allErrors:a}=s,c=Ik(t,e,r);n??(i||a)?Tk(o,c):$k(s,(0,ke._)`[${c}]`)}xt.reportError=ID;function PD(t,e=xt.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:i}=n,a=Ik(t,e,r);Tk(s,a),o||i||$k(n,$t.default.vErrors)}xt.reportExtraError=PD;function OD(t,e){t.assign($t.default.errors,e),t.if((0,ke._)`${$t.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ke._)`${$t.default.vErrors}.length`,e),()=>t.assign($t.default.vErrors,null)))}xt.resetErrorsCount=OD;function CD({gen:t,keyword:e,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",s,$t.default.errors,a=>{t.const(i,(0,ke._)`${$t.default.vErrors}[${a}]`),t.if((0,ke._)`${i}.instancePath === undefined`,()=>t.assign((0,ke._)`${i}.instancePath`,(0,ke.strConcat)($t.default.instancePath,o.errorPath))),t.assign((0,ke._)`${i}.schemaPath`,(0,ke.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,ke._)`${i}.schema`,r),t.assign((0,ke._)`${i}.data`,n))})}xt.extendErrors=CD;function Tk(t,e){let r=t.const("err",e);t.if((0,ke._)`${$t.default.vErrors} === null`,()=>t.assign($t.default.vErrors,(0,ke._)`[${r}]`),(0,ke._)`${$t.default.vErrors}.push(${r})`),t.code((0,ke._)`${$t.default.errors}++`)}function $k(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,ke._)`new ${t.ValidationError}(${e})`):(r.assign((0,ke._)`${n}.errors`,e),r.return(!1))}var Ms={keyword:new ke.Name("keyword"),schemaPath:new ke.Name("schemaPath"),params:new ke.Name("params"),propertyName:new ke.Name("propertyName"),message:new ke.Name("message"),schema:new ke.Name("schema"),parentSchema:new ke.Name("parentSchema")};function Ik(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,ke._)`{}`:AD(t,e,r)}function AD(t,e,r={}){let{gen:n,it:s}=t,o=[ND(s,r),RD(t,r)];return jD(t,e,o),n.object(...o)}function ND({errorPath:t},{instancePath:e}){let r=e?(0,ke.str)`${t}${(0,vl.getErrorPath)(e,vl.Type.Str)}`:t;return[$t.default.instancePath,(0,ke.strConcat)($t.default.instancePath,r)]}function RD({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,ke.str)`${e}/${t}`;return r&&(s=(0,ke.str)`${s}${(0,vl.getErrorPath)(r,vl.Type.Str)}`),[Ms.schemaPath,s]}function jD(t,{params:e,message:r},n){let{keyword:s,data:o,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Ms.keyword,s],[Ms.params,typeof e=="function"?e(t):e||(0,ke._)`{}`]),c.messages&&n.push([Ms.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Ms.schema,i],[Ms.parentSchema,(0,ke._)`${l}${d}`],[$t.default.data,o]),u&&n.push([Ms.propertyName,u])}});var Ok=S(Xo=>{"use strict";f();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.boolOrEmptySchema=Xo.topBoolOrEmptySchema=void 0;var zD=ja(),MD=me(),LD=ln(),qD={message:"boolean schema is false"};function ZD(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Pk(t,!1):typeof r=="object"&&r.$async===!0?e.return(LD.default.data):(e.assign((0,MD._)`${n}.errors`,null),e.return(!0))}Xo.topBoolOrEmptySchema=ZD;function DD(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Pk(t)):r.var(e,!0)}Xo.boolOrEmptySchema=DD;function Pk(t,e){let{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,zD.reportError)(s,qD,void 0,e)}});var Eg=S(Qo=>{"use strict";f();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.getRules=Qo.isJSONType=void 0;var FD=["string","number","integer","boolean","null","object","array"],UD=new Set(FD);function VD(t){return typeof t=="string"&&UD.has(t)}Qo.isJSONType=VD;function BD(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Qo.getRules=BD});var Tg=S(Rn=>{"use strict";f();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.shouldUseRule=Rn.shouldUseGroup=Rn.schemaHasRulesForType=void 0;function HD({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Ck(t,n)}Rn.schemaHasRulesForType=HD;function Ck(t,e){return e.rules.some(r=>Ak(t,r))}Rn.shouldUseGroup=Ck;function Ak(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Rn.shouldUseRule=Ak});var za=S(St=>{"use strict";f();Object.defineProperty(St,"__esModule",{value:!0});St.reportTypeError=St.checkDataTypes=St.checkDataType=St.coerceAndCheckDataType=St.getJSONTypes=St.getSchemaTypes=St.DataType=void 0;var KD=Eg(),GD=Tg(),JD=ja(),de=me(),Nk=Se(),ei;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(ei||(St.DataType=ei={}));function WD(t){let e=Rk(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}St.getSchemaTypes=WD;function Rk(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(KD.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}St.getJSONTypes=Rk;function YD(t,e){let{gen:r,data:n,opts:s}=t,o=XD(e,s.coerceTypes),i=e.length>0&&!(o.length===0&&e.length===1&&(0,GD.schemaHasRulesForType)(t,e[0]));if(i){let a=Ig(e,n,s.strictNumbers,ei.Wrong);r.if(a,()=>{o.length?QD(t,e,o):Pg(t)})}return i}St.coerceAndCheckDataType=YD;var jk=new Set(["string","number","integer","boolean","null"]);function XD(t,e){return e?t.filter(r=>jk.has(r)||e==="array"&&r==="array"):[]}function QD(t,e,r){let{gen:n,data:s,opts:o}=t,i=n.let("dataType",(0,de._)`typeof ${s}`),a=n.let("coerced",(0,de._)`undefined`);o.coerceTypes==="array"&&n.if((0,de._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,de._)`${s}[0]`).assign(i,(0,de._)`typeof ${s}`).if(Ig(e,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,de._)`${a} !== undefined`);for(let u of r)(jk.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),Pg(t),n.endIf(),n.if((0,de._)`${a} !== undefined`,()=>{n.assign(s,a),e2(t,a)});function c(u){switch(u){case"string":n.elseIf((0,de._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,de._)`"" + ${s}`).elseIf((0,de._)`${s} === null`).assign(a,(0,de._)`""`);return;case"number":n.elseIf((0,de._)`${i} == "boolean" || ${s} === null
|
|
2
|
+
var rz=Object.create;var Sp=Object.defineProperty;var nz=Object.getOwnPropertyDescriptor;var sz=Object.getOwnPropertyNames;var oz=Object.getPrototypeOf,iz=Object.prototype.hasOwnProperty;var Te=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var az=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),kp=(t,e)=>{for(var r in e)Sp(t,r,{get:e[r],enumerable:!0})},cz=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of sz(e))!iz.call(t,s)&&s!==r&&Sp(t,s,{get:()=>e[s],enumerable:!(n=nz(e,s))||n.enumerable});return t};var se=(t,e,r)=>(r=t!=null?rz(oz(t)):{},cz(e||!t||!t.__esModule?Sp(r,"default",{value:t,enumerable:!0}):r,t));import uz from"path";import{fileURLToPath as lz}from"url";var x0,dz,y,v,f=az(()=>{"use strict";x0=()=>lz(import.meta.url),dz=()=>uz.dirname(x0()),y=dz(),v=x0()});var Oa=S($e=>{"use strict";f();Object.defineProperty($e,"__esModule",{value:!0});$e.regexpCode=$e.getEsmExportName=$e.getProperty=$e.safeStringify=$e.stringify=$e.strConcat=$e.addCodeArg=$e.str=$e._=$e.nil=$e._Code=$e.Name=$e.IDENTIFIER=$e._CodeOrName=void 0;var $a=class{};$e._CodeOrName=$a;$e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var As=class extends $a{constructor(e){if(super(),!$e.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$e.Name=As;var rr=class extends $a{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof As&&(r[n.str]=(r[n.str]||0)+1),r),{})}};$e._Code=rr;$e.nil=new rr("");function gk(t,...e){let r=[t[0]],n=0;for(;n<e.length;)og(r,e[n]),r.push(t[++n]);return new rr(r)}$e._=gk;var sg=new rr("+");function yk(t,...e){let r=[Ia(t[0])],n=0;for(;n<e.length;)r.push(sg),og(r,e[n]),r.push(sg,Ia(t[++n]));return cD(r),new rr(r)}$e.str=yk;function og(t,e){e instanceof rr?t.push(...e._items):e instanceof As?t.push(e):t.push(dD(e))}$e.addCodeArg=og;function cD(t){let e=1;for(;e<t.length-1;){if(t[e]===sg){let r=uD(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function uD(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof As||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof As))return`"${t}${e.slice(1)}`}function lD(t,e){return e.emptyStr()?t:t.emptyStr()?e:yk`${t}${e}`}$e.strConcat=lD;function dD(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ia(Array.isArray(t)?t.join(","):t)}function fD(t){return new rr(Ia(t))}$e.stringify=fD;function Ia(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$e.safeStringify=Ia;function pD(t){return typeof t=="string"&&$e.IDENTIFIER.test(t)?new rr(`.${t}`):gk`[${t}]`}$e.getProperty=pD;function hD(t){if(typeof t=="string"&&$e.IDENTIFIER.test(t))return new rr(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}$e.getEsmExportName=hD;function mD(t){return new rr(t.toString())}$e.regexpCode=mD});var cg=S(jt=>{"use strict";f();Object.defineProperty(jt,"__esModule",{value:!0});jt.ValueScope=jt.ValueScopeName=jt.Scope=jt.varKinds=jt.UsedValueState=void 0;var Rt=Oa(),ig=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},fl;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(fl||(jt.UsedValueState=fl={}));jt.varKinds={const:new Rt.Name("const"),let:new Rt.Name("let"),var:new Rt.Name("var")};var pl=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Rt.Name?e:this.name(e)}name(e){return new Rt.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};jt.Scope=pl;var hl=class extends Rt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Rt._)`.${new Rt.Name(r)}[${n}]`}};jt.ValueScopeName=hl;var gD=(0,Rt._)`\n`,ag=class extends pl{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?gD:Rt.nil}}get(){return this._scope}name(e){return new hl(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let s=this.toName(e),{prefix:o}=s,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[o];if(a){let l=a.get(i);if(l)return l}else a=this._values[o]=new Map;a.set(i,s);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,s.setValue(r,{property:o,itemIndex:u}),s}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Rt._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,s=>{if(s.value===void 0)throw new Error(`CodeGen: name "${s}" has no value`);return s.value.code},r,n)}_reduceValues(e,r,n={},s){let o=Rt.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,fl.Started);let l=r(u);if(l){let d=this.opts.es5?jt.varKinds.var:jt.varKinds.const;o=(0,Rt._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=s?.(u))o=(0,Rt._)`${o}${l}${this.opts._n}`;else throw new ig(u);c.set(u,fl.Completed)})}return o}};jt.ValueScope=ag});var me=S(ge=>{"use strict";f();Object.defineProperty(ge,"__esModule",{value:!0});ge.or=ge.and=ge.not=ge.CodeGen=ge.operators=ge.varKinds=ge.ValueScopeName=ge.ValueScope=ge.Scope=ge.Name=ge.regexpCode=ge.stringify=ge.getProperty=ge.nil=ge.strConcat=ge.str=ge._=void 0;var xe=Oa(),wr=cg(),An=Oa();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return An._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return An.str}});Object.defineProperty(ge,"strConcat",{enumerable:!0,get:function(){return An.strConcat}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return An.nil}});Object.defineProperty(ge,"getProperty",{enumerable:!0,get:function(){return An.getProperty}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return An.stringify}});Object.defineProperty(ge,"regexpCode",{enumerable:!0,get:function(){return An.regexpCode}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return An.Name}});var _l=cg();Object.defineProperty(ge,"Scope",{enumerable:!0,get:function(){return _l.Scope}});Object.defineProperty(ge,"ValueScope",{enumerable:!0,get:function(){return _l.ValueScope}});Object.defineProperty(ge,"ValueScopeName",{enumerable:!0,get:function(){return _l.ValueScopeName}});Object.defineProperty(ge,"varKinds",{enumerable:!0,get:function(){return _l.varKinds}});ge.operators={GT:new xe._Code(">"),GTE:new xe._Code(">="),LT:new xe._Code("<"),LTE:new xe._Code("<="),EQ:new xe._Code("==="),NEQ:new xe._Code("!=="),NOT:new xe._Code("!"),OR:new xe._Code("||"),AND:new xe._Code("&&"),ADD:new xe._Code("+")};var cn=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ug=class extends cn{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?wr.varKinds.var:this.varKind,s=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${s};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Yo(this.rhs,e,r)),this}get names(){return this.rhs instanceof xe._CodeOrName?this.rhs.names:{}}},ml=class extends cn{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof xe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Yo(this.rhs,e,r),this}get names(){let e=this.lhs instanceof xe.Name?{}:{...this.lhs.names};return yl(e,this.rhs)}},lg=class extends ml{constructor(e,r,n,s){super(e,n,s),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},dg=class extends cn{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},fg=class extends cn{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},pg=class extends cn{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},hg=class extends cn{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Yo(this.code,e,r),this}get names(){return this.code instanceof xe._CodeOrName?this.code.names:{}}},Pa=class extends cn{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,s=n.length;for(;s--;){let o=n[s];o.optimizeNames(e,r)||(yD(e,o.names),n.splice(s,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>zs(e,r.names),{})}},un=class extends Pa{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},mg=class extends Pa{},Wo=class extends un{};Wo.kind="else";var Rs=class t extends un{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Wo(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(_k(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Yo(this.condition,e,r),this}get names(){let e=super.names;return yl(e,this.condition),this.else&&zs(e,this.else.names),e}};Rs.kind="if";var js=class extends un{};js.kind="for";var gg=class extends js{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Yo(this.iteration,e,r),this}get names(){return zs(super.names,this.iteration.names)}},yg=class extends js{constructor(e,r,n,s){super(),this.varKind=e,this.name=r,this.from=n,this.to=s}render(e){let r=e.es5?wr.varKinds.var:this.varKind,{name:n,from:s,to:o}=this;return`for(${r} ${n}=${s}; ${n}<${o}; ${n}++)`+super.render(e)}get names(){let e=yl(super.names,this.from);return yl(e,this.to)}},gl=class extends js{constructor(e,r,n,s){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=s}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Yo(this.iterable,e,r),this}get names(){return zs(super.names,this.iterable.names)}},Ca=class extends un{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Ca.kind="func";var Na=class extends Pa{render(e){return"return "+super.render(e)}};Na.kind="return";var _g=class extends un{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,s;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(s=this.finally)===null||s===void 0||s.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&zs(e,this.catch.names),this.finally&&zs(e,this.finally.names),e}},Aa=class extends un{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Aa.kind="catch";var Ra=class extends un{render(e){return"finally"+super.render(e)}};Ra.kind="finally";var vg=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new wr.Scope({parent:e}),this._nodes=[new mg]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,s){let o=this._scope.toName(r);return n!==void 0&&s&&(this._constants[o.str]=n),this._leafNode(new ug(e,o,n)),o}const(e,r,n){return this._def(wr.varKinds.const,e,r,n)}let(e,r,n){return this._def(wr.varKinds.let,e,r,n)}var(e,r,n){return this._def(wr.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ml(e,r,n))}add(e,r){return this._leafNode(new lg(e,ge.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==xe.nil&&this._leafNode(new hg(e)),this}object(...e){let r=["{"];for(let[n,s]of e)r.length>1&&r.push(","),r.push(n),(n!==s||this.opts.es5)&&(r.push(":"),(0,xe.addCodeArg)(r,s));return r.push("}"),new xe._Code(r)}if(e,r,n){if(this._blockNode(new Rs(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Rs(e))}else(){return this._elseNode(new Wo)}endIf(){return this._endBlockNode(Rs,Wo)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new gg(e),r)}forRange(e,r,n,s,o=this.opts.es5?wr.varKinds.var:wr.varKinds.let){let i=this._scope.toName(e);return this._for(new yg(o,i,r,n),()=>s(i))}forOf(e,r,n,s=wr.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let i=r instanceof xe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,xe._)`${i}.length`,a=>{this.var(o,(0,xe._)`${i}[${a}]`),n(o)})}return this._for(new gl("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?wr.varKinds.var:wr.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,xe._)`Object.keys(${r})`,n);let o=this._scope.toName(e);return this._for(new gl("in",s,o,r),()=>n(o))}endFor(){return this._endBlockNode(js)}label(e){return this._leafNode(new dg(e))}break(e){return this._leafNode(new fg(e))}return(e){let r=new Na;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Na)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let s=new _g;if(this._blockNode(s),this.code(e),r){let o=this.name("e");this._currNode=s.catch=new Aa(o),r(o)}return n&&(this._currNode=s.finally=new Ra,this.code(n)),this._endBlockNode(Aa,Ra)}throw(e){return this._leafNode(new pg(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=xe.nil,n,s){return this._blockNode(new Ca(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Ca)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Rs))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};ge.CodeGen=vg;function zs(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function yl(t,e){return e instanceof xe._CodeOrName?zs(t,e.names):t}function Yo(t,e,r){if(t instanceof xe.Name)return n(t);if(!s(t))return t;return new xe._Code(t._items.reduce((o,i)=>(i instanceof xe.Name&&(i=n(i)),i instanceof xe._Code?o.push(...i._items):o.push(i),o),[]));function n(o){let i=r[o.str];return i===void 0||e[o.str]!==1?o:(delete e[o.str],i)}function s(o){return o instanceof xe._Code&&o._items.some(i=>i instanceof xe.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function yD(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function _k(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,xe._)`!${bg(t)}`}ge.not=_k;var _D=vk(ge.operators.AND);function vD(...t){return t.reduce(_D)}ge.and=vD;var bD=vk(ge.operators.OR);function wD(...t){return t.reduce(bD)}ge.or=wD;function vk(t){return(e,r)=>e===xe.nil?r:r===xe.nil?e:(0,xe._)`${bg(e)} ${t} ${bg(r)}`}function bg(t){return t instanceof xe.Name?t:(0,xe._)`(${t})`}});var Se=S(ye=>{"use strict";f();Object.defineProperty(ye,"__esModule",{value:!0});ye.checkStrictMode=ye.getErrorPath=ye.Type=ye.useFunc=ye.setEvaluated=ye.evaluatedPropsToName=ye.mergeEvaluated=ye.eachItem=ye.unescapeJsonPointer=ye.escapeJsonPointer=ye.escapeFragment=ye.unescapeFragment=ye.schemaRefOrVal=ye.schemaHasRulesButRef=ye.schemaHasRules=ye.checkUnknownRules=ye.alwaysValidSchema=ye.toHash=void 0;var Me=me(),xD=Oa();function SD(t){let e={};for(let r of t)e[r]=!0;return e}ye.toHash=SD;function kD(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(xk(t,e),!Sk(e,t.self.RULES.all))}ye.alwaysValidSchema=kD;function xk(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let s=n.RULES.keywords;for(let o in e)s[o]||Tk(t,`unknown keyword: "${o}"`)}ye.checkUnknownRules=xk;function Sk(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ye.schemaHasRules=Sk;function ED(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ye.schemaHasRulesButRef=ED;function TD({topSchemaRef:t,schemaPath:e},r,n,s){if(!s){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Me._)`${r}`}return(0,Me._)`${t}${e}${(0,Me.getProperty)(n)}`}ye.schemaRefOrVal=TD;function $D(t){return kk(decodeURIComponent(t))}ye.unescapeFragment=$D;function ID(t){return encodeURIComponent(xg(t))}ye.escapeFragment=ID;function xg(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ye.escapeJsonPointer=xg;function kk(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ye.unescapeJsonPointer=kk;function OD(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ye.eachItem=OD;function bk({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(s,o,i,a)=>{let c=i===void 0?o:i instanceof Me.Name?(o instanceof Me.Name?t(s,o,i):e(s,o,i),i):o instanceof Me.Name?(e(s,i,o),o):r(o,i);return a===Me.Name&&!(c instanceof Me.Name)?n(s,c):c}}ye.mergeEvaluated={props:bk({mergeNames:(t,e,r)=>t.if((0,Me._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Me._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Me._)`${r} || {}`).code((0,Me._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Me._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Me._)`${r} || {}`),Sg(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Ek}),items:bk({mergeNames:(t,e,r)=>t.if((0,Me._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Me._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Me._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Me._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Ek(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Me._)`{}`);return e!==void 0&&Sg(t,r,e),r}ye.evaluatedPropsToName=Ek;function Sg(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Me._)`${e}${(0,Me.getProperty)(n)}`,!0))}ye.setEvaluated=Sg;var wk={};function PD(t,e){return t.scopeValue("func",{ref:e,code:wk[e.code]||(wk[e.code]=new xD._Code(e.code))})}ye.useFunc=PD;var wg;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(wg||(ye.Type=wg={}));function CD(t,e,r){if(t instanceof Me.Name){let n=e===wg.Num;return r?n?(0,Me._)`"[" + ${t} + "]"`:(0,Me._)`"['" + ${t} + "']"`:n?(0,Me._)`"/" + ${t}`:(0,Me._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Me.getProperty)(t).toString():"/"+xg(t)}ye.getErrorPath=CD;function Tk(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ye.checkStrictMode=Tk});var ln=S(kg=>{"use strict";f();Object.defineProperty(kg,"__esModule",{value:!0});var wt=me(),ND={data:new wt.Name("data"),valCxt:new wt.Name("valCxt"),instancePath:new wt.Name("instancePath"),parentData:new wt.Name("parentData"),parentDataProperty:new wt.Name("parentDataProperty"),rootData:new wt.Name("rootData"),dynamicAnchors:new wt.Name("dynamicAnchors"),vErrors:new wt.Name("vErrors"),errors:new wt.Name("errors"),this:new wt.Name("this"),self:new wt.Name("self"),scope:new wt.Name("scope"),json:new wt.Name("json"),jsonPos:new wt.Name("jsonPos"),jsonLen:new wt.Name("jsonLen"),jsonPart:new wt.Name("jsonPart")};kg.default=ND});var ja=S(xt=>{"use strict";f();Object.defineProperty(xt,"__esModule",{value:!0});xt.extendErrors=xt.resetErrorsCount=xt.reportExtraError=xt.reportError=xt.keyword$DataError=xt.keywordError=void 0;var ke=me(),vl=Se(),$t=ln();xt.keywordError={message:({keyword:t})=>(0,ke.str)`must pass "${t}" keyword validation`};xt.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ke.str)`"${t}" keyword must be ${e} ($data)`:(0,ke.str)`"${t}" keyword is invalid ($data)`};function AD(t,e=xt.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:i,allErrors:a}=s,c=Ok(t,e,r);n??(i||a)?$k(o,c):Ik(s,(0,ke._)`[${c}]`)}xt.reportError=AD;function RD(t,e=xt.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:i}=n,a=Ok(t,e,r);$k(s,a),o||i||Ik(n,$t.default.vErrors)}xt.reportExtraError=RD;function jD(t,e){t.assign($t.default.errors,e),t.if((0,ke._)`${$t.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ke._)`${$t.default.vErrors}.length`,e),()=>t.assign($t.default.vErrors,null)))}xt.resetErrorsCount=jD;function zD({gen:t,keyword:e,schemaValue:r,data:n,errsCount:s,it:o}){if(s===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",s,$t.default.errors,a=>{t.const(i,(0,ke._)`${$t.default.vErrors}[${a}]`),t.if((0,ke._)`${i}.instancePath === undefined`,()=>t.assign((0,ke._)`${i}.instancePath`,(0,ke.strConcat)($t.default.instancePath,o.errorPath))),t.assign((0,ke._)`${i}.schemaPath`,(0,ke.str)`${o.errSchemaPath}/${e}`),o.opts.verbose&&(t.assign((0,ke._)`${i}.schema`,r),t.assign((0,ke._)`${i}.data`,n))})}xt.extendErrors=zD;function $k(t,e){let r=t.const("err",e);t.if((0,ke._)`${$t.default.vErrors} === null`,()=>t.assign($t.default.vErrors,(0,ke._)`[${r}]`),(0,ke._)`${$t.default.vErrors}.push(${r})`),t.code((0,ke._)`${$t.default.errors}++`)}function Ik(t,e){let{gen:r,validateName:n,schemaEnv:s}=t;s.$async?r.throw((0,ke._)`new ${t.ValidationError}(${e})`):(r.assign((0,ke._)`${n}.errors`,e),r.return(!1))}var Ms={keyword:new ke.Name("keyword"),schemaPath:new ke.Name("schemaPath"),params:new ke.Name("params"),propertyName:new ke.Name("propertyName"),message:new ke.Name("message"),schema:new ke.Name("schema"),parentSchema:new ke.Name("parentSchema")};function Ok(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,ke._)`{}`:MD(t,e,r)}function MD(t,e,r={}){let{gen:n,it:s}=t,o=[LD(s,r),qD(t,r)];return ZD(t,e,o),n.object(...o)}function LD({errorPath:t},{instancePath:e}){let r=e?(0,ke.str)`${t}${(0,vl.getErrorPath)(e,vl.Type.Str)}`:t;return[$t.default.instancePath,(0,ke.strConcat)($t.default.instancePath,r)]}function qD({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let s=n?e:(0,ke.str)`${e}/${t}`;return r&&(s=(0,ke.str)`${s}${(0,vl.getErrorPath)(r,vl.Type.Str)}`),[Ms.schemaPath,s]}function ZD(t,{params:e,message:r},n){let{keyword:s,data:o,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Ms.keyword,s],[Ms.params,typeof e=="function"?e(t):e||(0,ke._)`{}`]),c.messages&&n.push([Ms.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Ms.schema,i],[Ms.parentSchema,(0,ke._)`${l}${d}`],[$t.default.data,o]),u&&n.push([Ms.propertyName,u])}});var Ck=S(Xo=>{"use strict";f();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.boolOrEmptySchema=Xo.topBoolOrEmptySchema=void 0;var DD=ja(),FD=me(),UD=ln(),VD={message:"boolean schema is false"};function BD(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Pk(t,!1):typeof r=="object"&&r.$async===!0?e.return(UD.default.data):(e.assign((0,FD._)`${n}.errors`,null),e.return(!0))}Xo.topBoolOrEmptySchema=BD;function HD(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Pk(t)):r.var(e,!0)}Xo.boolOrEmptySchema=HD;function Pk(t,e){let{gen:r,data:n}=t,s={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,DD.reportError)(s,VD,void 0,e)}});var Eg=S(Qo=>{"use strict";f();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.getRules=Qo.isJSONType=void 0;var KD=["string","number","integer","boolean","null","object","array"],GD=new Set(KD);function JD(t){return typeof t=="string"&&GD.has(t)}Qo.isJSONType=JD;function WD(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Qo.getRules=WD});var Tg=S(Rn=>{"use strict";f();Object.defineProperty(Rn,"__esModule",{value:!0});Rn.shouldUseRule=Rn.shouldUseGroup=Rn.schemaHasRulesForType=void 0;function YD({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Nk(t,n)}Rn.schemaHasRulesForType=YD;function Nk(t,e){return e.rules.some(r=>Ak(t,r))}Rn.shouldUseGroup=Nk;function Ak(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Rn.shouldUseRule=Ak});var za=S(St=>{"use strict";f();Object.defineProperty(St,"__esModule",{value:!0});St.reportTypeError=St.checkDataTypes=St.checkDataType=St.coerceAndCheckDataType=St.getJSONTypes=St.getSchemaTypes=St.DataType=void 0;var XD=Eg(),QD=Tg(),e2=ja(),de=me(),Rk=Se(),ei;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(ei||(St.DataType=ei={}));function t2(t){let e=jk(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}St.getSchemaTypes=t2;function jk(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(XD.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}St.getJSONTypes=jk;function r2(t,e){let{gen:r,data:n,opts:s}=t,o=n2(e,s.coerceTypes),i=e.length>0&&!(o.length===0&&e.length===1&&(0,QD.schemaHasRulesForType)(t,e[0]));if(i){let a=Ig(e,n,s.strictNumbers,ei.Wrong);r.if(a,()=>{o.length?s2(t,e,o):Og(t)})}return i}St.coerceAndCheckDataType=r2;var zk=new Set(["string","number","integer","boolean","null"]);function n2(t,e){return e?t.filter(r=>zk.has(r)||e==="array"&&r==="array"):[]}function s2(t,e,r){let{gen:n,data:s,opts:o}=t,i=n.let("dataType",(0,de._)`typeof ${s}`),a=n.let("coerced",(0,de._)`undefined`);o.coerceTypes==="array"&&n.if((0,de._)`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>n.assign(s,(0,de._)`${s}[0]`).assign(i,(0,de._)`typeof ${s}`).if(Ig(e,s,o.strictNumbers),()=>n.assign(a,s))),n.if((0,de._)`${a} !== undefined`);for(let u of r)(zk.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),Og(t),n.endIf(),n.if((0,de._)`${a} !== undefined`,()=>{n.assign(s,a),o2(t,a)});function c(u){switch(u){case"string":n.elseIf((0,de._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,de._)`"" + ${s}`).elseIf((0,de._)`${s} === null`).assign(a,(0,de._)`""`);return;case"number":n.elseIf((0,de._)`${i} == "boolean" || ${s} === null
|
|
4
4
|
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(a,(0,de._)`+${s}`);return;case"integer":n.elseIf((0,de._)`${i} === "boolean" || ${s} === null
|
|
5
5
|
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(a,(0,de._)`+${s}`);return;case"boolean":n.elseIf((0,de._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(a,!1).elseIf((0,de._)`${s} === "true" || ${s} === 1`).assign(a,!0);return;case"null":n.elseIf((0,de._)`${s} === "" || ${s} === 0 || ${s} === false`),n.assign(a,null);return;case"array":n.elseIf((0,de._)`${i} === "string" || ${i} === "number"
|
|
6
|
-
|| ${i} === "boolean" || ${s} === null`).assign(a,(0,de._)`[${s}]`)}}}function e2({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,de._)`${e} !== undefined`,()=>t.assign((0,de._)`${e}[${r}]`,n))}function $g(t,e,r,n=ei.Correct){let s=n===ei.Correct?de.operators.EQ:de.operators.NEQ,o;switch(t){case"null":return(0,de._)`${e} ${s} null`;case"array":o=(0,de._)`Array.isArray(${e})`;break;case"object":o=(0,de._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=i((0,de._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=i();break;default:return(0,de._)`typeof ${e} ${s} ${t}`}return n===ei.Correct?o:(0,de.not)(o);function i(a=de.nil){return(0,de.and)((0,de._)`typeof ${e} == "number"`,a,r?(0,de._)`isFinite(${e})`:de.nil)}}St.checkDataType=$g;function Ig(t,e,r,n){if(t.length===1)return $g(t[0],e,r,n);let s,o=(0,Nk.toHash)(t);if(o.array&&o.object){let i=(0,de._)`typeof ${e} != "object"`;s=o.null?i:(0,de._)`!${e} || ${i}`,delete o.null,delete o.array,delete o.object}else s=de.nil;o.number&&delete o.integer;for(let i in o)s=(0,de.and)(s,$g(i,e,r,n));return s}St.checkDataTypes=Ig;var t2={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,de._)`{type: ${t}}`:(0,de._)`{type: ${e}}`};function Pg(t){let e=r2(t);(0,JD.reportError)(e,t2)}St.reportTypeError=Pg;function r2(t){let{gen:e,data:r,schema:n}=t,s=(0,Nk.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:t}}});var Mk=S(bl=>{"use strict";f();Object.defineProperty(bl,"__esModule",{value:!0});bl.assignDefaults=void 0;var ti=me(),n2=Se();function s2(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let s in r)zk(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,o)=>zk(t,o,s.default))}bl.assignDefaults=s2;function zk(t,e,r){let{gen:n,compositeRule:s,data:o,opts:i}=t;if(r===void 0)return;let a=(0,ti._)`${o}${(0,ti.getProperty)(e)}`;if(s){(0,n2.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,ti._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,ti._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,ti._)`${a} = ${(0,ti.stringify)(r)}`)}});var nr=S(ze=>{"use strict";f();Object.defineProperty(ze,"__esModule",{value:!0});ze.validateUnion=ze.validateArray=ze.usePattern=ze.callValidateCode=ze.schemaProperties=ze.allSchemaProperties=ze.noPropertyInData=ze.propertyInData=ze.isOwnProperty=ze.hasPropFunc=ze.reportMissingProp=ze.checkMissingProp=ze.checkReportMissingProp=void 0;var Ve=me(),Og=Se(),jn=ln(),o2=Se();function i2(t,e){let{gen:r,data:n,it:s}=t;r.if(Ag(r,n,e,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ve._)`${e}`},!0),t.error()})}ze.checkReportMissingProp=i2;function a2({gen:t,data:e,it:{opts:r}},n,s){return(0,Ve.or)(...n.map(o=>(0,Ve.and)(Ag(t,e,o,r.ownProperties),(0,Ve._)`${s} = ${o}`)))}ze.checkMissingProp=a2;function c2(t,e){t.setParams({missingProperty:e},!0),t.error()}ze.reportMissingProp=c2;function Lk(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ve._)`Object.prototype.hasOwnProperty`})}ze.hasPropFunc=Lk;function Cg(t,e,r){return(0,Ve._)`${Lk(t)}.call(${e}, ${r})`}ze.isOwnProperty=Cg;function u2(t,e,r,n){let s=(0,Ve._)`${e}${(0,Ve.getProperty)(r)} !== undefined`;return n?(0,Ve._)`${s} && ${Cg(t,e,r)}`:s}ze.propertyInData=u2;function Ag(t,e,r,n){let s=(0,Ve._)`${e}${(0,Ve.getProperty)(r)} === undefined`;return n?(0,Ve.or)(s,(0,Ve.not)(Cg(t,e,r))):s}ze.noPropertyInData=Ag;function qk(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ze.allSchemaProperties=qk;function l2(t,e){return qk(e).filter(r=>!(0,Og.alwaysValidSchema)(t,e[r]))}ze.schemaProperties=l2;function d2({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,u){let l=u?(0,Ve._)`${t}, ${e}, ${n}${s}`:e,d=[[jn.default.instancePath,(0,Ve.strConcat)(jn.default.instancePath,o)],[jn.default.parentData,i.parentData],[jn.default.parentDataProperty,i.parentDataProperty],[jn.default.rootData,jn.default.rootData]];i.opts.dynamicRef&&d.push([jn.default.dynamicAnchors,jn.default.dynamicAnchors]);let p=(0,Ve._)`${l}, ${r.object(...d)}`;return c!==Ve.nil?(0,Ve._)`${a}.call(${c}, ${p})`:(0,Ve._)`${a}(${p})`}ze.callValidateCode=d2;var f2=(0,Ve._)`new RegExp`;function p2({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:s}=e.code,o=s(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Ve._)`${s.code==="new RegExp"?f2:(0,o2.useFunc)(t,s)}(${r}, ${n})`})}ze.usePattern=p2;function h2(t){let{gen:e,data:r,keyword:n,it:s}=t,o=e.name("valid");if(s.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(o,!0),i(()=>e.break()),o;function i(a){let c=e.const("len",(0,Ve._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Og.Type.Num},o),e.if((0,Ve.not)(o),a)})}}ze.validateArray=h2;function m2(t){let{gen:e,schema:r,keyword:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Og.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,Ve._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,Ve.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}ze.validateUnion=m2});var Fk=S(Lr=>{"use strict";f();Object.defineProperty(Lr,"__esModule",{value:!0});Lr.validateKeywordUsage=Lr.validSchemaType=Lr.funcKeywordCode=Lr.macroKeywordCode=void 0;var It=me(),Ls=ln(),g2=nr(),y2=ja();function _2(t,e){let{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=t,a=e.macro.call(i.self,s,o,i),c=Dk(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:It.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Lr.macroKeywordCode=_2;function v2(t,e){var r;let{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=t;w2(c,e);let u=!a&&e.compile?e.compile.call(c.self,o,i,c):e.validate,l=Dk(n,s,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)m(),e.modifying&&Zk(t),_(()=>t.error());else{let b=e.async?g():h();e.modifying&&Zk(t),_(()=>b2(t,b))}}function g(){let b=n.let("ruleErrs",null);return n.try(()=>m((0,It._)`await `),w=>n.assign(d,!1).if((0,It._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,It._)`${w}.errors`),()=>n.throw(w))),b}function h(){let b=(0,It._)`${l}.errors`;return n.assign(b,null),m(It.nil),b}function m(b=e.async?(0,It._)`await `:It.nil){let w=c.opts.passContext?Ls.default.this:Ls.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,It._)`${b}${(0,g2.callValidateCode)(t,l,w,x)}`,e.modifying)}function _(b){var w;n.if((0,It.not)((w=e.valid)!==null&&w!==void 0?w:d),b)}}Lr.funcKeywordCode=v2;function Zk(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,It._)`${n.parentData}[${n.parentDataProperty}]`))}function b2(t,e){let{gen:r}=t;r.if((0,It._)`Array.isArray(${e})`,()=>{r.assign(Ls.default.vErrors,(0,It._)`${Ls.default.vErrors} === null ? ${e} : ${Ls.default.vErrors}.concat(${e})`).assign(Ls.default.errors,(0,It._)`${Ls.default.vErrors}.length`),(0,y2.extendErrors)(t)},()=>t.error())}function w2({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Dk(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,It.stringify)(r)})}function x2(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Lr.validSchemaType=x2;function S2({schema:t,opts:e,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");let i=s.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Lr.validateKeywordUsage=S2});var Vk=S(zn=>{"use strict";f();Object.defineProperty(zn,"__esModule",{value:!0});zn.extendSubschemaMode=zn.extendSubschemaData=zn.getSubschema=void 0;var qr=me(),Uk=Se();function k2(t,{keyword:e,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,qr._)`${t.schemaPath}${(0,qr.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,qr._)`${t.schemaPath}${(0,qr.getProperty)(e)}${(0,qr.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Uk.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}zn.getSubschema=k2;function E2(t,e,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,qr._)`${e.data}${(0,qr.getProperty)(r)}`,!0);c(p),t.errorPath=(0,qr.str)`${u}${(0,Uk.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,qr._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(s!==void 0){let u=s instanceof qr.Name?s:a.let("data",s,!0);c(u),i!==void 0&&(t.propertyName=i)}o&&(t.dataTypes=o);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}zn.extendSubschemaData=E2;function T2(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(t.compositeRule=n),s!==void 0&&(t.createErrors=s),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}zn.extendSubschemaMode=T2});var Ng=S((wce,Bk)=>{"use strict";f();Bk.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Kk=S((Sce,Hk)=>{"use strict";f();var Mn=Hk.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};wl(e,n,s,t,"",t)};Mn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Mn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Mn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Mn.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 wl(t,e,r,n,s,o,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,s,o,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Mn.arrayKeywords)for(var p=0;p<d.length;p++)wl(t,e,r,d[p],s+"/"+l+"/"+p,o,s,l,n,p)}else if(l in Mn.propsKeywords){if(d&&typeof d=="object")for(var g in d)wl(t,e,r,d[g],s+"/"+l+"/"+$2(g),o,s,l,n,g)}else(l in Mn.keywords||t.allKeys&&!(l in Mn.skipKeywords))&&wl(t,e,r,d,s+"/"+l,o,s,l,n)}r(n,s,o,i,a,c,u)}}function $2(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ma=S(zt=>{"use strict";f();Object.defineProperty(zt,"__esModule",{value:!0});zt.getSchemaRefs=zt.resolveUrl=zt.normalizeId=zt._getFullPath=zt.getFullPath=zt.inlineRef=void 0;var I2=Se(),P2=Ng(),O2=Kk(),C2=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function A2(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Rg(t):e?Gk(t)<=e:!1}zt.inlineRef=A2;var N2=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Rg(t){for(let e in t){if(N2.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Rg)||typeof r=="object"&&Rg(r))return!0}return!1}function Gk(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!C2.has(r)&&(typeof t[r]=="object"&&(0,I2.eachItem)(t[r],n=>e+=Gk(n)),e===1/0))return 1/0}return e}function Jk(t,e="",r){r!==!1&&(e=ri(e));let n=t.parse(e);return Wk(t,n)}zt.getFullPath=Jk;function Wk(t,e){return t.serialize(e).split("#")[0]+"#"}zt._getFullPath=Wk;var R2=/#\/?$/;function ri(t){return t?t.replace(R2,""):""}zt.normalizeId=ri;function j2(t,e,r){return r=ri(r),t.resolve(e,r)}zt.resolveUrl=j2;var z2=/^[a-z_][-a-z0-9._]*$/i;function M2(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=ri(t[r]||e),o={"":s},i=Jk(n,s,!1),a={},c=new Set;return O2(t,{allKeys:!0},(d,p,g,h)=>{if(h===void 0)return;let m=i+p,_=o[h];typeof d[r]=="string"&&(_=b.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),o[p]=_;function b(x){let T=this.opts.uriResolver.resolve;if(x=ri(_?T(_,x):x),c.has(x))throw l(x);c.add(x);let P=this.refs[x];return typeof P=="string"&&(P=this.refs[P]),typeof P=="object"?u(d,P.schema,x):x!==ri(m)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=m),x}function w(x){if(typeof x=="string"){if(!z2.test(x))throw new Error(`invalid anchor "${x}"`);b.call(this,`#${x}`)}}}),a;function u(d,p,g){if(p!==void 0&&!P2(d,p))throw l(g)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}zt.getSchemaRefs=M2});var Za=S(Ln=>{"use strict";f();Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getData=Ln.KeywordCxt=Ln.validateFunctionCode=void 0;var tE=Ok(),Yk=za(),zg=Tg(),xl=za(),L2=Mk(),qa=Fk(),jg=Vk(),Y=me(),ae=ln(),q2=Ma(),dn=Se(),La=ja();function Z2(t){if(sE(t)&&(oE(t),nE(t))){U2(t);return}rE(t,()=>(0,tE.topBoolOrEmptySchema)(t))}Ln.validateFunctionCode=Z2;function rE({gen:t,validateName:e,schema:r,schemaEnv:n,opts:s},o){s.code.es5?t.func(e,(0,Y._)`${ae.default.data}, ${ae.default.valCxt}`,n.$async,()=>{t.code((0,Y._)`"use strict"; ${Xk(r,s)}`),F2(t,s),t.code(o)}):t.func(e,(0,Y._)`${ae.default.data}, ${D2(s)}`,n.$async,()=>t.code(Xk(r,s)).code(o))}function D2(t){return(0,Y._)`{${ae.default.instancePath}="", ${ae.default.parentData}, ${ae.default.parentDataProperty}, ${ae.default.rootData}=${ae.default.data}${t.dynamicRef?(0,Y._)`, ${ae.default.dynamicAnchors}={}`:Y.nil}}={}`}function F2(t,e){t.if(ae.default.valCxt,()=>{t.var(ae.default.instancePath,(0,Y._)`${ae.default.valCxt}.${ae.default.instancePath}`),t.var(ae.default.parentData,(0,Y._)`${ae.default.valCxt}.${ae.default.parentData}`),t.var(ae.default.parentDataProperty,(0,Y._)`${ae.default.valCxt}.${ae.default.parentDataProperty}`),t.var(ae.default.rootData,(0,Y._)`${ae.default.valCxt}.${ae.default.rootData}`),e.dynamicRef&&t.var(ae.default.dynamicAnchors,(0,Y._)`${ae.default.valCxt}.${ae.default.dynamicAnchors}`)},()=>{t.var(ae.default.instancePath,(0,Y._)`""`),t.var(ae.default.parentData,(0,Y._)`undefined`),t.var(ae.default.parentDataProperty,(0,Y._)`undefined`),t.var(ae.default.rootData,ae.default.data),e.dynamicRef&&t.var(ae.default.dynamicAnchors,(0,Y._)`{}`)})}function U2(t){let{schema:e,opts:r,gen:n}=t;rE(t,()=>{r.$comment&&e.$comment&&aE(t),G2(t),n.let(ae.default.vErrors,null),n.let(ae.default.errors,0),r.unevaluated&&V2(t),iE(t),Y2(t)})}function V2(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,Y._)`${r}.evaluated`),e.if((0,Y._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,Y._)`${t.evaluated}.props`,(0,Y._)`undefined`)),e.if((0,Y._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,Y._)`${t.evaluated}.items`,(0,Y._)`undefined`))}function Xk(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,Y._)`/*# sourceURL=${r} */`:Y.nil}function B2(t,e){if(sE(t)&&(oE(t),nE(t))){H2(t,e);return}(0,tE.boolOrEmptySchema)(t,e)}function nE({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function sE(t){return typeof t.schema!="boolean"}function H2(t,e){let{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&aE(t),J2(t),W2(t);let o=n.const("_errs",ae.default.errors);iE(t,o),n.var(e,(0,Y._)`${o} === ${ae.default.errors}`)}function oE(t){(0,dn.checkUnknownRules)(t),K2(t)}function iE(t,e){if(t.opts.jtd)return Qk(t,[],!1,e);let r=(0,Yk.getSchemaTypes)(t.schema),n=(0,Yk.coerceAndCheckDataType)(t,r);Qk(t,r,!n,e)}function K2(t){let{schema:e,errSchemaPath:r,opts:n,self:s}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,dn.schemaHasRulesButRef)(e,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function G2(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,dn.checkStrictMode)(t,"default is ignored in the schema root")}function J2(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,q2.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function W2(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function aE({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===!0)t.code((0,Y._)`${ae.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=(0,Y.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,Y._)`${ae.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function Y2(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=t;r.$async?e.if((0,Y._)`${ae.default.errors} === 0`,()=>e.return(ae.default.data),()=>e.throw((0,Y._)`new ${s}(${ae.default.vErrors})`)):(e.assign((0,Y._)`${n}.errors`,ae.default.vErrors),o.unevaluated&&X2(t),e.return((0,Y._)`${ae.default.errors} === 0`))}function X2({gen:t,evaluated:e,props:r,items:n}){r instanceof Y.Name&&t.assign((0,Y._)`${e}.props`,r),n instanceof Y.Name&&t.assign((0,Y._)`${e}.items`,n)}function Qk(t,e,r,n){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,dn.schemaHasRulesButRef)(o,l))){s.block(()=>uE(t,"$ref",l.all.$ref.definition));return}c.jtd||Q2(t,e),s.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,zg.shouldUseGroup)(o,p)&&(p.type?(s.if((0,xl.checkDataType)(p.type,i,c.strictNumbers)),eE(t,p),e.length===1&&e[0]===p.type&&r&&(s.else(),(0,xl.reportTypeError)(t)),s.endIf()):eE(t,p),a||s.if((0,Y._)`${ae.default.errors} === ${n||0}`))}}function eE(t,e){let{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,L2.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,zg.shouldUseRule)(n,o)&&uE(t,o.keyword,o.definition,e.type)})}function Q2(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(eF(t,e),t.opts.allowUnionTypes||tF(t,e),rF(t,t.dataTypes))}function eF(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{cE(t.dataTypes,r)||Mg(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),sF(t,e)}}function tF(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Mg(t,"use allowUnionTypes to allow union type keyword")}function rF(t,e){let r=t.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0,zg.shouldUseRule)(t.schema,s)){let{type:o}=s.definition;o.length&&!o.some(i=>nF(e,i))&&Mg(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function nF(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function cE(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function sF(t,e){let r=[];for(let n of t.dataTypes)cE(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Mg(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,dn.checkStrictMode)(t,e,t.opts.strictTypes)}var Sl=class{constructor(e,r,n){if((0,qa.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,dn.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",lE(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,qa.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ae.default.errors))}result(e,r,n){this.failResult((0,Y.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,Y.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,Y._)`${r} !== undefined && (${(0,Y.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?La.reportExtraError:La.reportError)(this,this.def.error,r)}$dataError(){(0,La.reportError)(this,this.def.$dataError||La.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,La.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=Y.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=Y.nil,r=Y.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,Y.or)((0,Y._)`${s} === undefined`,r)),e!==Y.nil&&n.assign(e,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==Y.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,Y.or)(i(),a());function i(){if(n.length){if(!(r instanceof Y.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,Y._)`${(0,xl.checkDataTypes)(c,r,o.opts.strictNumbers,xl.DataType.Wrong)}`}return Y.nil}function a(){if(s.validateSchema){let c=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,Y._)`!${c}(${r})`}return Y.nil}}subschema(e,r){let n=(0,jg.getSubschema)(this.it,e);(0,jg.extendSubschemaData)(n,this.it,e),(0,jg.extendSubschemaMode)(n,e);let s={...this.it,...n,items:void 0,props:void 0};return B2(s,r),s}mergeEvaluated(e,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=dn.mergeEvaluated.props(s,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=dn.mergeEvaluated.items(s,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(e,Y.Name)),!0}};Ln.KeywordCxt=Sl;function uE(t,e,r,n){let s=new Sl(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,qa.funcKeywordCode)(s,r):"macro"in r?(0,qa.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,qa.funcKeywordCode)(s,r)}var oF=/^\/(?:[^~]|~0|~1)*$/,iF=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function lE(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,o;if(t==="")return ae.default.rootData;if(t[0]==="/"){if(!oF.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,o=ae.default.rootData}else{let u=iF.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(s=u[2],s==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(o=r[e-l],!s)return o}let i=o,a=s.split("/");for(let u of a)u&&(o=(0,Y._)`${o}${(0,Y.getProperty)((0,dn.unescapeJsonPointer)(u))}`,i=(0,Y._)`${i} && ${o}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Ln.getData=lE});var kl=S(qg=>{"use strict";f();Object.defineProperty(qg,"__esModule",{value:!0});var Lg=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};qg.default=Lg});var Da=S(Fg=>{"use strict";f();Object.defineProperty(Fg,"__esModule",{value:!0});var Zg=Ma(),Dg=class extends Error{constructor(e,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Zg.resolveUrl)(e,r,n),this.missingSchema=(0,Zg.normalizeId)((0,Zg.getFullPath)(e,this.missingRef))}};Fg.default=Dg});var Tl=S(sr=>{"use strict";f();Object.defineProperty(sr,"__esModule",{value:!0});sr.resolveSchema=sr.getCompilingSchema=sr.resolveRef=sr.compileSchema=sr.SchemaEnv=void 0;var xr=me(),aF=kl(),qs=ln(),Sr=Ma(),dE=Se(),cF=Za(),ni=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Sr.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};sr.SchemaEnv=ni;function Vg(t){let e=fE.call(this,t);if(e)return e;let r=(0,Sr.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new xr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),a;t.$async&&(a=i.scopeValue("Error",{ref:aF.default,code:(0,xr._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:qs.default.data,parentData:qs.default.parentData,parentDataProperty:qs.default.parentDataProperty,dataNames:[qs.default.data],dataPathArr:[xr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,xr.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:xr.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,xr._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,cF.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(qs.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let g=new Function(`${qs.default.self}`,`${qs.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:g}),g.errors=null,g.schema=t.schema,g.schemaEnv=t,t.$async&&(g.$async=!0),this.opts.code.source===!0&&(g.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:m}=u;g.evaluated={props:h instanceof xr.Name?void 0:h,items:m instanceof xr.Name?void 0:m,dynamicProps:h instanceof xr.Name,dynamicItems:m instanceof xr.Name},g.source&&(g.source.evaluated=(0,xr.stringify)(g.evaluated))}return t.validate=g,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}sr.compileSchema=Vg;function uF(t,e,r){var n;r=(0,Sr.resolveUrl)(this.opts.uriResolver,e,r);let s=t.refs[r];if(s)return s;let o=fF.call(this,t,r);if(o===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new ni({schema:i,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=lF.call(this,o)}sr.resolveRef=uF;function lF(t){return(0,Sr.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Vg.call(this,t)}function fE(t){for(let e of this._compilations)if(dF(e,t))return e}sr.getCompilingSchema=fE;function dF(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function fF(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||El.call(this,t,e)}function El(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Sr._getFullPath)(this.opts.uriResolver,r),s=(0,Sr.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===s)return Ug.call(this,r,t);let o=(0,Sr.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=El.call(this,t,i);return typeof a?.schema!="object"?void 0:Ug.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Vg.call(this,i),o===(0,Sr.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,Sr.resolveUrl)(this.opts.uriResolver,s,u)),new ni({schema:a,schemaId:c,root:t,baseId:s})}return Ug.call(this,r,i)}}sr.resolveSchema=El;var pF=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ug(t,{baseId:e,schema:r,root:n}){var s;if(((s=t.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,dE.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!pF.has(a)&&u&&(e=(0,Sr.resolveUrl)(this.opts.uriResolver,e,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,dE.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Sr.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=El.call(this,n,a)}let{schemaId:i}=this.opts;if(o=o||new ni({schema:r,schemaId:i,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var pE=S((jce,hF)=>{hF.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 Hg=S((zce,yE)=>{"use strict";f();var mF=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),mE=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Bg(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var gF=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function hE(t){return t.length=0,!0}function yF(t,e,r){if(t.length){let n=Bg(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function _F(t){let e=0,r={error:!1,address:"",zone:""},n=[],s=[],o=!1,i=!1,a=yF;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(i=!0),!a(s,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(o=!0),n.push(":");continue}else if(u==="%"){if(!a(s,n,r))break;a=hE}else{s.push(u);continue}}return s.length&&(a===hE?r.zone=s.join(""):i?n.push(s.join("")):n.push(Bg(s))),r.address=n.join(""),r}function gE(t){if(vF(t,":")<2)return{host:t,isIPV6:!1};let e=_F(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function vF(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function bF(t){let e=t,r=[],n=-1,s=0;for(;s=e.length;){if(s===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(s===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(s===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function wF(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function xF(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!mE(r)){let n=gE(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}yE.exports={nonSimpleDomain:gF,recomposeAuthority:xF,normalizeComponentEncoding:wF,removeDotSegments:bF,isIPv4:mE,isUUID:mF,normalizeIPv6:gE,stringArrayToHexStripped:Bg}});var xE=S((Lce,wE)=>{"use strict";f();var{isUUID:SF}=Hg(),kF=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,EF=["http","https","ws","wss","urn","urn:uuid"];function TF(t){return EF.indexOf(t)!==-1}function Kg(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function _E(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function vE(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function $F(t){return t.secure=Kg(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function IF(t){if((t.port===(Kg(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function PF(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(kF);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let s=`${n}:${e.nid||t.nid}`,o=Gg(s);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function OF(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),s=`${r}:${e.nid||n}`,o=Gg(s);o&&(t=o.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function CF(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!SF(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function AF(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var bE={scheme:"http",domainHost:!0,parse:_E,serialize:vE},NF={scheme:"https",domainHost:bE.domainHost,parse:_E,serialize:vE},$l={scheme:"ws",domainHost:!0,parse:$F,serialize:IF},RF={scheme:"wss",domainHost:$l.domainHost,parse:$l.parse,serialize:$l.serialize},jF={scheme:"urn",parse:PF,serialize:OF,skipNormalize:!0},zF={scheme:"urn:uuid",parse:CF,serialize:AF,skipNormalize:!0},Il={http:bE,https:NF,ws:$l,wss:RF,urn:jF,"urn:uuid":zF};Object.setPrototypeOf(Il,null);function Gg(t){return t&&(Il[t]||Il[t.toLowerCase()])||void 0}wE.exports={wsIsSecure:Kg,SCHEMES:Il,isValidSchemeName:TF,getSchemeHandler:Gg}});var EE=S((Zce,Ol)=>{"use strict";f();var{normalizeIPv6:MF,removeDotSegments:Fa,recomposeAuthority:LF,normalizeComponentEncoding:Pl,isIPv4:qF,nonSimpleDomain:ZF}=Hg(),{SCHEMES:DF,getSchemeHandler:SE}=xE();function FF(t,e){return typeof t=="string"?t=Zr(fn(t,e),e):typeof t=="object"&&(t=fn(Zr(t,e),e)),t}function UF(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=kE(fn(t,n),fn(e,n),n,!0);return n.skipEscape=!0,Zr(s,n)}function kE(t,e,r,n){let s={};return n||(t=fn(Zr(t,r),r),e=fn(Zr(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(s.scheme=e.scheme,s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Fa(e.path||""),s.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Fa(e.path||""),s.query=e.query):(e.path?(e.path[0]==="/"?s.path=Fa(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?s.path="/"+e.path:t.path?s.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:s.path=e.path,s.path=Fa(s.path)),s.query=e.query):(s.path=t.path,e.query!==void 0?s.query=e.query:s.query=t.query),s.userinfo=t.userinfo,s.host=t.host,s.port=t.port),s.scheme=t.scheme),s.fragment=e.fragment,s}function VF(t,e,r){return typeof t=="string"?(t=unescape(t),t=Zr(Pl(fn(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Zr(Pl(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Zr(Pl(fn(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Zr(Pl(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Zr(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),s=[],o=SE(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");let i=LF(r);if(i!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(i),r.path&&r.path[0]!=="/"&&s.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=Fa(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),s.push(a)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}var BF=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function fn(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(BF);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(qF(n.host)===!1){let c=MF(n.host);n.host=c.host.toLowerCase(),s=c.isIPV6}else s=!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 i=SE(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&s===!1&&ZF(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Jg={SCHEMES:DF,normalize:FF,resolve:UF,resolveComponent:kE,equal:VF,serialize:Zr,parse:fn};Ol.exports=Jg;Ol.exports.default=Jg;Ol.exports.fastUri=Jg});var $E=S(Wg=>{"use strict";f();Object.defineProperty(Wg,"__esModule",{value:!0});var TE=EE();TE.code='require("ajv/dist/runtime/uri").default';Wg.default=TE});var jE=S(gt=>{"use strict";f();Object.defineProperty(gt,"__esModule",{value:!0});gt.CodeGen=gt.Name=gt.nil=gt.stringify=gt.str=gt._=gt.KeywordCxt=void 0;var HF=Za();Object.defineProperty(gt,"KeywordCxt",{enumerable:!0,get:function(){return HF.KeywordCxt}});var si=me();Object.defineProperty(gt,"_",{enumerable:!0,get:function(){return si._}});Object.defineProperty(gt,"str",{enumerable:!0,get:function(){return si.str}});Object.defineProperty(gt,"stringify",{enumerable:!0,get:function(){return si.stringify}});Object.defineProperty(gt,"nil",{enumerable:!0,get:function(){return si.nil}});Object.defineProperty(gt,"Name",{enumerable:!0,get:function(){return si.Name}});Object.defineProperty(gt,"CodeGen",{enumerable:!0,get:function(){return si.CodeGen}});var KF=kl(),AE=Da(),GF=Eg(),Ua=Tl(),JF=me(),Va=Ma(),Cl=za(),Xg=Se(),IE=pE(),WF=$E(),NE=(t,e)=>new RegExp(t,e);NE.code="new RegExp";var YF=["removeAdditional","useDefaults","coerceTypes"],XF=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),QF={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."},eU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},PE=200;function tU(t){var e,r,n,s,o,i,a,c,u,l,d,p,g,h,m,_,b,w,x,T,P,L,U,$,N;let F=t.strict,C=(e=t.code)===null||e===void 0?void 0:e.optimize,z=C===!0||C===void 0?1:C||0,V=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:NE,te=(s=t.uriResolver)!==null&&s!==void 0?s:WF.default;return{strictSchema:(i=(o=t.strictSchema)!==null&&o!==void 0?o:F)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:F)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:F)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:F)!==null&&p!==void 0?p:"log",strictRequired:(h=(g=t.strictRequired)!==null&&g!==void 0?g:F)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:z,regExp:V}:{optimize:z,regExp:V},loopRequired:(m=t.loopRequired)!==null&&m!==void 0?m:PE,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:PE,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(T=t.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(P=t.addUsedSchema)!==null&&P!==void 0?P:!0,validateSchema:(L=t.validateSchema)!==null&&L!==void 0?L:!0,validateFormats:(U=t.validateFormats)!==null&&U!==void 0?U:!0,unicodeRegExp:($=t.unicodeRegExp)!==null&&$!==void 0?$:!0,int32range:(N=t.int32range)!==null&&N!==void 0?N:!0,uriResolver:te}}var Ba=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...tU(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new JF.ValueScope({scope:{},prefixes:XF,es5:r,lines:n}),this.logger=aU(e.logger);let s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,GF.getRules)(),OE.call(this,QF,e,"NOT SUPPORTED"),OE.call(this,eU,e,"DEPRECATED","warn"),this._metaOpts=oU.call(this),e.formats&&nU.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&sU.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),rU.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,s=IE;n==="id"&&(s={...IE},s.id=s.$id,delete s.$id),r&&e&&this.addMetaSchema(s,s[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let s=n(r);return"$async"in n||(this.errors=n.errors),s}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return s.call(this,e,r);async function s(l,d){await o.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function o(l){l&&!this.getSchema(l)&&await s.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof AE.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,s=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,s);return this}let o;if(typeof e=="object"){let{schemaId:i}=this.opts;if(o=e[i],o!==void 0&&typeof o!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Va.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,s,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(n,e);if(!s&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return s}getSchema(e){let r;for(;typeof(r=CE.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,s=new Ua.SchemaEnv({schema:{},schemaId:n});if(r=Ua.resolveSchema.call(this,s,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=CE.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Va.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(uU.call(this,n,r),!r)return(0,Xg.eachItem)(n,o=>Yg.call(this,o)),this;dU.call(this,r);let s={...r,type:(0,Cl.getJSONTypes)(r.type),schemaType:(0,Cl.getJSONTypes)(r.schemaType)};return(0,Xg.eachItem)(n,s.type.length===0?o=>Yg.call(this,o,s):o=>s.type.forEach(i=>Yg.call(this,o,s,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let s=n.rules.findIndex(o=>o.keyword===e);s>=0&&n.rules.splice(s,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(s=>`${n}${s.instancePath} ${s.message}`).reduce((s,o)=>s+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let s of r){let o=s.split("/").slice(1),i=e;for(let a of o)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=RE(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let s=e[n];(!r||r.test(n))&&(typeof s=="string"?delete e[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[n]))}}_addSchema(e,r,n,s=this.opts.validateSchema,o=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Va.normalizeId)(i||n);let u=Va.getSchemaRefs.call(this,e,n);return c=new Ua.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),s&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Ua.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Ua.compileSchema.call(this,e)}finally{this.opts=r}}};Ba.ValidationError=KF.default;Ba.MissingRefError=AE.default;gt.default=Ba;function OE(t,e,r,n="error"){for(let s in t){let o=s;o in e&&this.logger[n](`${r}: option ${s}. ${t[o]}`)}}function CE(t){return t=(0,Va.normalizeId)(t),this.schemas[t]||this.refs[t]}function rU(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function nU(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function sU(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function oU(){let t={...this.opts};for(let e of YF)delete t[e];return t}var iU={log(){},warn(){},error(){}};function aU(t){if(t===!1)return iU;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var cU=/^[a-z_$][a-z0-9_$:-]*$/i;function uU(t,e){let{RULES:r}=this;if((0,Xg.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!cU.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Yg(t,e,r){var n;let s=e?.post;if(r&&s)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},o.rules.push(i)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Cl.getJSONTypes)(e.type),schemaType:(0,Cl.getJSONTypes)(e.schemaType)}};e.before?lU.call(this,i,a,e.before):i.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function lU(t,e,r){let n=t.rules.findIndex(s=>s.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function dU(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=RE(e)),t.validateSchema=this.compile(e,!0))}var fU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function RE(t){return{anyOf:[t,fU]}}});var zE=S(Qg=>{"use strict";f();Object.defineProperty(Qg,"__esModule",{value:!0});var pU={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Qg.default=pU});var ZE=S(Zs=>{"use strict";f();Object.defineProperty(Zs,"__esModule",{value:!0});Zs.callRef=Zs.getValidate=void 0;var hU=Da(),ME=nr(),Mt=me(),oi=ln(),LE=Tl(),Al=Se(),mU={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return d();let l=LE.resolveRef.call(c,u,s,r);if(l===void 0)throw new hU.default(n.opts.uriResolver,s,r);if(l instanceof LE.SchemaEnv)return p(l);return g(l);function d(){if(o===u)return Nl(t,i,o,o.$async);let h=e.scopeValue("root",{ref:u});return Nl(t,(0,Mt._)`${h}.validate`,u,u.$async)}function p(h){let m=qE(t,h);Nl(t,m,h,h.$async)}function g(h){let m=e.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Mt.stringify)(h)}:{ref:h}),_=e.name("valid"),b=t.subschema({schema:h,dataTypes:[],schemaPath:Mt.nil,topSchemaRef:m,errSchemaPath:r},_);t.mergeEvaluated(b),t.ok(_)}}};function qE(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Mt._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Zs.getValidate=qE;function Nl(t,e,r,n){let{gen:s,it:o}=t,{allErrors:i,schemaEnv:a,opts:c}=o,u=c.passContext?oi.default.this:Mt.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=s.let("valid");s.try(()=>{s.code((0,Mt._)`await ${(0,ME.callValidateCode)(t,e,u)}`),g(e),i||s.assign(h,!0)},m=>{s.if((0,Mt._)`!(${m} instanceof ${o.ValidationError})`,()=>s.throw(m)),p(m),i||s.assign(h,!1)}),t.ok(h)}function d(){t.result((0,ME.callValidateCode)(t,e,u),()=>g(e),()=>p(e))}function p(h){let m=(0,Mt._)`${h}.errors`;s.assign(oi.default.vErrors,(0,Mt._)`${oi.default.vErrors} === null ? ${m} : ${oi.default.vErrors}.concat(${m})`),s.assign(oi.default.errors,(0,Mt._)`${oi.default.vErrors}.length`)}function g(h){var m;if(!o.opts.unevaluated)return;let _=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(o.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(o.props=Al.mergeEvaluated.props(s,_.props,o.props));else{let b=s.var("props",(0,Mt._)`${h}.evaluated.props`);o.props=Al.mergeEvaluated.props(s,b,o.props,Mt.Name)}if(o.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(o.items=Al.mergeEvaluated.items(s,_.items,o.items));else{let b=s.var("items",(0,Mt._)`${h}.evaluated.items`);o.items=Al.mergeEvaluated.items(s,b,o.items,Mt.Name)}}}Zs.callRef=Nl;Zs.default=mU});var DE=S(ey=>{"use strict";f();Object.defineProperty(ey,"__esModule",{value:!0});var gU=zE(),yU=ZE(),_U=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",gU.default,yU.default];ey.default=_U});var FE=S(ty=>{"use strict";f();Object.defineProperty(ty,"__esModule",{value:!0});var Rl=me(),qn=Rl.operators,jl={maximum:{okStr:"<=",ok:qn.LTE,fail:qn.GT},minimum:{okStr:">=",ok:qn.GTE,fail:qn.LT},exclusiveMaximum:{okStr:"<",ok:qn.LT,fail:qn.GTE},exclusiveMinimum:{okStr:">",ok:qn.GT,fail:qn.LTE}},vU={message:({keyword:t,schemaCode:e})=>(0,Rl.str)`must be ${jl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Rl._)`{comparison: ${jl[t].okStr}, limit: ${e}}`},bU={keyword:Object.keys(jl),type:"number",schemaType:"number",$data:!0,error:vU,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Rl._)`${r} ${jl[e].fail} ${n} || isNaN(${r})`)}};ty.default=bU});var UE=S(ry=>{"use strict";f();Object.defineProperty(ry,"__esModule",{value:!0});var Ha=me(),wU={message:({schemaCode:t})=>(0,Ha.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Ha._)`{multipleOf: ${t}}`},xU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wU,code(t){let{gen:e,data:r,schemaCode:n,it:s}=t,o=s.opts.multipleOfPrecision,i=e.let("res"),a=o?(0,Ha._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Ha._)`${i} !== parseInt(${i})`;t.fail$data((0,Ha._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};ry.default=xU});var BE=S(ny=>{"use strict";f();Object.defineProperty(ny,"__esModule",{value:!0});function VE(t){let e=t.length,r=0,n=0,s;for(;n<e;)r++,s=t.charCodeAt(n++),s>=55296&&s<=56319&&n<e&&(s=t.charCodeAt(n),(s&64512)===56320&&n++);return r}ny.default=VE;VE.code='require("ajv/dist/runtime/ucs2length").default'});var HE=S(sy=>{"use strict";f();Object.defineProperty(sy,"__esModule",{value:!0});var Ds=me(),SU=Se(),kU=BE(),EU={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ds.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ds._)`{limit: ${t}}`},TU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:EU,code(t){let{keyword:e,data:r,schemaCode:n,it:s}=t,o=e==="maxLength"?Ds.operators.GT:Ds.operators.LT,i=s.opts.unicode===!1?(0,Ds._)`${r}.length`:(0,Ds._)`${(0,SU.useFunc)(t.gen,kU.default)}(${r})`;t.fail$data((0,Ds._)`${i} ${o} ${n}`)}};sy.default=TU});var KE=S(oy=>{"use strict";f();Object.defineProperty(oy,"__esModule",{value:!0});var $U=nr(),IU=Se(),ii=me(),PU={message:({schemaCode:t})=>(0,ii.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ii._)`{pattern: ${t}}`},OU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:PU,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,ii._)`new RegExp`:(0,IU.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,ii._)`${u}(${o}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,ii._)`!${l}`)}else{let c=(0,$U.usePattern)(t,s);t.fail$data((0,ii._)`!${c}.test(${r})`)}}};oy.default=OU});var GE=S(iy=>{"use strict";f();Object.defineProperty(iy,"__esModule",{value:!0});var Ka=me(),CU={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Ka.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Ka._)`{limit: ${t}}`},AU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:CU,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?Ka.operators.GT:Ka.operators.LT;t.fail$data((0,Ka._)`Object.keys(${r}).length ${s} ${n}`)}};iy.default=AU});var JE=S(ay=>{"use strict";f();Object.defineProperty(ay,"__esModule",{value:!0});var Ga=nr(),Ja=me(),NU=Se(),RU={message:({params:{missingProperty:t}})=>(0,Ja.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ja._)`{missingProperty: ${t}}`},jU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:RU,code(t){let{gen:e,schema:r,schemaCode:n,data:s,$data:o,it:i}=t,{opts:a}=i;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let g=t.parentSchema.properties,{definedProperties:h}=t.it;for(let m of r)if(g?.[m]===void 0&&!h.has(m)){let _=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${m}" is not defined at "${_}" (strictRequired)`;(0,NU.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||o)t.block$data(Ja.nil,d);else for(let g of r)(0,Ga.checkReportMissingProp)(t,g)}function l(){let g=e.let("missing");if(c||o){let h=e.let("valid",!0);t.block$data(h,()=>p(g,h)),t.ok(h)}else e.if((0,Ga.checkMissingProp)(t,r,g)),(0,Ga.reportMissingProp)(t,g),e.else()}function d(){e.forOf("prop",n,g=>{t.setParams({missingProperty:g}),e.if((0,Ga.noPropertyInData)(e,s,g,a.ownProperties),()=>t.error())})}function p(g,h){t.setParams({missingProperty:g}),e.forOf(g,n,()=>{e.assign(h,(0,Ga.propertyInData)(e,s,g,a.ownProperties)),e.if((0,Ja.not)(h),()=>{t.error(),e.break()})},Ja.nil)}}};ay.default=jU});var WE=S(cy=>{"use strict";f();Object.defineProperty(cy,"__esModule",{value:!0});var Wa=me(),zU={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Wa.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Wa._)`{limit: ${t}}`},MU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:zU,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?Wa.operators.GT:Wa.operators.LT;t.fail$data((0,Wa._)`${r}.length ${s} ${n}`)}};cy.default=MU});var zl=S(uy=>{"use strict";f();Object.defineProperty(uy,"__esModule",{value:!0});var YE=Ng();YE.code='require("ajv/dist/runtime/equal").default';uy.default=YE});var XE=S(dy=>{"use strict";f();Object.defineProperty(dy,"__esModule",{value:!0});var ly=za(),yt=me(),LU=Se(),qU=zl(),ZU={message:({params:{i:t,j:e}})=>(0,yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,yt._)`{i: ${t}, j: ${e}}`},DU={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:ZU,code(t){let{gen:e,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=t;if(!n&&!s)return;let c=e.let("valid"),u=o.items?(0,ly.getSchemaTypes)(o.items):[];t.block$data(c,l,(0,yt._)`${i} === false`),t.ok(c);function l(){let h=e.let("i",(0,yt._)`${r}.length`),m=e.let("j");t.setParams({i:h,j:m}),e.assign(c,!0),e.if((0,yt._)`${h} > 1`,()=>(d()?p:g)(h,m))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,m){let _=e.name("item"),b=(0,ly.checkDataTypes)(u,_,a.opts.strictNumbers,ly.DataType.Wrong),w=e.const("indices",(0,yt._)`{}`);e.for((0,yt._)`;${h}--;`,()=>{e.let(_,(0,yt._)`${r}[${h}]`),e.if(b,(0,yt._)`continue`),u.length>1&&e.if((0,yt._)`typeof ${_} == "string"`,(0,yt._)`${_} += "_"`),e.if((0,yt._)`typeof ${w}[${_}] == "number"`,()=>{e.assign(m,(0,yt._)`${w}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,yt._)`${w}[${_}] = ${h}`)})}function g(h,m){let _=(0,LU.useFunc)(e,qU.default),b=e.name("outer");e.label(b).for((0,yt._)`;${h}--;`,()=>e.for((0,yt._)`${m} = ${h}; ${m}--;`,()=>e.if((0,yt._)`${_}(${r}[${h}], ${r}[${m}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};dy.default=DU});var QE=S(py=>{"use strict";f();Object.defineProperty(py,"__esModule",{value:!0});var fy=me(),FU=Se(),UU=zl(),VU={message:"must be equal to constant",params:({schemaCode:t})=>(0,fy._)`{allowedValue: ${t}}`},BU={keyword:"const",$data:!0,error:VU,code(t){let{gen:e,data:r,$data:n,schemaCode:s,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,fy._)`!${(0,FU.useFunc)(e,UU.default)}(${r}, ${s})`):t.fail((0,fy._)`${o} !== ${r}`)}};py.default=BU});var eT=S(hy=>{"use strict";f();Object.defineProperty(hy,"__esModule",{value:!0});var Ya=me(),HU=Se(),KU=zl(),GU={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Ya._)`{allowedValues: ${t}}`},JU={keyword:"enum",schemaType:"array",$data:!0,error:GU,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t;if(!n&&s.length===0)throw new Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,HU.useFunc)(e,KU.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(s))throw new Error("ajv implementation error");let g=e.const("vSchema",o);l=(0,Ya.or)(...s.map((h,m)=>p(g,m)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",o,g=>e.if((0,Ya._)`${u()}(${r}, ${g})`,()=>e.assign(l,!0).break()))}function p(g,h){let m=s[h];return typeof m=="object"&&m!==null?(0,Ya._)`${u()}(${r}, ${g}[${h}])`:(0,Ya._)`${r} === ${m}`}}};hy.default=JU});var tT=S(my=>{"use strict";f();Object.defineProperty(my,"__esModule",{value:!0});var WU=FE(),YU=UE(),XU=HE(),QU=KE(),e4=GE(),t4=JE(),r4=WE(),n4=XE(),s4=QE(),o4=eT(),i4=[WU.default,YU.default,XU.default,QU.default,e4.default,t4.default,r4.default,n4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},s4.default,o4.default];my.default=i4});var yy=S(Xa=>{"use strict";f();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.validateAdditionalItems=void 0;var Fs=me(),gy=Se(),a4={message:({params:{len:t}})=>(0,Fs.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Fs._)`{limit: ${t}}`},c4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:a4,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,gy.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}rT(t,n)}};function rT(t,e){let{gen:r,schema:n,data:s,keyword:o,it:i}=t;i.items=!0;let a=r.const("len",(0,Fs._)`${s}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Fs._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,gy.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Fs._)`${a} <= ${e.length}`);r.if((0,Fs.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:o,dataProp:l,dataPropType:gy.Type.Num},u),i.allErrors||r.if((0,Fs.not)(u),()=>r.break())})}}Xa.validateAdditionalItems=rT;Xa.default=c4});var _y=S(Qa=>{"use strict";f();Object.defineProperty(Qa,"__esModule",{value:!0});Qa.validateTuple=void 0;var nT=me(),Ml=Se(),u4=nr(),l4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return sT(t,"additionalItems",e);r.items=!0,!(0,Ml.alwaysValidSchema)(r,e)&&t.ok((0,u4.validateArray)(t))}};function sT(t,e,r=t.schema){let{gen:n,parentSchema:s,data:o,keyword:i,it:a}=t;l(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ml.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,nT._)`${o}.length`);r.forEach((d,p)=>{(0,Ml.alwaysValidSchema)(a,d)||(n.if((0,nT._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:g}=a,h=r.length,m=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!m){let _=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${g}"`;(0,Ml.checkStrictMode)(a,_,p.strictTuples)}}}Qa.validateTuple=sT;Qa.default=l4});var oT=S(vy=>{"use strict";f();Object.defineProperty(vy,"__esModule",{value:!0});var d4=_y(),f4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,d4.validateTuple)(t,"items")};vy.default=f4});var aT=S(by=>{"use strict";f();Object.defineProperty(by,"__esModule",{value:!0});var iT=me(),p4=Se(),h4=nr(),m4=yy(),g4={message:({params:{len:t}})=>(0,iT.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,iT._)`{limit: ${t}}`},y4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:g4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,p4.alwaysValidSchema)(n,e)&&(s?(0,m4.validateAdditionalItems)(t,s):t.ok((0,h4.validateArray)(t)))}};by.default=y4});var cT=S(wy=>{"use strict";f();Object.defineProperty(wy,"__esModule",{value:!0});var or=me(),Ll=Se(),_4={message:({params:{min:t,max:e}})=>e===void 0?(0,or.str)`must contain at least ${t} valid item(s)`:(0,or.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,or._)`{minContains: ${t}}`:(0,or._)`{minContains: ${t}, maxContains: ${e}}`},v4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:_4,code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t,i,a,{minContains:c,maxContains:u}=n;o.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,or._)`${s}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Ll.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Ll.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ll.alwaysValidSchema)(o,r)){let m=(0,or._)`${l} >= ${i}`;a!==void 0&&(m=(0,or._)`${m} && ${l} <= ${a}`),t.pass(m);return}o.items=!0;let d=e.name("valid");a===void 0&&i===1?g(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,or._)`${s}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let m=e.name("_valid"),_=e.let("count",0);g(m,()=>e.if(m,()=>h(_)))}function g(m,_){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:Ll.Type.Num,compositeRule:!0},m),_()})}function h(m){e.code((0,or._)`${m}++`),a===void 0?e.if((0,or._)`${m} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,or._)`${m} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,or._)`${m} >= ${i}`,()=>e.assign(d,!0)))}}};wy.default=v4});var dT=S(Dr=>{"use strict";f();Object.defineProperty(Dr,"__esModule",{value:!0});Dr.validateSchemaDeps=Dr.validatePropertyDeps=Dr.error=void 0;var xy=me(),b4=Se(),ec=nr();Dr.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,xy.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,xy._)`{property: ${t},
|
|
6
|
+
|| ${i} === "boolean" || ${s} === null`).assign(a,(0,de._)`[${s}]`)}}}function o2({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,de._)`${e} !== undefined`,()=>t.assign((0,de._)`${e}[${r}]`,n))}function $g(t,e,r,n=ei.Correct){let s=n===ei.Correct?de.operators.EQ:de.operators.NEQ,o;switch(t){case"null":return(0,de._)`${e} ${s} null`;case"array":o=(0,de._)`Array.isArray(${e})`;break;case"object":o=(0,de._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":o=i((0,de._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":o=i();break;default:return(0,de._)`typeof ${e} ${s} ${t}`}return n===ei.Correct?o:(0,de.not)(o);function i(a=de.nil){return(0,de.and)((0,de._)`typeof ${e} == "number"`,a,r?(0,de._)`isFinite(${e})`:de.nil)}}St.checkDataType=$g;function Ig(t,e,r,n){if(t.length===1)return $g(t[0],e,r,n);let s,o=(0,Rk.toHash)(t);if(o.array&&o.object){let i=(0,de._)`typeof ${e} != "object"`;s=o.null?i:(0,de._)`!${e} || ${i}`,delete o.null,delete o.array,delete o.object}else s=de.nil;o.number&&delete o.integer;for(let i in o)s=(0,de.and)(s,$g(i,e,r,n));return s}St.checkDataTypes=Ig;var i2={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,de._)`{type: ${t}}`:(0,de._)`{type: ${e}}`};function Og(t){let e=a2(t);(0,e2.reportError)(e,i2)}St.reportTypeError=Og;function a2(t){let{gen:e,data:r,schema:n}=t,s=(0,Rk.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:t}}});var Lk=S(bl=>{"use strict";f();Object.defineProperty(bl,"__esModule",{value:!0});bl.assignDefaults=void 0;var ti=me(),c2=Se();function u2(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let s in r)Mk(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,o)=>Mk(t,o,s.default))}bl.assignDefaults=u2;function Mk(t,e,r){let{gen:n,compositeRule:s,data:o,opts:i}=t;if(r===void 0)return;let a=(0,ti._)`${o}${(0,ti.getProperty)(e)}`;if(s){(0,c2.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,ti._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,ti._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,ti._)`${a} = ${(0,ti.stringify)(r)}`)}});var nr=S(ze=>{"use strict";f();Object.defineProperty(ze,"__esModule",{value:!0});ze.validateUnion=ze.validateArray=ze.usePattern=ze.callValidateCode=ze.schemaProperties=ze.allSchemaProperties=ze.noPropertyInData=ze.propertyInData=ze.isOwnProperty=ze.hasPropFunc=ze.reportMissingProp=ze.checkMissingProp=ze.checkReportMissingProp=void 0;var Ve=me(),Pg=Se(),jn=ln(),l2=Se();function d2(t,e){let{gen:r,data:n,it:s}=t;r.if(Ng(r,n,e,s.opts.ownProperties),()=>{t.setParams({missingProperty:(0,Ve._)`${e}`},!0),t.error()})}ze.checkReportMissingProp=d2;function f2({gen:t,data:e,it:{opts:r}},n,s){return(0,Ve.or)(...n.map(o=>(0,Ve.and)(Ng(t,e,o,r.ownProperties),(0,Ve._)`${s} = ${o}`)))}ze.checkMissingProp=f2;function p2(t,e){t.setParams({missingProperty:e},!0),t.error()}ze.reportMissingProp=p2;function qk(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ve._)`Object.prototype.hasOwnProperty`})}ze.hasPropFunc=qk;function Cg(t,e,r){return(0,Ve._)`${qk(t)}.call(${e}, ${r})`}ze.isOwnProperty=Cg;function h2(t,e,r,n){let s=(0,Ve._)`${e}${(0,Ve.getProperty)(r)} !== undefined`;return n?(0,Ve._)`${s} && ${Cg(t,e,r)}`:s}ze.propertyInData=h2;function Ng(t,e,r,n){let s=(0,Ve._)`${e}${(0,Ve.getProperty)(r)} === undefined`;return n?(0,Ve.or)(s,(0,Ve.not)(Cg(t,e,r))):s}ze.noPropertyInData=Ng;function Zk(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ze.allSchemaProperties=Zk;function m2(t,e){return Zk(e).filter(r=>!(0,Pg.alwaysValidSchema)(t,e[r]))}ze.schemaProperties=m2;function g2({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:s,errorPath:o},it:i},a,c,u){let l=u?(0,Ve._)`${t}, ${e}, ${n}${s}`:e,d=[[jn.default.instancePath,(0,Ve.strConcat)(jn.default.instancePath,o)],[jn.default.parentData,i.parentData],[jn.default.parentDataProperty,i.parentDataProperty],[jn.default.rootData,jn.default.rootData]];i.opts.dynamicRef&&d.push([jn.default.dynamicAnchors,jn.default.dynamicAnchors]);let p=(0,Ve._)`${l}, ${r.object(...d)}`;return c!==Ve.nil?(0,Ve._)`${a}.call(${c}, ${p})`:(0,Ve._)`${a}(${p})`}ze.callValidateCode=g2;var y2=(0,Ve._)`new RegExp`;function _2({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:s}=e.code,o=s(r,n);return t.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,Ve._)`${s.code==="new RegExp"?y2:(0,l2.useFunc)(t,s)}(${r}, ${n})`})}ze.usePattern=_2;function v2(t){let{gen:e,data:r,keyword:n,it:s}=t,o=e.name("valid");if(s.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(o,!0),i(()=>e.break()),o;function i(a){let c=e.const("len",(0,Ve._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Pg.Type.Num},o),e.if((0,Ve.not)(o),a)})}}ze.validateArray=v2;function b2(t){let{gen:e,schema:r,keyword:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Pg.alwaysValidSchema)(s,c))&&!s.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,Ve._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,Ve.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}ze.validateUnion=b2});var Uk=S(Lr=>{"use strict";f();Object.defineProperty(Lr,"__esModule",{value:!0});Lr.validateKeywordUsage=Lr.validSchemaType=Lr.funcKeywordCode=Lr.macroKeywordCode=void 0;var It=me(),Ls=ln(),w2=nr(),x2=ja();function S2(t,e){let{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=t,a=e.macro.call(i.self,s,o,i),c=Fk(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:It.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Lr.macroKeywordCode=S2;function k2(t,e){var r;let{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=t;T2(c,e);let u=!a&&e.compile?e.compile.call(c.self,o,i,c):e.validate,l=Fk(n,s,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)m(),e.modifying&&Dk(t),_(()=>t.error());else{let b=e.async?g():h();e.modifying&&Dk(t),_(()=>E2(t,b))}}function g(){let b=n.let("ruleErrs",null);return n.try(()=>m((0,It._)`await `),w=>n.assign(d,!1).if((0,It._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,It._)`${w}.errors`),()=>n.throw(w))),b}function h(){let b=(0,It._)`${l}.errors`;return n.assign(b,null),m(It.nil),b}function m(b=e.async?(0,It._)`await `:It.nil){let w=c.opts.passContext?Ls.default.this:Ls.default.self,x=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,It._)`${b}${(0,w2.callValidateCode)(t,l,w,x)}`,e.modifying)}function _(b){var w;n.if((0,It.not)((w=e.valid)!==null&&w!==void 0?w:d),b)}}Lr.funcKeywordCode=k2;function Dk(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,It._)`${n.parentData}[${n.parentDataProperty}]`))}function E2(t,e){let{gen:r}=t;r.if((0,It._)`Array.isArray(${e})`,()=>{r.assign(Ls.default.vErrors,(0,It._)`${Ls.default.vErrors} === null ? ${e} : ${Ls.default.vErrors}.concat(${e})`).assign(Ls.default.errors,(0,It._)`${Ls.default.vErrors}.length`),(0,x2.extendErrors)(t)},()=>t.error())}function T2({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Fk(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,It.stringify)(r)})}function $2(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Lr.validSchemaType=$2;function I2({schema:t,opts:e,self:r,errSchemaPath:n},s,o){if(Array.isArray(s.keyword)?!s.keyword.includes(o):s.keyword!==o)throw new Error("ajv implementation error");let i=s.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${o}: ${i.join(",")}`);if(s.validateSchema&&!s.validateSchema(t[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(s.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Lr.validateKeywordUsage=I2});var Bk=S(zn=>{"use strict";f();Object.defineProperty(zn,"__esModule",{value:!0});zn.extendSubschemaMode=zn.extendSubschemaData=zn.getSubschema=void 0;var qr=me(),Vk=Se();function O2(t,{keyword:e,schemaProp:r,schema:n,schemaPath:s,errSchemaPath:o,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,qr._)`${t.schemaPath}${(0,qr.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,qr._)`${t.schemaPath}${(0,qr.getProperty)(e)}${(0,qr.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Vk.escapeFragment)(r)}`}}if(n!==void 0){if(s===void 0||o===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:s,topSchemaRef:i,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}zn.getSubschema=O2;function P2(t,e,{dataProp:r,dataPropType:n,data:s,dataTypes:o,propertyName:i}){if(s!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,qr._)`${e.data}${(0,qr.getProperty)(r)}`,!0);c(p),t.errorPath=(0,qr.str)`${u}${(0,Vk.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,qr._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(s!==void 0){let u=s instanceof qr.Name?s:a.let("data",s,!0);c(u),i!==void 0&&(t.propertyName=i)}o&&(t.dataTypes=o);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}zn.extendSubschemaData=P2;function C2(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:s,allErrors:o}){n!==void 0&&(t.compositeRule=n),s!==void 0&&(t.createErrors=s),o!==void 0&&(t.allErrors=o),t.jtdDiscriminator=e,t.jtdMetadata=r}zn.extendSubschemaMode=C2});var Ag=S(($ce,Hk)=>{"use strict";f();Hk.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Gk=S((Oce,Kk)=>{"use strict";f();var Mn=Kk.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},s=r.post||function(){};wl(e,n,s,t,"",t)};Mn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Mn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Mn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Mn.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 wl(t,e,r,n,s,o,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,s,o,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Mn.arrayKeywords)for(var p=0;p<d.length;p++)wl(t,e,r,d[p],s+"/"+l+"/"+p,o,s,l,n,p)}else if(l in Mn.propsKeywords){if(d&&typeof d=="object")for(var g in d)wl(t,e,r,d[g],s+"/"+l+"/"+N2(g),o,s,l,n,g)}else(l in Mn.keywords||t.allKeys&&!(l in Mn.skipKeywords))&&wl(t,e,r,d,s+"/"+l,o,s,l,n)}r(n,s,o,i,a,c,u)}}function N2(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ma=S(zt=>{"use strict";f();Object.defineProperty(zt,"__esModule",{value:!0});zt.getSchemaRefs=zt.resolveUrl=zt.normalizeId=zt._getFullPath=zt.getFullPath=zt.inlineRef=void 0;var A2=Se(),R2=Ag(),j2=Gk(),z2=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function M2(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Rg(t):e?Jk(t)<=e:!1}zt.inlineRef=M2;var L2=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Rg(t){for(let e in t){if(L2.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Rg)||typeof r=="object"&&Rg(r))return!0}return!1}function Jk(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!z2.has(r)&&(typeof t[r]=="object"&&(0,A2.eachItem)(t[r],n=>e+=Jk(n)),e===1/0))return 1/0}return e}function Wk(t,e="",r){r!==!1&&(e=ri(e));let n=t.parse(e);return Yk(t,n)}zt.getFullPath=Wk;function Yk(t,e){return t.serialize(e).split("#")[0]+"#"}zt._getFullPath=Yk;var q2=/#\/?$/;function ri(t){return t?t.replace(q2,""):""}zt.normalizeId=ri;function Z2(t,e,r){return r=ri(r),t.resolve(e,r)}zt.resolveUrl=Z2;var D2=/^[a-z_][-a-z0-9._]*$/i;function F2(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=ri(t[r]||e),o={"":s},i=Wk(n,s,!1),a={},c=new Set;return j2(t,{allKeys:!0},(d,p,g,h)=>{if(h===void 0)return;let m=i+p,_=o[h];typeof d[r]=="string"&&(_=b.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),o[p]=_;function b(x){let T=this.opts.uriResolver.resolve;if(x=ri(_?T(_,x):x),c.has(x))throw l(x);c.add(x);let O=this.refs[x];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?u(d,O.schema,x):x!==ri(m)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=m),x}function w(x){if(typeof x=="string"){if(!D2.test(x))throw new Error(`invalid anchor "${x}"`);b.call(this,`#${x}`)}}}),a;function u(d,p,g){if(p!==void 0&&!R2(d,p))throw l(g)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}zt.getSchemaRefs=F2});var Za=S(Ln=>{"use strict";f();Object.defineProperty(Ln,"__esModule",{value:!0});Ln.getData=Ln.KeywordCxt=Ln.validateFunctionCode=void 0;var rE=Ck(),Xk=za(),zg=Tg(),xl=za(),U2=Lk(),qa=Uk(),jg=Bk(),Y=me(),ae=ln(),V2=Ma(),dn=Se(),La=ja();function B2(t){if(oE(t)&&(iE(t),sE(t))){G2(t);return}nE(t,()=>(0,rE.topBoolOrEmptySchema)(t))}Ln.validateFunctionCode=B2;function nE({gen:t,validateName:e,schema:r,schemaEnv:n,opts:s},o){s.code.es5?t.func(e,(0,Y._)`${ae.default.data}, ${ae.default.valCxt}`,n.$async,()=>{t.code((0,Y._)`"use strict"; ${Qk(r,s)}`),K2(t,s),t.code(o)}):t.func(e,(0,Y._)`${ae.default.data}, ${H2(s)}`,n.$async,()=>t.code(Qk(r,s)).code(o))}function H2(t){return(0,Y._)`{${ae.default.instancePath}="", ${ae.default.parentData}, ${ae.default.parentDataProperty}, ${ae.default.rootData}=${ae.default.data}${t.dynamicRef?(0,Y._)`, ${ae.default.dynamicAnchors}={}`:Y.nil}}={}`}function K2(t,e){t.if(ae.default.valCxt,()=>{t.var(ae.default.instancePath,(0,Y._)`${ae.default.valCxt}.${ae.default.instancePath}`),t.var(ae.default.parentData,(0,Y._)`${ae.default.valCxt}.${ae.default.parentData}`),t.var(ae.default.parentDataProperty,(0,Y._)`${ae.default.valCxt}.${ae.default.parentDataProperty}`),t.var(ae.default.rootData,(0,Y._)`${ae.default.valCxt}.${ae.default.rootData}`),e.dynamicRef&&t.var(ae.default.dynamicAnchors,(0,Y._)`${ae.default.valCxt}.${ae.default.dynamicAnchors}`)},()=>{t.var(ae.default.instancePath,(0,Y._)`""`),t.var(ae.default.parentData,(0,Y._)`undefined`),t.var(ae.default.parentDataProperty,(0,Y._)`undefined`),t.var(ae.default.rootData,ae.default.data),e.dynamicRef&&t.var(ae.default.dynamicAnchors,(0,Y._)`{}`)})}function G2(t){let{schema:e,opts:r,gen:n}=t;nE(t,()=>{r.$comment&&e.$comment&&cE(t),Q2(t),n.let(ae.default.vErrors,null),n.let(ae.default.errors,0),r.unevaluated&&J2(t),aE(t),rF(t)})}function J2(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,Y._)`${r}.evaluated`),e.if((0,Y._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,Y._)`${t.evaluated}.props`,(0,Y._)`undefined`)),e.if((0,Y._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,Y._)`${t.evaluated}.items`,(0,Y._)`undefined`))}function Qk(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,Y._)`/*# sourceURL=${r} */`:Y.nil}function W2(t,e){if(oE(t)&&(iE(t),sE(t))){Y2(t,e);return}(0,rE.boolOrEmptySchema)(t,e)}function sE({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function oE(t){return typeof t.schema!="boolean"}function Y2(t,e){let{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&cE(t),eF(t),tF(t);let o=n.const("_errs",ae.default.errors);aE(t,o),n.var(e,(0,Y._)`${o} === ${ae.default.errors}`)}function iE(t){(0,dn.checkUnknownRules)(t),X2(t)}function aE(t,e){if(t.opts.jtd)return eE(t,[],!1,e);let r=(0,Xk.getSchemaTypes)(t.schema),n=(0,Xk.coerceAndCheckDataType)(t,r);eE(t,r,!n,e)}function X2(t){let{schema:e,errSchemaPath:r,opts:n,self:s}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,dn.schemaHasRulesButRef)(e,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Q2(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,dn.checkStrictMode)(t,"default is ignored in the schema root")}function eF(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,V2.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function tF(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function cE({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:s}){let o=r.$comment;if(s.$comment===!0)t.code((0,Y._)`${ae.default.self}.logger.log(${o})`);else if(typeof s.$comment=="function"){let i=(0,Y.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,Y._)`${ae.default.self}.opts.$comment(${o}, ${i}, ${a}.schema)`)}}function rF(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:s,opts:o}=t;r.$async?e.if((0,Y._)`${ae.default.errors} === 0`,()=>e.return(ae.default.data),()=>e.throw((0,Y._)`new ${s}(${ae.default.vErrors})`)):(e.assign((0,Y._)`${n}.errors`,ae.default.vErrors),o.unevaluated&&nF(t),e.return((0,Y._)`${ae.default.errors} === 0`))}function nF({gen:t,evaluated:e,props:r,items:n}){r instanceof Y.Name&&t.assign((0,Y._)`${e}.props`,r),n instanceof Y.Name&&t.assign((0,Y._)`${e}.items`,n)}function eE(t,e,r,n){let{gen:s,schema:o,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,dn.schemaHasRulesButRef)(o,l))){s.block(()=>lE(t,"$ref",l.all.$ref.definition));return}c.jtd||sF(t,e),s.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,zg.shouldUseGroup)(o,p)&&(p.type?(s.if((0,xl.checkDataType)(p.type,i,c.strictNumbers)),tE(t,p),e.length===1&&e[0]===p.type&&r&&(s.else(),(0,xl.reportTypeError)(t)),s.endIf()):tE(t,p),a||s.if((0,Y._)`${ae.default.errors} === ${n||0}`))}}function tE(t,e){let{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,U2.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,zg.shouldUseRule)(n,o)&&lE(t,o.keyword,o.definition,e.type)})}function sF(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(oF(t,e),t.opts.allowUnionTypes||iF(t,e),aF(t,t.dataTypes))}function oF(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{uE(t.dataTypes,r)||Mg(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),uF(t,e)}}function iF(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Mg(t,"use allowUnionTypes to allow union type keyword")}function aF(t,e){let r=t.self.RULES.all;for(let n in r){let s=r[n];if(typeof s=="object"&&(0,zg.shouldUseRule)(t.schema,s)){let{type:o}=s.definition;o.length&&!o.some(i=>cF(e,i))&&Mg(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function cF(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function uE(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function uF(t,e){let r=[];for(let n of t.dataTypes)uE(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Mg(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,dn.checkStrictMode)(t,e,t.opts.strictTypes)}var Sl=class{constructor(e,r,n){if((0,qa.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,dn.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",dE(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,qa.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",ae.default.errors))}result(e,r,n){this.failResult((0,Y.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,Y.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,Y._)`${r} !== undefined && (${(0,Y.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?La.reportExtraError:La.reportError)(this,this.def.error,r)}$dataError(){(0,La.reportError)(this,this.def.$dataError||La.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,La.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=Y.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=Y.nil,r=Y.nil){if(!this.$data)return;let{gen:n,schemaCode:s,schemaType:o,def:i}=this;n.if((0,Y.or)((0,Y._)`${s} === undefined`,r)),e!==Y.nil&&n.assign(e,!0),(o.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==Y.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:s,it:o}=this;return(0,Y.or)(i(),a());function i(){if(n.length){if(!(r instanceof Y.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,Y._)`${(0,xl.checkDataTypes)(c,r,o.opts.strictNumbers,xl.DataType.Wrong)}`}return Y.nil}function a(){if(s.validateSchema){let c=e.scopeValue("validate$data",{ref:s.validateSchema});return(0,Y._)`!${c}(${r})`}return Y.nil}}subschema(e,r){let n=(0,jg.getSubschema)(this.it,e);(0,jg.extendSubschemaData)(n,this.it,e),(0,jg.extendSubschemaMode)(n,e);let s={...this.it,...n,items:void 0,props:void 0};return W2(s,r),s}mergeEvaluated(e,r){let{it:n,gen:s}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=dn.mergeEvaluated.props(s,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=dn.mergeEvaluated.items(s,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:s}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return s.if(r,()=>this.mergeEvaluated(e,Y.Name)),!0}};Ln.KeywordCxt=Sl;function lE(t,e,r,n){let s=new Sl(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,qa.funcKeywordCode)(s,r):"macro"in r?(0,qa.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,qa.funcKeywordCode)(s,r)}var lF=/^\/(?:[^~]|~0|~1)*$/,dF=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function dE(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,o;if(t==="")return ae.default.rootData;if(t[0]==="/"){if(!lF.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,o=ae.default.rootData}else{let u=dF.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(s=u[2],s==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(o=r[e-l],!s)return o}let i=o,a=s.split("/");for(let u of a)u&&(o=(0,Y._)`${o}${(0,Y.getProperty)((0,dn.unescapeJsonPointer)(u))}`,i=(0,Y._)`${i} && ${o}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Ln.getData=dE});var kl=S(qg=>{"use strict";f();Object.defineProperty(qg,"__esModule",{value:!0});var Lg=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};qg.default=Lg});var Da=S(Fg=>{"use strict";f();Object.defineProperty(Fg,"__esModule",{value:!0});var Zg=Ma(),Dg=class extends Error{constructor(e,r,n,s){super(s||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Zg.resolveUrl)(e,r,n),this.missingSchema=(0,Zg.normalizeId)((0,Zg.getFullPath)(e,this.missingRef))}};Fg.default=Dg});var Tl=S(sr=>{"use strict";f();Object.defineProperty(sr,"__esModule",{value:!0});sr.resolveSchema=sr.getCompilingSchema=sr.resolveRef=sr.compileSchema=sr.SchemaEnv=void 0;var xr=me(),fF=kl(),qs=ln(),Sr=Ma(),fE=Se(),pF=Za(),ni=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Sr.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};sr.SchemaEnv=ni;function Vg(t){let e=pE.call(this,t);if(e)return e;let r=(0,Sr.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new xr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),a;t.$async&&(a=i.scopeValue("Error",{ref:fF.default,code:(0,xr._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:qs.default.data,parentData:qs.default.parentData,parentDataProperty:qs.default.parentDataProperty,dataNames:[qs.default.data],dataPathArr:[xr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,xr.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:xr.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,xr._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,pF.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(qs.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let g=new Function(`${qs.default.self}`,`${qs.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:g}),g.errors=null,g.schema=t.schema,g.schemaEnv=t,t.$async&&(g.$async=!0),this.opts.code.source===!0&&(g.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:m}=u;g.evaluated={props:h instanceof xr.Name?void 0:h,items:m instanceof xr.Name?void 0:m,dynamicProps:h instanceof xr.Name,dynamicItems:m instanceof xr.Name},g.source&&(g.source.evaluated=(0,xr.stringify)(g.evaluated))}return t.validate=g,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}sr.compileSchema=Vg;function hF(t,e,r){var n;r=(0,Sr.resolveUrl)(this.opts.uriResolver,e,r);let s=t.refs[r];if(s)return s;let o=yF.call(this,t,r);if(o===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(o=new ni({schema:i,schemaId:a,root:t,baseId:e}))}if(o!==void 0)return t.refs[r]=mF.call(this,o)}sr.resolveRef=hF;function mF(t){return(0,Sr.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Vg.call(this,t)}function pE(t){for(let e of this._compilations)if(gF(e,t))return e}sr.getCompilingSchema=pE;function gF(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function yF(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||El.call(this,t,e)}function El(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Sr._getFullPath)(this.opts.uriResolver,r),s=(0,Sr.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===s)return Ug.call(this,r,t);let o=(0,Sr.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=El.call(this,t,i);return typeof a?.schema!="object"?void 0:Ug.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Vg.call(this,i),o===(0,Sr.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,Sr.resolveUrl)(this.opts.uriResolver,s,u)),new ni({schema:a,schemaId:c,root:t,baseId:s})}return Ug.call(this,r,i)}}sr.resolveSchema=El;var _F=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ug(t,{baseId:e,schema:r,root:n}){var s;if(((s=t.fragment)===null||s===void 0?void 0:s[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,fE.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!_F.has(a)&&u&&(e=(0,Sr.resolveUrl)(this.opts.uriResolver,e,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,fE.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Sr.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=El.call(this,n,a)}let{schemaId:i}=this.opts;if(o=o||new ni({schema:r,schemaId:i,root:n,baseId:e}),o.schema!==o.root.schema)return o}});var hE=S((Dce,vF)=>{vF.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 Hg=S((Fce,_E)=>{"use strict";f();var bF=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),gE=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Bg(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var wF=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function mE(t){return t.length=0,!0}function xF(t,e,r){if(t.length){let n=Bg(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function SF(t){let e=0,r={error:!1,address:"",zone:""},n=[],s=[],o=!1,i=!1,a=xF;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(i=!0),!a(s,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(o=!0),n.push(":");continue}else if(u==="%"){if(!a(s,n,r))break;a=mE}else{s.push(u);continue}}return s.length&&(a===mE?r.zone=s.join(""):i?n.push(s.join("")):n.push(Bg(s))),r.address=n.join(""),r}function yE(t){if(kF(t,":")<2)return{host:t,isIPV6:!1};let e=SF(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function kF(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function EF(t){let e=t,r=[],n=-1,s=0;for(;s=e.length;){if(s===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(s===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(s===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function TF(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function $F(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!gE(r)){let n=yE(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}_E.exports={nonSimpleDomain:wF,recomposeAuthority:$F,normalizeComponentEncoding:TF,removeDotSegments:EF,isIPv4:gE,isUUID:bF,normalizeIPv6:yE,stringArrayToHexStripped:Bg}});var SE=S((Vce,xE)=>{"use strict";f();var{isUUID:IF}=Hg(),OF=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,PF=["http","https","ws","wss","urn","urn:uuid"];function CF(t){return PF.indexOf(t)!==-1}function Kg(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function vE(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function bE(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function NF(t){return t.secure=Kg(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function AF(t){if((t.port===(Kg(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function RF(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(OF);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let s=`${n}:${e.nid||t.nid}`,o=Gg(s);t.path=void 0,o&&(t=o.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function jF(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),s=`${r}:${e.nid||n}`,o=Gg(s);o&&(t=o.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function zF(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!IF(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function MF(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var wE={scheme:"http",domainHost:!0,parse:vE,serialize:bE},LF={scheme:"https",domainHost:wE.domainHost,parse:vE,serialize:bE},$l={scheme:"ws",domainHost:!0,parse:NF,serialize:AF},qF={scheme:"wss",domainHost:$l.domainHost,parse:$l.parse,serialize:$l.serialize},ZF={scheme:"urn",parse:RF,serialize:jF,skipNormalize:!0},DF={scheme:"urn:uuid",parse:zF,serialize:MF,skipNormalize:!0},Il={http:wE,https:LF,ws:$l,wss:qF,urn:ZF,"urn:uuid":DF};Object.setPrototypeOf(Il,null);function Gg(t){return t&&(Il[t]||Il[t.toLowerCase()])||void 0}xE.exports={wsIsSecure:Kg,SCHEMES:Il,isValidSchemeName:CF,getSchemeHandler:Gg}});var TE=S((Hce,Pl)=>{"use strict";f();var{normalizeIPv6:FF,removeDotSegments:Fa,recomposeAuthority:UF,normalizeComponentEncoding:Ol,isIPv4:VF,nonSimpleDomain:BF}=Hg(),{SCHEMES:HF,getSchemeHandler:kE}=SE();function KF(t,e){return typeof t=="string"?t=Zr(fn(t,e),e):typeof t=="object"&&(t=fn(Zr(t,e),e)),t}function GF(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=EE(fn(t,n),fn(e,n),n,!0);return n.skipEscape=!0,Zr(s,n)}function EE(t,e,r,n){let s={};return n||(t=fn(Zr(t,r),r),e=fn(Zr(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(s.scheme=e.scheme,s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Fa(e.path||""),s.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(s.userinfo=e.userinfo,s.host=e.host,s.port=e.port,s.path=Fa(e.path||""),s.query=e.query):(e.path?(e.path[0]==="/"?s.path=Fa(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?s.path="/"+e.path:t.path?s.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:s.path=e.path,s.path=Fa(s.path)),s.query=e.query):(s.path=t.path,e.query!==void 0?s.query=e.query:s.query=t.query),s.userinfo=t.userinfo,s.host=t.host,s.port=t.port),s.scheme=t.scheme),s.fragment=e.fragment,s}function JF(t,e,r){return typeof t=="string"?(t=unescape(t),t=Zr(Ol(fn(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Zr(Ol(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Zr(Ol(fn(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Zr(Ol(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Zr(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),s=[],o=kE(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&s.push(r.scheme,":");let i=UF(r);if(i!==void 0&&(n.reference!=="suffix"&&s.push("//"),s.push(i),r.path&&r.path[0]!=="/"&&s.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(a=Fa(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),s.push(a)}return r.query!==void 0&&s.push("?",r.query),r.fragment!==void 0&&s.push("#",r.fragment),s.join("")}var WF=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function fn(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let o=t.match(WF);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host)if(VF(n.host)===!1){let c=FF(n.host);n.host=c.host.toLowerCase(),s=c.isIPV6}else s=!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 i=kE(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&s===!1&&BF(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var Jg={SCHEMES:HF,normalize:KF,resolve:GF,resolveComponent:EE,equal:JF,serialize:Zr,parse:fn};Pl.exports=Jg;Pl.exports.default=Jg;Pl.exports.fastUri=Jg});var IE=S(Wg=>{"use strict";f();Object.defineProperty(Wg,"__esModule",{value:!0});var $E=TE();$E.code='require("ajv/dist/runtime/uri").default';Wg.default=$E});var zE=S(gt=>{"use strict";f();Object.defineProperty(gt,"__esModule",{value:!0});gt.CodeGen=gt.Name=gt.nil=gt.stringify=gt.str=gt._=gt.KeywordCxt=void 0;var YF=Za();Object.defineProperty(gt,"KeywordCxt",{enumerable:!0,get:function(){return YF.KeywordCxt}});var si=me();Object.defineProperty(gt,"_",{enumerable:!0,get:function(){return si._}});Object.defineProperty(gt,"str",{enumerable:!0,get:function(){return si.str}});Object.defineProperty(gt,"stringify",{enumerable:!0,get:function(){return si.stringify}});Object.defineProperty(gt,"nil",{enumerable:!0,get:function(){return si.nil}});Object.defineProperty(gt,"Name",{enumerable:!0,get:function(){return si.Name}});Object.defineProperty(gt,"CodeGen",{enumerable:!0,get:function(){return si.CodeGen}});var XF=kl(),AE=Da(),QF=Eg(),Ua=Tl(),eU=me(),Va=Ma(),Cl=za(),Xg=Se(),OE=hE(),tU=IE(),RE=(t,e)=>new RegExp(t,e);RE.code="new RegExp";var rU=["removeAdditional","useDefaults","coerceTypes"],nU=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),sU={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."},oU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},PE=200;function iU(t){var e,r,n,s,o,i,a,c,u,l,d,p,g,h,m,_,b,w,x,T,O,L,U,$,A;let F=t.strict,C=(e=t.code)===null||e===void 0?void 0:e.optimize,z=C===!0||C===void 0?1:C||0,V=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:RE,te=(s=t.uriResolver)!==null&&s!==void 0?s:tU.default;return{strictSchema:(i=(o=t.strictSchema)!==null&&o!==void 0?o:F)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:F)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:F)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:F)!==null&&p!==void 0?p:"log",strictRequired:(h=(g=t.strictRequired)!==null&&g!==void 0?g:F)!==null&&h!==void 0?h:!1,code:t.code?{...t.code,optimize:z,regExp:V}:{optimize:z,regExp:V},loopRequired:(m=t.loopRequired)!==null&&m!==void 0?m:PE,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:PE,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(T=t.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(O=t.addUsedSchema)!==null&&O!==void 0?O:!0,validateSchema:(L=t.validateSchema)!==null&&L!==void 0?L:!0,validateFormats:(U=t.validateFormats)!==null&&U!==void 0?U:!0,unicodeRegExp:($=t.unicodeRegExp)!==null&&$!==void 0?$:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:te}}var Ba=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...iU(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new eU.ValueScope({scope:{},prefixes:nU,es5:r,lines:n}),this.logger=fU(e.logger);let s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,QF.getRules)(),CE.call(this,sU,e,"NOT SUPPORTED"),CE.call(this,oU,e,"DEPRECATED","warn"),this._metaOpts=lU.call(this),e.formats&&cU.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&uU.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),aU.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,s=OE;n==="id"&&(s={...OE},s.id=s.$id,delete s.$id),r&&e&&this.addMetaSchema(s,s[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let s=n(r);return"$async"in n||(this.errors=n.errors),s}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return s.call(this,e,r);async function s(l,d){await o.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function o(l){l&&!this.getSchema(l)&&await s.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof AE.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,s=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,s);return this}let o;if(typeof e=="object"){let{schemaId:i}=this.opts;if(o=e[i],o!==void 0&&typeof o!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Va.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,s,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let s=this.validate(n,e);if(!s&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return s}getSchema(e){let r;for(;typeof(r=NE.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,s=new Ua.SchemaEnv({schema:{},schemaId:n});if(r=Ua.resolveSchema.call(this,s,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=NE.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Va.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(hU.call(this,n,r),!r)return(0,Xg.eachItem)(n,o=>Yg.call(this,o)),this;gU.call(this,r);let s={...r,type:(0,Cl.getJSONTypes)(r.type),schemaType:(0,Cl.getJSONTypes)(r.schemaType)};return(0,Xg.eachItem)(n,s.type.length===0?o=>Yg.call(this,o,s):o=>s.type.forEach(i=>Yg.call(this,o,s,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let s=n.rules.findIndex(o=>o.keyword===e);s>=0&&n.rules.splice(s,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(s=>`${n}${s.instancePath} ${s.message}`).reduce((s,o)=>s+r+o)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let s of r){let o=s.split("/").slice(1),i=e;for(let a of o)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=jE(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let s=e[n];(!r||r.test(n))&&(typeof s=="string"?delete e[n]:s&&!s.meta&&(this._cache.delete(s.schema),delete e[n]))}}_addSchema(e,r,n,s=this.opts.validateSchema,o=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Va.normalizeId)(i||n);let u=Va.getSchemaRefs.call(this,e,n);return c=new Ua.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),s&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Ua.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Ua.compileSchema.call(this,e)}finally{this.opts=r}}};Ba.ValidationError=XF.default;Ba.MissingRefError=AE.default;gt.default=Ba;function CE(t,e,r,n="error"){for(let s in t){let o=s;o in e&&this.logger[n](`${r}: option ${s}. ${t[o]}`)}}function NE(t){return t=(0,Va.normalizeId)(t),this.schemas[t]||this.refs[t]}function aU(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function cU(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function uU(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function lU(){let t={...this.opts};for(let e of rU)delete t[e];return t}var dU={log(){},warn(){},error(){}};function fU(t){if(t===!1)return dU;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var pU=/^[a-z_$][a-z0-9_$:-]*$/i;function hU(t,e){let{RULES:r}=this;if((0,Xg.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!pU.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Yg(t,e,r){var n;let s=e?.post;if(r&&s)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,i=s?o.post:o.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},o.rules.push(i)),o.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Cl.getJSONTypes)(e.type),schemaType:(0,Cl.getJSONTypes)(e.schemaType)}};e.before?mU.call(this,i,a,e.before):i.rules.push(a),o.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function mU(t,e,r){let n=t.rules.findIndex(s=>s.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function gU(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=jE(e)),t.validateSchema=this.compile(e,!0))}var yU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function jE(t){return{anyOf:[t,yU]}}});var ME=S(Qg=>{"use strict";f();Object.defineProperty(Qg,"__esModule",{value:!0});var _U={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Qg.default=_U});var DE=S(Zs=>{"use strict";f();Object.defineProperty(Zs,"__esModule",{value:!0});Zs.callRef=Zs.getValidate=void 0;var vU=Da(),LE=nr(),Mt=me(),oi=ln(),qE=Tl(),Nl=Se(),bU={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:s,schemaEnv:o,validateName:i,opts:a,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&s===u.baseId)return d();let l=qE.resolveRef.call(c,u,s,r);if(l===void 0)throw new vU.default(n.opts.uriResolver,s,r);if(l instanceof qE.SchemaEnv)return p(l);return g(l);function d(){if(o===u)return Al(t,i,o,o.$async);let h=e.scopeValue("root",{ref:u});return Al(t,(0,Mt._)`${h}.validate`,u,u.$async)}function p(h){let m=ZE(t,h);Al(t,m,h,h.$async)}function g(h){let m=e.scopeValue("schema",a.code.source===!0?{ref:h,code:(0,Mt.stringify)(h)}:{ref:h}),_=e.name("valid"),b=t.subschema({schema:h,dataTypes:[],schemaPath:Mt.nil,topSchemaRef:m,errSchemaPath:r},_);t.mergeEvaluated(b),t.ok(_)}}};function ZE(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Mt._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Zs.getValidate=ZE;function Al(t,e,r,n){let{gen:s,it:o}=t,{allErrors:i,schemaEnv:a,opts:c}=o,u=c.passContext?oi.default.this:Mt.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=s.let("valid");s.try(()=>{s.code((0,Mt._)`await ${(0,LE.callValidateCode)(t,e,u)}`),g(e),i||s.assign(h,!0)},m=>{s.if((0,Mt._)`!(${m} instanceof ${o.ValidationError})`,()=>s.throw(m)),p(m),i||s.assign(h,!1)}),t.ok(h)}function d(){t.result((0,LE.callValidateCode)(t,e,u),()=>g(e),()=>p(e))}function p(h){let m=(0,Mt._)`${h}.errors`;s.assign(oi.default.vErrors,(0,Mt._)`${oi.default.vErrors} === null ? ${m} : ${oi.default.vErrors}.concat(${m})`),s.assign(oi.default.errors,(0,Mt._)`${oi.default.vErrors}.length`)}function g(h){var m;if(!o.opts.unevaluated)return;let _=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(o.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(o.props=Nl.mergeEvaluated.props(s,_.props,o.props));else{let b=s.var("props",(0,Mt._)`${h}.evaluated.props`);o.props=Nl.mergeEvaluated.props(s,b,o.props,Mt.Name)}if(o.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(o.items=Nl.mergeEvaluated.items(s,_.items,o.items));else{let b=s.var("items",(0,Mt._)`${h}.evaluated.items`);o.items=Nl.mergeEvaluated.items(s,b,o.items,Mt.Name)}}}Zs.callRef=Al;Zs.default=bU});var FE=S(ey=>{"use strict";f();Object.defineProperty(ey,"__esModule",{value:!0});var wU=ME(),xU=DE(),SU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",wU.default,xU.default];ey.default=SU});var UE=S(ty=>{"use strict";f();Object.defineProperty(ty,"__esModule",{value:!0});var Rl=me(),qn=Rl.operators,jl={maximum:{okStr:"<=",ok:qn.LTE,fail:qn.GT},minimum:{okStr:">=",ok:qn.GTE,fail:qn.LT},exclusiveMaximum:{okStr:"<",ok:qn.LT,fail:qn.GTE},exclusiveMinimum:{okStr:">",ok:qn.GT,fail:qn.LTE}},kU={message:({keyword:t,schemaCode:e})=>(0,Rl.str)`must be ${jl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Rl._)`{comparison: ${jl[t].okStr}, limit: ${e}}`},EU={keyword:Object.keys(jl),type:"number",schemaType:"number",$data:!0,error:kU,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Rl._)`${r} ${jl[e].fail} ${n} || isNaN(${r})`)}};ty.default=EU});var VE=S(ry=>{"use strict";f();Object.defineProperty(ry,"__esModule",{value:!0});var Ha=me(),TU={message:({schemaCode:t})=>(0,Ha.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Ha._)`{multipleOf: ${t}}`},$U={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:TU,code(t){let{gen:e,data:r,schemaCode:n,it:s}=t,o=s.opts.multipleOfPrecision,i=e.let("res"),a=o?(0,Ha._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Ha._)`${i} !== parseInt(${i})`;t.fail$data((0,Ha._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};ry.default=$U});var HE=S(ny=>{"use strict";f();Object.defineProperty(ny,"__esModule",{value:!0});function BE(t){let e=t.length,r=0,n=0,s;for(;n<e;)r++,s=t.charCodeAt(n++),s>=55296&&s<=56319&&n<e&&(s=t.charCodeAt(n),(s&64512)===56320&&n++);return r}ny.default=BE;BE.code='require("ajv/dist/runtime/ucs2length").default'});var KE=S(sy=>{"use strict";f();Object.defineProperty(sy,"__esModule",{value:!0});var Ds=me(),IU=Se(),OU=HE(),PU={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Ds.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Ds._)`{limit: ${t}}`},CU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:PU,code(t){let{keyword:e,data:r,schemaCode:n,it:s}=t,o=e==="maxLength"?Ds.operators.GT:Ds.operators.LT,i=s.opts.unicode===!1?(0,Ds._)`${r}.length`:(0,Ds._)`${(0,IU.useFunc)(t.gen,OU.default)}(${r})`;t.fail$data((0,Ds._)`${i} ${o} ${n}`)}};sy.default=CU});var GE=S(oy=>{"use strict";f();Object.defineProperty(oy,"__esModule",{value:!0});var NU=nr(),AU=Se(),ii=me(),RU={message:({schemaCode:t})=>(0,ii.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ii._)`{pattern: ${t}}`},jU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:RU,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,ii._)`new RegExp`:(0,AU.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,ii._)`${u}(${o}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,ii._)`!${l}`)}else{let c=(0,NU.usePattern)(t,s);t.fail$data((0,ii._)`!${c}.test(${r})`)}}};oy.default=jU});var JE=S(iy=>{"use strict";f();Object.defineProperty(iy,"__esModule",{value:!0});var Ka=me(),zU={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Ka.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Ka._)`{limit: ${t}}`},MU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:zU,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?Ka.operators.GT:Ka.operators.LT;t.fail$data((0,Ka._)`Object.keys(${r}).length ${s} ${n}`)}};iy.default=MU});var WE=S(ay=>{"use strict";f();Object.defineProperty(ay,"__esModule",{value:!0});var Ga=nr(),Ja=me(),LU=Se(),qU={message:({params:{missingProperty:t}})=>(0,Ja.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ja._)`{missingProperty: ${t}}`},ZU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:qU,code(t){let{gen:e,schema:r,schemaCode:n,data:s,$data:o,it:i}=t,{opts:a}=i;if(!o&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let g=t.parentSchema.properties,{definedProperties:h}=t.it;for(let m of r)if(g?.[m]===void 0&&!h.has(m)){let _=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${m}" is not defined at "${_}" (strictRequired)`;(0,LU.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||o)t.block$data(Ja.nil,d);else for(let g of r)(0,Ga.checkReportMissingProp)(t,g)}function l(){let g=e.let("missing");if(c||o){let h=e.let("valid",!0);t.block$data(h,()=>p(g,h)),t.ok(h)}else e.if((0,Ga.checkMissingProp)(t,r,g)),(0,Ga.reportMissingProp)(t,g),e.else()}function d(){e.forOf("prop",n,g=>{t.setParams({missingProperty:g}),e.if((0,Ga.noPropertyInData)(e,s,g,a.ownProperties),()=>t.error())})}function p(g,h){t.setParams({missingProperty:g}),e.forOf(g,n,()=>{e.assign(h,(0,Ga.propertyInData)(e,s,g,a.ownProperties)),e.if((0,Ja.not)(h),()=>{t.error(),e.break()})},Ja.nil)}}};ay.default=ZU});var YE=S(cy=>{"use strict";f();Object.defineProperty(cy,"__esModule",{value:!0});var Wa=me(),DU={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Wa.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Wa._)`{limit: ${t}}`},FU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:DU,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?Wa.operators.GT:Wa.operators.LT;t.fail$data((0,Wa._)`${r}.length ${s} ${n}`)}};cy.default=FU});var zl=S(uy=>{"use strict";f();Object.defineProperty(uy,"__esModule",{value:!0});var XE=Ag();XE.code='require("ajv/dist/runtime/equal").default';uy.default=XE});var QE=S(dy=>{"use strict";f();Object.defineProperty(dy,"__esModule",{value:!0});var ly=za(),yt=me(),UU=Se(),VU=zl(),BU={message:({params:{i:t,j:e}})=>(0,yt.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,yt._)`{i: ${t}, j: ${e}}`},HU={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:BU,code(t){let{gen:e,data:r,$data:n,schema:s,parentSchema:o,schemaCode:i,it:a}=t;if(!n&&!s)return;let c=e.let("valid"),u=o.items?(0,ly.getSchemaTypes)(o.items):[];t.block$data(c,l,(0,yt._)`${i} === false`),t.ok(c);function l(){let h=e.let("i",(0,yt._)`${r}.length`),m=e.let("j");t.setParams({i:h,j:m}),e.assign(c,!0),e.if((0,yt._)`${h} > 1`,()=>(d()?p:g)(h,m))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,m){let _=e.name("item"),b=(0,ly.checkDataTypes)(u,_,a.opts.strictNumbers,ly.DataType.Wrong),w=e.const("indices",(0,yt._)`{}`);e.for((0,yt._)`;${h}--;`,()=>{e.let(_,(0,yt._)`${r}[${h}]`),e.if(b,(0,yt._)`continue`),u.length>1&&e.if((0,yt._)`typeof ${_} == "string"`,(0,yt._)`${_} += "_"`),e.if((0,yt._)`typeof ${w}[${_}] == "number"`,()=>{e.assign(m,(0,yt._)`${w}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,yt._)`${w}[${_}] = ${h}`)})}function g(h,m){let _=(0,UU.useFunc)(e,VU.default),b=e.name("outer");e.label(b).for((0,yt._)`;${h}--;`,()=>e.for((0,yt._)`${m} = ${h}; ${m}--;`,()=>e.if((0,yt._)`${_}(${r}[${h}], ${r}[${m}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};dy.default=HU});var eT=S(py=>{"use strict";f();Object.defineProperty(py,"__esModule",{value:!0});var fy=me(),KU=Se(),GU=zl(),JU={message:"must be equal to constant",params:({schemaCode:t})=>(0,fy._)`{allowedValue: ${t}}`},WU={keyword:"const",$data:!0,error:JU,code(t){let{gen:e,data:r,$data:n,schemaCode:s,schema:o}=t;n||o&&typeof o=="object"?t.fail$data((0,fy._)`!${(0,KU.useFunc)(e,GU.default)}(${r}, ${s})`):t.fail((0,fy._)`${o} !== ${r}`)}};py.default=WU});var tT=S(hy=>{"use strict";f();Object.defineProperty(hy,"__esModule",{value:!0});var Ya=me(),YU=Se(),XU=zl(),QU={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Ya._)`{allowedValues: ${t}}`},e4={keyword:"enum",schemaType:"array",$data:!0,error:QU,code(t){let{gen:e,data:r,$data:n,schema:s,schemaCode:o,it:i}=t;if(!n&&s.length===0)throw new Error("enum must have non-empty array");let a=s.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,YU.useFunc)(e,XU.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(s))throw new Error("ajv implementation error");let g=e.const("vSchema",o);l=(0,Ya.or)(...s.map((h,m)=>p(g,m)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",o,g=>e.if((0,Ya._)`${u()}(${r}, ${g})`,()=>e.assign(l,!0).break()))}function p(g,h){let m=s[h];return typeof m=="object"&&m!==null?(0,Ya._)`${u()}(${r}, ${g}[${h}])`:(0,Ya._)`${r} === ${m}`}}};hy.default=e4});var rT=S(my=>{"use strict";f();Object.defineProperty(my,"__esModule",{value:!0});var t4=UE(),r4=VE(),n4=KE(),s4=GE(),o4=JE(),i4=WE(),a4=YE(),c4=QE(),u4=eT(),l4=tT(),d4=[t4.default,r4.default,n4.default,s4.default,o4.default,i4.default,a4.default,c4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u4.default,l4.default];my.default=d4});var yy=S(Xa=>{"use strict";f();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.validateAdditionalItems=void 0;var Fs=me(),gy=Se(),f4={message:({params:{len:t}})=>(0,Fs.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Fs._)`{limit: ${t}}`},p4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:f4,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,gy.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}nT(t,n)}};function nT(t,e){let{gen:r,schema:n,data:s,keyword:o,it:i}=t;i.items=!0;let a=r.const("len",(0,Fs._)`${s}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Fs._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,gy.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Fs._)`${a} <= ${e.length}`);r.if((0,Fs.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:o,dataProp:l,dataPropType:gy.Type.Num},u),i.allErrors||r.if((0,Fs.not)(u),()=>r.break())})}}Xa.validateAdditionalItems=nT;Xa.default=p4});var _y=S(Qa=>{"use strict";f();Object.defineProperty(Qa,"__esModule",{value:!0});Qa.validateTuple=void 0;var sT=me(),Ml=Se(),h4=nr(),m4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return oT(t,"additionalItems",e);r.items=!0,!(0,Ml.alwaysValidSchema)(r,e)&&t.ok((0,h4.validateArray)(t))}};function oT(t,e,r=t.schema){let{gen:n,parentSchema:s,data:o,keyword:i,it:a}=t;l(s),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ml.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,sT._)`${o}.length`);r.forEach((d,p)=>{(0,Ml.alwaysValidSchema)(a,d)||(n.if((0,sT._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:g}=a,h=r.length,m=h===d.minItems&&(h===d.maxItems||d[e]===!1);if(p.strictTuples&&!m){let _=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${g}"`;(0,Ml.checkStrictMode)(a,_,p.strictTuples)}}}Qa.validateTuple=oT;Qa.default=m4});var iT=S(vy=>{"use strict";f();Object.defineProperty(vy,"__esModule",{value:!0});var g4=_y(),y4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,g4.validateTuple)(t,"items")};vy.default=y4});var cT=S(by=>{"use strict";f();Object.defineProperty(by,"__esModule",{value:!0});var aT=me(),_4=Se(),v4=nr(),b4=yy(),w4={message:({params:{len:t}})=>(0,aT.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,aT._)`{limit: ${t}}`},x4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:w4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,_4.alwaysValidSchema)(n,e)&&(s?(0,b4.validateAdditionalItems)(t,s):t.ok((0,v4.validateArray)(t)))}};by.default=x4});var uT=S(wy=>{"use strict";f();Object.defineProperty(wy,"__esModule",{value:!0});var or=me(),Ll=Se(),S4={message:({params:{min:t,max:e}})=>e===void 0?(0,or.str)`must contain at least ${t} valid item(s)`:(0,or.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,or._)`{minContains: ${t}}`:(0,or._)`{minContains: ${t}, maxContains: ${e}}`},k4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:S4,code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t,i,a,{minContains:c,maxContains:u}=n;o.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,or._)`${s}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Ll.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Ll.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ll.alwaysValidSchema)(o,r)){let m=(0,or._)`${l} >= ${i}`;a!==void 0&&(m=(0,or._)`${m} && ${l} <= ${a}`),t.pass(m);return}o.items=!0;let d=e.name("valid");a===void 0&&i===1?g(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,or._)`${s}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let m=e.name("_valid"),_=e.let("count",0);g(m,()=>e.if(m,()=>h(_)))}function g(m,_){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:Ll.Type.Num,compositeRule:!0},m),_()})}function h(m){e.code((0,or._)`${m}++`),a===void 0?e.if((0,or._)`${m} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,or._)`${m} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,or._)`${m} >= ${i}`,()=>e.assign(d,!0)))}}};wy.default=k4});var fT=S(Dr=>{"use strict";f();Object.defineProperty(Dr,"__esModule",{value:!0});Dr.validateSchemaDeps=Dr.validatePropertyDeps=Dr.error=void 0;var xy=me(),E4=Se(),ec=nr();Dr.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,xy.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,xy._)`{property: ${t},
|
|
7
7
|
missingProperty: ${n},
|
|
8
8
|
depsCount: ${e},
|
|
9
|
-
deps: ${r}}`};var w4={keyword:"dependencies",type:"object",schemaType:"object",error:Dr.error,code(t){let[e,r]=x4(t);uT(t,e),lT(t,r)}};function x4({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let s=Array.isArray(t[n])?e:r;s[n]=t[n]}return[e,r]}function uT(t,e=t.schema){let{gen:r,data:n,it:s}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,ec.propertyInData)(r,n,i,s.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors?r.if(c,()=>{for(let u of a)(0,ec.checkReportMissingProp)(t,u)}):(r.if((0,xy._)`${c} && (${(0,ec.checkMissingProp)(t,a,o)})`),(0,ec.reportMissingProp)(t,o),r.else())}}Dr.validatePropertyDeps=uT;function lT(t,e=t.schema){let{gen:r,data:n,keyword:s,it:o}=t,i=r.name("valid");for(let a in e)(0,b4.alwaysValidSchema)(o,e[a])||(r.if((0,ec.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=t.subschema({keyword:s,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Dr.validateSchemaDeps=lT;Dr.default=w4});var pT=S(Sy=>{"use strict";f();Object.defineProperty(Sy,"__esModule",{value:!0});var fT=me(),S4=Se(),k4={message:"property name must be valid",params:({params:t})=>(0,fT._)`{propertyName: ${t.propertyName}}`},E4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:k4,code(t){let{gen:e,schema:r,data:n,it:s}=t;if((0,S4.alwaysValidSchema)(s,r))return;let o=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),e.if((0,fT.not)(o),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(o)}};Sy.default=E4});var Ey=S(ky=>{"use strict";f();Object.defineProperty(ky,"__esModule",{value:!0});var ql=nr(),kr=me(),T4=ln(),Zl=Se(),$4={message:"must NOT have additional properties",params:({params:t})=>(0,kr._)`{additionalProperty: ${t.additionalProperty}}`},I4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:$4,code(t){let{gen:e,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Zl.alwaysValidSchema)(i,r))return;let u=(0,ql.allSchemaProperties)(n.properties),l=(0,ql.allSchemaProperties)(n.patternProperties);d(),t.ok((0,kr._)`${o} === ${T4.default.errors}`);function d(){e.forIn("key",s,_=>{!u.length&&!l.length?h(_):e.if(p(_),()=>h(_))})}function p(_){let b;if(u.length>8){let w=(0,Zl.schemaRefOrVal)(i,n.properties,"properties");b=(0,ql.isOwnProperty)(e,w,_)}else u.length?b=(0,kr.or)(...u.map(w=>(0,kr._)`${_} === ${w}`)):b=kr.nil;return l.length&&(b=(0,kr.or)(b,...l.map(w=>(0,kr._)`${(0,ql.usePattern)(t,w)}.test(${_})`))),(0,kr.not)(b)}function g(_){e.code((0,kr._)`delete ${s}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){g(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Zl.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(m(_,b,!1),e.if((0,kr.not)(b),()=>{t.reset(),g(_)})):(m(_,b),a||e.if((0,kr.not)(b),()=>e.break()))}}function m(_,b,w){let x={keyword:"additionalProperties",dataProp:_,dataPropType:Zl.Type.Str};w===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,b)}}};ky.default=I4});var gT=S($y=>{"use strict";f();Object.defineProperty($y,"__esModule",{value:!0});var P4=Za(),hT=nr(),Ty=Se(),mT=Ey(),O4={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&mT.default.code(new P4.KeywordCxt(o,mT.default,"additionalProperties"));let i=(0,hT.allSchemaProperties)(r);for(let d of i)o.definedProperties.add(d);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Ty.mergeEvaluated.props(e,(0,Ty.toHash)(i),o.props));let a=i.filter(d=>!(0,Ty.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,hT.propertyInData)(e,s,d,o.opts.ownProperties)),l(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};$y.default=O4});var bT=S(Iy=>{"use strict";f();Object.defineProperty(Iy,"__esModule",{value:!0});var yT=nr(),Dl=me(),_T=Se(),vT=Se(),C4={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:s,it:o}=t,{opts:i}=o,a=(0,yT.allSchemaProperties)(r),c=a.filter(m=>(0,_T.alwaysValidSchema)(o,r[m]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&s.properties,l=e.name("valid");o.props!==!0&&!(o.props instanceof Dl.Name)&&(o.props=(0,vT.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let m of a)u&&g(m),o.allErrors?h(m):(e.var(l,!0),h(m),e.if(l))}function g(m){for(let _ in u)new RegExp(m).test(_)&&(0,_T.checkStrictMode)(o,`property ${_} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){e.forIn("key",n,_=>{e.if((0,Dl._)`${(0,yT.usePattern)(t,m)}.test(${_})`,()=>{let b=c.includes(m);b||t.subschema({keyword:"patternProperties",schemaProp:m,dataProp:_,dataPropType:vT.Type.Str},l),o.opts.unevaluated&&d!==!0?e.assign((0,Dl._)`${d}[${_}]`,!0):!b&&!o.allErrors&&e.if((0,Dl.not)(l),()=>e.break())})})}}};Iy.default=C4});var wT=S(Py=>{"use strict";f();Object.defineProperty(Py,"__esModule",{value:!0});var A4=Se(),N4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,A4.alwaysValidSchema)(n,r)){t.fail();return}let s=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Py.default=N4});var xT=S(Oy=>{"use strict";f();Object.defineProperty(Oy,"__esModule",{value:!0});var R4=nr(),j4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:R4.validateUnion,error:{message:"must match a schema in anyOf"}};Oy.default=j4});var ST=S(Cy=>{"use strict";f();Object.defineProperty(Cy,"__esModule",{value:!0});var Fl=me(),z4=Se(),M4={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Fl._)`{passingSchemas: ${t.passing}}`},L4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:M4,code(t){let{gen:e,schema:r,parentSchema:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){o.forEach((l,d)=>{let p;(0,z4.alwaysValidSchema)(s,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Fl._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Fl._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Fl.Name)})})}}};Cy.default=L4});var kT=S(Ay=>{"use strict";f();Object.defineProperty(Ay,"__esModule",{value:!0});var q4=Se(),Z4={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let s=e.name("valid");r.forEach((o,i)=>{if((0,q4.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:i},s);t.ok(s),t.mergeEvaluated(a)})}};Ay.default=Z4});var $T=S(Ny=>{"use strict";f();Object.defineProperty(Ny,"__esModule",{value:!0});var Ul=me(),TT=Se(),D4={message:({params:t})=>(0,Ul.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ul._)`{failingKeyword: ${t.ifClause}}`},F4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:D4,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,TT.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=ET(n,"then"),o=ET(n,"else");if(!s&&!o)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),s&&o){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else s?e.if(a,u("then")):e.if((0,Ul.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,Ul._)`${l}`):t.setParams({ifClause:l})}}}};function ET(t,e){let r=t.schema[e];return r!==void 0&&!(0,TT.alwaysValidSchema)(t,r)}Ny.default=F4});var IT=S(Ry=>{"use strict";f();Object.defineProperty(Ry,"__esModule",{value:!0});var U4=Se(),V4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,U4.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ry.default=V4});var PT=S(jy=>{"use strict";f();Object.defineProperty(jy,"__esModule",{value:!0});var B4=yy(),H4=oT(),K4=_y(),G4=aT(),J4=cT(),W4=dT(),Y4=pT(),X4=Ey(),Q4=gT(),e9=bT(),t9=wT(),r9=xT(),n9=ST(),s9=kT(),o9=$T(),i9=IT();function a9(t=!1){let e=[t9.default,r9.default,n9.default,s9.default,o9.default,i9.default,Y4.default,X4.default,W4.default,Q4.default,e9.default];return t?e.push(H4.default,G4.default):e.push(B4.default,K4.default),e.push(J4.default),e}jy.default=a9});var OT=S(zy=>{"use strict";f();Object.defineProperty(zy,"__esModule",{value:!0});var st=me(),c9={message:({schemaCode:t})=>(0,st.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,st._)`{format: ${t}}`},u9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:c9,code(t,e){let{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;s?p():g();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,st._)`${h}[${i}]`),_=r.let("fType"),b=r.let("format");r.if((0,st._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(_,(0,st._)`${m}.type || "string"`).assign(b,(0,st._)`${m}.validate`),()=>r.assign(_,(0,st._)`"string"`).assign(b,m)),t.fail$data((0,st.or)(w(),x()));function w(){return c.strictSchema===!1?st.nil:(0,st._)`${i} && !${b}`}function x(){let T=l.$async?(0,st._)`(${m}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,st._)`${b}(${n})`,P=(0,st._)`(typeof ${b} == "function" ? ${T} : ${b}.test(${n}))`;return(0,st._)`${b} && ${b} !== true && ${_} === ${e} && !${P}`}}function g(){let h=d.formats[o];if(!h){w();return}if(h===!0)return;let[m,_,b]=x(h);m===e&&t.pass(T());function w(){if(c.strictSchema===!1){d.logger.warn(P());return}throw new Error(P());function P(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function x(P){let L=P instanceof RegExp?(0,st.regexpCode)(P):c.code.formats?(0,st._)`${c.code.formats}${(0,st.getProperty)(o)}`:void 0,U=r.scopeValue("formats",{key:o,ref:P,code:L});return typeof P=="object"&&!(P instanceof RegExp)?[P.type||"string",P.validate,(0,st._)`${U}.validate`]:["string",P,U]}function T(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,st._)`await ${b}(${n})`}return typeof _=="function"?(0,st._)`${b}(${n})`:(0,st._)`${b}.test(${n})`}}}};zy.default=u9});var CT=S(My=>{"use strict";f();Object.defineProperty(My,"__esModule",{value:!0});var l9=OT(),d9=[l9.default];My.default=d9});var AT=S(ai=>{"use strict";f();Object.defineProperty(ai,"__esModule",{value:!0});ai.contentVocabulary=ai.metadataVocabulary=void 0;ai.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ai.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var RT=S(Ly=>{"use strict";f();Object.defineProperty(Ly,"__esModule",{value:!0});var f9=DE(),p9=tT(),h9=PT(),m9=CT(),NT=AT(),g9=[f9.default,p9.default,(0,h9.default)(),m9.default,NT.metadataVocabulary,NT.contentVocabulary];Ly.default=g9});var zT=S(Vl=>{"use strict";f();Object.defineProperty(Vl,"__esModule",{value:!0});Vl.DiscrError=void 0;var jT;(function(t){t.Tag="tag",t.Mapping="mapping"})(jT||(Vl.DiscrError=jT={}))});var LT=S(Zy=>{"use strict";f();Object.defineProperty(Zy,"__esModule",{value:!0});var ci=me(),qy=zT(),MT=Tl(),y9=Da(),_9=Se(),v9={message:({params:{discrError:t,tagName:e}})=>t===qy.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,ci._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},b9={keyword:"discriminator",type:"object",schemaType:"object",error:v9,code(t){let{gen:e,data:r,schema:n,parentSchema:s,it:o}=t,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,ci._)`${r}${(0,ci.getProperty)(a)}`);e.if((0,ci._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:qy.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let g=p();e.if(!1);for(let h in g)e.elseIf((0,ci._)`${u} === ${h}`),e.assign(c,d(g[h]));e.else(),t.error(!1,{discrError:qy.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(g){let h=e.name("valid"),m=t.subschema({keyword:"oneOf",schemaProp:g},h);return t.mergeEvaluated(m,ci.Name),h}function p(){var g;let h={},m=b(s),_=!0;for(let T=0;T<i.length;T++){let P=i[T];if(P?.$ref&&!(0,_9.schemaHasRulesButRef)(P,o.self.RULES)){let U=P.$ref;if(P=MT.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,U),P instanceof MT.SchemaEnv&&(P=P.schema),P===void 0)throw new y9.default(o.opts.uriResolver,o.baseId,U)}let L=(g=P?.properties)===null||g===void 0?void 0:g[a];if(typeof L!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(m||b(P)),w(L,T)}if(!_)throw new Error(`discriminator: "${a}" must be required`);return h;function b({required:T}){return Array.isArray(T)&&T.includes(a)}function w(T,P){if(T.const)x(T.const,P);else if(T.enum)for(let L of T.enum)x(L,P);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(T,P){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[T]=P}}}};Zy.default=b9});var qT=S((gle,w9)=>{w9.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 Fy=S((Be,Dy)=>{"use strict";f();Object.defineProperty(Be,"__esModule",{value:!0});Be.MissingRefError=Be.ValidationError=Be.CodeGen=Be.Name=Be.nil=Be.stringify=Be.str=Be._=Be.KeywordCxt=Be.Ajv=void 0;var x9=jE(),S9=RT(),k9=LT(),ZT=qT(),E9=["/properties"],Bl="http://json-schema.org/draft-07/schema",ui=class extends x9.default{_addVocabularies(){super._addVocabularies(),S9.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(k9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(ZT,E9):ZT;this.addMetaSchema(e,Bl,!1),this.refs["http://json-schema.org/schema"]=Bl}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Bl)?Bl:void 0)}};Be.Ajv=ui;Dy.exports=Be=ui;Dy.exports.Ajv=ui;Object.defineProperty(Be,"__esModule",{value:!0});Be.default=ui;var T9=Za();Object.defineProperty(Be,"KeywordCxt",{enumerable:!0,get:function(){return T9.KeywordCxt}});var li=me();Object.defineProperty(Be,"_",{enumerable:!0,get:function(){return li._}});Object.defineProperty(Be,"str",{enumerable:!0,get:function(){return li.str}});Object.defineProperty(Be,"stringify",{enumerable:!0,get:function(){return li.stringify}});Object.defineProperty(Be,"nil",{enumerable:!0,get:function(){return li.nil}});Object.defineProperty(Be,"Name",{enumerable:!0,get:function(){return li.Name}});Object.defineProperty(Be,"CodeGen",{enumerable:!0,get:function(){return li.CodeGen}});var $9=kl();Object.defineProperty(Be,"ValidationError",{enumerable:!0,get:function(){return $9.default}});var I9=Da();Object.defineProperty(Be,"MissingRefError",{enumerable:!0,get:function(){return I9.default}})});var GT=S(Ur=>{"use strict";f();Object.defineProperty(Ur,"__esModule",{value:!0});Ur.formatNames=Ur.fastFormats=Ur.fullFormats=void 0;function Fr(t,e){return{validate:t,compare:e}}Ur.fullFormats={date:Fr(VT,Hy),time:Fr(Vy(!0),Ky),"date-time":Fr(DT(!0),HT),"iso-time":Fr(Vy(),BT),"iso-date-time":Fr(DT(),KT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:R9,"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:D9,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:j9,int32:{type:"number",validate:L9},int64:{type:"number",validate:q9},float:{type:"number",validate:UT},double:{type:"number",validate:UT},password:!0,binary:!0};Ur.fastFormats={...Ur.fullFormats,date:Fr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Hy),time:Fr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ky),"date-time":Fr(/^\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,HT),"iso-time":Fr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,BT),"iso-date-time":Fr(/^\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,KT),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};Ur.formatNames=Object.keys(Ur.fullFormats);function P9(t){return t%4===0&&(t%100!==0||t%400===0)}var O9=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,C9=[0,31,28,31,30,31,30,31,31,30,31,30,31];function VT(t){let e=O9.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],s=+e[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&P9(r)?29:C9[n])}function Hy(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Uy=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Vy(t){return function(r){let n=Uy.exec(r);if(!n)return!1;let s=+n[1],o=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-l*c,p=s-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ky(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function BT(t,e){if(!(t&&e))return;let r=Uy.exec(t),n=Uy.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var By=/t|\s/i;function DT(t){let e=Vy(t);return function(n){let s=n.split(By);return s.length===2&&VT(s[0])&&e(s[1])}}function HT(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function KT(t,e){if(!(t&&e))return;let[r,n]=t.split(By),[s,o]=e.split(By),i=Hy(r,s);if(i!==void 0)return i||Ky(n,o)}var A9=/\/|:/,N9=/^(?:[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 R9(t){return A9.test(t)&&N9.test(t)}var FT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function j9(t){return FT.lastIndex=0,FT.test(t)}var z9=-(2**31),M9=2**31-1;function L9(t){return Number.isInteger(t)&&t<=M9&&t>=z9}function q9(t){return Number.isInteger(t)}function UT(){return!0}var Z9=/[^\\]\\Z/;function D9(t){if(Z9.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var JT=S(di=>{"use strict";f();Object.defineProperty(di,"__esModule",{value:!0});di.formatLimitDefinition=void 0;var F9=Fy(),Er=me(),Zn=Er.operators,Hl={formatMaximum:{okStr:"<=",ok:Zn.LTE,fail:Zn.GT},formatMinimum:{okStr:">=",ok:Zn.GTE,fail:Zn.LT},formatExclusiveMaximum:{okStr:"<",ok:Zn.LT,fail:Zn.GTE},formatExclusiveMinimum:{okStr:">",ok:Zn.GT,fail:Zn.LTE}},U9={message:({keyword:t,schemaCode:e})=>(0,Er.str)`should be ${Hl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Er._)`{comparison: ${Hl[t].okStr}, limit: ${e}}`};di.formatLimitDefinition={keyword:Object.keys(Hl),type:"string",schemaType:"string",$data:!0,error:U9,code(t){let{gen:e,data:r,schemaCode:n,keyword:s,it:o}=t,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new F9.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),g=e.const("fmt",(0,Er._)`${p}[${c.schemaCode}]`);t.fail$data((0,Er.or)((0,Er._)`typeof ${g} != "object"`,(0,Er._)`${g} instanceof RegExp`,(0,Er._)`typeof ${g}.compare != "function"`,d(g)))}function l(){let p=c.schema,g=a.formats[p];if(!g||g===!0)return;if(typeof g!="object"||g instanceof RegExp||typeof g.compare!="function")throw new Error(`"${s}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:g,code:i.code.formats?(0,Er._)`${i.code.formats}${(0,Er.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,Er._)`${p}.compare(${r}, ${n}) ${Hl[s].fail} 0`}},dependencies:["format"]};var V9=t=>(t.addKeyword(di.formatLimitDefinition),t);di.default=V9});var QT=S((tc,XT)=>{"use strict";f();Object.defineProperty(tc,"__esModule",{value:!0});var fi=GT(),B9=JT(),Gy=me(),WT=new Gy.Name("fullFormats"),H9=new Gy.Name("fastFormats"),Jy=(t,e={keywords:!0})=>{if(Array.isArray(e))return YT(t,e,fi.fullFormats,WT),t;let[r,n]=e.mode==="fast"?[fi.fastFormats,H9]:[fi.fullFormats,WT],s=e.formats||fi.formatNames;return YT(t,s,r,n),e.keywords&&(0,B9.default)(t),t};Jy.get=(t,e="full")=>{let n=(e==="fast"?fi.fastFormats:fi.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function YT(t,e,r,n){var s,o;(s=(o=t.opts.code).formats)!==null&&s!==void 0||(o.formats=(0,Gy._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}XT.exports=tc=Jy;Object.defineProperty(tc,"__esModule",{value:!0});tc.default=Jy});var nc=S(De=>{"use strict";f();Object.defineProperty(De,"__esModule",{value:!0});De.getParsedType=De.ZodParsedType=De.objectUtil=De.util=void 0;var Qy;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let o={};for(let i of s)o[i]=i;return o},t.getValidEnumValues=s=>{let o=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(let a of o)i[a]=s[a];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(let i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(Qy||(De.util=Qy={}));var d$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(d$||(De.objectUtil=d$={}));De.ZodParsedType=Qy.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Q9=t=>{switch(typeof t){case"undefined":return De.ZodParsedType.undefined;case"string":return De.ZodParsedType.string;case"number":return Number.isNaN(t)?De.ZodParsedType.nan:De.ZodParsedType.number;case"boolean":return De.ZodParsedType.boolean;case"function":return De.ZodParsedType.function;case"bigint":return De.ZodParsedType.bigint;case"symbol":return De.ZodParsedType.symbol;case"object":return Array.isArray(t)?De.ZodParsedType.array:t===null?De.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?De.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?De.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?De.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?De.ZodParsedType.date:De.ZodParsedType.object;default:return De.ZodParsedType.unknown}};De.getParsedType=Q9});var Yl=S(Fn=>{"use strict";f();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ZodError=Fn.quotelessJson=Fn.ZodIssueCode=void 0;var f$=nc();Fn.ZodIssueCode=f$.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var eV=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Fn.quotelessJson=eV;var sc=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,f$.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let o=s.path[0];r[o]=r[o]||[],r[o].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Fn.ZodError=sc;sc.create=t=>new sc(t)});var t_=S(e_=>{"use strict";f();Object.defineProperty(e_,"__esModule",{value:!0});var kt=Yl(),Us=nc(),tV=(t,e)=>{let r;switch(t.code){case kt.ZodIssueCode.invalid_type:t.received===Us.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case kt.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Us.util.jsonStringifyReplacer)}`;break;case kt.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Us.util.joinValues(t.keys,", ")}`;break;case kt.ZodIssueCode.invalid_union:r="Invalid input";break;case kt.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Us.util.joinValues(t.options)}`;break;case kt.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Us.util.joinValues(t.options)}, received '${t.received}'`;break;case kt.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case kt.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case kt.ZodIssueCode.invalid_date:r="Invalid date";break;case kt.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Us.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case kt.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case kt.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case kt.ZodIssueCode.custom:r="Invalid input";break;case kt.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case kt.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case kt.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Us.util.assertNever(t)}return{message:r}};e_.default=tV});var Xl=S(Un=>{"use strict";f();var rV=Un&&Un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Un,"__esModule",{value:!0});Un.defaultErrorMap=void 0;Un.setErrorMap=nV;Un.getErrorMap=sV;var p$=rV(t_());Un.defaultErrorMap=p$.default;var h$=p$.default;function nV(t){h$=t}function sV(){return h$}});var n_=S(Re=>{"use strict";f();var oV=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.isAsync=Re.isValid=Re.isDirty=Re.isAborted=Re.OK=Re.DIRTY=Re.INVALID=Re.ParseStatus=Re.EMPTY_PATH=Re.makeIssue=void 0;Re.addIssueToContext=cV;var iV=Xl(),m$=oV(t_()),aV=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...s,path:o,message:a}};Re.makeIssue=aV;Re.EMPTY_PATH=[];function cV(t,e){let r=(0,iV.getErrorMap)(),n=(0,Re.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===m$.default?void 0:m$.default].filter(s=>!!s)});t.common.issues.push(n)}var r_=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return Re.INVALID;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let o=await s.key,i=await s.value;n.push({key:o,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Re.INVALID;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:e.value,value:n}}};Re.ParseStatus=r_;Re.INVALID=Object.freeze({status:"aborted"});var uV=t=>({status:"dirty",value:t});Re.DIRTY=uV;var lV=t=>({status:"valid",value:t});Re.OK=lV;var dV=t=>t.status==="aborted";Re.isAborted=dV;var fV=t=>t.status==="dirty";Re.isDirty=fV;var pV=t=>t.status==="valid";Re.isValid=pV;var hV=t=>typeof Promise<"u"&&t instanceof Promise;Re.isAsync=hV});var y$=S(g$=>{"use strict";f();Object.defineProperty(g$,"__esModule",{value:!0})});var v$=S(Ql=>{"use strict";f();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.errorUtil=void 0;var _$;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(_$||(Ql.errorUtil=_$={}))});var C$=S(k=>{"use strict";f();Object.defineProperty(k,"__esModule",{value:!0});k.discriminatedUnion=k.date=k.boolean=k.bigint=k.array=k.any=k.coerce=k.ZodFirstPartyTypeKind=k.late=k.ZodSchema=k.Schema=k.ZodReadonly=k.ZodPipeline=k.ZodBranded=k.BRAND=k.ZodNaN=k.ZodCatch=k.ZodDefault=k.ZodNullable=k.ZodOptional=k.ZodTransformer=k.ZodEffects=k.ZodPromise=k.ZodNativeEnum=k.ZodEnum=k.ZodLiteral=k.ZodLazy=k.ZodFunction=k.ZodSet=k.ZodMap=k.ZodRecord=k.ZodTuple=k.ZodIntersection=k.ZodDiscriminatedUnion=k.ZodUnion=k.ZodObject=k.ZodArray=k.ZodVoid=k.ZodNever=k.ZodUnknown=k.ZodAny=k.ZodNull=k.ZodUndefined=k.ZodSymbol=k.ZodDate=k.ZodBoolean=k.ZodBigInt=k.ZodNumber=k.ZodString=k.ZodType=void 0;k.NEVER=k.void=k.unknown=k.union=k.undefined=k.tuple=k.transformer=k.symbol=k.string=k.strictObject=k.set=k.record=k.promise=k.preprocess=k.pipeline=k.ostring=k.optional=k.onumber=k.oboolean=k.object=k.number=k.nullable=k.null=k.never=k.nativeEnum=k.nan=k.map=k.literal=k.lazy=k.intersection=k.instanceof=k.function=k.enum=k.effect=void 0;k.datetimeRegex=k$;k.custom=T$;var q=Yl(),ed=Xl(),X=v$(),E=n_(),D=nc(),ar=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},b$=(t,e)=>{if((0,E.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new q.ZodError(t.common.issues);return this._error=r,this._error}}};function ue(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}var le=class{get description(){return this._def.description}_getType(e){return(0,D.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,D.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,D.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,E.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,D.getParsedType)(e)},s=this._parseSync({data:e,path:n.path,parent:n});return b$(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,D.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,D.getParsedType)(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await((0,E.isAsync)(s)?s:Promise.resolve(s));return b$(n,o)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{let i=e(s),a=()=>o.addIssue({code:q.ZodIssueCode.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Gt({schema:this,typeName:ie.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ir.create(this,this._def)}nullable(){return Br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mn.create(this)}promise(){return Hn.create(this,this._def)}or(e){return Ws.create([this,e],this._def)}and(e){return Ys.create(this,e,this._def)}transform(e){return new Gt({...ue(this._def),schema:this,typeName:ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ro({...ue(this._def),innerType:this,defaultValue:r,typeName:ie.ZodDefault})}brand(){return new oc({typeName:ie.ZodBranded,type:this,...ue(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new no({...ue(this._def),innerType:this,catchValue:r,typeName:ie.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ic.create(this,e)}readonly(){return so.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};k.ZodType=le;k.Schema=le;k.ZodSchema=le;var mV=/^c[^\s-]{8,}$/i,gV=/^[0-9a-z]+$/,yV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,_V=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,vV=/^[a-z0-9_-]{21}$/i,bV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wV=/^[-+]?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)?)??$/,xV=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,SV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",s_,kV=/^(?:(?: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])$/,EV=/^(?:(?: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])$/,TV=/^(([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]))$/,$V=/^(([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])$/,IV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,PV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,x$="((\\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])))",OV=new RegExp(`^${x$}$`);function S$(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function CV(t){return new RegExp(`^${S$(t)}$`)}function k$(t){let e=`${x$}T${S$(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function AV(t,e){return!!((e==="v4"||!e)&&kV.test(t)||(e==="v6"||!e)&&TV.test(t))}function NV(t,e){if(!bV.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function RV(t,e){return!!((e==="v4"||!e)&&EV.test(t)||(e==="v6"||!e)&&$V.test(t))}var Vn=class t extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.ZodParsedType.string){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.string,received:o.parsedType}),E.INVALID}let n=new E.ParseStatus,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")xV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"email",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")s_||(s_=new RegExp(SV,"u")),s_.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"emoji",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")_V.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"uuid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")vV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"nanoid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")mV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")gV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid2",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")yV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ulid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"url",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"regex",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?k$(o).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?OV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?CV(o).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?wV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"duration",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?AV(e.data,o.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ip",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?NV(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"jwt",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?RV(e.data,o.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cidr",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?IV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?PV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64url",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):D.util.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:q.ZodIssueCode.invalid_string,...X.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...X.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...X.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...X.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...X.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...X.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...X.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...X.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...X.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...X.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...X.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...X.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...X.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...X.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,X.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};k.ZodString=Vn;Vn.create=t=>new Vn({checks:[],typeName:ie.ZodString,coerce:t?.coerce??!1,...ue(t)});function jV(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}var Vs=class t extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.ZodParsedType.number){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.number,received:o.parsedType}),E.INVALID}let n,s=new E.ParseStatus;for(let o of this._def.checks)o.kind==="int"?D.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?jV(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.not_finite,message:o.message}),s.dirty()):D.util.assertNever(o);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,X.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,X.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,X.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,X.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:X.errorUtil.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:X.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:X.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&D.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};k.ZodNumber=Vs;Vs.create=t=>new Vs({checks:[],typeName:ie.ZodNumber,coerce:t?.coerce||!1,...ue(t)});var Bs=class t extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.ZodParsedType.bigint)return this._getInvalidInput(e);let n,s=new E.ParseStatus;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):D.util.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.bigint,received:r.parsedType}),E.INVALID}gte(e,r){return this.setLimit("min",e,!0,X.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,X.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,X.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,X.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:X.errorUtil.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:X.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};k.ZodBigInt=Bs;Bs.create=t=>new Bs({checks:[],typeName:ie.ZodBigInt,coerce:t?.coerce??!1,...ue(t)});var Hs=class extends le{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.boolean,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodBoolean=Hs;Hs.create=t=>new Hs({typeName:ie.ZodBoolean,coerce:t?.coerce||!1,...ue(t)});var Ks=class t extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.ZodParsedType.date){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.date,received:o.parsedType}),E.INVALID}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_date}),E.INVALID}let n=new E.ParseStatus,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):D.util.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:X.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:X.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};k.ZodDate=Ks;Ks.create=t=>new Ks({checks:[],coerce:t?.coerce||!1,typeName:ie.ZodDate,...ue(t)});var mi=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.symbol,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodSymbol=mi;mi.create=t=>new mi({typeName:ie.ZodSymbol,...ue(t)});var Gs=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.undefined,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodUndefined=Gs;Gs.create=t=>new Gs({typeName:ie.ZodUndefined,...ue(t)});var Js=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.null,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodNull=Js;Js.create=t=>new Js({typeName:ie.ZodNull,...ue(t)});var Bn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,E.OK)(e.data)}};k.ZodAny=Bn;Bn.create=t=>new Bn({typeName:ie.ZodAny,...ue(t)});var hn=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,E.OK)(e.data)}};k.ZodUnknown=hn;hn.create=t=>new hn({typeName:ie.ZodUnknown,...ue(t)});var Tr=class extends le{_parse(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.never,received:r.parsedType}),E.INVALID}};k.ZodNever=Tr;Tr.create=t=>new Tr({typeName:ie.ZodNever,...ue(t)});var gi=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.void,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodVoid=gi;gi.create=t=>new gi({typeName:ie.ZodVoid,...ue(t)});var mn=class t extends le{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==D.ZodParsedType.array)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.array,received:r.parsedType}),E.INVALID;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&((0,E.addIssueToContext)(r,{code:i?q.ZodIssueCode.too_big:q.ZodIssueCode.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&((0,E.addIssueToContext)(r,{code:q.ZodIssueCode.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&((0,E.addIssueToContext)(r,{code:q.ZodIssueCode.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new ar(r,i,r.path,a)))).then(i=>E.ParseStatus.mergeArray(n,i));let o=[...r.data].map((i,a)=>s.type._parseSync(new ar(r,i,r.path,a)));return E.ParseStatus.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:X.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:X.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:X.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};k.ZodArray=mn;mn.create=(t,e)=>new mn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ie.ZodArray,...ue(e)});function hi(t){if(t instanceof Lt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ir.create(hi(n))}return new Lt({...t._def,shape:()=>e})}else return t instanceof mn?new mn({...t._def,type:hi(t.element)}):t instanceof ir?ir.create(hi(t.unwrap())):t instanceof Br?Br.create(hi(t.unwrap())):t instanceof Vr?Vr.create(t.items.map(e=>hi(e))):t}var Lt=class t extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=D.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==D.ZodParsedType.object){let u=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(u,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.object,received:u.parsedType}),E.INVALID}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(let u in s.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=o[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ar(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Tr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&((0,E.addIssueToContext)(s,{code:q.ZodIssueCode.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=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ar(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>E.ParseStatus.mergeObjectSync(n,u)):E.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return X.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:X.errorUtil.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ie.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of D.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of D.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return hi(this)}partial(e){let r={};for(let n of D.util.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of D.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ir;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return E$(D.util.objectKeys(this.shape))}};k.ZodObject=Lt;Lt.create=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strip",catchall:Tr.create(),typeName:ie.ZodObject,...ue(e)});Lt.strictCreate=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strict",catchall:Tr.create(),typeName:ie.ZodObject,...ue(e)});Lt.lazycreate=(t,e)=>new Lt({shape:t,unknownKeys:"strip",catchall:Tr.create(),typeName:ie.ZodObject,...ue(e)});var Ws=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(a=>new q.ZodError(a.ctx.common.issues));return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_union,unionErrors:i}),E.INVALID}if(r.common.async)return Promise.all(n.map(async o=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(c=>new q.ZodError(c));return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_union,unionErrors:a}),E.INVALID}}get options(){return this._def.options}};k.ZodUnion=Ws;Ws.create=(t,e)=>new Ws({options:t,typeName:ie.ZodUnion,...ue(e)});var pn=t=>t instanceof Xs?pn(t.schema):t instanceof Gt?pn(t.innerType()):t instanceof Qs?[t.value]:t instanceof eo?t.options:t instanceof to?D.util.objectValues(t.enum):t instanceof ro?pn(t._def.innerType):t instanceof Gs?[void 0]:t instanceof Js?[null]:t instanceof ir?[void 0,...pn(t.unwrap())]:t instanceof Br?[null,...pn(t.unwrap())]:t instanceof oc||t instanceof so?pn(t.unwrap()):t instanceof no?pn(t._def.innerType):[],td=class t extends le{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==D.ZodParsedType.object)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.object,received:r.parsedType}),E.INVALID;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):((0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),E.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let o of r){let i=pn(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,o)}}return new t({typeName:ie.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...ue(n)})}};k.ZodDiscriminatedUnion=td;function o_(t,e){let r=(0,D.getParsedType)(t),n=(0,D.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===D.ZodParsedType.object&&n===D.ZodParsedType.object){let s=D.util.objectKeys(e),o=D.util.objectKeys(t).filter(a=>s.indexOf(a)!==-1),i={...t,...e};for(let a of o){let c=o_(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===D.ZodParsedType.array&&n===D.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<t.length;o++){let i=t[o],a=e[o],c=o_(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===D.ZodParsedType.date&&n===D.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ys=class extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(o,i)=>{if((0,E.isAborted)(o)||(0,E.isAborted)(i))return E.INVALID;let a=o_(o.value,i.value);return a.valid?(((0,E.isDirty)(o)||(0,E.isDirty)(i))&&r.dirty(),{status:r.value,value:a.data}):((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_intersection_types}),E.INVALID)};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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};k.ZodIntersection=Ys;Ys.create=(t,e,r)=>new Ys({left:t,right:e,typeName:ie.ZodIntersection,...ue(r)});var Vr=class t extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.array)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.array,received:n.parsedType}),E.INVALID;if(n.data.length<this._def.items.length)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new ar(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>E.ParseStatus.mergeArray(r,i)):E.ParseStatus.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};k.ZodTuple=Vr;Vr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vr({items:t,typeName:ie.ZodTuple,rest:null,...ue(e)})};var rd=class t extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.object)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.object,received:n.parsedType}),E.INVALID;let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in n.data)s.push({key:o._parse(new ar(n,a,n.path,a)),value:i._parse(new ar(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?E.ParseStatus.mergeObjectAsync(r,s):E.ParseStatus.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof le?new t({keyType:e,valueType:r,typeName:ie.ZodRecord,...ue(n)}):new t({keyType:Vn.create(),valueType:e,typeName:ie.ZodRecord,...ue(r)})}};k.ZodRecord=rd;var yi=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.map)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.map,received:n.parsedType}),E.INVALID;let s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new ar(n,a,n.path,[u,"key"])),value:o._parse(new ar(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return E.INVALID;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return E.INVALID;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};k.ZodMap=yi;yi.create=(t,e,r)=>new yi({valueType:e,keyType:t,typeName:ie.ZodMap,...ue(r)});var _i=class t extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.set)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.set,received:n.parsedType}),E.INVALID;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return E.INVALID;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new ar(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:X.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:X.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};k.ZodSet=_i;_i.create=(t,e)=>new _i({valueType:t,minSize:null,maxSize:null,typeName:ie.ZodSet,...ue(e)});var nd=class t extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==D.ZodParsedType.function)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.function,received:r.parsedType}),E.INVALID;function n(a,c){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ed.getErrorMap)(),ed.defaultErrorMap].filter(u=>!!u),issueData:{code:q.ZodIssueCode.invalid_arguments,argumentsError:c}})}function s(a,c){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ed.getErrorMap)(),ed.defaultErrorMap].filter(u=>!!u),issueData:{code:q.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Hn){let a=this;return(0,E.OK)(async function(...c){let u=new q.ZodError([]),l=await a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(g=>{throw u.addIssue(s(d,g)),u})})}else{let a=this;return(0,E.OK)(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new q.ZodError([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new q.ZodError([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Vr.create(e).rest(hn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Vr.create([]).rest(hn.create()),returns:r||hn.create(),typeName:ie.ZodFunction,...ue(n)})}};k.ZodFunction=nd;var Xs=class extends le{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};k.ZodLazy=Xs;Xs.create=(t,e)=>new Xs({getter:t,typeName:ie.ZodLazy,...ue(e)});var Qs=class extends le{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{received:r.data,code:q.ZodIssueCode.invalid_literal,expected:this._def.value}),E.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};k.ZodLiteral=Qs;Qs.create=(t,e)=>new Qs({value:t,typeName:ie.ZodLiteral,...ue(e)});function E$(t,e){return new eo({values:t,typeName:ie.ZodEnum,...ue(e)})}var eo=class t extends le{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{expected:D.util.joinValues(n),received:r.parsedType,code:q.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{received:r.data,code:q.ZodIssueCode.invalid_enum_value,options:n}),E.INVALID}return(0,E.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};k.ZodEnum=eo;eo.create=E$;var to=class extends le{_parse(e){let r=D.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==D.ZodParsedType.string&&n.parsedType!==D.ZodParsedType.number){let s=D.util.objectValues(r);return(0,E.addIssueToContext)(n,{expected:D.util.joinValues(s),received:n.parsedType,code:q.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(D.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=D.util.objectValues(r);return(0,E.addIssueToContext)(n,{received:n.data,code:q.ZodIssueCode.invalid_enum_value,options:s}),E.INVALID}return(0,E.OK)(e.data)}get enum(){return this._def.values}};k.ZodNativeEnum=to;to.create=(t,e)=>new to({values:t,typeName:ie.ZodNativeEnum,...ue(e)});var Hn=class extends le{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==D.ZodParsedType.promise&&r.common.async===!1)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.promise,received:r.parsedType}),E.INVALID;let n=r.parsedType===D.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,E.OK)(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};k.ZodPromise=Hn;Hn.create=(t,e)=>new Hn({type:t,typeName:ie.ZodPromise,...ue(e)});var Gt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:i=>{(0,E.addIssueToContext)(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){let i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return E.INVALID;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?E.INVALID:c.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(c.value):c});{if(r.value==="aborted")return E.INVALID;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?E.INVALID:a.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(a.value):a}}if(s.type==="refinement"){let i=a=>{let c=s.refinement(a,o);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"?E.INVALID:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?E.INVALID:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,E.isValid)(i))return E.INVALID;let a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>(0,E.isValid)(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):E.INVALID);D.util.assertNever(s)}};k.ZodEffects=Gt;k.ZodTransformer=Gt;Gt.create=(t,e,r)=>new Gt({schema:t,typeName:ie.ZodEffects,effect:e,...ue(r)});Gt.createWithPreprocess=(t,e,r)=>new Gt({schema:e,effect:{type:"preprocess",transform:t},typeName:ie.ZodEffects,...ue(r)});var ir=class extends le{_parse(e){return this._getType(e)===D.ZodParsedType.undefined?(0,E.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};k.ZodOptional=ir;ir.create=(t,e)=>new ir({innerType:t,typeName:ie.ZodOptional,...ue(e)});var Br=class extends le{_parse(e){return this._getType(e)===D.ZodParsedType.null?(0,E.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};k.ZodNullable=Br;Br.create=(t,e)=>new Br({innerType:t,typeName:ie.ZodNullable,...ue(e)});var ro=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===D.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};k.ZodDefault=ro;ro.create=(t,e)=>new ro({innerType:t,typeName:ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ue(e)});var no=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,E.isAsync)(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new q.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new q.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};k.ZodCatch=no;no.create=(t,e)=>new no({innerType:t,typeName:ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ue(e)});var vi=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.nan,received:n.parsedType}),E.INVALID}return{status:"valid",value:e.data}}};k.ZodNaN=vi;vi.create=t=>new vi({typeName:ie.ZodNaN,...ue(t)});k.BRAND=Symbol("zod_brand");var oc=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};k.ZodBranded=oc;var ic=class t extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?E.INVALID:o.status==="dirty"?(r.dirty(),(0,E.DIRTY)(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?E.INVALID:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ie.ZodPipeline})}};k.ZodPipeline=ic;var so=class extends le{_parse(e){let r=this._def.innerType._parse(e),n=s=>((0,E.isValid)(s)&&(s.value=Object.freeze(s.value)),s);return(0,E.isAsync)(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};k.ZodReadonly=so;so.create=(t,e)=>new so({innerType:t,typeName:ie.ZodReadonly,...ue(e)});function w$(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function T$(t,e={},r){return t?Bn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=w$(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=w$(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):Bn.create()}k.late={object:Lt.lazycreate};var ie;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ie||(k.ZodFirstPartyTypeKind=ie={}));var zV=(t,e={message:`Input not instance of ${t.name}`})=>T$(r=>r instanceof t,e);k.instanceof=zV;var $$=Vn.create;k.string=$$;var I$=Vs.create;k.number=I$;var MV=vi.create;k.nan=MV;var LV=Bs.create;k.bigint=LV;var P$=Hs.create;k.boolean=P$;var qV=Ks.create;k.date=qV;var ZV=mi.create;k.symbol=ZV;var DV=Gs.create;k.undefined=DV;var FV=Js.create;k.null=FV;var UV=Bn.create;k.any=UV;var VV=hn.create;k.unknown=VV;var BV=Tr.create;k.never=BV;var HV=gi.create;k.void=HV;var KV=mn.create;k.array=KV;var GV=Lt.create;k.object=GV;var JV=Lt.strictCreate;k.strictObject=JV;var WV=Ws.create;k.union=WV;var YV=td.create;k.discriminatedUnion=YV;var XV=Ys.create;k.intersection=XV;var QV=Vr.create;k.tuple=QV;var eB=rd.create;k.record=eB;var tB=yi.create;k.map=tB;var rB=_i.create;k.set=rB;var nB=nd.create;k.function=nB;var sB=Xs.create;k.lazy=sB;var oB=Qs.create;k.literal=oB;var iB=eo.create;k.enum=iB;var aB=to.create;k.nativeEnum=aB;var cB=Hn.create;k.promise=cB;var O$=Gt.create;k.effect=O$;k.transformer=O$;var uB=ir.create;k.optional=uB;var lB=Br.create;k.nullable=lB;var dB=Gt.createWithPreprocess;k.preprocess=dB;var fB=ic.create;k.pipeline=fB;var pB=()=>$$().optional();k.ostring=pB;var hB=()=>I$().optional();k.onumber=hB;var mB=()=>P$().optional();k.oboolean=mB;k.coerce={string:(t=>Vn.create({...t,coerce:!0})),number:(t=>Vs.create({...t,coerce:!0})),boolean:(t=>Hs.create({...t,coerce:!0})),bigint:(t=>Bs.create({...t,coerce:!0})),date:(t=>Ks.create({...t,coerce:!0}))};k.NEVER=E.INVALID});var i_=S(cr=>{"use strict";f();var gB=cr&&cr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),bi=cr&&cr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&gB(e,t,r)};Object.defineProperty(cr,"__esModule",{value:!0});bi(Xl(),cr);bi(n_(),cr);bi(y$(),cr);bi(nc(),cr);bi(C$(),cr);bi(Yl(),cr)});var R$=S(qt=>{"use strict";f();var A$=qt&&qt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),yB=qt&&qt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),_B=qt&&qt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&A$(e,t,r);return yB(e,t),e},vB=qt&&qt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&A$(e,t,r)};Object.defineProperty(qt,"__esModule",{value:!0});qt.z=void 0;var N$=_B(i_());qt.z=N$;vB(i_(),qt);qt.default=N$});var wi=S(sd=>{"use strict";f();Object.defineProperty(sd,"__esModule",{value:!0});sd.config=void 0;var oo=R$(),bB=oo.z.object({MCP_SERVER_PORT:oo.z.coerce.number().int().positive().default(3001),MCP_SERVER_HOST:oo.z.string().default("0.0.0.0"),TOOLPILOT_MODE:oo.z.enum(["dev","staging","production"]).default("dev"),TOOLPILOT_API_URL:oo.z.string().default("https://api.neurynae.com"),NODE_ENV:oo.z.enum(["development","test","production"]).default("development"),LOG_LEVEL:oo.z.enum(["fatal","error","warn","info","debug","trace"]).default("info")});function wB(){let t=bB.safeParse(process.env);return t.success||(console.error("\u274C Invalid environment configuration:"),console.error(t.error.format()),process.exit(1)),t.data}sd.config=wB()});var id=S(od=>{"use strict";f();Object.defineProperty(od,"__esModule",{value:!0});od.ErrorCode=void 0;od.ErrorCode={ERR_DB_CONNECTION:"ERR_DB_CONNECTION",ERR_DB_QUERY:"ERR_DB_QUERY",ERR_DB_TIMEOUT:"ERR_DB_TIMEOUT",ERR_DB_CONSTRAINT:"ERR_DB_CONSTRAINT",ERR_DB_NOT_FOUND:"ERR_DB_NOT_FOUND",ERR_VALIDATION_INPUT:"ERR_VALIDATION_INPUT",ERR_VALIDATION_SCHEMA:"ERR_VALIDATION_SCHEMA",ERR_AUTH_TOKEN_EXPIRED:"ERR_AUTH_TOKEN_EXPIRED",ERR_AUTH_UNAUTHORIZED:"ERR_AUTH_UNAUTHORIZED",ERR_AUTH_FORBIDDEN:"ERR_AUTH_FORBIDDEN",ERR_EXTERNAL_GITHUB:"ERR_EXTERNAL_GITHUB",ERR_EXTERNAL_NOMIC:"ERR_EXTERNAL_NOMIC",ERR_EXTERNAL_QDRANT:"ERR_EXTERNAL_QDRANT",ERR_EXTERNAL_MEMGRAPH:"ERR_EXTERNAL_MEMGRAPH",ERR_EXTERNAL_RAZORPAY:"ERR_EXTERNAL_RAZORPAY",ERR_QUEUE_PUBLISH:"ERR_QUEUE_PUBLISH",ERR_QUEUE_CONSUME:"ERR_QUEUE_CONSUME",ERR_QUEUE_TIMEOUT:"ERR_QUEUE_TIMEOUT",ERR_SEARCH_PIPELINE:"ERR_SEARCH_PIPELINE",ERR_SEARCH_EMBEDDING:"ERR_SEARCH_EMBEDDING",ERR_SEARCH_NO_RESULTS:"ERR_SEARCH_NO_RESULTS",ERR_INDEXER_CRAWL:"ERR_INDEXER_CRAWL",ERR_INDEXER_PROCESS:"ERR_INDEXER_PROCESS",ERR_INDEXER_WRITE:"ERR_INDEXER_WRITE",ERR_NETWORK_TIMEOUT:"ERR_NETWORK_TIMEOUT",ERR_NETWORK_UNREACHABLE:"ERR_NETWORK_UNREACHABLE",ERR_MCP_HANDLER:"ERR_MCP_HANDLER",ERR_MCP_AUTH:"ERR_MCP_AUTH",ERR_INTERNAL:"ERR_INTERNAL",ERR_NOT_FOUND:"ERR_NOT_FOUND",ERR_RATE_LIMIT:"ERR_RATE_LIMIT"}});var ad=S(rt=>{"use strict";f();Object.defineProperty(rt,"__esModule",{value:!0});rt.VectorError=rt.IndexerError=rt.SearchError=rt.QueueError=rt.ExternalServiceError=rt.AuthError=rt.ValidationError=rt.NetworkError=rt.DatabaseError=rt.AppError=void 0;var gn=id(),ur=class extends Error{code;httpStatus;severity;isOperational;context;timestamp;constructor(e){super(e.message,{cause:e.cause}),this.name=this.constructor.name,this.code=e.code,this.httpStatus=e.httpStatus??500,this.severity=e.severity??"medium",this.isOperational=e.isOperational??!0,this.context=e.context??{},this.timestamp=new Date().toISOString(),Object.setPrototypeOf(this,new.target.prototype)}toJSON(){return{name:this.name,code:this.code,message:this.message,httpStatus:this.httpStatus,severity:this.severity,isOperational:this.isOperational,context:this.context,timestamp:this.timestamp,stack:this.stack,cause:this.cause instanceof Error?{name:this.cause.name,message:this.cause.message,stack:this.cause.stack}:this.cause}}};rt.AppError=ur;var a_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_DB_QUERY,message:e.message,httpStatus:503,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.DatabaseError=a_;var c_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_NETWORK_TIMEOUT,message:e.message,httpStatus:502,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.NetworkError=c_;var u_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_VALIDATION_INPUT,message:e.message,httpStatus:400,severity:"low",isOperational:!0,cause:e.cause,context:e.context})}};rt.ValidationError=u_;var l_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_AUTH_UNAUTHORIZED,message:e.message,httpStatus:401,severity:"medium",isOperational:!0,cause:e.cause,context:e.context})}};rt.AuthError=l_;var d_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_INTERNAL,message:`[${e.service}] ${e.message}`,httpStatus:502,severity:"high",isOperational:!0,cause:e.cause,context:{...e.context,service:e.service}})}};rt.ExternalServiceError=d_;var f_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_QUEUE_PUBLISH,message:e.message,httpStatus:503,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.QueueError=f_;var p_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_SEARCH_PIPELINE,message:e.message,httpStatus:500,severity:"medium",isOperational:!0,cause:e.cause,context:e.context})}};rt.SearchError=p_;var h_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_INDEXER_PROCESS,message:e.message,httpStatus:500,severity:"medium",isOperational:!0,cause:e.cause,context:e.context})}};rt.IndexerError=h_;var m_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_EXTERNAL_NOMIC,message:e.message,httpStatus:502,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.VectorError=m_});var y_=S(g_=>{"use strict";f();Object.defineProperty(g_,"__esModule",{value:!0});g_.errorSerializer=SB;var xB=ad();function SB(t){return t instanceof xB.AppError?t.toJSON():t instanceof Error?{name:t.name,message:t.message,stack:t.stack,cause:t.cause instanceof Error?{name:t.cause.name,message:t.cause.message,stack:t.cause.stack}:t.cause}:{message:String(t)}}});var v_=S((jde,M$)=>{"use strict";f();var ac=t=>t&&typeof t.message=="string",__=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return ac(r)?r:void 0}else return ac(e)?e:void 0},j$=(t,e)=>{if(!ac(t))return"";let r=t.stack||"";if(e.has(t))return r+`
|
|
9
|
+
deps: ${r}}`};var T4={keyword:"dependencies",type:"object",schemaType:"object",error:Dr.error,code(t){let[e,r]=$4(t);lT(t,e),dT(t,r)}};function $4({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let s=Array.isArray(t[n])?e:r;s[n]=t[n]}return[e,r]}function lT(t,e=t.schema){let{gen:r,data:n,it:s}=t;if(Object.keys(e).length===0)return;let o=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,ec.propertyInData)(r,n,i,s.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors?r.if(c,()=>{for(let u of a)(0,ec.checkReportMissingProp)(t,u)}):(r.if((0,xy._)`${c} && (${(0,ec.checkMissingProp)(t,a,o)})`),(0,ec.reportMissingProp)(t,o),r.else())}}Dr.validatePropertyDeps=lT;function dT(t,e=t.schema){let{gen:r,data:n,keyword:s,it:o}=t,i=r.name("valid");for(let a in e)(0,E4.alwaysValidSchema)(o,e[a])||(r.if((0,ec.propertyInData)(r,n,a,o.opts.ownProperties),()=>{let c=t.subschema({keyword:s,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Dr.validateSchemaDeps=dT;Dr.default=T4});var hT=S(Sy=>{"use strict";f();Object.defineProperty(Sy,"__esModule",{value:!0});var pT=me(),I4=Se(),O4={message:"property name must be valid",params:({params:t})=>(0,pT._)`{propertyName: ${t.propertyName}}`},P4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:O4,code(t){let{gen:e,schema:r,data:n,it:s}=t;if((0,I4.alwaysValidSchema)(s,r))return;let o=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),e.if((0,pT.not)(o),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(o)}};Sy.default=P4});var Ey=S(ky=>{"use strict";f();Object.defineProperty(ky,"__esModule",{value:!0});var ql=nr(),kr=me(),C4=ln(),Zl=Se(),N4={message:"must NOT have additional properties",params:({params:t})=>(0,kr._)`{additionalProperty: ${t.additionalProperty}}`},A4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:N4,code(t){let{gen:e,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=t;if(!o)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Zl.alwaysValidSchema)(i,r))return;let u=(0,ql.allSchemaProperties)(n.properties),l=(0,ql.allSchemaProperties)(n.patternProperties);d(),t.ok((0,kr._)`${o} === ${C4.default.errors}`);function d(){e.forIn("key",s,_=>{!u.length&&!l.length?h(_):e.if(p(_),()=>h(_))})}function p(_){let b;if(u.length>8){let w=(0,Zl.schemaRefOrVal)(i,n.properties,"properties");b=(0,ql.isOwnProperty)(e,w,_)}else u.length?b=(0,kr.or)(...u.map(w=>(0,kr._)`${_} === ${w}`)):b=kr.nil;return l.length&&(b=(0,kr.or)(b,...l.map(w=>(0,kr._)`${(0,ql.usePattern)(t,w)}.test(${_})`))),(0,kr.not)(b)}function g(_){e.code((0,kr._)`delete ${s}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){g(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Zl.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(m(_,b,!1),e.if((0,kr.not)(b),()=>{t.reset(),g(_)})):(m(_,b),a||e.if((0,kr.not)(b),()=>e.break()))}}function m(_,b,w){let x={keyword:"additionalProperties",dataProp:_,dataPropType:Zl.Type.Str};w===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,b)}}};ky.default=A4});var yT=S($y=>{"use strict";f();Object.defineProperty($y,"__esModule",{value:!0});var R4=Za(),mT=nr(),Ty=Se(),gT=Ey(),j4={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:s,it:o}=t;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&gT.default.code(new R4.KeywordCxt(o,gT.default,"additionalProperties"));let i=(0,mT.allSchemaProperties)(r);for(let d of i)o.definedProperties.add(d);o.opts.unevaluated&&i.length&&o.props!==!0&&(o.props=Ty.mergeEvaluated.props(e,(0,Ty.toHash)(i),o.props));let a=i.filter(d=>!(0,Ty.alwaysValidSchema)(o,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,mT.propertyInData)(e,s,d,o.opts.ownProperties)),l(d),o.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};$y.default=j4});var wT=S(Iy=>{"use strict";f();Object.defineProperty(Iy,"__esModule",{value:!0});var _T=nr(),Dl=me(),vT=Se(),bT=Se(),z4={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:s,it:o}=t,{opts:i}=o,a=(0,_T.allSchemaProperties)(r),c=a.filter(m=>(0,vT.alwaysValidSchema)(o,r[m]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&s.properties,l=e.name("valid");o.props!==!0&&!(o.props instanceof Dl.Name)&&(o.props=(0,bT.evaluatedPropsToName)(e,o.props));let{props:d}=o;p();function p(){for(let m of a)u&&g(m),o.allErrors?h(m):(e.var(l,!0),h(m),e.if(l))}function g(m){for(let _ in u)new RegExp(m).test(_)&&(0,vT.checkStrictMode)(o,`property ${_} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){e.forIn("key",n,_=>{e.if((0,Dl._)`${(0,_T.usePattern)(t,m)}.test(${_})`,()=>{let b=c.includes(m);b||t.subschema({keyword:"patternProperties",schemaProp:m,dataProp:_,dataPropType:bT.Type.Str},l),o.opts.unevaluated&&d!==!0?e.assign((0,Dl._)`${d}[${_}]`,!0):!b&&!o.allErrors&&e.if((0,Dl.not)(l),()=>e.break())})})}}};Iy.default=z4});var xT=S(Oy=>{"use strict";f();Object.defineProperty(Oy,"__esModule",{value:!0});var M4=Se(),L4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,M4.alwaysValidSchema)(n,r)){t.fail();return}let s=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Oy.default=L4});var ST=S(Py=>{"use strict";f();Object.defineProperty(Py,"__esModule",{value:!0});var q4=nr(),Z4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:q4.validateUnion,error:{message:"must match a schema in anyOf"}};Py.default=Z4});var kT=S(Cy=>{"use strict";f();Object.defineProperty(Cy,"__esModule",{value:!0});var Fl=me(),D4=Se(),F4={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Fl._)`{passingSchemas: ${t.passing}}`},U4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:F4,code(t){let{gen:e,schema:r,parentSchema:n,it:s}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){o.forEach((l,d)=>{let p;(0,D4.alwaysValidSchema)(s,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Fl._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Fl._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Fl.Name)})})}}};Cy.default=U4});var ET=S(Ny=>{"use strict";f();Object.defineProperty(Ny,"__esModule",{value:!0});var V4=Se(),B4={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let s=e.name("valid");r.forEach((o,i)=>{if((0,V4.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:i},s);t.ok(s),t.mergeEvaluated(a)})}};Ny.default=B4});var IT=S(Ay=>{"use strict";f();Object.defineProperty(Ay,"__esModule",{value:!0});var Ul=me(),$T=Se(),H4={message:({params:t})=>(0,Ul.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ul._)`{failingKeyword: ${t.ifClause}}`},K4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:H4,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,$T.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=TT(n,"then"),o=TT(n,"else");if(!s&&!o)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),s&&o){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else s?e.if(a,u("then")):e.if((0,Ul.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,Ul._)`${l}`):t.setParams({ifClause:l})}}}};function TT(t,e){let r=t.schema[e];return r!==void 0&&!(0,$T.alwaysValidSchema)(t,r)}Ay.default=K4});var OT=S(Ry=>{"use strict";f();Object.defineProperty(Ry,"__esModule",{value:!0});var G4=Se(),J4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,G4.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ry.default=J4});var PT=S(jy=>{"use strict";f();Object.defineProperty(jy,"__esModule",{value:!0});var W4=yy(),Y4=iT(),X4=_y(),Q4=cT(),e9=uT(),t9=fT(),r9=hT(),n9=Ey(),s9=yT(),o9=wT(),i9=xT(),a9=ST(),c9=kT(),u9=ET(),l9=IT(),d9=OT();function f9(t=!1){let e=[i9.default,a9.default,c9.default,u9.default,l9.default,d9.default,r9.default,n9.default,t9.default,s9.default,o9.default];return t?e.push(Y4.default,Q4.default):e.push(W4.default,X4.default),e.push(e9.default),e}jy.default=f9});var CT=S(zy=>{"use strict";f();Object.defineProperty(zy,"__esModule",{value:!0});var st=me(),p9={message:({schemaCode:t})=>(0,st.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,st._)`{format: ${t}}`},h9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:p9,code(t,e){let{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;s?p():g();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,st._)`${h}[${i}]`),_=r.let("fType"),b=r.let("format");r.if((0,st._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(_,(0,st._)`${m}.type || "string"`).assign(b,(0,st._)`${m}.validate`),()=>r.assign(_,(0,st._)`"string"`).assign(b,m)),t.fail$data((0,st.or)(w(),x()));function w(){return c.strictSchema===!1?st.nil:(0,st._)`${i} && !${b}`}function x(){let T=l.$async?(0,st._)`(${m}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,st._)`${b}(${n})`,O=(0,st._)`(typeof ${b} == "function" ? ${T} : ${b}.test(${n}))`;return(0,st._)`${b} && ${b} !== true && ${_} === ${e} && !${O}`}}function g(){let h=d.formats[o];if(!h){w();return}if(h===!0)return;let[m,_,b]=x(h);m===e&&t.pass(T());function w(){if(c.strictSchema===!1){d.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function x(O){let L=O instanceof RegExp?(0,st.regexpCode)(O):c.code.formats?(0,st._)`${c.code.formats}${(0,st.getProperty)(o)}`:void 0,U=r.scopeValue("formats",{key:o,ref:O,code:L});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,st._)`${U}.validate`]:["string",O,U]}function T(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,st._)`await ${b}(${n})`}return typeof _=="function"?(0,st._)`${b}(${n})`:(0,st._)`${b}.test(${n})`}}}};zy.default=h9});var NT=S(My=>{"use strict";f();Object.defineProperty(My,"__esModule",{value:!0});var m9=CT(),g9=[m9.default];My.default=g9});var AT=S(ai=>{"use strict";f();Object.defineProperty(ai,"__esModule",{value:!0});ai.contentVocabulary=ai.metadataVocabulary=void 0;ai.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ai.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var jT=S(Ly=>{"use strict";f();Object.defineProperty(Ly,"__esModule",{value:!0});var y9=FE(),_9=rT(),v9=PT(),b9=NT(),RT=AT(),w9=[y9.default,_9.default,(0,v9.default)(),b9.default,RT.metadataVocabulary,RT.contentVocabulary];Ly.default=w9});var MT=S(Vl=>{"use strict";f();Object.defineProperty(Vl,"__esModule",{value:!0});Vl.DiscrError=void 0;var zT;(function(t){t.Tag="tag",t.Mapping="mapping"})(zT||(Vl.DiscrError=zT={}))});var qT=S(Zy=>{"use strict";f();Object.defineProperty(Zy,"__esModule",{value:!0});var ci=me(),qy=MT(),LT=Tl(),x9=Da(),S9=Se(),k9={message:({params:{discrError:t,tagName:e}})=>t===qy.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,ci._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},E9={keyword:"discriminator",type:"object",schemaType:"object",error:k9,code(t){let{gen:e,data:r,schema:n,parentSchema:s,it:o}=t,{oneOf:i}=s;if(!o.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,ci._)`${r}${(0,ci.getProperty)(a)}`);e.if((0,ci._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:qy.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let g=p();e.if(!1);for(let h in g)e.elseIf((0,ci._)`${u} === ${h}`),e.assign(c,d(g[h]));e.else(),t.error(!1,{discrError:qy.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(g){let h=e.name("valid"),m=t.subschema({keyword:"oneOf",schemaProp:g},h);return t.mergeEvaluated(m,ci.Name),h}function p(){var g;let h={},m=b(s),_=!0;for(let T=0;T<i.length;T++){let O=i[T];if(O?.$ref&&!(0,S9.schemaHasRulesButRef)(O,o.self.RULES)){let U=O.$ref;if(O=LT.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,U),O instanceof LT.SchemaEnv&&(O=O.schema),O===void 0)throw new x9.default(o.opts.uriResolver,o.baseId,U)}let L=(g=O?.properties)===null||g===void 0?void 0:g[a];if(typeof L!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(m||b(O)),w(L,T)}if(!_)throw new Error(`discriminator: "${a}" must be required`);return h;function b({required:T}){return Array.isArray(T)&&T.includes(a)}function w(T,O){if(T.const)x(T.const,O);else if(T.enum)for(let L of T.enum)x(L,O);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(T,O){if(typeof T!="string"||T in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[T]=O}}}};Zy.default=E9});var ZT=S((xle,T9)=>{T9.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 Fy=S((Be,Dy)=>{"use strict";f();Object.defineProperty(Be,"__esModule",{value:!0});Be.MissingRefError=Be.ValidationError=Be.CodeGen=Be.Name=Be.nil=Be.stringify=Be.str=Be._=Be.KeywordCxt=Be.Ajv=void 0;var $9=zE(),I9=jT(),O9=qT(),DT=ZT(),P9=["/properties"],Bl="http://json-schema.org/draft-07/schema",ui=class extends $9.default{_addVocabularies(){super._addVocabularies(),I9.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(O9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(DT,P9):DT;this.addMetaSchema(e,Bl,!1),this.refs["http://json-schema.org/schema"]=Bl}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Bl)?Bl:void 0)}};Be.Ajv=ui;Dy.exports=Be=ui;Dy.exports.Ajv=ui;Object.defineProperty(Be,"__esModule",{value:!0});Be.default=ui;var C9=Za();Object.defineProperty(Be,"KeywordCxt",{enumerable:!0,get:function(){return C9.KeywordCxt}});var li=me();Object.defineProperty(Be,"_",{enumerable:!0,get:function(){return li._}});Object.defineProperty(Be,"str",{enumerable:!0,get:function(){return li.str}});Object.defineProperty(Be,"stringify",{enumerable:!0,get:function(){return li.stringify}});Object.defineProperty(Be,"nil",{enumerable:!0,get:function(){return li.nil}});Object.defineProperty(Be,"Name",{enumerable:!0,get:function(){return li.Name}});Object.defineProperty(Be,"CodeGen",{enumerable:!0,get:function(){return li.CodeGen}});var N9=kl();Object.defineProperty(Be,"ValidationError",{enumerable:!0,get:function(){return N9.default}});var A9=Da();Object.defineProperty(Be,"MissingRefError",{enumerable:!0,get:function(){return A9.default}})});var JT=S(Ur=>{"use strict";f();Object.defineProperty(Ur,"__esModule",{value:!0});Ur.formatNames=Ur.fastFormats=Ur.fullFormats=void 0;function Fr(t,e){return{validate:t,compare:e}}Ur.fullFormats={date:Fr(BT,Hy),time:Fr(Vy(!0),Ky),"date-time":Fr(FT(!0),KT),"iso-time":Fr(Vy(),HT),"iso-date-time":Fr(FT(),GT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:q9,"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:H9,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:Z9,int32:{type:"number",validate:U9},int64:{type:"number",validate:V9},float:{type:"number",validate:VT},double:{type:"number",validate:VT},password:!0,binary:!0};Ur.fastFormats={...Ur.fullFormats,date:Fr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Hy),time:Fr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ky),"date-time":Fr(/^\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,KT),"iso-time":Fr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,HT),"iso-date-time":Fr(/^\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,GT),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};Ur.formatNames=Object.keys(Ur.fullFormats);function R9(t){return t%4===0&&(t%100!==0||t%400===0)}var j9=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,z9=[0,31,28,31,30,31,30,31,31,30,31,30,31];function BT(t){let e=j9.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],s=+e[3];return n>=1&&n<=12&&s>=1&&s<=(n===2&&R9(r)?29:z9[n])}function Hy(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Uy=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Vy(t){return function(r){let n=Uy.exec(r);if(!n)return!1;let s=+n[1],o=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(s<=23&&o<=59&&i<60)return!0;let d=o-l*c,p=s-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ky(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function HT(t,e){if(!(t&&e))return;let r=Uy.exec(t),n=Uy.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var By=/t|\s/i;function FT(t){let e=Vy(t);return function(n){let s=n.split(By);return s.length===2&&BT(s[0])&&e(s[1])}}function KT(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function GT(t,e){if(!(t&&e))return;let[r,n]=t.split(By),[s,o]=e.split(By),i=Hy(r,s);if(i!==void 0)return i||Ky(n,o)}var M9=/\/|:/,L9=/^(?:[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 q9(t){return M9.test(t)&&L9.test(t)}var UT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Z9(t){return UT.lastIndex=0,UT.test(t)}var D9=-(2**31),F9=2**31-1;function U9(t){return Number.isInteger(t)&&t<=F9&&t>=D9}function V9(t){return Number.isInteger(t)}function VT(){return!0}var B9=/[^\\]\\Z/;function H9(t){if(B9.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var WT=S(di=>{"use strict";f();Object.defineProperty(di,"__esModule",{value:!0});di.formatLimitDefinition=void 0;var K9=Fy(),Er=me(),Zn=Er.operators,Hl={formatMaximum:{okStr:"<=",ok:Zn.LTE,fail:Zn.GT},formatMinimum:{okStr:">=",ok:Zn.GTE,fail:Zn.LT},formatExclusiveMaximum:{okStr:"<",ok:Zn.LT,fail:Zn.GTE},formatExclusiveMinimum:{okStr:">",ok:Zn.GT,fail:Zn.LTE}},G9={message:({keyword:t,schemaCode:e})=>(0,Er.str)`should be ${Hl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Er._)`{comparison: ${Hl[t].okStr}, limit: ${e}}`};di.formatLimitDefinition={keyword:Object.keys(Hl),type:"string",schemaType:"string",$data:!0,error:G9,code(t){let{gen:e,data:r,schemaCode:n,keyword:s,it:o}=t,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new K9.KeywordCxt(o,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),g=e.const("fmt",(0,Er._)`${p}[${c.schemaCode}]`);t.fail$data((0,Er.or)((0,Er._)`typeof ${g} != "object"`,(0,Er._)`${g} instanceof RegExp`,(0,Er._)`typeof ${g}.compare != "function"`,d(g)))}function l(){let p=c.schema,g=a.formats[p];if(!g||g===!0)return;if(typeof g!="object"||g instanceof RegExp||typeof g.compare!="function")throw new Error(`"${s}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:g,code:i.code.formats?(0,Er._)`${i.code.formats}${(0,Er.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,Er._)`${p}.compare(${r}, ${n}) ${Hl[s].fail} 0`}},dependencies:["format"]};var J9=t=>(t.addKeyword(di.formatLimitDefinition),t);di.default=J9});var e$=S((tc,QT)=>{"use strict";f();Object.defineProperty(tc,"__esModule",{value:!0});var fi=JT(),W9=WT(),Gy=me(),YT=new Gy.Name("fullFormats"),Y9=new Gy.Name("fastFormats"),Jy=(t,e={keywords:!0})=>{if(Array.isArray(e))return XT(t,e,fi.fullFormats,YT),t;let[r,n]=e.mode==="fast"?[fi.fastFormats,Y9]:[fi.fullFormats,YT],s=e.formats||fi.formatNames;return XT(t,s,r,n),e.keywords&&(0,W9.default)(t),t};Jy.get=(t,e="full")=>{let n=(e==="fast"?fi.fastFormats:fi.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function XT(t,e,r,n){var s,o;(s=(o=t.opts.code).formats)!==null&&s!==void 0||(o.formats=(0,Gy._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}QT.exports=tc=Jy;Object.defineProperty(tc,"__esModule",{value:!0});tc.default=Jy});var nc=S(De=>{"use strict";f();Object.defineProperty(De,"__esModule",{value:!0});De.getParsedType=De.ZodParsedType=De.objectUtil=De.util=void 0;var Qy;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let o={};for(let i of s)o[i]=i;return o},t.getValidEnumValues=s=>{let o=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(let a of o)i[a]=s[a];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(let i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(Qy||(De.util=Qy={}));var f$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(f$||(De.objectUtil=f$={}));De.ZodParsedType=Qy.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var sV=t=>{switch(typeof t){case"undefined":return De.ZodParsedType.undefined;case"string":return De.ZodParsedType.string;case"number":return Number.isNaN(t)?De.ZodParsedType.nan:De.ZodParsedType.number;case"boolean":return De.ZodParsedType.boolean;case"function":return De.ZodParsedType.function;case"bigint":return De.ZodParsedType.bigint;case"symbol":return De.ZodParsedType.symbol;case"object":return Array.isArray(t)?De.ZodParsedType.array:t===null?De.ZodParsedType.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?De.ZodParsedType.promise:typeof Map<"u"&&t instanceof Map?De.ZodParsedType.map:typeof Set<"u"&&t instanceof Set?De.ZodParsedType.set:typeof Date<"u"&&t instanceof Date?De.ZodParsedType.date:De.ZodParsedType.object;default:return De.ZodParsedType.unknown}};De.getParsedType=sV});var Yl=S(Fn=>{"use strict";f();Object.defineProperty(Fn,"__esModule",{value:!0});Fn.ZodError=Fn.quotelessJson=Fn.ZodIssueCode=void 0;var p$=nc();Fn.ZodIssueCode=p$.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var oV=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Fn.quotelessJson=oV;var sc=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,p$.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let o=s.path[0];r[o]=r[o]||[],r[o].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Fn.ZodError=sc;sc.create=t=>new sc(t)});var t_=S(e_=>{"use strict";f();Object.defineProperty(e_,"__esModule",{value:!0});var kt=Yl(),Us=nc(),iV=(t,e)=>{let r;switch(t.code){case kt.ZodIssueCode.invalid_type:t.received===Us.ZodParsedType.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case kt.ZodIssueCode.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Us.util.jsonStringifyReplacer)}`;break;case kt.ZodIssueCode.unrecognized_keys:r=`Unrecognized key(s) in object: ${Us.util.joinValues(t.keys,", ")}`;break;case kt.ZodIssueCode.invalid_union:r="Invalid input";break;case kt.ZodIssueCode.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Us.util.joinValues(t.options)}`;break;case kt.ZodIssueCode.invalid_enum_value:r=`Invalid enum value. Expected ${Us.util.joinValues(t.options)}, received '${t.received}'`;break;case kt.ZodIssueCode.invalid_arguments:r="Invalid function arguments";break;case kt.ZodIssueCode.invalid_return_type:r="Invalid function return type";break;case kt.ZodIssueCode.invalid_date:r="Invalid date";break;case kt.ZodIssueCode.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Us.util.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case kt.ZodIssueCode.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case kt.ZodIssueCode.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case kt.ZodIssueCode.custom:r="Invalid input";break;case kt.ZodIssueCode.invalid_intersection_types:r="Intersection results could not be merged";break;case kt.ZodIssueCode.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case kt.ZodIssueCode.not_finite:r="Number must be finite";break;default:r=e.defaultError,Us.util.assertNever(t)}return{message:r}};e_.default=iV});var Xl=S(Un=>{"use strict";f();var aV=Un&&Un.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Un,"__esModule",{value:!0});Un.defaultErrorMap=void 0;Un.setErrorMap=cV;Un.getErrorMap=uV;var h$=aV(t_());Un.defaultErrorMap=h$.default;var m$=h$.default;function cV(t){m$=t}function uV(){return m$}});var n_=S(Re=>{"use strict";f();var lV=Re&&Re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Re,"__esModule",{value:!0});Re.isAsync=Re.isValid=Re.isDirty=Re.isAborted=Re.OK=Re.DIRTY=Re.INVALID=Re.ParseStatus=Re.EMPTY_PATH=Re.makeIssue=void 0;Re.addIssueToContext=pV;var dV=Xl(),g$=lV(t_()),fV=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...s,path:o,message:a}};Re.makeIssue=fV;Re.EMPTY_PATH=[];function pV(t,e){let r=(0,dV.getErrorMap)(),n=(0,Re.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===g$.default?void 0:g$.default].filter(s=>!!s)});t.common.issues.push(n)}var r_=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return Re.INVALID;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let o=await s.key,i=await s.value;n.push({key:o,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return Re.INVALID;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:e.value,value:n}}};Re.ParseStatus=r_;Re.INVALID=Object.freeze({status:"aborted"});var hV=t=>({status:"dirty",value:t});Re.DIRTY=hV;var mV=t=>({status:"valid",value:t});Re.OK=mV;var gV=t=>t.status==="aborted";Re.isAborted=gV;var yV=t=>t.status==="dirty";Re.isDirty=yV;var _V=t=>t.status==="valid";Re.isValid=_V;var vV=t=>typeof Promise<"u"&&t instanceof Promise;Re.isAsync=vV});var _$=S(y$=>{"use strict";f();Object.defineProperty(y$,"__esModule",{value:!0})});var b$=S(Ql=>{"use strict";f();Object.defineProperty(Ql,"__esModule",{value:!0});Ql.errorUtil=void 0;var v$;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(v$||(Ql.errorUtil=v$={}))});var N$=S(k=>{"use strict";f();Object.defineProperty(k,"__esModule",{value:!0});k.discriminatedUnion=k.date=k.boolean=k.bigint=k.array=k.any=k.coerce=k.ZodFirstPartyTypeKind=k.late=k.ZodSchema=k.Schema=k.ZodReadonly=k.ZodPipeline=k.ZodBranded=k.BRAND=k.ZodNaN=k.ZodCatch=k.ZodDefault=k.ZodNullable=k.ZodOptional=k.ZodTransformer=k.ZodEffects=k.ZodPromise=k.ZodNativeEnum=k.ZodEnum=k.ZodLiteral=k.ZodLazy=k.ZodFunction=k.ZodSet=k.ZodMap=k.ZodRecord=k.ZodTuple=k.ZodIntersection=k.ZodDiscriminatedUnion=k.ZodUnion=k.ZodObject=k.ZodArray=k.ZodVoid=k.ZodNever=k.ZodUnknown=k.ZodAny=k.ZodNull=k.ZodUndefined=k.ZodSymbol=k.ZodDate=k.ZodBoolean=k.ZodBigInt=k.ZodNumber=k.ZodString=k.ZodType=void 0;k.NEVER=k.void=k.unknown=k.union=k.undefined=k.tuple=k.transformer=k.symbol=k.string=k.strictObject=k.set=k.record=k.promise=k.preprocess=k.pipeline=k.ostring=k.optional=k.onumber=k.oboolean=k.object=k.number=k.nullable=k.null=k.never=k.nativeEnum=k.nan=k.map=k.literal=k.lazy=k.intersection=k.instanceof=k.function=k.enum=k.effect=void 0;k.datetimeRegex=E$;k.custom=$$;var q=Yl(),ed=Xl(),X=b$(),E=n_(),D=nc(),ar=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},w$=(t,e)=>{if((0,E.isValid)(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new q.ZodError(t.common.issues);return this._error=r,this._error}}};function ue(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}var le=class{get description(){return this._def.description}_getType(e){return(0,D.getParsedType)(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:(0,D.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new E.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0,D.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if((0,E.isAsync)(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,D.getParsedType)(e)},s=this._parseSync({data:e,path:n.path,parent:n});return w$(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,D.getParsedType)(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>(0,E.isValid)(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0,D.getParsedType)(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await((0,E.isAsync)(s)?s:Promise.resolve(s));return w$(n,o)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{let i=e(s),a=()=>o.addIssue({code:q.ZodIssueCode.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Gt({schema:this,typeName:ie.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ir.create(this,this._def)}nullable(){return Br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mn.create(this)}promise(){return Hn.create(this,this._def)}or(e){return Ws.create([this,e],this._def)}and(e){return Ys.create(this,e,this._def)}transform(e){return new Gt({...ue(this._def),schema:this,typeName:ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ro({...ue(this._def),innerType:this,defaultValue:r,typeName:ie.ZodDefault})}brand(){return new oc({typeName:ie.ZodBranded,type:this,...ue(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new no({...ue(this._def),innerType:this,catchValue:r,typeName:ie.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ic.create(this,e)}readonly(){return so.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};k.ZodType=le;k.Schema=le;k.ZodSchema=le;var bV=/^c[^\s-]{8,}$/i,wV=/^[0-9a-z]+$/,xV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,SV=/^[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,kV=/^[a-z0-9_-]{21}$/i,EV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,TV=/^[-+]?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)?)??$/,$V=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,IV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",s_,OV=/^(?:(?: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])$/,PV=/^(?:(?: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])$/,CV=/^(([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]))$/,NV=/^(([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])$/,AV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,RV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,S$="((\\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])))",jV=new RegExp(`^${S$}$`);function k$(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function zV(t){return new RegExp(`^${k$(t)}$`)}function E$(t){let e=`${S$}T${k$(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function MV(t,e){return!!((e==="v4"||!e)&&OV.test(t)||(e==="v6"||!e)&&CV.test(t))}function LV(t,e){if(!EV.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function qV(t,e){return!!((e==="v4"||!e)&&PV.test(t)||(e==="v6"||!e)&&NV.test(t))}var Vn=class t extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==D.ZodParsedType.string){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.string,received:o.parsedType}),E.INVALID}let n=new E.ParseStatus,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")$V.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"email",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")s_||(s_=new RegExp(IV,"u")),s_.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"emoji",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")SV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"uuid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")kV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"nanoid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")bV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")wV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cuid2",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")xV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ulid",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"url",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"regex",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?E$(o).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?jV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?zV(o).test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?TV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"duration",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?MV(e.data,o.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"ip",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?LV(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"jwt",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?qV(e.data,o.version)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"cidr",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?AV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?RV.test(e.data)||(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{validation:"base64url",code:q.ZodIssueCode.invalid_string,message:o.message}),n.dirty()):D.util.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:q.ZodIssueCode.invalid_string,...X.errorUtil.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...X.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...X.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...X.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...X.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...X.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...X.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...X.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...X.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...X.errorUtil.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...X.errorUtil.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...X.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...X.errorUtil.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...X.errorUtil.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...X.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...X.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...X.errorUtil.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...X.errorUtil.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...X.errorUtil.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...X.errorUtil.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...X.errorUtil.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...X.errorUtil.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...X.errorUtil.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...X.errorUtil.errToObj(r)})}nonempty(e){return this.min(1,X.errorUtil.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};k.ZodString=Vn;Vn.create=t=>new Vn({checks:[],typeName:ie.ZodString,coerce:t?.coerce??!1,...ue(t)});function ZV(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}var Vs=class t extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==D.ZodParsedType.number){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.number,received:o.parsedType}),E.INVALID}let n,s=new E.ParseStatus;for(let o of this._def.checks)o.kind==="int"?D.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?ZV(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.not_finite,message:o.message}),s.dirty()):D.util.assertNever(o);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,X.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,X.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,X.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,X.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:X.errorUtil.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:X.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:X.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:X.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:X.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:X.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:X.errorUtil.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:X.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:X.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:X.errorUtil.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&D.util.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};k.ZodNumber=Vs;Vs.create=t=>new Vs({checks:[],typeName:ie.ZodNumber,coerce:t?.coerce||!1,...ue(t)});var Bs=class t extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==D.ZodParsedType.bigint)return this._getInvalidInput(e);let n,s=new E.ParseStatus;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):D.util.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.bigint,received:r.parsedType}),E.INVALID}gte(e,r){return this.setLimit("min",e,!0,X.errorUtil.toString(r))}gt(e,r){return this.setLimit("min",e,!1,X.errorUtil.toString(r))}lte(e,r){return this.setLimit("max",e,!0,X.errorUtil.toString(r))}lt(e,r){return this.setLimit("max",e,!1,X.errorUtil.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:X.errorUtil.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:X.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:X.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:X.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:X.errorUtil.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:X.errorUtil.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};k.ZodBigInt=Bs;Bs.create=t=>new Bs({checks:[],typeName:ie.ZodBigInt,coerce:t?.coerce??!1,...ue(t)});var Hs=class extends le{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==D.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.boolean,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodBoolean=Hs;Hs.create=t=>new Hs({typeName:ie.ZodBoolean,coerce:t?.coerce||!1,...ue(t)});var Ks=class t extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==D.ZodParsedType.date){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.date,received:o.parsedType}),E.INVALID}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(o,{code:q.ZodIssueCode.invalid_date}),E.INVALID}let n=new E.ParseStatus,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),(0,E.addIssueToContext)(s,{code:q.ZodIssueCode.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):D.util.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:X.errorUtil.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:X.errorUtil.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};k.ZodDate=Ks;Ks.create=t=>new Ks({checks:[],coerce:t?.coerce||!1,typeName:ie.ZodDate,...ue(t)});var mi=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.symbol,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodSymbol=mi;mi.create=t=>new mi({typeName:ie.ZodSymbol,...ue(t)});var Gs=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.undefined,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodUndefined=Gs;Gs.create=t=>new Gs({typeName:ie.ZodUndefined,...ue(t)});var Js=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.null){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.null,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodNull=Js;Js.create=t=>new Js({typeName:ie.ZodNull,...ue(t)});var Bn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,E.OK)(e.data)}};k.ZodAny=Bn;Bn.create=t=>new Bn({typeName:ie.ZodAny,...ue(t)});var hn=class extends le{constructor(){super(...arguments),this._unknown=!0}_parse(e){return(0,E.OK)(e.data)}};k.ZodUnknown=hn;hn.create=t=>new hn({typeName:ie.ZodUnknown,...ue(t)});var Tr=class extends le{_parse(e){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.never,received:r.parsedType}),E.INVALID}};k.ZodNever=Tr;Tr.create=t=>new Tr({typeName:ie.ZodNever,...ue(t)});var gi=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.void,received:n.parsedType}),E.INVALID}return(0,E.OK)(e.data)}};k.ZodVoid=gi;gi.create=t=>new gi({typeName:ie.ZodVoid,...ue(t)});var mn=class t extends le{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==D.ZodParsedType.array)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.array,received:r.parsedType}),E.INVALID;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&((0,E.addIssueToContext)(r,{code:i?q.ZodIssueCode.too_big:q.ZodIssueCode.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&((0,E.addIssueToContext)(r,{code:q.ZodIssueCode.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&((0,E.addIssueToContext)(r,{code:q.ZodIssueCode.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new ar(r,i,r.path,a)))).then(i=>E.ParseStatus.mergeArray(n,i));let o=[...r.data].map((i,a)=>s.type._parseSync(new ar(r,i,r.path,a)));return E.ParseStatus.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:X.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:X.errorUtil.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:X.errorUtil.toString(r)}})}nonempty(e){return this.min(1,e)}};k.ZodArray=mn;mn.create=(t,e)=>new mn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ie.ZodArray,...ue(e)});function hi(t){if(t instanceof Lt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ir.create(hi(n))}return new Lt({...t._def,shape:()=>e})}else return t instanceof mn?new mn({...t._def,type:hi(t.element)}):t instanceof ir?ir.create(hi(t.unwrap())):t instanceof Br?Br.create(hi(t.unwrap())):t instanceof Vr?Vr.create(t.items.map(e=>hi(e))):t}var Lt=class t extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=D.util.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==D.ZodParsedType.object){let u=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(u,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.object,received:u.parsedType}),E.INVALID}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Tr&&this._def.unknownKeys==="strip"))for(let u in s.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=o[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ar(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Tr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&((0,E.addIssueToContext)(s,{code:q.ZodIssueCode.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=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ar(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>E.ParseStatus.mergeObjectSync(n,u)):E.ParseStatus.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return X.errorUtil.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:X.errorUtil.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ie.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of D.util.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of D.util.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return hi(this)}partial(e){let r={};for(let n of D.util.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of D.util.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof ir;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return T$(D.util.objectKeys(this.shape))}};k.ZodObject=Lt;Lt.create=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strip",catchall:Tr.create(),typeName:ie.ZodObject,...ue(e)});Lt.strictCreate=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strict",catchall:Tr.create(),typeName:ie.ZodObject,...ue(e)});Lt.lazycreate=(t,e)=>new Lt({shape:t,unknownKeys:"strip",catchall:Tr.create(),typeName:ie.ZodObject,...ue(e)});var Ws=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(a=>new q.ZodError(a.ctx.common.issues));return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_union,unionErrors:i}),E.INVALID}if(r.common.async)return Promise.all(n.map(async o=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(c=>new q.ZodError(c));return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_union,unionErrors:a}),E.INVALID}}get options(){return this._def.options}};k.ZodUnion=Ws;Ws.create=(t,e)=>new Ws({options:t,typeName:ie.ZodUnion,...ue(e)});var pn=t=>t instanceof Xs?pn(t.schema):t instanceof Gt?pn(t.innerType()):t instanceof Qs?[t.value]:t instanceof eo?t.options:t instanceof to?D.util.objectValues(t.enum):t instanceof ro?pn(t._def.innerType):t instanceof Gs?[void 0]:t instanceof Js?[null]:t instanceof ir?[void 0,...pn(t.unwrap())]:t instanceof Br?[null,...pn(t.unwrap())]:t instanceof oc||t instanceof so?pn(t.unwrap()):t instanceof no?pn(t._def.innerType):[],td=class t extends le{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==D.ZodParsedType.object)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.object,received:r.parsedType}),E.INVALID;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):((0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),E.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let o of r){let i=pn(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,o)}}return new t({typeName:ie.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...ue(n)})}};k.ZodDiscriminatedUnion=td;function o_(t,e){let r=(0,D.getParsedType)(t),n=(0,D.getParsedType)(e);if(t===e)return{valid:!0,data:t};if(r===D.ZodParsedType.object&&n===D.ZodParsedType.object){let s=D.util.objectKeys(e),o=D.util.objectKeys(t).filter(a=>s.indexOf(a)!==-1),i={...t,...e};for(let a of o){let c=o_(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===D.ZodParsedType.array&&n===D.ZodParsedType.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<t.length;o++){let i=t[o],a=e[o],c=o_(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===D.ZodParsedType.date&&n===D.ZodParsedType.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Ys=class extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(o,i)=>{if((0,E.isAborted)(o)||(0,E.isAborted)(i))return E.INVALID;let a=o_(o.value,i.value);return a.valid?(((0,E.isDirty)(o)||(0,E.isDirty)(i))&&r.dirty(),{status:r.value,value:a.data}):((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_intersection_types}),E.INVALID)};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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};k.ZodIntersection=Ys;Ys.create=(t,e,r)=>new Ys({left:t,right:e,typeName:ie.ZodIntersection,...ue(r)});var Vr=class t extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.array)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.array,received:n.parsedType}),E.INVALID;if(n.data.length<this._def.items.length)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new ar(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>E.ParseStatus.mergeArray(r,i)):E.ParseStatus.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};k.ZodTuple=Vr;Vr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vr({items:t,typeName:ie.ZodTuple,rest:null,...ue(e)})};var rd=class t extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.object)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.object,received:n.parsedType}),E.INVALID;let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in n.data)s.push({key:o._parse(new ar(n,a,n.path,a)),value:i._parse(new ar(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?E.ParseStatus.mergeObjectAsync(r,s):E.ParseStatus.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof le?new t({keyType:e,valueType:r,typeName:ie.ZodRecord,...ue(n)}):new t({keyType:Vn.create(),valueType:e,typeName:ie.ZodRecord,...ue(r)})}};k.ZodRecord=rd;var yi=class extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.map)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.map,received:n.parsedType}),E.INVALID;let s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new ar(n,a,n.path,[u,"key"])),value:o._parse(new ar(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return E.INVALID;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return E.INVALID;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};k.ZodMap=yi;yi.create=(t,e,r)=>new yi({valueType:e,keyType:t,typeName:ie.ZodMap,...ue(r)});var _i=class t extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==D.ZodParsedType.set)return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.set,received:n.parsedType}),E.INVALID;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&((0,E.addIssueToContext)(n,{code:q.ZodIssueCode.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return E.INVALID;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new ar(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:X.errorUtil.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:X.errorUtil.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};k.ZodSet=_i;_i.create=(t,e)=>new _i({valueType:t,minSize:null,maxSize:null,typeName:ie.ZodSet,...ue(e)});var nd=class t extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==D.ZodParsedType.function)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.function,received:r.parsedType}),E.INVALID;function n(a,c){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ed.getErrorMap)(),ed.defaultErrorMap].filter(u=>!!u),issueData:{code:q.ZodIssueCode.invalid_arguments,argumentsError:c}})}function s(a,c){return(0,E.makeIssue)({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,(0,ed.getErrorMap)(),ed.defaultErrorMap].filter(u=>!!u),issueData:{code:q.ZodIssueCode.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Hn){let a=this;return(0,E.OK)(async function(...c){let u=new q.ZodError([]),l=await a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(g=>{throw u.addIssue(s(d,g)),u})})}else{let a=this;return(0,E.OK)(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new q.ZodError([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new q.ZodError([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Vr.create(e).rest(hn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Vr.create([]).rest(hn.create()),returns:r||hn.create(),typeName:ie.ZodFunction,...ue(n)})}};k.ZodFunction=nd;var Xs=class extends le{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};k.ZodLazy=Xs;Xs.create=(t,e)=>new Xs({getter:t,typeName:ie.ZodLazy,...ue(e)});var Qs=class extends le{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(r,{received:r.data,code:q.ZodIssueCode.invalid_literal,expected:this._def.value}),E.INVALID}return{status:"valid",value:e.data}}get value(){return this._def.value}};k.ZodLiteral=Qs;Qs.create=(t,e)=>new Qs({value:t,typeName:ie.ZodLiteral,...ue(e)});function T$(t,e){return new eo({values:t,typeName:ie.ZodEnum,...ue(e)})}var eo=class t extends le{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{expected:D.util.joinValues(n),received:r.parsedType,code:q.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return(0,E.addIssueToContext)(r,{received:r.data,code:q.ZodIssueCode.invalid_enum_value,options:n}),E.INVALID}return(0,E.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};k.ZodEnum=eo;eo.create=T$;var to=class extends le{_parse(e){let r=D.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==D.ZodParsedType.string&&n.parsedType!==D.ZodParsedType.number){let s=D.util.objectValues(r);return(0,E.addIssueToContext)(n,{expected:D.util.joinValues(s),received:n.parsedType,code:q.ZodIssueCode.invalid_type}),E.INVALID}if(this._cache||(this._cache=new Set(D.util.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=D.util.objectValues(r);return(0,E.addIssueToContext)(n,{received:n.data,code:q.ZodIssueCode.invalid_enum_value,options:s}),E.INVALID}return(0,E.OK)(e.data)}get enum(){return this._def.values}};k.ZodNativeEnum=to;to.create=(t,e)=>new to({values:t,typeName:ie.ZodNativeEnum,...ue(e)});var Hn=class extends le{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==D.ZodParsedType.promise&&r.common.async===!1)return(0,E.addIssueToContext)(r,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.promise,received:r.parsedType}),E.INVALID;let n=r.parsedType===D.ZodParsedType.promise?r.data:Promise.resolve(r.data);return(0,E.OK)(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};k.ZodPromise=Hn;Hn.create=(t,e)=>new Hn({type:t,typeName:ie.ZodPromise,...ue(e)});var Gt=class extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:i=>{(0,E.addIssueToContext)(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){let i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return E.INVALID;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?E.INVALID:c.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(c.value):c});{if(r.value==="aborted")return E.INVALID;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?E.INVALID:a.status==="dirty"||r.value==="dirty"?(0,E.DIRTY)(a.value):a}}if(s.type==="refinement"){let i=a=>{let c=s.refinement(a,o);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"?E.INVALID:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?E.INVALID:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0,E.isValid)(i))return E.INVALID;let a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>(0,E.isValid)(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):E.INVALID);D.util.assertNever(s)}};k.ZodEffects=Gt;k.ZodTransformer=Gt;Gt.create=(t,e,r)=>new Gt({schema:t,typeName:ie.ZodEffects,effect:e,...ue(r)});Gt.createWithPreprocess=(t,e,r)=>new Gt({schema:e,effect:{type:"preprocess",transform:t},typeName:ie.ZodEffects,...ue(r)});var ir=class extends le{_parse(e){return this._getType(e)===D.ZodParsedType.undefined?(0,E.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};k.ZodOptional=ir;ir.create=(t,e)=>new ir({innerType:t,typeName:ie.ZodOptional,...ue(e)});var Br=class extends le{_parse(e){return this._getType(e)===D.ZodParsedType.null?(0,E.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};k.ZodNullable=Br;Br.create=(t,e)=>new Br({innerType:t,typeName:ie.ZodNullable,...ue(e)});var ro=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===D.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};k.ZodDefault=ro;ro.create=(t,e)=>new ro({innerType:t,typeName:ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ue(e)});var no=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return(0,E.isAsync)(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new q.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new q.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};k.ZodCatch=no;no.create=(t,e)=>new no({innerType:t,typeName:ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ue(e)});var vi=class extends le{_parse(e){if(this._getType(e)!==D.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return(0,E.addIssueToContext)(n,{code:q.ZodIssueCode.invalid_type,expected:D.ZodParsedType.nan,received:n.parsedType}),E.INVALID}return{status:"valid",value:e.data}}};k.ZodNaN=vi;vi.create=t=>new vi({typeName:ie.ZodNaN,...ue(t)});k.BRAND=Symbol("zod_brand");var oc=class extends le{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};k.ZodBranded=oc;var ic=class t extends le{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?E.INVALID:o.status==="dirty"?(r.dirty(),(0,E.DIRTY)(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?E.INVALID:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ie.ZodPipeline})}};k.ZodPipeline=ic;var so=class extends le{_parse(e){let r=this._def.innerType._parse(e),n=s=>((0,E.isValid)(s)&&(s.value=Object.freeze(s.value)),s);return(0,E.isAsync)(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};k.ZodReadonly=so;so.create=(t,e)=>new so({innerType:t,typeName:ie.ZodReadonly,...ue(e)});function x$(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function $$(t,e={},r){return t?Bn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=x$(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=x$(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):Bn.create()}k.late={object:Lt.lazycreate};var ie;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ie||(k.ZodFirstPartyTypeKind=ie={}));var DV=(t,e={message:`Input not instance of ${t.name}`})=>$$(r=>r instanceof t,e);k.instanceof=DV;var I$=Vn.create;k.string=I$;var O$=Vs.create;k.number=O$;var FV=vi.create;k.nan=FV;var UV=Bs.create;k.bigint=UV;var P$=Hs.create;k.boolean=P$;var VV=Ks.create;k.date=VV;var BV=mi.create;k.symbol=BV;var HV=Gs.create;k.undefined=HV;var KV=Js.create;k.null=KV;var GV=Bn.create;k.any=GV;var JV=hn.create;k.unknown=JV;var WV=Tr.create;k.never=WV;var YV=gi.create;k.void=YV;var XV=mn.create;k.array=XV;var QV=Lt.create;k.object=QV;var eB=Lt.strictCreate;k.strictObject=eB;var tB=Ws.create;k.union=tB;var rB=td.create;k.discriminatedUnion=rB;var nB=Ys.create;k.intersection=nB;var sB=Vr.create;k.tuple=sB;var oB=rd.create;k.record=oB;var iB=yi.create;k.map=iB;var aB=_i.create;k.set=aB;var cB=nd.create;k.function=cB;var uB=Xs.create;k.lazy=uB;var lB=Qs.create;k.literal=lB;var dB=eo.create;k.enum=dB;var fB=to.create;k.nativeEnum=fB;var pB=Hn.create;k.promise=pB;var C$=Gt.create;k.effect=C$;k.transformer=C$;var hB=ir.create;k.optional=hB;var mB=Br.create;k.nullable=mB;var gB=Gt.createWithPreprocess;k.preprocess=gB;var yB=ic.create;k.pipeline=yB;var _B=()=>I$().optional();k.ostring=_B;var vB=()=>O$().optional();k.onumber=vB;var bB=()=>P$().optional();k.oboolean=bB;k.coerce={string:(t=>Vn.create({...t,coerce:!0})),number:(t=>Vs.create({...t,coerce:!0})),boolean:(t=>Hs.create({...t,coerce:!0})),bigint:(t=>Bs.create({...t,coerce:!0})),date:(t=>Ks.create({...t,coerce:!0}))};k.NEVER=E.INVALID});var i_=S(cr=>{"use strict";f();var wB=cr&&cr.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),bi=cr&&cr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&wB(e,t,r)};Object.defineProperty(cr,"__esModule",{value:!0});bi(Xl(),cr);bi(n_(),cr);bi(_$(),cr);bi(nc(),cr);bi(N$(),cr);bi(Yl(),cr)});var j$=S(qt=>{"use strict";f();var A$=qt&&qt.__createBinding||(Object.create?(function(t,e,r,n){n===void 0&&(n=r);var s=Object.getOwnPropertyDescriptor(e,r);(!s||("get"in s?!e.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,s)}):(function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]})),xB=qt&&qt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),SB=qt&&qt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&A$(e,t,r);return xB(e,t),e},kB=qt&&qt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&A$(e,t,r)};Object.defineProperty(qt,"__esModule",{value:!0});qt.z=void 0;var R$=SB(i_());qt.z=R$;kB(i_(),qt);qt.default=R$});var wi=S(sd=>{"use strict";f();Object.defineProperty(sd,"__esModule",{value:!0});sd.config=void 0;var oo=j$(),EB=oo.z.object({MCP_SERVER_PORT:oo.z.coerce.number().int().positive().default(3001),MCP_SERVER_HOST:oo.z.string().default("0.0.0.0"),TOOLPILOT_MODE:oo.z.enum(["dev","staging","production"]).default("dev"),TOOLPILOT_API_URL:oo.z.string().default("https://api.neurynae.com"),NODE_ENV:oo.z.enum(["development","test","production"]).default("development"),LOG_LEVEL:oo.z.enum(["fatal","error","warn","info","debug","trace"]).default("info")});function TB(){let t=EB.safeParse(process.env);return t.success||(console.error("\u274C Invalid environment configuration:"),console.error(t.error.format()),process.exit(1)),t.data}sd.config=TB()});var id=S(od=>{"use strict";f();Object.defineProperty(od,"__esModule",{value:!0});od.ErrorCode=void 0;od.ErrorCode={ERR_DB_CONNECTION:"ERR_DB_CONNECTION",ERR_DB_QUERY:"ERR_DB_QUERY",ERR_DB_TIMEOUT:"ERR_DB_TIMEOUT",ERR_DB_CONSTRAINT:"ERR_DB_CONSTRAINT",ERR_DB_NOT_FOUND:"ERR_DB_NOT_FOUND",ERR_VALIDATION_INPUT:"ERR_VALIDATION_INPUT",ERR_VALIDATION_SCHEMA:"ERR_VALIDATION_SCHEMA",ERR_AUTH_TOKEN_EXPIRED:"ERR_AUTH_TOKEN_EXPIRED",ERR_AUTH_UNAUTHORIZED:"ERR_AUTH_UNAUTHORIZED",ERR_AUTH_FORBIDDEN:"ERR_AUTH_FORBIDDEN",ERR_EXTERNAL_GITHUB:"ERR_EXTERNAL_GITHUB",ERR_EXTERNAL_NOMIC:"ERR_EXTERNAL_NOMIC",ERR_EXTERNAL_QDRANT:"ERR_EXTERNAL_QDRANT",ERR_EXTERNAL_MEMGRAPH:"ERR_EXTERNAL_MEMGRAPH",ERR_EXTERNAL_RAZORPAY:"ERR_EXTERNAL_RAZORPAY",ERR_QUEUE_PUBLISH:"ERR_QUEUE_PUBLISH",ERR_QUEUE_CONSUME:"ERR_QUEUE_CONSUME",ERR_QUEUE_TIMEOUT:"ERR_QUEUE_TIMEOUT",ERR_SEARCH_PIPELINE:"ERR_SEARCH_PIPELINE",ERR_SEARCH_EMBEDDING:"ERR_SEARCH_EMBEDDING",ERR_SEARCH_NO_RESULTS:"ERR_SEARCH_NO_RESULTS",ERR_INDEXER_CRAWL:"ERR_INDEXER_CRAWL",ERR_INDEXER_PROCESS:"ERR_INDEXER_PROCESS",ERR_INDEXER_WRITE:"ERR_INDEXER_WRITE",ERR_NETWORK_TIMEOUT:"ERR_NETWORK_TIMEOUT",ERR_NETWORK_UNREACHABLE:"ERR_NETWORK_UNREACHABLE",ERR_MCP_HANDLER:"ERR_MCP_HANDLER",ERR_MCP_AUTH:"ERR_MCP_AUTH",ERR_INTERNAL:"ERR_INTERNAL",ERR_NOT_FOUND:"ERR_NOT_FOUND",ERR_RATE_LIMIT:"ERR_RATE_LIMIT"}});var ad=S(rt=>{"use strict";f();Object.defineProperty(rt,"__esModule",{value:!0});rt.VectorError=rt.IndexerError=rt.SearchError=rt.QueueError=rt.ExternalServiceError=rt.AuthError=rt.ValidationError=rt.NetworkError=rt.DatabaseError=rt.AppError=void 0;var gn=id(),ur=class extends Error{code;httpStatus;severity;isOperational;context;timestamp;constructor(e){super(e.message,{cause:e.cause}),this.name=this.constructor.name,this.code=e.code,this.httpStatus=e.httpStatus??500,this.severity=e.severity??"medium",this.isOperational=e.isOperational??!0,this.context=e.context??{},this.timestamp=new Date().toISOString(),Object.setPrototypeOf(this,new.target.prototype)}toJSON(){return{name:this.name,code:this.code,message:this.message,httpStatus:this.httpStatus,severity:this.severity,isOperational:this.isOperational,context:this.context,timestamp:this.timestamp,stack:this.stack,cause:this.cause instanceof Error?{name:this.cause.name,message:this.cause.message,stack:this.cause.stack}:this.cause}}};rt.AppError=ur;var a_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_DB_QUERY,message:e.message,httpStatus:503,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.DatabaseError=a_;var c_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_NETWORK_TIMEOUT,message:e.message,httpStatus:502,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.NetworkError=c_;var u_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_VALIDATION_INPUT,message:e.message,httpStatus:400,severity:"low",isOperational:!0,cause:e.cause,context:e.context})}};rt.ValidationError=u_;var l_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_AUTH_UNAUTHORIZED,message:e.message,httpStatus:401,severity:"medium",isOperational:!0,cause:e.cause,context:e.context})}};rt.AuthError=l_;var d_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_INTERNAL,message:`[${e.service}] ${e.message}`,httpStatus:502,severity:"high",isOperational:!0,cause:e.cause,context:{...e.context,service:e.service}})}};rt.ExternalServiceError=d_;var f_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_QUEUE_PUBLISH,message:e.message,httpStatus:503,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.QueueError=f_;var p_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_SEARCH_PIPELINE,message:e.message,httpStatus:500,severity:"medium",isOperational:!0,cause:e.cause,context:e.context})}};rt.SearchError=p_;var h_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_INDEXER_PROCESS,message:e.message,httpStatus:500,severity:"medium",isOperational:!0,cause:e.cause,context:e.context})}};rt.IndexerError=h_;var m_=class extends ur{constructor(e){super({code:e.code??gn.ErrorCode.ERR_EXTERNAL_NOMIC,message:e.message,httpStatus:502,severity:"high",isOperational:!0,cause:e.cause,context:e.context})}};rt.VectorError=m_});var y_=S(g_=>{"use strict";f();Object.defineProperty(g_,"__esModule",{value:!0});g_.errorSerializer=IB;var $B=ad();function IB(t){return t instanceof $B.AppError?t.toJSON():t instanceof Error?{name:t.name,message:t.message,stack:t.stack,cause:t.cause instanceof Error?{name:t.cause.name,message:t.cause.message,stack:t.cause.stack}:t.cause}:{message:String(t)}}});var v_=S((Dde,L$)=>{"use strict";f();var ac=t=>t&&typeof t.message=="string",__=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return ac(r)?r:void 0}else return ac(e)?e:void 0},z$=(t,e)=>{if(!ac(t))return"";let r=t.stack||"";if(e.has(t))return r+`
|
|
10
10
|
causes have become circular...`;let n=__(t);return n?(e.add(t),r+`
|
|
11
|
-
caused by: `+j$(n,e)):r},kB=t=>j$(t,new Set),z$=(t,e,r)=>{if(!ac(t))return"";let n=r?"":t.message||"";if(e.has(t))return n+": ...";let s=__(t);if(s){e.add(t);let o=typeof t.cause=="function";return n+(o?"":": ")+z$(s,e,o)}else return n},EB=t=>z$(t,new Set);M$.exports={isErrorLike:ac,getErrorCause:__,stackWithCauses:kB,messageWithCauses:EB}});var b_=S((Mde,q$)=>{"use strict";f();var TB=Symbol("circular-ref-tag"),cd=Symbol("pino-raw-err-ref"),L$=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[cd]},set:function(t){this[cd]=t}}});Object.defineProperty(L$,cd,{writable:!0,value:{}});q$.exports={pinoErrProto:L$,pinoErrorSymbols:{seen:TB,rawSymbol:cd}}});var F$=S((qde,D$)=>{"use strict";f();D$.exports=x_;var{messageWithCauses:$B,stackWithCauses:IB,isErrorLike:Z$}=v_(),{pinoErrProto:PB,pinoErrorSymbols:OB}=b_(),{seen:w_}=OB,{toString:CB}=Object.prototype;function x_(t){if(!Z$(t))return t;t[w_]=void 0;let e=Object.create(PB);e.type=CB.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=$B(t),e.stack=IB(t),Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>x_(r)));for(let r in t)if(e[r]===void 0){let n=t[r];Z$(n)?r!=="cause"&&!Object.prototype.hasOwnProperty.call(n,w_)&&(e[r]=x_(n)):e[r]=n}return delete t[w_],e.raw=t,e}});var V$=S((Dde,U$)=>{"use strict";f();U$.exports=ld;var{isErrorLike:S_}=v_(),{pinoErrProto:AB,pinoErrorSymbols:NB}=b_(),{seen:ud}=NB,{toString:RB}=Object.prototype;function ld(t){if(!S_(t))return t;t[ud]=void 0;let e=Object.create(AB);e.type=RB.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=t.message,e.stack=t.stack,Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>ld(r))),S_(t.cause)&&!Object.prototype.hasOwnProperty.call(t.cause,ud)&&(e.cause=ld(t.cause));for(let r in t)if(e[r]===void 0){let n=t[r];S_(n)?Object.prototype.hasOwnProperty.call(n,ud)||(e[r]=ld(n)):e[r]=n}return delete t[ud],e.raw=t,e}});var G$=S((Ude,K$)=>{"use strict";f();K$.exports={mapHttpRequest:jB,reqSerializer:H$};var k_=Symbol("pino-raw-req-ref"),B$=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[k_]},set:function(t){this[k_]=t}}});Object.defineProperty(B$,k_,{writable:!0,value:{}});function H$(t){let e=t.info||t.socket,r=Object.create(B$);if(r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl)r.url=t.originalUrl;else{let n=t.path;r.url=typeof n=="string"?n:t.url?t.url.path||t.url:void 0}return t.query&&(r.query=t.query),t.params&&(r.params=t.params),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function jB(t){return{req:H$(t)}}});var X$=S((Bde,Y$)=>{"use strict";f();Y$.exports={mapHttpResponse:zB,resSerializer:W$};var E_=Symbol("pino-raw-res-ref"),J$=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[E_]},set:function(t){this[E_]=t}}});Object.defineProperty(J$,E_,{writable:!0,value:{}});function W$(t){let e=Object.create(J$);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function zB(t){return{res:W$(t)}}});var $_=S((Kde,Q$)=>{"use strict";f();var T_=F$(),MB=V$(),dd=G$(),fd=X$();Q$.exports={err:T_,errWithCause:MB,mapHttpRequest:dd.mapHttpRequest,mapHttpResponse:fd.mapHttpResponse,req:dd.reqSerializer,res:fd.resSerializer,wrapErrorSerializer:function(e){return e===T_?e:function(n){return e(T_(n))}},wrapRequestSerializer:function(e){return e===dd.reqSerializer?e:function(n){return e(dd.reqSerializer(n))}},wrapResponseSerializer:function(e){return e===fd.resSerializer?e:function(n){return e(fd.resSerializer(n))}}}});var I_=S((Jde,eI)=>{"use strict";f();function LB(t,e){return e}eI.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=LB;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let n=r.slice(2),s=[];for(let o of n)o&&s.push(o.getFileName());return s}});var iI=S((Yde,oI)=>{"use strict";f();function P_(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){let e=[];for(let r=0;r<t.length;r++)e[r]=P_(t[r]);return e}if(typeof t=="object"){let e=Object.create(Object.getPrototypeOf(t));for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=P_(t[r]));return e}return t}function tI(t){let e=[],r="",n=!1,s=!1,o="";for(let i=0;i<t.length;i++){let a=t[i];!n&&a==="."?r&&(e.push(r),r=""):a==="["?(r&&(e.push(r),r=""),n=!0):a==="]"&&n?(e.push(r),r="",n=!1,s=!1):(a==='"'||a==="'")&&n?s?a===o?(s=!1,o=""):r+=a:(s=!0,o=a):r+=a}return r&&e.push(r),e}function rI(t,e,r){let n=t;for(let o=0;o<e.length-1;o++){let i=e[o];if(typeof n!="object"||n===null||!(i in n)||typeof n[i]!="object"||n[i]===null)return!1;n=n[i]}let s=e[e.length-1];if(s==="*"){if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o]=r;else if(typeof n=="object"&&n!==null)for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=r)}else typeof n=="object"&&n!==null&&s in n&&Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=r);return!0}function nI(t,e){let r=t;for(let s=0;s<e.length-1;s++){let o=e[s];if(typeof r!="object"||r===null||!(o in r)||typeof r[o]!="object"||r[o]===null)return!1;r=r[o]}let n=e[e.length-1];if(n==="*"){if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=void 0;else if(typeof r=="object"&&r!==null)for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&delete r[s]}else typeof r=="object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var pd=Symbol("PATH_NOT_FOUND");function qB(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||r===null||!(n in r))return pd;r=r[n]}return r}function ZB(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function DB(t,e,r,n=!1){for(let s of e){let o=tI(s);if(o.includes("*"))sI(t,o,r,s,n);else if(n)nI(t,o);else{let i=qB(t,o);if(i===pd)continue;let a=typeof r=="function"?r(i,o):r;rI(t,o,a)}}}function sI(t,e,r,n,s=!1){let o=e.indexOf("*");if(o===e.length-1){let i=e.slice(0,-1),a=t;for(let c of i){if(a==null||typeof a!="object"||a===null)return;a=a[c]}if(Array.isArray(a))if(s)for(let c=0;c<a.length;c++)a[c]=void 0;else for(let c=0;c<a.length;c++){let u=[...i,c.toString()],l=typeof r=="function"?r(a[c],u):r;a[c]=l}else if(typeof a=="object"&&a!==null)if(s){let c=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&c.push(u);for(let u of c)delete a[u]}else for(let c in a){let u=[...i,c],l=typeof r=="function"?r(a[c],u):r;a[c]=l}}else FB(t,e,r,o,n,s)}function FB(t,e,r,n,s,o=!1){let i=e.slice(0,n),a=e.slice(n+1),c=[];function u(l,d){if(d===i.length){if(Array.isArray(l))for(let p=0;p<l.length;p++)c[d]=p.toString(),u(l[p],d+1);else if(typeof l=="object"&&l!==null)for(let p in l)c[d]=p,u(l[p],d+1)}else if(d<i.length){let p=i[d];l&&typeof l=="object"&&l!==null&&p in l&&(c[d]=p,u(l[p],d+1))}else if(a.includes("*"))sI(l,a,typeof r=="function"?(g,h)=>{let m=[...c.slice(0,d),...h];return r(g,m)}:r,s,o);else if(o)nI(l,a);else{let p=typeof r=="function"?r(ZB(l,a),[...c.slice(0,d),...a]):r;rI(l,a,p)}}if(i.length===0)u(t,0);else{let l=t;for(let d=0;d<i.length;d++){let p=i[d];if(l==null||typeof l!="object"||l===null)return;l=l[p],c[d]=p}l!=null&&u(l,i.length)}}function UB(t){if(t.length===0)return null;let e=new Map;for(let r of t){let n=tI(r),s=e;for(let o=0;o<n.length;o++){let i=n[o];s.has(i)||s.set(i,new Map),s=s.get(i)}}return e}function VB(t,e){if(!e)return t;function r(n,s,o=0){if(!s||s.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(Array.isArray(n)){let a=[];for(let c=0;c<n.length;c++){let u=c.toString();s.has(u)||s.has("*")?a[c]=r(n[c],s.get(u)||s.get("*")):a[c]=n[c]}return a}let i=Object.create(Object.getPrototypeOf(n));for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(s.has(a)||s.has("*")?i[a]=r(n[a],s.get(a)||s.get("*")):i[a]=n[a]);return i}return r(t,e)}function BB(t){if(typeof t!="string")throw new Error("Paths must be (non-empty) strings");if(t==="")throw new Error("Invalid redaction path ()");if(t.includes(".."))throw new Error(`Invalid redaction path (${t})`);if(t.includes(","))throw new Error(`Invalid redaction path (${t})`);let e=0,r=!1,n="";for(let s=0;s<t.length;s++){let o=t[s];if((o==='"'||o==="'")&&e>0)r?o===n&&(r=!1,n=""):(r=!0,n=o);else if(o==="["&&!r)e++;else if(o==="]"&&!r&&(e--,e<0))throw new Error(`Invalid redaction path (${t})`)}if(e!==0)throw new Error(`Invalid redaction path (${t})`)}function HB(t){if(!Array.isArray(t))throw new TypeError("paths must be an array");for(let e of t)BB(e)}function KB(t={}){let{paths:e=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:s=!0,remove:o=!1}=t;HB(e);let i=UB(e);return function(c){if(s&&(c===null||typeof c!="object")&&(c==null||typeof c!="object"))return n?n(c):c;let u=VB(c,i),l=c,d=r;return typeof r=="function"&&(d=r),DB(u,e,d,o),n===!1?(u.restore=function(){return P_(l)},u):typeof n=="function"?n(u):JSON.stringify(u)}}oI.exports=KB});var xi=S((Qde,aI)=>{"use strict";f();var GB=Symbol("pino.setLevel"),JB=Symbol("pino.getLevel"),WB=Symbol("pino.levelVal"),YB=Symbol("pino.levelComp"),XB=Symbol("pino.useLevelLabels"),QB=Symbol("pino.useOnlyCustomLevels"),eH=Symbol("pino.mixin"),tH=Symbol("pino.lsCache"),rH=Symbol("pino.chindings"),nH=Symbol("pino.asJson"),sH=Symbol("pino.write"),oH=Symbol("pino.redactFmt"),iH=Symbol("pino.time"),aH=Symbol("pino.timeSliceIndex"),cH=Symbol("pino.stream"),uH=Symbol("pino.stringify"),lH=Symbol("pino.stringifySafe"),dH=Symbol("pino.stringifiers"),fH=Symbol("pino.end"),pH=Symbol("pino.formatOpts"),hH=Symbol("pino.messageKey"),mH=Symbol("pino.errorKey"),gH=Symbol("pino.nestedKey"),yH=Symbol("pino.nestedKeyStr"),_H=Symbol("pino.mixinMergeStrategy"),vH=Symbol("pino.msgPrefix"),bH=Symbol("pino.wildcardFirst"),wH=Symbol.for("pino.serializers"),xH=Symbol.for("pino.formatters"),SH=Symbol.for("pino.hooks"),kH=Symbol.for("pino.metadata");aI.exports={setLevelSym:GB,getLevelSym:JB,levelValSym:WB,levelCompSym:YB,useLevelLabelsSym:XB,mixinSym:eH,lsCacheSym:tH,chindingsSym:rH,asJsonSym:nH,writeSym:sH,serializersSym:wH,redactFmtSym:oH,timeSym:iH,timeSliceIndexSym:aH,streamSym:cH,stringifySym:uH,stringifySafeSym:lH,stringifiersSym:dH,endSym:fH,formatOptsSym:pH,messageKeySym:hH,errorKeySym:mH,nestedKeySym:gH,wildcardFirstSym:bH,needsMetadataGsym:kH,useOnlyCustomLevelsSym:QB,formattersSym:xH,hooksSym:SH,nestedKeyStrSym:yH,mixinMergeStrategySym:_H,msgPrefixSym:vH}});var C_=S((tfe,dI)=>{"use strict";f();var cI=iI(),{redactFmtSym:EH,wildcardFirstSym:hd}=xi(),O_=/[^.[\]]+|\[([^[\]]*?)\]/g,uI="[Redacted]",lI=!1;function TH(t,e){let{paths:r,censor:n,remove:s}=$H(t),o=r.reduce((c,u)=>{O_.lastIndex=0;let l=O_.exec(u),d=O_.exec(u),p=l[1]!==void 0?l[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):l[0];if(p==="*"&&(p=hd),d===null)return c[p]=null,c;if(c[p]===null)return c;let{index:g}=d,h=`${u.substr(g,u.length-1)}`;return c[p]=c[p]||[],p!==hd&&c[p].length===0&&c[p].push(...c[hd]||[]),p===hd&&Object.keys(c).forEach(function(m){c[m]&&c[m].push(h)}),c[p].push(h),c},{}),i={[EH]:cI({paths:r,censor:n,serialize:e,strict:lI,remove:s})},a=(...c)=>e(typeof n=="function"?n(...c):n);return[...Object.keys(o),...Object.getOwnPropertySymbols(o)].reduce((c,u)=>{if(o[u]===null)c[u]=l=>a(l,[u]);else{let l=typeof n=="function"?(d,p)=>n(d,[u,...p]):n;c[u]=cI({paths:o[u],censor:l,serialize:e,strict:lI,remove:s})}return c},i)}function $H(t){if(Array.isArray(t))return t={paths:t,censor:uI},t;let{paths:e,censor:r=uI,remove:n}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return n===!0&&(r=void 0),{paths:e,censor:r,remove:n}}dI.exports=TH});var hI=S((nfe,pI)=>{"use strict";f();var IH=()=>"",PH=()=>`,"time":${Date.now()}`,OH=()=>`,"time":${Math.round(Date.now()/1e3)}`,CH=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,AH=1000000n,fI=1000000000n,NH=BigInt(Date.now())*AH,RH=process.hrtime.bigint(),jH=()=>{let t=process.hrtime.bigint()-RH,e=NH+t,r=e/fI,n=e%fI,s=Number(r*1000n+n/1000000n),o=new Date(s),i=o.getUTCFullYear(),a=(o.getUTCMonth()+1).toString().padStart(2,"0"),c=o.getUTCDate().toString().padStart(2,"0"),u=o.getUTCHours().toString().padStart(2,"0"),l=o.getUTCMinutes().toString().padStart(2,"0"),d=o.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${i}-${a}-${c}T${u}:${l}:${d}.${n.toString().padStart(9,"0")}Z"`};pI.exports={nullTime:IH,epochTime:PH,unixTime:OH,isoTime:CH,isoTimeNano:jH}});var gI=S((ofe,mI)=>{"use strict";f();function zH(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}mI.exports=MH;function MH(t,e,r){var n=r&&r.stringify||zH,s=1;if(typeof t=="object"&&t!==null){var o=e.length+s;if(o===1)return t;var i=new Array(o);i[0]=n(t);for(var a=1;a<o;a++)i[a]=n(e[a]);return i.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",l=1-s,d=-1,p=t&&t.length||0,g=0;g<p;){if(t.charCodeAt(g)===37&&g+1<p){switch(d=d>-1?d:0,t.charCodeAt(g+1)){case 100:case 102:if(l>=c||e[l]==null)break;d<g&&(u+=t.slice(d,g)),u+=Number(e[l]),d=g+2,g++;break;case 105:if(l>=c||e[l]==null)break;d<g&&(u+=t.slice(d,g)),u+=Math.floor(Number(e[l])),d=g+2,g++;break;case 79:case 111:case 106:if(l>=c||e[l]===void 0)break;d<g&&(u+=t.slice(d,g));var h=typeof e[l];if(h==="string"){u+="'"+e[l]+"'",d=g+2,g++;break}if(h==="function"){u+=e[l].name||"<anonymous>",d=g+2,g++;break}u+=n(e[l]),d=g+2,g++;break;case 115:if(l>=c)break;d<g&&(u+=t.slice(d,g)),u+=String(e[l]),d=g+2,g++;break;case 37:d<g&&(u+=t.slice(d,g)),u+="%",d=g+2,g++,l--;break}++l}++g}return d===-1?t:(d<p&&(u+=t.slice(d)),u)}});var N_=S((afe,A_)=>{"use strict";f();if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));A_.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(e);for(;n>Date.now(););};A_.exports=t}});var kI=S((ufe,SI)=>{"use strict";f();var He=Te("fs"),LH=Te("events"),qH=Te("util").inherits,yI=Te("path"),j_=N_(),ZH=Te("assert"),md=100,gd=Buffer.allocUnsafe(0),DH=16*1024,_I="buffer",vI="utf8",[FH,UH]=(process.versions.node||"0.0").split(".").map(Number),VH=FH>=22&&UH>=7;function bI(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(o,i){if(o){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",o)}):e.emit("error",o);return}let a=e._reopening;e.fd=i,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e.destroyed&&(!e._writing&&e._len>e.minLength||e._flushPending?e._actualWrite():a&&process.nextTick(()=>e.emit("drain")))}let n=e.append?"a":"w",s=e.mode;if(e.sync)try{e.mkdir&&He.mkdirSync(yI.dirname(t),{recursive:!0});let o=He.openSync(t,n,s);r(null,o)}catch(o){throw r(o),o}else e.mkdir?He.mkdir(yI.dirname(t),{recursive:!0},o=>{if(o)return r(o);He.open(t,n,s,r)}):He.open(t,n,s,r)}function $r(t){if(!(this instanceof $r))return new $r(t);let{fd:e,dest:r,minLength:n,maxLength:s,maxWrite:o,periodicFlush:i,sync:a,append:c=!0,mkdir:u,retryEAGAIN:l,fsync:d,contentMode:p,mode:g}=t||{};e=e||r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=s||0,this.maxWrite=o||DH,this._periodicFlush=i||0,this._periodicFlushTimer=void 0,this.sync=a||!1,this.writable=!0,this._fsync=d||!1,this.append=c||!1,this.mode=g,this.retryEAGAIN=l||(()=>!0),this.mkdir=u||!1;let h,m;if(p===_I)this._writingBuf=gd,this.write=KH,this.flush=JH,this.flushSync=YH,this._actualWrite=QH,h=()=>He.writeSync(this.fd,this._writingBuf),m=()=>He.write(this.fd,this._writingBuf,this.release);else if(p===void 0||p===vI)this._writingBuf="",this.write=HH,this.flush=GH,this.flushSync=WH,this._actualWrite=XH,h=()=>Buffer.isBuffer(this._writingBuf)?He.writeSync(this.fd,this._writingBuf):He.writeSync(this.fd,this._writingBuf,"utf8"),m=()=>Buffer.isBuffer(this._writingBuf)?He.write(this.fd,this._writingBuf,this.release):He.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${vI}" and "${_I}", but passed ${p}`);if(typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")bI(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(_,b)=>{if(_){if((_.code==="EAGAIN"||_.code==="EBUSY")&&this.retryEAGAIN(_,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{j_(md),this.release(void 0,0)}catch(T){this.release(T)}else setTimeout(m,md);else this._writing=!1,this.emit("error",_);return}this.emit("write",b);let w=R_(this._writingBuf,this._len,b);if(this._len=w.len,this._writingBuf=w.writingBuf,this._writingBuf.length){if(!this.sync){m();return}try{do{let T=h(),P=R_(this._writingBuf,this._len,T);this._len=P.len,this._writingBuf=P.writingBuf}while(this._writingBuf.length)}catch(T){this.release(T);return}}this._fsync&&He.fsyncSync(this.fd);let x=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):x>this.minLength?this._actualWrite():this._ending?x>0?this._actualWrite():(this._writing=!1,yd(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(BH,this)):this.emit("drain"))},this.on("newListener",function(_){_==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function R_(t,e,r){return typeof t=="string"&&(t=Buffer.from(t)),e=Math.max(e-r,0),t=t.subarray(r),{writingBuf:t,len:e}}function BH(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}qH($r,LH);function wI(t,e){return t.length===0?gd:t.length===1?t[0]:Buffer.concat(t,e)}function HH(t){if(this.destroyed)throw new Error("SonicBoom destroyed");t=""+t;let e=Buffer.byteLength(t),r=this._len+e,n=this._bufs;return this.maxLength&&r>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(n.length===0||Buffer.byteLength(n[n.length-1])+e>this.maxWrite?n.push(t):n[n.length-1]+=t,this._len=r,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function KH(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs,n=this._lens;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||n[n.length-1]+t.length>this.maxWrite?(r.push([t]),n.push(t.length)):(r[r.length-1].push(t),n[n.length-1]+=t.length),this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function xI(t){this._flushPending=!0;let e=()=>{if(this._fsync)this._flushPending=!1,t();else try{He.fsync(this.fd,n=>{this._flushPending=!1,t(n)})}catch(n){t(n)}this.off("error",r)},r=n=>{this._flushPending=!1,t(n),this.off("drain",e)};this.once("drain",e),this.once("error",r)}function GH(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&xI.call(this,t),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function JH(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&xI.call(this,t),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}$r.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(t&&(this.file=t),this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&He.close(e,r=>{if(r)return this.emit("error",r)})}),bI(this.file,this)};$r.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():yd(this)))};function WH(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let t="";for(;this._bufs.length||t.length;){t.length<=0&&(t=this._bufs[0]);try{let e=Buffer.isBuffer(t)?He.writeSync(this.fd,t):He.writeSync(this.fd,t,"utf8"),r=R_(t,this._len,e);t=r.writingBuf,this._len=r.len,t.length<=0&&this._bufs.shift()}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;j_(md)}}try{He.fsyncSync(this.fd)}catch{}}function YH(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=gd);let t=gd;for(;this._bufs.length||t.length;){t.length<=0&&(t=wI(this._bufs[0],this._lens[0]));try{let e=He.writeSync(this.fd,t);t=t.subarray(e),this._len=Math.max(this._len-e,0),t.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;j_(md)}}}$r.prototype.destroy=function(){this.destroyed||yd(this)};function XH(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",this.sync)try{let e=Buffer.isBuffer(this._writingBuf)?He.writeSync(this.fd,this._writingBuf):He.writeSync(this.fd,this._writingBuf,"utf8");t(null,e)}catch(e){t(e)}else He.write(this.fd,this._writingBuf,t)}function QH(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:wI(this._bufs.shift(),this._lens.shift()),this.sync)try{let e=He.writeSync(this.fd,this._writingBuf);t(null,e)}catch(e){t(e)}else VH&&(this._writingBuf=Buffer.from(this._writingBuf)),He.write(this.fd,this._writingBuf,t)}function yd(t){if(t.fd===-1){t.once("ready",yd.bind(null,t));return}t._periodicFlushTimer!==void 0&&clearInterval(t._periodicFlushTimer),t.destroyed=!0,t._bufs=[],t._lens=[],ZH(typeof t.fd=="number",`sonic.fd must be a number, got ${typeof t.fd}`);try{He.fsync(t.fd,e)}catch{}function e(){t.fd!==1&&t.fd!==2?He.close(t.fd,r):r()}function r(n){if(n){t.emit("error",n);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}}$r.SonicBoom=$r;$r.default=$r;SI.exports=$r});var z_=S((dfe,PI)=>{"use strict";f();var Ir={exit:[],beforeExit:[]},EI={exit:r6,beforeExit:n6},Si;function e6(){Si===void 0&&(Si=new FinalizationRegistry(s6))}function t6(t){Ir[t].length>0||process.on(t,EI[t])}function TI(t){Ir[t].length>0||(process.removeListener(t,EI[t]),Ir.exit.length===0&&Ir.beforeExit.length===0&&(Si=void 0))}function r6(){$I("exit")}function n6(){$I("beforeExit")}function $I(t){for(let e of Ir[t]){let r=e.deref(),n=e.fn;r!==void 0&&n(r,t)}Ir[t]=[]}function s6(t){for(let e of["exit","beforeExit"]){let r=Ir[e].indexOf(t);Ir[e].splice(r,r+1),TI(e)}}function II(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");t6(t);let n=new WeakRef(e);n.fn=r,e6(),Si.register(e,n),Ir[t].push(n)}function o6(t,e){II("exit",t,e)}function i6(t,e){II("beforeExit",t,e)}function a6(t){if(Si!==void 0){Si.unregister(t);for(let e of["exit","beforeExit"])Ir[e]=Ir[e].filter(r=>{let n=r.deref();return n&&n!==t}),TI(e)}}PI.exports={register:o6,registerBeforeExit:i6,unregister:a6}});var OI=S((pfe,c6)=>{c6.exports={name:"thread-stream",version:"3.1.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^20.1.0","@types/tap":"^15.0.0","@yao-pkg/pkg":"^5.11.5",desm:"^1.3.0",fastbench:"^1.0.1",husky:"^9.0.6","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1",standard:"^17.0.0",tap:"^16.2.0","ts-node":"^10.8.0",typescript:"^5.3.2","why-is-node-running":"^2.2.2"},scripts:{build:"tsc --noEmit",test:'standard && npm run build && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',"test:ci":"standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts","test:ci:js":'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',"test:ci:ts":'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',"test:yarn":'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},standard:{ignore:["test/ts/**/*","test/syntax-error.mjs"]},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var AI=S((hfe,CI)=>{"use strict";f();function u6(t,e,r,n,s){let o=Date.now()+n,i=Atomics.load(t,e);if(i===r){s(null,"ok");return}let a=i,c=u=>{Date.now()>o?s(null,"timed-out"):setTimeout(()=>{a=i,i=Atomics.load(t,e),i===a?c(u>=1e3?1e3:u*2):i===r?s(null,"ok"):s(null,"not-equal")},u)};c(1)}function l6(t,e,r,n,s){let o=Date.now()+n,i=Atomics.load(t,e);if(i!==r){s(null,"ok");return}let a=c=>{Date.now()>o?s(null,"timed-out"):setTimeout(()=>{i=Atomics.load(t,e),i!==r?s(null,"ok"):a(c>=1e3?1e3:c*2)},c)};a(1)}CI.exports={wait:u6,waitDiff:l6}});var RI=S((gfe,NI)=>{"use strict";f();NI.exports={WRITE_INDEX:4,READ_INDEX:8}});var qI=S((_fe,LI)=>{"use strict";f();var{version:d6}=OI(),{EventEmitter:f6}=Te("events"),{Worker:p6}=Te("worker_threads"),{join:h6}=Te("path"),{pathToFileURL:m6}=Te("url"),{wait:g6}=AI(),{WRITE_INDEX:Zt,READ_INDEX:Hr}=RI(),y6=Te("buffer"),_6=Te("assert"),A=Symbol("kImpl"),v6=y6.constants.MAX_STRING_LENGTH,cc=class{constructor(e){this._value=e}deref(){return this._value}},vd=class{register(){}unregister(){}},b6=process.env.NODE_V8_COVERAGE?vd:global.FinalizationRegistry||vd,w6=process.env.NODE_V8_COVERAGE?cc:global.WeakRef||cc,jI=new b6(t=>{t.exited||t.terminate()});function x6(t,e){let{filename:r,workerData:n}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||h6(y,"lib","worker.js"),i=new p6(o,{...e.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:m6(r).href,dataBuf:t[A].dataBuf,stateBuf:t[A].stateBuf,workerData:{$context:{threadStreamVersion:d6},...n}}});return i.stream=new cc(t),i.on("message",S6),i.on("exit",MI),jI.register(t,i),i}function zI(t){_6(!t[A].sync),t[A].needDrain&&(t[A].needDrain=!1,t.emit("drain"))}function _d(t){let e=Atomics.load(t[A].state,Zt),r=t[A].data.length-e;if(r>0){if(t[A].buf.length===0){t[A].flushing=!1,t[A].ending?D_(t):t[A].needDrain&&process.nextTick(zI,t);return}let n=t[A].buf.slice(0,r),s=Buffer.byteLength(n);s<=r?(t[A].buf=t[A].buf.slice(r),bd(t,n,_d.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[A].state,Hr,0),Atomics.store(t[A].state,Zt,0);s>t[A].data.length;)r=r/2,n=t[A].buf.slice(0,r),s=Buffer.byteLength(n);t[A].buf=t[A].buf.slice(r),bd(t,n,_d.bind(null,t))}})}else if(r===0){if(e===0&&t[A].buf.length===0)return;t.flush(()=>{Atomics.store(t[A].state,Hr,0),Atomics.store(t[A].state,Zt,0),_d(t)})}else Kr(t,new Error("overwritten"))}function S6(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new w6(e),e.flush(()=>{e[A].ready=!0,e.emit("ready")});break;case"ERROR":Kr(e,t.err);break;case"EVENT":Array.isArray(t.args)?e.emit(t.name,...t.args):e.emit(t.name,t.args);break;case"WARNING":process.emitWarning(t.err);break;default:Kr(e,new Error("this should not happen: "+t.code))}}function MI(t){let e=this.stream.deref();e!==void 0&&(jI.unregister(e),e.worker.exited=!0,e.worker.off("exit",MI),Kr(e,t!==0?new Error("the worker thread exited"):null))}var L_=class extends f6{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[A]={},this[A].stateBuf=new SharedArrayBuffer(128),this[A].state=new Int32Array(this[A].stateBuf),this[A].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[A].data=Buffer.from(this[A].dataBuf),this[A].sync=e.sync||!1,this[A].ending=!1,this[A].ended=!1,this[A].needDrain=!1,this[A].destroyed=!1,this[A].flushing=!1,this[A].ready=!1,this[A].finished=!1,this[A].errored=null,this[A].closed=!1,this[A].buf="",this.worker=x6(this,e),this.on("message",(r,n)=>{this.worker.postMessage(r,n)})}write(e){if(this[A].destroyed)return q_(this,new Error("the worker has exited")),!1;if(this[A].ending)return q_(this,new Error("the worker is ending")),!1;if(this[A].flushing&&this[A].buf.length+e.length>=v6)try{M_(this),this[A].flushing=!0}catch(r){return Kr(this,r),!1}if(this[A].buf+=e,this[A].sync)try{return M_(this),!0}catch(r){return Kr(this,r),!1}return this[A].flushing||(this[A].flushing=!0,setImmediate(_d,this)),this[A].needDrain=this[A].data.length-this[A].buf.length-Atomics.load(this[A].state,Zt)<=0,!this[A].needDrain}end(){this[A].destroyed||(this[A].ending=!0,D_(this))}flush(e){if(this[A].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[A].state,Zt);g6(this[A].state,Hr,r,1/0,(n,s)=>{if(n){Kr(this,n),process.nextTick(e,n);return}if(s==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[A].destroyed||(M_(this),Z_(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[A].ready}get destroyed(){return this[A].destroyed}get closed(){return this[A].closed}get writable(){return!this[A].destroyed&&!this[A].ending}get writableEnded(){return this[A].ending}get writableFinished(){return this[A].finished}get writableNeedDrain(){return this[A].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[A].errored}};function q_(t,e){setImmediate(()=>{t.emit("error",e)})}function Kr(t,e){t[A].destroyed||(t[A].destroyed=!0,e&&(t[A].errored=e,q_(t,e)),t.worker.exited?setImmediate(()=>{t[A].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[A].closed=!0,t.emit("close")}))}function bd(t,e,r){let n=Atomics.load(t[A].state,Zt),s=Buffer.byteLength(e);return t[A].data.write(e,n),Atomics.store(t[A].state,Zt,n+s),Atomics.notify(t[A].state,Zt),r(),!0}function D_(t){if(!(t[A].ended||!t[A].ending||t[A].flushing)){t[A].ended=!0;try{t.flushSync();let e=Atomics.load(t[A].state,Hr);Atomics.store(t[A].state,Zt,-1),Atomics.notify(t[A].state,Zt);let r=0;for(;e!==-1;){if(Atomics.wait(t[A].state,Hr,e,1e3),e=Atomics.load(t[A].state,Hr),e===-2){Kr(t,new Error("end() failed"));return}if(++r===10){Kr(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[A].finished=!0,t.emit("finish")})}catch(e){Kr(t,e)}}}function M_(t){let e=()=>{t[A].ending?D_(t):t[A].needDrain&&process.nextTick(zI,t)};for(t[A].flushing=!1;t[A].buf.length!==0;){let r=Atomics.load(t[A].state,Zt),n=t[A].data.length-r;if(n===0){Z_(t),Atomics.store(t[A].state,Hr,0),Atomics.store(t[A].state,Zt,0);continue}else if(n<0)throw new Error("overwritten");let s=t[A].buf.slice(0,n),o=Buffer.byteLength(s);if(o<=n)t[A].buf=t[A].buf.slice(n),bd(t,s,e);else{for(Z_(t),Atomics.store(t[A].state,Hr,0),Atomics.store(t[A].state,Zt,0);o>t[A].buf.length;)n=n/2,s=t[A].buf.slice(0,n),o=Buffer.byteLength(s);t[A].buf=t[A].buf.slice(n),bd(t,s,e)}}}function Z_(t){if(t[A].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[A].state,Zt),r=0;for(;;){let n=Atomics.load(t[A].state,Hr);if(n===-2)throw Error("_flushSync failed");if(n!==e)Atomics.wait(t[A].state,Hr,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}LI.exports=L_});var V_=S((bfe,ZI)=>{"use strict";f();var{createRequire:k6}=Te("module"),E6=I_(),{join:F_,isAbsolute:T6,sep:$6}=Te("path"),I6=N_(),U_=z_(),P6=qI();function O6(t){U_.register(t,A6),U_.registerBeforeExit(t,N6),t.on("close",function(){U_.unregister(t)})}function C6(t,e,r,n){let s=new P6({filename:t,workerData:e,workerOpts:r,sync:n});s.on("ready",o),s.on("close",function(){process.removeListener("exit",i)}),process.on("exit",i);function o(){process.removeListener("exit",i),s.unref(),r.autoEnd!==!1&&O6(s)}function i(){s.closed||(s.flushSync(),I6(100),s.end())}return s}function A6(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function N6(t){t.flushSync()}function R6(t){let{pipeline:e,targets:r,levels:n,dedupe:s,worker:o={},caller:i=E6(),sync:a=!1}=t,c={...t.options},u=typeof i=="string"?[i]:i,l="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},d=t.target;if(d&&r)throw new Error("only one of target or targets can be specified");return r?(d=l["pino-worker"]||F_(y,"worker.js"),c.targets=r.filter(g=>g.target).map(g=>({...g,target:p(g.target)})),c.pipelines=r.filter(g=>g.pipeline).map(g=>g.pipeline.map(h=>({...h,level:g.level,target:p(h.target)})))):e&&(d=l["pino-worker"]||F_(y,"worker.js"),c.pipelines=[e.map(g=>({...g,target:p(g.target)}))]),n&&(c.levels=n),s&&(c.dedupe=s),c.pinoWillSendConfig=!0,C6(p(d),c,o,a);function p(g){if(g=l[g]||g,T6(g)||g.indexOf("file://")===0)return g;if(g==="pino/file")return F_(y,"..","file.js");let h;for(let m of u)try{let _=m==="node:repl"?process.cwd()+$6:m;h=k6(_).resolve(g);break}catch{continue}if(!h)throw new Error(`unable to determine transport target for "${g}"`);return h}}ZI.exports=R6});var kd=S((xfe,QI)=>{"use strict";f();var DI=Te("diagnostics_channel"),FI=gI(),{mapHttpRequest:j6,mapHttpResponse:z6}=$_(),H_=kI(),UI=z_(),{lsCacheSym:M6,chindingsSym:KI,writeSym:VI,serializersSym:GI,formatOptsSym:BI,endSym:L6,stringifiersSym:JI,stringifySym:WI,stringifySafeSym:K_,wildcardFirstSym:YI,nestedKeySym:q6,formattersSym:XI,messageKeySym:Z6,errorKeySym:D6,nestedKeyStrSym:F6,msgPrefixSym:wd}=xi(),{isMainThread:U6}=Te("worker_threads"),V6=V_(),Sd;typeof DI.tracingChannel=="function"?Sd=DI.tracingChannel("pino_asJson"):Sd={hasSubscribers:!1,traceSync(t,e,r,...n){return t.call(r,...n)}};function ki(){}function B6(t,e){if(!e)return r;return function(...s){e.call(this,s,r,t)};function r(n,...s){if(typeof n=="object"){let o=n;n!==null&&(n.method&&n.headers&&n.socket?n=j6(n):typeof n.setHeader=="function"&&(n=z6(n)));let i;o===null&&s.length===0?i=[null]:(o=s.shift(),i=s),typeof this[wd]=="string"&&o!==void 0&&o!==null&&(o=this[wd]+o),this[VI](n,FI(o,i,this[BI]),t)}else{let o=n===void 0?s.shift():n;typeof this[wd]=="string"&&o!==void 0&&o!==null&&(o=this[wd]+o),this[VI](null,FI(o,s,this[BI]),t)}}}function B_(t){let e="",r=0,n=!1,s=255,o=t.length;if(o>100)return JSON.stringify(t);for(var i=0;i<o&&s>=32;i++)s=t.charCodeAt(i),(s===34||s===92)&&(e+=t.slice(r,i)+"\\",r=i,n=!0);return n?e+=t.slice(r):e=t,s<32?JSON.stringify(t):'"'+e+'"'}function H6(t,e,r,n){if(Sd.hasSubscribers===!1)return HI.call(this,t,e,r,n);let s={instance:this,arguments};return Sd.traceSync(HI,s,this,t,e,r,n)}function HI(t,e,r,n){let s=this[WI],o=this[K_],i=this[JI],a=this[L6],c=this[KI],u=this[GI],l=this[XI],d=this[Z6],p=this[D6],g=this[M6][r]+n;g=g+c;let h;l.log&&(t=l.log(t));let m=i[YI],_="";for(let w in t)if(h=t[w],Object.prototype.hasOwnProperty.call(t,w)&&h!==void 0){u[w]?h=u[w](h):w===p&&u.err&&(h=u.err(h));let x=i[w]||m;switch(typeof h){case"undefined":case"function":continue;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":x&&(h=x(h));break;case"string":h=(x||B_)(h);break;default:h=(x||s)(h,o)}if(h===void 0)continue;let T=B_(w);_+=","+T+":"+h}let b="";if(e!==void 0){h=u[d]?u[d](e):e;let w=i[d]||m;switch(typeof h){case"function":break;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":w&&(h=w(h)),b=',"'+d+'":'+h;break;case"string":h=(w||B_)(h),b=',"'+d+'":'+h;break;default:h=(w||s)(h,o),b=',"'+d+'":'+h}}return this[q6]&&_?g+this[F6]+_.slice(1)+"}"+b+a:g+_+b+a}function K6(t,e){let r,n=t[KI],s=t[WI],o=t[K_],i=t[JI],a=i[YI],c=t[GI],u=t[XI].bindings;e=u(e);for(let l in e)if(r=e[l],((l.length<5||l!=="level"&&l!=="serializers"&&l!=="formatters"&&l!=="customLevels")&&e.hasOwnProperty(l)&&r!==void 0)===!0){if(r=c[l]?c[l](r):r,r=(i[l]||a||s)(r,o),r===void 0)continue;n+=',"'+l+'":'+r}return n}function G6(t){return t.write!==t.constructor.prototype.write}function xd(t){let e=new H_(t);return e.on("error",r),!t.sync&&U6&&(UI.register(e,J6),e.on("close",function(){UI.unregister(e)})),e;function r(n){if(n.code==="EPIPE"){e.write=ki,e.end=ki,e.flushSync=ki,e.destroy=ki;return}e.removeListener("error",r),e.emit("error",n)}}function J6(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function W6(t){return function(r,n,s={},o){if(typeof s=="string")o=xd({dest:s}),s={};else if(typeof o=="string"){if(s&&s.transport)throw Error("only one of option.transport or stream can be specified");o=xd({dest:o})}else if(s instanceof H_||s.writable||s._writableState)o=s,s={};else if(s.transport){if(s.transport instanceof H_||s.transport.writable||s.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(s.transport.targets&&s.transport.targets.length&&s.formatters&&typeof s.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let c;s.customLevels&&(c=s.useOnlyCustomLevels?s.customLevels:Object.assign({},s.levels,s.customLevels)),o=V6({caller:n,...s.transport,levels:c})}if(s=Object.assign({},t,s),s.serializers=Object.assign({},t.serializers,s.serializers),s.formatters=Object.assign({},t.formatters,s.formatters),s.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:i,onChild:a}=s;return i===!1&&(s.level="silent"),a||(s.onChild=ki),o||(G6(process.stdout)?o=process.stdout:o=xd({fd:process.stdout.fd||1})),{opts:s,stream:o}}}function Y6(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[K_])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function X6(t,e,r){return{level:t,bindings:e,log:r}}function Q6(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t===void 0?1:t}QI.exports={noop:ki,buildSafeSonicBoom:xd,asChindings:K6,asJson:H6,genLog:B6,createArgsNormalizer:W6,stringify:Y6,buildFormatters:X6,normalizeDestFileDescriptor:Q6}});var Ed=S((kfe,eP)=>{"use strict";f();var eK={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},tK={ASC:"ASC",DESC:"DESC"};eP.exports={DEFAULT_LEVELS:eK,SORTING_ORDER:tK}});var W_=S((Tfe,sP)=>{"use strict";f();var{lsCacheSym:rK,levelValSym:G_,useOnlyCustomLevelsSym:nK,streamSym:sK,formattersSym:oK,hooksSym:iK,levelCompSym:tP}=xi(),{noop:aK,genLog:io}=kd(),{DEFAULT_LEVELS:Gr,SORTING_ORDER:rP}=Ed(),nP={fatal:t=>{let e=io(Gr.fatal,t);return function(...r){let n=this[sK];if(e.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:t=>io(Gr.error,t),warn:t=>io(Gr.warn,t),info:t=>io(Gr.info,t),debug:t=>io(Gr.debug,t),trace:t=>io(Gr.trace,t)},J_=Object.keys(Gr).reduce((t,e)=>(t[Gr[e]]=e,t),{}),cK=Object.keys(J_).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function uK(t){let e=t[oK].level,{labels:r}=t.levels,n={};for(let s in r){let o=e(r[s],Number(s));n[s]=JSON.stringify(o).slice(0,-1)}return t[rK]=n,t}function lK(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function dK(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let n=this[G_],s=this[G_]=r[t],o=this[nK],i=this[tP],a=this[iK].logMethod;for(let c in r){if(i(r[c],s)===!1){this[c]=aK;continue}this[c]=lK(c,o)?nP[c](a):io(r[c],a)}this.emit("level-change",t,s,e[n],n,this)}function fK(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function pK(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&this[tP](r,this[G_])}function hK(t,e,r){return t===rP.DESC?e<=r:e>=r}function mK(t){return typeof t=="string"?hK.bind(null,t):t}function gK(t=null,e=!1){let r=t?Object.keys(t).reduce((o,i)=>(o[t[i]]=i,o),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:J_,r),s=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Gr,t);return{labels:n,values:s}}function yK(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys(J_).map(o=>+o),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:Gr,e);if(!(t in n))throw Error(`default level:${t} must be included in custom levels`)}function _K(t,e){let{labels:r,values:n}=t;for(let s in e){if(s in n)throw Error("levels cannot be overridden");if(e[s]in r)throw Error("pre-existing level values cannot be used for new levels")}}function vK(t){if(typeof t!="function"&&!(typeof t=="string"&&Object.values(rP).includes(t)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}sP.exports={initialLsCache:cK,genLsCache:uK,levelMethods:nP,getLevel:fK,setLevel:dK,isLevelEnabled:pK,mappings:gK,assertNoLevelCollisions:_K,assertDefaultLevelFound:yK,genLevelComparison:mK,assertLevelComparison:vK}});var Y_=S((Ife,oP)=>{"use strict";f();oP.exports={version:"9.14.0"}});var pP=S((Cfe,fP)=>{"use strict";f();var{EventEmitter:bK}=Te("events"),{lsCacheSym:wK,levelValSym:xK,setLevelSym:$d,getLevelSym:iP,chindingsSym:Id,parsedChindingsSym:SK,mixinSym:kK,asJsonSym:cP,writeSym:EK,mixinMergeStrategySym:TK,timeSym:$K,timeSliceIndexSym:IK,streamSym:uP,serializersSym:ao,formattersSym:uc,errorKeySym:PK,messageKeySym:OK,useOnlyCustomLevelsSym:CK,needsMetadataGsym:AK,redactFmtSym:NK,stringifySym:RK,formatOptsSym:jK,stringifiersSym:zK,msgPrefixSym:Q_,hooksSym:MK}=xi(),{getLevel:LK,setLevel:qK,isLevelEnabled:ZK,mappings:DK,initialLsCache:FK,genLsCache:UK,assertNoLevelCollisions:VK}=W_(),{asChindings:ev,asJson:BK,buildFormatters:X_,stringify:aP,noop:lP}=kd(),{version:HK}=Y_(),KK=C_(),GK=class{},dP={constructor:GK,child:JK,bindings:WK,setBindings:YK,flush:e3,isLevelEnabled:ZK,version:HK,get level(){return this[iP]()},set level(t){this[$d](t)},get levelVal(){return this[xK]},set levelVal(t){throw Error("levelVal is read-only")},get msgPrefix(){return this[Q_]},get[Symbol.toStringTag](){return"Pino"},[wK]:FK,[EK]:QK,[cP]:BK,[iP]:LK,[$d]:qK};Object.setPrototypeOf(dP,bK.prototype);fP.exports=function(){return Object.create(dP)};var Td=t=>t;function JK(t,e){if(!t)throw Error("missing bindings for child Pino");let r=this[ao],n=this[uc],s=Object.create(this);if(e==null)return s[uc].bindings!==Td&&(s[uc]=X_(n.level,Td,n.log)),s[Id]=ev(s,t),s[$d](this.level),this.onChild!==lP&&this.onChild(s),s;if(e.hasOwnProperty("serializers")===!0){s[ao]=Object.create(null);for(let l in r)s[ao][l]=r[l];let c=Object.getOwnPropertySymbols(r);for(var o=0;o<c.length;o++){let l=c[o];s[ao][l]=r[l]}for(let l in e.serializers)s[ao][l]=e.serializers[l];let u=Object.getOwnPropertySymbols(e.serializers);for(var i=0;i<u.length;i++){let l=u[i];s[ao][l]=e.serializers[l]}}else s[ao]=r;if(e.hasOwnProperty("formatters")){let{level:c,bindings:u,log:l}=e.formatters;s[uc]=X_(c||n.level,u||Td,l||n.log)}else s[uc]=X_(n.level,Td,n.log);if(e.hasOwnProperty("customLevels")===!0&&(VK(this.levels,e.customLevels),s.levels=DK(e.customLevels,s[CK]),UK(s)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){s.redact=e.redact;let c=KK(s.redact,aP),u={stringify:c[NK]};s[RK]=aP,s[zK]=c,s[jK]=u}typeof e.msgPrefix=="string"&&(s[Q_]=(this[Q_]||"")+e.msgPrefix),s[Id]=ev(s,t);let a=e.level||this.level;return s[$d](a),this.onChild(s),s}function WK(){let e=`{${this[Id].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function YK(t){let e=ev(this,t);this[Id]=e,delete this[SK]}function XK(t,e){return Object.assign(e,t)}function QK(t,e,r){let n=this[$K](),s=this[kK],o=this[PK],i=this[OK],a=this[TK]||XK,c,u=this[MK].streamWrite;t==null?c={}:t instanceof Error?(c={[o]:t},e===void 0&&(e=t.message)):(c=t,e===void 0&&t[i]===void 0&&t[o]&&(e=t[o].message)),s&&(c=a(c,s(c,r,this)));let l=this[cP](c,e,r,n),d=this[uP];d[AK]===!0&&(d.lastLevel=r,d.lastObj=c,d.lastMsg=e,d.lastTime=n.slice(this[IK]),d.lastLogger=this),d.write(u?u(l):l)}function e3(t){if(t!=null&&typeof t!="function")throw Error("callback must be a function");let e=this[uP];typeof e.flush=="function"?e.flush(t||lP):t&&t()}});var yP=S((sv,gP)=>{"use strict";f();var{hasOwnProperty:lc}=Object.prototype,uo=nv();uo.configure=nv;uo.stringify=uo;uo.default=uo;sv.stringify=uo;sv.configure=nv;gP.exports=uo;var t3=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Kn(t){return t.length<5e3&&!t3.test(t)?`"${t}"`:JSON.stringify(t)}function tv(t,e){if(t.length>200||e)return t.sort(e);for(let r=1;r<t.length;r++){let n=t[r],s=r;for(;s!==0&&t[s-1]>n;)t[s]=t[s-1],s--;t[s]=n}return t}var r3=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function rv(t){return r3.call(t)!==void 0&&t.length!==0}function hP(t,e,r){t.length<r&&(r=t.length);let n=e===","?"":" ",s=`"0":${n}${t[0]}`;for(let o=1;o<r;o++)s+=`${e}"${o}":${n}${t[o]}`;return s}function n3(t){if(lc.call(t,"circularValue")){let e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function s3(t){let e;if(lc.call(t,"deterministic")&&(e=t.deterministic,typeof e!="boolean"&&typeof e!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return e===void 0?!0:e}function o3(t,e){let r;if(lc.call(t,e)&&(r=t[e],typeof r!="boolean"))throw new TypeError(`The "${e}" argument must be of type boolean`);return r===void 0?!0:r}function mP(t,e){let r;if(lc.call(t,e)){if(r=t[e],typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function co(t){return t===1?"1 item":`${t} items`}function i3(t){let e=new Set;for(let r of t)(typeof r=="string"||typeof r=="number")&&e.add(String(r));return e}function a3(t){if(lc.call(t,"strict")){let e=t.strict;if(typeof e!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(e)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function nv(t){t={...t};let e=a3(t);e&&(t.bigint===void 0&&(t.bigint=!1),"circularValue"in t||(t.circularValue=Error));let r=n3(t),n=o3(t,"bigint"),s=s3(t),o=typeof s=="function"?s:void 0,i=mP(t,"maximumDepth"),a=mP(t,"maximumBreadth");function c(g,h,m,_,b,w){let x=h[g];switch(typeof x=="object"&&x!==null&&typeof x.toJSON=="function"&&(x=x.toJSON(g)),x=_.call(h,g,x),typeof x){case"string":return Kn(x);case"object":{if(x===null)return"null";if(m.indexOf(x)!==-1)return r;let T="",P=",",L=w;if(Array.isArray(x)){if(x.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(x),b!==""&&(w+=b,T+=`
|
|
12
|
-
${w}`,
|
|
13
|
-
${w}`);let z=Math.min(x.length,a),V=0;for(;V<z-1;V++){let pe=c(String(V),x,m,_,b,w);T+=pe!==void 0?pe:"null",T+=
|
|
14
|
-
${L}`),m.pop(),`[${T}]`}let U=Object.keys(x),$=U.length;if($===0)return"{}";if(i<m.length+1)return'"[Object]"';let
|
|
15
|
-
${w}`,
|
|
11
|
+
caused by: `+z$(n,e)):r},OB=t=>z$(t,new Set),M$=(t,e,r)=>{if(!ac(t))return"";let n=r?"":t.message||"";if(e.has(t))return n+": ...";let s=__(t);if(s){e.add(t);let o=typeof t.cause=="function";return n+(o?"":": ")+M$(s,e,o)}else return n},PB=t=>M$(t,new Set);L$.exports={isErrorLike:ac,getErrorCause:__,stackWithCauses:OB,messageWithCauses:PB}});var b_=S((Ude,Z$)=>{"use strict";f();var CB=Symbol("circular-ref-tag"),cd=Symbol("pino-raw-err-ref"),q$=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[cd]},set:function(t){this[cd]=t}}});Object.defineProperty(q$,cd,{writable:!0,value:{}});Z$.exports={pinoErrProto:q$,pinoErrorSymbols:{seen:CB,rawSymbol:cd}}});var U$=S((Bde,F$)=>{"use strict";f();F$.exports=x_;var{messageWithCauses:NB,stackWithCauses:AB,isErrorLike:D$}=v_(),{pinoErrProto:RB,pinoErrorSymbols:jB}=b_(),{seen:w_}=jB,{toString:zB}=Object.prototype;function x_(t){if(!D$(t))return t;t[w_]=void 0;let e=Object.create(RB);e.type=zB.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=NB(t),e.stack=AB(t),Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>x_(r)));for(let r in t)if(e[r]===void 0){let n=t[r];D$(n)?r!=="cause"&&!Object.prototype.hasOwnProperty.call(n,w_)&&(e[r]=x_(n)):e[r]=n}return delete t[w_],e.raw=t,e}});var B$=S((Kde,V$)=>{"use strict";f();V$.exports=ld;var{isErrorLike:S_}=v_(),{pinoErrProto:MB,pinoErrorSymbols:LB}=b_(),{seen:ud}=LB,{toString:qB}=Object.prototype;function ld(t){if(!S_(t))return t;t[ud]=void 0;let e=Object.create(MB);e.type=qB.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=t.message,e.stack=t.stack,Array.isArray(t.errors)&&(e.aggregateErrors=t.errors.map(r=>ld(r))),S_(t.cause)&&!Object.prototype.hasOwnProperty.call(t.cause,ud)&&(e.cause=ld(t.cause));for(let r in t)if(e[r]===void 0){let n=t[r];S_(n)?Object.prototype.hasOwnProperty.call(n,ud)||(e[r]=ld(n)):e[r]=n}return delete t[ud],e.raw=t,e}});var J$=S((Jde,G$)=>{"use strict";f();G$.exports={mapHttpRequest:ZB,reqSerializer:K$};var k_=Symbol("pino-raw-req-ref"),H$=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[k_]},set:function(t){this[k_]=t}}});Object.defineProperty(H$,k_,{writable:!0,value:{}});function K$(t){let e=t.info||t.socket,r=Object.create(H$);if(r.id=typeof t.id=="function"?t.id():t.id||(t.info?t.info.id:void 0),r.method=t.method,t.originalUrl)r.url=t.originalUrl;else{let n=t.path;r.url=typeof n=="string"?n:t.url?t.url.path||t.url:void 0}return t.query&&(r.query=t.query),t.params&&(r.params=t.params),r.headers=t.headers,r.remoteAddress=e&&e.remoteAddress,r.remotePort=e&&e.remotePort,r.raw=t.raw||t,r}function ZB(t){return{req:K$(t)}}});var Q$=S((Yde,X$)=>{"use strict";f();X$.exports={mapHttpResponse:DB,resSerializer:Y$};var E_=Symbol("pino-raw-res-ref"),W$=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[E_]},set:function(t){this[E_]=t}}});Object.defineProperty(W$,E_,{writable:!0,value:{}});function Y$(t){let e=Object.create(W$);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function DB(t){return{res:Y$(t)}}});var $_=S((Qde,eI)=>{"use strict";f();var T_=U$(),FB=B$(),dd=J$(),fd=Q$();eI.exports={err:T_,errWithCause:FB,mapHttpRequest:dd.mapHttpRequest,mapHttpResponse:fd.mapHttpResponse,req:dd.reqSerializer,res:fd.resSerializer,wrapErrorSerializer:function(e){return e===T_?e:function(n){return e(T_(n))}},wrapRequestSerializer:function(e){return e===dd.reqSerializer?e:function(n){return e(dd.reqSerializer(n))}},wrapResponseSerializer:function(e){return e===fd.resSerializer?e:function(n){return e(fd.resSerializer(n))}}}});var I_=S((tfe,tI)=>{"use strict";f();function UB(t,e){return e}tI.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=UB;let r=new Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(r))return;let n=r.slice(2),s=[];for(let o of n)o&&s.push(o.getFileName());return s}});var aI=S((nfe,iI)=>{"use strict";f();function O_(t){if(t===null||typeof t!="object")return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){let e=[];for(let r=0;r<t.length;r++)e[r]=O_(t[r]);return e}if(typeof t=="object"){let e=Object.create(Object.getPrototypeOf(t));for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=O_(t[r]));return e}return t}function rI(t){let e=[],r="",n=!1,s=!1,o="";for(let i=0;i<t.length;i++){let a=t[i];!n&&a==="."?r&&(e.push(r),r=""):a==="["?(r&&(e.push(r),r=""),n=!0):a==="]"&&n?(e.push(r),r="",n=!1,s=!1):(a==='"'||a==="'")&&n?s?a===o?(s=!1,o=""):r+=a:(s=!0,o=a):r+=a}return r&&e.push(r),e}function nI(t,e,r){let n=t;for(let o=0;o<e.length-1;o++){let i=e[o];if(typeof n!="object"||n===null||!(i in n)||typeof n[i]!="object"||n[i]===null)return!1;n=n[i]}let s=e[e.length-1];if(s==="*"){if(Array.isArray(n))for(let o=0;o<n.length;o++)n[o]=r;else if(typeof n=="object"&&n!==null)for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=r)}else typeof n=="object"&&n!==null&&s in n&&Object.prototype.hasOwnProperty.call(n,s)&&(n[s]=r);return!0}function sI(t,e){let r=t;for(let s=0;s<e.length-1;s++){let o=e[s];if(typeof r!="object"||r===null||!(o in r)||typeof r[o]!="object"||r[o]===null)return!1;r=r[o]}let n=e[e.length-1];if(n==="*"){if(Array.isArray(r))for(let s=0;s<r.length;s++)r[s]=void 0;else if(typeof r=="object"&&r!==null)for(let s in r)Object.prototype.hasOwnProperty.call(r,s)&&delete r[s]}else typeof r=="object"&&r!==null&&n in r&&Object.prototype.hasOwnProperty.call(r,n)&&delete r[n];return!0}var pd=Symbol("PATH_NOT_FOUND");function VB(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||r===null||!(n in r))return pd;r=r[n]}return r}function BB(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||r===null)return;r=r[n]}return r}function HB(t,e,r,n=!1){for(let s of e){let o=rI(s);if(o.includes("*"))oI(t,o,r,s,n);else if(n)sI(t,o);else{let i=VB(t,o);if(i===pd)continue;let a=typeof r=="function"?r(i,o):r;nI(t,o,a)}}}function oI(t,e,r,n,s=!1){let o=e.indexOf("*");if(o===e.length-1){let i=e.slice(0,-1),a=t;for(let c of i){if(a==null||typeof a!="object"||a===null)return;a=a[c]}if(Array.isArray(a))if(s)for(let c=0;c<a.length;c++)a[c]=void 0;else for(let c=0;c<a.length;c++){let u=[...i,c.toString()],l=typeof r=="function"?r(a[c],u):r;a[c]=l}else if(typeof a=="object"&&a!==null)if(s){let c=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&c.push(u);for(let u of c)delete a[u]}else for(let c in a){let u=[...i,c],l=typeof r=="function"?r(a[c],u):r;a[c]=l}}else KB(t,e,r,o,n,s)}function KB(t,e,r,n,s,o=!1){let i=e.slice(0,n),a=e.slice(n+1),c=[];function u(l,d){if(d===i.length){if(Array.isArray(l))for(let p=0;p<l.length;p++)c[d]=p.toString(),u(l[p],d+1);else if(typeof l=="object"&&l!==null)for(let p in l)c[d]=p,u(l[p],d+1)}else if(d<i.length){let p=i[d];l&&typeof l=="object"&&l!==null&&p in l&&(c[d]=p,u(l[p],d+1))}else if(a.includes("*"))oI(l,a,typeof r=="function"?(g,h)=>{let m=[...c.slice(0,d),...h];return r(g,m)}:r,s,o);else if(o)sI(l,a);else{let p=typeof r=="function"?r(BB(l,a),[...c.slice(0,d),...a]):r;nI(l,a,p)}}if(i.length===0)u(t,0);else{let l=t;for(let d=0;d<i.length;d++){let p=i[d];if(l==null||typeof l!="object"||l===null)return;l=l[p],c[d]=p}l!=null&&u(l,i.length)}}function GB(t){if(t.length===0)return null;let e=new Map;for(let r of t){let n=rI(r),s=e;for(let o=0;o<n.length;o++){let i=n[o];s.has(i)||s.set(i,new Map),s=s.get(i)}}return e}function JB(t,e){if(!e)return t;function r(n,s,o=0){if(!s||s.size===0||n===null||typeof n!="object")return n;if(n instanceof Date)return new Date(n.getTime());if(Array.isArray(n)){let a=[];for(let c=0;c<n.length;c++){let u=c.toString();s.has(u)||s.has("*")?a[c]=r(n[c],s.get(u)||s.get("*")):a[c]=n[c]}return a}let i=Object.create(Object.getPrototypeOf(n));for(let a in n)Object.prototype.hasOwnProperty.call(n,a)&&(s.has(a)||s.has("*")?i[a]=r(n[a],s.get(a)||s.get("*")):i[a]=n[a]);return i}return r(t,e)}function WB(t){if(typeof t!="string")throw new Error("Paths must be (non-empty) strings");if(t==="")throw new Error("Invalid redaction path ()");if(t.includes(".."))throw new Error(`Invalid redaction path (${t})`);if(t.includes(","))throw new Error(`Invalid redaction path (${t})`);let e=0,r=!1,n="";for(let s=0;s<t.length;s++){let o=t[s];if((o==='"'||o==="'")&&e>0)r?o===n&&(r=!1,n=""):(r=!0,n=o);else if(o==="["&&!r)e++;else if(o==="]"&&!r&&(e--,e<0))throw new Error(`Invalid redaction path (${t})`)}if(e!==0)throw new Error(`Invalid redaction path (${t})`)}function YB(t){if(!Array.isArray(t))throw new TypeError("paths must be an array");for(let e of t)WB(e)}function XB(t={}){let{paths:e=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:s=!0,remove:o=!1}=t;YB(e);let i=GB(e);return function(c){if(s&&(c===null||typeof c!="object")&&(c==null||typeof c!="object"))return n?n(c):c;let u=JB(c,i),l=c,d=r;return typeof r=="function"&&(d=r),HB(u,e,d,o),n===!1?(u.restore=function(){return O_(l)},u):typeof n=="function"?n(u):JSON.stringify(u)}}iI.exports=XB});var xi=S((ofe,cI)=>{"use strict";f();var QB=Symbol("pino.setLevel"),eH=Symbol("pino.getLevel"),tH=Symbol("pino.levelVal"),rH=Symbol("pino.levelComp"),nH=Symbol("pino.useLevelLabels"),sH=Symbol("pino.useOnlyCustomLevels"),oH=Symbol("pino.mixin"),iH=Symbol("pino.lsCache"),aH=Symbol("pino.chindings"),cH=Symbol("pino.asJson"),uH=Symbol("pino.write"),lH=Symbol("pino.redactFmt"),dH=Symbol("pino.time"),fH=Symbol("pino.timeSliceIndex"),pH=Symbol("pino.stream"),hH=Symbol("pino.stringify"),mH=Symbol("pino.stringifySafe"),gH=Symbol("pino.stringifiers"),yH=Symbol("pino.end"),_H=Symbol("pino.formatOpts"),vH=Symbol("pino.messageKey"),bH=Symbol("pino.errorKey"),wH=Symbol("pino.nestedKey"),xH=Symbol("pino.nestedKeyStr"),SH=Symbol("pino.mixinMergeStrategy"),kH=Symbol("pino.msgPrefix"),EH=Symbol("pino.wildcardFirst"),TH=Symbol.for("pino.serializers"),$H=Symbol.for("pino.formatters"),IH=Symbol.for("pino.hooks"),OH=Symbol.for("pino.metadata");cI.exports={setLevelSym:QB,getLevelSym:eH,levelValSym:tH,levelCompSym:rH,useLevelLabelsSym:nH,mixinSym:oH,lsCacheSym:iH,chindingsSym:aH,asJsonSym:cH,writeSym:uH,serializersSym:TH,redactFmtSym:lH,timeSym:dH,timeSliceIndexSym:fH,streamSym:pH,stringifySym:hH,stringifySafeSym:mH,stringifiersSym:gH,endSym:yH,formatOptsSym:_H,messageKeySym:vH,errorKeySym:bH,nestedKeySym:wH,wildcardFirstSym:EH,needsMetadataGsym:OH,useOnlyCustomLevelsSym:sH,formattersSym:$H,hooksSym:IH,nestedKeyStrSym:xH,mixinMergeStrategySym:SH,msgPrefixSym:kH}});var C_=S((afe,fI)=>{"use strict";f();var uI=aI(),{redactFmtSym:PH,wildcardFirstSym:hd}=xi(),P_=/[^.[\]]+|\[([^[\]]*?)\]/g,lI="[Redacted]",dI=!1;function CH(t,e){let{paths:r,censor:n,remove:s}=NH(t),o=r.reduce((c,u)=>{P_.lastIndex=0;let l=P_.exec(u),d=P_.exec(u),p=l[1]!==void 0?l[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):l[0];if(p==="*"&&(p=hd),d===null)return c[p]=null,c;if(c[p]===null)return c;let{index:g}=d,h=`${u.substr(g,u.length-1)}`;return c[p]=c[p]||[],p!==hd&&c[p].length===0&&c[p].push(...c[hd]||[]),p===hd&&Object.keys(c).forEach(function(m){c[m]&&c[m].push(h)}),c[p].push(h),c},{}),i={[PH]:uI({paths:r,censor:n,serialize:e,strict:dI,remove:s})},a=(...c)=>e(typeof n=="function"?n(...c):n);return[...Object.keys(o),...Object.getOwnPropertySymbols(o)].reduce((c,u)=>{if(o[u]===null)c[u]=l=>a(l,[u]);else{let l=typeof n=="function"?(d,p)=>n(d,[u,...p]):n;c[u]=uI({paths:o[u],censor:l,serialize:e,strict:dI,remove:s})}return c},i)}function NH(t){if(Array.isArray(t))return t={paths:t,censor:lI},t;let{paths:e,censor:r=lI,remove:n}=t;if(Array.isArray(e)===!1)throw Error("pino \u2013 redact must contain an array of strings");return n===!0&&(r=void 0),{paths:e,censor:r,remove:n}}fI.exports=CH});var mI=S((ufe,hI)=>{"use strict";f();var AH=()=>"",RH=()=>`,"time":${Date.now()}`,jH=()=>`,"time":${Math.round(Date.now()/1e3)}`,zH=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,MH=1000000n,pI=1000000000n,LH=BigInt(Date.now())*MH,qH=process.hrtime.bigint(),ZH=()=>{let t=process.hrtime.bigint()-qH,e=LH+t,r=e/pI,n=e%pI,s=Number(r*1000n+n/1000000n),o=new Date(s),i=o.getUTCFullYear(),a=(o.getUTCMonth()+1).toString().padStart(2,"0"),c=o.getUTCDate().toString().padStart(2,"0"),u=o.getUTCHours().toString().padStart(2,"0"),l=o.getUTCMinutes().toString().padStart(2,"0"),d=o.getUTCSeconds().toString().padStart(2,"0");return`,"time":"${i}-${a}-${c}T${u}:${l}:${d}.${n.toString().padStart(9,"0")}Z"`};hI.exports={nullTime:AH,epochTime:RH,unixTime:jH,isoTime:zH,isoTimeNano:ZH}});var yI=S((dfe,gI)=>{"use strict";f();function DH(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}gI.exports=FH;function FH(t,e,r){var n=r&&r.stringify||DH,s=1;if(typeof t=="object"&&t!==null){var o=e.length+s;if(o===1)return t;var i=new Array(o);i[0]=n(t);for(var a=1;a<o;a++)i[a]=n(e[a]);return i.join(" ")}if(typeof t!="string")return t;var c=e.length;if(c===0)return t;for(var u="",l=1-s,d=-1,p=t&&t.length||0,g=0;g<p;){if(t.charCodeAt(g)===37&&g+1<p){switch(d=d>-1?d:0,t.charCodeAt(g+1)){case 100:case 102:if(l>=c||e[l]==null)break;d<g&&(u+=t.slice(d,g)),u+=Number(e[l]),d=g+2,g++;break;case 105:if(l>=c||e[l]==null)break;d<g&&(u+=t.slice(d,g)),u+=Math.floor(Number(e[l])),d=g+2,g++;break;case 79:case 111:case 106:if(l>=c||e[l]===void 0)break;d<g&&(u+=t.slice(d,g));var h=typeof e[l];if(h==="string"){u+="'"+e[l]+"'",d=g+2,g++;break}if(h==="function"){u+=e[l].name||"<anonymous>",d=g+2,g++;break}u+=n(e[l]),d=g+2,g++;break;case 115:if(l>=c)break;d<g&&(u+=t.slice(d,g)),u+=String(e[l]),d=g+2,g++;break;case 37:d<g&&(u+=t.slice(d,g)),u+="%",d=g+2,g++,l--;break}++l}++g}return d===-1?t:(d<p&&(u+=t.slice(d)),u)}});var A_=S((pfe,N_)=>{"use strict";f();if(typeof SharedArrayBuffer<"u"&&typeof Atomics<"u"){let e=function(r){if((r>0&&r<1/0)===!1)throw typeof r!="number"&&typeof r!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");Atomics.wait(t,0,0,Number(r))},t=new Int32Array(new SharedArrayBuffer(4));N_.exports=e}else{let t=function(e){if((e>0&&e<1/0)===!1)throw typeof e!="number"&&typeof e!="bigint"?TypeError("sleep: ms must be a number"):RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");let n=Date.now()+Number(e);for(;n>Date.now(););};N_.exports=t}});var EI=S((mfe,kI)=>{"use strict";f();var He=Te("fs"),UH=Te("events"),VH=Te("util").inherits,_I=Te("path"),j_=A_(),BH=Te("assert"),md=100,gd=Buffer.allocUnsafe(0),HH=16*1024,vI="buffer",bI="utf8",[KH,GH]=(process.versions.node||"0.0").split(".").map(Number),JH=KH>=22&&GH>=7;function wI(t,e){e._opening=!0,e._writing=!0,e._asyncDrainScheduled=!1;function r(o,i){if(o){e._reopening=!1,e._writing=!1,e._opening=!1,e.sync?process.nextTick(()=>{e.listenerCount("error")>0&&e.emit("error",o)}):e.emit("error",o);return}let a=e._reopening;e.fd=i,e.file=t,e._reopening=!1,e._opening=!1,e._writing=!1,e.sync?process.nextTick(()=>e.emit("ready")):e.emit("ready"),!e.destroyed&&(!e._writing&&e._len>e.minLength||e._flushPending?e._actualWrite():a&&process.nextTick(()=>e.emit("drain")))}let n=e.append?"a":"w",s=e.mode;if(e.sync)try{e.mkdir&&He.mkdirSync(_I.dirname(t),{recursive:!0});let o=He.openSync(t,n,s);r(null,o)}catch(o){throw r(o),o}else e.mkdir?He.mkdir(_I.dirname(t),{recursive:!0},o=>{if(o)return r(o);He.open(t,n,s,r)}):He.open(t,n,s,r)}function $r(t){if(!(this instanceof $r))return new $r(t);let{fd:e,dest:r,minLength:n,maxLength:s,maxWrite:o,periodicFlush:i,sync:a,append:c=!0,mkdir:u,retryEAGAIN:l,fsync:d,contentMode:p,mode:g}=t||{};e=e||r,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(n||0,16387),this.file=null,this.destroyed=!1,this.minLength=n||0,this.maxLength=s||0,this.maxWrite=o||HH,this._periodicFlush=i||0,this._periodicFlushTimer=void 0,this.sync=a||!1,this.writable=!0,this._fsync=d||!1,this.append=c||!1,this.mode=g,this.retryEAGAIN=l||(()=>!0),this.mkdir=u||!1;let h,m;if(p===vI)this._writingBuf=gd,this.write=XH,this.flush=e6,this.flushSync=r6,this._actualWrite=s6,h=()=>He.writeSync(this.fd,this._writingBuf),m=()=>He.write(this.fd,this._writingBuf,this.release);else if(p===void 0||p===bI)this._writingBuf="",this.write=YH,this.flush=QH,this.flushSync=t6,this._actualWrite=n6,h=()=>Buffer.isBuffer(this._writingBuf)?He.writeSync(this.fd,this._writingBuf):He.writeSync(this.fd,this._writingBuf,"utf8"),m=()=>Buffer.isBuffer(this._writingBuf)?He.write(this.fd,this._writingBuf,this.release):He.write(this.fd,this._writingBuf,"utf8",this.release);else throw new Error(`SonicBoom supports "${bI}" and "${vI}", but passed ${p}`);if(typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")wI(e,this);else throw new Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(_,b)=>{if(_){if((_.code==="EAGAIN"||_.code==="EBUSY")&&this.retryEAGAIN(_,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{j_(md),this.release(void 0,0)}catch(T){this.release(T)}else setTimeout(m,md);else this._writing=!1,this.emit("error",_);return}this.emit("write",b);let w=R_(this._writingBuf,this._len,b);if(this._len=w.len,this._writingBuf=w.writingBuf,this._writingBuf.length){if(!this.sync){m();return}try{do{let T=h(),O=R_(this._writingBuf,this._len,T);this._len=O.len,this._writingBuf=O.writingBuf}while(this._writingBuf.length)}catch(T){this.release(T);return}}this._fsync&&He.fsyncSync(this.fd);let x=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):x>this.minLength?this._actualWrite():this._ending?x>0?this._actualWrite():(this._writing=!1,yd(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(WH,this)):this.emit("drain"))},this.on("newListener",function(_){_==="drain"&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function R_(t,e,r){return typeof t=="string"&&(t=Buffer.from(t)),e=Math.max(e-r,0),t=t.subarray(r),{writingBuf:t,len:e}}function WH(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}VH($r,UH);function xI(t,e){return t.length===0?gd:t.length===1?t[0]:Buffer.concat(t,e)}function YH(t){if(this.destroyed)throw new Error("SonicBoom destroyed");t=""+t;let e=Buffer.byteLength(t),r=this._len+e,n=this._bufs;return this.maxLength&&r>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(n.length===0||Buffer.byteLength(n[n.length-1])+e>this.maxWrite?n.push(t):n[n.length-1]+=t,this._len=r,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function XH(t){if(this.destroyed)throw new Error("SonicBoom destroyed");let e=this._len+t.length,r=this._bufs,n=this._lens;return this.maxLength&&e>this.maxLength?(this.emit("drop",t),this._len<this._hwm):(r.length===0||n[n.length-1]+t.length>this.maxWrite?(r.push([t]),n.push(t.length)):(r[r.length-1].push(t),n[n.length-1]+=t.length),this._len=e,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function SI(t){this._flushPending=!0;let e=()=>{if(this._fsync)this._flushPending=!1,t();else try{He.fsync(this.fd,n=>{this._flushPending=!1,t(n)})}catch(n){t(n)}this.off("error",r)},r=n=>{this._flushPending=!1,t(n),this.off("drain",e)};this.once("drain",e),this.once("error",r)}function QH(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&SI.call(this,t),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function e6(t){if(t!=null&&typeof t!="function")throw new Error("flush cb must be a function");if(this.destroyed){let e=new Error("SonicBoom destroyed");if(t){t(e);return}throw e}if(this.minLength<=0){t?.();return}t&&SI.call(this,t),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}$r.prototype.reopen=function(t){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.reopen(t)});return}if(this._ending)return;if(!this.file)throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(t&&(this.file=t),this._reopening=!0,this._writing)return;let e=this.fd;this.once("ready",()=>{e!==this.fd&&He.close(e,r=>{if(r)return this.emit("error",r)})}),wI(this.file,this)};$r.prototype.end=function(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this._opening){this.once("ready",()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():yd(this)))};function t6(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let t="";for(;this._bufs.length||t.length;){t.length<=0&&(t=this._bufs[0]);try{let e=Buffer.isBuffer(t)?He.writeSync(this.fd,t):He.writeSync(this.fd,t,"utf8"),r=R_(t,this._len,e);t=r.writingBuf,this._len=r.len,t.length<=0&&this._bufs.shift()}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;j_(md)}}try{He.fsyncSync(this.fd)}catch{}}function r6(){if(this.destroyed)throw new Error("SonicBoom destroyed");if(this.fd<0)throw new Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=gd);let t=gd;for(;this._bufs.length||t.length;){t.length<=0&&(t=xI(this._bufs[0],this._lens[0]));try{let e=He.writeSync(this.fd,t);t=t.subarray(e),this._len=Math.max(this._len-e,0),t.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(e){if((e.code==="EAGAIN"||e.code==="EBUSY")&&!this.retryEAGAIN(e,t.length,this._len-t.length))throw e;j_(md)}}}$r.prototype.destroy=function(){this.destroyed||yd(this)};function n6(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||"",this.sync)try{let e=Buffer.isBuffer(this._writingBuf)?He.writeSync(this.fd,this._writingBuf):He.writeSync(this.fd,this._writingBuf,"utf8");t(null,e)}catch(e){t(e)}else He.write(this.fd,this._writingBuf,t)}function s6(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:xI(this._bufs.shift(),this._lens.shift()),this.sync)try{let e=He.writeSync(this.fd,this._writingBuf);t(null,e)}catch(e){t(e)}else JH&&(this._writingBuf=Buffer.from(this._writingBuf)),He.write(this.fd,this._writingBuf,t)}function yd(t){if(t.fd===-1){t.once("ready",yd.bind(null,t));return}t._periodicFlushTimer!==void 0&&clearInterval(t._periodicFlushTimer),t.destroyed=!0,t._bufs=[],t._lens=[],BH(typeof t.fd=="number",`sonic.fd must be a number, got ${typeof t.fd}`);try{He.fsync(t.fd,e)}catch{}function e(){t.fd!==1&&t.fd!==2?He.close(t.fd,r):r()}function r(n){if(n){t.emit("error",n);return}t._ending&&!t._writing&&t.emit("finish"),t.emit("close")}}$r.SonicBoom=$r;$r.default=$r;kI.exports=$r});var z_=S((yfe,PI)=>{"use strict";f();var Ir={exit:[],beforeExit:[]},TI={exit:a6,beforeExit:c6},Si;function o6(){Si===void 0&&(Si=new FinalizationRegistry(u6))}function i6(t){Ir[t].length>0||process.on(t,TI[t])}function $I(t){Ir[t].length>0||(process.removeListener(t,TI[t]),Ir.exit.length===0&&Ir.beforeExit.length===0&&(Si=void 0))}function a6(){II("exit")}function c6(){II("beforeExit")}function II(t){for(let e of Ir[t]){let r=e.deref(),n=e.fn;r!==void 0&&n(r,t)}Ir[t]=[]}function u6(t){for(let e of["exit","beforeExit"]){let r=Ir[e].indexOf(t);Ir[e].splice(r,r+1),$I(e)}}function OI(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");i6(t);let n=new WeakRef(e);n.fn=r,o6(),Si.register(e,n),Ir[t].push(n)}function l6(t,e){OI("exit",t,e)}function d6(t,e){OI("beforeExit",t,e)}function f6(t){if(Si!==void 0){Si.unregister(t);for(let e of["exit","beforeExit"])Ir[e]=Ir[e].filter(r=>{let n=r.deref();return n&&n!==t}),$I(e)}}PI.exports={register:l6,registerBeforeExit:d6,unregister:f6}});var CI=S((vfe,p6)=>{p6.exports={name:"thread-stream",version:"3.1.0",description:"A streaming way to send data to a Node.js Worker Thread",main:"index.js",types:"index.d.ts",dependencies:{"real-require":"^0.2.0"},devDependencies:{"@types/node":"^20.1.0","@types/tap":"^15.0.0","@yao-pkg/pkg":"^5.11.5",desm:"^1.3.0",fastbench:"^1.0.1",husky:"^9.0.6","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1",standard:"^17.0.0",tap:"^16.2.0","ts-node":"^10.8.0",typescript:"^5.3.2","why-is-node-running":"^2.2.2"},scripts:{build:"tsc --noEmit",test:'standard && npm run build && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',"test:ci":"standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts","test:ci:js":'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',"test:ci:ts":'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',"test:yarn":'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',transpile:"sh ./test/ts/transpile.sh",prepare:"husky install"},standard:{ignore:["test/ts/**/*","test/syntax-error.mjs"]},repository:{type:"git",url:"git+https://github.com/mcollina/thread-stream.git"},keywords:["worker","thread","threads","stream"],author:"Matteo Collina <hello@matteocollina.com>",license:"MIT",bugs:{url:"https://github.com/mcollina/thread-stream/issues"},homepage:"https://github.com/mcollina/thread-stream#readme"}});var AI=S((bfe,NI)=>{"use strict";f();function h6(t,e,r,n,s){let o=Date.now()+n,i=Atomics.load(t,e);if(i===r){s(null,"ok");return}let a=i,c=u=>{Date.now()>o?s(null,"timed-out"):setTimeout(()=>{a=i,i=Atomics.load(t,e),i===a?c(u>=1e3?1e3:u*2):i===r?s(null,"ok"):s(null,"not-equal")},u)};c(1)}function m6(t,e,r,n,s){let o=Date.now()+n,i=Atomics.load(t,e);if(i!==r){s(null,"ok");return}let a=c=>{Date.now()>o?s(null,"timed-out"):setTimeout(()=>{i=Atomics.load(t,e),i!==r?s(null,"ok"):a(c>=1e3?1e3:c*2)},c)};a(1)}NI.exports={wait:h6,waitDiff:m6}});var jI=S((xfe,RI)=>{"use strict";f();RI.exports={WRITE_INDEX:4,READ_INDEX:8}});var ZI=S((kfe,qI)=>{"use strict";f();var{version:g6}=CI(),{EventEmitter:y6}=Te("events"),{Worker:_6}=Te("worker_threads"),{join:v6}=Te("path"),{pathToFileURL:b6}=Te("url"),{wait:w6}=AI(),{WRITE_INDEX:Zt,READ_INDEX:Hr}=jI(),x6=Te("buffer"),S6=Te("assert"),N=Symbol("kImpl"),k6=x6.constants.MAX_STRING_LENGTH,cc=class{constructor(e){this._value=e}deref(){return this._value}},vd=class{register(){}unregister(){}},E6=process.env.NODE_V8_COVERAGE?vd:global.FinalizationRegistry||vd,T6=process.env.NODE_V8_COVERAGE?cc:global.WeakRef||cc,zI=new E6(t=>{t.exited||t.terminate()});function $6(t,e){let{filename:r,workerData:n}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||v6(y,"lib","worker.js"),i=new _6(o,{...e.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:b6(r).href,dataBuf:t[N].dataBuf,stateBuf:t[N].stateBuf,workerData:{$context:{threadStreamVersion:g6},...n}}});return i.stream=new cc(t),i.on("message",I6),i.on("exit",LI),zI.register(t,i),i}function MI(t){S6(!t[N].sync),t[N].needDrain&&(t[N].needDrain=!1,t.emit("drain"))}function _d(t){let e=Atomics.load(t[N].state,Zt),r=t[N].data.length-e;if(r>0){if(t[N].buf.length===0){t[N].flushing=!1,t[N].ending?D_(t):t[N].needDrain&&process.nextTick(MI,t);return}let n=t[N].buf.slice(0,r),s=Buffer.byteLength(n);s<=r?(t[N].buf=t[N].buf.slice(r),bd(t,n,_d.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[N].state,Hr,0),Atomics.store(t[N].state,Zt,0);s>t[N].data.length;)r=r/2,n=t[N].buf.slice(0,r),s=Buffer.byteLength(n);t[N].buf=t[N].buf.slice(r),bd(t,n,_d.bind(null,t))}})}else if(r===0){if(e===0&&t[N].buf.length===0)return;t.flush(()=>{Atomics.store(t[N].state,Hr,0),Atomics.store(t[N].state,Zt,0),_d(t)})}else Kr(t,new Error("overwritten"))}function I6(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new T6(e),e.flush(()=>{e[N].ready=!0,e.emit("ready")});break;case"ERROR":Kr(e,t.err);break;case"EVENT":Array.isArray(t.args)?e.emit(t.name,...t.args):e.emit(t.name,t.args);break;case"WARNING":process.emitWarning(t.err);break;default:Kr(e,new Error("this should not happen: "+t.code))}}function LI(t){let e=this.stream.deref();e!==void 0&&(zI.unregister(e),e.worker.exited=!0,e.worker.off("exit",LI),Kr(e,t!==0?new Error("the worker thread exited"):null))}var L_=class extends y6{constructor(e={}){if(super(),e.bufferSize<4)throw new Error("bufferSize must at least fit a 4-byte utf-8 char");this[N]={},this[N].stateBuf=new SharedArrayBuffer(128),this[N].state=new Int32Array(this[N].stateBuf),this[N].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[N].data=Buffer.from(this[N].dataBuf),this[N].sync=e.sync||!1,this[N].ending=!1,this[N].ended=!1,this[N].needDrain=!1,this[N].destroyed=!1,this[N].flushing=!1,this[N].ready=!1,this[N].finished=!1,this[N].errored=null,this[N].closed=!1,this[N].buf="",this.worker=$6(this,e),this.on("message",(r,n)=>{this.worker.postMessage(r,n)})}write(e){if(this[N].destroyed)return q_(this,new Error("the worker has exited")),!1;if(this[N].ending)return q_(this,new Error("the worker is ending")),!1;if(this[N].flushing&&this[N].buf.length+e.length>=k6)try{M_(this),this[N].flushing=!0}catch(r){return Kr(this,r),!1}if(this[N].buf+=e,this[N].sync)try{return M_(this),!0}catch(r){return Kr(this,r),!1}return this[N].flushing||(this[N].flushing=!0,setImmediate(_d,this)),this[N].needDrain=this[N].data.length-this[N].buf.length-Atomics.load(this[N].state,Zt)<=0,!this[N].needDrain}end(){this[N].destroyed||(this[N].ending=!0,D_(this))}flush(e){if(this[N].destroyed){typeof e=="function"&&process.nextTick(e,new Error("the worker has exited"));return}let r=Atomics.load(this[N].state,Zt);w6(this[N].state,Hr,r,1/0,(n,s)=>{if(n){Kr(this,n),process.nextTick(e,n);return}if(s==="not-equal"){this.flush(e);return}process.nextTick(e)})}flushSync(){this[N].destroyed||(M_(this),Z_(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[N].ready}get destroyed(){return this[N].destroyed}get closed(){return this[N].closed}get writable(){return!this[N].destroyed&&!this[N].ending}get writableEnded(){return this[N].ending}get writableFinished(){return this[N].finished}get writableNeedDrain(){return this[N].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[N].errored}};function q_(t,e){setImmediate(()=>{t.emit("error",e)})}function Kr(t,e){t[N].destroyed||(t[N].destroyed=!0,e&&(t[N].errored=e,q_(t,e)),t.worker.exited?setImmediate(()=>{t[N].closed=!0,t.emit("close")}):t.worker.terminate().catch(()=>{}).then(()=>{t[N].closed=!0,t.emit("close")}))}function bd(t,e,r){let n=Atomics.load(t[N].state,Zt),s=Buffer.byteLength(e);return t[N].data.write(e,n),Atomics.store(t[N].state,Zt,n+s),Atomics.notify(t[N].state,Zt),r(),!0}function D_(t){if(!(t[N].ended||!t[N].ending||t[N].flushing)){t[N].ended=!0;try{t.flushSync();let e=Atomics.load(t[N].state,Hr);Atomics.store(t[N].state,Zt,-1),Atomics.notify(t[N].state,Zt);let r=0;for(;e!==-1;){if(Atomics.wait(t[N].state,Hr,e,1e3),e=Atomics.load(t[N].state,Hr),e===-2){Kr(t,new Error("end() failed"));return}if(++r===10){Kr(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[N].finished=!0,t.emit("finish")})}catch(e){Kr(t,e)}}}function M_(t){let e=()=>{t[N].ending?D_(t):t[N].needDrain&&process.nextTick(MI,t)};for(t[N].flushing=!1;t[N].buf.length!==0;){let r=Atomics.load(t[N].state,Zt),n=t[N].data.length-r;if(n===0){Z_(t),Atomics.store(t[N].state,Hr,0),Atomics.store(t[N].state,Zt,0);continue}else if(n<0)throw new Error("overwritten");let s=t[N].buf.slice(0,n),o=Buffer.byteLength(s);if(o<=n)t[N].buf=t[N].buf.slice(n),bd(t,s,e);else{for(Z_(t),Atomics.store(t[N].state,Hr,0),Atomics.store(t[N].state,Zt,0);o>t[N].buf.length;)n=n/2,s=t[N].buf.slice(0,n),o=Buffer.byteLength(s);t[N].buf=t[N].buf.slice(n),bd(t,s,e)}}}function Z_(t){if(t[N].flushing)throw new Error("unable to flush while flushing");let e=Atomics.load(t[N].state,Zt),r=0;for(;;){let n=Atomics.load(t[N].state,Hr);if(n===-2)throw Error("_flushSync failed");if(n!==e)Atomics.wait(t[N].state,Hr,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}qI.exports=L_});var V_=S((Tfe,DI)=>{"use strict";f();var{createRequire:O6}=Te("module"),P6=I_(),{join:F_,isAbsolute:C6,sep:N6}=Te("path"),A6=A_(),U_=z_(),R6=ZI();function j6(t){U_.register(t,M6),U_.registerBeforeExit(t,L6),t.on("close",function(){U_.unregister(t)})}function z6(t,e,r,n){let s=new R6({filename:t,workerData:e,workerOpts:r,sync:n});s.on("ready",o),s.on("close",function(){process.removeListener("exit",i)}),process.on("exit",i);function o(){process.removeListener("exit",i),s.unref(),r.autoEnd!==!1&&j6(s)}function i(){s.closed||(s.flushSync(),A6(100),s.end())}return s}function M6(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function L6(t){t.flushSync()}function q6(t){let{pipeline:e,targets:r,levels:n,dedupe:s,worker:o={},caller:i=P6(),sync:a=!1}=t,c={...t.options},u=typeof i=="string"?[i]:i,l="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},d=t.target;if(d&&r)throw new Error("only one of target or targets can be specified");return r?(d=l["pino-worker"]||F_(y,"worker.js"),c.targets=r.filter(g=>g.target).map(g=>({...g,target:p(g.target)})),c.pipelines=r.filter(g=>g.pipeline).map(g=>g.pipeline.map(h=>({...h,level:g.level,target:p(h.target)})))):e&&(d=l["pino-worker"]||F_(y,"worker.js"),c.pipelines=[e.map(g=>({...g,target:p(g.target)}))]),n&&(c.levels=n),s&&(c.dedupe=s),c.pinoWillSendConfig=!0,z6(p(d),c,o,a);function p(g){if(g=l[g]||g,C6(g)||g.indexOf("file://")===0)return g;if(g==="pino/file")return F_(y,"..","file.js");let h;for(let m of u)try{let _=m==="node:repl"?process.cwd()+N6:m;h=O6(_).resolve(g);break}catch{continue}if(!h)throw new Error(`unable to determine transport target for "${g}"`);return h}}DI.exports=q6});var kd=S((Ife,eO)=>{"use strict";f();var FI=Te("diagnostics_channel"),UI=yI(),{mapHttpRequest:Z6,mapHttpResponse:D6}=$_(),H_=EI(),VI=z_(),{lsCacheSym:F6,chindingsSym:GI,writeSym:BI,serializersSym:JI,formatOptsSym:HI,endSym:U6,stringifiersSym:WI,stringifySym:YI,stringifySafeSym:K_,wildcardFirstSym:XI,nestedKeySym:V6,formattersSym:QI,messageKeySym:B6,errorKeySym:H6,nestedKeyStrSym:K6,msgPrefixSym:wd}=xi(),{isMainThread:G6}=Te("worker_threads"),J6=V_(),Sd;typeof FI.tracingChannel=="function"?Sd=FI.tracingChannel("pino_asJson"):Sd={hasSubscribers:!1,traceSync(t,e,r,...n){return t.call(r,...n)}};function ki(){}function W6(t,e){if(!e)return r;return function(...s){e.call(this,s,r,t)};function r(n,...s){if(typeof n=="object"){let o=n;n!==null&&(n.method&&n.headers&&n.socket?n=Z6(n):typeof n.setHeader=="function"&&(n=D6(n)));let i;o===null&&s.length===0?i=[null]:(o=s.shift(),i=s),typeof this[wd]=="string"&&o!==void 0&&o!==null&&(o=this[wd]+o),this[BI](n,UI(o,i,this[HI]),t)}else{let o=n===void 0?s.shift():n;typeof this[wd]=="string"&&o!==void 0&&o!==null&&(o=this[wd]+o),this[BI](null,UI(o,s,this[HI]),t)}}}function B_(t){let e="",r=0,n=!1,s=255,o=t.length;if(o>100)return JSON.stringify(t);for(var i=0;i<o&&s>=32;i++)s=t.charCodeAt(i),(s===34||s===92)&&(e+=t.slice(r,i)+"\\",r=i,n=!0);return n?e+=t.slice(r):e=t,s<32?JSON.stringify(t):'"'+e+'"'}function Y6(t,e,r,n){if(Sd.hasSubscribers===!1)return KI.call(this,t,e,r,n);let s={instance:this,arguments};return Sd.traceSync(KI,s,this,t,e,r,n)}function KI(t,e,r,n){let s=this[YI],o=this[K_],i=this[WI],a=this[U6],c=this[GI],u=this[JI],l=this[QI],d=this[B6],p=this[H6],g=this[F6][r]+n;g=g+c;let h;l.log&&(t=l.log(t));let m=i[XI],_="";for(let w in t)if(h=t[w],Object.prototype.hasOwnProperty.call(t,w)&&h!==void 0){u[w]?h=u[w](h):w===p&&u.err&&(h=u.err(h));let x=i[w]||m;switch(typeof h){case"undefined":case"function":continue;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":x&&(h=x(h));break;case"string":h=(x||B_)(h);break;default:h=(x||s)(h,o)}if(h===void 0)continue;let T=B_(w);_+=","+T+":"+h}let b="";if(e!==void 0){h=u[d]?u[d](e):e;let w=i[d]||m;switch(typeof h){case"function":break;case"number":Number.isFinite(h)===!1&&(h=null);case"boolean":w&&(h=w(h)),b=',"'+d+'":'+h;break;case"string":h=(w||B_)(h),b=',"'+d+'":'+h;break;default:h=(w||s)(h,o),b=',"'+d+'":'+h}}return this[V6]&&_?g+this[K6]+_.slice(1)+"}"+b+a:g+_+b+a}function X6(t,e){let r,n=t[GI],s=t[YI],o=t[K_],i=t[WI],a=i[XI],c=t[JI],u=t[QI].bindings;e=u(e);for(let l in e)if(r=e[l],((l.length<5||l!=="level"&&l!=="serializers"&&l!=="formatters"&&l!=="customLevels")&&e.hasOwnProperty(l)&&r!==void 0)===!0){if(r=c[l]?c[l](r):r,r=(i[l]||a||s)(r,o),r===void 0)continue;n+=',"'+l+'":'+r}return n}function Q6(t){return t.write!==t.constructor.prototype.write}function xd(t){let e=new H_(t);return e.on("error",r),!t.sync&&G6&&(VI.register(e,eK),e.on("close",function(){VI.unregister(e)})),e;function r(n){if(n.code==="EPIPE"){e.write=ki,e.end=ki,e.flushSync=ki,e.destroy=ki;return}e.removeListener("error",r),e.emit("error",n)}}function eK(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function tK(t){return function(r,n,s={},o){if(typeof s=="string")o=xd({dest:s}),s={};else if(typeof o=="string"){if(s&&s.transport)throw Error("only one of option.transport or stream can be specified");o=xd({dest:o})}else if(s instanceof H_||s.writable||s._writableState)o=s,s={};else if(s.transport){if(s.transport instanceof H_||s.transport.writable||s.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(s.transport.targets&&s.transport.targets.length&&s.formatters&&typeof s.formatters.level=="function")throw Error("option.transport.targets do not allow custom level formatters");let c;s.customLevels&&(c=s.useOnlyCustomLevels?s.customLevels:Object.assign({},s.levels,s.customLevels)),o=J6({caller:n,...s.transport,levels:c})}if(s=Object.assign({},t,s),s.serializers=Object.assign({},t.serializers,s.serializers),s.formatters=Object.assign({},t.formatters,s.formatters),s.prettyPrint)throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:i,onChild:a}=s;return i===!1&&(s.level="silent"),a||(s.onChild=ki),o||(Q6(process.stdout)?o=process.stdout:o=xd({fd:process.stdout.fd||1})),{opts:s,stream:o}}}function rK(t,e){try{return JSON.stringify(t)}catch{try{return(e||this[K_])(t)}catch{return'"[unable to serialize, circular reference is too complex to analyze]"'}}}function nK(t,e,r){return{level:t,bindings:e,log:r}}function sK(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t===void 0?1:t}eO.exports={noop:ki,buildSafeSonicBoom:xd,asChindings:X6,asJson:Y6,genLog:W6,createArgsNormalizer:tK,stringify:rK,buildFormatters:nK,normalizeDestFileDescriptor:sK}});var Ed=S((Pfe,tO)=>{"use strict";f();var oK={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},iK={ASC:"ASC",DESC:"DESC"};tO.exports={DEFAULT_LEVELS:oK,SORTING_ORDER:iK}});var W_=S((Nfe,oO)=>{"use strict";f();var{lsCacheSym:aK,levelValSym:G_,useOnlyCustomLevelsSym:cK,streamSym:uK,formattersSym:lK,hooksSym:dK,levelCompSym:rO}=xi(),{noop:fK,genLog:io}=kd(),{DEFAULT_LEVELS:Gr,SORTING_ORDER:nO}=Ed(),sO={fatal:t=>{let e=io(Gr.fatal,t);return function(...r){let n=this[uK];if(e.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:t=>io(Gr.error,t),warn:t=>io(Gr.warn,t),info:t=>io(Gr.info,t),debug:t=>io(Gr.debug,t),trace:t=>io(Gr.trace,t)},J_=Object.keys(Gr).reduce((t,e)=>(t[Gr[e]]=e,t),{}),pK=Object.keys(J_).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function hK(t){let e=t[lK].level,{labels:r}=t.levels,n={};for(let s in r){let o=e(r[s],Number(s));n[s]=JSON.stringify(o).slice(0,-1)}return t[aK]=n,t}function mK(t,e){if(e)return!1;switch(t){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}function gK(t){let{labels:e,values:r}=this.levels;if(typeof t=="number"){if(e[t]===void 0)throw Error("unknown level value"+t);t=e[t]}if(r[t]===void 0)throw Error("unknown level "+t);let n=this[G_],s=this[G_]=r[t],o=this[cK],i=this[rO],a=this[dK].logMethod;for(let c in r){if(i(r[c],s)===!1){this[c]=fK;continue}this[c]=mK(c,o)?sO[c](a):io(r[c],a)}this.emit("level-change",t,s,e[n],n,this)}function yK(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function _K(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&this[rO](r,this[G_])}function vK(t,e,r){return t===nO.DESC?e<=r:e>=r}function bK(t){return typeof t=="string"?vK.bind(null,t):t}function wK(t=null,e=!1){let r=t?Object.keys(t).reduce((o,i)=>(o[t[i]]=i,o),{}):null,n=Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),e?null:J_,r),s=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),e?null:Gr,t);return{labels:n,values:s}}function xK(t,e,r){if(typeof t=="number"){if(![].concat(Object.keys(e||{}).map(o=>e[o]),r?[]:Object.keys(J_).map(o=>+o),1/0).includes(t))throw Error(`default level:${t} must be included in custom levels`);return}let n=Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),r?null:Gr,e);if(!(t in n))throw Error(`default level:${t} must be included in custom levels`)}function SK(t,e){let{labels:r,values:n}=t;for(let s in e){if(s in n)throw Error("levels cannot be overridden");if(e[s]in r)throw Error("pre-existing level values cannot be used for new levels")}}function kK(t){if(typeof t!="function"&&!(typeof t=="string"&&Object.values(nO).includes(t)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}oO.exports={initialLsCache:pK,genLsCache:hK,levelMethods:sO,getLevel:yK,setLevel:gK,isLevelEnabled:_K,mappings:wK,assertNoLevelCollisions:SK,assertDefaultLevelFound:xK,genLevelComparison:bK,assertLevelComparison:kK}});var Y_=S((Rfe,iO)=>{"use strict";f();iO.exports={version:"9.14.0"}});var hO=S((Mfe,pO)=>{"use strict";f();var{EventEmitter:EK}=Te("events"),{lsCacheSym:TK,levelValSym:$K,setLevelSym:$d,getLevelSym:aO,chindingsSym:Id,parsedChindingsSym:IK,mixinSym:OK,asJsonSym:uO,writeSym:PK,mixinMergeStrategySym:CK,timeSym:NK,timeSliceIndexSym:AK,streamSym:lO,serializersSym:ao,formattersSym:uc,errorKeySym:RK,messageKeySym:jK,useOnlyCustomLevelsSym:zK,needsMetadataGsym:MK,redactFmtSym:LK,stringifySym:qK,formatOptsSym:ZK,stringifiersSym:DK,msgPrefixSym:Q_,hooksSym:FK}=xi(),{getLevel:UK,setLevel:VK,isLevelEnabled:BK,mappings:HK,initialLsCache:KK,genLsCache:GK,assertNoLevelCollisions:JK}=W_(),{asChindings:ev,asJson:WK,buildFormatters:X_,stringify:cO,noop:dO}=kd(),{version:YK}=Y_(),XK=C_(),QK=class{},fO={constructor:QK,child:e3,bindings:t3,setBindings:r3,flush:o3,isLevelEnabled:BK,version:YK,get level(){return this[aO]()},set level(t){this[$d](t)},get levelVal(){return this[$K]},set levelVal(t){throw Error("levelVal is read-only")},get msgPrefix(){return this[Q_]},get[Symbol.toStringTag](){return"Pino"},[TK]:KK,[PK]:s3,[uO]:WK,[aO]:UK,[$d]:VK};Object.setPrototypeOf(fO,EK.prototype);pO.exports=function(){return Object.create(fO)};var Td=t=>t;function e3(t,e){if(!t)throw Error("missing bindings for child Pino");let r=this[ao],n=this[uc],s=Object.create(this);if(e==null)return s[uc].bindings!==Td&&(s[uc]=X_(n.level,Td,n.log)),s[Id]=ev(s,t),s[$d](this.level),this.onChild!==dO&&this.onChild(s),s;if(e.hasOwnProperty("serializers")===!0){s[ao]=Object.create(null);for(let l in r)s[ao][l]=r[l];let c=Object.getOwnPropertySymbols(r);for(var o=0;o<c.length;o++){let l=c[o];s[ao][l]=r[l]}for(let l in e.serializers)s[ao][l]=e.serializers[l];let u=Object.getOwnPropertySymbols(e.serializers);for(var i=0;i<u.length;i++){let l=u[i];s[ao][l]=e.serializers[l]}}else s[ao]=r;if(e.hasOwnProperty("formatters")){let{level:c,bindings:u,log:l}=e.formatters;s[uc]=X_(c||n.level,u||Td,l||n.log)}else s[uc]=X_(n.level,Td,n.log);if(e.hasOwnProperty("customLevels")===!0&&(JK(this.levels,e.customLevels),s.levels=HK(e.customLevels,s[zK]),GK(s)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){s.redact=e.redact;let c=XK(s.redact,cO),u={stringify:c[LK]};s[qK]=cO,s[DK]=c,s[ZK]=u}typeof e.msgPrefix=="string"&&(s[Q_]=(this[Q_]||"")+e.msgPrefix),s[Id]=ev(s,t);let a=e.level||this.level;return s[$d](a),this.onChild(s),s}function t3(){let e=`{${this[Id].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function r3(t){let e=ev(this,t);this[Id]=e,delete this[IK]}function n3(t,e){return Object.assign(e,t)}function s3(t,e,r){let n=this[NK](),s=this[OK],o=this[RK],i=this[jK],a=this[CK]||n3,c,u=this[FK].streamWrite;t==null?c={}:t instanceof Error?(c={[o]:t},e===void 0&&(e=t.message)):(c=t,e===void 0&&t[i]===void 0&&t[o]&&(e=t[o].message)),s&&(c=a(c,s(c,r,this)));let l=this[uO](c,e,r,n),d=this[lO];d[MK]===!0&&(d.lastLevel=r,d.lastObj=c,d.lastMsg=e,d.lastTime=n.slice(this[AK]),d.lastLogger=this),d.write(u?u(l):l)}function o3(t){if(t!=null&&typeof t!="function")throw Error("callback must be a function");let e=this[lO];typeof e.flush=="function"?e.flush(t||dO):t&&t()}});var _O=S((sv,yO)=>{"use strict";f();var{hasOwnProperty:lc}=Object.prototype,uo=nv();uo.configure=nv;uo.stringify=uo;uo.default=uo;sv.stringify=uo;sv.configure=nv;yO.exports=uo;var i3=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Kn(t){return t.length<5e3&&!i3.test(t)?`"${t}"`:JSON.stringify(t)}function tv(t,e){if(t.length>200||e)return t.sort(e);for(let r=1;r<t.length;r++){let n=t[r],s=r;for(;s!==0&&t[s-1]>n;)t[s]=t[s-1],s--;t[s]=n}return t}var a3=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function rv(t){return a3.call(t)!==void 0&&t.length!==0}function mO(t,e,r){t.length<r&&(r=t.length);let n=e===","?"":" ",s=`"0":${n}${t[0]}`;for(let o=1;o<r;o++)s+=`${e}"${o}":${n}${t[o]}`;return s}function c3(t){if(lc.call(t,"circularValue")){let e=t.circularValue;if(typeof e=="string")return`"${e}"`;if(e==null)return e;if(e===Error||e===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function u3(t){let e;if(lc.call(t,"deterministic")&&(e=t.deterministic,typeof e!="boolean"&&typeof e!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return e===void 0?!0:e}function l3(t,e){let r;if(lc.call(t,e)&&(r=t[e],typeof r!="boolean"))throw new TypeError(`The "${e}" argument must be of type boolean`);return r===void 0?!0:r}function gO(t,e){let r;if(lc.call(t,e)){if(r=t[e],typeof r!="number")throw new TypeError(`The "${e}" argument must be of type number`);if(!Number.isInteger(r))throw new TypeError(`The "${e}" argument must be an integer`);if(r<1)throw new RangeError(`The "${e}" argument must be >= 1`)}return r===void 0?1/0:r}function co(t){return t===1?"1 item":`${t} items`}function d3(t){let e=new Set;for(let r of t)(typeof r=="string"||typeof r=="number")&&e.add(String(r));return e}function f3(t){if(lc.call(t,"strict")){let e=t.strict;if(typeof e!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(e)return r=>{let n=`Object can not safely be stringified. Received type ${typeof r}`;throw typeof r!="function"&&(n+=` (${r.toString()})`),new Error(n)}}}function nv(t){t={...t};let e=f3(t);e&&(t.bigint===void 0&&(t.bigint=!1),"circularValue"in t||(t.circularValue=Error));let r=c3(t),n=l3(t,"bigint"),s=u3(t),o=typeof s=="function"?s:void 0,i=gO(t,"maximumDepth"),a=gO(t,"maximumBreadth");function c(g,h,m,_,b,w){let x=h[g];switch(typeof x=="object"&&x!==null&&typeof x.toJSON=="function"&&(x=x.toJSON(g)),x=_.call(h,g,x),typeof x){case"string":return Kn(x);case"object":{if(x===null)return"null";if(m.indexOf(x)!==-1)return r;let T="",O=",",L=w;if(Array.isArray(x)){if(x.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(x),b!==""&&(w+=b,T+=`
|
|
12
|
+
${w}`,O=`,
|
|
13
|
+
${w}`);let z=Math.min(x.length,a),V=0;for(;V<z-1;V++){let pe=c(String(V),x,m,_,b,w);T+=pe!==void 0?pe:"null",T+=O}let te=c(String(V),x,m,_,b,w);if(T+=te!==void 0?te:"null",x.length-1>a){let pe=x.length-a-1;T+=`${O}"... ${co(pe)} not stringified"`}return b!==""&&(T+=`
|
|
14
|
+
${L}`),m.pop(),`[${T}]`}let U=Object.keys(x),$=U.length;if($===0)return"{}";if(i<m.length+1)return'"[Object]"';let A="",F="";b!==""&&(w+=b,O=`,
|
|
15
|
+
${w}`,A=" ");let C=Math.min($,a);s&&!rv(x)&&(U=tv(U,o)),m.push(x);for(let z=0;z<C;z++){let V=U[z],te=c(V,x,m,_,b,w);te!==void 0&&(T+=`${F}${Kn(V)}:${A}${te}`,F=O)}if($>a){let z=$-a;T+=`${F}"...":${A}"${co(z)} not stringified"`,F=O}return b!==""&&F.length>1&&(T=`
|
|
16
16
|
${w}${T}
|
|
17
|
-
${L}`),m.pop(),`{${T}}`}case"number":return isFinite(x)?String(x):e?e(x):"null";case"boolean":return x===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(x);default:return e?e(x):void 0}}function u(g,h,m,_,b,w){switch(typeof h=="object"&&h!==null&&typeof h.toJSON=="function"&&(h=h.toJSON(g)),typeof h){case"string":return Kn(h);case"object":{if(h===null)return"null";if(m.indexOf(h)!==-1)return r;let x=w,T="",
|
|
18
|
-
${w}`,
|
|
19
|
-
${w}`);let $=Math.min(h.length,a),
|
|
20
|
-
${x}`),m.pop(),`[${T}]`}m.push(h);let L="";b!==""&&(w+=b,
|
|
21
|
-
${w}`,L=" ");let U="";for(let $ of _){let
|
|
17
|
+
${L}`),m.pop(),`{${T}}`}case"number":return isFinite(x)?String(x):e?e(x):"null";case"boolean":return x===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(x);default:return e?e(x):void 0}}function u(g,h,m,_,b,w){switch(typeof h=="object"&&h!==null&&typeof h.toJSON=="function"&&(h=h.toJSON(g)),typeof h){case"string":return Kn(h);case"object":{if(h===null)return"null";if(m.indexOf(h)!==-1)return r;let x=w,T="",O=",";if(Array.isArray(h)){if(h.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(h),b!==""&&(w+=b,T+=`
|
|
18
|
+
${w}`,O=`,
|
|
19
|
+
${w}`);let $=Math.min(h.length,a),A=0;for(;A<$-1;A++){let C=u(String(A),h[A],m,_,b,w);T+=C!==void 0?C:"null",T+=O}let F=u(String(A),h[A],m,_,b,w);if(T+=F!==void 0?F:"null",h.length-1>a){let C=h.length-a-1;T+=`${O}"... ${co(C)} not stringified"`}return b!==""&&(T+=`
|
|
20
|
+
${x}`),m.pop(),`[${T}]`}m.push(h);let L="";b!==""&&(w+=b,O=`,
|
|
21
|
+
${w}`,L=" ");let U="";for(let $ of _){let A=u($,h[$],m,_,b,w);A!==void 0&&(T+=`${U}${Kn($)}:${L}${A}`,U=O)}return b!==""&&U.length>1&&(T=`
|
|
22
22
|
${w}${T}
|
|
23
|
-
${x}`),m.pop(),`{${T}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return e?e(h):void 0}}function l(g,h,m,_,b){switch(typeof h){case"string":return Kn(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(g),typeof h!="object")return l(g,h,m,_,b);if(h===null)return"null"}if(m.indexOf(h)!==-1)return r;let w=b;if(Array.isArray(h)){if(h.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(h),b+=_;let
|
|
23
|
+
${x}`),m.pop(),`{${T}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return e?e(h):void 0}}function l(g,h,m,_,b){switch(typeof h){case"string":return Kn(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(g),typeof h!="object")return l(g,h,m,_,b);if(h===null)return"null"}if(m.indexOf(h)!==-1)return r;let w=b;if(Array.isArray(h)){if(h.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(h),b+=_;let A=`
|
|
24
24
|
${b}`,F=`,
|
|
25
|
-
${b}`,C=Math.min(h.length,a),z=0;for(;z<C-1;z++){let te=l(String(z),h[z],m,_,b);
|
|
26
|
-
${w}`,m.pop(),`[${
|
|
27
|
-
${b}`,L="",U="",$=Math.min(T,a);rv(h)&&(L+=
|
|
25
|
+
${b}`,C=Math.min(h.length,a),z=0;for(;z<C-1;z++){let te=l(String(z),h[z],m,_,b);A+=te!==void 0?te:"null",A+=F}let V=l(String(z),h[z],m,_,b);if(A+=V!==void 0?V:"null",h.length-1>a){let te=h.length-a-1;A+=`${F}"... ${co(te)} not stringified"`}return A+=`
|
|
26
|
+
${w}`,m.pop(),`[${A}]`}let x=Object.keys(h),T=x.length;if(T===0)return"{}";if(i<m.length+1)return'"[Object]"';b+=_;let O=`,
|
|
27
|
+
${b}`,L="",U="",$=Math.min(T,a);rv(h)&&(L+=mO(h,O,a),x=x.slice(h.length),$-=h.length,U=O),s&&(x=tv(x,o)),m.push(h);for(let A=0;A<$;A++){let F=x[A],C=l(F,h[F],m,_,b);C!==void 0&&(L+=`${U}${Kn(F)}: ${C}`,U=O)}if(T>a){let A=T-a;L+=`${U}"...": "${co(A)} not stringified"`,U=O}return U!==""&&(L=`
|
|
28
28
|
${b}${L}
|
|
29
|
-
${w}`),m.pop(),`{${L}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return e?e(h):void 0}}function d(g,h,m){switch(typeof h){case"string":return Kn(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(g),typeof h!="object")return d(g,h,m);if(h===null)return"null"}if(m.indexOf(h)!==-1)return r;let _="",b=h.length!==void 0;if(b&&Array.isArray(h)){if(h.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(h);let L=Math.min(h.length,a),U=0;for(;U<L-1;U++){let
|
|
29
|
+
${w}`),m.pop(),`{${L}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return e?e(h):void 0}}function d(g,h,m){switch(typeof h){case"string":return Kn(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(g),typeof h!="object")return d(g,h,m);if(h===null)return"null"}if(m.indexOf(h)!==-1)return r;let _="",b=h.length!==void 0;if(b&&Array.isArray(h)){if(h.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(h);let L=Math.min(h.length,a),U=0;for(;U<L-1;U++){let A=d(String(U),h[U],m);_+=A!==void 0?A:"null",_+=","}let $=d(String(U),h[U],m);if(_+=$!==void 0?$:"null",h.length-1>a){let A=h.length-a-1;_+=`,"... ${co(A)} not stringified"`}return m.pop(),`[${_}]`}let w=Object.keys(h),x=w.length;if(x===0)return"{}";if(i<m.length+1)return'"[Object]"';let T="",O=Math.min(x,a);b&&rv(h)&&(_+=mO(h,",",a),w=w.slice(h.length),O-=h.length,T=","),s&&(w=tv(w,o)),m.push(h);for(let L=0;L<O;L++){let U=w[L],$=d(U,h[U],m);$!==void 0&&(_+=`${T}${Kn(U)}:${$}`,T=",")}if(x>a){let L=x-a;_+=`${T}"...":"${co(L)} not stringified"`}return m.pop(),`{${_}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return e?e(h):void 0}}function p(g,h,m){if(arguments.length>1){let _="";if(typeof m=="number"?_=" ".repeat(Math.min(m,10)):typeof m=="string"&&(_=m.slice(0,10)),h!=null){if(typeof h=="function")return c("",{"":g},[],h,_,"");if(Array.isArray(h))return u("",g,[],d3(h),_,"")}if(_.length!==0)return l("",g,[],_,"")}return d("",g,[])}return p}});var xO=S((Zfe,wO)=>{"use strict";f();var ov=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:bO}=Ed(),p3=bO.info;function h3(t,e){t=t||[],e=e||{dedupe:!1};let r=Object.create(bO);r.silent=1/0,e.levels&&typeof e.levels=="object"&&Object.keys(e.levels).forEach(d=>{r[d]=e.levels[d]});let n={write:s,add:a,remove:c,emit:o,flushSync:i,end:u,minLevel:0,lastId:0,streams:[],clone:l,[ov]:!0,streamLevels:r};return Array.isArray(t)?t.forEach(a,n):a.call(n,t),t=null,n;function s(d){let p,g=this.lastLevel,{streams:h}=this,m=0,_;for(let b=m3(h.length,e.dedupe);y3(b,h.length,e.dedupe);b=g3(b,e.dedupe))if(p=h[b],p.level<=g){if(m!==0&&m!==p.level)break;if(_=p.stream,_[ov]){let{lastTime:w,lastMsg:x,lastObj:T,lastLogger:O}=this;_.lastLevel=g,_.lastTime=w,_.lastMsg=x,_.lastObj=T,_.lastLogger=O}_.write(d),e.dedupe&&(m=p.level)}else if(!e.dedupe)break}function o(...d){for(let{stream:p}of this.streams)typeof p.emit=="function"&&p.emit(...d)}function i(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync()}function a(d){if(!d)return n;let p=typeof d.write=="function"||d.stream,g=d.write?d:d.stream;if(!p)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:h,streamLevels:m}=this,_;typeof d.levelVal=="number"?_=d.levelVal:typeof d.level=="string"?_=m[d.level]:typeof d.level=="number"?_=d.level:_=p3;let b={stream:g,level:_,levelVal:void 0,id:++n.lastId};return h.unshift(b),h.sort(vO),this.minLevel=h[0].level,n}function c(d){let{streams:p}=this,g=p.findIndex(h=>h.id===d);return g>=0&&(p.splice(g,1),p.sort(vO),this.minLevel=p.length>0?p[0].level:-1),n}function u(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync(),d.end()}function l(d){let p=new Array(this.streams.length);for(let g=0;g<p.length;g++)p[g]={level:d,stream:this.streams[g].stream};return{write:s,add:a,remove:c,minLevel:d,streams:p,clone:l,emit:o,flushSync:i,[ov]:!0}}}function vO(t,e){return t.level-e.level}function m3(t,e){return e?t-1:0}function g3(t,e){return e?t-1:t+1}function y3(t,e,r){return r?t>=0:t<e}wO.exports=h3});var zO=S((Ffe,lr)=>{"use strict";f();var _3=Te("os"),PO=$_(),v3=I_(),b3=C_(),CO=mI(),w3=hO(),NO=xi(),{configure:x3}=_O(),{assertDefaultLevelFound:S3,mappings:AO,genLsCache:k3,genLevelComparison:E3,assertLevelComparison:T3}=W_(),{DEFAULT_LEVELS:RO,SORTING_ORDER:$3}=Ed(),{createArgsNormalizer:I3,asChindings:O3,buildSafeSonicBoom:SO,buildFormatters:P3,stringify:iv,normalizeDestFileDescriptor:kO,noop:C3}=kd(),{version:N3}=Y_(),{chindingsSym:EO,redactFmtSym:A3,serializersSym:TO,timeSym:R3,timeSliceIndexSym:j3,streamSym:z3,stringifySym:$O,stringifySafeSym:av,stringifiersSym:IO,setLevelSym:M3,endSym:L3,formatOptsSym:q3,messageKeySym:Z3,errorKeySym:D3,nestedKeySym:F3,mixinSym:U3,levelCompSym:V3,useOnlyCustomLevelsSym:B3,formattersSym:OO,hooksSym:H3,nestedKeyStrSym:K3,mixinMergeStrategySym:G3,msgPrefixSym:J3}=NO,{epochTime:jO,nullTime:W3}=CO,{pid:Y3}=process,X3=_3.hostname(),Q3=PO.err,eG={level:"info",levelComparison:$3.ASC,levels:RO,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:Y3,hostname:X3},serializers:Object.assign(Object.create(null),{err:Q3}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:jO,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},tG=I3(eG),rG=Object.assign(Object.create(null),PO);function cv(...t){let e={},{opts:r,stream:n}=tG(e,v3(),...t);r.level&&typeof r.level=="string"&&RO[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{redact:s,crlf:o,serializers:i,timestamp:a,messageKey:c,errorKey:u,nestedKey:l,base:d,name:p,level:g,customLevels:h,levelComparison:m,mixin:_,mixinMergeStrategy:b,useOnlyCustomLevels:w,formatters:x,hooks:T,depthLimit:O,edgeLimit:L,onChild:U,msgPrefix:$}=r,A=x3({maximumDepth:O,maximumBreadth:L}),F=P3(x.level,x.bindings,x.log),C=iv.bind({[av]:A}),z=s?b3(s,C):{},V=s?{stringify:z[A3]}:{stringify:C},te="}"+(o?`\r
|
|
30
30
|
`:`
|
|
31
|
-
`),pe=k3.bind(null,{[kP]:"",[EP]:i,[$P]:z,[TP]:iv,[av]:N,[IP]:F}),ee="";d!==null&&(p===void 0?ee=pe(d):ee=pe(Object.assign({},d,{name:p})));let Ie=a instanceof Function?a:a?RP:B3,Fe=Ie().indexOf(":")+1;if(w&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(_&&typeof _!="function")throw Error(`Unknown mixin type "${typeof _}" - expected "function"`);if($&&typeof $!="string")throw Error(`Unknown msgPrefix type "${typeof $}" - expected "string"`);_3(g,h,w);let Ne=AP(h,w);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:Ne,messageKey:c,errorKey:u}}),w3(m);let lu=b3(m);return Object.assign(e,{levels:Ne,[q3]:lu,[Z3]:w,[C3]:n,[P3]:Ie,[O3]:Fe,[TP]:iv,[av]:N,[$P]:z,[N3]:te,[R3]:V,[j3]:c,[z3]:u,[M3]:l,[F3]:l?`,${JSON.stringify(l)}:{`:"",[EP]:i,[L3]:_,[U3]:b,[kP]:ee,[IP]:F,[D3]:T,silent:T3,onChild:U,[V3]:$}),Object.setPrototypeOf(e,g3()),v3(e),e[A3](g),e}lr.exports=cv;lr.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=SP(t.dest||process.stdout.fd),xP(t)):xP({dest:SP(t),minLength:0});lr.exports.transport=V_();lr.exports.multistream=wP();lr.exports.levels=AP();lr.exports.stdSerializers=Y3;lr.exports.stdTimeFunctions=Object.assign({},OP);lr.exports.symbols=CP;lr.exports.version=$3;lr.exports.default=cv;lr.exports.pino=cv});var qP=S(Ei=>{"use strict";f();var X3=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.createMcpLogger=LP;Ei.createLogger=LP;var zP=X3(jP()),MP=y_(),Q3=["password","token","accessToken","access_token","refreshToken","refresh_token","apiKey","api_key","secret","TOOLPILOT_API_KEY","authorization","cookie","*.password","*.token","*.secret","*.apiKey","*.api_key"];function LP(t){let e=t.level??process.env.LOG_LEVEL??(process.env.NODE_ENV!=="production"?"debug":"info"),r={name:t.name,level:e,serializers:{err:MP.errorSerializer,error:MP.errorSerializer},redact:{paths:Q3,censor:"[REDACTED]"},timestamp:zP.default.stdTimeFunctions.isoTime,base:{pid:process.pid,...t.defaultFields}};return(0,zP.default)(r,process.stderr)}});var ZP=S(uv=>{"use strict";f();Object.defineProperty(uv,"__esModule",{value:!0});uv.withErrorHandling=rG;var eG=id(),tG=ad();function rG(t,e,r){return async n=>{try{return await r(n)}catch(s){if(s instanceof tG.AppError){let o=s.severity==="critical"||s.severity==="high"?"error":"warn";return e[o]({err:s,tool:t},`Tool ${t} failed: ${s.message}`),{content:[{type:"text",text:JSON.stringify({ok:!1,error:s.code,message:s.isOperational?s.message:"An internal error occurred"})}],isError:!0}}return e.error({err:s,tool:t},`Unexpected error in tool ${t}`),{content:[{type:"text",text:JSON.stringify({ok:!1,error:eG.ErrorCode.ERR_MCP_HANDLER,message:s instanceof Error?s.message:String(s)})}],isError:!0}}}}});var Oe=S(Pe=>{"use strict";f();Object.defineProperty(Pe,"__esModule",{value:!0});Pe.withErrorHandling=Pe.createLogger=Pe.createMcpLogger=Pe.errorSerializer=Pe.VectorError=Pe.IndexerError=Pe.SearchError=Pe.QueueError=Pe.ExternalServiceError=Pe.AuthError=Pe.ValidationError=Pe.NetworkError=Pe.DatabaseError=Pe.AppError=Pe.ErrorCode=void 0;var nG=id();Object.defineProperty(Pe,"ErrorCode",{enumerable:!0,get:function(){return nG.ErrorCode}});var Jr=ad();Object.defineProperty(Pe,"AppError",{enumerable:!0,get:function(){return Jr.AppError}});Object.defineProperty(Pe,"DatabaseError",{enumerable:!0,get:function(){return Jr.DatabaseError}});Object.defineProperty(Pe,"NetworkError",{enumerable:!0,get:function(){return Jr.NetworkError}});Object.defineProperty(Pe,"ValidationError",{enumerable:!0,get:function(){return Jr.ValidationError}});Object.defineProperty(Pe,"AuthError",{enumerable:!0,get:function(){return Jr.AuthError}});Object.defineProperty(Pe,"ExternalServiceError",{enumerable:!0,get:function(){return Jr.ExternalServiceError}});Object.defineProperty(Pe,"QueueError",{enumerable:!0,get:function(){return Jr.QueueError}});Object.defineProperty(Pe,"SearchError",{enumerable:!0,get:function(){return Jr.SearchError}});Object.defineProperty(Pe,"IndexerError",{enumerable:!0,get:function(){return Jr.IndexerError}});Object.defineProperty(Pe,"VectorError",{enumerable:!0,get:function(){return Jr.VectorError}});var sG=y_();Object.defineProperty(Pe,"errorSerializer",{enumerable:!0,get:function(){return sG.errorSerializer}});var DP=qP();Object.defineProperty(Pe,"createMcpLogger",{enumerable:!0,get:function(){return DP.createMcpLogger}});Object.defineProperty(Pe,"createLogger",{enumerable:!0,get:function(){return DP.createLogger}});var oG=ZP();Object.defineProperty(Pe,"withErrorHandling",{enumerable:!0,get:function(){return oG.withErrorHandling}})});var uO=S((hpe,yv)=>{"use strict";f();(function(){var t;function e(r,n){var s=this instanceof e?this:t;if(s.reset(n),typeof r=="string"&&r.length>0&&s.hash(r),s!==this)return s}e.prototype.hash=function(r){var n,s,o,i,a;switch(a=r.length,this.len+=a,s=this.k1,o=0,this.rem){case 0:s^=a>o?r.charCodeAt(o++)&65535:0;case 1:s^=a>o?(r.charCodeAt(o++)&65535)<<8:0;case 2:s^=a>o?(r.charCodeAt(o++)&65535)<<16:0;case 3:s^=a>o?(r.charCodeAt(o)&255)<<24:0,s^=a>o?(r.charCodeAt(o++)&65280)>>8:0}if(this.rem=a+this.rem&3,a-=this.rem,a>0){for(n=this.h1;s=s*11601+(s&65535)*3432906752&4294967295,s=s<<15|s>>>17,s=s*13715+(s&65535)*461832192&4294967295,n^=s,n=n<<13|n>>>19,n=n*5+3864292196&4294967295,!(o>=a);)s=r.charCodeAt(o++)&65535^(r.charCodeAt(o++)&65535)<<8^(r.charCodeAt(o++)&65535)<<16,i=r.charCodeAt(o++),s^=(i&255)<<24^(i&65280)>>8;switch(s=0,this.rem){case 3:s^=(r.charCodeAt(o+2)&65535)<<16;case 2:s^=(r.charCodeAt(o+1)&65535)<<8;case 1:s^=r.charCodeAt(o)&65535}this.h1=n}return this.k1=s,this},e.prototype.result=function(){var r,n;return r=this.k1,n=this.h1,r>0&&(r=r*11601+(r&65535)*3432906752&4294967295,r=r<<15|r>>>17,r=r*13715+(r&65535)*461832192&4294967295,n^=r),n^=this.len,n^=n>>>16,n=n*51819+(n&65535)*2246770688&4294967295,n^=n>>>13,n=n*44597+(n&65535)*3266445312&4294967295,n^=n>>>16,n>>>0},e.prototype.reset=function(r){return this.h1=typeof r=="number"?r:0,this.rem=this.k1=this.len=0,this},t=new e,typeof yv<"u"?yv.exports=e:this.MurmurHash3=e})()});var lO=S(fo=>{"use strict";f();Object.defineProperty(fo,"__esModule",{value:!0});fo.signals=void 0;fo.signals=[];fo.signals.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&fo.signals.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&fo.signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var dO=S(Yr=>{"use strict";f();var Ad;Object.defineProperty(Yr,"__esModule",{value:!0});Yr.unload=Yr.load=Yr.onExit=Yr.signals=void 0;var Nd=lO();Object.defineProperty(Yr,"signals",{enumerable:!0,get:function(){return Nd.signals}});var Rd=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",_v=Symbol.for("signal-exit emitter"),vv=globalThis,fG=Object.defineProperty.bind(Object),bv=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(vv[_v])return vv[_v];fG(vv,_v,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],s=n.indexOf(r);s!==-1&&(s===0&&n.length===1?n.length=0:n.splice(s,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let s=!1;for(let o of this.listeners[e])s=o(r,n)===!0||s;return e==="exit"&&(s=this.emit("afterExit",r,n)||s),s}},jd=class{},pG=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),wv=class extends jd{onExit(){return()=>{}}load(){}unload(){}},xv=class extends jd{#r=Sv.platform==="win32"?"SIGINT":"SIGHUP";#t=new bv;#e;#o;#i;#s={};#n=!1;constructor(e){super(),this.#e=e,this.#s={};for(let r of Nd.signals)this.#s[r]=()=>{let n=this.#e.listeners(r),{count:s}=this.#t,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(s+=o.__signal_exit_emitter__.count),n.length===s){this.unload();let i=this.#t.emit("exit",null,r),a=r==="SIGHUP"?this.#r:r;i||e.kill(e.pid,a)}};this.#i=e.reallyExit,this.#o=e.emit}onExit(e,r){if(!Rd(this.#e))return()=>{};this.#n===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#t.on(n,e),()=>{this.#t.removeListener(n,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#n){this.#n=!0,this.#t.count+=1;for(let e of Nd.signals)try{let r=this.#s[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#n&&(this.#n=!1,Nd.signals.forEach(e=>{let r=this.#s[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#i,this.#t.count-=1)}#a(e){return Rd(this.#e)?(this.#e.exitCode=e||0,this.#t.emit("exit",this.#e.exitCode,null),this.#i.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#o;if(e==="exit"&&Rd(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let s=n.call(this.#e,e,...r);return this.#t.emit("exit",this.#e.exitCode,null),s}else return n.call(this.#e,e,...r)}},Sv=globalThis.process;Ad=pG(Rd(Sv)?new xv(Sv):new wv),Yr.onExit=Ad.onExit,Yr.load=Ad.load,Yr.unload=Ad.unload});var Md=S((bpe,hc)=>{"use strict";f();hc.exports=bG;hc.exports.sync=wG;hc.exports._getTmpname=kv;hc.exports._cleanupOnExit=Ev;var Xe=Te("fs"),hG=uO(),{onExit:fO}=dO(),mG=Te("path"),{promisify:fr}=Te("util"),Gn={},gG=(function(){try{return Te("worker_threads").threadId}catch{return 0}})(),yG=0;function kv(t){return t+"."+hG(v).hash(String(process.pid)).hash(String(gG)).hash(String(++yG)).result()}function Ev(t){return()=>{try{Xe.unlinkSync(typeof t=="function"?t():t)}catch{}}}function _G(t){return new Promise(e=>{Gn[t]||(Gn[t]=[]),Gn[t].push(e),Gn[t].length===1&&e()})}function zd(t){return t.code==="ENOSYS"||(!process.getuid||process.getuid()!==0)&&(t.code==="EINVAL"||t.code==="EPERM")}async function vG(t,e,r={}){typeof r=="string"&&(r={encoding:r});let n,s,o=fO(Ev(()=>s)),i=mG.resolve(t);try{await _G(i);let a=await fr(Xe.realpath)(t).catch(()=>t);if(s=kv(a),!r.mode||!r.chown){let c=await fr(Xe.stat)(a).catch(()=>{});c&&(r.mode==null&&(r.mode=c.mode),r.chown==null&&process.getuid&&(r.chown={uid:c.uid,gid:c.gid}))}n=await fr(Xe.open)(s,"w",r.mode),r.tmpfileCreated&&await r.tmpfileCreated(s),ArrayBuffer.isView(e)?await fr(Xe.write)(n,e,0,e.length,0):e!=null&&await fr(Xe.write)(n,String(e),0,String(r.encoding||"utf8")),r.fsync!==!1&&await fr(Xe.fsync)(n),await fr(Xe.close)(n),n=null,r.chown&&await fr(Xe.chown)(s,r.chown.uid,r.chown.gid).catch(c=>{if(!zd(c))throw c}),r.mode&&await fr(Xe.chmod)(s,r.mode).catch(c=>{if(!zd(c))throw c}),await fr(Xe.rename)(s,a)}finally{n&&await fr(Xe.close)(n).catch(()=>{}),o(),await fr(Xe.unlink)(s).catch(()=>{}),Gn[i].shift(),Gn[i].length>0?Gn[i][0]():delete Gn[i]}}async function bG(t,e,r,n){r instanceof Function&&(n=r,r={});let s=vG(t,e,r);if(n)try{let o=await s;return n(o)}catch(o){return n(o)}return s}function wG(t,e,r){typeof r=="string"?r={encoding:r}:r||(r={});try{t=Xe.realpathSync(t)}catch{}let n=kv(t);if(!r.mode||!r.chown)try{let c=Xe.statSync(t);r=Object.assign({},r),r.mode||(r.mode=c.mode),!r.chown&&process.getuid&&(r.chown={uid:c.uid,gid:c.gid})}catch{}let s,o=Ev(n),i=fO(o),a=!0;try{if(s=Xe.openSync(n,"w",r.mode||438),r.tmpfileCreated&&r.tmpfileCreated(n),ArrayBuffer.isView(e)?Xe.writeSync(s,e,0,e.length,0):e!=null&&Xe.writeSync(s,String(e),0,String(r.encoding||"utf8")),r.fsync!==!1&&Xe.fsyncSync(s),Xe.closeSync(s),s=null,r.chown)try{Xe.chownSync(n,r.chown.uid,r.chown.gid)}catch(c){if(!zd(c))throw c}if(r.mode)try{Xe.chmodSync(n,r.mode)}catch(c){if(!zd(c))throw c}Xe.renameSync(n,t),a=!1}finally{if(s)try{Xe.closeSync(s)}catch{}i(),a&&o()}}});var yO=S((qpe,gO)=>{"use strict";f();var Wn=Te("constants"),PG=process.cwd,Zd=null,OG=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Zd||(Zd=PG.call(process)),Zd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cv=process.chdir,process.chdir=function(t){Zd=null,Cv.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cv));var Cv;gO.exports=CG;function CG(t){Wn.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=i(t.chownSync),t.fchownSync=i(t.fchownSync),t.lchownSync=i(t.lchownSync),t.chmodSync=s(t.chmodSync),t.fchmodSync=s(t.fchmodSync),t.lchmodSync=s(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,d,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,d,p,g){g&&process.nextTick(g)},t.lchownSync=function(){}),OG==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function d(p,g,h){var m=Date.now(),_=0;l(p,g,function b(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){t.stat(g,function(x,T){x&&x.code==="ENOENT"?l(p,g,b):h(w)})},_),_<100&&(_+=10);return}h&&h(w)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function d(p,g,h,m,_,b){var w;if(b&&typeof b=="function"){var x=0;w=function(T,P,L){if(T&&T.code==="EAGAIN"&&x<10)return x++,l.call(t,p,g,h,m,_,w);b.apply(this,arguments)}}return l.call(t,p,g,h,m,_,w)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(d,p,g,h,m){for(var _=0;;)try{return l.call(t,d,p,g,h,m)}catch(b){if(b.code==="EAGAIN"&&_<10){_++;continue}throw b}}})(t.readSync);function e(l){l.lchmod=function(d,p,g){l.open(d,Wn.O_WRONLY|Wn.O_SYMLINK,p,function(h,m){if(h){g&&g(h);return}l.fchmod(m,p,function(_){l.close(m,function(b){g&&g(_||b)})})})},l.lchmodSync=function(d,p){var g=l.openSync(d,Wn.O_WRONLY|Wn.O_SYMLINK,p),h=!0,m;try{m=l.fchmodSync(g,p),h=!1}finally{if(h)try{l.closeSync(g)}catch{}else l.closeSync(g)}return m}}function r(l){Wn.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(d,p,g,h){l.open(d,Wn.O_SYMLINK,function(m,_){if(m){h&&h(m);return}l.futimes(_,p,g,function(b){l.close(_,function(w){h&&h(b||w)})})})},l.lutimesSync=function(d,p,g){var h=l.openSync(d,Wn.O_SYMLINK),m,_=!0;try{m=l.futimesSync(h,p,g),_=!1}finally{if(_)try{l.closeSync(h)}catch{}else l.closeSync(h)}return m}):l.futimes&&(l.lutimes=function(d,p,g,h){h&&process.nextTick(h)},l.lutimesSync=function(){})}function n(l){return l&&function(d,p,g){return l.call(t,d,p,function(h){u(h)&&(h=null),g&&g.apply(this,arguments)})}}function s(l){return l&&function(d,p){try{return l.call(t,d,p)}catch(g){if(!u(g))throw g}}}function o(l){return l&&function(d,p,g,h){return l.call(t,d,p,g,function(m){u(m)&&(m=null),h&&h.apply(this,arguments)})}}function i(l){return l&&function(d,p,g){try{return l.call(t,d,p,g)}catch(h){if(!u(h))throw h}}}function a(l){return l&&function(d,p,g){typeof p=="function"&&(g=p,p=null);function h(m,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),g&&g.apply(this,arguments)}return p?l.call(t,d,p,h):l.call(t,d,h)}}function c(l){return l&&function(d,p){var g=p?l.call(t,d,p):l.call(t,d);return g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),g}}function u(l){if(!l||l.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var bO=S((Dpe,vO)=>{"use strict";f();var _O=Te("stream").Stream;vO.exports=AG;function AG(t){return{ReadStream:e,WriteStream:r};function e(n,s){if(!(this instanceof e))return new e(n,s);_O.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,s=s||{};for(var i=Object.keys(s),a=0,c=i.length;a<c;a++){var u=i[a];this[u]=s[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(l,d){if(l){o.emit("error",l),o.readable=!1;return}o.fd=d,o.emit("open",d),o._read()})}function r(n,s){if(!(this instanceof r))return new r(n,s);_O.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,s=s||{};for(var o=Object.keys(s),i=0,a=o.length;i<a;i++){var c=o[i];this[c]=s[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var xO=S((Upe,wO)=>{"use strict";f();wO.exports=RG;var NG=Object.getPrototypeOf||function(t){return t.__proto__};function RG(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:NG(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var jv=S((Bpe,Rv)=>{"use strict";f();var tt=Te("fs"),jG=yO(),zG=bO(),MG=xO(),Dd=Te("util"),_t,Ud;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_t=Symbol.for("graceful-fs.queue"),Ud=Symbol.for("graceful-fs.previous")):(_t="___graceful-fs.queue",Ud="___graceful-fs.previous");function LG(){}function EO(t,e){Object.defineProperty(t,_t,{get:function(){return e}})}var ho=LG;Dd.debuglog?ho=Dd.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ho=function(){var t=Dd.format.apply(Dd,arguments);t="GFS4: "+t.split(/\n/).join(`
|
|
32
|
-
GFS4: `),console.error(t)});tt[_t]||(SO=global[_t]||[],EO(tt,SO),tt.close=(function(t){function e(r,n){return t.call(tt,r,function(s){s||kO(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Ud,{value:t}),e})(tt.close),tt.closeSync=(function(t){function e(r){t.apply(tt,arguments),kO()}return Object.defineProperty(e,Ud,{value:t}),e})(tt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ho(tt[_t]),Te("assert").equal(tt[_t].length,0)}));var SO;global[_t]||EO(global,tt[_t]);Rv.exports=Av(MG(tt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!tt.__patched&&(Rv.exports=Av(tt),tt.__patched=!0);function Av(t){jG(t),t.gracefulify=Av,t.createReadStream=P,t.createWriteStream=L;var e=t.readFile;t.readFile=r;function r(N,F,C){return typeof F=="function"&&(C=F,F=null),z(N,F,C);function z(V,te,pe,ee){return e(V,te,function(Ie){Ie&&(Ie.code==="EMFILE"||Ie.code==="ENFILE")?Ii([z,[V,te,pe],Ie,ee||Date.now(),Date.now()]):typeof pe=="function"&&pe.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=s;function s(N,F,C,z){return typeof C=="function"&&(z=C,C=null),V(N,F,C,z);function V(te,pe,ee,Ie,Fe){return n(te,pe,ee,function(Ne){Ne&&(Ne.code==="EMFILE"||Ne.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ne,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=i);function i(N,F,C,z){return typeof C=="function"&&(z=C,C=null),V(N,F,C,z);function V(te,pe,ee,Ie,Fe){return o(te,pe,ee,function(Ne){Ne&&(Ne.code==="EMFILE"||Ne.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ne,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(N,F,C,z){return typeof C=="function"&&(z=C,C=0),V(N,F,C,z);function V(te,pe,ee,Ie,Fe){return a(te,pe,ee,function(Ne){Ne&&(Ne.code==="EMFILE"||Ne.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ne,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}var u=t.readdir;t.readdir=d;var l=/^v[0-5]\./;function d(N,F,C){typeof F=="function"&&(C=F,F=null);var z=l.test(process.version)?function(pe,ee,Ie,Fe){return u(pe,V(pe,ee,Ie,Fe))}:function(pe,ee,Ie,Fe){return u(pe,ee,V(pe,ee,Ie,Fe))};return z(N,F,C);function V(te,pe,ee,Ie){return function(Fe,Ne){Fe&&(Fe.code==="EMFILE"||Fe.code==="ENFILE")?Ii([z,[te,pe,ee],Fe,Ie||Date.now(),Date.now()]):(Ne&&Ne.sort&&Ne.sort(),typeof ee=="function"&&ee.call(this,Fe,Ne))}}}if(process.version.substr(0,4)==="v0.8"){var p=zG(t);b=p.ReadStream,x=p.WriteStream}var g=t.ReadStream;g&&(b.prototype=Object.create(g.prototype),b.prototype.open=w);var h=t.WriteStream;h&&(x.prototype=Object.create(h.prototype),x.prototype.open=T),Object.defineProperty(t,"ReadStream",{get:function(){return b},set:function(N){b=N},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return x},set:function(N){x=N},enumerable:!0,configurable:!0});var m=b;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(N){m=N},enumerable:!0,configurable:!0});var _=x;Object.defineProperty(t,"FileWriteStream",{get:function(){return _},set:function(N){_=N},enumerable:!0,configurable:!0});function b(N,F){return this instanceof b?(g.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function w(){var N=this;$(N.path,N.flags,N.mode,function(F,C){F?(N.autoClose&&N.destroy(),N.emit("error",F)):(N.fd=C,N.emit("open",C),N.read())})}function x(N,F){return this instanceof x?(h.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function T(){var N=this;$(N.path,N.flags,N.mode,function(F,C){F?(N.destroy(),N.emit("error",F)):(N.fd=C,N.emit("open",C))})}function P(N,F){return new t.ReadStream(N,F)}function L(N,F){return new t.WriteStream(N,F)}var U=t.open;t.open=$;function $(N,F,C,z){return typeof C=="function"&&(z=C,C=null),V(N,F,C,z);function V(te,pe,ee,Ie,Fe){return U(te,pe,ee,function(Ne,lu){Ne&&(Ne.code==="EMFILE"||Ne.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ne,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}return t}function Ii(t){ho("ENQUEUE",t[0].name,t[1]),tt[_t].push(t),Nv()}var Fd;function kO(){for(var t=Date.now(),e=0;e<tt[_t].length;++e)tt[_t][e].length>2&&(tt[_t][e][3]=t,tt[_t][e][4]=t);Nv()}function Nv(){if(clearTimeout(Fd),Fd=void 0,tt[_t].length!==0){var t=tt[_t].shift(),e=t[0],r=t[1],n=t[2],s=t[3],o=t[4];if(s===void 0)ho("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-s>=6e4){ho("TIMEOUT",e.name,r);var i=r.pop();typeof i=="function"&&i.call(null,n)}else{var a=Date.now()-o,c=Math.max(o-s,1),u=Math.min(c*1.2,100);a>=u?(ho("RETRY",e.name,r),e.apply(null,r.concat([s]))):tt[_t].push(t)}Fd===void 0&&(Fd=setTimeout(Nv,0))}}});var $O=S((Kpe,TO)=>{"use strict";f();function hr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}TO.exports=hr;hr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};hr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};hr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,s=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&s.unref(),!0};hr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};hr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};hr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};hr.prototype.start=hr.prototype.try;hr.prototype.errors=function(){return this._errors};hr.prototype.attempts=function(){return this._attempts};hr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var s=this._errors[n],o=s.message,i=(t[o]||0)+1;t[o]=i,i>=r&&(e=s,r=i)}return e}});var IO=S(mo=>{"use strict";f();var qG=$O();mo.operation=function(t){var e=mo.timeouts(t);return new qG(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};mo.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],s=0;s<e.retries;s++)n.push(this.createTimeout(s,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(s,e)),n.sort(function(o,i){return o-i}),n};mo.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};mo.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var s=0;s<r.length;s++){var o=r[s],i=t[o];t[o]=function(c){var u=mo.operation(e),l=Array.prototype.slice.call(arguments,1),d=l.pop();l.push(function(p){u.retry(p)||(p&&(arguments[0]=u.mainError()),d.apply(this,arguments))}),u.attempt(function(){c.apply(t,l)})}.bind(t,i),t[o].options=e}}});var OO=S((Ype,PO)=>{"use strict";f();PO.exports=IO()});var CO=S((Qpe,Vd)=>{"use strict";f();Vd.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Vd.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Vd.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var zO=S((the,Ci)=>{"use strict";f();var Qe=global.process,go=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};go(Qe)?(AO=Te("assert"),Pi=CO(),NO=/^win/i.test(Qe.platform),mc=Te("events"),typeof mc!="function"&&(mc=mc.EventEmitter),Qe.__signal_exit_emitter__?dt=Qe.__signal_exit_emitter__:(dt=Qe.__signal_exit_emitter__=new mc,dt.count=0,dt.emitted={}),dt.infinite||(dt.setMaxListeners(1/0),dt.infinite=!0),Ci.exports=function(t,e){if(!go(global.process))return function(){};AO.equal(typeof t,"function","a callback must be provided for exit handler"),Oi===!1&&zv();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){dt.removeListener(r,t),dt.listeners("exit").length===0&&dt.listeners("afterexit").length===0&&Bd()};return dt.on(r,t),n},Bd=function(){!Oi||!go(global.process)||(Oi=!1,Pi.forEach(function(e){try{Qe.removeListener(e,Hd[e])}catch{}}),Qe.emit=Kd,Qe.reallyExit=Mv,dt.count-=1)},Ci.exports.unload=Bd,yo=function(e,r,n){dt.emitted[e]||(dt.emitted[e]=!0,dt.emit(e,r,n))},Hd={},Pi.forEach(function(t){Hd[t]=function(){if(go(global.process)){var r=Qe.listeners(t);r.length===dt.count&&(Bd(),yo("exit",null,t),yo("afterexit",null,t),NO&&t==="SIGHUP"&&(t="SIGINT"),Qe.kill(Qe.pid,t))}}}),Ci.exports.signals=function(){return Pi},Oi=!1,zv=function(){Oi||!go(global.process)||(Oi=!0,dt.count+=1,Pi=Pi.filter(function(e){try{return Qe.on(e,Hd[e]),!0}catch{return!1}}),Qe.emit=jO,Qe.reallyExit=RO)},Ci.exports.load=zv,Mv=Qe.reallyExit,RO=function(e){go(global.process)&&(Qe.exitCode=e||0,yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),Mv.call(Qe,Qe.exitCode))},Kd=Qe.emit,jO=function(e,r){if(e==="exit"&&go(global.process)){r!==void 0&&(Qe.exitCode=r);var n=Kd.apply(this,arguments);return yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),n}else return Kd.apply(this,arguments)}):Ci.exports=function(){return function(){}};var AO,Pi,NO,mc,dt,Bd,yo,Hd,Oi,zv,Mv,RO,Kd,jO});var LO=S((nhe,Lv)=>{"use strict";f();var MO=Symbol();function ZG(t,e,r){let n=e[MO];if(n)return e.stat(t,(o,i)=>{if(o)return r(o);r(null,i.mtime,n)});let s=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,s,s,o=>{if(o)return r(o);e.stat(t,(i,a)=>{if(i)return r(i);let c=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,MO,{value:c}),r(null,a.mtime,c)})})}function DG(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Lv.exports.probe=ZG;Lv.exports.getMtime=DG});var UO=S((ohe,yc)=>{"use strict";f();var FG=Te("path"),Dv=jv(),UG=OO(),VG=zO(),qO=LO(),vn={};function gc(t,e){return e.lockfilePath||`${t}.lock`}function Fv(t,e,r){if(!e.realpath)return r(null,FG.resolve(t));e.fs.realpath(t,r)}function Zv(t,e,r){let n=gc(t,e);e.fs.mkdir(n,s=>{if(!s)return qO.probe(n,e.fs,(o,i,a)=>{if(o)return e.fs.rmdir(n,()=>{}),r(o);r(null,i,a)});if(s.code!=="EEXIST")return r(s);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(o,i)=>{if(o)return o.code==="ENOENT"?Zv(t,{...e,stale:0},r):r(o);if(!ZO(i,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));DO(t,e,a=>{if(a)return r(a);Zv(t,{...e,stale:0},r)})})})}function ZO(t,e){return t.mtime.getTime()<Date.now()-e.stale}function DO(t,e,r){e.fs.rmdir(gc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Gd(t,e){let r=vn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,s)=>{let o=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||o?qv(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Gd(t,e));if(!(r.mtime.getTime()===s.mtime.getTime()))return qv(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=qO.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,c=>{let u=r.lastUpdate+e.stale<Date.now();if(!r.released){if(c)return c.code==="ENOENT"||u?qv(t,r,Object.assign(c,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Gd(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Gd(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function qv(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),vn[t]===e&&delete vn[t],e.options.onCompromised(r)}function BG(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:Dv,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),Fv(t,e,(n,s)=>{if(n)return r(n);let o=UG.operation(e.retries);o.attempt(()=>{Zv(s,e,(i,a,c)=>{if(o.retry(i))return;if(i)return r(o.mainError());let u=vn[s]={lockfilePath:gc(s,e),mtime:a,mtimePrecision:c,options:e,lastUpdate:Date.now()};Gd(s,e),r(null,l=>{if(u.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));FO(s,{...e,realpath:!1},l)})})})})}function FO(t,e,r){e={fs:Dv,realpath:!0,...e},Fv(t,e,(n,s)=>{if(n)return r(n);let o=vn[s];if(!o)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete vn[s],DO(s,e,r)})}function HG(t,e,r){e={stale:1e4,realpath:!0,fs:Dv,...e},e.stale=Math.max(e.stale||0,2e3),Fv(t,e,(n,s)=>{if(n)return r(n);e.fs.stat(gc(s,e),(o,i)=>o?o.code==="ENOENT"?r(null,!1):r(o):r(null,!ZO(i,e)))})}function KG(){return vn}VG(()=>{for(let t in vn){let e=vn[t].options;try{e.fs.rmdirSync(gc(t,e))}catch{}}});yc.exports.lock=BG;yc.exports.unlock=FO;yc.exports.check=HG;yc.exports.getLocks=KG});var BO=S((ahe,VO)=>{"use strict";f();var GG=jv();function JG(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...s)=>{let o=s.pop(),i;try{i=t[`${n}Sync`](...s)}catch(a){return o(a)}o(null,i)}}),r}function WG(t){return(...e)=>new Promise((r,n)=>{e.push((s,o)=>{s?n(s):r(o)}),t(...e)})}function YG(t){return(...e)=>{let r,n;if(e.push((s,o)=>{r=s,n=o}),t(...e),r)throw r;return n}}function XG(t){if(t={...t},t.fs=JG(t.fs||GG),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}VO.exports={toPromise:WG,toSync:YG,toSyncOptions:XG}});var Vv=S((uhe,Yn)=>{"use strict";f();var Ai=UO(),{toPromise:Jd,toSync:Wd,toSyncOptions:Uv}=BO();async function HO(t,e){let r=await Jd(Ai.lock)(t,e);return Jd(r)}function QG(t,e){let r=Wd(Ai.lock)(t,Uv(e));return Wd(r)}function eJ(t,e){return Jd(Ai.unlock)(t,e)}function tJ(t,e){return Wd(Ai.unlock)(t,Uv(e))}function rJ(t,e){return Jd(Ai.check)(t,e)}function nJ(t,e){return Wd(Ai.check)(t,Uv(e))}Yn.exports=HO;Yn.exports.lock=HO;Yn.exports.unlock=eJ;Yn.exports.lockSync=QG;Yn.exports.unlockSync=tJ;Yn.exports.check=rJ;Yn.exports.checkSync=nJ});var Ee=S(vt=>{"use strict";f();var Gv=Symbol.for("yaml.alias"),b1=Symbol.for("yaml.document"),of=Symbol.for("yaml.map"),w1=Symbol.for("yaml.pair"),Jv=Symbol.for("yaml.scalar"),af=Symbol.for("yaml.seq"),bn=Symbol.for("yaml.node.type"),RJ=t=>!!t&&typeof t=="object"&&t[bn]===Gv,jJ=t=>!!t&&typeof t=="object"&&t[bn]===b1,zJ=t=>!!t&&typeof t=="object"&&t[bn]===of,MJ=t=>!!t&&typeof t=="object"&&t[bn]===w1,x1=t=>!!t&&typeof t=="object"&&t[bn]===Jv,LJ=t=>!!t&&typeof t=="object"&&t[bn]===af;function S1(t){if(t&&typeof t=="object")switch(t[bn]){case of:case af:return!0}return!1}function qJ(t){if(t&&typeof t=="object")switch(t[bn]){case Gv:case of:case Jv:case af:return!0}return!1}var ZJ=t=>(x1(t)||S1(t))&&!!t.anchor;vt.ALIAS=Gv;vt.DOC=b1;vt.MAP=of;vt.NODE_TYPE=bn;vt.PAIR=w1;vt.SCALAR=Jv;vt.SEQ=af;vt.hasAnchor=ZJ;vt.isAlias=RJ;vt.isCollection=S1;vt.isDocument=jJ;vt.isMap=zJ;vt.isNode=qJ;vt.isPair=MJ;vt.isScalar=x1;vt.isSeq=LJ});var wc=S(Wv=>{"use strict";f();var ut=Ee(),Ft=Symbol("break visit"),k1=Symbol("skip children"),Qr=Symbol("remove node");function cf(t,e){let r=E1(e);ut.isDocument(t)?ji(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):ji(null,t,r,Object.freeze([]))}cf.BREAK=Ft;cf.SKIP=k1;cf.REMOVE=Qr;function ji(t,e,r,n){let s=T1(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return $1(t,n,s),ji(t,s,r,n);if(typeof s!="symbol"){if(ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let i=ji(o,e.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===Ft)return Ft;i===Qr&&(e.items.splice(o,1),o-=1)}}}else if(ut.isPair(e)){n=Object.freeze(n.concat(e));let o=ji("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=ji("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}async function uf(t,e){let r=E1(e);ut.isDocument(t)?await zi(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):await zi(null,t,r,Object.freeze([]))}uf.BREAK=Ft;uf.SKIP=k1;uf.REMOVE=Qr;async function zi(t,e,r,n){let s=await T1(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return $1(t,n,s),zi(t,s,r,n);if(typeof s!="symbol"){if(ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let i=await zi(o,e.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===Ft)return Ft;i===Qr&&(e.items.splice(o,1),o-=1)}}}else if(ut.isPair(e)){n=Object.freeze(n.concat(e));let o=await zi("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=await zi("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}function E1(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function T1(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(ut.isMap(e))return r.Map?.(t,e,n);if(ut.isSeq(e))return r.Seq?.(t,e,n);if(ut.isPair(e))return r.Pair?.(t,e,n);if(ut.isScalar(e))return r.Scalar?.(t,e,n);if(ut.isAlias(e))return r.Alias?.(t,e,n)}function $1(t,e,r){let n=e[e.length-1];if(ut.isCollection(n))n.items[t]=r;else if(ut.isPair(n))t==="key"?n.key=r:n.value=r;else if(ut.isDocument(n))n.contents=r;else{let s=ut.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}Wv.visit=cf;Wv.visitAsync=uf});var Yv=S(P1=>{"use strict";f();var I1=Ee(),DJ=wc(),FJ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},UJ=t=>t.replace(/[!,[\]{}]/g,e=>FJ[e]),xc=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),s=n.shift();switch(s){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,i]=n;return this.tags[o]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let i=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,i),!1}}default:return r(0,`Unknown directive ${s}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let i=e.slice(2,-1);return i==="!"||i==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),i)}let[,n,s]=e.match(/^(.*!)([^!]*)$/s);s||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(s)}catch(i){return r(String(i)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+UJ(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),s;if(e&&n.length>0&&I1.isNode(e.contents)){let o={};DJ.visit(e.contents,(i,a)=>{I1.isNode(a)&&a.tag&&(o[a.tag]=!0)}),s=Object.keys(o)}else s=[];for(let[o,i]of n)o==="!!"&&i==="tag:yaml.org,2002:"||(!e||s.some(a=>a.startsWith(i)))&&r.push(`%TAG ${o} ${i}`);return r.join(`
|
|
33
|
-
`)}};xc.defaultYaml={explicit:!1,version:"1.2"};xc.defaultTags={"!!":"tag:yaml.org,2002:"};
|
|
31
|
+
`),pe=O3.bind(null,{[EO]:"",[TO]:i,[IO]:z,[$O]:iv,[av]:A,[OO]:F}),ee="";d!==null&&(p===void 0?ee=pe(d):ee=pe(Object.assign({},d,{name:p})));let Ie=a instanceof Function?a:a?jO:W3,Fe=Ie().indexOf(":")+1;if(w&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(_&&typeof _!="function")throw Error(`Unknown mixin type "${typeof _}" - expected "function"`);if($&&typeof $!="string")throw Error(`Unknown msgPrefix type "${typeof $}" - expected "string"`);S3(g,h,w);let Ae=AO(h,w);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:Ae,messageKey:c,errorKey:u}}),T3(m);let lu=E3(m);return Object.assign(e,{levels:Ae,[V3]:lu,[B3]:w,[z3]:n,[R3]:Ie,[j3]:Fe,[$O]:iv,[av]:A,[IO]:z,[L3]:te,[q3]:V,[Z3]:c,[D3]:u,[F3]:l,[K3]:l?`,${JSON.stringify(l)}:{`:"",[TO]:i,[U3]:_,[G3]:b,[EO]:ee,[OO]:F,[H3]:T,silent:C3,onChild:U,[J3]:$}),Object.setPrototypeOf(e,w3()),k3(e),e[M3](g),e}lr.exports=cv;lr.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=kO(t.dest||process.stdout.fd),SO(t)):SO({dest:kO(t),minLength:0});lr.exports.transport=V_();lr.exports.multistream=xO();lr.exports.levels=AO();lr.exports.stdSerializers=rG;lr.exports.stdTimeFunctions=Object.assign({},CO);lr.exports.symbols=NO;lr.exports.version=N3;lr.exports.default=cv;lr.exports.pino=cv});var ZO=S(Ei=>{"use strict";f();var nG=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.createMcpLogger=qO;Ei.createLogger=qO;var MO=nG(zO()),LO=y_(),sG=["password","token","accessToken","access_token","refreshToken","refresh_token","apiKey","api_key","secret","TOOLPILOT_API_KEY","authorization","cookie","*.password","*.token","*.secret","*.apiKey","*.api_key"];function qO(t){let e=t.level??process.env.LOG_LEVEL??(process.env.NODE_ENV!=="production"?"debug":"info"),r={name:t.name,level:e,serializers:{err:LO.errorSerializer,error:LO.errorSerializer},redact:{paths:sG,censor:"[REDACTED]"},timestamp:MO.default.stdTimeFunctions.isoTime,base:{pid:process.pid,...t.defaultFields}};return(0,MO.default)(r,process.stderr)}});var DO=S(uv=>{"use strict";f();Object.defineProperty(uv,"__esModule",{value:!0});uv.withErrorHandling=aG;var oG=id(),iG=ad();function aG(t,e,r){return async n=>{try{return await r(n)}catch(s){if(s instanceof iG.AppError){let o=s.severity==="critical"||s.severity==="high"?"error":"warn";return e[o]({err:s,tool:t},`Tool ${t} failed: ${s.message}`),{content:[{type:"text",text:JSON.stringify({ok:!1,error:s.code,message:s.isOperational?s.message:"An internal error occurred"})}],isError:!0}}return e.error({err:s,tool:t},`Unexpected error in tool ${t}`),{content:[{type:"text",text:JSON.stringify({ok:!1,error:oG.ErrorCode.ERR_MCP_HANDLER,message:s instanceof Error?s.message:String(s)})}],isError:!0}}}}});var Pe=S(Oe=>{"use strict";f();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.withErrorHandling=Oe.createLogger=Oe.createMcpLogger=Oe.errorSerializer=Oe.VectorError=Oe.IndexerError=Oe.SearchError=Oe.QueueError=Oe.ExternalServiceError=Oe.AuthError=Oe.ValidationError=Oe.NetworkError=Oe.DatabaseError=Oe.AppError=Oe.ErrorCode=void 0;var cG=id();Object.defineProperty(Oe,"ErrorCode",{enumerable:!0,get:function(){return cG.ErrorCode}});var Jr=ad();Object.defineProperty(Oe,"AppError",{enumerable:!0,get:function(){return Jr.AppError}});Object.defineProperty(Oe,"DatabaseError",{enumerable:!0,get:function(){return Jr.DatabaseError}});Object.defineProperty(Oe,"NetworkError",{enumerable:!0,get:function(){return Jr.NetworkError}});Object.defineProperty(Oe,"ValidationError",{enumerable:!0,get:function(){return Jr.ValidationError}});Object.defineProperty(Oe,"AuthError",{enumerable:!0,get:function(){return Jr.AuthError}});Object.defineProperty(Oe,"ExternalServiceError",{enumerable:!0,get:function(){return Jr.ExternalServiceError}});Object.defineProperty(Oe,"QueueError",{enumerable:!0,get:function(){return Jr.QueueError}});Object.defineProperty(Oe,"SearchError",{enumerable:!0,get:function(){return Jr.SearchError}});Object.defineProperty(Oe,"IndexerError",{enumerable:!0,get:function(){return Jr.IndexerError}});Object.defineProperty(Oe,"VectorError",{enumerable:!0,get:function(){return Jr.VectorError}});var uG=y_();Object.defineProperty(Oe,"errorSerializer",{enumerable:!0,get:function(){return uG.errorSerializer}});var FO=ZO();Object.defineProperty(Oe,"createMcpLogger",{enumerable:!0,get:function(){return FO.createMcpLogger}});Object.defineProperty(Oe,"createLogger",{enumerable:!0,get:function(){return FO.createLogger}});var lG=DO();Object.defineProperty(Oe,"withErrorHandling",{enumerable:!0,get:function(){return lG.withErrorHandling}})});var lP=S((bpe,yv)=>{"use strict";f();(function(){var t;function e(r,n){var s=this instanceof e?this:t;if(s.reset(n),typeof r=="string"&&r.length>0&&s.hash(r),s!==this)return s}e.prototype.hash=function(r){var n,s,o,i,a;switch(a=r.length,this.len+=a,s=this.k1,o=0,this.rem){case 0:s^=a>o?r.charCodeAt(o++)&65535:0;case 1:s^=a>o?(r.charCodeAt(o++)&65535)<<8:0;case 2:s^=a>o?(r.charCodeAt(o++)&65535)<<16:0;case 3:s^=a>o?(r.charCodeAt(o)&255)<<24:0,s^=a>o?(r.charCodeAt(o++)&65280)>>8:0}if(this.rem=a+this.rem&3,a-=this.rem,a>0){for(n=this.h1;s=s*11601+(s&65535)*3432906752&4294967295,s=s<<15|s>>>17,s=s*13715+(s&65535)*461832192&4294967295,n^=s,n=n<<13|n>>>19,n=n*5+3864292196&4294967295,!(o>=a);)s=r.charCodeAt(o++)&65535^(r.charCodeAt(o++)&65535)<<8^(r.charCodeAt(o++)&65535)<<16,i=r.charCodeAt(o++),s^=(i&255)<<24^(i&65280)>>8;switch(s=0,this.rem){case 3:s^=(r.charCodeAt(o+2)&65535)<<16;case 2:s^=(r.charCodeAt(o+1)&65535)<<8;case 1:s^=r.charCodeAt(o)&65535}this.h1=n}return this.k1=s,this},e.prototype.result=function(){var r,n;return r=this.k1,n=this.h1,r>0&&(r=r*11601+(r&65535)*3432906752&4294967295,r=r<<15|r>>>17,r=r*13715+(r&65535)*461832192&4294967295,n^=r),n^=this.len,n^=n>>>16,n=n*51819+(n&65535)*2246770688&4294967295,n^=n>>>13,n=n*44597+(n&65535)*3266445312&4294967295,n^=n>>>16,n>>>0},e.prototype.reset=function(r){return this.h1=typeof r=="number"?r:0,this.rem=this.k1=this.len=0,this},t=new e,typeof yv<"u"?yv.exports=e:this.MurmurHash3=e})()});var dP=S(fo=>{"use strict";f();Object.defineProperty(fo,"__esModule",{value:!0});fo.signals=void 0;fo.signals=[];fo.signals.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&fo.signals.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&fo.signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});var fP=S(Yr=>{"use strict";f();var Nd;Object.defineProperty(Yr,"__esModule",{value:!0});Yr.unload=Yr.load=Yr.onExit=Yr.signals=void 0;var Ad=dP();Object.defineProperty(Yr,"signals",{enumerable:!0,get:function(){return Ad.signals}});var Rd=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",_v=Symbol.for("signal-exit emitter"),vv=globalThis,yG=Object.defineProperty.bind(Object),bv=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(vv[_v])return vv[_v];yG(vv,_v,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],s=n.indexOf(r);s!==-1&&(s===0&&n.length===1?n.length=0:n.splice(s,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let s=!1;for(let o of this.listeners[e])s=o(r,n)===!0||s;return e==="exit"&&(s=this.emit("afterExit",r,n)||s),s}},jd=class{},_G=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),wv=class extends jd{onExit(){return()=>{}}load(){}unload(){}},xv=class extends jd{#r=Sv.platform==="win32"?"SIGINT":"SIGHUP";#t=new bv;#e;#o;#i;#s={};#n=!1;constructor(e){super(),this.#e=e,this.#s={};for(let r of Ad.signals)this.#s[r]=()=>{let n=this.#e.listeners(r),{count:s}=this.#t,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(s+=o.__signal_exit_emitter__.count),n.length===s){this.unload();let i=this.#t.emit("exit",null,r),a=r==="SIGHUP"?this.#r:r;i||e.kill(e.pid,a)}};this.#i=e.reallyExit,this.#o=e.emit}onExit(e,r){if(!Rd(this.#e))return()=>{};this.#n===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#t.on(n,e),()=>{this.#t.removeListener(n,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#n){this.#n=!0,this.#t.count+=1;for(let e of Ad.signals)try{let r=this.#s[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#c(e,...r),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#n&&(this.#n=!1,Ad.signals.forEach(e=>{let r=this.#s[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#o,this.#e.reallyExit=this.#i,this.#t.count-=1)}#a(e){return Rd(this.#e)?(this.#e.exitCode=e||0,this.#t.emit("exit",this.#e.exitCode,null),this.#i.call(this.#e,this.#e.exitCode)):0}#c(e,...r){let n=this.#o;if(e==="exit"&&Rd(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let s=n.call(this.#e,e,...r);return this.#t.emit("exit",this.#e.exitCode,null),s}else return n.call(this.#e,e,...r)}},Sv=globalThis.process;Nd=_G(Rd(Sv)?new xv(Sv):new wv),Yr.onExit=Nd.onExit,Yr.load=Nd.load,Yr.unload=Nd.unload});var Md=S((Tpe,hc)=>{"use strict";f();hc.exports=EG;hc.exports.sync=TG;hc.exports._getTmpname=kv;hc.exports._cleanupOnExit=Ev;var Xe=Te("fs"),vG=lP(),{onExit:pP}=fP(),bG=Te("path"),{promisify:fr}=Te("util"),Gn={},wG=(function(){try{return Te("worker_threads").threadId}catch{return 0}})(),xG=0;function kv(t){return t+"."+vG(v).hash(String(process.pid)).hash(String(wG)).hash(String(++xG)).result()}function Ev(t){return()=>{try{Xe.unlinkSync(typeof t=="function"?t():t)}catch{}}}function SG(t){return new Promise(e=>{Gn[t]||(Gn[t]=[]),Gn[t].push(e),Gn[t].length===1&&e()})}function zd(t){return t.code==="ENOSYS"||(!process.getuid||process.getuid()!==0)&&(t.code==="EINVAL"||t.code==="EPERM")}async function kG(t,e,r={}){typeof r=="string"&&(r={encoding:r});let n,s,o=pP(Ev(()=>s)),i=bG.resolve(t);try{await SG(i);let a=await fr(Xe.realpath)(t).catch(()=>t);if(s=kv(a),!r.mode||!r.chown){let c=await fr(Xe.stat)(a).catch(()=>{});c&&(r.mode==null&&(r.mode=c.mode),r.chown==null&&process.getuid&&(r.chown={uid:c.uid,gid:c.gid}))}n=await fr(Xe.open)(s,"w",r.mode),r.tmpfileCreated&&await r.tmpfileCreated(s),ArrayBuffer.isView(e)?await fr(Xe.write)(n,e,0,e.length,0):e!=null&&await fr(Xe.write)(n,String(e),0,String(r.encoding||"utf8")),r.fsync!==!1&&await fr(Xe.fsync)(n),await fr(Xe.close)(n),n=null,r.chown&&await fr(Xe.chown)(s,r.chown.uid,r.chown.gid).catch(c=>{if(!zd(c))throw c}),r.mode&&await fr(Xe.chmod)(s,r.mode).catch(c=>{if(!zd(c))throw c}),await fr(Xe.rename)(s,a)}finally{n&&await fr(Xe.close)(n).catch(()=>{}),o(),await fr(Xe.unlink)(s).catch(()=>{}),Gn[i].shift(),Gn[i].length>0?Gn[i][0]():delete Gn[i]}}async function EG(t,e,r,n){r instanceof Function&&(n=r,r={});let s=kG(t,e,r);if(n)try{let o=await s;return n(o)}catch(o){return n(o)}return s}function TG(t,e,r){typeof r=="string"?r={encoding:r}:r||(r={});try{t=Xe.realpathSync(t)}catch{}let n=kv(t);if(!r.mode||!r.chown)try{let c=Xe.statSync(t);r=Object.assign({},r),r.mode||(r.mode=c.mode),!r.chown&&process.getuid&&(r.chown={uid:c.uid,gid:c.gid})}catch{}let s,o=Ev(n),i=pP(o),a=!0;try{if(s=Xe.openSync(n,"w",r.mode||438),r.tmpfileCreated&&r.tmpfileCreated(n),ArrayBuffer.isView(e)?Xe.writeSync(s,e,0,e.length,0):e!=null&&Xe.writeSync(s,String(e),0,String(r.encoding||"utf8")),r.fsync!==!1&&Xe.fsyncSync(s),Xe.closeSync(s),s=null,r.chown)try{Xe.chownSync(n,r.chown.uid,r.chown.gid)}catch(c){if(!zd(c))throw c}if(r.mode)try{Xe.chmodSync(n,r.mode)}catch(c){if(!zd(c))throw c}Xe.renameSync(n,t),a=!1}finally{if(s)try{Xe.closeSync(s)}catch{}i(),a&&o()}}});var _P=S((Bpe,yP)=>{"use strict";f();var Wn=Te("constants"),RG=process.cwd,Zd=null,jG=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return Zd||(Zd=RG.call(process)),Zd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cv=process.chdir,process.chdir=function(t){Zd=null,Cv.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cv));var Cv;yP.exports=zG;function zG(t){Wn.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=i(t.chownSync),t.fchownSync=i(t.fchownSync),t.lchownSync=i(t.lchownSync),t.chmodSync=s(t.chmodSync),t.fchmodSync=s(t.fchmodSync),t.lchmodSync=s(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,d,p){p&&process.nextTick(p)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,d,p,g){g&&process.nextTick(g)},t.lchownSync=function(){}),jG==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function d(p,g,h){var m=Date.now(),_=0;l(p,g,function b(w){if(w&&(w.code==="EACCES"||w.code==="EPERM"||w.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){t.stat(g,function(x,T){x&&x.code==="ENOENT"?l(p,g,b):h(w)})},_),_<100&&(_+=10);return}h&&h(w)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(l){function d(p,g,h,m,_,b){var w;if(b&&typeof b=="function"){var x=0;w=function(T,O,L){if(T&&T.code==="EAGAIN"&&x<10)return x++,l.call(t,p,g,h,m,_,w);b.apply(this,arguments)}}return l.call(t,p,g,h,m,_,w)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,l),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(l){return function(d,p,g,h,m){for(var _=0;;)try{return l.call(t,d,p,g,h,m)}catch(b){if(b.code==="EAGAIN"&&_<10){_++;continue}throw b}}})(t.readSync);function e(l){l.lchmod=function(d,p,g){l.open(d,Wn.O_WRONLY|Wn.O_SYMLINK,p,function(h,m){if(h){g&&g(h);return}l.fchmod(m,p,function(_){l.close(m,function(b){g&&g(_||b)})})})},l.lchmodSync=function(d,p){var g=l.openSync(d,Wn.O_WRONLY|Wn.O_SYMLINK,p),h=!0,m;try{m=l.fchmodSync(g,p),h=!1}finally{if(h)try{l.closeSync(g)}catch{}else l.closeSync(g)}return m}}function r(l){Wn.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(d,p,g,h){l.open(d,Wn.O_SYMLINK,function(m,_){if(m){h&&h(m);return}l.futimes(_,p,g,function(b){l.close(_,function(w){h&&h(b||w)})})})},l.lutimesSync=function(d,p,g){var h=l.openSync(d,Wn.O_SYMLINK),m,_=!0;try{m=l.futimesSync(h,p,g),_=!1}finally{if(_)try{l.closeSync(h)}catch{}else l.closeSync(h)}return m}):l.futimes&&(l.lutimes=function(d,p,g,h){h&&process.nextTick(h)},l.lutimesSync=function(){})}function n(l){return l&&function(d,p,g){return l.call(t,d,p,function(h){u(h)&&(h=null),g&&g.apply(this,arguments)})}}function s(l){return l&&function(d,p){try{return l.call(t,d,p)}catch(g){if(!u(g))throw g}}}function o(l){return l&&function(d,p,g,h){return l.call(t,d,p,g,function(m){u(m)&&(m=null),h&&h.apply(this,arguments)})}}function i(l){return l&&function(d,p,g){try{return l.call(t,d,p,g)}catch(h){if(!u(h))throw h}}}function a(l){return l&&function(d,p,g){typeof p=="function"&&(g=p,p=null);function h(m,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),g&&g.apply(this,arguments)}return p?l.call(t,d,p,h):l.call(t,d,h)}}function c(l){return l&&function(d,p){var g=p?l.call(t,d,p):l.call(t,d);return g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),g}}function u(l){if(!l||l.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var wP=S((Kpe,bP)=>{"use strict";f();var vP=Te("stream").Stream;bP.exports=MG;function MG(t){return{ReadStream:e,WriteStream:r};function e(n,s){if(!(this instanceof e))return new e(n,s);vP.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,s=s||{};for(var i=Object.keys(s),a=0,c=i.length;a<c;a++){var u=i[a];this[u]=s[u]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(l,d){if(l){o.emit("error",l),o.readable=!1;return}o.fd=d,o.emit("open",d),o._read()})}function r(n,s){if(!(this instanceof r))return new r(n,s);vP.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,s=s||{};for(var o=Object.keys(s),i=0,a=o.length;i<a;i++){var c=o[i];this[c]=s[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var SP=S((Jpe,xP)=>{"use strict";f();xP.exports=qG;var LG=Object.getPrototypeOf||function(t){return t.__proto__};function qG(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:LG(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var jv=S((Ype,Rv)=>{"use strict";f();var tt=Te("fs"),ZG=_P(),DG=wP(),FG=SP(),Dd=Te("util"),_t,Ud;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_t=Symbol.for("graceful-fs.queue"),Ud=Symbol.for("graceful-fs.previous")):(_t="___graceful-fs.queue",Ud="___graceful-fs.previous");function UG(){}function TP(t,e){Object.defineProperty(t,_t,{get:function(){return e}})}var ho=UG;Dd.debuglog?ho=Dd.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ho=function(){var t=Dd.format.apply(Dd,arguments);t="GFS4: "+t.split(/\n/).join(`
|
|
32
|
+
GFS4: `),console.error(t)});tt[_t]||(kP=global[_t]||[],TP(tt,kP),tt.close=(function(t){function e(r,n){return t.call(tt,r,function(s){s||EP(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Ud,{value:t}),e})(tt.close),tt.closeSync=(function(t){function e(r){t.apply(tt,arguments),EP()}return Object.defineProperty(e,Ud,{value:t}),e})(tt.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){ho(tt[_t]),Te("assert").equal(tt[_t].length,0)}));var kP;global[_t]||TP(global,tt[_t]);Rv.exports=Nv(FG(tt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!tt.__patched&&(Rv.exports=Nv(tt),tt.__patched=!0);function Nv(t){ZG(t),t.gracefulify=Nv,t.createReadStream=O,t.createWriteStream=L;var e=t.readFile;t.readFile=r;function r(A,F,C){return typeof F=="function"&&(C=F,F=null),z(A,F,C);function z(V,te,pe,ee){return e(V,te,function(Ie){Ie&&(Ie.code==="EMFILE"||Ie.code==="ENFILE")?Ii([z,[V,te,pe],Ie,ee||Date.now(),Date.now()]):typeof pe=="function"&&pe.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=s;function s(A,F,C,z){return typeof C=="function"&&(z=C,C=null),V(A,F,C,z);function V(te,pe,ee,Ie,Fe){return n(te,pe,ee,function(Ae){Ae&&(Ae.code==="EMFILE"||Ae.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ae,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=i);function i(A,F,C,z){return typeof C=="function"&&(z=C,C=null),V(A,F,C,z);function V(te,pe,ee,Ie,Fe){return o(te,pe,ee,function(Ae){Ae&&(Ae.code==="EMFILE"||Ae.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ae,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(A,F,C,z){return typeof C=="function"&&(z=C,C=0),V(A,F,C,z);function V(te,pe,ee,Ie,Fe){return a(te,pe,ee,function(Ae){Ae&&(Ae.code==="EMFILE"||Ae.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ae,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}var u=t.readdir;t.readdir=d;var l=/^v[0-5]\./;function d(A,F,C){typeof F=="function"&&(C=F,F=null);var z=l.test(process.version)?function(pe,ee,Ie,Fe){return u(pe,V(pe,ee,Ie,Fe))}:function(pe,ee,Ie,Fe){return u(pe,ee,V(pe,ee,Ie,Fe))};return z(A,F,C);function V(te,pe,ee,Ie){return function(Fe,Ae){Fe&&(Fe.code==="EMFILE"||Fe.code==="ENFILE")?Ii([z,[te,pe,ee],Fe,Ie||Date.now(),Date.now()]):(Ae&&Ae.sort&&Ae.sort(),typeof ee=="function"&&ee.call(this,Fe,Ae))}}}if(process.version.substr(0,4)==="v0.8"){var p=DG(t);b=p.ReadStream,x=p.WriteStream}var g=t.ReadStream;g&&(b.prototype=Object.create(g.prototype),b.prototype.open=w);var h=t.WriteStream;h&&(x.prototype=Object.create(h.prototype),x.prototype.open=T),Object.defineProperty(t,"ReadStream",{get:function(){return b},set:function(A){b=A},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return x},set:function(A){x=A},enumerable:!0,configurable:!0});var m=b;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(A){m=A},enumerable:!0,configurable:!0});var _=x;Object.defineProperty(t,"FileWriteStream",{get:function(){return _},set:function(A){_=A},enumerable:!0,configurable:!0});function b(A,F){return this instanceof b?(g.apply(this,arguments),this):b.apply(Object.create(b.prototype),arguments)}function w(){var A=this;$(A.path,A.flags,A.mode,function(F,C){F?(A.autoClose&&A.destroy(),A.emit("error",F)):(A.fd=C,A.emit("open",C),A.read())})}function x(A,F){return this instanceof x?(h.apply(this,arguments),this):x.apply(Object.create(x.prototype),arguments)}function T(){var A=this;$(A.path,A.flags,A.mode,function(F,C){F?(A.destroy(),A.emit("error",F)):(A.fd=C,A.emit("open",C))})}function O(A,F){return new t.ReadStream(A,F)}function L(A,F){return new t.WriteStream(A,F)}var U=t.open;t.open=$;function $(A,F,C,z){return typeof C=="function"&&(z=C,C=null),V(A,F,C,z);function V(te,pe,ee,Ie,Fe){return U(te,pe,ee,function(Ae,lu){Ae&&(Ae.code==="EMFILE"||Ae.code==="ENFILE")?Ii([V,[te,pe,ee,Ie],Ae,Fe||Date.now(),Date.now()]):typeof Ie=="function"&&Ie.apply(this,arguments)})}}return t}function Ii(t){ho("ENQUEUE",t[0].name,t[1]),tt[_t].push(t),Av()}var Fd;function EP(){for(var t=Date.now(),e=0;e<tt[_t].length;++e)tt[_t][e].length>2&&(tt[_t][e][3]=t,tt[_t][e][4]=t);Av()}function Av(){if(clearTimeout(Fd),Fd=void 0,tt[_t].length!==0){var t=tt[_t].shift(),e=t[0],r=t[1],n=t[2],s=t[3],o=t[4];if(s===void 0)ho("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-s>=6e4){ho("TIMEOUT",e.name,r);var i=r.pop();typeof i=="function"&&i.call(null,n)}else{var a=Date.now()-o,c=Math.max(o-s,1),u=Math.min(c*1.2,100);a>=u?(ho("RETRY",e.name,r),e.apply(null,r.concat([s]))):tt[_t].push(t)}Fd===void 0&&(Fd=setTimeout(Av,0))}}});var IP=S((Qpe,$P)=>{"use strict";f();function hr(t,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}$P.exports=hr;hr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};hr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};hr.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=new Date().getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(r===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift();else return!1;var n=this,s=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&s.unref(),!0};hr.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};hr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};hr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};hr.prototype.start=hr.prototype.try;hr.prototype.errors=function(){return this._errors};hr.prototype.attempts=function(){return this._attempts};hr.prototype.mainError=function(){if(this._errors.length===0)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var s=this._errors[n],o=s.message,i=(t[o]||0)+1;t[o]=i,i>=r&&(e=s,r=i)}return e}});var OP=S(mo=>{"use strict";f();var VG=IP();mo.operation=function(t){var e=mo.timeouts(t);return new VG(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})};mo.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],s=0;s<e.retries;s++)n.push(this.createTimeout(s,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(s,e)),n.sort(function(o,i){return o-i}),n};mo.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout),n};mo.wrap=function(t,e,r){if(e instanceof Array&&(r=e,e=null),!r){r=[];for(var n in t)typeof t[n]=="function"&&r.push(n)}for(var s=0;s<r.length;s++){var o=r[s],i=t[o];t[o]=function(c){var u=mo.operation(e),l=Array.prototype.slice.call(arguments,1),d=l.pop();l.push(function(p){u.retry(p)||(p&&(arguments[0]=u.mainError()),d.apply(this,arguments))}),u.attempt(function(){c.apply(t,l)})}.bind(t,i),t[o].options=e}}});var CP=S((nhe,PP)=>{"use strict";f();PP.exports=OP()});var NP=S((ohe,Vd)=>{"use strict";f();Vd.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Vd.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Vd.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var MP=S((ahe,Ci)=>{"use strict";f();var Qe=global.process,go=function(t){return t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function"};go(Qe)?(AP=Te("assert"),Oi=NP(),RP=/^win/i.test(Qe.platform),mc=Te("events"),typeof mc!="function"&&(mc=mc.EventEmitter),Qe.__signal_exit_emitter__?dt=Qe.__signal_exit_emitter__:(dt=Qe.__signal_exit_emitter__=new mc,dt.count=0,dt.emitted={}),dt.infinite||(dt.setMaxListeners(1/0),dt.infinite=!0),Ci.exports=function(t,e){if(!go(global.process))return function(){};AP.equal(typeof t,"function","a callback must be provided for exit handler"),Pi===!1&&zv();var r="exit";e&&e.alwaysLast&&(r="afterexit");var n=function(){dt.removeListener(r,t),dt.listeners("exit").length===0&&dt.listeners("afterexit").length===0&&Bd()};return dt.on(r,t),n},Bd=function(){!Pi||!go(global.process)||(Pi=!1,Oi.forEach(function(e){try{Qe.removeListener(e,Hd[e])}catch{}}),Qe.emit=Kd,Qe.reallyExit=Mv,dt.count-=1)},Ci.exports.unload=Bd,yo=function(e,r,n){dt.emitted[e]||(dt.emitted[e]=!0,dt.emit(e,r,n))},Hd={},Oi.forEach(function(t){Hd[t]=function(){if(go(global.process)){var r=Qe.listeners(t);r.length===dt.count&&(Bd(),yo("exit",null,t),yo("afterexit",null,t),RP&&t==="SIGHUP"&&(t="SIGINT"),Qe.kill(Qe.pid,t))}}}),Ci.exports.signals=function(){return Oi},Pi=!1,zv=function(){Pi||!go(global.process)||(Pi=!0,dt.count+=1,Oi=Oi.filter(function(e){try{return Qe.on(e,Hd[e]),!0}catch{return!1}}),Qe.emit=zP,Qe.reallyExit=jP)},Ci.exports.load=zv,Mv=Qe.reallyExit,jP=function(e){go(global.process)&&(Qe.exitCode=e||0,yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),Mv.call(Qe,Qe.exitCode))},Kd=Qe.emit,zP=function(e,r){if(e==="exit"&&go(global.process)){r!==void 0&&(Qe.exitCode=r);var n=Kd.apply(this,arguments);return yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),n}else return Kd.apply(this,arguments)}):Ci.exports=function(){return function(){}};var AP,Oi,RP,mc,dt,Bd,yo,Hd,Pi,zv,Mv,jP,Kd,zP});var qP=S((uhe,Lv)=>{"use strict";f();var LP=Symbol();function BG(t,e,r){let n=e[LP];if(n)return e.stat(t,(o,i)=>{if(o)return r(o);r(null,i.mtime,n)});let s=new Date(Math.ceil(Date.now()/1e3)*1e3+5);e.utimes(t,s,s,o=>{if(o)return r(o);e.stat(t,(i,a)=>{if(i)return r(i);let c=a.mtime.getTime()%1e3===0?"s":"ms";Object.defineProperty(e,LP,{value:c}),r(null,a.mtime,c)})})}function HG(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Lv.exports.probe=BG;Lv.exports.getMtime=HG});var VP=S((dhe,yc)=>{"use strict";f();var KG=Te("path"),Dv=jv(),GG=CP(),JG=MP(),ZP=qP(),vn={};function gc(t,e){return e.lockfilePath||`${t}.lock`}function Fv(t,e,r){if(!e.realpath)return r(null,KG.resolve(t));e.fs.realpath(t,r)}function Zv(t,e,r){let n=gc(t,e);e.fs.mkdir(n,s=>{if(!s)return ZP.probe(n,e.fs,(o,i,a)=>{if(o)return e.fs.rmdir(n,()=>{}),r(o);r(null,i,a)});if(s.code!=="EEXIST")return r(s);if(e.stale<=0)return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));e.fs.stat(n,(o,i)=>{if(o)return o.code==="ENOENT"?Zv(t,{...e,stale:0},r):r(o);if(!DP(i,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));FP(t,e,a=>{if(a)return r(a);Zv(t,{...e,stale:0},r)})})})}function DP(t,e){return t.mtime.getTime()<Date.now()-e.stale}function FP(t,e,r){e.fs.rmdir(gc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Gd(t,e){let r=vn[t];r.updateTimeout||(r.updateDelay=r.updateDelay||e.update,r.updateTimeout=setTimeout(()=>{r.updateTimeout=null,e.fs.stat(r.lockfilePath,(n,s)=>{let o=r.lastUpdate+e.stale<Date.now();if(n)return n.code==="ENOENT"||o?qv(t,r,Object.assign(n,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Gd(t,e));if(!(r.mtime.getTime()===s.mtime.getTime()))return qv(t,r,Object.assign(new Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let a=ZP.getMtime(r.mtimePrecision);e.fs.utimes(r.lockfilePath,a,a,c=>{let u=r.lastUpdate+e.stale<Date.now();if(!r.released){if(c)return c.code==="ENOENT"||u?qv(t,r,Object.assign(c,{code:"ECOMPROMISED"})):(r.updateDelay=1e3,Gd(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Gd(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function qv(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),vn[t]===e&&delete vn[t],e.options.onCompromised(r)}function WG(t,e,r){e={stale:1e4,update:null,realpath:!0,retries:0,fs:Dv,onCompromised:n=>{throw n},...e},e.retries=e.retries||0,e.retries=typeof e.retries=="number"?{retries:e.retries}:e.retries,e.stale=Math.max(e.stale||0,2e3),e.update=e.update==null?e.stale/2:e.update||0,e.update=Math.max(Math.min(e.update,e.stale/2),1e3),Fv(t,e,(n,s)=>{if(n)return r(n);let o=GG.operation(e.retries);o.attempt(()=>{Zv(s,e,(i,a,c)=>{if(o.retry(i))return;if(i)return r(o.mainError());let u=vn[s]={lockfilePath:gc(s,e),mtime:a,mtimePrecision:c,options:e,lastUpdate:Date.now()};Gd(s,e),r(null,l=>{if(u.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));UP(s,{...e,realpath:!1},l)})})})})}function UP(t,e,r){e={fs:Dv,realpath:!0,...e},Fv(t,e,(n,s)=>{if(n)return r(n);let o=vn[s];if(!o)return r(Object.assign(new Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));o.updateTimeout&&clearTimeout(o.updateTimeout),o.released=!0,delete vn[s],FP(s,e,r)})}function YG(t,e,r){e={stale:1e4,realpath:!0,fs:Dv,...e},e.stale=Math.max(e.stale||0,2e3),Fv(t,e,(n,s)=>{if(n)return r(n);e.fs.stat(gc(s,e),(o,i)=>o?o.code==="ENOENT"?r(null,!1):r(o):r(null,!DP(i,e)))})}function XG(){return vn}JG(()=>{for(let t in vn){let e=vn[t].options;try{e.fs.rmdirSync(gc(t,e))}catch{}}});yc.exports.lock=WG;yc.exports.unlock=UP;yc.exports.check=YG;yc.exports.getLocks=XG});var HP=S((phe,BP)=>{"use strict";f();var QG=jv();function eJ(t){let e=["mkdir","realpath","stat","rmdir","utimes"],r={...t};return e.forEach(n=>{r[n]=(...s)=>{let o=s.pop(),i;try{i=t[`${n}Sync`](...s)}catch(a){return o(a)}o(null,i)}}),r}function tJ(t){return(...e)=>new Promise((r,n)=>{e.push((s,o)=>{s?n(s):r(o)}),t(...e)})}function rJ(t){return(...e)=>{let r,n;if(e.push((s,o)=>{r=s,n=o}),t(...e),r)throw r;return n}}function nJ(t){if(t={...t},t.fs=eJ(t.fs||QG),typeof t.retries=="number"&&t.retries>0||t.retries&&typeof t.retries.retries=="number"&&t.retries.retries>0)throw Object.assign(new Error("Cannot use retries with the sync api"),{code:"ESYNC"});return t}BP.exports={toPromise:tJ,toSync:rJ,toSyncOptions:nJ}});var Vv=S((mhe,Yn)=>{"use strict";f();var Ni=VP(),{toPromise:Jd,toSync:Wd,toSyncOptions:Uv}=HP();async function KP(t,e){let r=await Jd(Ni.lock)(t,e);return Jd(r)}function sJ(t,e){let r=Wd(Ni.lock)(t,Uv(e));return Wd(r)}function oJ(t,e){return Jd(Ni.unlock)(t,e)}function iJ(t,e){return Wd(Ni.unlock)(t,Uv(e))}function aJ(t,e){return Jd(Ni.check)(t,e)}function cJ(t,e){return Wd(Ni.check)(t,Uv(e))}Yn.exports=KP;Yn.exports.lock=KP;Yn.exports.unlock=oJ;Yn.exports.lockSync=sJ;Yn.exports.unlockSync=iJ;Yn.exports.check=aJ;Yn.exports.checkSync=cJ});var Ee=S(vt=>{"use strict";f();var Gv=Symbol.for("yaml.alias"),wC=Symbol.for("yaml.document"),of=Symbol.for("yaml.map"),xC=Symbol.for("yaml.pair"),Jv=Symbol.for("yaml.scalar"),af=Symbol.for("yaml.seq"),bn=Symbol.for("yaml.node.type"),qJ=t=>!!t&&typeof t=="object"&&t[bn]===Gv,ZJ=t=>!!t&&typeof t=="object"&&t[bn]===wC,DJ=t=>!!t&&typeof t=="object"&&t[bn]===of,FJ=t=>!!t&&typeof t=="object"&&t[bn]===xC,SC=t=>!!t&&typeof t=="object"&&t[bn]===Jv,UJ=t=>!!t&&typeof t=="object"&&t[bn]===af;function kC(t){if(t&&typeof t=="object")switch(t[bn]){case of:case af:return!0}return!1}function VJ(t){if(t&&typeof t=="object")switch(t[bn]){case Gv:case of:case Jv:case af:return!0}return!1}var BJ=t=>(SC(t)||kC(t))&&!!t.anchor;vt.ALIAS=Gv;vt.DOC=wC;vt.MAP=of;vt.NODE_TYPE=bn;vt.PAIR=xC;vt.SCALAR=Jv;vt.SEQ=af;vt.hasAnchor=BJ;vt.isAlias=qJ;vt.isCollection=kC;vt.isDocument=ZJ;vt.isMap=DJ;vt.isNode=VJ;vt.isPair=FJ;vt.isScalar=SC;vt.isSeq=UJ});var wc=S(Wv=>{"use strict";f();var ut=Ee(),Ft=Symbol("break visit"),EC=Symbol("skip children"),Qr=Symbol("remove node");function cf(t,e){let r=TC(e);ut.isDocument(t)?ji(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):ji(null,t,r,Object.freeze([]))}cf.BREAK=Ft;cf.SKIP=EC;cf.REMOVE=Qr;function ji(t,e,r,n){let s=$C(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return IC(t,n,s),ji(t,s,r,n);if(typeof s!="symbol"){if(ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let i=ji(o,e.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===Ft)return Ft;i===Qr&&(e.items.splice(o,1),o-=1)}}}else if(ut.isPair(e)){n=Object.freeze(n.concat(e));let o=ji("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=ji("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}async function uf(t,e){let r=TC(e);ut.isDocument(t)?await zi(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):await zi(null,t,r,Object.freeze([]))}uf.BREAK=Ft;uf.SKIP=EC;uf.REMOVE=Qr;async function zi(t,e,r,n){let s=await $C(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return IC(t,n,s),zi(t,s,r,n);if(typeof s!="symbol"){if(ut.isCollection(e)){n=Object.freeze(n.concat(e));for(let o=0;o<e.items.length;++o){let i=await zi(o,e.items[o],r,n);if(typeof i=="number")o=i-1;else{if(i===Ft)return Ft;i===Qr&&(e.items.splice(o,1),o-=1)}}}else if(ut.isPair(e)){n=Object.freeze(n.concat(e));let o=await zi("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=await zi("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}function TC(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function $C(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(ut.isMap(e))return r.Map?.(t,e,n);if(ut.isSeq(e))return r.Seq?.(t,e,n);if(ut.isPair(e))return r.Pair?.(t,e,n);if(ut.isScalar(e))return r.Scalar?.(t,e,n);if(ut.isAlias(e))return r.Alias?.(t,e,n)}function IC(t,e,r){let n=e[e.length-1];if(ut.isCollection(n))n.items[t]=r;else if(ut.isPair(n))t==="key"?n.key=r:n.value=r;else if(ut.isDocument(n))n.contents=r;else{let s=ut.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${s} parent`)}}Wv.visit=cf;Wv.visitAsync=uf});var Yv=S(PC=>{"use strict";f();var OC=Ee(),HJ=wc(),KJ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},GJ=t=>t.replace(/[!,[\]{}]/g,e=>KJ[e]),xc=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),s=n.shift();switch(s){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[o,i]=n;return this.tags[o]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[o]=n;if(o==="1.1"||o==="1.2")return this.yaml.version=o,!0;{let i=/^\d+\.\d+$/.test(o);return r(6,`Unsupported YAML version ${o}`,i),!1}}default:return r(0,`Unknown directive ${s}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let i=e.slice(2,-1);return i==="!"||i==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),i)}let[,n,s]=e.match(/^(.*!)([^!]*)$/s);s||r(`The ${e} tag has no suffix`);let o=this.tags[n];if(o)try{return o+decodeURIComponent(s)}catch(i){return r(String(i)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+GJ(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),s;if(e&&n.length>0&&OC.isNode(e.contents)){let o={};HJ.visit(e.contents,(i,a)=>{OC.isNode(a)&&a.tag&&(o[a.tag]=!0)}),s=Object.keys(o)}else s=[];for(let[o,i]of n)o==="!!"&&i==="tag:yaml.org,2002:"||(!e||s.some(a=>a.startsWith(i)))&&r.push(`%TAG ${o} ${i}`);return r.join(`
|
|
33
|
+
`)}};xc.defaultYaml={explicit:!1,version:"1.2"};xc.defaultTags={"!!":"tag:yaml.org,2002:"};PC.Directives=xc});var lf=S(Sc=>{"use strict";f();var CC=Ee(),JJ=wc();function WJ(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function NC(t){let e=new Set;return JJ.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function AC(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function YJ(t,e){let r=[],n=new Map,s=null;return{onAnchor:o=>{r.push(o),s??(s=NC(t));let i=AC(e,s);return s.add(i),i},setAnchors:()=>{for(let o of r){let i=n.get(o);if(typeof i=="object"&&i.anchor&&(CC.isScalar(i.node)||CC.isCollection(i.node)))i.node.anchor=i.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=o,a}}},sourceObjects:n}}Sc.anchorIsValid=WJ;Sc.anchorNames=NC;Sc.createNodeAnchors=YJ;Sc.findNewAnchor=AC});var Xv=S(RC=>{"use strict";f();function kc(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let s=0,o=n.length;s<o;++s){let i=n[s],a=kc(t,n,String(s),i);a===void 0?delete n[s]:a!==i&&(n[s]=a)}else if(n instanceof Map)for(let s of Array.from(n.keys())){let o=n.get(s),i=kc(t,n,s,o);i===void 0?n.delete(s):i!==o&&n.set(s,i)}else if(n instanceof Set)for(let s of Array.from(n)){let o=kc(t,n,s,s);o===void 0?n.delete(s):o!==s&&(n.delete(s),n.add(o))}else for(let[s,o]of Object.entries(n)){let i=kc(t,n,s,o);i===void 0?delete n[s]:i!==o&&(n[s]=i)}return t.call(e,r,n)}RC.applyReviver=kc});var Xn=S(zC=>{"use strict";f();var XJ=Ee();function jC(t,e,r){if(Array.isArray(t))return t.map((n,s)=>jC(n,String(s),r));if(t&&typeof t.toJSON=="function"){if(!r||!XJ.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=o=>{n.res=o,delete r.onCreate};let s=t.toJSON(e,r);return r.onCreate&&r.onCreate(s),s}return typeof t=="bigint"&&!r?.keep?Number(t):t}zC.toJS=jC});var df=S(LC=>{"use strict";f();var QJ=Xv(),MC=Ee(),e5=Xn(),Qv=class{constructor(e){Object.defineProperty(this,MC.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:s,reviver:o}={}){if(!MC.isDocument(e))throw new TypeError("A document argument is required");let i={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=e5.toJS(this,"",i);if(typeof s=="function")for(let{count:c,res:u}of i.anchors.values())s(u,c);return typeof o=="function"?QJ.applyReviver(o,{"":a},"",a):a}};LC.NodeBase=Qv});var Ec=S(qC=>{"use strict";f();var t5=lf(),r5=wc(),Mi=Ee(),n5=df(),s5=Xn(),eb=class extends n5.NodeBase{constructor(e){super(Mi.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,r){let n;r?.aliasResolveCache?n=r.aliasResolveCache:(n=[],r5.visit(e,{Node:(o,i)=>{(Mi.isAlias(i)||Mi.hasAnchor(i))&&n.push(i)}}),r&&(r.aliasResolveCache=n));let s;for(let o of n){if(o===this)break;o.anchor===this.source&&(s=o)}return s}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:s,maxAliasCount:o}=r,i=this.resolve(s,r);if(!i){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(i);if(a||(s5.toJS(i,null,r),a=n.get(i)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(o>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ff(s,i,n)),a.count*a.aliasCount>o)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let s=`*${this.source}`;if(e){if(t5.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let o=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(o)}if(e.implicitKey)return`${s} `}return s}};function ff(t,e,r){if(Mi.isAlias(e)){let n=e.resolve(t),s=r&&n&&r.get(n);return s?s.count*s.aliasCount:0}else if(Mi.isCollection(e)){let n=0;for(let s of e.items){let o=ff(t,s,r);o>n&&(n=o)}return n}else if(Mi.isPair(e)){let n=ff(t,e.key,r),s=ff(t,e.value,r);return Math.max(n,s)}return 1}qC.Alias=eb});var it=S(tb=>{"use strict";f();var o5=Ee(),i5=df(),a5=Xn(),c5=t=>!t||typeof t!="function"&&typeof t!="object",Qn=class extends i5.NodeBase{constructor(e){super(o5.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:a5.toJS(this.value,e,r)}toString(){return String(this.value)}};Qn.BLOCK_FOLDED="BLOCK_FOLDED";Qn.BLOCK_LITERAL="BLOCK_LITERAL";Qn.PLAIN="PLAIN";Qn.QUOTE_DOUBLE="QUOTE_DOUBLE";Qn.QUOTE_SINGLE="QUOTE_SINGLE";tb.Scalar=Qn;tb.isScalarValue=c5});var Tc=S(DC=>{"use strict";f();var u5=Ec(),bo=Ee(),ZC=it(),l5="tag:yaml.org,2002:";function d5(t,e,r){if(e){let n=r.filter(o=>o.tag===e),s=n.find(o=>!o.format)??n[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return r.find(n=>n.identify?.(t)&&!n.format)}function f5(t,e,r){if(bo.isDocument(t)&&(t=t.contents),bo.isNode(t))return t;if(bo.isPair(t)){let d=r.schema[bo.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:s,onTagObj:o,schema:i,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=s(t)),new u5.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=l5+e.slice(2));let u=d5(t,e,i.tags);if(!u){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new ZC.Scalar(t);return c&&(c.node=d),d}u=t instanceof Map?i[bo.MAP]:Symbol.iterator in Object(t)?i[bo.SEQ]:i[bo.MAP]}o&&(o(u),delete r.onTagObj);let l=u?.createNode?u.createNode(r.schema,t,r):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(r.schema,t,r):new ZC.Scalar(t);return e?l.tag=e:u.default||(l.tag=u.tag),c&&(c.node=l),l}DC.createNode=f5});var hf=S(pf=>{"use strict";f();var p5=Tc(),en=Ee(),h5=df();function rb(t,e,r){let n=r;for(let s=e.length-1;s>=0;--s){let o=e[s];if(typeof o=="number"&&Number.isInteger(o)&&o>=0){let i=[];i[o]=n,n=i}else n=new Map([[o,n]])}return p5.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var FC=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,nb=class extends h5.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>en.isNode(n)||en.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(FC(e))this.add(r);else{let[n,...s]=e,o=this.get(n,!0);if(en.isCollection(o))o.addIn(s,r);else if(o===void 0&&this.schema)this.set(n,rb(this.schema,s,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let s=this.get(r,!0);if(en.isCollection(s))return s.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...s]=e,o=this.get(n,!0);return s.length===0?!r&&en.isScalar(o)?o.value:o:en.isCollection(o)?o.getIn(s,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!en.isPair(r))return!1;let n=r.value;return n==null||e&&en.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let s=this.get(r,!0);return en.isCollection(s)?s.hasIn(n):!1}setIn(e,r){let[n,...s]=e;if(s.length===0)this.set(n,r);else{let o=this.get(n,!0);if(en.isCollection(o))o.setIn(s,r);else if(o===void 0&&this.schema)this.set(n,rb(this.schema,s,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}};pf.Collection=nb;pf.collectionFromPath=rb;pf.isEmptyPath=FC});var $c=S(mf=>{"use strict";f();var m5=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function sb(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var g5=(t,e,r)=>t.endsWith(`
|
|
34
34
|
`)?sb(r,e):r.includes(`
|
|
35
35
|
`)?`
|
|
36
|
-
`+sb(r,e):(t.endsWith(" ")?"":" ")+r;mf.indentComment=sb;mf.lineComment=
|
|
37
|
-
`)r===ob&&(m=
|
|
36
|
+
`+sb(r,e):(t.endsWith(" ")?"":" ")+r;mf.indentComment=sb;mf.lineComment=g5;mf.stringifyComment=m5});var VC=S(Ic=>{"use strict";f();var y5="flow",ob="block",gf="quoted";function _5(t,e,r="flow",{indentAtStart:n,lineWidth:s=80,minContentWidth:o=20,onFold:i,onOverflow:a}={}){if(!s||s<0)return t;s<o&&(o=0);let c=Math.max(1+o,1+s-e.length);if(t.length<=c)return t;let u=[],l={},d=s-e.length;typeof n=="number"&&(n>s-Math.max(2,o)?u.push(0):d=s-n);let p,g,h=!1,m=-1,_=-1,b=-1;r===ob&&(m=UC(t,m,e.length),m!==-1&&(d=m+c));for(let x;x=t[m+=1];){if(r===gf&&x==="\\"){switch(_=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if(x===`
|
|
37
|
+
`)r===ob&&(m=UC(t,m,e.length)),d=m+e.length+c,p=void 0;else{if(x===" "&&g&&g!==" "&&g!==`
|
|
38
38
|
`&&g!==" "){let T=t[m+1];T&&T!==" "&&T!==`
|
|
39
|
-
`&&T!==" "&&(p=m)}if(m>=d)if(p)u.push(p),d=p+c,p=void 0;else if(r===gf){for(;g===" "||g===" ";)g=x,x=t[m+=1],h=!0;let T=m>b+1?m-2:_-1;if(l[T])return t;u.push(T),l[T]=!0,d=T+c,p=void 0}else h=!0}g=x}if(h&&a&&a(),u.length===0)return t;i&&i();let w=t.slice(0,u[0]);for(let x=0;x<u.length;++x){let T=u[x],
|
|
40
|
-
${e}${t.slice(0,
|
|
41
|
-
${e}${t.slice(T+1,
|
|
42
|
-
`);n=e,s=e+1,o=t[s]}return n}Ic.FOLD_BLOCK=ob;Ic.FOLD_FLOW=
|
|
43
|
-
`){if(o-i>n)return!0;if(i=o+1,s-i<=n)return!1}return!0}function
|
|
39
|
+
`&&T!==" "&&(p=m)}if(m>=d)if(p)u.push(p),d=p+c,p=void 0;else if(r===gf){for(;g===" "||g===" ";)g=x,x=t[m+=1],h=!0;let T=m>b+1?m-2:_-1;if(l[T])return t;u.push(T),l[T]=!0,d=T+c,p=void 0}else h=!0}g=x}if(h&&a&&a(),u.length===0)return t;i&&i();let w=t.slice(0,u[0]);for(let x=0;x<u.length;++x){let T=u[x],O=u[x+1]||t.length;T===0?w=`
|
|
40
|
+
${e}${t.slice(0,O)}`:(r===gf&&l[T]&&(w+=`${t[T]}\\`),w+=`
|
|
41
|
+
${e}${t.slice(T+1,O)}`)}return w}function UC(t,e,r){let n=e,s=e+1,o=t[s];for(;o===" "||o===" ";)if(e<s+r)o=t[++e];else{do o=t[++e];while(o&&o!==`
|
|
42
|
+
`);n=e,s=e+1,o=t[s]}return n}Ic.FOLD_BLOCK=ob;Ic.FOLD_FLOW=y5;Ic.FOLD_QUOTED=gf;Ic.foldFlowLines=_5});var Pc=S(BC=>{"use strict";f();var Cr=it(),es=VC(),_f=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),vf=t=>/^(%|---|\.\.\.)/m.test(t);function v5(t,e,r){if(!e||e<0)return!1;let n=e-r,s=t.length;if(s<=n)return!1;for(let o=0,i=0;o<s;++o)if(t[o]===`
|
|
43
|
+
`){if(o-i>n)return!0;if(i=o+1,s-i<=n)return!1}return!0}function Oc(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,s=e.options.doubleQuotedMinMultiLineLength,o=e.indent||(vf(t)?" ":""),i="",a=0;for(let c=0,u=r[c];u;u=r[++c])if(u===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(i+=r.slice(a,c)+"\\ ",c+=1,a=c,u="\\"),u==="\\")switch(r[c+1]){case"u":{i+=r.slice(a,c);let l=r.substr(c+2,4);switch(l){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:l.substr(0,2)==="00"?i+="\\x"+l.substr(2):i+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<s)c+=1;else{for(i+=r.slice(a,c)+`
|
|
44
44
|
|
|
45
45
|
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)i+=`
|
|
46
46
|
`,c+=2;i+=o,r[c+2]===" "&&(i+="\\"),c+=1,a=c+1}break;default:c+=1}return i=a?i+r.slice(a):r,n?i:es.foldFlowLines(i,o,es.FOLD_QUOTED,_f(e,!1))}function ib(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
|
|
47
|
-
`)||/[ \t]\n|\n[ \t]/.test(t))return
|
|
48
|
-
${r}`)+"'";return e.implicitKey?n:es.foldFlowLines(n,r,es.FOLD_FLOW,_f(e,!1))}function Li(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=
|
|
47
|
+
`)||/[ \t]\n|\n[ \t]/.test(t))return Oc(t,e);let r=e.indent||(vf(t)?" ":""),n="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
48
|
+
${r}`)+"'";return e.implicitKey?n:es.foldFlowLines(n,r,es.FOLD_FLOW,_f(e,!1))}function Li(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=Oc;else{let s=t.includes('"'),o=t.includes("'");s&&!o?n=ib:o&&!s?n=Oc:n=r?ib:Oc}return n(t,e)}var ab;try{ab=new RegExp(`(^|(?<!
|
|
49
49
|
))
|
|
50
50
|
+(?!
|
|
51
|
-
|$)`,"g")}catch{ab=/\n+(?!\n|$)/g}function yf({comment:t,type:e,value:r},n,s,o){let{blockQuote:i,commentString:a,lineWidth:c}=n.options;if(!i||/\n[\t ]+$/.test(r))return Li(r,n);let u=n.indent||(n.forceBlockIndent||vf(r)?" ":""),l=i==="literal"?!0:i==="folded"||e===Cr.Scalar.BLOCK_FOLDED?!1:e===Cr.Scalar.BLOCK_LITERAL?!0:!
|
|
51
|
+
|$)`,"g")}catch{ab=/\n+(?!\n|$)/g}function yf({comment:t,type:e,value:r},n,s,o){let{blockQuote:i,commentString:a,lineWidth:c}=n.options;if(!i||/\n[\t ]+$/.test(r))return Li(r,n);let u=n.indent||(n.forceBlockIndent||vf(r)?" ":""),l=i==="literal"?!0:i==="folded"||e===Cr.Scalar.BLOCK_FOLDED?!1:e===Cr.Scalar.BLOCK_LITERAL?!0:!v5(r,c,u.length);if(!r)return l?`|
|
|
52
52
|
`:`>
|
|
53
|
-
`;let d,p;for(p=r.length;p>0;--p){let
|
|
54
|
-
`&&
|
|
53
|
+
`;let d,p;for(p=r.length;p>0;--p){let O=r[p-1];if(O!==`
|
|
54
|
+
`&&O!==" "&&O!==" ")break}let g=r.substring(p),h=g.indexOf(`
|
|
55
55
|
`);h===-1?d="-":r===g||h!==g.length-1?(d="+",o&&o()):d="",g&&(r=r.slice(0,-g.length),g[g.length-1]===`
|
|
56
|
-
`&&(g=g.slice(0,-1)),g=g.replace(ab,`$&${u}`));let m=!1,_,b=-1;for(_=0;_<r.length;++_){let
|
|
57
|
-
`)b=_;else break}let w=r.substring(0,b<_?b+1:_);w&&(r=r.substring(w.length),w=w.replace(/\n+/g,`$&${u}`));let T=(m?u?"2":"1":"")+d;if(t&&(T+=" "+a(t.replace(/ ?[\r\n]+/g," ")),s&&s()),!l){let
|
|
58
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),L=!1,U=_f(n,!0);i!=="folded"&&e!==Cr.Scalar.BLOCK_FOLDED&&(U.onOverflow=()=>{L=!0});let $=es.foldFlowLines(`${w}${
|
|
56
|
+
`&&(g=g.slice(0,-1)),g=g.replace(ab,`$&${u}`));let m=!1,_,b=-1;for(_=0;_<r.length;++_){let O=r[_];if(O===" ")m=!0;else if(O===`
|
|
57
|
+
`)b=_;else break}let w=r.substring(0,b<_?b+1:_);w&&(r=r.substring(w.length),w=w.replace(/\n+/g,`$&${u}`));let T=(m?u?"2":"1":"")+d;if(t&&(T+=" "+a(t.replace(/ ?[\r\n]+/g," ")),s&&s()),!l){let O=r.replace(/\n+/g,`
|
|
58
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),L=!1,U=_f(n,!0);i!=="folded"&&e!==Cr.Scalar.BLOCK_FOLDED&&(U.onOverflow=()=>{L=!0});let $=es.foldFlowLines(`${w}${O}${g}`,u,es.FOLD_BLOCK,U);if(!L)return`>${T}
|
|
59
59
|
${u}${$}`}return r=r.replace(/\n+/g,`$&${u}`),`|${T}
|
|
60
|
-
${u}${w}${r}${g}`}function
|
|
60
|
+
${u}${w}${r}${g}`}function b5(t,e,r,n){let{type:s,value:o}=t,{actualString:i,implicitKey:a,indent:c,indentStep:u,inFlow:l}=e;if(a&&o.includes(`
|
|
61
61
|
`)||l&&/[[\]{},]/.test(o))return Li(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||l||!o.includes(`
|
|
62
62
|
`)?Li(o,e):yf(t,e,r,n);if(!a&&!l&&s!==Cr.Scalar.PLAIN&&o.includes(`
|
|
63
63
|
`))return yf(t,e,r,n);if(vf(o)){if(c==="")return e.forceBlockIndent=!0,yf(t,e,r,n);if(a&&c===u)return Li(o,e)}let d=o.replace(/\n+/g,`$&
|
|
64
|
-
${c}`);if(i){let p=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:g,tags:h}=e.doc.schema;if(h.some(p)||g?.some(p))return Li(o,e)}return a?d:es.foldFlowLines(d,c,es.FOLD_FLOW,_f(e,!1))}function
|
|
65
|
-
${e.indent}${a}`:a}cb.createStringifyContext=
|
|
66
|
-
${a}:`):(_=`${_}:`,p&&(_+=
|
|
64
|
+
${c}`);if(i){let p=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:g,tags:h}=e.doc.schema;if(h.some(p)||g?.some(p))return Li(o,e)}return a?d:es.foldFlowLines(d,c,es.FOLD_FLOW,_f(e,!1))}function w5(t,e,r,n){let{implicitKey:s,inFlow:o}=e,i=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Cr.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value)&&(a=Cr.Scalar.QUOTE_DOUBLE);let c=l=>{switch(l){case Cr.Scalar.BLOCK_FOLDED:case Cr.Scalar.BLOCK_LITERAL:return s||o?Li(i.value,e):yf(i,e,r,n);case Cr.Scalar.QUOTE_DOUBLE:return Oc(i.value,e);case Cr.Scalar.QUOTE_SINGLE:return ib(i.value,e);case Cr.Scalar.PLAIN:return b5(i,e,r,n);default:return null}},u=c(a);if(u===null){let{defaultKeyType:l,defaultStringType:d}=e.options,p=s&&l||d;if(u=c(p),u===null)throw new Error(`Unsupported default string type ${p}`)}return u}BC.stringifyString=w5});var Cc=S(cb=>{"use strict";f();var x5=lf(),ts=Ee(),S5=$c(),k5=Pc();function E5(t,e){let r=Object.assign({blockQuote:!0,commentString:S5.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function T5(t,e){if(e.tag){let s=t.filter(o=>o.tag===e.tag);if(s.length>0)return s.find(o=>o.format===e.format)??s[0]}let r,n;if(ts.isScalar(e)){n=e.value;let s=t.filter(o=>o.identify?.(n));if(s.length>1){let o=s.filter(i=>i.test);o.length>0&&(s=o)}r=s.find(o=>o.format===e.format)??s.find(o=>!o.format)}else n=e,r=t.find(s=>s.nodeClass&&n instanceof s.nodeClass);if(!r){let s=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${s} value`)}return r}function $5(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let s=[],o=(ts.isScalar(t)||ts.isCollection(t))&&t.anchor;o&&x5.anchorIsValid(o)&&(r.add(o),s.push(`&${o}`));let i=t.tag??(e.default?null:e.tag);return i&&s.push(n.directives.tagString(i)),s.join(" ")}function I5(t,e,r,n){if(ts.isPair(t))return t.toString(e,r,n);if(ts.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let s,o=ts.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>s=c});s??(s=T5(e.doc.schema.tags,o));let i=$5(o,s,e);i.length>0&&(e.indentAtStart=(e.indentAtStart??0)+i.length+1);let a=typeof s.stringify=="function"?s.stringify(o,e,r,n):ts.isScalar(o)?k5.stringifyString(o,e,r,n):o.toString(e,r,n);return i?ts.isScalar(o)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
|
|
65
|
+
${e.indent}${a}`:a}cb.createStringifyContext=E5;cb.stringify=I5});var JC=S(GC=>{"use strict";f();var wn=Ee(),HC=it(),KC=Cc(),Nc=$c();function O5({key:t,value:e},r,n,s){let{allNullValues:o,doc:i,indent:a,indentStep:c,options:{commentString:u,indentSeq:l,simpleKeys:d}}=r,p=wn.isNode(t)&&t.comment||null;if(d){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(wn.isCollection(t)||!wn.isNode(t)&&typeof t=="object"){let U="With simple keys, collection cannot be used as a key value";throw new Error(U)}}let g=!d&&(!t||p&&e==null&&!r.inFlow||wn.isCollection(t)||(wn.isScalar(t)?t.type===HC.Scalar.BLOCK_FOLDED||t.type===HC.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!g&&(d||!o),indent:a+c});let h=!1,m=!1,_=KC.stringify(t,r,()=>h=!0,()=>m=!0);if(!g&&!r.inFlow&&_.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");g=!0}if(r.inFlow){if(o||e==null)return h&&n&&n(),_===""?"?":g?`? ${_}`:_}else if(o&&!d||e==null&&g)return _=`? ${_}`,p&&!h?_+=Nc.lineComment(_,r.indent,u(p)):m&&s&&s(),_;h&&(p=null),g?(p&&(_+=Nc.lineComment(_,r.indent,u(p))),_=`? ${_}
|
|
66
|
+
${a}:`):(_=`${_}:`,p&&(_+=Nc.lineComment(_,r.indent,u(p))));let b,w,x;wn.isNode(e)?(b=!!e.spaceBefore,w=e.commentBefore,x=e.comment):(b=!1,w=null,x=null,e&&typeof e=="object"&&(e=i.createNode(e))),r.implicitKey=!1,!g&&!p&&wn.isScalar(e)&&(r.indentAtStart=_.length+1),m=!1,!l&&c.length>=2&&!r.inFlow&&!g&&wn.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let T=!1,O=KC.stringify(e,r,()=>T=!0,()=>m=!0),L=" ";if(p||b||w){if(L=b?`
|
|
67
67
|
`:"",w){let U=u(w);L+=`
|
|
68
|
-
${
|
|
68
|
+
${Nc.indentComment(U,r.indent)}`}O===""&&!r.inFlow?L===`
|
|
69
69
|
`&&x&&(L=`
|
|
70
70
|
|
|
71
71
|
`):L+=`
|
|
72
|
-
${r.indent}`}else if(!g&&wn.isCollection(e)){let U=
|
|
73
|
-
`),
|
|
74
|
-
${r.indent}`)}}else(
|
|
75
|
-
`)&&(L="");return _+=L+
|
|
72
|
+
${r.indent}`}else if(!g&&wn.isCollection(e)){let U=O[0],$=O.indexOf(`
|
|
73
|
+
`),A=$!==-1,F=r.inFlow??e.flow??e.items.length===0;if(A||!F){let C=!1;if(A&&(U==="&"||U==="!")){let z=O.indexOf(" ");U==="&"&&z!==-1&&z<$&&O[z+1]==="!"&&(z=O.indexOf(" ",z+1)),(z===-1||$<z)&&(C=!0)}C||(L=`
|
|
74
|
+
${r.indent}`)}}else(O===""||O[0]===`
|
|
75
|
+
`)&&(L="");return _+=L+O,r.inFlow?T&&n&&n():x&&!T?_+=Nc.lineComment(_,r.indent,u(x)):m&&s&&s(),_}GC.stringifyPair=O5});var lb=S(ub=>{"use strict";f();var WC=Te("process");function P5(t,...e){t==="debug"&&console.log(...e)}function C5(t,e){(t==="debug"||t==="warn")&&(typeof WC.emitWarning=="function"?WC.emitWarning(e):console.warn(e))}ub.debug=P5;ub.warn=C5});var Sf=S(xf=>{"use strict";f();var Ac=Ee(),YC=it(),bf="<<",wf={identify:t=>t===bf||typeof t=="symbol"&&t.description===bf,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new YC.Scalar(Symbol(bf)),{addToJSMap:XC}),stringify:()=>bf},N5=(t,e)=>(wf.identify(e)||Ac.isScalar(e)&&(!e.type||e.type===YC.Scalar.PLAIN)&&wf.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===wf.tag&&r.default);function XC(t,e,r){if(r=t&&Ac.isAlias(r)?r.resolve(t.doc):r,Ac.isSeq(r))for(let n of r.items)db(t,e,n);else if(Array.isArray(r))for(let n of r)db(t,e,n);else db(t,e,r)}function db(t,e,r){let n=t&&Ac.isAlias(r)?r.resolve(t.doc):r;if(!Ac.isMap(n))throw new Error("Merge sources must be maps or map aliases");let s=n.toJSON(null,t,Map);for(let[o,i]of s)e instanceof Map?e.has(o)||e.set(o,i):e instanceof Set?e.add(o):Object.prototype.hasOwnProperty.call(e,o)||Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0});return e}xf.addMergeToJSMap=XC;xf.isMergeKey=N5;xf.merge=wf});var pb=S(t1=>{"use strict";f();var A5=lb(),QC=Sf(),R5=Cc(),e1=Ee(),fb=Xn();function j5(t,e,{key:r,value:n}){if(e1.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(QC.isMergeKey(t,r))QC.addMergeToJSMap(t,e,n);else{let s=fb.toJS(r,"",t);if(e instanceof Map)e.set(s,fb.toJS(n,s,t));else if(e instanceof Set)e.add(s);else{let o=z5(r,s,t),i=fb.toJS(n,o,t);o in e?Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0}):e[o]=i}}return e}function z5(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(e1.isNode(t)&&r?.doc){let n=R5.createStringifyContext(r.doc,{});n.anchors=new Set;for(let o of r.anchors.keys())n.anchors.add(o.anchor);n.inFlow=!0,n.inStringifyKey=!0;let s=t.toString(n);if(!r.mapKeyWarned){let o=JSON.stringify(s);o.length>40&&(o=o.substring(0,36)+'..."'),A5.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${o}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return s}return JSON.stringify(e)}t1.addPairToJSMap=j5});var rs=S(hb=>{"use strict";f();var r1=Tc(),M5=JC(),L5=pb(),kf=Ee();function q5(t,e,r){let n=r1.createNode(t,void 0,r),s=r1.createNode(e,void 0,r);return new Ef(n,s)}var Ef=class t{constructor(e,r=null){Object.defineProperty(this,kf.NODE_TYPE,{value:kf.PAIR}),this.key=e,this.value=r}clone(e){let{key:r,value:n}=this;return kf.isNode(r)&&(r=r.clone(e)),kf.isNode(n)&&(n=n.clone(e)),new t(r,n)}toJSON(e,r){let n=r?.mapAsMap?new Map:{};return L5.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?M5.stringifyPair(this,e,r,n):JSON.stringify(this)}};hb.Pair=Ef;hb.createPair=q5});var mb=S(s1=>{"use strict";f();var wo=Ee(),n1=Cc(),Tf=$c();function Z5(t,e,r){return(e.inFlow??t.flow?F5:D5)(t,e,r)}function D5({comment:t,items:e},r,{blockItemPrefix:n,flowChars:s,itemIndent:o,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:u}}=r,l=Object.assign({},r,{indent:o,type:null}),d=!1,p=[];for(let h=0;h<e.length;++h){let m=e[h],_=null;if(wo.isNode(m))!d&&m.spaceBefore&&p.push(""),$f(r,p,m.commentBefore,d),m.comment&&(_=m.comment);else if(wo.isPair(m)){let w=wo.isNode(m.key)?m.key:null;w&&(!d&&w.spaceBefore&&p.push(""),$f(r,p,w.commentBefore,d))}d=!1;let b=n1.stringify(m,l,()=>_=null,()=>d=!0);_&&(b+=Tf.lineComment(b,o,u(_))),d&&_&&(d=!1),p.push(n+b)}let g;if(p.length===0)g=s.start+s.end;else{g=p[0];for(let h=1;h<p.length;++h){let m=p[h];g+=m?`
|
|
76
76
|
${c}${m}`:`
|
|
77
77
|
`}}return t?(g+=`
|
|
78
|
-
`+Tf.indentComment(u(t),c),a&&a()):d&&i&&i(),g}function
|
|
78
|
+
`+Tf.indentComment(u(t),c),a&&a()):d&&i&&i(),g}function F5({items:t},e,{flowChars:r,itemIndent:n}){let{indent:s,indentStep:o,flowCollectionPadding:i,options:{commentString:a}}=e;n+=o;let c=Object.assign({},e,{indent:n,inFlow:!0,type:null}),u=!1,l=0,d=[];for(let h=0;h<t.length;++h){let m=t[h],_=null;if(wo.isNode(m))m.spaceBefore&&d.push(""),$f(e,d,m.commentBefore,!1),m.comment&&(_=m.comment);else if(wo.isPair(m)){let w=wo.isNode(m.key)?m.key:null;w&&(w.spaceBefore&&d.push(""),$f(e,d,w.commentBefore,!1),w.comment&&(u=!0));let x=wo.isNode(m.value)?m.value:null;x?(x.comment&&(_=x.comment),x.commentBefore&&(u=!0)):m.value==null&&w?.comment&&(_=w.comment)}_&&(u=!0);let b=n1.stringify(m,c,()=>_=null);u||(u=d.length>l||b.includes(`
|
|
79
79
|
`)),h<t.length-1?b+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(u||(u=d.reduce((w,x)=>w+x.length+2,2)+(b.length+2)>e.options.lineWidth)),u&&(b+=",")),_&&(b+=Tf.lineComment(b,n,a(_))),d.push(b),l=d.length}let{start:p,end:g}=r;if(d.length===0)return p+g;if(!u){let h=d.reduce((m,_)=>m+_.length+2,2);u=e.options.lineWidth>0&&h>e.options.lineWidth}if(u){let h=p;for(let m of d)h+=m?`
|
|
80
80
|
${o}${s}${m}`:`
|
|
81
81
|
`;return`${h}
|
|
82
|
-
${s}${g}`}else return`${p}${i}${d.join(" ")}${i}${g}`}function $f({indent:t,options:{commentString:e}},r,n,s){if(n&&s&&(n=n.replace(/^\n+/,"")),n){let o=Tf.indentComment(e(n),t);r.push(o.trimStart())}}
|
|
83
|
-
`:" ")}return
|
|
82
|
+
${s}${g}`}else return`${p}${i}${d.join(" ")}${i}${g}`}function $f({indent:t,options:{commentString:e}},r,n,s){if(n&&s&&(n=n.replace(/^\n+/,"")),n){let o=Tf.indentComment(e(n),t);r.push(o.trimStart())}}s1.stringifyCollection=Z5});var ss=S(yb=>{"use strict";f();var U5=mb(),V5=pb(),B5=hf(),ns=Ee(),If=rs(),H5=it();function Rc(t,e){let r=ns.isScalar(e)?e.value:e;for(let n of t)if(ns.isPair(n)&&(n.key===e||n.key===r||ns.isScalar(n.key)&&n.key.value===r))return n}var gb=class extends B5.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ns.MAP,e),this.items=[]}static from(e,r,n){let{keepUndefined:s,replacer:o}=n,i=new this(e),a=(c,u)=>{if(typeof o=="function")u=o.call(r,c,u);else if(Array.isArray(o)&&!o.includes(c))return;(u!==void 0||s)&&i.items.push(If.createPair(c,u,n))};if(r instanceof Map)for(let[c,u]of r)a(c,u);else if(r&&typeof r=="object")for(let c of Object.keys(r))a(c,r[c]);return typeof e.sortMapEntries=="function"&&i.items.sort(e.sortMapEntries),i}add(e,r){let n;ns.isPair(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new If.Pair(e,e?.value):n=new If.Pair(e.key,e.value);let s=Rc(this.items,n.key),o=this.schema?.sortMapEntries;if(s){if(!r)throw new Error(`Key ${n.key} already set`);ns.isScalar(s.value)&&H5.isScalarValue(n.value)?s.value.value=n.value:s.value=n.value}else if(o){let i=this.items.findIndex(a=>o(n,a)<0);i===-1?this.items.push(n):this.items.splice(i,0,n)}else this.items.push(n)}delete(e){let r=Rc(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let s=Rc(this.items,e)?.value;return(!r&&ns.isScalar(s)?s.value:s)??void 0}has(e){return!!Rc(this.items,e)}set(e,r){this.add(new If.Pair(e,r),!0)}toJSON(e,r,n){let s=n?new n:r?.mapAsMap?new Map:{};r?.onCreate&&r.onCreate(s);for(let o of this.items)V5.addPairToJSMap(r,s,o);return s}toString(e,r,n){if(!e)return JSON.stringify(this);for(let s of this.items)if(!ns.isPair(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),U5.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};yb.YAMLMap=gb;yb.findPair=Rc});var qi=S(i1=>{"use strict";f();var K5=Ee(),o1=ss(),G5={collection:"map",default:!0,nodeClass:o1.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return K5.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>o1.YAMLMap.from(t,e,r)};i1.map=G5});var os=S(a1=>{"use strict";f();var J5=Tc(),W5=mb(),Y5=hf(),Pf=Ee(),X5=it(),Q5=Xn(),_b=class extends Y5.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Pf.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let r=Of(e);return typeof r!="number"?!1:this.items.splice(r,1).length>0}get(e,r){let n=Of(e);if(typeof n!="number")return;let s=this.items[n];return!r&&Pf.isScalar(s)?s.value:s}has(e){let r=Of(e);return typeof r=="number"&&r<this.items.length}set(e,r){let n=Of(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[n];Pf.isScalar(s)&&X5.isScalarValue(r)?s.value=r:this.items[n]=r}toJSON(e,r){let n=[];r?.onCreate&&r.onCreate(n);let s=0;for(let o of this.items)n.push(Q5.toJS(o,String(s++),r));return n}toString(e,r,n){return e?W5.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:r}):JSON.stringify(this)}static from(e,r,n){let{replacer:s}=n,o=new this(e);if(r&&Symbol.iterator in Object(r)){let i=0;for(let a of r){if(typeof s=="function"){let c=r instanceof Set?a:String(i++);a=s.call(r,c,a)}o.items.push(J5.createNode(a,void 0,n))}}return o}};function Of(t){let e=Pf.isScalar(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}a1.YAMLSeq=_b});var Zi=S(u1=>{"use strict";f();var eW=Ee(),c1=os(),tW={collection:"seq",default:!0,nodeClass:c1.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return eW.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>c1.YAMLSeq.from(t,e,r)};u1.seq=tW});var jc=S(l1=>{"use strict";f();var rW=Pc(),nW={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,r,n){return e=Object.assign({actualString:!0},e),rW.stringifyString(t,e,r,n)}};l1.string=nW});var Cf=S(p1=>{"use strict";f();var d1=it(),f1={identify:t=>t==null,createNode:()=>new d1.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new d1.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&f1.test.test(t)?t:e.options.nullStr};p1.nullTag=f1});var vb=S(m1=>{"use strict";f();var sW=it(),h1={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new sW.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&h1.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};m1.boolTag=h1});var Di=S(g1=>{"use strict";f();function oW({format:t,minFractionDigits:e,tag:r,value:n}){if(typeof n=="bigint")return String(n);let s=typeof n=="number"?n:Number(n);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!t&&e&&(!r||r==="tag:yaml.org,2002:float")&&/^\d/.test(o)){let i=o.indexOf(".");i<0&&(i=o.length,o+=".");let a=e-(o.length-i-1);for(;a-- >0;)o+="0"}return o}g1.stringifyNumber=oW});var wb=S(Nf=>{"use strict";f();var iW=it(),bb=Di(),aW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:bb.stringifyNumber},cW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():bb.stringifyNumber(t)}},uW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new iW.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:bb.stringifyNumber};Nf.float=uW;Nf.floatExp=cW;Nf.floatNaN=aW});var Sb=S(Rf=>{"use strict";f();var y1=Di(),Af=t=>typeof t=="bigint"||Number.isInteger(t),xb=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function _1(t,e,r){let{value:n}=t;return Af(n)&&n>=0?r+n.toString(e):y1.stringifyNumber(t)}var lW={identify:t=>Af(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>xb(t,2,8,r),stringify:t=>_1(t,8,"0o")},dW={identify:Af,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>xb(t,0,10,r),stringify:y1.stringifyNumber},fW={identify:t=>Af(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,r)=>xb(t,2,16,r),stringify:t=>_1(t,16,"0x")};Rf.int=dW;Rf.intHex=fW;Rf.intOct=lW});var b1=S(v1=>{"use strict";f();var pW=qi(),hW=Cf(),mW=Zi(),gW=jc(),yW=vb(),kb=wb(),Eb=Sb(),_W=[pW.map,mW.seq,gW.string,hW.nullTag,yW.boolTag,Eb.intOct,Eb.int,Eb.intHex,kb.floatNaN,kb.floatExp,kb.float];v1.schema=_W});var S1=S(x1=>{"use strict";f();var vW=it(),bW=qi(),wW=Zi();function w1(t){return typeof t=="bigint"||Number.isInteger(t)}var jf=({value:t})=>JSON.stringify(t),xW=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:jf},{identify:t=>t==null,createNode:()=>new vW.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:jf},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:jf},{identify:w1,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:r})=>r?BigInt(t):parseInt(t,10),stringify:({value:t})=>w1(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:jf}],SW={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},kW=[bW.map,wW.seq].concat(xW,SW);x1.schema=kW});var $b=S(k1=>{"use strict";f();var zc=Te("buffer"),Tb=it(),EW=Pc(),TW={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof zc.Buffer=="function")return zc.Buffer.from(t,"base64");if(typeof atob=="function"){let r=atob(t.replace(/[\n\r]/g,"")),n=new Uint8Array(r.length);for(let s=0;s<r.length;++s)n[s]=r.charCodeAt(s);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:r},n,s,o){if(!r)return"";let i=r,a;if(typeof zc.Buffer=="function")a=i instanceof zc.Buffer?i.toString("base64"):zc.Buffer.from(i.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let u=0;u<i.length;++u)c+=String.fromCharCode(i[u]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=Tb.Scalar.BLOCK_LITERAL),e!==Tb.Scalar.QUOTE_DOUBLE){let c=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),u=Math.ceil(a.length/c),l=new Array(u);for(let d=0,p=0;d<u;++d,p+=c)l[d]=a.substr(p,c);a=l.join(e===Tb.Scalar.BLOCK_LITERAL?`
|
|
83
|
+
`:" ")}return EW.stringifyString({comment:t,type:e,value:a},n,s,o)}};k1.binary=TW});var Lf=S(Mf=>{"use strict";f();var zf=Ee(),Ib=rs(),$W=it(),IW=os();function E1(t,e){if(zf.isSeq(t))for(let r=0;r<t.items.length;++r){let n=t.items[r];if(!zf.isPair(n)){if(zf.isMap(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");let s=n.items[0]||new Ib.Pair(new $W.Scalar(null));if(n.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${n.commentBefore}
|
|
84
84
|
${s.key.commentBefore}`:n.commentBefore),n.comment){let o=s.value??s.key;o.comment=o.comment?`${n.comment}
|
|
85
|
-
${o.comment}`:n.comment}n=s}t.items[r]=zf.isPair(n)?n:new Ib.Pair(n)}}else e("Expected a sequence for this tag");return t}function EC(t,e,r){let{replacer:n}=r,s=new SW.YAMLSeq(t);s.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let i of e){typeof n=="function"&&(i=n.call(e,String(o++),i));let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let u=Object.keys(i);if(u.length===1)a=u[0],c=i[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;s.items.push(Ib.createPair(a,c,r))}return s}var kW={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:kC,createNode:EC};Mf.createPairs=EC;Mf.pairs=kW;Mf.resolvePairs=kC});var Cb=S(Ob=>{"use strict";f();var TC=Ee(),Pb=Xn(),Mc=ss(),EW=os(),$C=Lf(),xo=class t extends EW.YAMLSeq{constructor(){super(),this.add=Mc.YAMLMap.prototype.add.bind(this),this.delete=Mc.YAMLMap.prototype.delete.bind(this),this.get=Mc.YAMLMap.prototype.get.bind(this),this.has=Mc.YAMLMap.prototype.has.bind(this),this.set=Mc.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let s of this.items){let o,i;if(TC.isPair(s)?(o=Pb.toJS(s.key,"",r),i=Pb.toJS(s.value,o,r)):o=Pb.toJS(s,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,i)}return n}static from(e,r,n){let s=$C.createPairs(e,r,n),o=new this;return o.items=s.items,o}};xo.tag="tag:yaml.org,2002:omap";var TW={collection:"seq",identify:t=>t instanceof Map,nodeClass:xo,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=$C.resolvePairs(t,e),n=[];for(let{key:s}of r.items)TC.isScalar(s)&&(n.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):n.push(s.value));return Object.assign(new xo,r)},createNode:(t,e,r)=>xo.from(t,e,r)};Ob.YAMLOMap=xo;Ob.omap=TW});var AC=S(Ab=>{"use strict";f();var IC=it();function PC({value:t,source:e},r){return e&&(t?OC:CC).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var OC={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new IC.Scalar(!0),stringify:PC},CC={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new IC.Scalar(!1),stringify:PC};Ab.falseTag=CC;Ab.trueTag=OC});var NC=S(qf=>{"use strict";f();var $W=it(),Nb=Di(),IW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Nb.stringifyNumber},PW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Nb.stringifyNumber(t)}},OW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new $W.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Nb.stringifyNumber};qf.float=OW;qf.floatExp=PW;qf.floatNaN=IW});var jC=S(qc=>{"use strict";f();var RC=Di(),Lc=t=>typeof t=="bigint"||Number.isInteger(t);function Zf(t,e,r,{intAsBigInt:n}){let s=t[0];if((s==="-"||s==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let i=BigInt(t);return s==="-"?BigInt(-1)*i:i}let o=parseInt(t,r);return s==="-"?-1*o:o}function Rb(t,e,r){let{value:n}=t;if(Lc(n)){let s=n.toString(e);return n<0?"-"+r+s.substr(1):r+s}return RC.stringifyNumber(t)}var CW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Zf(t,2,2,r),stringify:t=>Rb(t,2,"0b")},AW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Zf(t,1,8,r),stringify:t=>Rb(t,8,"0")},NW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Zf(t,0,10,r),stringify:RC.stringifyNumber},RW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Zf(t,2,16,r),stringify:t=>Rb(t,16,"0x")};qc.int=NW;qc.intBin=CW;qc.intHex=RW;qc.intOct=AW});var zb=S(jb=>{"use strict";f();var Uf=Ee(),Df=rs(),Ff=ss(),So=class t extends Ff.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Uf.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Df.Pair(e.key,null):r=new Df.Pair(e,null),Ff.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Ff.findPair(this.items,e);return!r&&Uf.isPair(n)?Uf.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Ff.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Df.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:s}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let i of r)typeof s=="function"&&(i=s.call(r,i,i)),o.items.push(Df.createPair(i,null,n));return o}};So.tag="tag:yaml.org,2002:set";var jW={collection:"map",identify:t=>t instanceof Set,nodeClass:So,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>So.from(t,e,r),resolve(t,e){if(Uf.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new So,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};jb.YAMLSet=So;jb.set=jW});var Lb=S(Vf=>{"use strict";f();var zW=Di();function Mb(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,s=i=>e?BigInt(i):Number(i),o=n.replace(/_/g,"").split(":").reduce((i,a)=>i*s(60)+s(a),s(0));return r==="-"?s(-1)*o:o}function zC(t){let{value:e}=t,r=i=>i;if(typeof e=="bigint")r=i=>BigInt(i);else if(isNaN(e)||!isFinite(e))return zW.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let s=r(60),o=[e%s];return e<60?o.unshift(0):(e=(e-o[0])/s,o.unshift(e%s),e>=60&&(e=(e-o[0])/s,o.unshift(e))),n+o.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var MW={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>Mb(t,r),stringify:zC},LW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Mb(t,!1),stringify:zC},MC={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(MC.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,s,o,i,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,u=Date.UTC(r,n-1,s,o||0,i||0,a||0,c),l=e[8];if(l&&l!=="Z"){let d=Mb(l,!1);Math.abs(d)<30&&(d*=60),u-=6e4*d}return new Date(u)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Vf.floatTime=LW;Vf.intTime=MW;Vf.timestamp=MC});var ZC=S(qC=>{"use strict";f();var qW=qi(),ZW=Cf(),DW=Zi(),FW=jc(),UW=$b(),LC=AC(),qb=NC(),Bf=jC(),VW=Sf(),BW=Cb(),HW=Lf(),KW=zb(),Zb=Lb(),GW=[qW.map,DW.seq,FW.string,ZW.nullTag,LC.trueTag,LC.falseTag,Bf.intBin,Bf.intOct,Bf.int,Bf.intHex,qb.floatNaN,qb.floatExp,qb.float,UW.binary,VW.merge,BW.omap,HW.pairs,KW.set,Zb.intTime,Zb.floatTime,Zb.timestamp];qC.schema=GW});var WC=S(Ub=>{"use strict";f();var VC=qi(),JW=Cf(),BC=Zi(),WW=jc(),YW=vb(),Db=wb(),Fb=Sb(),XW=vC(),QW=xC(),HC=$b(),Zc=Sf(),KC=Cb(),GC=Lf(),DC=ZC(),JC=zb(),Hf=Lb(),FC=new Map([["core",XW.schema],["failsafe",[VC.map,BC.seq,WW.string]],["json",QW.schema],["yaml11",DC.schema],["yaml-1.1",DC.schema]]),UC={binary:HC.binary,bool:YW.boolTag,float:Db.float,floatExp:Db.floatExp,floatNaN:Db.floatNaN,floatTime:Hf.floatTime,int:Fb.int,intHex:Fb.intHex,intOct:Fb.intOct,intTime:Hf.intTime,map:VC.map,merge:Zc.merge,null:JW.nullTag,omap:KC.omap,pairs:GC.pairs,seq:BC.seq,set:JC.set,timestamp:Hf.timestamp},e8={"tag:yaml.org,2002:binary":HC.binary,"tag:yaml.org,2002:merge":Zc.merge,"tag:yaml.org,2002:omap":KC.omap,"tag:yaml.org,2002:pairs":GC.pairs,"tag:yaml.org,2002:set":JC.set,"tag:yaml.org,2002:timestamp":Hf.timestamp};function t8(t,e,r){let n=FC.get(e);if(n&&!t)return r&&!n.includes(Zc.merge)?n.concat(Zc.merge):n.slice();let s=n;if(!s)if(Array.isArray(t))s=[];else{let o=Array.from(FC.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)s=s.concat(o);else typeof t=="function"&&(s=t(s.slice()));return r&&(s=s.concat(Zc.merge)),s.reduce((o,i)=>{let a=typeof i=="string"?UC[i]:i;if(!a){let c=JSON.stringify(i),u=Object.keys(UC).map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return o.includes(a)||o.push(a),o},[])}Ub.coreKnownTags=e8;Ub.getTags=t8});var Hb=S(YC=>{"use strict";f();var Vb=Ee(),r8=qi(),n8=Zi(),s8=jc(),Kf=WC(),o8=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Bb=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:s,schema:o,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(e)?Kf.getTags(e,"compat"):e?Kf.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=s?Kf.coreKnownTags:{},this.tags=Kf.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Vb.MAP,{value:r8.map}),Object.defineProperty(this,Vb.SCALAR,{value:s8.string}),Object.defineProperty(this,Vb.SEQ,{value:n8.seq}),this.sortMapEntries=typeof i=="function"?i:i===!0?o8:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};YC.Schema=Bb});var QC=S(XC=>{"use strict";f();var i8=Ee(),Kb=Cc(),Dc=$c();function a8(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let s=Kb.createStringifyContext(t,e),{commentString:o}=s.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Dc.indentComment(c,""))}let i=!1,a=null;if(t.contents){if(i8.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let l=o(t.contents.commentBefore);r.push(Dc.indentComment(l,""))}s.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>i=!0,u=Kb.stringify(t.contents,s,()=>a=null,c);a&&(u+=Dc.lineComment(u,"",o(a))),(u[0]==="|"||u[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${u}`:r.push(u)}else r.push(Kb.stringify(t.contents,s));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
85
|
+
${o.comment}`:n.comment}n=s}t.items[r]=zf.isPair(n)?n:new Ib.Pair(n)}}else e("Expected a sequence for this tag");return t}function T1(t,e,r){let{replacer:n}=r,s=new IW.YAMLSeq(t);s.tag="tag:yaml.org,2002:pairs";let o=0;if(e&&Symbol.iterator in Object(e))for(let i of e){typeof n=="function"&&(i=n.call(e,String(o++),i));let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let u=Object.keys(i);if(u.length===1)a=u[0],c=i[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;s.items.push(Ib.createPair(a,c,r))}return s}var OW={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:E1,createNode:T1};Mf.createPairs=T1;Mf.pairs=OW;Mf.resolvePairs=E1});var Cb=S(Pb=>{"use strict";f();var $1=Ee(),Ob=Xn(),Mc=ss(),PW=os(),I1=Lf(),xo=class t extends PW.YAMLSeq{constructor(){super(),this.add=Mc.YAMLMap.prototype.add.bind(this),this.delete=Mc.YAMLMap.prototype.delete.bind(this),this.get=Mc.YAMLMap.prototype.get.bind(this),this.has=Mc.YAMLMap.prototype.has.bind(this),this.set=Mc.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let s of this.items){let o,i;if($1.isPair(s)?(o=Ob.toJS(s.key,"",r),i=Ob.toJS(s.value,o,r)):o=Ob.toJS(s,"",r),n.has(o))throw new Error("Ordered maps must not include duplicate keys");n.set(o,i)}return n}static from(e,r,n){let s=I1.createPairs(e,r,n),o=new this;return o.items=s.items,o}};xo.tag="tag:yaml.org,2002:omap";var CW={collection:"seq",identify:t=>t instanceof Map,nodeClass:xo,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=I1.resolvePairs(t,e),n=[];for(let{key:s}of r.items)$1.isScalar(s)&&(n.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):n.push(s.value));return Object.assign(new xo,r)},createNode:(t,e,r)=>xo.from(t,e,r)};Pb.YAMLOMap=xo;Pb.omap=CW});var A1=S(Nb=>{"use strict";f();var O1=it();function P1({value:t,source:e},r){return e&&(t?C1:N1).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var C1={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new O1.Scalar(!0),stringify:P1},N1={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new O1.Scalar(!1),stringify:P1};Nb.falseTag=N1;Nb.trueTag=C1});var R1=S(qf=>{"use strict";f();var NW=it(),Ab=Di(),AW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ab.stringifyNumber},RW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Ab.stringifyNumber(t)}},jW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new NW.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Ab.stringifyNumber};qf.float=jW;qf.floatExp=RW;qf.floatNaN=AW});var z1=S(qc=>{"use strict";f();var j1=Di(),Lc=t=>typeof t=="bigint"||Number.isInteger(t);function Zf(t,e,r,{intAsBigInt:n}){let s=t[0];if((s==="-"||s==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let i=BigInt(t);return s==="-"?BigInt(-1)*i:i}let o=parseInt(t,r);return s==="-"?-1*o:o}function Rb(t,e,r){let{value:n}=t;if(Lc(n)){let s=n.toString(e);return n<0?"-"+r+s.substr(1):r+s}return j1.stringifyNumber(t)}var zW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Zf(t,2,2,r),stringify:t=>Rb(t,2,"0b")},MW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Zf(t,1,8,r),stringify:t=>Rb(t,8,"0")},LW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Zf(t,0,10,r),stringify:j1.stringifyNumber},qW={identify:Lc,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Zf(t,2,16,r),stringify:t=>Rb(t,16,"0x")};qc.int=LW;qc.intBin=zW;qc.intHex=qW;qc.intOct=MW});var zb=S(jb=>{"use strict";f();var Uf=Ee(),Df=rs(),Ff=ss(),So=class t extends Ff.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;Uf.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new Df.Pair(e.key,null):r=new Df.Pair(e,null),Ff.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=Ff.findPair(this.items,e);return!r&&Uf.isPair(n)?Uf.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=Ff.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new Df.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:s}=n,o=new this(e);if(r&&Symbol.iterator in Object(r))for(let i of r)typeof s=="function"&&(i=s.call(r,i,i)),o.items.push(Df.createPair(i,null,n));return o}};So.tag="tag:yaml.org,2002:set";var ZW={collection:"map",identify:t=>t instanceof Set,nodeClass:So,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>So.from(t,e,r),resolve(t,e){if(Uf.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new So,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};jb.YAMLSet=So;jb.set=ZW});var Lb=S(Vf=>{"use strict";f();var DW=Di();function Mb(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,s=i=>e?BigInt(i):Number(i),o=n.replace(/_/g,"").split(":").reduce((i,a)=>i*s(60)+s(a),s(0));return r==="-"?s(-1)*o:o}function M1(t){let{value:e}=t,r=i=>i;if(typeof e=="bigint")r=i=>BigInt(i);else if(isNaN(e)||!isFinite(e))return DW.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let s=r(60),o=[e%s];return e<60?o.unshift(0):(e=(e-o[0])/s,o.unshift(e%s),e>=60&&(e=(e-o[0])/s,o.unshift(e))),n+o.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var FW={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>Mb(t,r),stringify:M1},UW={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Mb(t,!1),stringify:M1},L1={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(L1.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,s,o,i,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,u=Date.UTC(r,n-1,s,o||0,i||0,a||0,c),l=e[8];if(l&&l!=="Z"){let d=Mb(l,!1);Math.abs(d)<30&&(d*=60),u-=6e4*d}return new Date(u)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Vf.floatTime=UW;Vf.intTime=FW;Vf.timestamp=L1});var D1=S(Z1=>{"use strict";f();var VW=qi(),BW=Cf(),HW=Zi(),KW=jc(),GW=$b(),q1=A1(),qb=R1(),Bf=z1(),JW=Sf(),WW=Cb(),YW=Lf(),XW=zb(),Zb=Lb(),QW=[VW.map,HW.seq,KW.string,BW.nullTag,q1.trueTag,q1.falseTag,Bf.intBin,Bf.intOct,Bf.int,Bf.intHex,qb.floatNaN,qb.floatExp,qb.float,GW.binary,JW.merge,WW.omap,YW.pairs,XW.set,Zb.intTime,Zb.floatTime,Zb.timestamp];Z1.schema=QW});var Y1=S(Ub=>{"use strict";f();var B1=qi(),e8=Cf(),H1=Zi(),t8=jc(),r8=vb(),Db=wb(),Fb=Sb(),n8=b1(),s8=S1(),K1=$b(),Zc=Sf(),G1=Cb(),J1=Lf(),F1=D1(),W1=zb(),Hf=Lb(),U1=new Map([["core",n8.schema],["failsafe",[B1.map,H1.seq,t8.string]],["json",s8.schema],["yaml11",F1.schema],["yaml-1.1",F1.schema]]),V1={binary:K1.binary,bool:r8.boolTag,float:Db.float,floatExp:Db.floatExp,floatNaN:Db.floatNaN,floatTime:Hf.floatTime,int:Fb.int,intHex:Fb.intHex,intOct:Fb.intOct,intTime:Hf.intTime,map:B1.map,merge:Zc.merge,null:e8.nullTag,omap:G1.omap,pairs:J1.pairs,seq:H1.seq,set:W1.set,timestamp:Hf.timestamp},o8={"tag:yaml.org,2002:binary":K1.binary,"tag:yaml.org,2002:merge":Zc.merge,"tag:yaml.org,2002:omap":G1.omap,"tag:yaml.org,2002:pairs":J1.pairs,"tag:yaml.org,2002:set":W1.set,"tag:yaml.org,2002:timestamp":Hf.timestamp};function i8(t,e,r){let n=U1.get(e);if(n&&!t)return r&&!n.includes(Zc.merge)?n.concat(Zc.merge):n.slice();let s=n;if(!s)if(Array.isArray(t))s=[];else{let o=Array.from(U1.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${o} or define customTags array`)}if(Array.isArray(t))for(let o of t)s=s.concat(o);else typeof t=="function"&&(s=t(s.slice()));return r&&(s=s.concat(Zc.merge)),s.reduce((o,i)=>{let a=typeof i=="string"?V1[i]:i;if(!a){let c=JSON.stringify(i),u=Object.keys(V1).map(l=>JSON.stringify(l)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return o.includes(a)||o.push(a),o},[])}Ub.coreKnownTags=o8;Ub.getTags=i8});var Hb=S(X1=>{"use strict";f();var Vb=Ee(),a8=qi(),c8=Zi(),u8=jc(),Kf=Y1(),l8=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,Bb=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:s,schema:o,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(e)?Kf.getTags(e,"compat"):e?Kf.getTags(null,e):null,this.name=typeof o=="string"&&o||"core",this.knownTags=s?Kf.coreKnownTags:{},this.tags=Kf.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,Vb.MAP,{value:a8.map}),Object.defineProperty(this,Vb.SCALAR,{value:u8.string}),Object.defineProperty(this,Vb.SEQ,{value:c8.seq}),this.sortMapEntries=typeof i=="function"?i:i===!0?l8:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};X1.Schema=Bb});var eN=S(Q1=>{"use strict";f();var d8=Ee(),Kb=Cc(),Dc=$c();function f8(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let s=Kb.createStringifyContext(t,e),{commentString:o}=s.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(Dc.indentComment(c,""))}let i=!1,a=null;if(t.contents){if(d8.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let l=o(t.contents.commentBefore);r.push(Dc.indentComment(l,""))}s.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>i=!0,u=Kb.stringify(t.contents,s,()=>a=null,c);a&&(u+=Dc.lineComment(u,"",o(a))),(u[0]==="|"||u[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${u}`:r.push(u)}else r.push(Kb.stringify(t.contents,s));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(`
|
|
86
86
|
`)?(r.push("..."),r.push(Dc.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&i&&(c=c.replace(/^\n+/,"")),c&&((!i||a)&&r[r.length-1]!==""&&r.push(""),r.push(Dc.indentComment(o(c),"")))}return r.join(`
|
|
87
87
|
`)+`
|
|
88
|
-
`}
|
|
88
|
+
`}Q1.stringifyDocument=f8});var Fc=S(tN=>{"use strict";f();var p8=Ec(),Fi=hf(),mr=Ee(),h8=rs(),m8=Xn(),g8=Hb(),y8=eN(),Gb=lf(),_8=Xv(),v8=Tc(),Jb=Yv(),Wb=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,mr.NODE_TYPE,{value:mr.DOC});let s=null;typeof r=="function"||Array.isArray(r)?s=r:n===void 0&&r&&(n=r,r=void 0);let o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:i}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new Jb.Directives({version:i}),this.setSchema(i,n),this.contents=e===void 0?null:this.createNode(e,s,n)}clone(){let e=Object.create(t.prototype,{[mr.NODE_TYPE]:{value:mr.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=mr.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Ui(this.contents)&&this.contents.add(e)}addIn(e,r){Ui(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=Gb.anchorNames(this);e.anchor=!r||n.has(r)?Gb.findNewAnchor(r||"a",n):r}return new p8.Alias(e.anchor)}createNode(e,r,n){let s;if(typeof r=="function")e=r.call({"":e},"",e),s=r;else if(Array.isArray(r)){let _=w=>typeof w=="number"||w instanceof String||w instanceof Number,b=r.filter(_).map(String);b.length>0&&(r=r.concat(b)),s=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:o,anchorPrefix:i,flow:a,keepUndefined:c,onTagObj:u,tag:l}=n??{},{onAnchor:d,setAnchors:p,sourceObjects:g}=Gb.createNodeAnchors(this,i||"a"),h={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:g},m=v8.createNode(e,l,h);return a&&mr.isCollection(m)&&(m.flow=!0),p(),m}createPair(e,r,n={}){let s=this.createNode(e,null,n),o=this.createNode(r,null,n);return new h8.Pair(s,o)}delete(e){return Ui(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Fi.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Ui(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return mr.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Fi.isEmptyPath(e)?!r&&mr.isScalar(this.contents)?this.contents.value:this.contents:mr.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return mr.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Fi.isEmptyPath(e)?this.contents!==void 0:mr.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Fi.collectionFromPath(this.schema,[e],r):Ui(this.contents)&&this.contents.set(e,r)}setIn(e,r){Fi.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Fi.collectionFromPath(this.schema,Array.from(e),r):Ui(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Jb.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Jb.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new g8.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:s,onAnchor:o,reviver:i}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=m8.toJS(this.contents,r??"",a);if(typeof o=="function")for(let{count:u,res:l}of a.anchors.values())o(l,u);return typeof i=="function"?_8.applyReviver(i,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return y8.stringifyDocument(this,e)}};function Ui(t){if(mr.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}tN.Document=Wb});var Bc=S(Vc=>{"use strict";f();var Uc=class extends Error{constructor(e,r,n,s){super(),this.name=e,this.code=n,this.message=s,this.pos=r}},Yb=class extends Uc{constructor(e,r,n){super("YAMLParseError",e,r,n)}},Xb=class extends Uc{constructor(e,r,n){super("YAMLWarning",e,r,n)}},b8=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:s}=r.linePos[0];r.message+=` at line ${n}, column ${s}`;let o=s-1,i=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&i.length>80){let a=Math.min(o-39,i.length-79);i="\u2026"+i.substring(a),o-=a-1}if(i.length>80&&(i=i.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(i.substring(0,o))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
89
89
|
`),i=a+i}if(/[^ ]/.test(i)){let a=1,c=r.linePos[1];c?.line===n&&c.col>s&&(a=Math.max(1,Math.min(c.col-s,80-o)));let u=" ".repeat(o)+"^".repeat(a);r.message+=`:
|
|
90
90
|
|
|
91
91
|
${i}
|
|
92
92
|
${u}
|
|
93
|
-
`}};Vc.YAMLError=Uc;Vc.YAMLParseError=Yb;Vc.YAMLWarning=Xb;Vc.prettifyError=
|
|
94
|
-
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(Qb(e.key)||Qb(e.value))return!0}return!1;default:return!0}}
|
|
95
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
96
|
-
`+x.comment:w.comment=x.comment);let T=new
|
|
97
|
-
`+L.comment:u.comment=L.comment),d=L.end;continue}!i&&r.options.strict&&
|
|
98
|
-
`+U:$.comment=U,L.comment=L.comment.substring(U.length+1)}}if(!i&&!T&&!L.found){let U=
|
|
99
|
-
`+
|
|
100
|
-
`+_.comment:u.comment=_.comment),u.range=[n.offset,m,_.offset]}else u.range=[n.offset,m,m];return u}
|
|
93
|
+
`}};Vc.YAMLError=Uc;Vc.YAMLParseError=Yb;Vc.YAMLWarning=Xb;Vc.prettifyError=b8});var Hc=S(rN=>{"use strict";f();function w8(t,{flow:e,indicator:r,next:n,offset:s,onError:o,parentIndent:i,startOnNewline:a}){let c=!1,u=a,l=a,d="",p="",g=!1,h=!1,m=null,_=null,b=null,w=null,x=null,T=null,O=null;for(let $ of t)switch(h&&($.type!=="space"&&$.type!=="newline"&&$.type!=="comma"&&o($.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(u&&$.type!=="comment"&&$.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),$.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&$.source.includes(" ")&&(m=$),l=!0;break;case"comment":{l||o($,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=$.source.substring(1)||" ";d?d+=p+A:d=A,p="",u=!1;break}case"newline":u?d?d+=$.source:(!T||r!=="seq-item-ind")&&(c=!0):p+=$.source,u=!0,g=!0,(_||b)&&(w=$),l=!0;break;case"anchor":_&&o($,"MULTIPLE_ANCHORS","A node can have at most one anchor"),$.source.endsWith(":")&&o($.offset+$.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),_=$,O??(O=$.offset),u=!1,l=!1,h=!0;break;case"tag":{b&&o($,"MULTIPLE_TAGS","A node can have at most one tag"),b=$,O??(O=$.offset),u=!1,l=!1,h=!0;break}case r:(_||b)&&o($,"BAD_PROP_ORDER",`Anchors and tags must be after the ${$.source} indicator`),T&&o($,"UNEXPECTED_TOKEN",`Unexpected ${$.source} in ${e??"collection"}`),T=$,u=r==="seq-item-ind"||r==="explicit-key-ind",l=!1;break;case"comma":if(e){x&&o($,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),x=$,u=!1,l=!1;break}default:o($,"UNEXPECTED_TOKEN",`Unexpected ${$.type} token`),u=!1,l=!1}let L=t[t.length-1],U=L?L.offset+L.source.length:s;return h&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(u&&m.indent<=i||n?.type==="block-map"||n?.type==="block-seq")&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:x,found:T,spaceBefore:c,comment:d,hasNewline:g,anchor:_,tag:b,newlineAfterProp:w,end:U,start:O??U}}rN.resolveProps=w8});var Gf=S(nN=>{"use strict";f();function Qb(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
|
|
94
|
+
`))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let r of e.start)if(r.type==="newline")return!0;if(e.sep){for(let r of e.sep)if(r.type==="newline")return!0}if(Qb(e.key)||Qb(e.value))return!0}return!1;default:return!0}}nN.containsNewline=Qb});var ew=S(sN=>{"use strict";f();var x8=Gf();function S8(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&x8.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}sN.flowIndentCheck=S8});var tw=S(iN=>{"use strict";f();var oN=Ee();function k8(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let s=typeof n=="function"?n:(o,i)=>o===i||oN.isScalar(o)&&oN.isScalar(i)&&o.value===i.value;return e.some(o=>s(o.key,r))}iN.mapIncludes=k8});var fN=S(dN=>{"use strict";f();var aN=rs(),E8=ss(),cN=Hc(),T8=Gf(),uN=ew(),$8=tw(),lN="All mapping items must start at the same column";function I8({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=o?.nodeClass??E8.YAMLMap,a=new i(r.schema);r.atRoot&&(r.atRoot=!1);let c=n.offset,u=null;for(let l of n.items){let{start:d,key:p,sep:g,value:h}=l,m=cN.resolveProps(d,{indicator:"explicit-key-ind",next:p??g?.[0],offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0}),_=!m.found;if(_){if(p&&(p.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==n.indent&&s(c,"BAD_INDENT",lN)),!m.anchor&&!m.tag&&!g){u=m.end,m.comment&&(a.comment?a.comment+=`
|
|
95
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||T8.containsNewline(p))&&s(p??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==n.indent&&s(c,"BAD_INDENT",lN);r.atKey=!0;let b=m.end,w=p?t(r,p,m,s):e(r,b,d,null,m,s);r.schema.compat&&uN.flowIndentCheck(n.indent,p,s),r.atKey=!1,$8.mapIncludes(r,a.items,w)&&s(b,"DUPLICATE_KEY","Map keys must be unique");let x=cN.resolveProps(g??[],{indicator:"map-value-ind",next:h,offset:w.range[2],onError:s,parentIndent:n.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=x.end,x.found){_&&(h?.type==="block-map"&&!x.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),r.options.strict&&m.start<x.found.offset-1024&&s(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let T=h?t(r,h,x,s):e(r,c,g,null,x,s);r.schema.compat&&uN.flowIndentCheck(n.indent,h,s),c=T.range[2];let O=new aN.Pair(w,T);r.options.keepSourceTokens&&(O.srcToken=l),a.items.push(O)}else{_&&s(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),x.comment&&(w.comment?w.comment+=`
|
|
96
|
+
`+x.comment:w.comment=x.comment);let T=new aN.Pair(w);r.options.keepSourceTokens&&(T.srcToken=l),a.items.push(T)}}return u&&u<c&&s(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,c,u??c],a}dN.resolveBlockMap=I8});var hN=S(pN=>{"use strict";f();var O8=os(),P8=Hc(),C8=ew();function N8({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=o?.nodeClass??O8.YAMLSeq,a=new i(r.schema);r.atRoot&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let c=n.offset,u=null;for(let{start:l,value:d}of n.items){let p=P8.resolveProps(l,{indicator:"seq-item-ind",next:d,offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||d)d?.type==="block-seq"?s(p.end,"BAD_INDENT","All sequence items must start at the same column"):s(c,"MISSING_CHAR","Sequence item without - indicator");else{u=p.end,p.comment&&(a.comment=p.comment);continue}let g=d?t(r,d,p,s):e(r,p.end,l,null,p,s);r.schema.compat&&C8.flowIndentCheck(n.indent,d,s),c=g.range[2],a.items.push(g)}return a.range=[n.offset,c,u??c],a}pN.resolveBlockSeq=N8});var Vi=S(mN=>{"use strict";f();function A8(t,e,r,n){let s="";if(t){let o=!1,i="";for(let a of t){let{source:c,type:u}=a;switch(u){case"space":o=!0;break;case"comment":{r&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let l=c.substring(1)||" ";s?s+=i+l:s=l,i="";break}case"newline":s&&(i+=c),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=c.length}}return{comment:s,offset:e}}mN.resolveEnd=A8});var vN=S(_N=>{"use strict";f();var R8=Ee(),j8=rs(),gN=ss(),z8=os(),M8=Vi(),yN=Hc(),L8=Gf(),q8=tw(),rw="Block collections are not allowed within flow collections",nw=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Z8({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=n.start.source==="{",a=i?"flow map":"flow sequence",c=o?.nodeClass??(i?gN.YAMLMap:z8.YAMLSeq),u=new c(r.schema);u.flow=!0;let l=r.atRoot;l&&(r.atRoot=!1),r.atKey&&(r.atKey=!1);let d=n.offset+n.start.source.length;for(let _=0;_<n.items.length;++_){let b=n.items[_],{start:w,key:x,sep:T,value:O}=b,L=yN.resolveProps(w,{flow:a,indicator:"explicit-key-ind",next:x??T?.[0],offset:d,onError:s,parentIndent:n.indent,startOnNewline:!1});if(!L.found){if(!L.anchor&&!L.tag&&!T&&!O){_===0&&L.comma?s(L.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):_<n.items.length-1&&s(L.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),L.comment&&(u.comment?u.comment+=`
|
|
97
|
+
`+L.comment:u.comment=L.comment),d=L.end;continue}!i&&r.options.strict&&L8.containsNewline(x)&&s(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(_===0)L.comma&&s(L.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(L.comma||s(L.start,"MISSING_CHAR",`Missing , between ${a} items`),L.comment){let U="";e:for(let $ of w)switch($.type){case"comma":case"space":break;case"comment":U=$.source.substring(1);break e;default:break e}if(U){let $=u.items[u.items.length-1];R8.isPair($)&&($=$.value??$.key),$.comment?$.comment+=`
|
|
98
|
+
`+U:$.comment=U,L.comment=L.comment.substring(U.length+1)}}if(!i&&!T&&!L.found){let U=O?t(r,O,L,s):e(r,L.end,T,null,L,s);u.items.push(U),d=U.range[2],nw(O)&&s(U.range,"BLOCK_IN_FLOW",rw)}else{r.atKey=!0;let U=L.end,$=x?t(r,x,L,s):e(r,U,w,null,L,s);nw(x)&&s($.range,"BLOCK_IN_FLOW",rw),r.atKey=!1;let A=yN.resolveProps(T??[],{flow:a,indicator:"map-value-ind",next:O,offset:$.range[2],onError:s,parentIndent:n.indent,startOnNewline:!1});if(A.found){if(!i&&!L.found&&r.options.strict){if(T)for(let z of T){if(z===A.found)break;if(z.type==="newline"){s(z,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}L.start<A.found.offset-1024&&s(A.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else O&&("source"in O&&O.source?.[0]===":"?s(O,"MISSING_CHAR",`Missing space after : in ${a}`):s(A.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let F=O?t(r,O,A,s):A.found?e(r,A.end,T,null,A,s):null;F?nw(O)&&s(F.range,"BLOCK_IN_FLOW",rw):A.comment&&($.comment?$.comment+=`
|
|
99
|
+
`+A.comment:$.comment=A.comment);let C=new j8.Pair($,F);if(r.options.keepSourceTokens&&(C.srcToken=b),i){let z=u;q8.mapIncludes(r,z.items,$)&&s(U,"DUPLICATE_KEY","Map keys must be unique"),z.items.push(C)}else{let z=new gN.YAMLMap(r.schema);z.flow=!0,z.items.push(C);let V=(F??$).range;z.range=[$.range[0],V[1],V[2]],u.items.push(z)}d=F?F.range[2]:A.end}}let p=i?"}":"]",[g,...h]=n.end,m=d;if(g?.source===p)m=g.offset+g.source.length;else{let _=a[0].toUpperCase()+a.substring(1),b=l?`${_} must end with a ${p}`:`${_} in block collection must be sufficiently indented and end with a ${p}`;s(d,l?"MISSING_CHAR":"BAD_INDENT",b),g&&g.source.length!==1&&h.unshift(g)}if(h.length>0){let _=M8.resolveEnd(h,m,r.options.strict,s);_.comment&&(u.comment?u.comment+=`
|
|
100
|
+
`+_.comment:u.comment=_.comment),u.range=[n.offset,m,_.offset]}else u.range=[n.offset,m,m];return u}_N.resolveFlowCollection=Z8});var wN=S(bN=>{"use strict";f();var D8=Ee(),F8=it(),U8=ss(),V8=os(),B8=fN(),H8=hN(),K8=vN();function sw(t,e,r,n,s,o){let i=r.type==="block-map"?B8.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?H8.resolveBlockSeq(t,e,r,n,o):K8.resolveFlowCollection(t,e,r,n,o),a=i.constructor;return s==="!"||s===a.tagName?(i.tag=a.tagName,i):(s&&(i.tag=s),i)}function G8(t,e,r,n,s){let o=n.tag,i=o?e.directives.tagName(o.source,p=>s(o,"TAG_RESOLVE_FAILED",p)):null;if(r.type==="block-seq"){let{anchor:p,newlineAfterProp:g}=n,h=p&&o?p.offset>o.offset?p:o:p??o;h&&(!g||g.offset<h.offset)&&s(h,"MISSING_CHAR","Missing newline after block sequence props")}let a=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!o||!i||i==="!"||i===U8.YAMLMap.tagName&&a==="map"||i===V8.YAMLSeq.tagName&&a==="seq")return sw(t,e,r,s,i);let c=e.schema.tags.find(p=>p.tag===i&&p.collection===a);if(!c){let p=e.schema.knownTags[i];if(p?.collection===a)e.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?s(o,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):s(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),sw(t,e,r,s,i)}let u=sw(t,e,r,s,i,c),l=c.resolve?.(u,p=>s(o,"TAG_RESOLVE_FAILED",p),e.options)??u,d=D8.isNode(l)?l:new F8.Scalar(l);return d.range=u.range,d.tag=i,c?.format&&(d.format=c.format),d}bN.composeCollection=G8});var iw=S(xN=>{"use strict";f();var ow=it();function J8(t,e,r){let n=e.offset,s=W8(e,t.options.strict,r);if(!s)return{value:"",type:null,comment:"",range:[n,n,n]};let o=s.mode===">"?ow.Scalar.BLOCK_FOLDED:ow.Scalar.BLOCK_LITERAL,i=e.source?Y8(e.source):[],a=i.length;for(let m=i.length-1;m>=0;--m){let _=i[m][1];if(_===""||_==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&i.length>0?`
|
|
101
101
|
`.repeat(Math.max(1,i.length-1)):"",_=n+s.length;return e.source&&(_+=e.source.length),{value:m,type:o,comment:s.comment,range:[n,_,_]}}let c=e.indent+s.indent,u=e.offset+s.length,l=0;for(let m=0;m<a;++m){let[_,b]=i[m];if(b===""||b==="\r")s.indent===0&&_.length>c&&(c=_.length);else{_.length<c&&r(u+_.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(c=_.length),l=m,c===0&&!t.atRoot&&r(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=_.length+b.length+1}for(let m=i.length-1;m>=a;--m)i[m][0].length>c&&(a=m+1);let d="",p="",g=!1;for(let m=0;m<l;++m)d+=i[m][0].slice(c)+`
|
|
102
102
|
`;for(let m=l;m<a;++m){let[_,b]=i[m];u+=_.length+b.length+1;let w=b[b.length-1]==="\r";if(w&&(b=b.slice(0,-1)),b&&_.length<c){let T=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;r(u-b.length-(w?2:1),"BAD_INDENT",T),_=""}o===ow.Scalar.BLOCK_LITERAL?(d+=p+_.slice(c)+b,p=`
|
|
103
103
|
`):_.length>c||b[0]===" "?(p===" "?p=`
|
|
@@ -112,70 +112,70 @@ ${u}
|
|
|
112
112
|
`+i[m][0].slice(c);d[d.length-1]!==`
|
|
113
113
|
`&&(d+=`
|
|
114
114
|
`);break;default:d+=`
|
|
115
|
-
`}let h=n+s.length+e.source.length;return{value:d,type:o,comment:s.comment,range:[n,h,h]}}function
|
|
115
|
+
`}let h=n+s.length+e.source.length;return{value:d,type:o,comment:s.comment,range:[n,h,h]}}function W8({offset:t,props:e},r,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:s}=e[0],o=s[0],i=0,a="",c=-1;for(let p=1;p<s.length;++p){let g=s[p];if(!a&&(g==="-"||g==="+"))a=g;else{let h=Number(g);!i&&h?i=h:c===-1&&(c=t+p)}}c!==-1&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let u=!1,l="",d=s.length;for(let p=1;p<e.length;++p){let g=e[p];switch(g.type){case"space":u=!0;case"newline":d+=g.source.length;break;case"comment":r&&!u&&n(g,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=g.source.length,l=g.source.substring(1);break;case"error":n(g,"UNEXPECTED_TOKEN",g.message),d+=g.source.length;break;default:{let h=`Unexpected token in block scalar header: ${g.type}`;n(g,"UNEXPECTED_TOKEN",h);let m=g.source;m&&typeof m=="string"&&(d+=m.length)}}}return{mode:o,indent:i,chomp:a,comment:l,length:d}}function Y8(t){let e=t.split(/\n( *)/),r=e[0],n=r.match(/^( *)/),o=[n?.[1]?[n[1],r.slice(n[1].length)]:["",r]];for(let i=1;i<e.length;i+=2)o.push([e[i],e[i+1]]);return o}xN.resolveBlockScalar=J8});var cw=S(kN=>{"use strict";f();var aw=it(),X8=Vi();function Q8(t,e,r){let{offset:n,type:s,source:o,end:i}=t,a,c,u=(p,g,h)=>r(n+p,g,h);switch(s){case"scalar":a=aw.Scalar.PLAIN,c=eY(o,u);break;case"single-quoted-scalar":a=aw.Scalar.QUOTE_SINGLE,c=tY(o,u);break;case"double-quoted-scalar":a=aw.Scalar.QUOTE_DOUBLE,c=rY(o,u);break;default:return r(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}let l=n+o.length,d=X8.resolveEnd(i,l,e,r);return{value:c,type:a,comment:d.comment,range:[n,l,d.offset]}}function eY(t,e){let r="";switch(t[0]){case" ":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${t[0]}`;break}case"@":case"`":{r=`reserved character ${t[0]}`;break}}return r&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`),SN(t)}function tY(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),SN(t.slice(1,-1)).replace(/''/g,"'")}function SN(t){let e,r;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
116
116
|
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
117
117
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(t);if(!n)return t;let s=n[1],o=" ",i=e.lastIndex;for(r.lastIndex=i;n=r.exec(t);)n[1]===""?o===`
|
|
118
118
|
`?s+=o:o=`
|
|
119
|
-
`:(s+=o+n[1],o=" "),i=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=i,n=a.exec(t),s+o+(n?.[1]??"")}function
|
|
119
|
+
`:(s+=o+n[1],o=" "),i=r.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=i,n=a.exec(t),s+o+(n?.[1]??"")}function rY(t,e){let r="";for(let n=1;n<t.length-1;++n){let s=t[n];if(!(s==="\r"&&t[n+1]===`
|
|
120
120
|
`))if(s===`
|
|
121
|
-
`){let{fold:o,offset:i}=
|
|
121
|
+
`){let{fold:o,offset:i}=nY(t,n);r+=o,n=i}else if(s==="\\"){let o=t[++n],i=sY[o];if(i)r+=i;else if(o===`
|
|
122
122
|
`)for(o=t[n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="\r"&&t[n+1]===`
|
|
123
|
-
`)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a={x:2,u:4,U:8}[o];r+=
|
|
123
|
+
`)for(o=t[++n+1];o===" "||o===" ";)o=t[++n+1];else if(o==="x"||o==="u"||o==="U"){let a={x:2,u:4,U:8}[o];r+=oY(t,n+1,a,e),n+=a}else{let a=t.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),r+=a}}else if(s===" "||s===" "){let o=n,i=t[n+1];for(;i===" "||i===" ";)i=t[++n+1];i!==`
|
|
124
124
|
`&&!(i==="\r"&&t[n+2]===`
|
|
125
|
-
`)&&(r+=n>o?t.slice(o,n+1):s)}else r+=s}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function
|
|
125
|
+
`)&&(r+=n>o?t.slice(o,n+1):s)}else r+=s}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function nY(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===`
|
|
126
126
|
`||n==="\r")&&!(n==="\r"&&t[e+2]!==`
|
|
127
127
|
`);)n===`
|
|
128
128
|
`&&(r+=`
|
|
129
|
-
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var
|
|
130
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
129
|
+
`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var sY={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
130
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function oY(t,e,r,n){let s=t.substr(e,r),i=s.length===r&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(i)){let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(i)}kN.resolveFlowScalar=Q8});var $N=S(TN=>{"use strict";f();var ko=Ee(),EN=it(),iY=iw(),aY=cw();function cY(t,e,r,n){let{value:s,type:o,comment:i,range:a}=e.type==="block-scalar"?iY.resolveBlockScalar(t,e,n):aY.resolveFlowScalar(e,t.options.strict,n),c=r?t.directives.tagName(r.source,d=>n(r,"TAG_RESOLVE_FAILED",d)):null,u;t.options.stringKeys&&t.atKey?u=t.schema[ko.SCALAR]:c?u=uY(t.schema,s,c,r,n):e.type==="scalar"?u=lY(t,s,e,n):u=t.schema[ko.SCALAR];let l;try{let d=u.resolve(s,p=>n(r??e,"TAG_RESOLVE_FAILED",p),t.options);l=ko.isScalar(d)?d:new EN.Scalar(d)}catch(d){let p=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",p),l=new EN.Scalar(s)}return l.range=a,l.source=s,o&&(l.type=o),c&&(l.tag=c),u.format&&(l.format=u.format),i&&(l.comment=i),l}function uY(t,e,r,n,s){if(r==="!")return t[ko.SCALAR];let o=[];for(let a of t.tags)if(!a.collection&&a.tag===r)if(a.default&&a.test)o.push(a);else return a;for(let a of o)if(a.test?.test(e))return a;let i=t.knownTags[r];return i&&!i.collection?(t.tags.push(Object.assign({},i,{default:!1,test:void 0})),i):(s(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),t[ko.SCALAR])}function lY({atKey:t,directives:e,schema:r},n,s,o){let i=r.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(n))||r[ko.SCALAR];if(r.compat){let a=r.compat.find(c=>c.default&&c.test?.test(n))??r[ko.SCALAR];if(i.tag!==a.tag){let c=e.tagString(i.tag),u=e.tagString(a.tag),l=`Value may be parsed as either ${c} or ${u}`;o(s,"TAG_RESOLVE_FAILED",l,!0)}}return i}TN.composeScalar=cY});var ON=S(IN=>{"use strict";f();function dY(t,e,r){if(e){r??(r=e.length);for(let n=r-1;n>=0;--n){let s=e[n];switch(s.type){case"space":case"comment":case"newline":t-=s.source.length;continue}for(s=e[++n];s?.type==="space";)t+=s.source.length,s=e[++n];break}}return t}IN.emptyScalarPosition=dY});var NN=S(lw=>{"use strict";f();var fY=Ec(),pY=Ee(),hY=wN(),PN=$N(),mY=Vi(),gY=ON(),yY={composeNode:CN,composeEmptyNode:uw};function CN(t,e,r,n){let s=t.atKey,{spaceBefore:o,comment:i,anchor:a,tag:c}=r,u,l=!0;switch(e.type){case"alias":u=_Y(t,e,n),(a||c)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=PN.composeScalar(t,e,c,n),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=hY.composeCollection(yY,t,e,r,n),a&&(u.anchor=a.source.substring(1))}catch(d){let p=d instanceof Error?d.message:String(d);n(e,"RESOURCE_EXHAUSTION",p)}break;default:{let d=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",d),l=!1}}return u??(u=uw(t,e.offset,void 0,null,r,n)),a&&u.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&t.options.stringKeys&&(!pY.isScalar(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&n(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),o&&(u.spaceBefore=!0),i&&(e.type==="scalar"&&e.source===""?u.comment=i:u.commentBefore=i),t.options.keepSourceTokens&&l&&(u.srcToken=e),u}function uw(t,e,r,n,{spaceBefore:s,comment:o,anchor:i,tag:a,end:c},u){let l={type:"scalar",offset:gY.emptyScalarPosition(e,r,n),indent:-1,source:""},d=PN.composeScalar(t,l,a,u);return i&&(d.anchor=i.source.substring(1),d.anchor===""&&u(i,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(d.spaceBefore=!0),o&&(d.comment=o,d.range[2]=c),d}function _Y({options:t},{offset:e,source:r,end:n},s){let o=new fY.Alias(r.substring(1));o.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),o.source.endsWith(":")&&s(e+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=e+r.length,a=mY.resolveEnd(n,i,t.strict,s);return o.range=[e,i,a.offset],a.comment&&(o.comment=a.comment),o}lw.composeEmptyNode=uw;lw.composeNode=CN});var jN=S(RN=>{"use strict";f();var vY=Fc(),AN=NN(),bY=Vi(),wY=Hc();function xY(t,e,{offset:r,start:n,value:s,end:o},i){let a=Object.assign({_directives:e},t),c=new vY.Document(void 0,a),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},l=wY.resolveProps(n,{indicator:"doc-start",next:s??o?.[0],offset:r,onError:i,parentIndent:0,startOnNewline:!0});l.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!l.hasNewline&&i(l.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?AN.composeNode(u,s,l,i):AN.composeEmptyNode(u,l.end,n,null,l,i);let d=c.contents.range[2],p=bY.resolveEnd(o,d,!1,i);return p.comment&&(c.comment=p.comment),c.range=[r,d,p.offset],c}RN.composeDoc=xY});var fw=S(LN=>{"use strict";f();var SY=Te("process"),kY=Yv(),EY=Fc(),Kc=Bc(),zN=Ee(),TY=jN(),$Y=Vi();function Gc(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:r}=t;return[e,e+(typeof r=="string"?r.length:1)]}function MN(t){let e="",r=!1,n=!1;for(let s=0;s<t.length;++s){let o=t[s];switch(o[0]){case"#":e+=(e===""?"":n?`
|
|
131
131
|
|
|
132
132
|
`:`
|
|
133
|
-
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[s+1]?.[0]!=="#"&&(s+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var dw=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,s,o)=>{let i=Gc(r);o?this.warnings.push(new Kc.YAMLWarning(i,n,s)):this.errors.push(new Kc.YAMLParseError(i,n,s))},this.directives=new
|
|
134
|
-
${n}`:n;else if(s||e.directives.docStart||!o)e.commentBefore=n;else if(
|
|
133
|
+
`)+(o.substring(1)||" "),r=!0,n=!1;break;case"%":t[s+1]?.[0]!=="#"&&(s+=1),r=!1;break;default:r||(n=!0),r=!1}}return{comment:e,afterEmptyLine:n}}var dw=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,s,o)=>{let i=Gc(r);o?this.warnings.push(new Kc.YAMLWarning(i,n,s)):this.errors.push(new Kc.YAMLParseError(i,n,s))},this.directives=new kY.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:s}=MN(this.prelude);if(n){let o=e.contents;if(r)e.comment=e.comment?`${e.comment}
|
|
134
|
+
${n}`:n;else if(s||e.directives.docStart||!o)e.commentBefore=n;else if(zN.isCollection(o)&&!o.flow&&o.items.length>0){let i=o.items[0];zN.isPair(i)&&(i=i.key);let a=i.commentBefore;i.commentBefore=a?`${n}
|
|
135
135
|
${a}`:n}else{let i=o.commentBefore;o.commentBefore=i?`${n}
|
|
136
|
-
${i}`:n}}r?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
137
|
-
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Kc.YAMLParseError(Gc(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),s=new
|
|
136
|
+
${i}`:n}}r?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:MN(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,r=!1,n=-1){for(let s of e)yield*this.next(s);yield*this.end(r,n)}*next(e){switch(SY.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(r,n,s)=>{let o=Gc(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=TY.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!r.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(r,!1),this.doc&&(yield this.doc),this.doc=r,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let r=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Kc.YAMLParseError(Gc(e),"UNEXPECTED_TOKEN",r);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new Kc.YAMLParseError(Gc(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=$Y.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),r.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
|
|
137
|
+
${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.push(new Kc.YAMLParseError(Gc(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,r=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let n=Object.assign({_directives:this.directives},this.options),s=new EY.Document(void 0,n);this.atDirectives&&this.onError(r,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,r,r],this.decorate(s,!1),yield s}}};LN.Composer=dw});var DN=S(Jf=>{"use strict";f();var IY=iw(),OY=cw(),PY=Bc(),qN=Pc();function CY(t,e=!0,r){if(t){let n=(s,o,i)=>{let a=typeof s=="number"?s:Array.isArray(s)?s[0]:s.offset;if(r)r(a,o,i);else throw new PY.YAMLParseError([a,a+1],o,i)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return OY.resolveFlowScalar(t,e,n);case"block-scalar":return IY.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function NY(t,e){let{implicitKey:r=!1,indent:n,inFlow:s=!1,offset:o=-1,type:i="PLAIN"}=e,a=qN.stringifyString({type:i,value:t},{implicitKey:r,indent:n>0?" ".repeat(n):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}}),c=e.end??[{type:"newline",offset:-1,indent:n,source:`
|
|
138
138
|
`}];switch(a[0]){case"|":case">":{let u=a.indexOf(`
|
|
139
139
|
`),l=a.substring(0,u),d=a.substring(u+1)+`
|
|
140
|
-
`,p=[{type:"block-scalar-header",offset:o,indent:n,source:l}];return
|
|
141
|
-
`}),{type:"block-scalar",offset:o,indent:n,props:p,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function
|
|
140
|
+
`,p=[{type:"block-scalar-header",offset:o,indent:n,source:l}];return ZN(p,c)||p.push({type:"newline",offset:-1,indent:n,source:`
|
|
141
|
+
`}),{type:"block-scalar",offset:o,indent:n,props:p,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function AY(t,e,r={}){let{afterKey:n=!1,implicitKey:s=!1,inFlow:o=!1,type:i}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!i)switch(t.type){case"single-quoted-scalar":i="QUOTE_SINGLE";break;case"double-quoted-scalar":i="QUOTE_DOUBLE";break;case"block-scalar":{let u=t.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:i="PLAIN"}let c=qN.stringifyString({type:i,value:e},{implicitKey:s||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":RY(t,c);break;case'"':pw(t,c,"double-quoted-scalar");break;case"'":pw(t,c,"single-quoted-scalar");break;default:pw(t,c,"scalar")}}function RY(t,e){let r=e.indexOf(`
|
|
142
142
|
`),n=e.substring(0,r),s=e.substring(r+1)+`
|
|
143
|
-
`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=s}else{let{offset:o}=t,i="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:i,source:n}];
|
|
144
|
-
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:i,props:a,source:s})}}function
|
|
145
|
-
`};delete t.items,Object.assign(t,{type:r,source:e,end:[s]});break}default:{let n="indent"in t?t.indent:-1,s="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:s})}}}Jf.createScalarToken
|
|
143
|
+
`;if(t.type==="block-scalar"){let o=t.props[0];if(o.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o.source=n,t.source=s}else{let{offset:o}=t,i="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:o,indent:i,source:n}];ZN(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:i,source:`
|
|
144
|
+
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:i,props:a,source:s})}}function ZN(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function pw(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),s=e.length;t.props[0].type==="block-scalar-header"&&(s-=t.props[0].source.length);for(let o of n)o.offset+=s;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let s={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
145
|
+
`};delete t.items,Object.assign(t,{type:r,source:e,end:[s]});break}default:{let n="indent"in t?t.indent:-1,s="end"in t&&Array.isArray(t.end)?t.end.filter(o=>o.type==="space"||o.type==="comment"||o.type==="newline"):[];for(let o of Object.keys(t))o!=="type"&&o!=="offset"&&delete t[o];Object.assign(t,{type:r,indent:n,source:e,end:s})}}}Jf.createScalarToken=NY;Jf.resolveAsScalar=CY;Jf.setScalarValue=AY});var UN=S(FN=>{"use strict";f();var jY=t=>"type"in t?Yf(t):Wf(t);function Yf(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=Yf(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=Wf(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=Wf(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=Wf(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function Wf({start:t,key:e,sep:r,value:n}){let s="";for(let o of t)s+=o.source;if(e&&(s+=Yf(e)),r)for(let o of r)s+=o.source;return n&&(s+=Yf(n)),s}FN.stringify=jY});var KN=S(HN=>{"use strict";f();var hw=Symbol("break visit"),zY=Symbol("skip children"),VN=Symbol("remove item");function Eo(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),BN(Object.freeze([]),t,e)}Eo.BREAK=hw;Eo.SKIP=zY;Eo.REMOVE=VN;Eo.itemAtPath=(t,e)=>{let r=t;for(let[n,s]of e){let o=r?.[n];if(o&&"items"in o)r=o.items[s];else return}return r};Eo.parentCollection=(t,e)=>{let r=Eo.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],s=r?.[n];if(s&&"items"in s)return s;throw new Error("Parent collection not found")};function BN(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let s of["key","value"]){let o=e[s];if(o&&"items"in o){for(let i=0;i<o.items.length;++i){let a=BN(Object.freeze(t.concat([[s,i]])),o.items[i],r);if(typeof a=="number")i=a-1;else{if(a===hw)return hw;a===VN&&(o.items.splice(i,1),i-=1)}}typeof n=="function"&&s==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}HN.visit=Eo});var Xf=S(Ut=>{"use strict";f();var mw=DN(),MY=UN(),LY=KN(),gw="\uFEFF",yw="",_w="",vw="",qY=t=>!!t&&"items"in t,ZY=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function DY(t){switch(t){case gw:return"<BOM>";case yw:return"<DOC>";case _w:return"<FLOW_END>";case vw:return"<SCALAR>";default:return JSON.stringify(t)}}function FY(t){switch(t){case gw:return"byte-order-mark";case yw:return"doc-mode";case _w:return"flow-error-end";case vw:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
146
146
|
`:case`\r
|
|
147
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ut.createScalarToken=mw.createScalarToken;Ut.resolveAsScalar=mw.resolveAsScalar;Ut.setScalarValue=mw.setScalarValue;Ut.stringify=
|
|
148
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
149
|
-
\r `),bw=t=>!t||
|
|
147
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Ut.createScalarToken=mw.createScalarToken;Ut.resolveAsScalar=mw.resolveAsScalar;Ut.setScalarValue=mw.setScalarValue;Ut.stringify=MY.stringify;Ut.visit=LY.visit;Ut.BOM=gw;Ut.DOCUMENT=yw;Ut.FLOW_END=_w;Ut.SCALAR=vw;Ut.isCollection=qY;Ut.isScalar=ZY;Ut.prettyToken=DY;Ut.tokenType=FY});var xw=S(JN=>{"use strict";f();var Jc=Xf();function Nr(t){switch(t){case void 0:case" ":case`
|
|
148
|
+
`:case"\r":case" ":return!0;default:return!1}}var GN=new Set("0123456789ABCDEFabcdef"),UY=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Qf=new Set(",[]{}"),VY=new Set(` ,[]{}
|
|
149
|
+
\r `),bw=t=>!t||VY.has(t),ww=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===`
|
|
150
150
|
`?!0:r==="\r"?this.buffer[e+1]===`
|
|
151
151
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let s=this.buffer[n+e+1];if(s===`
|
|
152
152
|
`||!s&&!this.atEnd)return e+n+1}return r===`
|
|
153
|
-
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&
|
|
154
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Jc.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let o=e[n-1];if(o===" "||o===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let o=e[r-1];if(o===" "||o===" ")r-=1;else break}let s=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield Jc.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&
|
|
153
|
+
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Nr(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
154
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Jc.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let o=e[n-1];if(o===" "||o===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let o=e[r-1];if(o===" "||o===" ")r-=1;else break}let s=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield Jc.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&Nr(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Nr(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Nr(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(bw),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&s[0]!=="#"||n===0&&(s.startsWith("---")||s.startsWith("..."))&&Nr(s[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield Jc.FLOW_END,yield*this.parseLineStart();let o=0;for(;s[o]===",";)o+=yield*this.pushCount(1),o+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(o+=yield*this.pushIndicators(),s[o]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-o),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(bw),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let i=this.charAt(1);if(this.flowKey||Nr(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let o=0;for(;this.buffer[r-1-o]==="\\";)o+=1;if(o%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),s=n.indexOf(`
|
|
155
155
|
`,this.pos);if(s!==-1){for(;s!==-1;){let o=this.continueScalar(s+1);if(o===-1)break;s=n.indexOf(`
|
|
156
|
-
`,o)}s!==-1&&(r=s-(n[s-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>
|
|
156
|
+
`,o)}s!==-1&&(r=s-(n[s-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Nr(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let o=this.pos;n=this.buffer[o];++o)switch(n){case" ":r+=1;break;case`
|
|
157
157
|
`:e=o,r=0;break;case"\r":{let i=this.buffer[o+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
|
|
158
158
|
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(`
|
|
159
159
|
`,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(n=this.buffer[s];n===" ";)n=this.buffer[++s];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
160
160
|
`;)n=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let o=e-1,i=this.buffer[o];i==="\r"&&(i=this.buffer[--o]);let a=o;for(;i===" ";)i=this.buffer[--o];if(i===`
|
|
161
|
-
`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Jc.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,s;for(;s=this.buffer[++n];)if(s===":"){let o=this.buffer[n+1];if(
|
|
161
|
+
`&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Jc.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,s;for(;s=this.buffer[++n];)if(s===":"){let o=this.buffer[n+1];if(Nr(o)||e&&Qf.has(o))break;r=n}else if(Nr(s)){let o=this.buffer[n+1];if(s==="\r"&&(o===`
|
|
162
162
|
`?(n+=1,s=`
|
|
163
163
|
`,o=this.buffer[n+1]):r=n),o==="#"||e&&Qf.has(o))break;if(s===`
|
|
164
|
-
`){let i=this.continueScalar(n+1);if(i===-1)break;n=Math.max(n,i-2)}}else{if(e&&Qf.has(s))break;r=n}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield Jc.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(bw))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,r=this.charAt(1);if(
|
|
164
|
+
`){let i=this.continueScalar(n+1);if(i===-1)break;n=Math.max(n,i-2)}}else{if(e&&Qf.has(s))break;r=n}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield Jc.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(bw))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,r=this.charAt(1);if(Nr(r)||e&&Qf.has(r))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Nr(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(UY.has(r))r=this.buffer[++e];else if(r==="%"&&GN.has(this.buffer[e+1])&&GN.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
165
165
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
166
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let s=r-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=r),s}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};
|
|
166
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let s=r-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=r),s}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};JN.Lexer=ww});var kw=S(WN=>{"use strict";f();var Sw=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r<n;){let o=r+n>>1;this.lineStarts[o]<e?r=o+1:n=o}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let s=this.lineStarts[r-1];return{line:r,col:e-s+1}}}};WN.LineCounter=Sw});var Tw=S(tA=>{"use strict";f();var BY=Te("process"),YN=Xf(),HY=xw();function is(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function XN(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function eA(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ep(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Bi(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function QN(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!is(e.start,"explicit-key-ind")&&!is(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,eA(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Ew=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new HY.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,BY.env.LOG_TOKENS&&console.log("|",YN.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=YN.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&QN(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let s=n.items[n.items.length-1];if(s.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=r;else{Object.assign(s,{key:r,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=n.items[n.items.length-1];s.value?n.items.push({start:[],value:r}):s.value=r;break}case"flow-collection":{let s=n.items[n.items.length-1];!s||s.value?n.items.push({start:[],key:r,sep:[]}):s.sep?s.value=r:Object.assign(s,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let s=r.items[r.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&XN(s.start)===-1&&(r.indent===0||s.start.every(o=>o.type!=="comment"||o.indent<r.indent))&&(n.type==="document"?n.end=s.start:n.items.push({start:s.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{XN(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let r=ep(this.peek(2)),n=Bi(r),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
|
167
167
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
168
|
-
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,r.start),s.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,s=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(s&&r.sep&&!r.value){let i=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":i.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(o=r.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":s||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):s||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(is(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(
|
|
168
|
+
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,r.start),s.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,s=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",o=[];if(s&&r.sep&&!r.value){let i=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":i.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(o=r.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":s||r.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):s||r.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(is(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(eA(r.key)&&!is(r.sep,"newline")){let i=Bi(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:a,sep:c}]})}else o.length>0?r.sep=r.sep.concat(o,this.sourceToken):r.sep.push(this.sourceToken);else if(is(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let i=Bi(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||s?e.items.push({start:o,key:null,sep:[this.sourceToken]}):is(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);s||r.value?(e.items.push({start:o,key:i,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(i):(Object.assign(r,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{let i=this.startBlockValue(e);if(i){if(i.type==="block-seq"){if(!r.explicitKey&&r.sep&&!is(r.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:o});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,r.start),s.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||is(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let s=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:s,sep:[]}):r.sep?this.stack.push(s):Object.assign(r,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let s=ep(n),o=Bi(s);QN(e);let i=e.end.splice(1,e.end.length);i.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
|
|
169
169
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
170
|
-
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=ep(e),n=Bi(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=ep(e),n=Bi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};
|
|
171
|
-
`&&t[o]!=="\r";o++)c+=t[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--)
|
|
172
|
-
`||t==="\r"}function hN(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return ot("InvalidXml","XML declaration allowed only at the start of the document.",Pt(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function mN(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var m7='"',g7="'";function y7(t,e){let r="",n="",s=!1;for(;e<t.length;e++){if(t[e]===m7||t[e]===g7)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){s=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:s}}var _7=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function gN(t,e){let r=Pw.getAllMatches(t,_7),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",eu(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",eu(r[s]));if(r[s][3]===void 0&&!e.allowBooleanAttributes)return ot("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",eu(r[s]));let o=r[s][2];if(!w7(o))return ot("InvalidAttr","Attribute '"+o+"' is an invalid name.",eu(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return ot("InvalidAttr","Attribute '"+o+"' is repeated.",eu(r[s]))}return!0}function v7(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function b7(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,v7(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function ot(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function w7(t){return Pw.isName(t)}function x7(t){return Pw.isName(t)}function Pt(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function eu(t){return t.startIndex+t[1].length}});var xN=S(Cw=>{"use strict";f();var{DANGEROUS_PROPERTY_NAMES:_N,criticalProperties:S7}=Qc(),vN=t=>_N.includes(t)?"__"+t:t,bN={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,onDangerousProperty:vN};function k7(t,e){if(typeof t!="string")return;let r=t.toLowerCase();if(_N.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(S7.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function wN(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:wN(!0)}var E7=function(t){let e=Object.assign({},bN,t),r=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:n,name:s}of r)n&&k7(n,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=vN),e.processEntities=wN(e.processEntities),e};Cw.buildOptions=E7;Cw.defaultOptions=bN});var kN=S((B_e,SN)=>{"use strict";f();var Aw=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};SN.exports=Aw});var $N=S((K_e,TN)=>{"use strict";f();var EN=Qc(),Nw=class{constructor(e){this.suppressValidationErr=!e,this.options=e||{}}readDocType(e,r){let n=Object.create(null),s=0;if(e[r+3]==="O"&&e[r+4]==="C"&&e[r+5]==="T"&&e[r+6]==="Y"&&e[r+7]==="P"&&e[r+8]==="E"){r=r+9;let o=1,i=!1,a=!1,c="";for(;r<e.length;r++)if(e[r]==="<"&&!a){if(i&&To(e,"!ENTITY",r)){r+=7;let u,l;if([u,l,r]=this.readEntityExp(e,r+1,this.suppressValidationErr),l.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);let d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n[u]={regx:RegExp(`&${d};`,"g"),val:l},s++}}else if(i&&To(e,"!ELEMENT",r)){r+=8;let{index:u}=this.readElementExp(e,r+1);r=u}else if(i&&To(e,"!ATTLIST",r))r+=8;else if(i&&To(e,"!NOTATION",r)){r+=9;let{index:u}=this.readNotationExp(e,r+1,this.suppressValidationErr);r=u}else if(To(e,"!--",r))a=!0;else throw new Error("Invalid DOCTYPE");o++,c=""}else if(e[r]===">"){if(a?e[r-1]==="-"&&e[r-2]==="-"&&(a=!1,o--):o--,o===0)break}else e[r]==="["?i=!0:c+=e[r];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r])&&e[r]!=='"'&&e[r]!=="'";)n+=e[r],r++;if(tu(n),r=Vt(e,r),!this.suppressValidationErr){if(e.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[r]==="%")throw new Error("Parameter entities are not supported")}let s="";if([r,s]=this.readIdentifierVal(e,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&s.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[n,s,r]}readNotationExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;!this.suppressValidationErr&&tu(n),r=Vt(e,r);let s=e.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);r+=s.length,r=Vt(e,r);let o=null,i=null;if(s==="PUBLIC")[r,o]=this.readIdentifierVal(e,r,"publicIdentifier"),r=Vt(e,r),(e[r]==='"'||e[r]==="'")&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"));else if(s==="SYSTEM"&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:o,systemIdentifier:i,index:--r}}readIdentifierVal(e,r,n){let s="",o=e[r];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(r++;r<e.length&&e[r]!==o;)s+=e[r],r++;if(e[r]!==o)throw new Error(`Unterminated ${n} value`);return r++,[r,s]}readElementExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;if(!this.suppressValidationErr&&!EN.isName(n))throw new Error(`Invalid element name: "${n}"`);r=Vt(e,r);let s="";if(e[r]==="E"&&To(e,"MPTY",r))r+=4;else if(e[r]==="A"&&To(e,"NY",r))r+=2;else if(e[r]==="("){for(r++;r<e.length&&e[r]!==")";)s+=e[r],r++;if(e[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[r]}"`);return{elementName:n,contentModel:s.trim(),index:r}}readAttlistExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;tu(n),r=Vt(e,r);let s="";for(;r<e.length&&!/\s/.test(e[r]);)s+=e[r],r++;if(!tu(s))throw new Error(`Invalid attribute name: "${s}"`);r=Vt(e,r);let o="";if(e.substring(r,r+8).toUpperCase()==="NOTATION"){if(o="NOTATION",r+=8,r=Vt(e,r),e[r]!=="(")throw new Error(`Expected '(', found "${e[r]}"`);r++;let a=[];for(;r<e.length&&e[r]!==")";){let c="";for(;r<e.length&&e[r]!=="|"&&e[r]!==")";)c+=e[r],r++;if(c=c.trim(),!tu(c))throw new Error(`Invalid notation name: "${c}"`);a.push(c),e[r]==="|"&&(r++,r=Vt(e,r))}if(e[r]!==")")throw new Error("Unterminated list of notations");r++,o+=" ("+a.join("|")+")"}else{for(;r<e.length&&!/\s/.test(e[r]);)o+=e[r],r++;let a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}r=Vt(e,r);let i="";return e.substring(r,r+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",r+=8):e.substring(r,r+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",r+=7):[r,i]=this.readIdentifierVal(e,r,"ATTLIST"),{elementName:n,attributeName:s,attributeType:o,defaultValue:i,index:r}}},Vt=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function To(t,e,r){for(let n=0;n<e.length;n++)if(e[n]!==t[r+n+1])return!1;return!0}function tu(t){if(EN.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}TN.exports=Nw});var PN=S((J_e,IN)=>{"use strict";f();var T7=/^[-+]?0x[a-fA-F0-9]+$/,$7=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,I7={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function P7(t,e={}){if(e=Object.assign({},I7,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(t==="0")return 0;if(e.hex&&T7.test(r))return C7(r,16);if(r.search(/[eE]/)!==-1){let n=r.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(n){if(e.leadingZeros)r=(n[1]||"")+n[3];else if(!(n[2]==="0"&&n[3][0]==="."))return t;return e.eNotation?Number(r):t}else return t}else{let n=$7.exec(r);if(n){let s=n[1],o=n[2],i=O7(n[3]);if(!e.leadingZeros&&o.length>0&&s&&r[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!s&&r[1]!==".")return t;if(e.leadingZeros&&o===t)return 0;{let a=Number(r),c=""+a;return c.search(/[eE]/)!==-1?e.eNotation?a:t:r.indexOf(".")!==-1?c==="0"&&i===""||c===i||s&&c==="-"+i?a:t:o?i===c||s+i===c?a:t:r===c||r===s+c?a:t}}else return t}}function O7(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}function C7(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}IN.exports=P7});var Rw=S((Y_e,ON)=>{"use strict";f();function A7(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let r of t)if(typeof r=="string"&&e===r||r instanceof RegExp&&r.test(e))return!0}:()=>!1}ON.exports=A7});var NN=S((Q_e,AN)=>{"use strict";f();var rp=Qc(),Hi=kN(),N7=$N(),R7=PN(),j7=Rw(),jw=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>CN(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>CN(n,16,"&#x")}},this.addExternalEntities=z7,this.parseXml=D7,this.parseTextData=M7,this.resolveNameSpace=L7,this.buildAttributesMap=Z7,this.isItStopNode=B7,this.replaceEntitiesValue=U7,this.readStopNodeData=K7,this.saveTextToParentTag=V7,this.addChild=F7,this.ignoreAttributesFn=j7(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let r=0;r<this.options.stopNodes.length;r++){let n=this.options.stopNodes[r];typeof n=="string"&&(n.startsWith("*.")?this.stopNodesWildcard.add(n.substring(2)):this.stopNodesExact.add(n))}}}};function z7(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r],s=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+s+";","g"),val:t[n]}}}function M7(t,e,r,n,s,o,i){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,r));let a=this.options.tagValueProcessor(e,t,r,s,o);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?Mw(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Mw(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function L7(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var q7=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Z7(t,e,r){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){let n=rp.getAllMatches(t,q7),s=n.length,o={};for(let i=0;i<s;i++){let a=this.resolveNameSpace(n[i][1]);if(this.ignoreAttributesFn(a,e))continue;let c=n[i][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u=G7(u,this.options),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,r,e);let l=this.options.attributeValueProcessor(a,c,e);l==null?o[u]=c:typeof l!=typeof c||l!==c?o[u]=l:o[u]=Mw(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){let i={};return i[this.options.attributesGroupName]=o,i}return o}}var D7=function(t){t=t.replace(/\r\n?/g,`
|
|
173
|
-
`);let e=new Hi("!xml"),r=e,n="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;let o=new
|
|
174
|
-
`),
|
|
170
|
+
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=ep(e),n=Bi(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=ep(e),n=Bi(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};tA.Parser=Ew});var iA=S(Yc=>{"use strict";f();var rA=fw(),KY=Fc(),Wc=Bc(),GY=lb(),JY=Ee(),WY=kw(),nA=Tw();function sA(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new WY.LineCounter||null,prettyErrors:e}}function YY(t,e={}){let{lineCounter:r,prettyErrors:n}=sA(e),s=new nA.Parser(r?.addNewLine),o=new rA.Composer(e),i=Array.from(o.compose(s.parse(t)));if(n&&r)for(let a of i)a.errors.forEach(Wc.prettifyError(t,r)),a.warnings.forEach(Wc.prettifyError(t,r));return i.length>0?i:Object.assign([],{empty:!0},o.streamInfo())}function oA(t,e={}){let{lineCounter:r,prettyErrors:n}=sA(e),s=new nA.Parser(r?.addNewLine),o=new rA.Composer(e),i=null;for(let a of o.compose(s.parse(t),!0,t.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new Wc.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(i.errors.forEach(Wc.prettifyError(t,r)),i.warnings.forEach(Wc.prettifyError(t,r))),i}function XY(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let s=oA(t,r);if(!s)return null;if(s.warnings.forEach(o=>GY.warn(s.options.logLevel,o)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:n},r))}function QY(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let s=Math.round(r);r=s<1?void 0:s>8?{indent:8}:{indent:s}}if(t===void 0){let{keepUndefined:s}=r??e??{};if(!s)return}return JY.isDocument(t)&&!n?t.toString(r):new KY.Document(t,n,r).toString(r)}Yc.parse=XY;Yc.parseAllDocuments=YY;Yc.parseDocument=oA;Yc.stringify=QY});var Xc=S(Ne=>{"use strict";f();var e7=fw(),t7=Fc(),r7=Hb(),$w=Bc(),n7=Ec(),as=Ee(),s7=rs(),o7=it(),i7=ss(),a7=os(),c7=Xf(),u7=xw(),l7=kw(),d7=Tw(),tp=iA(),aA=wc();Ne.Composer=e7.Composer;Ne.Document=t7.Document;Ne.Schema=r7.Schema;Ne.YAMLError=$w.YAMLError;Ne.YAMLParseError=$w.YAMLParseError;Ne.YAMLWarning=$w.YAMLWarning;Ne.Alias=n7.Alias;Ne.isAlias=as.isAlias;Ne.isCollection=as.isCollection;Ne.isDocument=as.isDocument;Ne.isMap=as.isMap;Ne.isNode=as.isNode;Ne.isPair=as.isPair;Ne.isScalar=as.isScalar;Ne.isSeq=as.isSeq;Ne.Pair=s7.Pair;Ne.Scalar=o7.Scalar;Ne.YAMLMap=i7.YAMLMap;Ne.YAMLSeq=a7.YAMLSeq;Ne.CST=c7;Ne.Lexer=u7.Lexer;Ne.LineCounter=l7.LineCounter;Ne.Parser=d7.Parser;Ne.parse=tp.parse;Ne.parseAllDocuments=tp.parseAllDocuments;Ne.parseDocument=tp.parseDocument;Ne.stringify=tp.stringify;Ne.visit=aA.visit;Ne.visitAsync=aA.visitAsync});var Qc=S(Ar=>{"use strict";f();var fA=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",p7=fA+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",pA="["+fA+"]["+p7+"]*",h7=new RegExp("^"+pA+"$"),m7=function(t,e){let r=[],n=e.exec(t);for(;n;){let s=[];s.startIndex=e.lastIndex-n[0].length;let o=n.length;for(let i=0;i<o;i++)s.push(n[i]);r.push(s),n=e.exec(t)}return r},g7=function(t){let e=h7.exec(t);return!(e===null||typeof e>"u")};Ar.isExist=function(t){return typeof t<"u"};Ar.isEmptyObject=function(t){return Object.keys(t).length===0};Ar.merge=function(t,e,r){if(e){let n=Object.keys(e),s=n.length;for(let o=0;o<s;o++)r==="strict"?t[n[o]]=[e[n[o]]]:t[n[o]]=e[n[o]]}};Ar.getValue=function(t){return Ar.isExist(t)?t:""};var y7=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],_7=["__proto__","constructor","prototype"];Ar.isName=g7;Ar.getAllMatches=m7;Ar.nameRegexp=pA;Ar.DANGEROUS_PROPERTY_NAMES=y7;Ar.criticalProperties=_7});var Pw=S(_A=>{"use strict";f();var Ow=Qc(),v7={allowBooleanAttributes:!1,unpairedTags:[]};_A.validate=function(t,e){e=Object.assign({},v7,e);let r=[],n=!1,s=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=mA(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=gA(t,o);continue}else{let a=!1;t[o]==="/"&&(a=!0,o++);let c="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
|
|
171
|
+
`&&t[o]!=="\r";o++)c+=t[o];if(c=c.trim(),c[c.length-1]==="/"&&(c=c.substring(0,c.length-1),o--),!$7(c)){let d;return c.trim().length===0?d="Invalid space after '<'.":d="Tag '"+c+"' is an invalid name.",ot("InvalidTag",d,Ot(t,o))}let u=x7(t,o);if(u===!1)return ot("InvalidAttr","Attributes for '"+c+"' have open quote.",Ot(t,o));let l=u.value;if(o=u.index,l[l.length-1]==="/"){let d=o-l.length;l=l.substring(0,l.length-1);let p=yA(l,e);if(p===!0)n=!0;else return ot(p.err.code,p.err.msg,Ot(t,d+p.err.line))}else if(a)if(u.tagClosed){if(l.trim().length>0)return ot("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",Ot(t,i));if(r.length===0)return ot("InvalidTag","Closing tag '"+c+"' has not been opened.",Ot(t,i));{let d=r.pop();if(c!==d.tagName){let p=Ot(t,d.tagStartPos);return ot("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+c+"'.",Ot(t,i))}r.length==0&&(s=!0)}}else return ot("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Ot(t,o));else{let d=yA(l,e);if(d!==!0)return ot(d.err.code,d.err.msg,Ot(t,o-l.length+d.err.line));if(s===!0)return ot("InvalidXml","Multiple possible root nodes found.",Ot(t,o));e.unpairedTags.indexOf(c)!==-1||r.push({tagName:c,tagStartPos:i}),n=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=gA(t,o);continue}else if(t[o+1]==="?"){if(o=mA(t,++o),o.err)return o}else break;else if(t[o]==="&"){let d=E7(t,o);if(d==-1)return ot("InvalidChar","char '&' is not expected.",Ot(t,o));o=d}else if(s===!0&&!hA(t[o]))return ot("InvalidXml","Extra text at the end",Ot(t,o));t[o]==="<"&&o--}}else{if(hA(t[o]))continue;return ot("InvalidChar","char '"+t[o]+"' is not expected.",Ot(t,o))}if(n){if(r.length==1)return ot("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Ot(t,r[0].tagStartPos));if(r.length>0)return ot("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ot("InvalidXml","Start tag expected.",1);return!0};function hA(t){return t===" "||t===" "||t===`
|
|
172
|
+
`||t==="\r"}function mA(t,e){let r=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){let n=t.substr(r,e-r);if(e>5&&n==="xml")return ot("InvalidXml","XML declaration allowed only at the start of the document.",Ot(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function gA(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e<t.length;e++)if(t[e]==="<")r++;else if(t[e]===">"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}var b7='"',w7="'";function x7(t,e){let r="",n="",s=!1;for(;e<t.length;e++){if(t[e]===b7||t[e]===w7)n===""?n=t[e]:n!==t[e]||(n="");else if(t[e]===">"&&n===""){s=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:s}}var S7=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function yA(t,e){let r=Ow.getAllMatches(t,S7),n={};for(let s=0;s<r.length;s++){if(r[s][1].length===0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' has no space in starting.",eu(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",eu(r[s]));if(r[s][3]===void 0&&!e.allowBooleanAttributes)return ot("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",eu(r[s]));let o=r[s][2];if(!T7(o))return ot("InvalidAttr","Attribute '"+o+"' is an invalid name.",eu(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return ot("InvalidAttr","Attribute '"+o+"' is repeated.",eu(r[s]))}return!0}function k7(t,e){let r=/\d/;for(t[e]==="x"&&(e++,r=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(r))break}return-1}function E7(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,k7(t,e);let r=0;for(;e<t.length;e++,r++)if(!(t[e].match(/\w/)&&r<20)){if(t[e]===";")break;return-1}return e}function ot(t,e,r){return{err:{code:t,msg:e,line:r.line||r,col:r.col}}}function T7(t){return Ow.isName(t)}function $7(t){return Ow.isName(t)}function Ot(t,e){let r=t.substring(0,e).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function eu(t){return t.startIndex+t[1].length}});var SA=S(Cw=>{"use strict";f();var{DANGEROUS_PROPERTY_NAMES:vA,criticalProperties:I7}=Qc(),bA=t=>vA.includes(t)?"__"+t:t,wA={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,onDangerousProperty:bA};function O7(t,e){if(typeof t!="string")return;let r=t.toLowerCase();if(vA.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(I7.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function xA(t){return typeof t=="boolean"?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof t=="object"&&t!==null?{enabled:t.enabled!==!1,maxEntitySize:Math.max(1,t.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,t.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,t.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,t.maxExpandedLength??1e5),maxEntityCount:Math.max(1,t.maxEntityCount??1e3),allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:xA(!0)}var P7=function(t){let e=Object.assign({},wA,t),r=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(let{value:n,name:s}of r)n&&O7(n,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=bA),e.processEntities=xA(e.processEntities),e};Cw.buildOptions=P7;Cw.defaultOptions=wA});var EA=S((Y_e,kA)=>{"use strict";f();var Nw=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};kA.exports=Nw});var IA=S((Q_e,$A)=>{"use strict";f();var TA=Qc(),Aw=class{constructor(e){this.suppressValidationErr=!e,this.options=e||{}}readDocType(e,r){let n=Object.create(null),s=0;if(e[r+3]==="O"&&e[r+4]==="C"&&e[r+5]==="T"&&e[r+6]==="Y"&&e[r+7]==="P"&&e[r+8]==="E"){r=r+9;let o=1,i=!1,a=!1,c="";for(;r<e.length;r++)if(e[r]==="<"&&!a){if(i&&To(e,"!ENTITY",r)){r+=7;let u,l;if([u,l,r]=this.readEntityExp(e,r+1,this.suppressValidationErr),l.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&s>=this.options.maxEntityCount)throw new Error(`Entity count (${s+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);let d=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");n[u]={regx:RegExp(`&${d};`,"g"),val:l},s++}}else if(i&&To(e,"!ELEMENT",r)){r+=8;let{index:u}=this.readElementExp(e,r+1);r=u}else if(i&&To(e,"!ATTLIST",r))r+=8;else if(i&&To(e,"!NOTATION",r)){r+=9;let{index:u}=this.readNotationExp(e,r+1,this.suppressValidationErr);r=u}else if(To(e,"!--",r))a=!0;else throw new Error("Invalid DOCTYPE");o++,c=""}else if(e[r]===">"){if(a?e[r-1]==="-"&&e[r-2]==="-"&&(a=!1,o--):o--,o===0)break}else e[r]==="["?i=!0:c+=e[r];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r])&&e[r]!=='"'&&e[r]!=="'";)n+=e[r],r++;if(tu(n),r=Vt(e,r),!this.suppressValidationErr){if(e.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(e[r]==="%")throw new Error("Parameter entities are not supported")}let s="";if([r,s]=this.readIdentifierVal(e,r,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&s.length>this.options.maxEntitySize)throw new Error(`Entity "${n}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return r--,[n,s,r]}readNotationExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;!this.suppressValidationErr&&tu(n),r=Vt(e,r);let s=e.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);r+=s.length,r=Vt(e,r);let o=null,i=null;if(s==="PUBLIC")[r,o]=this.readIdentifierVal(e,r,"publicIdentifier"),r=Vt(e,r),(e[r]==='"'||e[r]==="'")&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"));else if(s==="SYSTEM"&&([r,i]=this.readIdentifierVal(e,r,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:o,systemIdentifier:i,index:--r}}readIdentifierVal(e,r,n){let s="",o=e[r];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(r++;r<e.length&&e[r]!==o;)s+=e[r],r++;if(e[r]!==o)throw new Error(`Unterminated ${n} value`);return r++,[r,s]}readElementExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;if(!this.suppressValidationErr&&!TA.isName(n))throw new Error(`Invalid element name: "${n}"`);r=Vt(e,r);let s="";if(e[r]==="E"&&To(e,"MPTY",r))r+=4;else if(e[r]==="A"&&To(e,"NY",r))r+=2;else if(e[r]==="("){for(r++;r<e.length&&e[r]!==")";)s+=e[r],r++;if(e[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${e[r]}"`);return{elementName:n,contentModel:s.trim(),index:r}}readAttlistExp(e,r){r=Vt(e,r);let n="";for(;r<e.length&&!/\s/.test(e[r]);)n+=e[r],r++;tu(n),r=Vt(e,r);let s="";for(;r<e.length&&!/\s/.test(e[r]);)s+=e[r],r++;if(!tu(s))throw new Error(`Invalid attribute name: "${s}"`);r=Vt(e,r);let o="";if(e.substring(r,r+8).toUpperCase()==="NOTATION"){if(o="NOTATION",r+=8,r=Vt(e,r),e[r]!=="(")throw new Error(`Expected '(', found "${e[r]}"`);r++;let a=[];for(;r<e.length&&e[r]!==")";){let c="";for(;r<e.length&&e[r]!=="|"&&e[r]!==")";)c+=e[r],r++;if(c=c.trim(),!tu(c))throw new Error(`Invalid notation name: "${c}"`);a.push(c),e[r]==="|"&&(r++,r=Vt(e,r))}if(e[r]!==")")throw new Error("Unterminated list of notations");r++,o+=" ("+a.join("|")+")"}else{for(;r<e.length&&!/\s/.test(e[r]);)o+=e[r],r++;let a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}r=Vt(e,r);let i="";return e.substring(r,r+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",r+=8):e.substring(r,r+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",r+=7):[r,i]=this.readIdentifierVal(e,r,"ATTLIST"),{elementName:n,attributeName:s,attributeType:o,defaultValue:i,index:r}}},Vt=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function To(t,e,r){for(let n=0;n<e.length;n++)if(e[n]!==t[r+n+1])return!1;return!0}function tu(t){if(TA.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}$A.exports=Aw});var PA=S((tve,OA)=>{"use strict";f();var C7=/^[-+]?0x[a-fA-F0-9]+$/,N7=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,A7={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function R7(t,e={}){if(e=Object.assign({},A7,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(t==="0")return 0;if(e.hex&&C7.test(r))return z7(r,16);if(r.search(/[eE]/)!==-1){let n=r.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);if(n){if(e.leadingZeros)r=(n[1]||"")+n[3];else if(!(n[2]==="0"&&n[3][0]==="."))return t;return e.eNotation?Number(r):t}else return t}else{let n=N7.exec(r);if(n){let s=n[1],o=n[2],i=j7(n[3]);if(!e.leadingZeros&&o.length>0&&s&&r[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!s&&r[1]!==".")return t;if(e.leadingZeros&&o===t)return 0;{let a=Number(r),c=""+a;return c.search(/[eE]/)!==-1?e.eNotation?a:t:r.indexOf(".")!==-1?c==="0"&&i===""||c===i||s&&c==="-"+i?a:t:o?i===c||s+i===c?a:t:r===c||r===s+c?a:t}}else return t}}function j7(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}function z7(t,e){if(parseInt)return parseInt(t,e);if(Number.parseInt)return Number.parseInt(t,e);if(window&&window.parseInt)return window.parseInt(t,e);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}OA.exports=R7});var Rw=S((nve,CA)=>{"use strict";f();function M7(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(let r of t)if(typeof r=="string"&&e===r||r instanceof RegExp&&r.test(e))return!0}:()=>!1}CA.exports=M7});var RA=S((ove,AA)=>{"use strict";f();var rp=Qc(),Hi=EA(),L7=IA(),q7=PA(),Z7=Rw(),jw=class{constructor(e){if(this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>NA(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>NA(n,16,"&#x")}},this.addExternalEntities=D7,this.parseXml=H7,this.parseTextData=F7,this.resolveNameSpace=U7,this.buildAttributesMap=B7,this.isItStopNode=W7,this.replaceEntitiesValue=G7,this.readStopNodeData=X7,this.saveTextToParentTag=J7,this.addChild=K7,this.ignoreAttributesFn=Z7(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let r=0;r<this.options.stopNodes.length;r++){let n=this.options.stopNodes[r];typeof n=="string"&&(n.startsWith("*.")?this.stopNodesWildcard.add(n.substring(2)):this.stopNodesExact.add(n))}}}};function D7(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r],s=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+s+";","g"),val:t[n]}}}function F7(t,e,r,n,s,o,i){if(t!==void 0&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){i||(t=this.replaceEntitiesValue(t,e,r));let a=this.options.tagValueProcessor(e,t,r,s,o);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?Mw(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Mw(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function U7(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}var V7=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function B7(t,e,r){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){let n=rp.getAllMatches(t,V7),s=n.length,o={};for(let i=0;i<s;i++){let a=this.resolveNameSpace(n[i][1]);if(this.ignoreAttributesFn(a,e))continue;let c=n[i][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u=Q7(u,this.options),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,r,e);let l=this.options.attributeValueProcessor(a,c,e);l==null?o[u]=c:typeof l!=typeof c||l!==c?o[u]=l:o[u]=Mw(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){let i={};return i[this.options.attributesGroupName]=o,i}return o}}var H7=function(t){t=t.replace(/\r\n?/g,`
|
|
173
|
+
`);let e=new Hi("!xml"),r=e,n="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;let o=new L7(this.options.processEntities);for(let i=0;i<t.length;i++)if(t[i]==="<")if(t[i+1]==="/"){let c=$o(t,">",i,"Closing Tag is not closed."),u=t.substring(i+2,c).trim();if(this.options.removeNSPrefix){let p=u.indexOf(":");p!==-1&&(u=u.substr(p+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,s));let l=s.substring(s.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let d=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(d=s.lastIndexOf(".",s.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=s.lastIndexOf("."),s=s.substring(0,d),r=this.tagsNodeStack.pop(),n="",i=c}else if(t[i+1]==="?"){let c=zw(t,i,!1,"?>");if(!c)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,s),!(this.options.ignoreDeclaration&&c.tagName==="?xml"||this.options.ignorePiTags)){let u=new Hi(c.tagName);u.add(this.options.textNodeName,""),c.tagName!==c.tagExp&&c.attrExpPresent&&(u[":@"]=this.buildAttributesMap(c.tagExp,s,c.tagName)),this.addChild(r,u,s,i)}i=c.closeIndex+1}else if(t.substr(i+1,3)==="!--"){let c=$o(t,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(i+4,c-2);n=this.saveTextToParentTag(n,r,s),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=c}else if(t.substr(i+1,2)==="!D"){let c=o.readDocType(t,i);this.docTypeEntities=c.entities,i=c.i}else if(t.substr(i+1,2)==="!["){let c=$o(t,"]]>",i,"CDATA is not closed.")-2,u=t.substring(i+9,c);n=this.saveTextToParentTag(n,r,s);let l=this.parseTextData(u,r.tagname,s,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,l),i=c+2}else{let c=zw(t,i,this.options.removeNSPrefix),u=c.tagName,l=c.rawTagName,d=c.tagExp,p=c.attrExpPresent,g=c.closeIndex;if(this.options.transformTagName){let _=this.options.transformTagName(u);d===u&&(d=_),u=_}if(this.options.strictReservedNames&&(u===this.options.commentPropName||u===this.options.cdataPropName||u===this.options.textNodeName||u===this.options.attributesGroupName))throw new Error(`Invalid tag name: ${u}`);r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,s,!1));let h=r;h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(r=this.tagsNodeStack.pop(),s=s.substring(0,s.lastIndexOf("."))),u!==e.tagname&&(s+=s?"."+u:u);let m=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,s,u)){let _="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),s=s.substr(0,s.length-1),d=u):d=d.substr(0,d.length-1),i=c.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=c.closeIndex;else{let w=this.readStopNodeData(t,l,g+1);if(!w)throw new Error(`Unexpected end of ${l}`);i=w.i,_=w.tagContent}let b=new Hi(u);u!==d&&p&&(b[":@"]=this.buildAttributesMap(d,s,u)),_&&(_=this.parseTextData(_,u,s,!0,p,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),b.add(this.options.textNodeName,_),this.addChild(r,b,s,m)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){if(u[u.length-1]==="/"?(u=u.substr(0,u.length-1),s=s.substr(0,s.length-1),d=u):d=d.substr(0,d.length-1),this.options.transformTagName){let b=this.options.transformTagName(u);d===u&&(d=b),u=b}let _=new Hi(u);u!==d&&p&&(_[":@"]=this.buildAttributesMap(d,s,u)),this.addChild(r,_,s,m),s=s.substr(0,s.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(u)!==-1){let _=new Hi(u);u!==d&&p&&(_[":@"]=this.buildAttributesMap(d,s)),this.addChild(r,_,s,m),s=s.substr(0,s.lastIndexOf(".")),i=c.closeIndex;continue}else{let _=new Hi(u);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),u!==d&&p&&(_[":@"]=this.buildAttributesMap(d,s,u)),this.addChild(r,_,s),r=_}n="",i=g}}else n+=t[i];return e.child};function K7(t,e,r,n){this.options.captureMetaData||(n=void 0);let s=this.options.updateTag(e.tagname,r,e[":@"]);s===!1||(typeof s=="string"&&(e.tagname=s),t.addChild(e,n))}var G7=function(t,e,r){if(t.indexOf("&")===-1)return t;let n=this.options.processEntities;if(!n.enabled||n.allowedTags&&!n.allowedTags.includes(e)||n.tagFilter&&!n.tagFilter(e,r))return t;for(let s in this.docTypeEntities){let o=this.docTypeEntities[s],i=t.match(o.regx);if(i){if(this.entityExpansionCount+=i.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);let a=t.length;if(t=t.replace(o.regx,o.val),n.maxExpandedLength&&(this.currentExpandedLength+=t.length-a,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(t.indexOf("&")===-1)return t;for(let s of Object.keys(this.lastEntities)){let o=this.lastEntities[s],i=t.match(o.regex);if(i&&(this.entityExpansionCount+=i.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);t=t.replace(o.regex,o.val)}if(t.indexOf("&")===-1)return t;if(this.options.htmlEntities)for(let s of Object.keys(this.htmlEntities)){let o=this.htmlEntities[s],i=t.match(o.regex);if(i&&(this.entityExpansionCount+=i.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions))throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);t=t.replace(o.regex,o.val)}return t=t.replace(this.ampEntity.regex,this.ampEntity.val),t};function J7(t,e,r,n){return t&&(n===void 0&&(n=e.child.length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function W7(t,e,r,n){return!!(e&&e.has(n)||t&&t.has(r))}function Y7(t,e,r=">"){let n,s="";for(let o=e;o<t.length;o++){let i=t[o];if(n)i===n&&(n="");else if(i==='"'||i==="'")n=i;else if(i===r[0])if(r[1]){if(t[o+1]===r[1])return{data:s,index:o}}else return{data:s,index:o};else i===" "&&(i=" ");s+=i}}function $o(t,e,r,n){let s=t.indexOf(e,r);if(s===-1)throw new Error(n);return s+e.length-1}function zw(t,e,r,n=">"){let s=Y7(t,e+1,n);if(!s)return;let o=s.data,i=s.index,a=o.search(/\s/),c=o,u=!0;a!==-1&&(c=o.substring(0,a),o=o.substring(a+1).trimStart());let l=c;if(r){let d=c.indexOf(":");d!==-1&&(c=c.substr(d+1),u=c!==s.data.substr(d+1))}return{tagName:c,tagExp:o,closeIndex:i,attrExpPresent:u,rawTagName:l}}function X7(t,e,r){let n=r,s=1;for(;r<t.length;r++)if(t[r]==="<")if(t[r+1]==="/"){let o=$o(t,">",r,`${e} is not closed`);if(t.substring(r+2,o).trim()===e&&(s--,s===0))return{tagContent:t.substring(n,r),i:o};r=o}else if(t[r+1]==="?")r=$o(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=$o(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=$o(t,"]]>",r,"StopNode is not closed.")-2;else{let o=zw(t,r,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&s++,r=o.closeIndex)}}function Mw(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:q7(t,r)}else return rp.isExist(t)?t:""}function NA(t,e,r){let n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):r+t+";"}function Q7(t,e){if(rp.criticalProperties.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return rp.DANGEROUS_PROPERTY_NAMES.includes(t)?e.onDangerousProperty(t):t}AA.exports=jw});var MA=S(zA=>{"use strict";f();function eX(t,e){return jA(t,e)}function jA(t,e,r){let n,s={};for(let o=0;o<t.length;o++){let i=t[o],a=tX(i),c="";if(r===void 0?c=a:c=r+"."+a,a===e.textNodeName)n===void 0?n=i[a]:n+=""+i[a];else{if(a===void 0)continue;if(i[a]){let u=jA(i[a],e,c),l=nX(u,e);i[":@"]?rX(u,i[":@"],c,e):Object.keys(u).length===1&&u[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?u=u[e.textNodeName]:Object.keys(u).length===0&&(e.alwaysCreateTextNode?u[e.textNodeName]="":u=""),s[a]!==void 0&&s.hasOwnProperty(a)?(Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(u)):e.isArray(a,c,l)?s[a]=[u]:s[a]=u}}}return typeof n=="string"?n.length>0&&(s[e.textNodeName]=n):n!==void 0&&(s[e.textNodeName]=n),s}function tX(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function rX(t,e,r,n){if(e){let s=Object.keys(e),o=s.length;for(let i=0;i<o;i++){let a=s[i];n.isArray(a,r+"."+a,!0,!0)?t[a]=[e[a]]:t[a]=e[a]}}}function nX(t,e){let{textNodeName:r}=e,n=Object.keys(t).length;return!!(n===0||n===1&&(t[r]||typeof t[r]=="boolean"||t[r]===0))}zA.prettify=eX});var qA=S((uve,LA)=>{"use strict";f();var{buildOptions:sX}=SA(),oX=RA(),{prettify:iX}=MA(),aX=Pw(),Lw=class{constructor(e){this.externalEntities={},this.options=sX(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let o=aX.validate(e,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let n=new oX(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(e);return this.options.preserveOrder||s===void 0?s:iX(s,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};LA.exports=Lw});var UA=S((dve,FA)=>{"use strict";f();function cX(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=`
|
|
174
|
+
`),DA(t,e,"",r)}function DA(t,e,r,n){let s="",o=!1;if(!Array.isArray(t)){if(t!=null){let i=t.toString();return i=qw(i,e),i}return""}for(let i=0;i<t.length;i++){let a=t[i],c=uX(a);if(c===void 0)continue;let u="";if(r.length===0?u=c:u=`${r}.${c}`,c===e.textNodeName){let h=a[c];lX(u,e)||(h=e.tagValueProcessor(c,h),h=qw(h,e)),o&&(s+=n),s+=h,o=!1;continue}else if(c===e.cdataPropName){o&&(s+=n),s+=`<![CDATA[${a[c][0][e.textNodeName]}]]>`,o=!1;continue}else if(c===e.commentPropName){s+=n+`<!--${a[c][0][e.textNodeName]}-->`,o=!0;continue}else if(c[0]==="?"){let h=ZA(a[":@"],e),m=c==="?xml"?"":n,_=a[c][0][e.textNodeName];_=_.length!==0?" "+_:"",s+=m+`<${c}${_}${h}?>`,o=!0;continue}let l=n;l!==""&&(l+=e.indentBy);let d=ZA(a[":@"],e),p=n+`<${c}${d}`,g=DA(a[c],e,u,l);e.unpairedTags.indexOf(c)!==-1?e.suppressUnpairedNode?s+=p+">":s+=p+"/>":(!g||g.length===0)&&e.suppressEmptyNode?s+=p+"/>":g&&g.endsWith(">")?s+=p+`>${g}${n}</${c}>`:(s+=p+">",g&&n!==""&&(g.includes("/>")||g.includes("</"))?s+=n+e.indentBy+g+n:s+=g,s+=`</${c}>`),o=!0}return s}function uX(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(Object.prototype.hasOwnProperty.call(t,n)&&n!==":@")return n}}function ZA(t,e){let r="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e.attributeValueProcessor(n,t[n]);s=qw(s,e),s===!0&&e.suppressBooleanAttributes?r+=` ${n.substr(e.attributeNamePrefix.length)}`:r+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return r}function lX(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let r=t.substr(t.lastIndexOf(".")+1);for(let n in e.stopNodes)if(e.stopNodes[n]===t||e.stopNodes[n]==="*."+r)return!0;return!1}function qw(t,e){if(t&&t.length>0&&e.processEntities)for(let r=0;r<e.entities.length;r++){let n=e.entities[r];t=t.replace(n.regex,n.val)}return t}FA.exports=cX});var BA=S((pve,VA)=>{"use strict";f();var dX=UA(),fX=Rw(),pX={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function cs(t){this.options=Object.assign({},pX,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=fX(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=gX),this.processTextOrObjNode=hX,this.options.format?(this.indentate=mX,this.tagEndChar=`>
|
|
175
175
|
`,this.newLine=`
|
|
176
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}cs.prototype.build=function(t){return this.options.preserveOrder?iX(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};cs.prototype.j2x=function(t,e,r){let n="",s="",o=r.join(".");for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(typeof t[i]>"u")this.isAttribute(i)&&(s+="");else if(t[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?s+="":i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)s+=this.buildTextValNode(t[i],i,"",e);else if(typeof t[i]!="object"){let a=this.isAttribute(i);if(a&&!this.ignoreAttributesFn(a,o))n+=this.buildAttrPairStr(a,""+t[i]);else if(!a)if(i===this.options.textNodeName){let c=this.options.tagValueProcessor(i,""+t[i]);s+=this.replaceEntitiesValue(c)}else s+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){let a=t[i].length,c="",u="";for(let l=0;l<a;l++){let d=t[i][l];if(!(typeof d>"u"))if(d===null)i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(typeof d=="object")if(this.options.oneListGroup){let p=this.j2x(d,e+1,r.concat(i));c+=p.val,this.options.attributesGroupName&&d.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else c+=this.processTextOrObjNode(d,i,e,r);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(i,d);p=this.replaceEntitiesValue(p),c+=p}else c+=this.buildTextValNode(d,i,"",e)}this.options.oneListGroup&&(c=this.buildObjectNode(c,i,u,e)),s+=c}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){let a=Object.keys(t[i]),c=a.length;for(let u=0;u<c;u++)n+=this.buildAttrPairStr(a[u],""+t[i][a[u]])}else s+=this.processTextOrObjNode(t[i],i,e,r);return{attrStr:n,val:s}};cs.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function uX(t,e,r,n){let s=this.j2x(t,r+1,n.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,r):this.buildObjectNode(s.val,e,s.attrStr,r)}cs.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",s=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+o+">"+t+s:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+o+this.tagEndChar+t+this.indentate(n)+s}};cs.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};cs.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+s+"</"+e+this.tagEndChar}};cs.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function lX(t){return this.options.indentBy.repeat(t)}function dX(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}UN.exports=cs});var ru=S((uve,BN)=>{"use strict";f();var fX=Ow(),pX=LN(),hX=VN();BN.exports={XMLParser:pX,XMLValidator:fX,XMLBuilder:hX}});f();f();f();f();f();var R={};kp(R,{BRAND:()=>Az,DIRTY:()=>ls,EMPTY_PATH:()=>lz,INVALID:()=>re,NEVER:()=>mM,OK:()=>bt,ParseStatus:()=>ft,Schema:()=>he,ZodAny:()=>kn,ZodArray:()=>sn,ZodBigInt:()=>fs,ZodBoolean:()=>ps,ZodBranded:()=>ea,ZodCatch:()=>ks,ZodDate:()=>hs,ZodDefault:()=>Ss,ZodDiscriminatedUnion:()=>pu,ZodEffects:()=>Xt,ZodEnum:()=>ws,ZodError:()=>Ot,ZodFirstPartyTypeKind:()=>M,ZodFunction:()=>mu,ZodIntersection:()=>_s,ZodIssueCode:()=>j,ZodLazy:()=>vs,ZodLiteral:()=>bs,ZodMap:()=>zo,ZodNaN:()=>Lo,ZodNativeEnum:()=>xs,ZodNever:()=>yr,ZodNull:()=>gs,ZodNullable:()=>zr,ZodNumber:()=>ds,ZodObject:()=>At,ZodOptional:()=>Ct,ZodParsedType:()=>H,ZodPipeline:()=>ta,ZodPromise:()=>En,ZodReadonly:()=>Es,ZodRecord:()=>hu,ZodSchema:()=>he,ZodSet:()=>Mo,ZodString:()=>Sn,ZodSymbol:()=>Ro,ZodTransformer:()=>Xt,ZodTuple:()=>jr,ZodType:()=>he,ZodUndefined:()=>ms,ZodUnion:()=>ys,ZodUnknown:()=>nn,ZodVoid:()=>jo,addIssueToContext:()=>B,any:()=>Dz,array:()=>Bz,bigint:()=>zz,boolean:()=>A0,coerce:()=>hM,custom:()=>P0,date:()=>Mz,datetimeRegex:()=>$0,defaultErrorMap:()=>tn,discriminatedUnion:()=>Gz,effect:()=>iM,enum:()=>nM,function:()=>eM,getErrorMap:()=>Co,getParsedType:()=>Rr,instanceof:()=>Rz,intersection:()=>Jz,isAborted:()=>du,isAsync:()=>Ao,isDirty:()=>fu,isValid:()=>xn,late:()=>Nz,lazy:()=>tM,literal:()=>rM,makeIssue:()=>Qi,map:()=>Xz,nan:()=>jz,nativeEnum:()=>sM,never:()=>Uz,null:()=>Zz,nullable:()=>cM,number:()=>C0,object:()=>Ip,objectUtil:()=>Ep,oboolean:()=>pM,onumber:()=>fM,optional:()=>aM,ostring:()=>dM,pipeline:()=>lM,preprocess:()=>uM,promise:()=>oM,quotelessJson:()=>az,record:()=>Yz,set:()=>Qz,setErrorMap:()=>uz,strictObject:()=>Hz,string:()=>O0,symbol:()=>Lz,transformer:()=>iM,tuple:()=>Wz,undefined:()=>qz,union:()=>Kz,unknown:()=>Fz,util:()=>_e,void:()=>Vz});f();f();f();f();f();var _e;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let o={};for(let i of s)o[i]=i;return o},t.getValidEnumValues=s=>{let o=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(let a of o)i[a]=s[a];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(let i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(_e||(_e={}));var Ep;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ep||(Ep={}));var H=_e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rr=t=>{switch(typeof t){case"undefined":return H.undefined;case"string":return H.string;case"number":return Number.isNaN(t)?H.nan:H.number;case"boolean":return H.boolean;case"function":return H.function;case"bigint":return H.bigint;case"symbol":return H.symbol;case"object":return Array.isArray(t)?H.array:t===null?H.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?H.promise:typeof Map<"u"&&t instanceof Map?H.map:typeof Set<"u"&&t instanceof Set?H.set:typeof Date<"u"&&t instanceof Date?H.date:H.object;default:return H.unknown}};var j=_e.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"]),az=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Ot=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let o=s.path[0];r[o]=r[o]||[],r[o].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ot.create=t=>new Ot(t);var cz=(t,e)=>{let r;switch(t.code){case j.invalid_type:t.received===H.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case j.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,_e.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:r=`Unrecognized key(s) in object: ${_e.joinValues(t.keys,", ")}`;break;case j.invalid_union:r="Invalid input";break;case j.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${_e.joinValues(t.options)}`;break;case j.invalid_enum_value:r=`Invalid enum value. Expected ${_e.joinValues(t.options)}, received '${t.received}'`;break;case j.invalid_arguments:r="Invalid function arguments";break;case j.invalid_return_type:r="Invalid function return type";break;case j.invalid_date:r="Invalid date";break;case j.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:_e.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case j.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case j.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case j.custom:r="Invalid input";break;case j.invalid_intersection_types:r="Intersection results could not be merged";break;case j.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case j.not_finite:r="Number must be finite";break;default:r=e.defaultError,_e.assertNever(t)}return{message:r}},tn=cz;var x0=tn;function uz(t){x0=t}function Co(){return x0}f();var Qi=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...s,path:o,message:a}},lz=[];function B(t,e){let r=Co(),n=Qi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===tn?void 0:tn].filter(s=>!!s)});t.common.issues.push(n)}var ft=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return re;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let o=await s.key,i=await s.value;n.push({key:o,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return re;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:e.value,value:n}}},re=Object.freeze({status:"aborted"}),ls=t=>({status:"dirty",value:t}),bt=t=>({status:"valid",value:t}),du=t=>t.status==="aborted",fu=t=>t.status==="dirty",xn=t=>t.status==="valid",Ao=t=>typeof Promise<"u"&&t instanceof Promise;f();f();var G;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(G||(G={}));var Yt=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},S0=(t,e)=>{if(xn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ot(t.common.issues);return this._error=r,this._error}}};function ce(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}var he=class{get description(){return this._def.description}_getType(e){return Rr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Rr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ft,ctx:{common:e.parent.common,data:e.data,parsedType:Rr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Ao(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rr(e)},s=this._parseSync({data:e,path:n.path,parent:n});return S0(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return xn(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>xn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rr(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(Ao(s)?s:Promise.resolve(s));return S0(n,o)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{let i=e(s),a=()=>o.addIssue({code:j.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Xt({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ct.create(this,this._def)}nullable(){return zr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return En.create(this,this._def)}or(e){return ys.create([this,e],this._def)}and(e){return _s.create(this,e,this._def)}transform(e){return new Xt({...ce(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ss({...ce(this._def),innerType:this,defaultValue:r,typeName:M.ZodDefault})}brand(){return new ea({typeName:M.ZodBranded,type:this,...ce(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ks({...ce(this._def),innerType:this,catchValue:r,typeName:M.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ta.create(this,e)}readonly(){return Es.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},dz=/^c[^\s-]{8,}$/i,fz=/^[0-9a-z]+$/,pz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hz=/^[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,mz=/^[a-z0-9_-]{21}$/i,gz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yz=/^[-+]?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)?)??$/,_z=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,vz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tp,bz=/^(?:(?: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])$/,wz=/^(?:(?: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])$/,xz=/^(([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]))$/,Sz=/^(([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])$/,kz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ez=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,E0="((\\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])))",Tz=new RegExp(`^${E0}$`);function T0(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function $z(t){return new RegExp(`^${T0(t)}$`)}function $0(t){let e=`${E0}T${T0(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Iz(t,e){return!!((e==="v4"||!e)&&bz.test(t)||(e==="v6"||!e)&&xz.test(t))}function Pz(t,e){if(!gz.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Oz(t,e){return!!((e==="v4"||!e)&&wz.test(t)||(e==="v6"||!e)&&Sz.test(t))}var Sn=class t extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==H.string){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_type,expected:H.string,received:o.parsedType}),re}let n=new ft,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?B(s,{code:j.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&B(s,{code:j.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")_z.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"email",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Tp||(Tp=new RegExp(vz,"u")),Tp.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"emoji",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")hz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"uuid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")mz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"nanoid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")dz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")fz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid2",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")pz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ulid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),B(s,{validation:"url",code:j.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"regex",code:j.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?$0(o).test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Tz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?$z(o).test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?yz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"duration",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Iz(e.data,o.version)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ip",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Pz(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"jwt",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Oz(e.data,o.version)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cidr",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?kz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"base64",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Ez.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"base64url",code:j.invalid_string,message:o.message}),n.dirty()):_e.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:j.invalid_string,...G.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...G.errToObj(e)})}url(e){return this._addCheck({kind:"url",...G.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...G.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...G.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...G.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...G.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...G.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...G.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...G.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...G.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...G.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...G.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...G.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...G.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...G.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...G.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...G.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...G.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...G.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...G.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...G.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...G.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...G.errToObj(r)})}nonempty(e){return this.min(1,G.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Sn.create=t=>new Sn({checks:[],typeName:M.ZodString,coerce:t?.coerce??!1,...ce(t)});function Cz(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}var ds=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==H.number){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_type,expected:H.number,received:o.parsedType}),re}let n,s=new ft;for(let o of this._def.checks)o.kind==="int"?_e.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:j.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?Cz(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:j.not_finite,message:o.message}),s.dirty()):_e.assertNever(o);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:G.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:G.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_e.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};ds.create=t=>new ds({checks:[],typeName:M.ZodNumber,coerce:t?.coerce||!1,...ce(t)});var fs=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==H.bigint)return this._getInvalidInput(e);let n,s=new ft;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):_e.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:j.invalid_type,expected:H.bigint,received:r.parsedType}),re}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};fs.create=t=>new fs({checks:[],typeName:M.ZodBigInt,coerce:t?.coerce??!1,...ce(t)});var ps=class extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==H.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.boolean,received:n.parsedType}),re}return bt(e.data)}};ps.create=t=>new ps({typeName:M.ZodBoolean,coerce:t?.coerce||!1,...ce(t)});var hs=class t extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==H.date){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_type,expected:H.date,received:o.parsedType}),re}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_date}),re}let n=new ft,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):_e.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:G.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:G.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};hs.create=t=>new hs({checks:[],coerce:t?.coerce||!1,typeName:M.ZodDate,...ce(t)});var Ro=class extends he{_parse(e){if(this._getType(e)!==H.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.symbol,received:n.parsedType}),re}return bt(e.data)}};Ro.create=t=>new Ro({typeName:M.ZodSymbol,...ce(t)});var ms=class extends he{_parse(e){if(this._getType(e)!==H.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.undefined,received:n.parsedType}),re}return bt(e.data)}};ms.create=t=>new ms({typeName:M.ZodUndefined,...ce(t)});var gs=class extends he{_parse(e){if(this._getType(e)!==H.null){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.null,received:n.parsedType}),re}return bt(e.data)}};gs.create=t=>new gs({typeName:M.ZodNull,...ce(t)});var kn=class extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return bt(e.data)}};kn.create=t=>new kn({typeName:M.ZodAny,...ce(t)});var nn=class extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return bt(e.data)}};nn.create=t=>new nn({typeName:M.ZodUnknown,...ce(t)});var yr=class extends he{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:j.invalid_type,expected:H.never,received:r.parsedType}),re}};yr.create=t=>new yr({typeName:M.ZodNever,...ce(t)});var jo=class extends he{_parse(e){if(this._getType(e)!==H.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.void,received:n.parsedType}),re}return bt(e.data)}};jo.create=t=>new jo({typeName:M.ZodVoid,...ce(t)});var sn=class t extends he{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==H.array)return B(r,{code:j.invalid_type,expected:H.array,received:r.parsedType}),re;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(B(r,{code:i?j.too_big:j.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(B(r,{code:j.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(B(r,{code:j.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yt(r,i,r.path,a)))).then(i=>ft.mergeArray(n,i));let o=[...r.data].map((i,a)=>s.type._parseSync(new Yt(r,i,r.path,a)));return ft.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:G.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:G.toString(r)}})}nonempty(e){return this.min(1,e)}};sn.create=(t,e)=>new sn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...ce(e)});function No(t){if(t instanceof At){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ct.create(No(n))}return new At({...t._def,shape:()=>e})}else return t instanceof sn?new sn({...t._def,type:No(t.element)}):t instanceof Ct?Ct.create(No(t.unwrap())):t instanceof zr?zr.create(No(t.unwrap())):t instanceof jr?jr.create(t.items.map(e=>No(e))):t}var At=class t extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=_e.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==H.object){let u=this._getOrReturnCtx(e);return B(u,{code:j.invalid_type,expected:H.object,received:u.parsedType}),re}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof yr&&this._def.unknownKeys==="strip"))for(let u in s.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=o[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Yt(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof yr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&(B(s,{code:j.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=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Yt(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>ft.mergeObjectSync(n,u)):ft.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return G.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:G.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:M.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of _e.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of _e.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return No(this)}partial(e){let r={};for(let n of _e.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of _e.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Ct;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return I0(_e.objectKeys(this.shape))}};At.create=(t,e)=>new At({shape:()=>t,unknownKeys:"strip",catchall:yr.create(),typeName:M.ZodObject,...ce(e)});At.strictCreate=(t,e)=>new At({shape:()=>t,unknownKeys:"strict",catchall:yr.create(),typeName:M.ZodObject,...ce(e)});At.lazycreate=(t,e)=>new At({shape:t,unknownKeys:"strip",catchall:yr.create(),typeName:M.ZodObject,...ce(e)});var ys=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(a=>new Ot(a.ctx.common.issues));return B(r,{code:j.invalid_union,unionErrors:i}),re}if(r.common.async)return Promise.all(n.map(async o=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(c=>new Ot(c));return B(r,{code:j.invalid_union,unionErrors:a}),re}}get options(){return this._def.options}};ys.create=(t,e)=>new ys({options:t,typeName:M.ZodUnion,...ce(e)});var rn=t=>t instanceof vs?rn(t.schema):t instanceof Xt?rn(t.innerType()):t instanceof bs?[t.value]:t instanceof ws?t.options:t instanceof xs?_e.objectValues(t.enum):t instanceof Ss?rn(t._def.innerType):t instanceof ms?[void 0]:t instanceof gs?[null]:t instanceof Ct?[void 0,...rn(t.unwrap())]:t instanceof zr?[null,...rn(t.unwrap())]:t instanceof ea||t instanceof Es?rn(t.unwrap()):t instanceof ks?rn(t._def.innerType):[],pu=class t extends he{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==H.object)return B(r,{code:j.invalid_type,expected:H.object,received:r.parsedType}),re;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let o of r){let i=rn(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,o)}}return new t({typeName:M.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...ce(n)})}};function $p(t,e){let r=Rr(t),n=Rr(e);if(t===e)return{valid:!0,data:t};if(r===H.object&&n===H.object){let s=_e.objectKeys(e),o=_e.objectKeys(t).filter(a=>s.indexOf(a)!==-1),i={...t,...e};for(let a of o){let c=$p(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===H.array&&n===H.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<t.length;o++){let i=t[o],a=e[o],c=$p(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===H.date&&n===H.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var _s=class extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(o,i)=>{if(du(o)||du(i))return re;let a=$p(o.value,i.value);return a.valid?((fu(o)||fu(i))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:j.invalid_intersection_types}),re)};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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};_s.create=(t,e,r)=>new _s({left:t,right:e,typeName:M.ZodIntersection,...ce(r)});var jr=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.array)return B(n,{code:j.invalid_type,expected:H.array,received:n.parsedType}),re;if(n.data.length<this._def.items.length)return B(n,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&n.data.length>this._def.items.length&&(B(n,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Yt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>ft.mergeArray(r,i)):ft.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};jr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jr({items:t,typeName:M.ZodTuple,rest:null,...ce(e)})};var hu=class t extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.object)return B(n,{code:j.invalid_type,expected:H.object,received:n.parsedType}),re;let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in n.data)s.push({key:o._parse(new Yt(n,a,n.path,a)),value:i._parse(new Yt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ft.mergeObjectAsync(r,s):ft.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof he?new t({keyType:e,valueType:r,typeName:M.ZodRecord,...ce(n)}):new t({keyType:Sn.create(),valueType:e,typeName:M.ZodRecord,...ce(r)})}},zo=class extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.map)return B(n,{code:j.invalid_type,expected:H.map,received:n.parsedType}),re;let s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yt(n,a,n.path,[u,"key"])),value:o._parse(new Yt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return re;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return re;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};zo.create=(t,e,r)=>new zo({valueType:e,keyType:t,typeName:M.ZodMap,...ce(r)});var Mo=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.set)return B(n,{code:j.invalid_type,expected:H.set,received:n.parsedType}),re;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(B(n,{code:j.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(B(n,{code:j.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return re;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new Yt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:G.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Mo.create=(t,e)=>new Mo({valueType:t,minSize:null,maxSize:null,typeName:M.ZodSet,...ce(e)});var mu=class t extends he{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==H.function)return B(r,{code:j.invalid_type,expected:H.function,received:r.parsedType}),re;function n(a,c){return Qi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Co(),tn].filter(u=>!!u),issueData:{code:j.invalid_arguments,argumentsError:c}})}function s(a,c){return Qi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Co(),tn].filter(u=>!!u),issueData:{code:j.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof En){let a=this;return bt(async function(...c){let u=new Ot([]),l=await a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(g=>{throw u.addIssue(s(d,g)),u})})}else{let a=this;return bt(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Ot([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new Ot([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:jr.create(e).rest(nn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||jr.create([]).rest(nn.create()),returns:r||nn.create(),typeName:M.ZodFunction,...ce(n)})}},vs=class extends he{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};vs.create=(t,e)=>new vs({getter:t,typeName:M.ZodLazy,...ce(e)});var bs=class extends he{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:j.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:e.data}}get value(){return this._def.value}};bs.create=(t,e)=>new bs({value:t,typeName:M.ZodLiteral,...ce(e)});function I0(t,e){return new ws({values:t,typeName:M.ZodEnum,...ce(e)})}var ws=class t extends he{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:_e.joinValues(n),received:r.parsedType,code:j.invalid_type}),re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:j.invalid_enum_value,options:n}),re}return bt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};ws.create=I0;var xs=class extends he{_parse(e){let r=_e.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==H.string&&n.parsedType!==H.number){let s=_e.objectValues(r);return B(n,{expected:_e.joinValues(s),received:n.parsedType,code:j.invalid_type}),re}if(this._cache||(this._cache=new Set(_e.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=_e.objectValues(r);return B(n,{received:n.data,code:j.invalid_enum_value,options:s}),re}return bt(e.data)}get enum(){return this._def.values}};xs.create=(t,e)=>new xs({values:t,typeName:M.ZodNativeEnum,...ce(e)});var En=class extends he{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==H.promise&&r.common.async===!1)return B(r,{code:j.invalid_type,expected:H.promise,received:r.parsedType}),re;let n=r.parsedType===H.promise?r.data:Promise.resolve(r.data);return bt(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};En.create=(t,e)=>new En({type:t,typeName:M.ZodPromise,...ce(e)});var Xt=class extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:i=>{B(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){let i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return re;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?re:c.status==="dirty"?ls(c.value):r.value==="dirty"?ls(c.value):c});{if(r.value==="aborted")return re;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?re:a.status==="dirty"?ls(a.value):r.value==="dirty"?ls(a.value):a}}if(s.type==="refinement"){let i=a=>{let c=s.refinement(a,o);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"?re:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?re:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xn(i))return re;let a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>xn(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):re);_e.assertNever(s)}};Xt.create=(t,e,r)=>new Xt({schema:t,typeName:M.ZodEffects,effect:e,...ce(r)});Xt.createWithPreprocess=(t,e,r)=>new Xt({schema:e,effect:{type:"preprocess",transform:t},typeName:M.ZodEffects,...ce(r)});var Ct=class extends he{_parse(e){return this._getType(e)===H.undefined?bt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(t,e)=>new Ct({innerType:t,typeName:M.ZodOptional,...ce(e)});var zr=class extends he{_parse(e){return this._getType(e)===H.null?bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};zr.create=(t,e)=>new zr({innerType:t,typeName:M.ZodNullable,...ce(e)});var Ss=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ss.create=(t,e)=>new Ss({innerType:t,typeName:M.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});var ks=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ao(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ot(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ot(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ks.create=(t,e)=>new ks({innerType:t,typeName:M.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});var Lo=class extends he{_parse(e){if(this._getType(e)!==H.nan){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.nan,received:n.parsedType}),re}return{status:"valid",value:e.data}}};Lo.create=t=>new Lo({typeName:M.ZodNaN,...ce(t)});var Az=Symbol("zod_brand"),ea=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ta=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?re:o.status==="dirty"?(r.dirty(),ls(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?re:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:M.ZodPipeline})}},Es=class extends he{_parse(e){let r=this._def.innerType._parse(e),n=s=>(xn(s)&&(s.value=Object.freeze(s.value)),s);return Ao(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};Es.create=(t,e)=>new Es({innerType:t,typeName:M.ZodReadonly,...ce(e)});function k0(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function P0(t,e={},r){return t?kn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=k0(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=k0(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):kn.create()}var Nz={object:At.lazycreate},M;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(M||(M={}));var Rz=(t,e={message:`Input not instance of ${t.name}`})=>P0(r=>r instanceof t,e),O0=Sn.create,C0=ds.create,jz=Lo.create,zz=fs.create,A0=ps.create,Mz=hs.create,Lz=Ro.create,qz=ms.create,Zz=gs.create,Dz=kn.create,Fz=nn.create,Uz=yr.create,Vz=jo.create,Bz=sn.create,Ip=At.create,Hz=At.strictCreate,Kz=ys.create,Gz=pu.create,Jz=_s.create,Wz=jr.create,Yz=hu.create,Xz=zo.create,Qz=Mo.create,eM=mu.create,tM=vs.create,rM=bs.create,nM=ws.create,sM=xs.create,oM=En.create,iM=Xt.create,aM=Ct.create,cM=zr.create,uM=Xt.createWithPreprocess,lM=ta.create,dM=()=>O0().optional(),fM=()=>C0().optional(),pM=()=>A0().optional(),hM={string:(t=>Sn.create({...t,coerce:!0})),number:(t=>ds.create({...t,coerce:!0})),boolean:(t=>ps.create({...t,coerce:!0})),bigint:(t=>fs.create({...t,coerce:!0})),date:(t=>hs.create({...t,coerce:!0}))};var mM=re;f();f();f();var gM=Object.freeze({status:"aborted"});function O(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:t});function i(a){var c;let u=r?.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var on=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},gu={};function Bt(t){return t&&Object.assign(gu,t),gu}f();f();var ve={};kp(ve,{BIGINT_FORMAT_RANGES:()=>R0,Class:()=>Op,NUMBER_FORMAT_RANGES:()=>Mp,aborted:()=>$s,allowsEval:()=>Rp,assert:()=>wM,assertEqual:()=>yM,assertIs:()=>vM,assertNever:()=>bM,assertNotEqual:()=>_M,assignProp:()=>Np,cached:()=>sa,captureStackTrace:()=>_u,cleanEnum:()=>RM,cleanRegex:()=>ia,clone:()=>Ht,createTransparentProxy:()=>$M,defineLazy:()=>Le,esc:()=>Ts,escapeRegex:()=>Tn,extend:()=>OM,finalizeIssue:()=>_r,floatSafeRemainder:()=>Ap,getElementAtPath:()=>xM,getEnumValues:()=>na,getLengthableOrigin:()=>aa,getParsedType:()=>TM,getSizableOrigin:()=>j0,isObject:()=>qo,isPlainObject:()=>Zo,issue:()=>Lp,joinValues:()=>yu,jsonStringifyReplacer:()=>Cp,merge:()=>CM,normalizeParams:()=>ne,nullish:()=>oa,numKeys:()=>EM,omit:()=>PM,optionalKeys:()=>zp,partial:()=>AM,pick:()=>IM,prefixIssues:()=>Mr,primitiveTypes:()=>N0,promiseAllObject:()=>SM,propertyKeyTypes:()=>jp,randomString:()=>kM,required:()=>NM,stringifyPrimitive:()=>vu,unwrapMessage:()=>ra});f();function yM(t){return t}function _M(t){return t}function vM(t){}function bM(t){throw new Error}function wM(t){}function na(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,s])=>e.indexOf(+n)===-1).map(([n,s])=>s)}function yu(t,e="|"){return t.map(r=>vu(r)).join(e)}function Cp(t,e){return typeof e=="bigint"?e.toString():e}function sa(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function oa(t){return t==null}function ia(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Ap(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}function Le(t,e,r){Object.defineProperty(t,e,{get(){{let s=r();return t[e]=s,s}throw new Error("cached value already set")},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function Np(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function xM(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function SM(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let s={};for(let o=0;o<e.length;o++)s[e[o]]=n[o];return s})}function kM(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Ts(t){return JSON.stringify(t)}var _u=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function qo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Rp=sa(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Zo(t){if(qo(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(qo(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function EM(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var TM=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},jp=new Set(["string","number","symbol"]),N0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Tn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ht(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ne(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function $M(t){let e;return new Proxy({},{get(r,n,s){return e??(e=t()),Reflect.get(e,n,s)},set(r,n,s,o){return e??(e=t()),Reflect.set(e,n,s,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,s){return e??(e=t()),Reflect.defineProperty(e,n,s)}})}function vu(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function zp(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Mp={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]},R0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function IM(t,e){let r={},n=t._zod.def;for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(r[s]=n.shape[s])}return Ht(t,{...t._zod.def,shape:r,checks:[]})}function PM(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete r[s]}return Ht(t,{...t._zod.def,shape:r,checks:[]})}function OM(t,e){if(!Zo(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Np(this,"shape",n),n},checks:[]};return Ht(t,r)}function CM(t,e){return Ht(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return Np(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function AM(t,e,r){let n=e._zod.def.shape,s={...n};if(r)for(let o in r){if(!(o in n))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=t?new t({type:"optional",innerType:n[o]}):n[o])}else for(let o in n)s[o]=t?new t({type:"optional",innerType:n[o]}):n[o];return Ht(e,{...e._zod.def,shape:s,checks:[]})}function NM(t,e,r){let n=e._zod.def.shape,s={...n};if(r)for(let o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=new t({type:"nonoptional",innerType:n[o]}))}else for(let o in n)s[o]=new t({type:"nonoptional",innerType:n[o]});return Ht(e,{...e._zod.def,shape:s,checks:[]})}function $s(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Mr(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function ra(t){return typeof t=="string"?t:t?.message}function _r(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let s=ra(t.inst?._zod.def?.error?.(t))??ra(e?.error?.(t))??ra(r.customError?.(t))??ra(r.localeError?.(t))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function j0(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function aa(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Lp(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function RM(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Op=class{constructor(...e){}};var z0=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Cp,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},bu=O("$ZodError",z0),ca=O("$ZodError",z0,{Parent:Error});function qp(t,e=r=>r.message){let r={},n=[];for(let s of t.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}function Zp(t,e){let r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>s({issues:a}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(t),n}var Dp=t=>(e,r,n,s)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new on;if(i.issues.length){let a=new(s?.Err??t)(i.issues.map(c=>_r(c,o,Bt())));throw _u(a,s?.callee),a}return i.value},Fp=Dp(ca),Up=t=>async(e,r,n,s)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(s?.Err??t)(i.issues.map(c=>_r(c,o,Bt())));throw _u(a,s?.callee),a}return i.value},Vp=Up(ca),Bp=t=>(e,r,n)=>{let s=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new on;return o.issues.length?{success:!1,error:new(t??bu)(o.issues.map(i=>_r(i,s,Bt())))}:{success:!0,data:o.value}},Is=Bp(ca),Hp=t=>async(e,r,n)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(i=>_r(i,s,Bt())))}:{success:!0,data:o.value}},Ps=Hp(ca);f();f();f();var M0=/^[cC][^\s-]{8,}$/,L0=/^[0-9a-z]+$/,q0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Z0=/^[0-9a-vA-V]{20}$/,D0=/^[A-Za-z0-9]{27}$/,F0=/^[a-zA-Z0-9_-]{21}$/,U0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var V0=/^([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})$/,Kp=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var B0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var zM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function H0(){return new RegExp(zM,"u")}var K0=/^(?:(?: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])$/,G0=/^(([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})$/,J0=/^((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])$/,W0=/^(([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])$/,Y0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gp=/^[A-Za-z0-9_-]*$/,X0=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Q0=/^\+(?:[0-9]){6,14}[0-9]$/,ex="(?:(?:\\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])))",tx=new RegExp(`^${ex}$`);function rx(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nx(t){return new RegExp(`^${rx(t)}$`)}function sx(t){let e=rx({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${ex}T(?:${n})$`)}var ox=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var ix=/^\d+$/,ax=/^-?\d+(?:\.\d+)?/i,cx=/true|false/i,ux=/null/i;var lx=/^[^A-Z]*$/,dx=/^[^a-z]*$/;var pt=O("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),fx={number:"number",bigint:"bigint",object:"date"},Jp=O("$ZodCheckLessThan",(t,e)=>{pt.init(t,e);let r=fx[typeof e.value];t._zod.onattach.push(n=>{let s=n._zod.bag,o=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Wp=O("$ZodCheckGreaterThan",(t,e)=>{pt.init(t,e);let r=fx[typeof e.value];t._zod.onattach.push(n=>{let s=n._zod.bag,o=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),px=O("$ZodCheckMultipleOf",(t,e)=>{pt.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Ap(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),hx=O("$ZodCheckNumberFormat",(t,e)=>{pt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[s,o]=Mp[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=s,a.maximum=o,r&&(a.pattern=ix)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<s&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),a>o&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:t})}});var mx=O("$ZodCheckMaxLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!oa(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{let s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let s=n.value;if(s.length<=e.maximum)return;let i=aa(s);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),gx=O("$ZodCheckMinLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!oa(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{let s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let s=n.value;if(s.length>=e.minimum)return;let i=aa(s);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),yx=O("$ZodCheckLengthEquals",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!oa(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{let s=n._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=n=>{let s=n.value,o=s.length;if(o===e.length)return;let i=aa(s),a=o>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ua=O("$ZodCheckStringFormat",(t,e)=>{var r,n;pt.init(t,e),t._zod.onattach.push(s=>{let o=s._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),_x=O("$ZodCheckRegex",(t,e)=>{ua.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),vx=O("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=lx),ua.init(t,e)}),bx=O("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=dx),ua.init(t,e)}),wx=O("$ZodCheckIncludes",(t,e)=>{pt.init(t,e);let r=Tn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{let o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),xx=O("$ZodCheckStartsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`^${Tn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Sx=O("$ZodCheckEndsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`.*${Tn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var kx=O("$ZodCheckOverwrite",(t,e)=>{pt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});f();var xu=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
176
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}cs.prototype.build=function(t){return this.options.preserveOrder?dX(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0,[]).val)};cs.prototype.j2x=function(t,e,r){let n="",s="",o=r.join(".");for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(typeof t[i]>"u")this.isAttribute(i)&&(s+="");else if(t[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?s+="":i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)s+=this.buildTextValNode(t[i],i,"",e);else if(typeof t[i]!="object"){let a=this.isAttribute(i);if(a&&!this.ignoreAttributesFn(a,o))n+=this.buildAttrPairStr(a,""+t[i]);else if(!a)if(i===this.options.textNodeName){let c=this.options.tagValueProcessor(i,""+t[i]);s+=this.replaceEntitiesValue(c)}else s+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){let a=t[i].length,c="",u="";for(let l=0;l<a;l++){let d=t[i][l];if(!(typeof d>"u"))if(d===null)i[0]==="?"?s+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(typeof d=="object")if(this.options.oneListGroup){let p=this.j2x(d,e+1,r.concat(i));c+=p.val,this.options.attributesGroupName&&d.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else c+=this.processTextOrObjNode(d,i,e,r);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(i,d);p=this.replaceEntitiesValue(p),c+=p}else c+=this.buildTextValNode(d,i,"",e)}this.options.oneListGroup&&(c=this.buildObjectNode(c,i,u,e)),s+=c}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){let a=Object.keys(t[i]),c=a.length;for(let u=0;u<c;u++)n+=this.buildAttrPairStr(a[u],""+t[i][a[u]])}else s+=this.processTextOrObjNode(t[i],i,e,r);return{attrStr:n,val:s}};cs.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&e==="true"?" "+t:" "+t+'="'+e+'"'};function hX(t,e,r,n){let s=this.j2x(t,r+1,n.concat(e));return t[this.options.textNodeName]!==void 0&&Object.keys(t).length===1?this.buildTextValNode(t[this.options.textNodeName],e,s.attrStr,r):this.buildObjectNode(s.val,e,s.attrStr,r)}cs.prototype.buildObjectNode=function(t,e,r,n){if(t==="")return e[0]==="?"?this.indentate(n)+"<"+e+r+"?"+this.tagEndChar:this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,o="";return e[0]==="?"&&(o="?",s=""),(r||r==="")&&t.indexOf("<")===-1?this.indentate(n)+"<"+e+r+o+">"+t+s:this.options.commentPropName!==!1&&e===this.options.commentPropName&&o.length===0?this.indentate(n)+`<!--${t}-->`+this.newLine:this.indentate(n)+"<"+e+r+o+this.tagEndChar+t+this.indentate(n)+s}};cs.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`></${t}`,e};cs.prototype.buildTextValNode=function(t,e,r,n){if(this.options.cdataPropName!==!1&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+`<!--${t}-->`+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),s===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+s+"</"+e+this.tagEndChar}};cs.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){let r=this.options.entities[e];t=t.replace(r.regex,r.val)}return t};function mX(t){return this.options.indentBy.repeat(t)}function gX(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}VA.exports=cs});var ru=S((mve,HA)=>{"use strict";f();var yX=Pw(),_X=qA(),vX=BA();HA.exports={XMLParser:_X,XMLValidator:yX,XMLBuilder:vX}});f();f();f();f();f();var R={};kp(R,{BRAND:()=>Mz,DIRTY:()=>ls,EMPTY_PATH:()=>mz,INVALID:()=>re,NEVER:()=>bM,OK:()=>bt,ParseStatus:()=>ft,Schema:()=>he,ZodAny:()=>kn,ZodArray:()=>sn,ZodBigInt:()=>fs,ZodBoolean:()=>ps,ZodBranded:()=>ea,ZodCatch:()=>ks,ZodDate:()=>hs,ZodDefault:()=>Ss,ZodDiscriminatedUnion:()=>pu,ZodEffects:()=>Xt,ZodEnum:()=>ws,ZodError:()=>Pt,ZodFirstPartyTypeKind:()=>M,ZodFunction:()=>mu,ZodIntersection:()=>_s,ZodIssueCode:()=>j,ZodLazy:()=>vs,ZodLiteral:()=>bs,ZodMap:()=>zo,ZodNaN:()=>Lo,ZodNativeEnum:()=>xs,ZodNever:()=>yr,ZodNull:()=>gs,ZodNullable:()=>zr,ZodNumber:()=>ds,ZodObject:()=>Nt,ZodOptional:()=>Ct,ZodParsedType:()=>H,ZodPipeline:()=>ta,ZodPromise:()=>En,ZodReadonly:()=>Es,ZodRecord:()=>hu,ZodSchema:()=>he,ZodSet:()=>Mo,ZodString:()=>Sn,ZodSymbol:()=>Ro,ZodTransformer:()=>Xt,ZodTuple:()=>jr,ZodType:()=>he,ZodUndefined:()=>ms,ZodUnion:()=>ys,ZodUnknown:()=>nn,ZodVoid:()=>jo,addIssueToContext:()=>B,any:()=>Hz,array:()=>Wz,bigint:()=>Dz,boolean:()=>A0,coerce:()=>vM,custom:()=>P0,date:()=>Fz,datetimeRegex:()=>I0,defaultErrorMap:()=>tn,discriminatedUnion:()=>Qz,effect:()=>dM,enum:()=>cM,function:()=>oM,getErrorMap:()=>Co,getParsedType:()=>Rr,instanceof:()=>qz,intersection:()=>eM,isAborted:()=>du,isAsync:()=>No,isDirty:()=>fu,isValid:()=>xn,late:()=>Lz,lazy:()=>iM,literal:()=>aM,makeIssue:()=>Qi,map:()=>nM,nan:()=>Zz,nativeEnum:()=>uM,never:()=>Gz,null:()=>Bz,nullable:()=>pM,number:()=>N0,object:()=>Ip,objectUtil:()=>Ep,oboolean:()=>_M,onumber:()=>yM,optional:()=>fM,ostring:()=>gM,pipeline:()=>mM,preprocess:()=>hM,promise:()=>lM,quotelessJson:()=>fz,record:()=>rM,set:()=>sM,setErrorMap:()=>hz,strictObject:()=>Yz,string:()=>C0,symbol:()=>Uz,transformer:()=>dM,tuple:()=>tM,undefined:()=>Vz,union:()=>Xz,unknown:()=>Kz,util:()=>_e,void:()=>Jz});f();f();f();f();f();var _e;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let o={};for(let i of s)o[i]=i;return o},t.getValidEnumValues=s=>{let o=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),i={};for(let a of o)i[a]=s[a];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(o){return s[o]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let i in s)Object.prototype.hasOwnProperty.call(s,i)&&o.push(i);return o},t.find=(s,o)=>{for(let i of s)if(o(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}t.joinValues=n,t.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(_e||(_e={}));var Ep;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ep||(Ep={}));var H=_e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rr=t=>{switch(typeof t){case"undefined":return H.undefined;case"string":return H.string;case"number":return Number.isNaN(t)?H.nan:H.number;case"boolean":return H.boolean;case"function":return H.function;case"bigint":return H.bigint;case"symbol":return H.symbol;case"object":return Array.isArray(t)?H.array:t===null?H.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?H.promise:typeof Map<"u"&&t instanceof Map?H.map:typeof Set<"u"&&t instanceof Set?H.set:typeof Date<"u"&&t instanceof Date?H.date:H.object;default:return H.unknown}};var j=_e.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"]),fz=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Pt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)if(s.path.length>0){let o=s.path[0];r[o]=r[o]||[],r[o].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Pt.create=t=>new Pt(t);var pz=(t,e)=>{let r;switch(t.code){case j.invalid_type:t.received===H.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case j.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,_e.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:r=`Unrecognized key(s) in object: ${_e.joinValues(t.keys,", ")}`;break;case j.invalid_union:r="Invalid input";break;case j.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${_e.joinValues(t.options)}`;break;case j.invalid_enum_value:r=`Invalid enum value. Expected ${_e.joinValues(t.options)}, received '${t.received}'`;break;case j.invalid_arguments:r="Invalid function arguments";break;case j.invalid_return_type:r="Invalid function return type";break;case j.invalid_date:r="Invalid date";break;case j.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:_e.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case j.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case j.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case j.custom:r="Invalid input";break;case j.invalid_intersection_types:r="Intersection results could not be merged";break;case j.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case j.not_finite:r="Number must be finite";break;default:r=e.defaultError,_e.assertNever(t)}return{message:r}},tn=pz;var S0=tn;function hz(t){S0=t}function Co(){return S0}f();var Qi=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...s,path:o,message:a}},mz=[];function B(t,e){let r=Co(),n=Qi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===tn?void 0:tn].filter(s=>!!s)});t.common.issues.push(n)}var ft=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return re;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r){let o=await s.key,i=await s.value;n.push({key:o,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:o,value:i}=s;if(o.status==="aborted"||i.status==="aborted")return re;o.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[o.value]=i.value)}return{status:e.value,value:n}}},re=Object.freeze({status:"aborted"}),ls=t=>({status:"dirty",value:t}),bt=t=>({status:"valid",value:t}),du=t=>t.status==="aborted",fu=t=>t.status==="dirty",xn=t=>t.status==="valid",No=t=>typeof Promise<"u"&&t instanceof Promise;f();f();var G;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(G||(G={}));var Yt=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},k0=(t,e)=>{if(xn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Pt(t.common.issues);return this._error=r,this._error}}};function ce(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:s}}var he=class{get description(){return this._def.description}_getType(e){return Rr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Rr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ft,ctx:{common:e.parent.common,data:e.data,parsedType:Rr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(No(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rr(e)},s=this._parseSync({data:e,path:n.path,parent:n});return k0(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return xn(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>xn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rr(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(No(s)?s:Promise.resolve(s));return k0(n,o)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{let i=e(s),a=()=>o.addIssue({code:j.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new Xt({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Ct.create(this,this._def)}nullable(){return zr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return En.create(this,this._def)}or(e){return ys.create([this,e],this._def)}and(e){return _s.create(this,e,this._def)}transform(e){return new Xt({...ce(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ss({...ce(this._def),innerType:this,defaultValue:r,typeName:M.ZodDefault})}brand(){return new ea({typeName:M.ZodBranded,type:this,...ce(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ks({...ce(this._def),innerType:this,catchValue:r,typeName:M.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ta.create(this,e)}readonly(){return Es.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},gz=/^c[^\s-]{8,}$/i,yz=/^[0-9a-z]+$/,_z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vz=/^[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,bz=/^[a-z0-9_-]{21}$/i,wz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,xz=/^[-+]?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)?)??$/,Sz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tp,Ez=/^(?:(?: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])$/,Tz=/^(?:(?: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])$/,$z=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Iz=/^(([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])$/,Oz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,T0="((\\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])))",Cz=new RegExp(`^${T0}$`);function $0(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Nz(t){return new RegExp(`^${$0(t)}$`)}function I0(t){let e=`${T0}T${$0(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Az(t,e){return!!((e==="v4"||!e)&&Ez.test(t)||(e==="v6"||!e)&&$z.test(t))}function Rz(t,e){if(!wz.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function jz(t,e){return!!((e==="v4"||!e)&&Tz.test(t)||(e==="v6"||!e)&&Iz.test(t))}var Sn=class t extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==H.string){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_type,expected:H.string,received:o.parsedType}),re}let n=new ft,s;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let i=e.data.length>o.value,a=e.data.length<o.value;(i||a)&&(s=this._getOrReturnCtx(e,s),i?B(s,{code:j.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&B(s,{code:j.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Sz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"email",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Tp||(Tp=new RegExp(kz,"u")),Tp.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"emoji",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")vz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"uuid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")bz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"nanoid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")gz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")yz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cuid2",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")_z.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ulid",code:j.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),B(s,{validation:"url",code:j.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"regex",code:j.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?I0(o).test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Cz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Nz(o).test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?xz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"duration",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?Az(e.data,o.version)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"ip",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?Rz(e.data,o.alg)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"jwt",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?jz(e.data,o.version)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"cidr",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Oz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"base64",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Pz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"base64url",code:j.invalid_string,message:o.message}),n.dirty()):_e.assertNever(o);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:j.invalid_string,...G.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...G.errToObj(e)})}url(e){return this._addCheck({kind:"url",...G.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...G.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...G.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...G.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...G.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...G.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...G.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...G.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...G.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...G.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...G.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...G.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...G.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...G.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...G.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...G.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...G.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...G.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...G.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...G.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...G.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...G.errToObj(r)})}nonempty(e){return this.min(1,G.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Sn.create=t=>new Sn({checks:[],typeName:M.ZodString,coerce:t?.coerce??!1,...ce(t)});function zz(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}var ds=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==H.number){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_type,expected:H.number,received:o.parsedType}),re}let n,s=new ft;for(let o of this._def.checks)o.kind==="int"?_e.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:j.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?zz(e.data,o.value)!==0&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),B(n,{code:j.not_finite,message:o.message}),s.dirty()):_e.assertNever(o);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:G.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:G.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_e.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};ds.create=t=>new ds({checks:[],typeName:M.ZodNumber,coerce:t?.coerce||!1,...ce(t)});var fs=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==H.bigint)return this._getInvalidInput(e);let n,s=new ft;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),B(n,{code:j.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):_e.assertNever(o);return{status:s.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return B(r,{code:j.invalid_type,expected:H.bigint,received:r.parsedType}),re}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};fs.create=t=>new fs({checks:[],typeName:M.ZodBigInt,coerce:t?.coerce??!1,...ce(t)});var ps=class extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==H.boolean){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.boolean,received:n.parsedType}),re}return bt(e.data)}};ps.create=t=>new ps({typeName:M.ZodBoolean,coerce:t?.coerce||!1,...ce(t)});var hs=class t extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==H.date){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_type,expected:H.date,received:o.parsedType}),re}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return B(o,{code:j.invalid_date}),re}let n=new ft,s;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(s=this._getOrReturnCtx(e,s),B(s,{code:j.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):_e.assertNever(o);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:G.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:G.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};hs.create=t=>new hs({checks:[],coerce:t?.coerce||!1,typeName:M.ZodDate,...ce(t)});var Ro=class extends he{_parse(e){if(this._getType(e)!==H.symbol){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.symbol,received:n.parsedType}),re}return bt(e.data)}};Ro.create=t=>new Ro({typeName:M.ZodSymbol,...ce(t)});var ms=class extends he{_parse(e){if(this._getType(e)!==H.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.undefined,received:n.parsedType}),re}return bt(e.data)}};ms.create=t=>new ms({typeName:M.ZodUndefined,...ce(t)});var gs=class extends he{_parse(e){if(this._getType(e)!==H.null){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.null,received:n.parsedType}),re}return bt(e.data)}};gs.create=t=>new gs({typeName:M.ZodNull,...ce(t)});var kn=class extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return bt(e.data)}};kn.create=t=>new kn({typeName:M.ZodAny,...ce(t)});var nn=class extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return bt(e.data)}};nn.create=t=>new nn({typeName:M.ZodUnknown,...ce(t)});var yr=class extends he{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:j.invalid_type,expected:H.never,received:r.parsedType}),re}};yr.create=t=>new yr({typeName:M.ZodNever,...ce(t)});var jo=class extends he{_parse(e){if(this._getType(e)!==H.undefined){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.void,received:n.parsedType}),re}return bt(e.data)}};jo.create=t=>new jo({typeName:M.ZodVoid,...ce(t)});var sn=class t extends he{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==H.array)return B(r,{code:j.invalid_type,expected:H.array,received:r.parsedType}),re;if(s.exactLength!==null){let i=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(i||a)&&(B(r,{code:i?j.too_big:j.too_small,minimum:a?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(B(r,{code:j.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(B(r,{code:j.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>s.type._parseAsync(new Yt(r,i,r.path,a)))).then(i=>ft.mergeArray(n,i));let o=[...r.data].map((i,a)=>s.type._parseSync(new Yt(r,i,r.path,a)));return ft.mergeArray(n,o)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:G.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:G.toString(r)}})}nonempty(e){return this.min(1,e)}};sn.create=(t,e)=>new sn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...ce(e)});function Ao(t){if(t instanceof Nt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Ct.create(Ao(n))}return new Nt({...t._def,shape:()=>e})}else return t instanceof sn?new sn({...t._def,type:Ao(t.element)}):t instanceof Ct?Ct.create(Ao(t.unwrap())):t instanceof zr?zr.create(Ao(t.unwrap())):t instanceof jr?jr.create(t.items.map(e=>Ao(e))):t}var Nt=class t extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=_e.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==H.object){let u=this._getOrReturnCtx(e);return B(u,{code:j.invalid_type,expected:H.object,received:u.parsedType}),re}let{status:n,ctx:s}=this._processInputParams(e),{shape:o,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof yr&&this._def.unknownKeys==="strip"))for(let u in s.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=o[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Yt(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof yr){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")a.length>0&&(B(s,{code:j.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=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Yt(s,d,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>ft.mergeObjectSync(n,u)):ft.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return G.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:G.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:M.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of _e.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of _e.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Ao(this)}partial(e){let r={};for(let n of _e.objectKeys(this.shape)){let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of _e.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Ct;)o=o._def.innerType;r[n]=o}return new t({...this._def,shape:()=>r})}keyof(){return O0(_e.objectKeys(this.shape))}};Nt.create=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strip",catchall:yr.create(),typeName:M.ZodObject,...ce(e)});Nt.strictCreate=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strict",catchall:yr.create(),typeName:M.ZodObject,...ce(e)});Nt.lazycreate=(t,e)=>new Nt({shape:t,unknownKeys:"strip",catchall:yr.create(),typeName:M.ZodObject,...ce(e)});var ys=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(o){for(let a of o)if(a.result.status==="valid")return a.result;for(let a of o)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(a=>new Pt(a.ctx.common.issues));return B(r,{code:j.invalid_union,unionErrors:i}),re}if(r.common.async)return Promise.all(n.map(async o=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let o,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let a=i.map(c=>new Pt(c));return B(r,{code:j.invalid_union,unionErrors:a}),re}}get options(){return this._def.options}};ys.create=(t,e)=>new ys({options:t,typeName:M.ZodUnion,...ce(e)});var rn=t=>t instanceof vs?rn(t.schema):t instanceof Xt?rn(t.innerType()):t instanceof bs?[t.value]:t instanceof ws?t.options:t instanceof xs?_e.objectValues(t.enum):t instanceof Ss?rn(t._def.innerType):t instanceof ms?[void 0]:t instanceof gs?[null]:t instanceof Ct?[void 0,...rn(t.unwrap())]:t instanceof zr?[null,...rn(t.unwrap())]:t instanceof ea||t instanceof Es?rn(t.unwrap()):t instanceof ks?rn(t._def.innerType):[],pu=class t extends he{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==H.object)return B(r,{code:j.invalid_type,expected:H.object,received:r.parsedType}),re;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(B(r,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let o of r){let i=rn(o.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,o)}}return new t({typeName:M.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...ce(n)})}};function $p(t,e){let r=Rr(t),n=Rr(e);if(t===e)return{valid:!0,data:t};if(r===H.object&&n===H.object){let s=_e.objectKeys(e),o=_e.objectKeys(t).filter(a=>s.indexOf(a)!==-1),i={...t,...e};for(let a of o){let c=$p(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===H.array&&n===H.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let o=0;o<t.length;o++){let i=t[o],a=e[o],c=$p(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===H.date&&n===H.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var _s=class extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(o,i)=>{if(du(o)||du(i))return re;let a=$p(o.value,i.value);return a.valid?((fu(o)||fu(i))&&r.dirty(),{status:r.value,value:a.data}):(B(n,{code:j.invalid_intersection_types}),re)};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(([o,i])=>s(o,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};_s.create=(t,e,r)=>new _s({left:t,right:e,typeName:M.ZodIntersection,...ce(r)});var jr=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.array)return B(n,{code:j.invalid_type,expected:H.array,received:n.parsedType}),re;if(n.data.length<this._def.items.length)return B(n,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&n.data.length>this._def.items.length&&(B(n,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Yt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(o).then(i=>ft.mergeArray(r,i)):ft.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};jr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jr({items:t,typeName:M.ZodTuple,rest:null,...ce(e)})};var hu=class t extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.object)return B(n,{code:j.invalid_type,expected:H.object,received:n.parsedType}),re;let s=[],o=this._def.keyType,i=this._def.valueType;for(let a in n.data)s.push({key:o._parse(new Yt(n,a,n.path,a)),value:i._parse(new Yt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ft.mergeObjectAsync(r,s):ft.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof he?new t({keyType:e,valueType:r,typeName:M.ZodRecord,...ce(n)}):new t({keyType:Sn.create(),valueType:e,typeName:M.ZodRecord,...ce(r)})}},zo=class extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.map)return B(n,{code:j.invalid_type,expected:H.map,received:n.parsedType}),re;let s=this._def.keyType,o=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:s._parse(new Yt(n,a,n.path,[u,"key"])),value:o._parse(new Yt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return re;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return re;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};zo.create=(t,e,r)=>new zo({valueType:e,keyType:t,typeName:M.ZodMap,...ce(r)});var Mo=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.set)return B(n,{code:j.invalid_type,expected:H.set,received:n.parsedType}),re;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(B(n,{code:j.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(B(n,{code:j.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return re;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>o._parse(new Yt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:G.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Mo.create=(t,e)=>new Mo({valueType:t,minSize:null,maxSize:null,typeName:M.ZodSet,...ce(e)});var mu=class t extends he{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==H.function)return B(r,{code:j.invalid_type,expected:H.function,received:r.parsedType}),re;function n(a,c){return Qi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Co(),tn].filter(u=>!!u),issueData:{code:j.invalid_arguments,argumentsError:c}})}function s(a,c){return Qi({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Co(),tn].filter(u=>!!u),issueData:{code:j.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof En){let a=this;return bt(async function(...c){let u=new Pt([]),l=await a._def.args.parseAsync(c,o).catch(g=>{throw u.addIssue(n(c,g)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,o).catch(g=>{throw u.addIssue(s(d,g)),u})})}else{let a=this;return bt(function(...c){let u=a._def.args.safeParse(c,o);if(!u.success)throw new Pt([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,o);if(!d.success)throw new Pt([s(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:jr.create(e).rest(nn.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||jr.create([]).rest(nn.create()),returns:r||nn.create(),typeName:M.ZodFunction,...ce(n)})}},vs=class extends he{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};vs.create=(t,e)=>new vs({getter:t,typeName:M.ZodLazy,...ce(e)});var bs=class extends he{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return B(r,{received:r.data,code:j.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:e.data}}get value(){return this._def.value}};bs.create=(t,e)=>new bs({value:t,typeName:M.ZodLiteral,...ce(e)});function O0(t,e){return new ws({values:t,typeName:M.ZodEnum,...ce(e)})}var ws=class t extends he{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{expected:_e.joinValues(n),received:r.parsedType,code:j.invalid_type}),re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return B(r,{received:r.data,code:j.invalid_enum_value,options:n}),re}return bt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};ws.create=O0;var xs=class extends he{_parse(e){let r=_e.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==H.string&&n.parsedType!==H.number){let s=_e.objectValues(r);return B(n,{expected:_e.joinValues(s),received:n.parsedType,code:j.invalid_type}),re}if(this._cache||(this._cache=new Set(_e.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=_e.objectValues(r);return B(n,{received:n.data,code:j.invalid_enum_value,options:s}),re}return bt(e.data)}get enum(){return this._def.values}};xs.create=(t,e)=>new xs({values:t,typeName:M.ZodNativeEnum,...ce(e)});var En=class extends he{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==H.promise&&r.common.async===!1)return B(r,{code:j.invalid_type,expected:H.promise,received:r.parsedType}),re;let n=r.parsedType===H.promise?r.data:Promise.resolve(r.data);return bt(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};En.create=(t,e)=>new En({type:t,typeName:M.ZodPromise,...ce(e)});var Xt=class extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,o={addIssue:i=>{B(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){let i=s.transform(n.data,o);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return re;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?re:c.status==="dirty"?ls(c.value):r.value==="dirty"?ls(c.value):c});{if(r.value==="aborted")return re;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?re:a.status==="dirty"?ls(a.value):r.value==="dirty"?ls(a.value):a}}if(s.type==="refinement"){let i=a=>{let c=s.refinement(a,o);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"?re:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?re:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xn(i))return re;let a=s.transform(i.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>xn(i)?Promise.resolve(s.transform(i.value,o)).then(a=>({status:r.value,value:a})):re);_e.assertNever(s)}};Xt.create=(t,e,r)=>new Xt({schema:t,typeName:M.ZodEffects,effect:e,...ce(r)});Xt.createWithPreprocess=(t,e,r)=>new Xt({schema:e,effect:{type:"preprocess",transform:t},typeName:M.ZodEffects,...ce(r)});var Ct=class extends he{_parse(e){return this._getType(e)===H.undefined?bt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(t,e)=>new Ct({innerType:t,typeName:M.ZodOptional,...ce(e)});var zr=class extends he{_parse(e){return this._getType(e)===H.null?bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};zr.create=(t,e)=>new zr({innerType:t,typeName:M.ZodNullable,...ce(e)});var Ss=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ss.create=(t,e)=>new Ss({innerType:t,typeName:M.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...ce(e)});var ks=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return No(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Pt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Pt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ks.create=(t,e)=>new ks({innerType:t,typeName:M.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...ce(e)});var Lo=class extends he{_parse(e){if(this._getType(e)!==H.nan){let n=this._getOrReturnCtx(e);return B(n,{code:j.invalid_type,expected:H.nan,received:n.parsedType}),re}return{status:"valid",value:e.data}}};Lo.create=t=>new Lo({typeName:M.ZodNaN,...ce(t)});var Mz=Symbol("zod_brand"),ea=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ta=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?re:o.status==="dirty"?(r.dirty(),ls(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?re:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:M.ZodPipeline})}},Es=class extends he{_parse(e){let r=this._def.innerType._parse(e),n=s=>(xn(s)&&(s.value=Object.freeze(s.value)),s);return No(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}};Es.create=(t,e)=>new Es({innerType:t,typeName:M.ZodReadonly,...ce(e)});function E0(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function P0(t,e={},r){return t?kn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=E0(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=E0(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):kn.create()}var Lz={object:Nt.lazycreate},M;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(M||(M={}));var qz=(t,e={message:`Input not instance of ${t.name}`})=>P0(r=>r instanceof t,e),C0=Sn.create,N0=ds.create,Zz=Lo.create,Dz=fs.create,A0=ps.create,Fz=hs.create,Uz=Ro.create,Vz=ms.create,Bz=gs.create,Hz=kn.create,Kz=nn.create,Gz=yr.create,Jz=jo.create,Wz=sn.create,Ip=Nt.create,Yz=Nt.strictCreate,Xz=ys.create,Qz=pu.create,eM=_s.create,tM=jr.create,rM=hu.create,nM=zo.create,sM=Mo.create,oM=mu.create,iM=vs.create,aM=bs.create,cM=ws.create,uM=xs.create,lM=En.create,dM=Xt.create,fM=Ct.create,pM=zr.create,hM=Xt.createWithPreprocess,mM=ta.create,gM=()=>C0().optional(),yM=()=>N0().optional(),_M=()=>A0().optional(),vM={string:(t=>Sn.create({...t,coerce:!0})),number:(t=>ds.create({...t,coerce:!0})),boolean:(t=>ps.create({...t,coerce:!0})),bigint:(t=>fs.create({...t,coerce:!0})),date:(t=>hs.create({...t,coerce:!0}))};var bM=re;f();f();f();var wM=Object.freeze({status:"aborted"});function P(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:t});function i(a){var c;let u=r?.Parent?new o:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var on=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},gu={};function Bt(t){return t&&Object.assign(gu,t),gu}f();f();var ve={};kp(ve,{BIGINT_FORMAT_RANGES:()=>j0,Class:()=>Pp,NUMBER_FORMAT_RANGES:()=>Mp,aborted:()=>$s,allowsEval:()=>Rp,assert:()=>TM,assertEqual:()=>xM,assertIs:()=>kM,assertNever:()=>EM,assertNotEqual:()=>SM,assignProp:()=>Ap,cached:()=>sa,captureStackTrace:()=>_u,cleanEnum:()=>qM,cleanRegex:()=>ia,clone:()=>Ht,createTransparentProxy:()=>NM,defineLazy:()=>Le,esc:()=>Ts,escapeRegex:()=>Tn,extend:()=>jM,finalizeIssue:()=>_r,floatSafeRemainder:()=>Np,getElementAtPath:()=>$M,getEnumValues:()=>na,getLengthableOrigin:()=>aa,getParsedType:()=>CM,getSizableOrigin:()=>z0,isObject:()=>qo,isPlainObject:()=>Zo,issue:()=>Lp,joinValues:()=>yu,jsonStringifyReplacer:()=>Cp,merge:()=>zM,normalizeParams:()=>ne,nullish:()=>oa,numKeys:()=>PM,omit:()=>RM,optionalKeys:()=>zp,partial:()=>MM,pick:()=>AM,prefixIssues:()=>Mr,primitiveTypes:()=>R0,promiseAllObject:()=>IM,propertyKeyTypes:()=>jp,randomString:()=>OM,required:()=>LM,stringifyPrimitive:()=>vu,unwrapMessage:()=>ra});f();function xM(t){return t}function SM(t){return t}function kM(t){}function EM(t){throw new Error}function TM(t){}function na(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,s])=>e.indexOf(+n)===-1).map(([n,s])=>s)}function yu(t,e="|"){return t.map(r=>vu(r)).join(e)}function Cp(t,e){return typeof e=="bigint"?e.toString():e}function sa(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function oa(t){return t==null}function ia(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Np(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return o%i/10**s}function Le(t,e,r){Object.defineProperty(t,e,{get(){{let s=r();return t[e]=s,s}throw new Error("cached value already set")},set(s){Object.defineProperty(t,e,{value:s})},configurable:!0})}function Ap(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function $M(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function IM(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let s={};for(let o=0;o<e.length;o++)s[e[o]]=n[o];return s})}function OM(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Ts(t){return JSON.stringify(t)}var _u=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function qo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Rp=sa(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Zo(t){if(qo(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(qo(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function PM(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var CM=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},jp=new Set(["string","number","symbol"]),R0=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Tn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ht(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function ne(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function NM(t){let e;return new Proxy({},{get(r,n,s){return e??(e=t()),Reflect.get(e,n,s)},set(r,n,s,o){return e??(e=t()),Reflect.set(e,n,s,o)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,s){return e??(e=t()),Reflect.defineProperty(e,n,s)}})}function vu(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function zp(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Mp={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]},j0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function AM(t,e){let r={},n=t._zod.def;for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(r[s]=n.shape[s])}return Ht(t,{...t._zod.def,shape:r,checks:[]})}function RM(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete r[s]}return Ht(t,{...t._zod.def,shape:r,checks:[]})}function jM(t,e){if(!Zo(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Ap(this,"shape",n),n},checks:[]};return Ht(t,r)}function zM(t,e){return Ht(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return Ap(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function MM(t,e,r){let n=e._zod.def.shape,s={...n};if(r)for(let o in r){if(!(o in n))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=t?new t({type:"optional",innerType:n[o]}):n[o])}else for(let o in n)s[o]=t?new t({type:"optional",innerType:n[o]}):n[o];return Ht(e,{...e._zod.def,shape:s,checks:[]})}function LM(t,e,r){let n=e._zod.def.shape,s={...n};if(r)for(let o in r){if(!(o in s))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=new t({type:"nonoptional",innerType:n[o]}))}else for(let o in n)s[o]=new t({type:"nonoptional",innerType:n[o]});return Ht(e,{...e._zod.def,shape:s,checks:[]})}function $s(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Mr(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function ra(t){return typeof t=="string"?t:t?.message}function _r(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let s=ra(t.inst?._zod.def?.error?.(t))??ra(e?.error?.(t))??ra(r.customError?.(t))??ra(r.localeError?.(t))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function z0(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function aa(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Lp(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function qM(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Pp=class{constructor(...e){}};var M0=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Cp,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},bu=P("$ZodError",M0),ca=P("$ZodError",M0,{Parent:Error});function qp(t,e=r=>r.message){let r={},n=[];for(let s of t.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}function Zp(t,e){let r=e||function(o){return o.message},n={_errors:[]},s=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>s({issues:a}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return s(t),n}var Dp=t=>(e,r,n,s)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new on;if(i.issues.length){let a=new(s?.Err??t)(i.issues.map(c=>_r(c,o,Bt())));throw _u(a,s?.callee),a}return i.value},Fp=Dp(ca),Up=t=>async(e,r,n,s)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(s?.Err??t)(i.issues.map(c=>_r(c,o,Bt())));throw _u(a,s?.callee),a}return i.value},Vp=Up(ca),Bp=t=>(e,r,n)=>{let s=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new on;return o.issues.length?{success:!1,error:new(t??bu)(o.issues.map(i=>_r(i,s,Bt())))}:{success:!0,data:o.value}},Is=Bp(ca),Hp=t=>async(e,r,n)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},o=e._zod.run({value:r,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(i=>_r(i,s,Bt())))}:{success:!0,data:o.value}},Os=Hp(ca);f();f();f();var L0=/^[cC][^\s-]{8,}$/,q0=/^[0-9a-z]+$/,Z0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,D0=/^[0-9a-vA-V]{20}$/,F0=/^[A-Za-z0-9]{27}$/,U0=/^[a-zA-Z0-9_-]{21}$/,V0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var B0=/^([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})$/,Kp=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var H0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var DM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function K0(){return new RegExp(DM,"u")}var G0=/^(?:(?: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])$/,J0=/^(([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})$/,W0=/^((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])$/,Y0=/^(([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])$/,X0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gp=/^[A-Za-z0-9_-]*$/,Q0=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var ex=/^\+(?:[0-9]){6,14}[0-9]$/,tx="(?:(?:\\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])))",rx=new RegExp(`^${tx}$`);function nx(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sx(t){return new RegExp(`^${nx(t)}$`)}function ox(t){let e=nx({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${tx}T(?:${n})$`)}var ix=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var ax=/^\d+$/,cx=/^-?\d+(?:\.\d+)?/i,ux=/true|false/i,lx=/null/i;var dx=/^[^A-Z]*$/,fx=/^[^a-z]*$/;var pt=P("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),px={number:"number",bigint:"bigint",object:"date"},Jp=P("$ZodCheckLessThan",(t,e)=>{pt.init(t,e);let r=px[typeof e.value];t._zod.onattach.push(n=>{let s=n._zod.bag,o=(e.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?s.maximum=e.value:s.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Wp=P("$ZodCheckGreaterThan",(t,e)=>{pt.init(t,e);let r=px[typeof e.value];t._zod.onattach.push(n=>{let s=n._zod.bag,o=(e.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?s.minimum=e.value:s.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),hx=P("$ZodCheckMultipleOf",(t,e)=>{pt.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Np(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),mx=P("$ZodCheckNumberFormat",(t,e)=>{pt.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[s,o]=Mp[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=s,a.maximum=o,r&&(a.pattern=ax)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<s&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:s,inclusive:!0,inst:t,continue:!e.abort}),a>o&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inst:t})}});var gx=P("$ZodCheckMaxLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!oa(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{let s=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<s&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let s=n.value;if(s.length<=e.maximum)return;let i=aa(s);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),yx=P("$ZodCheckMinLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!oa(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{let s=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>s&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let s=n.value;if(s.length>=e.minimum)return;let i=aa(s);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),_x=P("$ZodCheckLengthEquals",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!oa(s)&&s.length!==void 0}),t._zod.onattach.push(n=>{let s=n._zod.bag;s.minimum=e.length,s.maximum=e.length,s.length=e.length}),t._zod.check=n=>{let s=n.value,o=s.length;if(o===e.length)return;let i=aa(s),a=o>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ua=P("$ZodCheckStringFormat",(t,e)=>{var r,n;pt.init(t,e),t._zod.onattach.push(s=>{let o=s._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=s=>{e.pattern.lastIndex=0,!e.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:e.format,input:s.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),vx=P("$ZodCheckRegex",(t,e)=>{ua.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),bx=P("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=dx),ua.init(t,e)}),wx=P("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=fx),ua.init(t,e)}),xx=P("$ZodCheckIncludes",(t,e)=>{pt.init(t,e);let r=Tn(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(s=>{let o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=s=>{s.value.includes(e.includes,e.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:s.value,inst:t,continue:!e.abort})}}),Sx=P("$ZodCheckStartsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`^${Tn(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),kx=P("$ZodCheckEndsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`.*${Tn(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var Ex=P("$ZodCheckOverwrite",(t,e)=>{pt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});f();var xu=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
177
177
|
`).filter(i=>i),s=Math.min(...n.map(i=>i.length-i.trimStart().length)),o=n.map(i=>i.slice(s)).map(i=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,r=this?.args,s=[...(this?.content??[""]).map(o=>` ${o}`)];return new e(...r,s.join(`
|
|
178
|
-
`))}};f();var
|
|
178
|
+
`))}};f();var $x={major:4,minor:0,patch:0};var je=P("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=$x;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let s of n)for(let o of s._zod.onattach)o(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let s=(o,i,a)=>{let c=$s(o),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(o))continue}else if(c)continue;let d=o.issues.length,p=l._zod.check(o);if(p instanceof Promise&&a?.async===!1)throw new on;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,o.issues.length!==d&&(c||(c=$s(o,d)))});else{if(o.issues.length===d)continue;c||(c=$s(o,d))}}return u?u.then(()=>o):o};t._zod.run=(o,i)=>{let a=t._zod.parse(o,i);if(a instanceof Promise){if(i.async===!1)throw new on;return a.then(c=>s(c,n,i))}return s(a,n,i)}}t["~standard"]={validate:s=>{try{let o=Is(t,s);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Os(t,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),la=P("$ZodString",(t,e)=>{je.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??ix(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),qe=P("$ZodStringFormat",(t,e)=>{ua.init(t,e),la.init(t,e)}),Xp=P("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=B0),qe.init(t,e)}),Qp=P("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Kp(n))}else e.pattern??(e.pattern=Kp());qe.init(t,e)}),eh=P("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=H0),qe.init(t,e)}),th=P("$ZodURL",(t,e)=>{qe.init(t,e),t._zod.check=r=>{try{let n=r.value,s=new URL(n),o=s.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Q0.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&o.endsWith("/")?r.value=o.slice(0,-1):r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),rh=P("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=K0()),qe.init(t,e)}),nh=P("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=U0),qe.init(t,e)}),sh=P("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=L0),qe.init(t,e)}),oh=P("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=q0),qe.init(t,e)}),ih=P("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Z0),qe.init(t,e)}),ah=P("$ZodXID",(t,e)=>{e.pattern??(e.pattern=D0),qe.init(t,e)}),ch=P("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=F0),qe.init(t,e)}),Mx=P("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=ox(e)),qe.init(t,e)}),Lx=P("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=rx),qe.init(t,e)}),qx=P("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=sx(e)),qe.init(t,e)}),Zx=P("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=V0),qe.init(t,e)}),uh=P("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=G0),qe.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),lh=P("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=J0),qe.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),dh=P("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=W0),qe.init(t,e)}),fh=P("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Y0),qe.init(t,e),t._zod.check=r=>{let[n,s]=r.value.split("/");try{if(!s)throw new Error;let o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Dx(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var ph=P("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=X0),qe.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Dx(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function FM(t){if(!Gp.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Dx(r)}var hh=P("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Gp),qe.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{FM(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),mh=P("$ZodE164",(t,e)=>{e.pattern??(e.pattern=ex),qe.init(t,e)});function UM(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let s=JSON.parse(atob(n));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||e&&(!("alg"in s)||s.alg!==e))}catch{return!1}}var gh=P("$ZodJWT",(t,e)=>{qe.init(t,e),t._zod.check=r=>{UM(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var ku=P("$ZodNumber",(t,e)=>{je.init(t,e),t._zod.pattern=t._zod.bag.pattern??cx,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;let o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:t,...o?{received:o}:{}}),r}}),yh=P("$ZodNumber",(t,e)=>{mx.init(t,e),ku.init(t,e)}),_h=P("$ZodBoolean",(t,e)=>{je.init(t,e),t._zod.pattern=ux,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let s=r.value;return typeof s=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:t}),r}});var vh=P("$ZodNull",(t,e)=>{je.init(t,e),t._zod.pattern=lx,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let s=r.value;return s===null||r.issues.push({expected:"null",code:"invalid_type",input:s,inst:t}),r}});var bh=P("$ZodUnknown",(t,e)=>{je.init(t,e),t._zod.parse=r=>r}),wh=P("$ZodNever",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Ix(t,e,r){t.issues.length&&e.issues.push(...Mr(r,t.issues)),e.value[r]=t.value}var xh=P("$ZodArray",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:t}),r;r.value=Array(s.length);let o=[];for(let i=0;i<s.length;i++){let a=s[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(u=>Ix(u,r,i))):Ix(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function Su(t,e,r){t.issues.length&&e.issues.push(...Mr(r,t.issues)),e.value[r]=t.value}function Ox(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Mr(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}var Eu=P("$ZodObject",(t,e)=>{je.init(t,e);let r=sa(()=>{let d=Object.keys(e.shape);for(let g of d)if(!(e.shape[g]instanceof je))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);let p=zp(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(p)}});Le(t._zod,"propValues",()=>{let d=e.shape,p={};for(let g in d){let h=d[g]._zod;if(h.values){p[g]??(p[g]=new Set);for(let m of h.values)p[g].add(m)}}return p});let n=d=>{let p=new xu(["shape","payload","ctx"]),g=r.value,h=w=>{let x=Ts(w);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};p.write("const input = payload.value;");let m=Object.create(null),_=0;for(let w of g.keys)m[w]=`key_${_++}`;p.write("const newResult = {}");for(let w of g.keys)if(g.optionalKeys.has(w)){let x=m[w];p.write(`const ${x} = ${h(w)};`);let T=Ts(w);p.write(`
|
|
179
179
|
if (${x}.issues.length) {
|
|
180
180
|
if (input[${T}] === undefined) {
|
|
181
181
|
if (${T} in input) {
|
|
@@ -198,13 +198,13 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
198
198
|
if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
199
199
|
...iss,
|
|
200
200
|
path: iss.path ? [${Ts(w)}, ...iss.path] : [${Ts(w)}]
|
|
201
|
-
})));`),p.write(`newResult[${Ts(w)}] = ${x}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(w,x)=>b(d,w,x)},s,o=qo,i=!gu.jitless,c=i&&Rp.value,u=e.catchall,l;t._zod.parse=(d,p)=>{l??(l=r.value);let g=d.value;if(!o(g))return d.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),d;let h=[];if(i&&c&&p?.async===!1&&p.jitless!==!0)s||(s=n(e.shape)),d=s(d,p);else{d.value={};let x=l.shape;for(let T of l.keys){let P=x[T],L=P._zod.run({value:g[T],issues:[]},p),U=P._zod.optin==="optional"&&P._zod.optout==="optional";L instanceof Promise?h.push(L.then($=>U?Ix($,d,T,g):Su($,d,T))):U?Ix(L,d,T,g):Su(L,d,T)}}if(!u)return h.length?Promise.all(h).then(()=>d):d;let m=[],_=l.keySet,b=u._zod,w=b.def.type;for(let x of Object.keys(g)){if(_.has(x))continue;if(w==="never"){m.push(x);continue}let T=b.run({value:g[x],issues:[]},p);T instanceof Promise?h.push(T.then(P=>Su(P,d,x))):Su(T,d,x)}return m.length&&d.issues.push({code:"unrecognized_keys",keys:m,input:g,inst:t}),h.length?Promise.all(h).then(()=>d):d}});function Px(t,e,r,n){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(o=>_r(o,n,Bt())))}),e}var Tu=O("$ZodUnion",(t,e)=>{je.init(t,e),Le(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Le(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Le(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Le(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>ia(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let s=!1,o=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(i=>Px(i,r,t,n)):Px(o,r,t,n)}}),Sh=O("$ZodDiscriminatedUnion",(t,e)=>{Tu.init(t,e);let r=t._zod.parse;Le(t._zod,"propValues",()=>{let s={};for(let o of e.options){let i=o._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,c]of Object.entries(i)){s[a]||(s[a]=new Set);for(let u of c)s[a].add(u)}}return s});let n=sa(()=>{let s=e.options,o=new Map;for(let i of s){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,i)}}return o});t._zod.parse=(s,o)=>{let i=s.value;if(!qo(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),s;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(s,o):e.unionFallback?r(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),s)}}),kh=O("$ZodIntersection",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>{let s=r.value,o=e.left._zod.run({value:s,issues:[]},n),i=e.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,u])=>Ox(r,c,u)):Ox(r,o,i)}});function Yp(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Zo(t)&&Zo(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(let o of n){let i=Yp(t[o],e[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let s=t[n],o=e[n],i=Yp(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ox(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),$s(t))return t;let n=Yp(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var Eh=O("$ZodRecord",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>{let s=r.value;if(!Zo(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),r;let o=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:s[c],issues:[]},n);u instanceof Promise?o.push(u.then(l=>{l.issues.length&&r.issues.push(...Mr(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...Mr(c,u.issues)),r.value[c]=u.value)}let a;for(let c in s)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(s)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>_r(u,n,Bt())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:s[i],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...Mr(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...Mr(i,c.issues)),r.value[a.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}});var Th=O("$ZodEnum",(t,e)=>{je.init(t,e);let r=na(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>jp.has(typeof n)).map(n=>typeof n=="string"?Tn(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{let o=n.value;return t._zod.values.has(o)||n.issues.push({code:"invalid_value",values:r,input:o,inst:t}),n}}),$h=O("$ZodLiteral",(t,e)=>{je.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Tn(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let s=r.value;return t._zod.values.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}});var Ih=O("$ZodTransform",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>{let s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new on;return r.value=s,r}}),Ph=O("$ZodOptional",(t,e)=>{je.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Le(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Le(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ia(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),Oh=O("$ZodNullable",(t,e)=>{je.init(t,e),Le(t._zod,"optin",()=>e.innerType._zod.optin),Le(t._zod,"optout",()=>e.innerType._zod.optout),Le(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ia(r.source)}|null)$`):void 0}),Le(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Ch=O("$ZodDefault",(t,e)=>{je.init(t,e),t._zod.optin="optional",Le(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Cx(o,e)):Cx(s,e)}});function Cx(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Ah=O("$ZodPrefault",(t,e)=>{je.init(t,e),t._zod.optin="optional",Le(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Nh=O("$ZodNonOptional",(t,e)=>{je.init(t,e),Le(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Ax(o,t)):Ax(s,t)}});function Ax(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Rh=O("$ZodCatch",(t,e)=>{je.init(t,e),t._zod.optin="optional",Le(t._zod,"optout",()=>e.innerType._zod.optout),Le(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>_r(i,n,Bt()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(o=>_r(o,n,Bt()))},input:r.value}),r.issues=[]),r)}});var jh=O("$ZodPipe",(t,e)=>{je.init(t,e),Le(t._zod,"values",()=>e.in._zod.values),Le(t._zod,"optin",()=>e.in._zod.optin),Le(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let s=e.in._zod.run(r,n);return s instanceof Promise?s.then(o=>Nx(o,e,n)):Nx(s,e,n)}});function Nx(t,e,r){return $s(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var zh=O("$ZodReadonly",(t,e)=>{je.init(t,e),Le(t._zod,"propValues",()=>e.innerType._zod.propValues),Le(t._zod,"values",()=>e.innerType._zod.values),Le(t._zod,"optin",()=>e.innerType._zod.optin),Le(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(Rx):Rx(s)}});function Rx(t){return t.value=Object.freeze(t.value),t}var Mh=O("$ZodCustom",(t,e)=>{pt.init(t,e),je.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,s=e.fn(n);if(s instanceof Promise)return s.then(o=>jx(o,r,n,t));jx(s,r,n,t)}});function jx(t,e,r,n){if(!t){let s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(Lp(s))}}f();var qM=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},ZM=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${qM(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${vu(n.values[0])}`:`Invalid option: expected one of ${yu(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",o=e(n.origin);return o?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",o=e(n.origin);return o?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${o.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.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":""}: ${yu(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 Dx(){return{localeError:ZM()}}f();var da=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Fx(){return new da}var $n=Fx();f();function Lh(t,e){return new t({type:"string",...ne(e)})}function qh(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ne(e)})}function $u(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ne(e)})}function Zh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ne(e)})}function Dh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ne(e)})}function Fh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ne(e)})}function Uh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ne(e)})}function Vh(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ne(e)})}function Bh(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ne(e)})}function Hh(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ne(e)})}function Kh(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ne(e)})}function Gh(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ne(e)})}function Jh(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ne(e)})}function Wh(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ne(e)})}function Yh(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ne(e)})}function Xh(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ne(e)})}function Qh(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ne(e)})}function em(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ne(e)})}function tm(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ne(e)})}function rm(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ne(e)})}function nm(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ne(e)})}function sm(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ne(e)})}function om(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ne(e)})}function Ux(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ne(e)})}function Vx(t,e){return new t({type:"string",format:"date",check:"string_format",...ne(e)})}function Bx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ne(e)})}function Hx(t,e){return new t({type:"string",format:"duration",check:"string_format",...ne(e)})}function im(t,e){return new t({type:"number",checks:[],...ne(e)})}function am(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ne(e)})}function cm(t,e){return new t({type:"boolean",...ne(e)})}function um(t,e){return new t({type:"null",...ne(e)})}function lm(t){return new t({type:"unknown"})}function dm(t,e){return new t({type:"never",...ne(e)})}function Iu(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!1})}function fa(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!0})}function Pu(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!1})}function pa(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!0})}function Ou(t,e){return new px({check:"multiple_of",...ne(e),value:t})}function Cu(t,e){return new mx({check:"max_length",...ne(e),maximum:t})}function Do(t,e){return new gx({check:"min_length",...ne(e),minimum:t})}function Au(t,e){return new yx({check:"length_equals",...ne(e),length:t})}function fm(t,e){return new _x({check:"string_format",format:"regex",...ne(e),pattern:t})}function pm(t){return new vx({check:"string_format",format:"lowercase",...ne(t)})}function hm(t){return new bx({check:"string_format",format:"uppercase",...ne(t)})}function mm(t,e){return new wx({check:"string_format",format:"includes",...ne(e),includes:t})}function gm(t,e){return new xx({check:"string_format",format:"starts_with",...ne(e),prefix:t})}function ym(t,e){return new Sx({check:"string_format",format:"ends_with",...ne(e),suffix:t})}function Os(t){return new kx({check:"overwrite",tx:t})}function _m(t){return Os(e=>e.normalize(t))}function vm(){return Os(t=>t.trim())}function bm(){return Os(t=>t.toLowerCase())}function wm(){return Os(t=>t.toUpperCase())}function Kx(t,e,r){return new t({type:"array",element:e,...ne(r)})}function xm(t,e,r){let n=ne(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Sm(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ne(r)})}f();var Nu=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??$n,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let s=e._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},p=e._zod.parent;if(p)a.ref=p,this.process(p,d),this.seen.get(p).isParent=!0;else{let g=a.schema;switch(s.type){case"string":{let h=g;h.type="string";let{minimum:m,maximum:_,format:b,patterns:w,contentEncoding:x}=e._zod.bag;if(typeof m=="number"&&(h.minLength=m),typeof _=="number"&&(h.maxLength=_),b&&(h.format=o[b]??b,h.format===""&&delete h.format),x&&(h.contentEncoding=x),w&&w.size>0){let T=[...w];T.length===1?h.pattern=T[0].source:T.length>1&&(a.schema.allOf=[...T.map(P=>({...this.target==="draft-7"?{type:"string"}:{},pattern:P.source}))])}break}case"number":{let h=g,{minimum:m,maximum:_,format:b,multipleOf:w,exclusiveMaximum:x,exclusiveMinimum:T}=e._zod.bag;typeof b=="string"&&b.includes("int")?h.type="integer":h.type="number",typeof T=="number"&&(h.exclusiveMinimum=T),typeof m=="number"&&(h.minimum=m,typeof T=="number"&&(T>=m?delete h.minimum:delete h.exclusiveMinimum)),typeof x=="number"&&(h.exclusiveMaximum=x),typeof _=="number"&&(h.maximum=_,typeof x=="number"&&(x<=_?delete h.maximum:delete h.exclusiveMaximum)),typeof w=="number"&&(h.multipleOf=w);break}case"boolean":{let h=g;h.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":{g.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":{g.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let h=g,{minimum:m,maximum:_}=e._zod.bag;typeof m=="number"&&(h.minItems=m),typeof _=="number"&&(h.maxItems=_),h.type="array",h.items=this.process(s.element,{...d,path:[...d.path,"items"]});break}case"object":{let h=g;h.type="object",h.properties={};let m=s.shape;for(let w in m)h.properties[w]=this.process(m[w],{...d,path:[...d.path,"properties",w]});let _=new Set(Object.keys(m)),b=new Set([..._].filter(w=>{let x=s.shape[w]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));b.size>0&&(h.required=Array.from(b)),s.catchall?._zod.def.type==="never"?h.additionalProperties=!1:s.catchall?s.catchall&&(h.additionalProperties=this.process(s.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{let h=g;h.anyOf=s.options.map((m,_)=>this.process(m,{...d,path:[...d.path,"anyOf",_]}));break}case"intersection":{let h=g,m=this.process(s.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(s.right,{...d,path:[...d.path,"allOf",1]}),b=x=>"allOf"in x&&Object.keys(x).length===1,w=[...b(m)?m.allOf:[m],...b(_)?_.allOf:[_]];h.allOf=w;break}case"tuple":{let h=g;h.type="array";let m=s.items.map((w,x)=>this.process(w,{...d,path:[...d.path,"prefixItems",x]}));if(this.target==="draft-2020-12"?h.prefixItems=m:h.items=m,s.rest){let w=this.process(s.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?h.items=w:h.additionalItems=w}s.rest&&(h.items=this.process(s.rest,{...d,path:[...d.path,"items"]}));let{minimum:_,maximum:b}=e._zod.bag;typeof _=="number"&&(h.minItems=_),typeof b=="number"&&(h.maxItems=b);break}case"record":{let h=g;h.type="object",h.propertyNames=this.process(s.keyType,{...d,path:[...d.path,"propertyNames"]}),h.additionalProperties=this.process(s.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 h=g,m=na(s.entries);m.every(_=>typeof _=="number")&&(h.type="number"),m.every(_=>typeof _=="string")&&(h.type="string"),h.enum=m;break}case"literal":{let h=g,m=[];for(let _ of s.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(_))}else m.push(_);if(m.length!==0)if(m.length===1){let _=m[0];h.type=_===null?"null":typeof _,h.const=_}else m.every(_=>typeof _=="number")&&(h.type="number"),m.every(_=>typeof _=="string")&&(h.type="string"),m.every(_=>typeof _=="boolean")&&(h.type="string"),m.every(_=>_===null)&&(h.type="null"),h.enum=m;break}case"file":{let h=g,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:b,mime:w}=e._zod.bag;_!==void 0&&(m.minLength=_),b!==void 0&&(m.maxLength=b),w?w.length===1?(m.contentMediaType=w[0],Object.assign(h,m)):h.anyOf=w.map(x=>({...m,contentMediaType:x})):Object.assign(h,m);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let h=this.process(s.innerType,d);g.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,d),a.ref=s.innerType;break}case"success":{let h=g;h.type="boolean";break}case"default":{this.process(s.innerType,d),a.ref=s.innerType,g.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,d),a.ref=s.innerType,this.io==="input"&&(g._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,d),a.ref=s.innerType;let h;try{h=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}g.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let h=g,m=e._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=m.source;break}case"pipe":{let h=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(h,d),a.ref=h;break}case"readonly":{this.process(s.innerType,d),a.ref=s.innerType,g.readOnly=!0;break}case"promise":{this.process(s.innerType,d),a.ref=s.innerType;break}case"optional":{this.process(s.innerType,d),a.ref=s.innerType;break}case"lazy":{let h=e._zod.innerType;this.process(h,d),a.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&at(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},s=this.seen.get(e);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let m=n.external.registry.get(l[0])?.id,_=n.external.uri??(w=>w);if(m)return{ref:_(m)};let b=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=b,{defId:b,ref:`${_("__shared")}#/${d}/${b}`}}if(l[1]===s)return{ref:"#"};let g=`#/${d}/`,h=l[1].schema.id??`__schema${this.counter++}`;return{defId:h,ref:g+h}},i=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:p,defId:g}=o(l);d.def={...d.schema},g&&(d.defId=g);let h=d.schema;for(let m in h)delete h[m];h.$ref=p};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>
|
|
201
|
+
})));`),p.write(`newResult[${Ts(w)}] = ${x}.value`)}p.write("payload.value = newResult;"),p.write("return payload;");let b=p.compile();return(w,x)=>b(d,w,x)},s,o=qo,i=!gu.jitless,c=i&&Rp.value,u=e.catchall,l;t._zod.parse=(d,p)=>{l??(l=r.value);let g=d.value;if(!o(g))return d.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),d;let h=[];if(i&&c&&p?.async===!1&&p.jitless!==!0)s||(s=n(e.shape)),d=s(d,p);else{d.value={};let x=l.shape;for(let T of l.keys){let O=x[T],L=O._zod.run({value:g[T],issues:[]},p),U=O._zod.optin==="optional"&&O._zod.optout==="optional";L instanceof Promise?h.push(L.then($=>U?Ox($,d,T,g):Su($,d,T))):U?Ox(L,d,T,g):Su(L,d,T)}}if(!u)return h.length?Promise.all(h).then(()=>d):d;let m=[],_=l.keySet,b=u._zod,w=b.def.type;for(let x of Object.keys(g)){if(_.has(x))continue;if(w==="never"){m.push(x);continue}let T=b.run({value:g[x],issues:[]},p);T instanceof Promise?h.push(T.then(O=>Su(O,d,x))):Su(T,d,x)}return m.length&&d.issues.push({code:"unrecognized_keys",keys:m,input:g,inst:t}),h.length?Promise.all(h).then(()=>d):d}});function Px(t,e,r,n){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(o=>_r(o,n,Bt())))}),e}var Tu=P("$ZodUnion",(t,e)=>{je.init(t,e),Le(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),Le(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),Le(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),Le(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>ia(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let s=!1,o=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)o.push(a),s=!0;else{if(a.issues.length===0)return a;o.push(a)}}return s?Promise.all(o).then(i=>Px(i,r,t,n)):Px(o,r,t,n)}}),Sh=P("$ZodDiscriminatedUnion",(t,e)=>{Tu.init(t,e);let r=t._zod.parse;Le(t._zod,"propValues",()=>{let s={};for(let o of e.options){let i=o._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(let[a,c]of Object.entries(i)){s[a]||(s[a]=new Set);for(let u of c)s[a].add(u)}}return s});let n=sa(()=>{let s=e.options,o=new Map;for(let i of s){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,i)}}return o});t._zod.parse=(s,o)=>{let i=s.value;if(!qo(i))return s.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),s;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(s,o):e.unionFallback?r(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),s)}}),kh=P("$ZodIntersection",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>{let s=r.value,o=e.left._zod.run({value:s,issues:[]},n),i=e.right._zod.run({value:s,issues:[]},n);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([c,u])=>Cx(r,c,u)):Cx(r,o,i)}});function Yp(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Zo(t)&&Zo(e)){let r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),s={...t,...e};for(let o of n){let i=Yp(t[o],e[o]);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};s[o]=i.data}return{valid:!0,data:s}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let s=t[n],o=e[n],i=Yp(s,o);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Cx(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),$s(t))return t;let n=Yp(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var Eh=P("$ZodRecord",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>{let s=r.value;if(!Zo(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:t}),r;let o=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:s[c],issues:[]},n);u instanceof Promise?o.push(u.then(l=>{l.issues.length&&r.issues.push(...Mr(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...Mr(c,u.issues)),r.value[c]=u.value)}let a;for(let c in s)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(s)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>_r(u,n,Bt())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:s[i],issues:[]},n);c instanceof Promise?o.push(c.then(u=>{u.issues.length&&r.issues.push(...Mr(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...Mr(i,c.issues)),r.value[a.value]=c.value)}}return o.length?Promise.all(o).then(()=>r):r}});var Th=P("$ZodEnum",(t,e)=>{je.init(t,e);let r=na(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>jp.has(typeof n)).map(n=>typeof n=="string"?Tn(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{let o=n.value;return t._zod.values.has(o)||n.issues.push({code:"invalid_value",values:r,input:o,inst:t}),n}}),$h=P("$ZodLiteral",(t,e)=>{je.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Tn(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let s=r.value;return t._zod.values.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}});var Ih=P("$ZodTransform",(t,e)=>{je.init(t,e),t._zod.parse=(r,n)=>{let s=e.transform(r.value,r);if(n.async)return(s instanceof Promise?s:Promise.resolve(s)).then(i=>(r.value=i,r));if(s instanceof Promise)throw new on;return r.value=s,r}}),Oh=P("$ZodOptional",(t,e)=>{je.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Le(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Le(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ia(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),Ph=P("$ZodNullable",(t,e)=>{je.init(t,e),Le(t._zod,"optin",()=>e.innerType._zod.optin),Le(t._zod,"optout",()=>e.innerType._zod.optout),Le(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${ia(r.source)}|null)$`):void 0}),Le(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),Ch=P("$ZodDefault",(t,e)=>{je.init(t,e),t._zod.optin="optional",Le(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Nx(o,e)):Nx(s,e)}});function Nx(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Nh=P("$ZodPrefault",(t,e)=>{je.init(t,e),t._zod.optin="optional",Le(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),Ah=P("$ZodNonOptional",(t,e)=>{je.init(t,e),Le(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>Ax(o,t)):Ax(s,t)}});function Ax(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Rh=P("$ZodCatch",(t,e)=>{je.init(t,e),t._zod.optin="optional",Le(t._zod,"optout",()=>e.innerType._zod.optout),Le(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>_r(i,n,Bt()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(o=>_r(o,n,Bt()))},input:r.value}),r.issues=[]),r)}});var jh=P("$ZodPipe",(t,e)=>{je.init(t,e),Le(t._zod,"values",()=>e.in._zod.values),Le(t._zod,"optin",()=>e.in._zod.optin),Le(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let s=e.in._zod.run(r,n);return s instanceof Promise?s.then(o=>Rx(o,e,n)):Rx(s,e,n)}});function Rx(t,e,r){return $s(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var zh=P("$ZodReadonly",(t,e)=>{je.init(t,e),Le(t._zod,"propValues",()=>e.innerType._zod.propValues),Le(t._zod,"values",()=>e.innerType._zod.values),Le(t._zod,"optin",()=>e.innerType._zod.optin),Le(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let s=e.innerType._zod.run(r,n);return s instanceof Promise?s.then(jx):jx(s)}});function jx(t){return t.value=Object.freeze(t.value),t}var Mh=P("$ZodCustom",(t,e)=>{pt.init(t,e),je.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,s=e.fn(n);if(s instanceof Promise)return s.then(o=>zx(o,r,n,t));zx(s,r,n,t)}});function zx(t,e,r,n){if(!t){let s={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(s.params=n._zod.def.params),e.issues.push(Lp(s))}}f();var VM=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},BM=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${VM(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${vu(n.values[0])}`:`Invalid option: expected one of ${yu(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",o=e(n.origin);return o?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${o.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",o=e(n.origin);return o?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${o.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.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":""}: ${yu(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 Fx(){return{localeError:BM()}}f();var da=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Ux(){return new da}var $n=Ux();f();function Lh(t,e){return new t({type:"string",...ne(e)})}function qh(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...ne(e)})}function $u(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...ne(e)})}function Zh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...ne(e)})}function Dh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ne(e)})}function Fh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ne(e)})}function Uh(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ne(e)})}function Vh(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...ne(e)})}function Bh(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...ne(e)})}function Hh(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...ne(e)})}function Kh(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...ne(e)})}function Gh(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...ne(e)})}function Jh(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...ne(e)})}function Wh(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...ne(e)})}function Yh(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...ne(e)})}function Xh(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...ne(e)})}function Qh(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...ne(e)})}function em(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ne(e)})}function tm(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ne(e)})}function rm(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...ne(e)})}function nm(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...ne(e)})}function sm(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...ne(e)})}function om(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...ne(e)})}function Vx(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ne(e)})}function Bx(t,e){return new t({type:"string",format:"date",check:"string_format",...ne(e)})}function Hx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ne(e)})}function Kx(t,e){return new t({type:"string",format:"duration",check:"string_format",...ne(e)})}function im(t,e){return new t({type:"number",checks:[],...ne(e)})}function am(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...ne(e)})}function cm(t,e){return new t({type:"boolean",...ne(e)})}function um(t,e){return new t({type:"null",...ne(e)})}function lm(t){return new t({type:"unknown"})}function dm(t,e){return new t({type:"never",...ne(e)})}function Iu(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!1})}function fa(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!0})}function Ou(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!1})}function pa(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!0})}function Pu(t,e){return new hx({check:"multiple_of",...ne(e),value:t})}function Cu(t,e){return new gx({check:"max_length",...ne(e),maximum:t})}function Do(t,e){return new yx({check:"min_length",...ne(e),minimum:t})}function Nu(t,e){return new _x({check:"length_equals",...ne(e),length:t})}function fm(t,e){return new vx({check:"string_format",format:"regex",...ne(e),pattern:t})}function pm(t){return new bx({check:"string_format",format:"lowercase",...ne(t)})}function hm(t){return new wx({check:"string_format",format:"uppercase",...ne(t)})}function mm(t,e){return new xx({check:"string_format",format:"includes",...ne(e),includes:t})}function gm(t,e){return new Sx({check:"string_format",format:"starts_with",...ne(e),prefix:t})}function ym(t,e){return new kx({check:"string_format",format:"ends_with",...ne(e),suffix:t})}function Ps(t){return new Ex({check:"overwrite",tx:t})}function _m(t){return Ps(e=>e.normalize(t))}function vm(){return Ps(t=>t.trim())}function bm(){return Ps(t=>t.toLowerCase())}function wm(){return Ps(t=>t.toUpperCase())}function Gx(t,e,r){return new t({type:"array",element:e,...ne(r)})}function xm(t,e,r){let n=ne(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Sm(t,e,r){return new t({type:"custom",check:"custom",fn:e,...ne(r)})}f();var Au=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??$n,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let s=e._zod.def,o={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},p=e._zod.parent;if(p)a.ref=p,this.process(p,d),this.seen.get(p).isParent=!0;else{let g=a.schema;switch(s.type){case"string":{let h=g;h.type="string";let{minimum:m,maximum:_,format:b,patterns:w,contentEncoding:x}=e._zod.bag;if(typeof m=="number"&&(h.minLength=m),typeof _=="number"&&(h.maxLength=_),b&&(h.format=o[b]??b,h.format===""&&delete h.format),x&&(h.contentEncoding=x),w&&w.size>0){let T=[...w];T.length===1?h.pattern=T[0].source:T.length>1&&(a.schema.allOf=[...T.map(O=>({...this.target==="draft-7"?{type:"string"}:{},pattern:O.source}))])}break}case"number":{let h=g,{minimum:m,maximum:_,format:b,multipleOf:w,exclusiveMaximum:x,exclusiveMinimum:T}=e._zod.bag;typeof b=="string"&&b.includes("int")?h.type="integer":h.type="number",typeof T=="number"&&(h.exclusiveMinimum=T),typeof m=="number"&&(h.minimum=m,typeof T=="number"&&(T>=m?delete h.minimum:delete h.exclusiveMinimum)),typeof x=="number"&&(h.exclusiveMaximum=x),typeof _=="number"&&(h.maximum=_,typeof x=="number"&&(x<=_?delete h.maximum:delete h.exclusiveMaximum)),typeof w=="number"&&(h.multipleOf=w);break}case"boolean":{let h=g;h.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":{g.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":{g.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let h=g,{minimum:m,maximum:_}=e._zod.bag;typeof m=="number"&&(h.minItems=m),typeof _=="number"&&(h.maxItems=_),h.type="array",h.items=this.process(s.element,{...d,path:[...d.path,"items"]});break}case"object":{let h=g;h.type="object",h.properties={};let m=s.shape;for(let w in m)h.properties[w]=this.process(m[w],{...d,path:[...d.path,"properties",w]});let _=new Set(Object.keys(m)),b=new Set([..._].filter(w=>{let x=s.shape[w]._zod;return this.io==="input"?x.optin===void 0:x.optout===void 0}));b.size>0&&(h.required=Array.from(b)),s.catchall?._zod.def.type==="never"?h.additionalProperties=!1:s.catchall?s.catchall&&(h.additionalProperties=this.process(s.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{let h=g;h.anyOf=s.options.map((m,_)=>this.process(m,{...d,path:[...d.path,"anyOf",_]}));break}case"intersection":{let h=g,m=this.process(s.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(s.right,{...d,path:[...d.path,"allOf",1]}),b=x=>"allOf"in x&&Object.keys(x).length===1,w=[...b(m)?m.allOf:[m],...b(_)?_.allOf:[_]];h.allOf=w;break}case"tuple":{let h=g;h.type="array";let m=s.items.map((w,x)=>this.process(w,{...d,path:[...d.path,"prefixItems",x]}));if(this.target==="draft-2020-12"?h.prefixItems=m:h.items=m,s.rest){let w=this.process(s.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?h.items=w:h.additionalItems=w}s.rest&&(h.items=this.process(s.rest,{...d,path:[...d.path,"items"]}));let{minimum:_,maximum:b}=e._zod.bag;typeof _=="number"&&(h.minItems=_),typeof b=="number"&&(h.maxItems=b);break}case"record":{let h=g;h.type="object",h.propertyNames=this.process(s.keyType,{...d,path:[...d.path,"propertyNames"]}),h.additionalProperties=this.process(s.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 h=g,m=na(s.entries);m.every(_=>typeof _=="number")&&(h.type="number"),m.every(_=>typeof _=="string")&&(h.type="string"),h.enum=m;break}case"literal":{let h=g,m=[];for(let _ of s.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(_))}else m.push(_);if(m.length!==0)if(m.length===1){let _=m[0];h.type=_===null?"null":typeof _,h.const=_}else m.every(_=>typeof _=="number")&&(h.type="number"),m.every(_=>typeof _=="string")&&(h.type="string"),m.every(_=>typeof _=="boolean")&&(h.type="string"),m.every(_=>_===null)&&(h.type="null"),h.enum=m;break}case"file":{let h=g,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:b,mime:w}=e._zod.bag;_!==void 0&&(m.minLength=_),b!==void 0&&(m.maxLength=b),w?w.length===1?(m.contentMediaType=w[0],Object.assign(h,m)):h.anyOf=w.map(x=>({...m,contentMediaType:x})):Object.assign(h,m);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let h=this.process(s.innerType,d);g.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(s.innerType,d),a.ref=s.innerType;break}case"success":{let h=g;h.type="boolean";break}case"default":{this.process(s.innerType,d),a.ref=s.innerType,g.default=JSON.parse(JSON.stringify(s.defaultValue));break}case"prefault":{this.process(s.innerType,d),a.ref=s.innerType,this.io==="input"&&(g._prefault=JSON.parse(JSON.stringify(s.defaultValue)));break}case"catch":{this.process(s.innerType,d),a.ref=s.innerType;let h;try{h=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}g.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let h=g,m=e._zod.pattern;if(!m)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=m.source;break}case"pipe":{let h=this.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;this.process(h,d),a.ref=h;break}case"readonly":{this.process(s.innerType,d),a.ref=s.innerType,g.readOnly=!0;break}case"promise":{this.process(s.innerType,d),a.ref=s.innerType;break}case"optional":{this.process(s.innerType,d),a.ref=s.innerType;break}case"lazy":{let h=e._zod.innerType;this.process(h,d),a.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&at(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},s=this.seen.get(e);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let m=n.external.registry.get(l[0])?.id,_=n.external.uri??(w=>w);if(m)return{ref:_(m)};let b=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=b,{defId:b,ref:`${_("__shared")}#/${d}/${b}`}}if(l[1]===s)return{ref:"#"};let g=`#/${d}/`,h=l[1].schema.id??`__schema${this.counter++}`;return{defId:h,ref:g+h}},i=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:p,defId:g}=o(l);d.def={...d.schema},g&&(d.defId=g);let h=d.schema;for(let m in h)delete h[m];h.$ref=p};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>
|
|
202
202
|
|
|
203
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){i(l);continue}if(n.external){let g=n.external.registry.get(l[0])?.id;if(e!==l[0]&&g){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let p=this.seen.get(l),g=p.def??p.schema,h={...g};if(p.ref===null)return;let m=p.ref;if(p.ref=null,m){a(m,d);let _=this.seen.get(m).schema;_.$ref&&d.target==="draft-7"?(g.allOf=g.allOf??[],g.allOf.push(_)):(Object.assign(g,_),Object.assign(g,h))}p.isParent||this.override({zodSchema:l,jsonSchema:g,path:p.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,s.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 km(t,e){if(t instanceof da){let n=new Nu(e),s={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let o={},i={registry:t,uri:e?.uri,defs:s};for(let a of t._idmap.entries()){let[c,u]=a;o[c]=n.emit(u,{...e,external:i})}if(Object.keys(s).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[a]:s}}return{schemas:o}}let r=new Nu(e);return r.process(t),r.emit(t,e)}function at(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let s=t._zod.def;switch(s.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 at(s.element,r);case"object":{for(let o in s.shape)if(at(s.shape[o],r))return!0;return!1}case"union":{for(let o of s.options)if(at(o,r))return!0;return!1}case"intersection":return at(s.left,r)||at(s.right,r);case"tuple":{for(let o of s.items)if(at(o,r))return!0;return!!(s.rest&&at(s.rest,r))}case"record":return at(s.keyType,r)||at(s.valueType,r);case"map":return at(s.keyType,r)||at(s.valueType,r);case"set":return at(s.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return at(s.innerType,r);case"lazy":return at(s.getter(),r);case"default":return at(s.innerType,r);case"prefault":return at(s.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return at(s.in,r)||at(s.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${s.type}`)}f();f();var wL=O("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");je.init(t,e),t.def=e,t.parse=(r,n)=>Fp(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Is(t,r,n),t.parseAsync=async(r,n)=>Vp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Ps(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Ht(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))});var xL=O("ZodMiniObject",(t,e)=>{Eu.init(t,e),wL.init(t,e),ve.defineLazy(t,"shape",()=>e.shape)});function Em(t,e){let r={type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},...ve.normalizeParams(e)};return new xL(r)}function Qt(t){return!!t._zod}function As(t){let e=Object.values(t);if(e.length===0)return Em({});let r=e.every(Qt),n=e.every(s=>!Qt(s));if(r)return Em(t);if(n)return Ip(t);throw new Error("Mixed Zod versions detected in object shape.")}function In(t,e){return Qt(t)?Is(t,e):t.safeParse(e)}async function Ru(t,e){return Qt(t)?await Ps(t,e):await t.safeParseAsync(e)}function Pn(t){if(!t)return;let e;if(Qt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Fo(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(s=>typeof s=="object"&&s!==null&&(s._def!==void 0||s._zod!==void 0||typeof s.parse=="function")))return As(t)}}if(Qt(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function ju(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Jx(t){return t.description}function Wx(t){if(Qt(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function zu(t){if(Qt(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}f();f();f();f();var ha={};kp(ha,{ZodISODate:()=>Xx,ZodISODateTime:()=>Yx,ZodISODuration:()=>eS,ZodISOTime:()=>Qx,date:()=>$m,datetime:()=>Tm,duration:()=>Pm,time:()=>Im});f();var Yx=O("ZodISODateTime",(t,e)=>{zx.init(t,e),Ge.init(t,e)});function Tm(t){return Ux(Yx,t)}var Xx=O("ZodISODate",(t,e)=>{Mx.init(t,e),Ge.init(t,e)});function $m(t){return Vx(Xx,t)}var Qx=O("ZodISOTime",(t,e)=>{Lx.init(t,e),Ge.init(t,e)});function Im(t){return Bx(Qx,t)}var eS=O("ZodISODuration",(t,e)=>{qx.init(t,e),Ge.init(t,e)});function Pm(t){return Hx(eS,t)}f();f();var tS=(t,e)=>{bu.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Zp(t,r)},flatten:{value:r=>qp(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Ine=O("ZodError",tS),ma=O("ZodError",tS,{Parent:Error});var rS=Dp(ma),nS=Up(ma),sS=Bp(ma),oS=Hp(ma);var et=O("ZodType",(t,e)=>(je.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Ht(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>rS(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>sS(t,r,n),t.parseAsync=async(r,n)=>nS(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>oS(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(vq(r,n)),t.superRefine=r=>t.check(bq(r)),t.overwrite=r=>t.check(Os(r)),t.optional=()=>We(t),t.nullable=()=>cS(t),t.nullish=()=>We(cS(t)),t.nonoptional=r=>fq(t,r),t.array=()=>be(t),t.or=r=>Ue([t,r]),t.and=r=>Lu(t,r),t.transform=r=>Cm(t,hS(r)),t.default=r=>uq(t,r),t.prefault=r=>dq(t,r),t.catch=r=>hq(t,r),t.pipe=r=>Cm(t,r),t.readonly=()=>yq(t),t.describe=r=>{let n=t.clone();return $n.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return $n.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return $n.get(t);let n=t.clone();return $n.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),uS=O("_ZodString",(t,e)=>{la.init(t,e),et.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(fm(...n)),t.includes=(...n)=>t.check(mm(...n)),t.startsWith=(...n)=>t.check(gm(...n)),t.endsWith=(...n)=>t.check(ym(...n)),t.min=(...n)=>t.check(Do(...n)),t.max=(...n)=>t.check(Cu(...n)),t.length=(...n)=>t.check(Au(...n)),t.nonempty=(...n)=>t.check(Do(1,...n)),t.lowercase=n=>t.check(pm(n)),t.uppercase=n=>t.check(hm(n)),t.trim=()=>t.check(vm()),t.normalize=(...n)=>t.check(_m(...n)),t.toLowerCase=()=>t.check(bm()),t.toUpperCase=()=>t.check(wm())}),CL=O("ZodString",(t,e)=>{la.init(t,e),uS.init(t,e),t.email=r=>t.check(qh(AL,r)),t.url=r=>t.check(Vh(NL,r)),t.jwt=r=>t.check(om(GL,r)),t.emoji=r=>t.check(Bh(RL,r)),t.guid=r=>t.check($u(iS,r)),t.uuid=r=>t.check(Zh(Mu,r)),t.uuidv4=r=>t.check(Dh(Mu,r)),t.uuidv6=r=>t.check(Fh(Mu,r)),t.uuidv7=r=>t.check(Uh(Mu,r)),t.nanoid=r=>t.check(Hh(jL,r)),t.guid=r=>t.check($u(iS,r)),t.cuid=r=>t.check(Kh(zL,r)),t.cuid2=r=>t.check(Gh(ML,r)),t.ulid=r=>t.check(Jh(LL,r)),t.base64=r=>t.check(rm(BL,r)),t.base64url=r=>t.check(nm(HL,r)),t.xid=r=>t.check(Wh(qL,r)),t.ksuid=r=>t.check(Yh(ZL,r)),t.ipv4=r=>t.check(Xh(DL,r)),t.ipv6=r=>t.check(Qh(FL,r)),t.cidrv4=r=>t.check(em(UL,r)),t.cidrv6=r=>t.check(tm(VL,r)),t.e164=r=>t.check(sm(KL,r)),t.datetime=r=>t.check(Tm(r)),t.date=r=>t.check($m(r)),t.time=r=>t.check(Im(r)),t.duration=r=>t.check(Pm(r))});function I(t){return Lh(CL,t)}var Ge=O("ZodStringFormat",(t,e)=>{qe.init(t,e),uS.init(t,e)}),AL=O("ZodEmail",(t,e)=>{eh.init(t,e),Ge.init(t,e)});var iS=O("ZodGUID",(t,e)=>{Xp.init(t,e),Ge.init(t,e)});var Mu=O("ZodUUID",(t,e)=>{Qp.init(t,e),Ge.init(t,e)});var NL=O("ZodURL",(t,e)=>{th.init(t,e),Ge.init(t,e)});var RL=O("ZodEmoji",(t,e)=>{rh.init(t,e),Ge.init(t,e)});var jL=O("ZodNanoID",(t,e)=>{nh.init(t,e),Ge.init(t,e)});var zL=O("ZodCUID",(t,e)=>{sh.init(t,e),Ge.init(t,e)});var ML=O("ZodCUID2",(t,e)=>{oh.init(t,e),Ge.init(t,e)});var LL=O("ZodULID",(t,e)=>{ih.init(t,e),Ge.init(t,e)});var qL=O("ZodXID",(t,e)=>{ah.init(t,e),Ge.init(t,e)});var ZL=O("ZodKSUID",(t,e)=>{ch.init(t,e),Ge.init(t,e)});var DL=O("ZodIPv4",(t,e)=>{uh.init(t,e),Ge.init(t,e)});var FL=O("ZodIPv6",(t,e)=>{lh.init(t,e),Ge.init(t,e)});var UL=O("ZodCIDRv4",(t,e)=>{dh.init(t,e),Ge.init(t,e)});var VL=O("ZodCIDRv6",(t,e)=>{fh.init(t,e),Ge.init(t,e)});var BL=O("ZodBase64",(t,e)=>{ph.init(t,e),Ge.init(t,e)});var HL=O("ZodBase64URL",(t,e)=>{hh.init(t,e),Ge.init(t,e)});var KL=O("ZodE164",(t,e)=>{mh.init(t,e),Ge.init(t,e)});var GL=O("ZodJWT",(t,e)=>{gh.init(t,e),Ge.init(t,e)});var lS=O("ZodNumber",(t,e)=>{ku.init(t,e),et.init(t,e),t.gt=(n,s)=>t.check(Pu(n,s)),t.gte=(n,s)=>t.check(pa(n,s)),t.min=(n,s)=>t.check(pa(n,s)),t.lt=(n,s)=>t.check(Iu(n,s)),t.lte=(n,s)=>t.check(fa(n,s)),t.max=(n,s)=>t.check(fa(n,s)),t.int=n=>t.check(aS(n)),t.safe=n=>t.check(aS(n)),t.positive=n=>t.check(Pu(0,n)),t.nonnegative=n=>t.check(pa(0,n)),t.negative=n=>t.check(Iu(0,n)),t.nonpositive=n=>t.check(fa(0,n)),t.multipleOf=(n,s)=>t.check(Ou(n,s)),t.step=(n,s)=>t.check(Ou(n,s)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function Ce(t){return im(lS,t)}var JL=O("ZodNumberFormat",(t,e)=>{yh.init(t,e),lS.init(t,e)});function aS(t){return am(JL,t)}var WL=O("ZodBoolean",(t,e)=>{_h.init(t,e),et.init(t,e)});function lt(t){return cm(WL,t)}var YL=O("ZodNull",(t,e)=>{vh.init(t,e),et.init(t,e)});function dS(t){return um(YL,t)}var XL=O("ZodUnknown",(t,e)=>{bh.init(t,e),et.init(t,e)});function Je(){return lm(XL)}var QL=O("ZodNever",(t,e)=>{wh.init(t,e),et.init(t,e)});function eq(t){return dm(QL,t)}var tq=O("ZodArray",(t,e)=>{xh.init(t,e),et.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Do(r,n)),t.nonempty=r=>t.check(Do(1,r)),t.max=(r,n)=>t.check(Cu(r,n)),t.length=(r,n)=>t.check(Au(r,n)),t.unwrap=()=>t.element});function be(t,e){return Kx(tq,t,e)}var fS=O("ZodObject",(t,e)=>{Eu.init(t,e),et.init(t,e),ve.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Nt(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Je()}),t.loose=()=>t.clone({...t._zod.def,catchall:Je()}),t.strict=()=>t.clone({...t._zod.def,catchall:eq()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ve.extend(t,r),t.merge=r=>ve.merge(t,r),t.pick=r=>ve.pick(t,r),t.omit=r=>ve.omit(t,r),t.partial=(...r)=>ve.partial(mS,t,r[0]),t.required=(...r)=>ve.required(gS,t,r[0])});function K(t,e){let r={type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},...ve.normalizeParams(e)};return new fS(r)}function Et(t,e){return new fS({type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},catchall:Je(),...ve.normalizeParams(e)})}var pS=O("ZodUnion",(t,e)=>{Tu.init(t,e),et.init(t,e),t.options=e.options});function Ue(t,e){return new pS({type:"union",options:t,...ve.normalizeParams(e)})}var rq=O("ZodDiscriminatedUnion",(t,e)=>{pS.init(t,e),Sh.init(t,e)});function Am(t,e,r){return new rq({type:"union",options:e,discriminator:t,...ve.normalizeParams(r)})}var nq=O("ZodIntersection",(t,e)=>{kh.init(t,e),et.init(t,e)});function Lu(t,e){return new nq({type:"intersection",left:t,right:e})}var sq=O("ZodRecord",(t,e)=>{Eh.init(t,e),et.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ze(t,e,r){return new sq({type:"record",keyType:t,valueType:e,...ve.normalizeParams(r)})}var Om=O("ZodEnum",(t,e)=>{Th.init(t,e),et.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,s)=>{let o={};for(let i of n)if(r.has(i))o[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Om({...e,checks:[],...ve.normalizeParams(s),entries:o})},t.exclude=(n,s)=>{let o={...e.entries};for(let i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new Om({...e,checks:[],...ve.normalizeParams(s),entries:o})}});function Nt(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Om({type:"enum",entries:r,...ve.normalizeParams(e)})}var oq=O("ZodLiteral",(t,e)=>{$h.init(t,e),et.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function W(t,e){return new oq({type:"literal",values:Array.isArray(t)?t:[t],...ve.normalizeParams(e)})}var iq=O("ZodTransform",(t,e)=>{Ih.init(t,e),et.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=o=>{if(typeof o=="string")r.issues.push(ve.issue(o,r.value,e));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(ve.issue(i))}};let s=e.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function hS(t){return new iq({type:"transform",transform:t})}var mS=O("ZodOptional",(t,e)=>{Ph.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function We(t){return new mS({type:"optional",innerType:t})}var aq=O("ZodNullable",(t,e)=>{Oh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cS(t){return new aq({type:"nullable",innerType:t})}var cq=O("ZodDefault",(t,e)=>{Ch.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function uq(t,e){return new cq({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var lq=O("ZodPrefault",(t,e)=>{Ah.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function dq(t,e){return new lq({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var gS=O("ZodNonOptional",(t,e)=>{Nh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function fq(t,e){return new gS({type:"nonoptional",innerType:t,...ve.normalizeParams(e)})}var pq=O("ZodCatch",(t,e)=>{Rh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function hq(t,e){return new pq({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var mq=O("ZodPipe",(t,e)=>{jh.init(t,e),et.init(t,e),t.in=e.in,t.out=e.out});function Cm(t,e){return new mq({type:"pipe",in:t,out:e})}var gq=O("ZodReadonly",(t,e)=>{zh.init(t,e),et.init(t,e)});function yq(t){return new gq({type:"readonly",innerType:t})}var yS=O("ZodCustom",(t,e)=>{Mh.init(t,e),et.init(t,e)});function _q(t){let e=new pt({check:"custom"});return e._zod.check=t,e}function _S(t,e){return xm(yS,t??(()=>!0),e)}function vq(t,e={}){return Sm(yS,t,e)}function bq(t){let e=_q(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(ve.issue(n,r.value,e._zod.def));else{let s=n;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=!e._zod.def.abort),r.issues.push(ve.issue(s))}},t(r.value,r)));return e}function Nm(t,e){return Cm(hS(t),e)}Bt(Dx());var jm="2025-11-25",vS="2025-03-26",Vo=[jm,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],On="io.modelcontextprotocol/related-task",Zu="2.0",ct=_S(t=>t!==null&&(typeof t=="object"||typeof t=="function")),bS=Ue([I(),Ce().int()]),wS=I(),Hne=Et({ttl:Ce().optional(),pollInterval:Ce().optional()}),wq=K({ttl:Ce().optional()}),xq=K({taskId:I()}),zm=Et({progressToken:bS.optional(),[On]:xq.optional()}),Kt=K({_meta:zm.optional()}),ga=Kt.extend({task:wq.optional()}),xS=t=>ga.safeParse(t).success,ht=K({method:I(),params:Kt.loose().optional()}),er=K({_meta:zm.optional()}),tr=K({method:I(),params:er.loose().optional()}),mt=Et({_meta:zm.optional()}),Du=Ue([I(),Ce().int()]),SS=K({jsonrpc:W(Zu),id:Du,...ht.shape}).strict(),Cn=t=>SS.safeParse(t).success,kS=K({jsonrpc:W(Zu),...tr.shape}).strict(),ES=t=>kS.safeParse(t).success,Mm=K({jsonrpc:W(Zu),id:Du,result:mt}).strict(),an=t=>Mm.safeParse(t).success;var Q;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Q||(Q={}));var Lm=K({jsonrpc:W(Zu),id:Du.optional(),error:K({code:Ce().int(),message:I(),data:Je().optional()})}).strict();var Bo=t=>Lm.safeParse(t).success;var ya=Ue([SS,kS,Mm,Lm]),Kne=Ue([Mm,Lm]),Fu=mt.strict(),Sq=er.extend({requestId:Du.optional(),reason:I().optional()}),Uu=tr.extend({method:W("notifications/cancelled"),params:Sq}),kq=K({src:I(),mimeType:I().optional(),sizes:be(I()).optional(),theme:Nt(["light","dark"]).optional()}),_a=K({icons:be(kq).optional()}),Uo=K({name:I(),title:I().optional()}),TS=Uo.extend({...Uo.shape,..._a.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),Eq=Lu(K({applyDefaults:lt().optional()}),Ze(I(),Je())),Tq=Nm(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Lu(K({form:Eq.optional(),url:ct.optional()}),Ze(I(),Je()).optional())),$q=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({sampling:Et({createMessage:ct.optional()}).optional(),elicitation:Et({create:ct.optional()}).optional()}).optional()}),Iq=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({tools:Et({call:ct.optional()}).optional()}).optional()}),Pq=K({experimental:Ze(I(),ct).optional(),sampling:K({context:ct.optional(),tools:ct.optional()}).optional(),elicitation:Tq.optional(),roots:K({listChanged:lt().optional()}).optional(),tasks:$q.optional(),extensions:Ze(I(),ct).optional()}),Oq=Kt.extend({protocolVersion:I(),capabilities:Pq,clientInfo:TS}),Vu=ht.extend({method:W("initialize"),params:Oq}),qm=t=>Vu.safeParse(t).success,Cq=K({experimental:Ze(I(),ct).optional(),logging:ct.optional(),completions:ct.optional(),prompts:K({listChanged:lt().optional()}).optional(),resources:K({subscribe:lt().optional(),listChanged:lt().optional()}).optional(),tools:K({listChanged:lt().optional()}).optional(),tasks:Iq.optional(),extensions:Ze(I(),ct).optional()}),Aq=mt.extend({protocolVersion:I(),capabilities:Cq,serverInfo:TS,instructions:I().optional()}),Zm=tr.extend({method:W("notifications/initialized"),params:er.optional()});var Bu=ht.extend({method:W("ping"),params:Kt.optional()}),Nq=K({progress:Ce(),total:We(Ce()),message:We(I())}),Rq=K({...er.shape,...Nq.shape,progressToken:bS}),Hu=tr.extend({method:W("notifications/progress"),params:Rq}),jq=Kt.extend({cursor:wS.optional()}),va=ht.extend({params:jq.optional()}),ba=mt.extend({nextCursor:wS.optional()}),zq=Nt(["working","input_required","completed","failed","cancelled"]),wa=K({taskId:I(),status:zq,ttl:Ue([Ce(),dS()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:We(Ce()),statusMessage:We(I())}),Ho=mt.extend({task:wa}),Mq=er.merge(wa),xa=tr.extend({method:W("notifications/tasks/status"),params:Mq}),Ku=ht.extend({method:W("tasks/get"),params:Kt.extend({taskId:I()})}),Gu=mt.merge(wa),Ju=ht.extend({method:W("tasks/result"),params:Kt.extend({taskId:I()})}),Gne=mt.loose(),Wu=va.extend({method:W("tasks/list")}),Yu=ba.extend({tasks:be(wa)}),Xu=ht.extend({method:W("tasks/cancel"),params:Kt.extend({taskId:I()})}),$S=mt.merge(wa),IS=K({uri:I(),mimeType:We(I()),_meta:Ze(I(),Je()).optional()}),PS=IS.extend({text:I()}),Dm=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),OS=IS.extend({blob:Dm}),Sa=Nt(["user","assistant"]),Ko=K({audience:be(Sa).optional(),priority:Ce().min(0).max(1).optional(),lastModified:ha.datetime({offset:!0}).optional()}),CS=K({...Uo.shape,..._a.shape,uri:I(),description:We(I()),mimeType:We(I()),size:We(Ce()),annotations:Ko.optional(),_meta:We(Et({}))}),Lq=K({...Uo.shape,..._a.shape,uriTemplate:I(),description:We(I()),mimeType:We(I()),annotations:Ko.optional(),_meta:We(Et({}))}),Qu=va.extend({method:W("resources/list")}),qq=ba.extend({resources:be(CS)}),el=va.extend({method:W("resources/templates/list")}),Zq=ba.extend({resourceTemplates:be(Lq)}),Fm=Kt.extend({uri:I()}),Dq=Fm,tl=ht.extend({method:W("resources/read"),params:Dq}),Fq=mt.extend({contents:be(Ue([PS,OS]))}),Uq=tr.extend({method:W("notifications/resources/list_changed"),params:er.optional()}),Vq=Fm,Bq=ht.extend({method:W("resources/subscribe"),params:Vq}),Hq=Fm,Kq=ht.extend({method:W("resources/unsubscribe"),params:Hq}),Gq=er.extend({uri:I()}),Jq=tr.extend({method:W("notifications/resources/updated"),params:Gq}),Wq=K({name:I(),description:We(I()),required:We(lt())}),Yq=K({...Uo.shape,..._a.shape,description:We(I()),arguments:We(be(Wq)),_meta:We(Et({}))}),rl=va.extend({method:W("prompts/list")}),Xq=ba.extend({prompts:be(Yq)}),Qq=Kt.extend({name:I(),arguments:Ze(I(),I()).optional()}),nl=ht.extend({method:W("prompts/get"),params:Qq}),Um=K({type:W("text"),text:I(),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),Vm=K({type:W("image"),data:Dm,mimeType:I(),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),Bm=K({type:W("audio"),data:Dm,mimeType:I(),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),eZ=K({type:W("tool_use"),name:I(),id:I(),input:Ze(I(),Je()),_meta:Ze(I(),Je()).optional()}),tZ=K({type:W("resource"),resource:Ue([PS,OS]),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),rZ=CS.extend({type:W("resource_link")}),Hm=Ue([Um,Vm,Bm,rZ,tZ]),nZ=K({role:Sa,content:Hm}),sZ=mt.extend({description:I().optional(),messages:be(nZ)}),oZ=tr.extend({method:W("notifications/prompts/list_changed"),params:er.optional()}),iZ=K({title:I().optional(),readOnlyHint:lt().optional(),destructiveHint:lt().optional(),idempotentHint:lt().optional(),openWorldHint:lt().optional()}),aZ=K({taskSupport:Nt(["required","optional","forbidden"]).optional()}),AS=K({...Uo.shape,..._a.shape,description:I().optional(),inputSchema:K({type:W("object"),properties:Ze(I(),ct).optional(),required:be(I()).optional()}).catchall(Je()),outputSchema:K({type:W("object"),properties:Ze(I(),ct).optional(),required:be(I()).optional()}).catchall(Je()).optional(),annotations:iZ.optional(),execution:aZ.optional(),_meta:Ze(I(),Je()).optional()}),sl=va.extend({method:W("tools/list")}),cZ=ba.extend({tools:be(AS)}),ol=mt.extend({content:be(Hm).default([]),structuredContent:Ze(I(),Je()).optional(),isError:lt().optional()}),Jne=ol.or(mt.extend({toolResult:Je()})),uZ=ga.extend({name:I(),arguments:Ze(I(),Je()).optional()}),Go=ht.extend({method:W("tools/call"),params:uZ}),lZ=tr.extend({method:W("notifications/tools/list_changed"),params:er.optional()}),Wne=K({autoRefresh:lt().default(!0),debounceMs:Ce().int().nonnegative().default(300)}),ka=Nt(["debug","info","notice","warning","error","critical","alert","emergency"]),dZ=Kt.extend({level:ka}),Km=ht.extend({method:W("logging/setLevel"),params:dZ}),fZ=er.extend({level:ka,logger:I().optional(),data:Je()}),pZ=tr.extend({method:W("notifications/message"),params:fZ}),hZ=K({name:I().optional()}),mZ=K({hints:be(hZ).optional(),costPriority:Ce().min(0).max(1).optional(),speedPriority:Ce().min(0).max(1).optional(),intelligencePriority:Ce().min(0).max(1).optional()}),gZ=K({mode:Nt(["auto","required","none"]).optional()}),yZ=K({type:W("tool_result"),toolUseId:I().describe("The unique identifier for the corresponding tool call."),content:be(Hm).default([]),structuredContent:K({}).loose().optional(),isError:lt().optional(),_meta:Ze(I(),Je()).optional()}),_Z=Am("type",[Um,Vm,Bm]),qu=Am("type",[Um,Vm,Bm,eZ,yZ]),vZ=K({role:Sa,content:Ue([qu,be(qu)]),_meta:Ze(I(),Je()).optional()}),bZ=ga.extend({messages:be(vZ),modelPreferences:mZ.optional(),systemPrompt:I().optional(),includeContext:Nt(["none","thisServer","allServers"]).optional(),temperature:Ce().optional(),maxTokens:Ce().int(),stopSequences:be(I()).optional(),metadata:ct.optional(),tools:be(AS).optional(),toolChoice:gZ.optional()}),wZ=ht.extend({method:W("sampling/createMessage"),params:bZ}),Ea=mt.extend({model:I(),stopReason:We(Nt(["endTurn","stopSequence","maxTokens"]).or(I())),role:Sa,content:_Z}),Gm=mt.extend({model:I(),stopReason:We(Nt(["endTurn","stopSequence","maxTokens","toolUse"]).or(I())),role:Sa,content:Ue([qu,be(qu)])}),xZ=K({type:W("boolean"),title:I().optional(),description:I().optional(),default:lt().optional()}),SZ=K({type:W("string"),title:I().optional(),description:I().optional(),minLength:Ce().optional(),maxLength:Ce().optional(),format:Nt(["email","uri","date","date-time"]).optional(),default:I().optional()}),kZ=K({type:Nt(["number","integer"]),title:I().optional(),description:I().optional(),minimum:Ce().optional(),maximum:Ce().optional(),default:Ce().optional()}),EZ=K({type:W("string"),title:I().optional(),description:I().optional(),enum:be(I()),default:I().optional()}),TZ=K({type:W("string"),title:I().optional(),description:I().optional(),oneOf:be(K({const:I(),title:I()})),default:I().optional()}),$Z=K({type:W("string"),title:I().optional(),description:I().optional(),enum:be(I()),enumNames:be(I()).optional(),default:I().optional()}),IZ=Ue([EZ,TZ]),PZ=K({type:W("array"),title:I().optional(),description:I().optional(),minItems:Ce().optional(),maxItems:Ce().optional(),items:K({type:W("string"),enum:be(I())}),default:be(I()).optional()}),OZ=K({type:W("array"),title:I().optional(),description:I().optional(),minItems:Ce().optional(),maxItems:Ce().optional(),items:K({anyOf:be(K({const:I(),title:I()}))}),default:be(I()).optional()}),CZ=Ue([PZ,OZ]),AZ=Ue([$Z,IZ,CZ]),NZ=Ue([AZ,xZ,SZ,kZ]),RZ=ga.extend({mode:W("form").optional(),message:I(),requestedSchema:K({type:W("object"),properties:Ze(I(),NZ),required:be(I()).optional()})}),jZ=ga.extend({mode:W("url"),message:I(),elicitationId:I(),url:I().url()}),zZ=Ue([RZ,jZ]),MZ=ht.extend({method:W("elicitation/create"),params:zZ}),LZ=er.extend({elicitationId:I()}),qZ=tr.extend({method:W("notifications/elicitation/complete"),params:LZ}),Jo=mt.extend({action:Nt(["accept","decline","cancel"]),content:Nm(t=>t===null?void 0:t,Ze(I(),Ue([I(),Ce(),lt(),be(I())])).optional())}),ZZ=K({type:W("ref/resource"),uri:I()});var DZ=K({type:W("ref/prompt"),name:I()}),FZ=Kt.extend({ref:Ue([DZ,ZZ]),argument:K({name:I(),value:I()}),context:K({arguments:Ze(I(),I()).optional()}).optional()}),il=ht.extend({method:W("completion/complete"),params:FZ});function NS(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function RS(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var UZ=mt.extend({completion:Et({values:be(I()).max(100),total:We(Ce().int()),hasMore:We(lt())})}),VZ=K({uri:I().startsWith("file://"),name:I().optional(),_meta:Ze(I(),Je()).optional()}),BZ=ht.extend({method:W("roots/list"),params:Kt.optional()}),Jm=mt.extend({roots:be(VZ)}),HZ=tr.extend({method:W("notifications/roots/list_changed"),params:er.optional()}),Yne=Ue([Bu,Vu,il,Km,nl,rl,Qu,el,tl,Bq,Kq,Go,sl,Ku,Ju,Wu,Xu]),Xne=Ue([Uu,Hu,Zm,HZ,xa]),Qne=Ue([Fu,Ea,Gm,Jo,Jm,Gu,Yu,Ho]),ese=Ue([Bu,wZ,MZ,BZ,Ku,Ju,Wu,Xu]),tse=Ue([Uu,Hu,pZ,Jq,Uq,lZ,oZ,xa,qZ]),rse=Ue([Fu,Aq,UZ,sZ,Xq,qq,Zq,Fq,ol,cZ,Gu,Yu,Ho]),J=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===Q.UrlElicitationRequired&&n){let s=n;if(s.elicitations)return new Rm(s.elicitations,r)}return new t(e,r,n)}},Rm=class extends J{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Q.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};f();function An(t){return t==="completed"||t==="failed"||t==="cancelled"}f();f();f();var zS=Symbol("Let zodToJsonSchema decide on which parser to use");var jS={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"},MS=t=>typeof t=="string"?{...jS,name:t}:{...jS,...t};f();var LS=t=>{let e=MS(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};f();function Wm(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function we(t,e,r,n,s){t[e]=r,Wm(t,e,n,s)}f();var al=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};f();f();f();function Ye(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?al(e,t.currentPath):e.join("/")}}f();function qS(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==M.ZodAny&&(r.items=oe(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&we(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&we(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(we(r,"minItems",t.exactLength.value,t.exactLength.message,e),we(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}f();function ZS(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?we(r,"minimum",n.value,n.message,e):we(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),we(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?we(r,"maximum",n.value,n.message,e):we(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),we(r,"maximum",n.value,n.message,e));break;case"multipleOf":we(r,"multipleOf",n.value,n.message,e);break}return r}f();function DS(){return{type:"boolean"}}f();function cl(t,e){return oe(t.type._def,e)}f();var FS=(t,e)=>oe(t.innerType._def,e);f();function Ym(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,o)=>Ym(t,e,s))};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 KZ(t,e)}}var KZ=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":we(r,"minimum",n.value,n.message,e);break;case"max":we(r,"maximum",n.value,n.message,e);break}return r};f();function US(t,e){return{...oe(t.innerType._def,e),default:t.defaultValue()}}f();function VS(t,e){return e.effectStrategy==="input"?oe(t.schema._def,e):Ye(e)}f();function BS(t){return{type:"string",enum:Array.from(t.values)}}f();var GZ=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function HS(t,e){let r=[oe(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),oe(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,s=[];return r.forEach(o=>{if(GZ(o))s.push(...o.allOf),o.unevaluatedProperties===void 0&&(n=void 0);else{let i=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;i=c}else n=void 0;s.push(i)}}),s.length?{allOf:s,...n}:void 0}f();function KS(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}f();f();f();var Xm,vr={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:()=>(Xm===void 0&&(Xm=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xm),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 ul(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":we(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":we(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":br(r,"email",n.message,e);break;case"format:idn-email":br(r,"idn-email",n.message,e);break;case"pattern:zod":Tt(r,vr.email,n.message,e);break}break;case"url":br(r,"uri",n.message,e);break;case"uuid":br(r,"uuid",n.message,e);break;case"regex":Tt(r,n.regex,n.message,e);break;case"cuid":Tt(r,vr.cuid,n.message,e);break;case"cuid2":Tt(r,vr.cuid2,n.message,e);break;case"startsWith":Tt(r,RegExp(`^${Qm(n.value,e)}`),n.message,e);break;case"endsWith":Tt(r,RegExp(`${Qm(n.value,e)}$`),n.message,e);break;case"datetime":br(r,"date-time",n.message,e);break;case"date":br(r,"date",n.message,e);break;case"time":br(r,"time",n.message,e);break;case"duration":br(r,"duration",n.message,e);break;case"length":we(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),we(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Tt(r,RegExp(Qm(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&br(r,"ipv4",n.message,e),n.version!=="v4"&&br(r,"ipv6",n.message,e);break}case"base64url":Tt(r,vr.base64url,n.message,e);break;case"jwt":Tt(r,vr.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Tt(r,vr.ipv4Cidr,n.message,e),n.version!=="v4"&&Tt(r,vr.ipv6Cidr,n.message,e);break}case"emoji":Tt(r,vr.emoji(),n.message,e);break;case"ulid":{Tt(r,vr.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{br(r,"binary",n.message,e);break}case"contentEncoding:base64":{we(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Tt(r,vr.base64,n.message,e);break}}break}case"nanoid":Tt(r,vr.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Qm(t,e){return e.patternStrategy==="escape"?WZ(t):t}var JZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function WZ(t){let e="";for(let r=0;r<t.length;r++)JZ.has(t[r])||(e+="\\"),e+=t[r];return e}function br(t,e,r,n){t.format||t.anyOf?.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):we(t,"format",e,r,n)}function Tt(t,e,r,n){t.pattern||t.allOf?.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:GS(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):we(t,"pattern",GS(e,n),r,n)}function GS(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,s="",o=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(o){s+=n[c],o=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(s+=n[c],s+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(s+=n[c],a=!0):s+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){s+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){s+=`(^|(?<=[\r
|
|
203
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){i(l);continue}if(n.external){let g=n.external.registry.get(l[0])?.id;if(e!==l[0]&&g){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let p=this.seen.get(l),g=p.def??p.schema,h={...g};if(p.ref===null)return;let m=p.ref;if(p.ref=null,m){a(m,d);let _=this.seen.get(m).schema;_.$ref&&d.target==="draft-7"?(g.allOf=g.allOf??[],g.allOf.push(_)):(Object.assign(g,_),Object.assign(g,h))}p.isParent||this.override({zodSchema:l,jsonSchema:g,path:p.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,s.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 km(t,e){if(t instanceof da){let n=new Au(e),s={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let o={},i={registry:t,uri:e?.uri,defs:s};for(let a of t._idmap.entries()){let[c,u]=a;o[c]=n.emit(u,{...e,external:i})}if(Object.keys(s).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[a]:s}}return{schemas:o}}let r=new Au(e);return r.process(t),r.emit(t,e)}function at(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let s=t._zod.def;switch(s.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 at(s.element,r);case"object":{for(let o in s.shape)if(at(s.shape[o],r))return!0;return!1}case"union":{for(let o of s.options)if(at(o,r))return!0;return!1}case"intersection":return at(s.left,r)||at(s.right,r);case"tuple":{for(let o of s.items)if(at(o,r))return!0;return!!(s.rest&&at(s.rest,r))}case"record":return at(s.keyType,r)||at(s.valueType,r);case"map":return at(s.keyType,r)||at(s.valueType,r);case"set":return at(s.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return at(s.innerType,r);case"lazy":return at(s.getter(),r);case"default":return at(s.innerType,r);case"prefault":return at(s.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return at(s.in,r)||at(s.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${s.type}`)}f();f();var TL=P("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");je.init(t,e),t.def=e,t.parse=(r,n)=>Fp(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Is(t,r,n),t.parseAsync=async(r,n)=>Vp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Os(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Ht(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))});var $L=P("ZodMiniObject",(t,e)=>{Eu.init(t,e),TL.init(t,e),ve.defineLazy(t,"shape",()=>e.shape)});function Em(t,e){let r={type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},...ve.normalizeParams(e)};return new $L(r)}function Qt(t){return!!t._zod}function Ns(t){let e=Object.values(t);if(e.length===0)return Em({});let r=e.every(Qt),n=e.every(s=>!Qt(s));if(r)return Em(t);if(n)return Ip(t);throw new Error("Mixed Zod versions detected in object shape.")}function In(t,e){return Qt(t)?Is(t,e):t.safeParse(e)}async function Ru(t,e){return Qt(t)?await Os(t,e):await t.safeParseAsync(e)}function On(t){if(!t)return;let e;if(Qt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Fo(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(s=>typeof s=="object"&&s!==null&&(s._def!==void 0||s._zod!==void 0||typeof s.parse=="function")))return Ns(t)}}if(Qt(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function ju(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Wx(t){return t.description}function Yx(t){if(Qt(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function zu(t){if(Qt(t)){let o=t._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}f();f();f();f();var ha={};kp(ha,{ZodISODate:()=>Qx,ZodISODateTime:()=>Xx,ZodISODuration:()=>tS,ZodISOTime:()=>eS,date:()=>$m,datetime:()=>Tm,duration:()=>Om,time:()=>Im});f();var Xx=P("ZodISODateTime",(t,e)=>{Mx.init(t,e),Ge.init(t,e)});function Tm(t){return Vx(Xx,t)}var Qx=P("ZodISODate",(t,e)=>{Lx.init(t,e),Ge.init(t,e)});function $m(t){return Bx(Qx,t)}var eS=P("ZodISOTime",(t,e)=>{qx.init(t,e),Ge.init(t,e)});function Im(t){return Hx(eS,t)}var tS=P("ZodISODuration",(t,e)=>{Zx.init(t,e),Ge.init(t,e)});function Om(t){return Kx(tS,t)}f();f();var rS=(t,e)=>{bu.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Zp(t,r)},flatten:{value:r=>qp(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Rne=P("ZodError",rS),ma=P("ZodError",rS,{Parent:Error});var nS=Dp(ma),sS=Up(ma),oS=Bp(ma),iS=Hp(ma);var et=P("ZodType",(t,e)=>(je.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Ht(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>nS(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>oS(t,r,n),t.parseAsync=async(r,n)=>sS(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>iS(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(kq(r,n)),t.superRefine=r=>t.check(Eq(r)),t.overwrite=r=>t.check(Ps(r)),t.optional=()=>We(t),t.nullable=()=>uS(t),t.nullish=()=>We(uS(t)),t.nonoptional=r=>yq(t,r),t.array=()=>be(t),t.or=r=>Ue([t,r]),t.and=r=>Lu(t,r),t.transform=r=>Cm(t,mS(r)),t.default=r=>hq(t,r),t.prefault=r=>gq(t,r),t.catch=r=>vq(t,r),t.pipe=r=>Cm(t,r),t.readonly=()=>xq(t),t.describe=r=>{let n=t.clone();return $n.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return $n.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return $n.get(t);let n=t.clone();return $n.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),lS=P("_ZodString",(t,e)=>{la.init(t,e),et.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(fm(...n)),t.includes=(...n)=>t.check(mm(...n)),t.startsWith=(...n)=>t.check(gm(...n)),t.endsWith=(...n)=>t.check(ym(...n)),t.min=(...n)=>t.check(Do(...n)),t.max=(...n)=>t.check(Cu(...n)),t.length=(...n)=>t.check(Nu(...n)),t.nonempty=(...n)=>t.check(Do(1,...n)),t.lowercase=n=>t.check(pm(n)),t.uppercase=n=>t.check(hm(n)),t.trim=()=>t.check(vm()),t.normalize=(...n)=>t.check(_m(...n)),t.toLowerCase=()=>t.check(bm()),t.toUpperCase=()=>t.check(wm())}),zL=P("ZodString",(t,e)=>{la.init(t,e),lS.init(t,e),t.email=r=>t.check(qh(ML,r)),t.url=r=>t.check(Vh(LL,r)),t.jwt=r=>t.check(om(QL,r)),t.emoji=r=>t.check(Bh(qL,r)),t.guid=r=>t.check($u(aS,r)),t.uuid=r=>t.check(Zh(Mu,r)),t.uuidv4=r=>t.check(Dh(Mu,r)),t.uuidv6=r=>t.check(Fh(Mu,r)),t.uuidv7=r=>t.check(Uh(Mu,r)),t.nanoid=r=>t.check(Hh(ZL,r)),t.guid=r=>t.check($u(aS,r)),t.cuid=r=>t.check(Kh(DL,r)),t.cuid2=r=>t.check(Gh(FL,r)),t.ulid=r=>t.check(Jh(UL,r)),t.base64=r=>t.check(rm(WL,r)),t.base64url=r=>t.check(nm(YL,r)),t.xid=r=>t.check(Wh(VL,r)),t.ksuid=r=>t.check(Yh(BL,r)),t.ipv4=r=>t.check(Xh(HL,r)),t.ipv6=r=>t.check(Qh(KL,r)),t.cidrv4=r=>t.check(em(GL,r)),t.cidrv6=r=>t.check(tm(JL,r)),t.e164=r=>t.check(sm(XL,r)),t.datetime=r=>t.check(Tm(r)),t.date=r=>t.check($m(r)),t.time=r=>t.check(Im(r)),t.duration=r=>t.check(Om(r))});function I(t){return Lh(zL,t)}var Ge=P("ZodStringFormat",(t,e)=>{qe.init(t,e),lS.init(t,e)}),ML=P("ZodEmail",(t,e)=>{eh.init(t,e),Ge.init(t,e)});var aS=P("ZodGUID",(t,e)=>{Xp.init(t,e),Ge.init(t,e)});var Mu=P("ZodUUID",(t,e)=>{Qp.init(t,e),Ge.init(t,e)});var LL=P("ZodURL",(t,e)=>{th.init(t,e),Ge.init(t,e)});var qL=P("ZodEmoji",(t,e)=>{rh.init(t,e),Ge.init(t,e)});var ZL=P("ZodNanoID",(t,e)=>{nh.init(t,e),Ge.init(t,e)});var DL=P("ZodCUID",(t,e)=>{sh.init(t,e),Ge.init(t,e)});var FL=P("ZodCUID2",(t,e)=>{oh.init(t,e),Ge.init(t,e)});var UL=P("ZodULID",(t,e)=>{ih.init(t,e),Ge.init(t,e)});var VL=P("ZodXID",(t,e)=>{ah.init(t,e),Ge.init(t,e)});var BL=P("ZodKSUID",(t,e)=>{ch.init(t,e),Ge.init(t,e)});var HL=P("ZodIPv4",(t,e)=>{uh.init(t,e),Ge.init(t,e)});var KL=P("ZodIPv6",(t,e)=>{lh.init(t,e),Ge.init(t,e)});var GL=P("ZodCIDRv4",(t,e)=>{dh.init(t,e),Ge.init(t,e)});var JL=P("ZodCIDRv6",(t,e)=>{fh.init(t,e),Ge.init(t,e)});var WL=P("ZodBase64",(t,e)=>{ph.init(t,e),Ge.init(t,e)});var YL=P("ZodBase64URL",(t,e)=>{hh.init(t,e),Ge.init(t,e)});var XL=P("ZodE164",(t,e)=>{mh.init(t,e),Ge.init(t,e)});var QL=P("ZodJWT",(t,e)=>{gh.init(t,e),Ge.init(t,e)});var dS=P("ZodNumber",(t,e)=>{ku.init(t,e),et.init(t,e),t.gt=(n,s)=>t.check(Ou(n,s)),t.gte=(n,s)=>t.check(pa(n,s)),t.min=(n,s)=>t.check(pa(n,s)),t.lt=(n,s)=>t.check(Iu(n,s)),t.lte=(n,s)=>t.check(fa(n,s)),t.max=(n,s)=>t.check(fa(n,s)),t.int=n=>t.check(cS(n)),t.safe=n=>t.check(cS(n)),t.positive=n=>t.check(Ou(0,n)),t.nonnegative=n=>t.check(pa(0,n)),t.negative=n=>t.check(Iu(0,n)),t.nonpositive=n=>t.check(fa(0,n)),t.multipleOf=(n,s)=>t.check(Pu(n,s)),t.step=(n,s)=>t.check(Pu(n,s)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function Ce(t){return im(dS,t)}var eq=P("ZodNumberFormat",(t,e)=>{yh.init(t,e),dS.init(t,e)});function cS(t){return am(eq,t)}var tq=P("ZodBoolean",(t,e)=>{_h.init(t,e),et.init(t,e)});function lt(t){return cm(tq,t)}var rq=P("ZodNull",(t,e)=>{vh.init(t,e),et.init(t,e)});function fS(t){return um(rq,t)}var nq=P("ZodUnknown",(t,e)=>{bh.init(t,e),et.init(t,e)});function Je(){return lm(nq)}var sq=P("ZodNever",(t,e)=>{wh.init(t,e),et.init(t,e)});function oq(t){return dm(sq,t)}var iq=P("ZodArray",(t,e)=>{xh.init(t,e),et.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Do(r,n)),t.nonempty=r=>t.check(Do(1,r)),t.max=(r,n)=>t.check(Cu(r,n)),t.length=(r,n)=>t.check(Nu(r,n)),t.unwrap=()=>t.element});function be(t,e){return Gx(iq,t,e)}var pS=P("ZodObject",(t,e)=>{Eu.init(t,e),et.init(t,e),ve.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>At(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Je()}),t.loose=()=>t.clone({...t._zod.def,catchall:Je()}),t.strict=()=>t.clone({...t._zod.def,catchall:oq()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>ve.extend(t,r),t.merge=r=>ve.merge(t,r),t.pick=r=>ve.pick(t,r),t.omit=r=>ve.omit(t,r),t.partial=(...r)=>ve.partial(gS,t,r[0]),t.required=(...r)=>ve.required(yS,t,r[0])});function K(t,e){let r={type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},...ve.normalizeParams(e)};return new pS(r)}function Et(t,e){return new pS({type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},catchall:Je(),...ve.normalizeParams(e)})}var hS=P("ZodUnion",(t,e)=>{Tu.init(t,e),et.init(t,e),t.options=e.options});function Ue(t,e){return new hS({type:"union",options:t,...ve.normalizeParams(e)})}var aq=P("ZodDiscriminatedUnion",(t,e)=>{hS.init(t,e),Sh.init(t,e)});function Nm(t,e,r){return new aq({type:"union",options:e,discriminator:t,...ve.normalizeParams(r)})}var cq=P("ZodIntersection",(t,e)=>{kh.init(t,e),et.init(t,e)});function Lu(t,e){return new cq({type:"intersection",left:t,right:e})}var uq=P("ZodRecord",(t,e)=>{Eh.init(t,e),et.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function Ze(t,e,r){return new uq({type:"record",keyType:t,valueType:e,...ve.normalizeParams(r)})}var Pm=P("ZodEnum",(t,e)=>{Th.init(t,e),et.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,s)=>{let o={};for(let i of n)if(r.has(i))o[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Pm({...e,checks:[],...ve.normalizeParams(s),entries:o})},t.exclude=(n,s)=>{let o={...e.entries};for(let i of n)if(r.has(i))delete o[i];else throw new Error(`Key ${i} not found in enum`);return new Pm({...e,checks:[],...ve.normalizeParams(s),entries:o})}});function At(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Pm({type:"enum",entries:r,...ve.normalizeParams(e)})}var lq=P("ZodLiteral",(t,e)=>{$h.init(t,e),et.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function W(t,e){return new lq({type:"literal",values:Array.isArray(t)?t:[t],...ve.normalizeParams(e)})}var dq=P("ZodTransform",(t,e)=>{Ih.init(t,e),et.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=o=>{if(typeof o=="string")r.issues.push(ve.issue(o,r.value,e));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(ve.issue(i))}};let s=e.transform(r.value,r);return s instanceof Promise?s.then(o=>(r.value=o,r)):(r.value=s,r)}});function mS(t){return new dq({type:"transform",transform:t})}var gS=P("ZodOptional",(t,e)=>{Oh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function We(t){return new gS({type:"optional",innerType:t})}var fq=P("ZodNullable",(t,e)=>{Ph.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function uS(t){return new fq({type:"nullable",innerType:t})}var pq=P("ZodDefault",(t,e)=>{Ch.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function hq(t,e){return new pq({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var mq=P("ZodPrefault",(t,e)=>{Nh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function gq(t,e){return new mq({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var yS=P("ZodNonOptional",(t,e)=>{Ah.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function yq(t,e){return new yS({type:"nonoptional",innerType:t,...ve.normalizeParams(e)})}var _q=P("ZodCatch",(t,e)=>{Rh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function vq(t,e){return new _q({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var bq=P("ZodPipe",(t,e)=>{jh.init(t,e),et.init(t,e),t.in=e.in,t.out=e.out});function Cm(t,e){return new bq({type:"pipe",in:t,out:e})}var wq=P("ZodReadonly",(t,e)=>{zh.init(t,e),et.init(t,e)});function xq(t){return new wq({type:"readonly",innerType:t})}var _S=P("ZodCustom",(t,e)=>{Mh.init(t,e),et.init(t,e)});function Sq(t){let e=new pt({check:"custom"});return e._zod.check=t,e}function vS(t,e){return xm(_S,t??(()=>!0),e)}function kq(t,e={}){return Sm(_S,t,e)}function Eq(t){let e=Sq(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(ve.issue(n,r.value,e._zod.def));else{let s=n;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=!e._zod.def.abort),r.issues.push(ve.issue(s))}},t(r.value,r)));return e}function Am(t,e){return Cm(mS(t),e)}Bt(Fx());var jm="2025-11-25",bS="2025-03-26",Vo=[jm,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Pn="io.modelcontextprotocol/related-task",Zu="2.0",ct=vS(t=>t!==null&&(typeof t=="object"||typeof t=="function")),wS=Ue([I(),Ce().int()]),xS=I(),Xne=Et({ttl:Ce().optional(),pollInterval:Ce().optional()}),Tq=K({ttl:Ce().optional()}),$q=K({taskId:I()}),zm=Et({progressToken:wS.optional(),[Pn]:$q.optional()}),Kt=K({_meta:zm.optional()}),ga=Kt.extend({task:Tq.optional()}),SS=t=>ga.safeParse(t).success,ht=K({method:I(),params:Kt.loose().optional()}),er=K({_meta:zm.optional()}),tr=K({method:I(),params:er.loose().optional()}),mt=Et({_meta:zm.optional()}),Du=Ue([I(),Ce().int()]),kS=K({jsonrpc:W(Zu),id:Du,...ht.shape}).strict(),Cn=t=>kS.safeParse(t).success,ES=K({jsonrpc:W(Zu),...tr.shape}).strict(),TS=t=>ES.safeParse(t).success,Mm=K({jsonrpc:W(Zu),id:Du,result:mt}).strict(),an=t=>Mm.safeParse(t).success;var Q;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Q||(Q={}));var Lm=K({jsonrpc:W(Zu),id:Du.optional(),error:K({code:Ce().int(),message:I(),data:Je().optional()})}).strict();var Bo=t=>Lm.safeParse(t).success;var ya=Ue([kS,ES,Mm,Lm]),Qne=Ue([Mm,Lm]),Fu=mt.strict(),Iq=er.extend({requestId:Du.optional(),reason:I().optional()}),Uu=tr.extend({method:W("notifications/cancelled"),params:Iq}),Oq=K({src:I(),mimeType:I().optional(),sizes:be(I()).optional(),theme:At(["light","dark"]).optional()}),_a=K({icons:be(Oq).optional()}),Uo=K({name:I(),title:I().optional()}),$S=Uo.extend({...Uo.shape,..._a.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),Pq=Lu(K({applyDefaults:lt().optional()}),Ze(I(),Je())),Cq=Am(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Lu(K({form:Pq.optional(),url:ct.optional()}),Ze(I(),Je()).optional())),Nq=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({sampling:Et({createMessage:ct.optional()}).optional(),elicitation:Et({create:ct.optional()}).optional()}).optional()}),Aq=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({tools:Et({call:ct.optional()}).optional()}).optional()}),Rq=K({experimental:Ze(I(),ct).optional(),sampling:K({context:ct.optional(),tools:ct.optional()}).optional(),elicitation:Cq.optional(),roots:K({listChanged:lt().optional()}).optional(),tasks:Nq.optional(),extensions:Ze(I(),ct).optional()}),jq=Kt.extend({protocolVersion:I(),capabilities:Rq,clientInfo:$S}),Vu=ht.extend({method:W("initialize"),params:jq}),qm=t=>Vu.safeParse(t).success,zq=K({experimental:Ze(I(),ct).optional(),logging:ct.optional(),completions:ct.optional(),prompts:K({listChanged:lt().optional()}).optional(),resources:K({subscribe:lt().optional(),listChanged:lt().optional()}).optional(),tools:K({listChanged:lt().optional()}).optional(),tasks:Aq.optional(),extensions:Ze(I(),ct).optional()}),Mq=mt.extend({protocolVersion:I(),capabilities:zq,serverInfo:$S,instructions:I().optional()}),Zm=tr.extend({method:W("notifications/initialized"),params:er.optional()});var Bu=ht.extend({method:W("ping"),params:Kt.optional()}),Lq=K({progress:Ce(),total:We(Ce()),message:We(I())}),qq=K({...er.shape,...Lq.shape,progressToken:wS}),Hu=tr.extend({method:W("notifications/progress"),params:qq}),Zq=Kt.extend({cursor:xS.optional()}),va=ht.extend({params:Zq.optional()}),ba=mt.extend({nextCursor:xS.optional()}),Dq=At(["working","input_required","completed","failed","cancelled"]),wa=K({taskId:I(),status:Dq,ttl:Ue([Ce(),fS()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:We(Ce()),statusMessage:We(I())}),Ho=mt.extend({task:wa}),Fq=er.merge(wa),xa=tr.extend({method:W("notifications/tasks/status"),params:Fq}),Ku=ht.extend({method:W("tasks/get"),params:Kt.extend({taskId:I()})}),Gu=mt.merge(wa),Ju=ht.extend({method:W("tasks/result"),params:Kt.extend({taskId:I()})}),ese=mt.loose(),Wu=va.extend({method:W("tasks/list")}),Yu=ba.extend({tasks:be(wa)}),Xu=ht.extend({method:W("tasks/cancel"),params:Kt.extend({taskId:I()})}),IS=mt.merge(wa),OS=K({uri:I(),mimeType:We(I()),_meta:Ze(I(),Je()).optional()}),PS=OS.extend({text:I()}),Dm=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),CS=OS.extend({blob:Dm}),Sa=At(["user","assistant"]),Ko=K({audience:be(Sa).optional(),priority:Ce().min(0).max(1).optional(),lastModified:ha.datetime({offset:!0}).optional()}),NS=K({...Uo.shape,..._a.shape,uri:I(),description:We(I()),mimeType:We(I()),size:We(Ce()),annotations:Ko.optional(),_meta:We(Et({}))}),Uq=K({...Uo.shape,..._a.shape,uriTemplate:I(),description:We(I()),mimeType:We(I()),annotations:Ko.optional(),_meta:We(Et({}))}),Qu=va.extend({method:W("resources/list")}),Vq=ba.extend({resources:be(NS)}),el=va.extend({method:W("resources/templates/list")}),Bq=ba.extend({resourceTemplates:be(Uq)}),Fm=Kt.extend({uri:I()}),Hq=Fm,tl=ht.extend({method:W("resources/read"),params:Hq}),Kq=mt.extend({contents:be(Ue([PS,CS]))}),Gq=tr.extend({method:W("notifications/resources/list_changed"),params:er.optional()}),Jq=Fm,Wq=ht.extend({method:W("resources/subscribe"),params:Jq}),Yq=Fm,Xq=ht.extend({method:W("resources/unsubscribe"),params:Yq}),Qq=er.extend({uri:I()}),eZ=tr.extend({method:W("notifications/resources/updated"),params:Qq}),tZ=K({name:I(),description:We(I()),required:We(lt())}),rZ=K({...Uo.shape,..._a.shape,description:We(I()),arguments:We(be(tZ)),_meta:We(Et({}))}),rl=va.extend({method:W("prompts/list")}),nZ=ba.extend({prompts:be(rZ)}),sZ=Kt.extend({name:I(),arguments:Ze(I(),I()).optional()}),nl=ht.extend({method:W("prompts/get"),params:sZ}),Um=K({type:W("text"),text:I(),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),Vm=K({type:W("image"),data:Dm,mimeType:I(),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),Bm=K({type:W("audio"),data:Dm,mimeType:I(),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),oZ=K({type:W("tool_use"),name:I(),id:I(),input:Ze(I(),Je()),_meta:Ze(I(),Je()).optional()}),iZ=K({type:W("resource"),resource:Ue([PS,CS]),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),aZ=NS.extend({type:W("resource_link")}),Hm=Ue([Um,Vm,Bm,aZ,iZ]),cZ=K({role:Sa,content:Hm}),uZ=mt.extend({description:I().optional(),messages:be(cZ)}),lZ=tr.extend({method:W("notifications/prompts/list_changed"),params:er.optional()}),dZ=K({title:I().optional(),readOnlyHint:lt().optional(),destructiveHint:lt().optional(),idempotentHint:lt().optional(),openWorldHint:lt().optional()}),fZ=K({taskSupport:At(["required","optional","forbidden"]).optional()}),AS=K({...Uo.shape,..._a.shape,description:I().optional(),inputSchema:K({type:W("object"),properties:Ze(I(),ct).optional(),required:be(I()).optional()}).catchall(Je()),outputSchema:K({type:W("object"),properties:Ze(I(),ct).optional(),required:be(I()).optional()}).catchall(Je()).optional(),annotations:dZ.optional(),execution:fZ.optional(),_meta:Ze(I(),Je()).optional()}),sl=va.extend({method:W("tools/list")}),pZ=ba.extend({tools:be(AS)}),ol=mt.extend({content:be(Hm).default([]),structuredContent:Ze(I(),Je()).optional(),isError:lt().optional()}),tse=ol.or(mt.extend({toolResult:Je()})),hZ=ga.extend({name:I(),arguments:Ze(I(),Je()).optional()}),Go=ht.extend({method:W("tools/call"),params:hZ}),mZ=tr.extend({method:W("notifications/tools/list_changed"),params:er.optional()}),rse=K({autoRefresh:lt().default(!0),debounceMs:Ce().int().nonnegative().default(300)}),ka=At(["debug","info","notice","warning","error","critical","alert","emergency"]),gZ=Kt.extend({level:ka}),Km=ht.extend({method:W("logging/setLevel"),params:gZ}),yZ=er.extend({level:ka,logger:I().optional(),data:Je()}),_Z=tr.extend({method:W("notifications/message"),params:yZ}),vZ=K({name:I().optional()}),bZ=K({hints:be(vZ).optional(),costPriority:Ce().min(0).max(1).optional(),speedPriority:Ce().min(0).max(1).optional(),intelligencePriority:Ce().min(0).max(1).optional()}),wZ=K({mode:At(["auto","required","none"]).optional()}),xZ=K({type:W("tool_result"),toolUseId:I().describe("The unique identifier for the corresponding tool call."),content:be(Hm).default([]),structuredContent:K({}).loose().optional(),isError:lt().optional(),_meta:Ze(I(),Je()).optional()}),SZ=Nm("type",[Um,Vm,Bm]),qu=Nm("type",[Um,Vm,Bm,oZ,xZ]),kZ=K({role:Sa,content:Ue([qu,be(qu)]),_meta:Ze(I(),Je()).optional()}),EZ=ga.extend({messages:be(kZ),modelPreferences:bZ.optional(),systemPrompt:I().optional(),includeContext:At(["none","thisServer","allServers"]).optional(),temperature:Ce().optional(),maxTokens:Ce().int(),stopSequences:be(I()).optional(),metadata:ct.optional(),tools:be(AS).optional(),toolChoice:wZ.optional()}),TZ=ht.extend({method:W("sampling/createMessage"),params:EZ}),Ea=mt.extend({model:I(),stopReason:We(At(["endTurn","stopSequence","maxTokens"]).or(I())),role:Sa,content:SZ}),Gm=mt.extend({model:I(),stopReason:We(At(["endTurn","stopSequence","maxTokens","toolUse"]).or(I())),role:Sa,content:Ue([qu,be(qu)])}),$Z=K({type:W("boolean"),title:I().optional(),description:I().optional(),default:lt().optional()}),IZ=K({type:W("string"),title:I().optional(),description:I().optional(),minLength:Ce().optional(),maxLength:Ce().optional(),format:At(["email","uri","date","date-time"]).optional(),default:I().optional()}),OZ=K({type:At(["number","integer"]),title:I().optional(),description:I().optional(),minimum:Ce().optional(),maximum:Ce().optional(),default:Ce().optional()}),PZ=K({type:W("string"),title:I().optional(),description:I().optional(),enum:be(I()),default:I().optional()}),CZ=K({type:W("string"),title:I().optional(),description:I().optional(),oneOf:be(K({const:I(),title:I()})),default:I().optional()}),NZ=K({type:W("string"),title:I().optional(),description:I().optional(),enum:be(I()),enumNames:be(I()).optional(),default:I().optional()}),AZ=Ue([PZ,CZ]),RZ=K({type:W("array"),title:I().optional(),description:I().optional(),minItems:Ce().optional(),maxItems:Ce().optional(),items:K({type:W("string"),enum:be(I())}),default:be(I()).optional()}),jZ=K({type:W("array"),title:I().optional(),description:I().optional(),minItems:Ce().optional(),maxItems:Ce().optional(),items:K({anyOf:be(K({const:I(),title:I()}))}),default:be(I()).optional()}),zZ=Ue([RZ,jZ]),MZ=Ue([NZ,AZ,zZ]),LZ=Ue([MZ,$Z,IZ,OZ]),qZ=ga.extend({mode:W("form").optional(),message:I(),requestedSchema:K({type:W("object"),properties:Ze(I(),LZ),required:be(I()).optional()})}),ZZ=ga.extend({mode:W("url"),message:I(),elicitationId:I(),url:I().url()}),DZ=Ue([qZ,ZZ]),FZ=ht.extend({method:W("elicitation/create"),params:DZ}),UZ=er.extend({elicitationId:I()}),VZ=tr.extend({method:W("notifications/elicitation/complete"),params:UZ}),Jo=mt.extend({action:At(["accept","decline","cancel"]),content:Am(t=>t===null?void 0:t,Ze(I(),Ue([I(),Ce(),lt(),be(I())])).optional())}),BZ=K({type:W("ref/resource"),uri:I()});var HZ=K({type:W("ref/prompt"),name:I()}),KZ=Kt.extend({ref:Ue([HZ,BZ]),argument:K({name:I(),value:I()}),context:K({arguments:Ze(I(),I()).optional()}).optional()}),il=ht.extend({method:W("completion/complete"),params:KZ});function RS(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function jS(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var GZ=mt.extend({completion:Et({values:be(I()).max(100),total:We(Ce().int()),hasMore:We(lt())})}),JZ=K({uri:I().startsWith("file://"),name:I().optional(),_meta:Ze(I(),Je()).optional()}),WZ=ht.extend({method:W("roots/list"),params:Kt.optional()}),Jm=mt.extend({roots:be(JZ)}),YZ=tr.extend({method:W("notifications/roots/list_changed"),params:er.optional()}),nse=Ue([Bu,Vu,il,Km,nl,rl,Qu,el,tl,Wq,Xq,Go,sl,Ku,Ju,Wu,Xu]),sse=Ue([Uu,Hu,Zm,YZ,xa]),ose=Ue([Fu,Ea,Gm,Jo,Jm,Gu,Yu,Ho]),ise=Ue([Bu,TZ,FZ,WZ,Ku,Ju,Wu,Xu]),ase=Ue([Uu,Hu,_Z,eZ,Gq,mZ,lZ,xa,VZ]),cse=Ue([Fu,Mq,GZ,uZ,nZ,Vq,Bq,Kq,ol,pZ,Gu,Yu,Ho]),J=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===Q.UrlElicitationRequired&&n){let s=n;if(s.elicitations)return new Rm(s.elicitations,r)}return new t(e,r,n)}},Rm=class extends J{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Q.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};f();function Nn(t){return t==="completed"||t==="failed"||t==="cancelled"}f();f();f();var MS=Symbol("Let zodToJsonSchema decide on which parser to use");var zS={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"},LS=t=>typeof t=="string"?{...zS,name:t}:{...zS,...t};f();var qS=t=>{let e=LS(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,s])=>[s._def,{def:s._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};f();function Wm(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function we(t,e,r,n,s){t[e]=r,Wm(t,e,n,s)}f();var al=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};f();f();f();function Ye(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?al(e,t.currentPath):e.join("/")}}f();function ZS(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==M.ZodAny&&(r.items=oe(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&we(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&we(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(we(r,"minItems",t.exactLength.value,t.exactLength.message,e),we(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}f();function DS(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?we(r,"minimum",n.value,n.message,e):we(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),we(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?we(r,"maximum",n.value,n.message,e):we(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),we(r,"maximum",n.value,n.message,e));break;case"multipleOf":we(r,"multipleOf",n.value,n.message,e);break}return r}f();function FS(){return{type:"boolean"}}f();function cl(t,e){return oe(t.type._def,e)}f();var US=(t,e)=>oe(t.innerType._def,e);f();function Ym(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((s,o)=>Ym(t,e,s))};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 XZ(t,e)}}var XZ=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":we(r,"minimum",n.value,n.message,e);break;case"max":we(r,"maximum",n.value,n.message,e);break}return r};f();function VS(t,e){return{...oe(t.innerType._def,e),default:t.defaultValue()}}f();function BS(t,e){return e.effectStrategy==="input"?oe(t.schema._def,e):Ye(e)}f();function HS(t){return{type:"string",enum:Array.from(t.values)}}f();var QZ=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function KS(t,e){let r=[oe(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),oe(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(o=>!!o),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,s=[];return r.forEach(o=>{if(QZ(o))s.push(...o.allOf),o.unevaluatedProperties===void 0&&(n=void 0);else{let i=o;if("additionalProperties"in o&&o.additionalProperties===!1){let{additionalProperties:a,...c}=o;i=c}else n=void 0;s.push(i)}}),s.length?{allOf:s,...n}:void 0}f();function GS(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}f();f();f();var Xm,vr={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:()=>(Xm===void 0&&(Xm=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xm),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 ul(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":we(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":we(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":br(r,"email",n.message,e);break;case"format:idn-email":br(r,"idn-email",n.message,e);break;case"pattern:zod":Tt(r,vr.email,n.message,e);break}break;case"url":br(r,"uri",n.message,e);break;case"uuid":br(r,"uuid",n.message,e);break;case"regex":Tt(r,n.regex,n.message,e);break;case"cuid":Tt(r,vr.cuid,n.message,e);break;case"cuid2":Tt(r,vr.cuid2,n.message,e);break;case"startsWith":Tt(r,RegExp(`^${Qm(n.value,e)}`),n.message,e);break;case"endsWith":Tt(r,RegExp(`${Qm(n.value,e)}$`),n.message,e);break;case"datetime":br(r,"date-time",n.message,e);break;case"date":br(r,"date",n.message,e);break;case"time":br(r,"time",n.message,e);break;case"duration":br(r,"duration",n.message,e);break;case"length":we(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),we(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Tt(r,RegExp(Qm(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&br(r,"ipv4",n.message,e),n.version!=="v4"&&br(r,"ipv6",n.message,e);break}case"base64url":Tt(r,vr.base64url,n.message,e);break;case"jwt":Tt(r,vr.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Tt(r,vr.ipv4Cidr,n.message,e),n.version!=="v4"&&Tt(r,vr.ipv6Cidr,n.message,e);break}case"emoji":Tt(r,vr.emoji(),n.message,e);break;case"ulid":{Tt(r,vr.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{br(r,"binary",n.message,e);break}case"contentEncoding:base64":{we(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Tt(r,vr.base64,n.message,e);break}}break}case"nanoid":Tt(r,vr.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Qm(t,e){return e.patternStrategy==="escape"?tD(t):t}var eD=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function tD(t){let e="";for(let r=0;r<t.length;r++)eD.has(t[r])||(e+="\\"),e+=t[r];return e}function br(t,e,r,n){t.format||t.anyOf?.some(s=>s.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):we(t,"format",e,r,n)}function Tt(t,e,r,n){t.pattern||t.allOf?.some(s=>s.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:JS(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):we(t,"pattern",JS(e,n),r,n)}function JS(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,s="",o=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(o){s+=n[c],o=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(s+=n[c],s+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(s+=n[c],a=!0):s+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){s+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){s+=`(^|(?<=[\r
|
|
204
204
|
]))`;continue}else if(n[c]==="$"){s+=`($|(?=[\r
|
|
205
205
|
]))`;continue}}if(r.s&&n[c]==="."){s+=i?`${n[c]}\r
|
|
206
206
|
`:`[${n[c]}\r
|
|
207
|
-
]`;continue}s+=n[c],n[c]==="\\"?o=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return s}function ll(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===M.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,s)=>({...n,[s]:oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",s]})??Ye(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===M.ZodString&&t.keyType._def.checks?.length){let{type:n,...s}=ul(t.keyType._def,e);return{...r,propertyNames:s}}else{if(t.keyType?._def.typeName===M.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===M.ZodBranded&&t.keyType._def.type._def.typeName===M.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...s}=cl(t.keyType._def,e);return{...r,propertyNames:s}}}return r}function JS(t,e){if(e.mapStrategy==="record")return ll(t,e);let r=oe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Ye(e),n=oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Ye(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}f();function WS(t){let e=t.values,n=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),s=Array.from(new Set(n.map(o=>typeof o)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}f();function YS(t){return t.target==="openAi"?void 0:{not:Ye({...t,currentPath:[...t.currentPath,"not"]})}}f();function XS(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}f();f();var Ta={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ek(t,e){if(e.target==="openApi3")return QS(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Ta&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((s,o)=>{let i=Ta[o._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((s,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(o._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){let s=n.filter((o,i,a)=>a.indexOf(o)===i);return{type:s.length>1?s:s[0],enum:r.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(o=>!n.includes(o))],[])};return QS(t,e)}var QS=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,s)=>oe(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function tk(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Ta[t.innerType._def.typeName],nullable:!0}:{type:[Ta[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=oe(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=oe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}f();function rk(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Wm(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?we(r,"minimum",n.value,n.message,e):we(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),we(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?we(r,"maximum",n.value,n.message,e):we(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),we(r,"maximum",n.value,n.message,e));break;case"multipleOf":we(r,"multipleOf",n.value,n.message,e);break}return r}f();function nk(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},s=[],o=t.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=XZ(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=oe(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||s.push(a))}s.length&&(n.required=s);let i=YZ(t,e);return i!==void 0&&(n.additionalProperties=i),n}function YZ(t,e){if(t.catchall._def.typeName!=="ZodNever")return oe(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function XZ(t){try{return t.isOptional()}catch{return!0}}f();var sk=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return oe(t.innerType._def,e);let r=oe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ye(e)},r]}:Ye(e)};f();var ok=(t,e)=>{if(e.pipeStrategy==="input")return oe(t.in._def,e);if(e.pipeStrategy==="output")return oe(t.out._def,e);let r=oe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=oe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};f();function ik(t,e){return oe(t.type._def,e)}f();function ak(t,e){let n={type:"array",uniqueItems:!0,items:oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&we(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&we(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}f();function ck(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>oe(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:oe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>oe(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}f();function uk(t){return{not:Ye(t)}}f();function lk(t){return Ye(t)}f();var dk=(t,e)=>oe(t.innerType._def,e);var fk=(t,e,r)=>{switch(e){case M.ZodString:return ul(t,r);case M.ZodNumber:return rk(t,r);case M.ZodObject:return nk(t,r);case M.ZodBigInt:return ZS(t,r);case M.ZodBoolean:return DS();case M.ZodDate:return Ym(t,r);case M.ZodUndefined:return uk(r);case M.ZodNull:return XS(r);case M.ZodArray:return qS(t,r);case M.ZodUnion:case M.ZodDiscriminatedUnion:return ek(t,r);case M.ZodIntersection:return HS(t,r);case M.ZodTuple:return ck(t,r);case M.ZodRecord:return ll(t,r);case M.ZodLiteral:return KS(t,r);case M.ZodEnum:return BS(t);case M.ZodNativeEnum:return WS(t);case M.ZodNullable:return tk(t,r);case M.ZodOptional:return sk(t,r);case M.ZodMap:return JS(t,r);case M.ZodSet:return ak(t,r);case M.ZodLazy:return()=>t.getter()._def;case M.ZodPromise:return ik(t,r);case M.ZodNaN:case M.ZodNever:return YS(r);case M.ZodEffects:return VS(t,r);case M.ZodAny:return Ye(r);case M.ZodUnknown:return lk(r);case M.ZodDefault:return US(t,r);case M.ZodBranded:return cl(t,r);case M.ZodReadonly:return dk(t,r);case M.ZodCatch:return FS(t,r);case M.ZodPipeline:return ok(t,r);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return(n=>{})(e)}};function oe(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==zS)return a}if(n&&!r){let a=QZ(n,e);if(a!==void 0)return a}let s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);let o=fk(t,t.typeName,e),i=typeof o=="function"?oe(o(),e):o;if(i&&eD(t,e,i),e.postProcess){let a=e.postProcess(i,t,e);return s.jsonSchema=i,a}return s.jsonSchema=i,i}var QZ=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:al(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Ye(e)):e.$refStrategy==="seen"?Ye(e):void 0}},eD=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);f();f();var eg=(t,e)=>{let r=LS(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:oe(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??Ye(r)}),{}):void 0,s=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=oe(t._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??Ye(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=s===void 0?n?{...o,[r.definitionPath]:n}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:o}};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 tD(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function tg(t,e){return Qt(t)?km(t,{target:tD(e?.target),io:e?.pipeStrategy??"input"}):eg(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function rg(t){let r=Pn(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=zu(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function ng(t,e){let r=In(t,e);if(!r.success)throw r.error;return r.data}var rD=6e4,dl=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Uu,r=>{this._oncancel(r)}),this.setNotificationHandler(Hu,r=>{this._onprogress(r)}),this.setRequestHandler(Bu,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ku,async(r,n)=>{let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new J(Q.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(Ju,async(r,n)=>{let s=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,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,p=new J(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(o,n.sessionId);if(!i)throw new J(Q.InvalidParams,`Task not found: ${o}`);if(!An(i.status))return await this._waitForTaskUpdate(o,n.signal),await s();if(An(i.status)){let a=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[On]:{taskId:o}}}}return await s()};return await s()}),this.setRequestHandler(Wu,async(r,n)=>{try{let{tasks:s,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:s,nextCursor:o,_meta:{}}}catch(s){throw new J(Q.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(Xu,async(r,n)=>{try{let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new J(Q.InvalidParams,`Task not found: ${r.params.taskId}`);if(An(s.status))throw new J(Q.InvalidParams,`Cannot cancel task in terminal status: ${s.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new J(Q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(s){throw s instanceof J?s:new J(Q.InvalidRequest,`Failed to cancel task: ${s instanceof Error?s.message:String(s)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,s,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:s})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),J.fromError(Q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){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=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let s=this._transport?.onmessage;this._transport.onmessage=(o,i)=>{s?.(o,i),an(o)||Bo(o)?this._onresponse(o):Cn(o)?this._onrequest(o,i):ES(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=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=J.fromError(Q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,s=this._transport,o=e.params?._meta?.[On]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Q.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},s?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):s?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=xS(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,s?.sessionId):void 0,u={signal:i.signal,sessionId:s?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new J(Q.ConnectionClosed,"Request was cancelled");let g={...p,relatedRequestId:e.id};o&&!g.relatedTask&&(g.relatedTask={taskId:o});let h=g.relatedTask?.taskId??o;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,g)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},s?.sessionId):await s?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},s?.sessionId):await s?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,s=Number(r),o=this._progressHandlers.get(s);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),an(e))n(e);else{let i=new J(e.error.code,e.error.message,e.error.data);n(i)}return}let s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(an(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),an(e))s(e);else{let i=J.fromError(e.error.code,e.error.message,e.error.data);s(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:s}=n??{};if(!s){try{yield{type:"result",result:await this.request(e,r,n)}}catch(i){yield{type:"error",error:i instanceof J?i:new J(Q.InternalError,String(i))}}return}let o;try{let i=await this.request(e,Ho,n);if(i.task)o=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new J(Q.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:a},An(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:a.status==="failed"?yield{type:"error",error:new J(Q.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new J(Q.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof J?i:new J(Q.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),g.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(g.params={...g.params,task:a}),c&&(g.params={...g.params,_meta:{...g.params?._meta||{},[On]:c}});let h=w=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(w)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let x=w instanceof J?w:new J(Q.RequestTimeout,String(w));l(x)};this._responseHandlers.set(p,w=>{if(!n?.signal?.aborted){if(w instanceof Error)return l(w);try{let x=In(r,w.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let m=n?.timeout??rD,_=()=>h(J.fromError(Q.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let w=x=>{let T=this._responseHandlers.get(p);T?T(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(b,{type:"request",message:g,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),l(x)})}else this._transport.send(g,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Gu,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Yu,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},$S,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[On]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[On]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[On]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=rg(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,o)=>{let i=ng(e,s);return Promise.resolve(r(i,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=rg(e);this._notificationHandlers.set(n,s=>{let o=ng(e,s);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,s)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let s of n)if(s.type==="request"&&Cn(s.message)){let o=s.message.id,i=this._requestResolvers.get(o);i?(i(new J(Q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let s=await this._taskStore?.getTask(e);s?.pollInterval&&(n=s.pollInterval)}catch{}return new Promise((s,o)=>{if(r.aborted){o(new J(Q.InvalidRequest,"Request cancelled"));return}let i=setTimeout(s,n);r.addEventListener("abort",()=>{clearTimeout(i),o(new J(Q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async s=>{if(!e)throw new Error("No request provided");return await n.createTask(s,e.id,{method:e.method,params:e.params},r)},getTask:async s=>{let o=await n.getTask(s,r);if(!o)throw new J(Q.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(s,o,i)=>{await n.storeTaskResult(s,o,i,r);let a=await n.getTask(s,r);if(a){let c=xa.parse({method:"notifications/tasks/status",params:a});await this.notification(c),An(a.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,r),updateTaskStatus:async(s,o,i)=>{let a=await n.getTask(s,r);if(!a)throw new J(Q.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(An(a.status))throw new J(Q.InvalidParams,`Cannot update task "${s}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(s,o,i,r);let c=await n.getTask(s,r);if(c){let u=xa.parse({method:"notifications/tasks/status",params:c});await this.notification(u),An(c.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,r)}}};function pk(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function hk(t,e){let r={...t};for(let n in e){let s=n,o=e[s];if(o===void 0)continue;let i=r[s];pk(i)&&pk(o)?r[s]={...i,...o}:r[s]=o}return r}f();var e$=se(Fy(),1),t$=se(QT(),1);function K9(){let t=new e$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,t$.default)(t),t}var Kl=class{constructor(e){this._ajv=e??K9()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};f();var Gl=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages[e.messages.length-1],o=Array.isArray(s.content)?s.content:[s.content],i=o.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(o.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(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(o.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))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:e},Ea,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),s=e.mode??"form";switch(s){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 o=s==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Jo,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};f();function r$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function n$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Jl=class extends dl{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ka.options.map((n,s)=>[n,s])),this.isMessageIgnored=(n,s)=>{let o=this._loggingLevels.get(s);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Kl,this.setRequestHandler(Vu,n=>this._oninitialize(n)),this.setNotificationHandler(Zm,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Km,async(n,s)=>{let o=s.sessionId||s.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=ka.safeParse(i);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Gl(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=hk(this._capabilities,e)}setRequestHandler(e,r){let s=Pn(e)?.method;if(!s)throw new Error("Schema is missing a method literal");let o;if(Qt(s)){let a=s;o=a._zod?.def?.value??a.value}else{let a=s;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(c,u)=>{let l=In(Go,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new J(Q.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=In(Ho,p);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new J(Q.InvalidParams,`Invalid task creation result: ${m}`)}return h.data}let g=In(ol,p);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new J(Q.InvalidParams,`Invalid tools/call result: ${h}`)}return g.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){n$(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&r$(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Vo.includes(r)?r:jm,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"},Fu)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],o=s.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(o){if(s.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(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Gm,r):this.request({method:"sampling/createMessage",params:e},Ea,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let s=e;return this.request({method:"elicitation/create",params:s},Jo,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let s=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:s},Jo,r);if(o.action==="accept"&&o.content&&s.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(s.requestedSchema)(o.content);if(!a.valid)throw new J(Q.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof J?i:new J(Q.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Jm,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};f();var o$=Symbol.for("mcp.completable");function Wy(t){return!!t&&typeof t=="object"&&o$ in t}function i$(t){return t[o$]?.complete}var s$;(function(t){t.Completable="McpCompletable"})(s$||(s$={}));f();f();var G9=/^[A-Za-z0-9._-]{1,128}$/;function J9(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!G9.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,s,o)=>o.indexOf(n)===s);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function W9(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Yy(t){let e=J9(t);return W9(t,e.warnings),e.isValid}f();var Wl=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){let s={taskSupport:"required",...r.execution};if(s.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,s,r._meta,n)}};f();var pi=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Jl(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Wl(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Dn(sl)),this.server.assertCanSetRequestHandler(Dn(Go)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(sl,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let s=Fo(r.inputSchema);return s?tg(s,{strictUnions:!0,pipeStrategy:"input"}):Y9})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let s=Fo(r.outputSchema);s&&(n.outputSchema=tg(s,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Go,async(e,r)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new J(Q.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new J(Q.InvalidParams,`Tool ${e.params.name} disabled`);let s=!!e.params.task,o=n.execution?.taskSupport,i="createTask"in n.handler;if((o==="required"||o==="optional")&&!i)throw new J(Q.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!s)throw new J(Q.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!s&&i)return await this.handleAutomaticTaskPolling(n,e,r);let a=await this.validateToolInput(n,e.params.arguments,e.params.name),c=await this.executeToolHandler(n,a,r);return s||await this.validateToolOutput(n,c,e.params.name),c}catch(n){if(n instanceof J&&n.code===Q.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;let o=Fo(e.inputSchema)??e.inputSchema,i=await Ru(o,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=ju(a);throw new J(Q.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return i.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new J(Q.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let s=Fo(e.outputSchema),o=await Ru(s,r.structuredContent);if(!o.success){let i="error"in o?o.error:"Unknown error",a=ju(i);throw new J(Q.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(e,r,n){let s=e.handler;if("createTask"in s){if(!n.taskStore)throw new Error("No task store provided.");let i={...n,taskStore:n.taskStore};if(e.inputSchema){let a=s;return await Promise.resolve(a.createTask(r,i))}else{let a=s;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=s;return await Promise.resolve(i(r,n))}else{let i=s;return await Promise.resolve(i(n))}}async handleAutomaticTaskPolling(e,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let s=await this.validateToolInput(e,r.params.arguments,r.params.name),o=e.handler,i={...n,taskStore:n.taskStore},a=s?await Promise.resolve(o.createTask(s,i)):await Promise.resolve(o.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(p=>setTimeout(p,l));let d=await n.taskStore.getTask(c);if(!d)throw new J(Q.InternalError,`Task ${c} not found during polling`);u=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Dn(il)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(il,async e=>{switch(e.params.ref.type){case"ref/prompt":return NS(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return RS(e),this.handleResourceCompletion(e,e.params.ref);default:throw new J(Q.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new J(Q.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new J(Q.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return rc;let o=Pn(n.argsSchema)?.[e.params.argument.name];if(!Wy(o))return rc;let i=i$(o);if(!i)return rc;let a=await i(e.params.argument.value,e.params.context);return c$(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return rc;throw new J(Q.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let s=n.resourceTemplate.completeCallback(e.params.argument.name);if(!s)return rc;let o=await s(e.params.argument.value,e.params.context);return c$(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Dn(Qu)),this.server.assertCanSetRequestHandler(Dn(el)),this.server.assertCanSetRequestHandler(Dn(tl)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Qu,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([o,i])=>i.enabled).map(([o,i])=>({uri:o,name:i.name,...i.metadata})),s=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let i=await o.resourceTemplate.listCallback(r);for(let a of i.resources)s.push({...o.metadata,...a})}return{resources:[...n,...s]}}),this.server.setRequestHandler(el,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(tl,async(e,r)=>{let n=new URL(e.params.uri),s=this._registeredResources[n.toString()];if(s){if(!s.enabled)throw new J(Q.InvalidParams,`Resource ${n} disabled`);return s.readCallback(n,r)}for(let o of Object.values(this._registeredResourceTemplates)){let i=o.resourceTemplate.uriTemplate.match(n.toString());if(i)return o.readCallback(n,i,r)}throw new J(Q.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Dn(rl)),this.server.assertCanSetRequestHandler(Dn(nl)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(rl,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?X9(r.argsSchema):void 0}))})),this.server.setRequestHandler(nl,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new J(Q.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new J(Q.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let s=Fo(n.argsSchema),o=await Ru(s,e.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",u=ju(c);throw new J(Q.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=o.data,a=n.callback;return await Promise.resolve(a(i,r))}else{let s=n.callback;return await Promise.resolve(s(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...n){let s;typeof n[0]=="object"&&(s=n.shift());let o=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,s){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,r,n,s,o){let i={name:e,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,s,o){let i={resourceTemplate:n,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!n.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,n,s,o){let i={title:r,description:n,argsSchema:s===void 0?void 0:As(s),callback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=As(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,s&&Object.values(s).some(c=>{let u=c instanceof Ct?c._def?.innerType:c;return Wy(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,n,s,o,i,a,c,u){Yy(e);let l={title:r,description:n,inputSchema:a$(s),outputSchema:a$(o),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&Yy(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=As(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=As(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,s,o,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(Xy(c))s=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Xy(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,n,s,o,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:s,description:o,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,s,o,i,a,c,{taskSupport:"forbidden"},u,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let s;r.length>1&&(s=r.shift());let o=r[0],i=this._createRegisteredPrompt(e,void 0,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:s,description:o,argsSchema:i}=r,a=this._createRegisteredPrompt(e,s,o,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Y9={type:"object",properties:{}};function u$(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function l$(t){return"_def"in t||"_zod"in t||u$(t)}function Xy(t){return typeof t!="object"||t===null||l$(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(u$)}function a$(t){if(t){if(Xy(t))return As(t);if(!l$(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function X9(t){let e=Pn(t);return e?Object.entries(e).map(([r,n])=>{let s=Jx(n),o=Wx(n);return{name:r,description:s,required:!o}}):[]}function Dn(t){let r=Pn(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=zu(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function c$(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var rc={completion:{values:[],hasMore:!1}};var v0=se(wi(),1),b0=se(Oe(),1);f();f();var FP=se(Oe(),1),iG=3e4,lo=class{baseUrl;apiKey;timeoutMs;accessToken;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey,this.accessToken=e.accessToken,this.timeoutMs=e.timeoutMs??iG}async searchTools(e){return this.post("/v1/search",e)}async searchToolsRespond(e){return this.post("/v1/search/respond",e)}async checkCompatibility(e){return this.post("/v1/graph/compatibility",e)}async compareTools(e){return this.post("/v1/graph/compare",e)}async getStack(e){return this.post("/v1/graph/stack",e)}async refineRequirement(e){return this.post("/v1/intelligence/refine",e)}async verifySuggestion(e){return this.post("/v1/intelligence/verify",e)}async checkIssue(e){return this.post("/v1/intelligence/issue",e)}async batchResolve(e){let r=[],n=new Map,s=new Map;if(e.length===0)return{results:[],warnings:r,methods:n,githubUrls:s};try{let o=await this.rawPost("/v1/tools/batch-resolve",{api_version:"1",tools:e});if(o.status===404)return r.push({scope:"batch-resolve",message:"/v1/tools/batch-resolve not deployed on this engine \u2014 falling back to offline classification (source: non_oss)."}),{results:e.map(c=>({input:c,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s};if(!o.ok)return r.push({scope:"batch-resolve",message:`batch-resolve returned HTTP ${o.status} \u2014 all tools marked as non_oss.`}),{results:e.map(c=>({input:c,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s};let i=await o.json();if(!Array.isArray(i.resolved))return r.push({scope:"batch-resolve",message:"batch-resolve returned unexpected body shape \u2014 falling back."}),{results:e.map(c=>({input:c,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s};let a=[];for(let c of i.resolved){let u=c.match_method??(c.matched?"tool_name_exact":"none"),l=c.matched??u!=="none",d=`${c.input.ecosystem}:${c.input.name}`;n.set(d,u),c.tool?.github_url&&s.set(d,c.tool.github_url),a.push({input:c.input,matched:l,match_method:u,tool:c.tool})}return{results:a,warnings:r,methods:n,githubUrls:s}}catch(o){return r.push({scope:"batch-resolve",message:`batch-resolve network failure: ${o instanceof Error?o.message:String(o)}. Tools classified as non_oss.`}),{results:e.map(i=>({input:i,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s}}}async reportOutcome(e){return this.post("/v1/feedback/outcome",e)}async suggestGraphUpdate(e){return this.post("/v1/feedback/suggest",e)}async register(e){return(await this.rawPost("/v1/register",{client_id:e})).json()}async healthCheck(){try{return(await fetch(`${this.baseUrl}/v1/health`,{signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}async post(e,r){try{let n=await this.rawPost(e,r);if(n.status===429&&n.headers.get("x-toolcairn-limit-exhausted")==="1")try{return{content:[{type:"text",text:(await n.clone().json()).message??"ToolCairn daily limit reached. Join the Pro waitlist for 1 month free: https://toolcairn.neurynae.com/waitlist?source=limit_exhausted"}]}}catch{}let s=await n.json();return s&&typeof s=="object"&&"content"in s?s:{content:[{type:"text",text:JSON.stringify(s)}]}}catch(n){let s=n instanceof Error?n.message:String(n);return{content:[{type:"text",text:JSON.stringify({ok:!1,error:FP.ErrorCode.ERR_NETWORK_UNREACHABLE,message:`ToolCairn API unreachable: ${s}. Check your internet connection or try again later.`})}],isError:!0}}}rawPost(e,r){let n={"Content-Type":"application/json","X-ToolCairn-Key":this.apiKey,"Accept-Encoding":"gzip"};return this.accessToken&&(n.Authorization=`Bearer ${this.accessToken}`),fetch(`${this.baseUrl}${e}`,{method:"POST",headers:n,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeoutMs)})}};f();import{mkdir as UP,readFile as VP,writeFile as BP}from"fs/promises";import{homedir as aG}from"os";import{join as lv}from"path";var Pd=lv(aG(),".toolcairn"),HP=lv(Pd,"credentials.json"),dv=lv(Pd,"pending-auth.json");async function fv(t){await UP(Pd,{recursive:!0}),await BP(dv,JSON.stringify(t,null,2),"utf-8")}async function dc(){try{let t=await VP(dv,"utf-8"),e=JSON.parse(t);return new Date(e.expires_at)<new Date?(await fc(),null):e}catch{return null}}async function fc(){try{let{unlink:t}=await import("fs/promises");await t(dv)}catch{}}function Ti(t){if(!t.access_token)return!1;try{let e=t.access_token.split(".");if(e.length!==3)return!1;let r=JSON.parse(Buffer.from(e[1]??"","base64url").toString("utf-8"));return!(r.exp&&r.exp<Date.now()/1e3+300)}catch{return!1}}async function Pr(){try{let t=await VP(HP,"utf-8");return JSON.parse(t)}catch{return null}}async function pv(){let t=await Pr();if(t)return t;let e={client_id:crypto.randomUUID(),created_at:new Date().toISOString()};return await Od(e),e}async function Od(t){await UP(Pd,{recursive:!0}),await BP(HP,JSON.stringify(t,null,2),"utf-8")}async function hv(t,e,r){let n=await pv();await Od({...n,client_id:e,access_token:t,user_id:r.id,user_email:r.email??void 0,user_name:r.name??void 0,authenticated_at:new Date().toISOString()})}async function mv(){let t=await pv();await Od({client_id:t.client_id,created_at:t.created_at,api_url:t.api_url})}f();var yn=se(Oe(),1);async function cG(t){let{spawn:e}=await import("child_process");try{let r=process.platform,n,s;r==="win32"?(n="cmd",s=["/c","start","",t]):r==="darwin"?(n="open",s=[t]):(n="xdg-open",s=[t]),e(n,s,{detached:!0,stdio:"ignore",shell:!1}).unref()}catch{}}async function Cd(t){let e=await fetch(`${t}/v1/auth/device-code`,{method:"POST"});if(!e.ok)throw new yn.NetworkError({code:yn.ErrorCode.ERR_NETWORK_UNREACHABLE,message:"Failed to start device auth. Check your internet connection."});let r=await e.json();return await fv({device_code:r.device_code,user_code:r.user_code,verification_uri:r.verification_uri,expires_at:new Date(Date.now()+r.expires_in*1e3).toISOString(),api_url:t}),process.stderr.write(`
|
|
207
|
+
]`;continue}s+=n[c],n[c]==="\\"?o=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return s}function ll(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===M.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,s)=>({...n,[s]:oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",s]})??Ye(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===M.ZodString&&t.keyType._def.checks?.length){let{type:n,...s}=ul(t.keyType._def,e);return{...r,propertyNames:s}}else{if(t.keyType?._def.typeName===M.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===M.ZodBranded&&t.keyType._def.type._def.typeName===M.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...s}=cl(t.keyType._def,e);return{...r,propertyNames:s}}}return r}function WS(t,e){if(e.mapStrategy==="record")return ll(t,e);let r=oe(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||Ye(e),n=oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||Ye(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}f();function YS(t){let e=t.values,n=Object.keys(t.values).filter(o=>typeof e[e[o]]!="number").map(o=>e[o]),s=Array.from(new Set(n.map(o=>typeof o)));return{type:s.length===1?s[0]==="string"?"string":"number":["string","number"],enum:n}}f();function XS(t){return t.target==="openAi"?void 0:{not:Ye({...t,currentPath:[...t.currentPath,"not"]})}}f();function QS(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}f();f();var Ta={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tk(t,e){if(e.target==="openApi3")return ek(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Ta&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((s,o)=>{let i=Ta[o._def.typeName];return i&&!s.includes(i)?[...s,i]:s},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((s,o)=>{let i=typeof o._def.value;switch(i){case"string":case"number":case"boolean":return[...s,i];case"bigint":return[...s,"integer"];case"object":if(o._def.value===null)return[...s,"null"];default:return s}},[]);if(n.length===r.length){let s=n.filter((o,i,a)=>a.indexOf(o)===i);return{type:s.length>1?s:s[0],enum:r.reduce((o,i)=>o.includes(i._def.value)?o:[...o,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,s)=>[...n,...s._def.values.filter(o=>!n.includes(o))],[])};return ek(t,e)}var ek=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,s)=>oe(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${s}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function rk(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Ta[t.innerType._def.typeName],nullable:!0}:{type:[Ta[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=oe(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=oe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}f();function nk(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Wm(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?we(r,"minimum",n.value,n.message,e):we(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),we(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?we(r,"maximum",n.value,n.message,e):we(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),we(r,"maximum",n.value,n.message,e));break;case"multipleOf":we(r,"multipleOf",n.value,n.message,e);break}return r}f();function sk(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},s=[],o=t.shape();for(let a in o){let c=o[a];if(c===void 0||c._def===void 0)continue;let u=nD(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=oe(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||s.push(a))}s.length&&(n.required=s);let i=rD(t,e);return i!==void 0&&(n.additionalProperties=i),n}function rD(t,e){if(t.catchall._def.typeName!=="ZodNever")return oe(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function nD(t){try{return t.isOptional()}catch{return!0}}f();var ok=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return oe(t.innerType._def,e);let r=oe(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ye(e)},r]}:Ye(e)};f();var ik=(t,e)=>{if(e.pipeStrategy==="input")return oe(t.in._def,e);if(e.pipeStrategy==="output")return oe(t.out._def,e);let r=oe(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=oe(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(s=>s!==void 0)}};f();function ak(t,e){return oe(t.type._def,e)}f();function ck(t,e){let n={type:"array",uniqueItems:!0,items:oe(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&we(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&we(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}f();function uk(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>oe(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:oe(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>oe(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}f();function lk(t){return{not:Ye(t)}}f();function dk(t){return Ye(t)}f();var fk=(t,e)=>oe(t.innerType._def,e);var pk=(t,e,r)=>{switch(e){case M.ZodString:return ul(t,r);case M.ZodNumber:return nk(t,r);case M.ZodObject:return sk(t,r);case M.ZodBigInt:return DS(t,r);case M.ZodBoolean:return FS();case M.ZodDate:return Ym(t,r);case M.ZodUndefined:return lk(r);case M.ZodNull:return QS(r);case M.ZodArray:return ZS(t,r);case M.ZodUnion:case M.ZodDiscriminatedUnion:return tk(t,r);case M.ZodIntersection:return KS(t,r);case M.ZodTuple:return uk(t,r);case M.ZodRecord:return ll(t,r);case M.ZodLiteral:return GS(t,r);case M.ZodEnum:return HS(t);case M.ZodNativeEnum:return YS(t);case M.ZodNullable:return rk(t,r);case M.ZodOptional:return ok(t,r);case M.ZodMap:return WS(t,r);case M.ZodSet:return ck(t,r);case M.ZodLazy:return()=>t.getter()._def;case M.ZodPromise:return ak(t,r);case M.ZodNaN:case M.ZodNever:return XS(r);case M.ZodEffects:return BS(t,r);case M.ZodAny:return Ye(r);case M.ZodUnknown:return dk(r);case M.ZodDefault:return VS(t,r);case M.ZodBranded:return cl(t,r);case M.ZodReadonly:return fk(t,r);case M.ZodCatch:return US(t,r);case M.ZodPipeline:return ik(t,r);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return(n=>{})(e)}};function oe(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==MS)return a}if(n&&!r){let a=sD(n,e);if(a!==void 0)return a}let s={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,s);let o=pk(t,t.typeName,e),i=typeof o=="function"?oe(o(),e):o;if(i&&oD(t,e,i),e.postProcess){let a=e.postProcess(i,t,e);return s.jsonSchema=i,a}return s.jsonSchema=i,i}var sD=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:al(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),Ye(e)):e.$refStrategy==="seen"?Ye(e):void 0}},oD=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);f();f();var eg=(t,e)=>{let r=qS(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:oe(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??Ye(r)}),{}):void 0,s=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,o=oe(t._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??Ye(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(o.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=s===void 0?n?{...o,[r.definitionPath]:n}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:o}};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 iD(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function tg(t,e){return Qt(t)?km(t,{target:iD(e?.target),io:e?.pipeStrategy??"input"}):eg(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function rg(t){let r=On(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=zu(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function ng(t,e){let r=In(t,e);if(!r.success)throw r.error;return r.data}var aD=6e4,dl=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Uu,r=>{this._oncancel(r)}),this.setNotificationHandler(Hu,r=>{this._onprogress(r)}),this.setRequestHandler(Bu,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ku,async(r,n)=>{let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new J(Q.InvalidParams,"Failed to retrieve task: Task not found");return{...s}}),this.setRequestHandler(Ju,async(r,n)=>{let s=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(o,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,p=new J(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(o,n.sessionId);if(!i)throw new J(Q.InvalidParams,`Task not found: ${o}`);if(!Nn(i.status))return await this._waitForTaskUpdate(o,n.signal),await s();if(Nn(i.status)){let a=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...a,_meta:{...a._meta,[Pn]:{taskId:o}}}}return await s()};return await s()}),this.setRequestHandler(Wu,async(r,n)=>{try{let{tasks:s,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:s,nextCursor:o,_meta:{}}}catch(s){throw new J(Q.InvalidParams,`Failed to list tasks: ${s instanceof Error?s.message:String(s)}`)}}),this.setRequestHandler(Xu,async(r,n)=>{try{let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new J(Q.InvalidParams,`Task not found: ${r.params.taskId}`);if(Nn(s.status))throw new J(Q.InvalidParams,`Cannot cancel task in terminal status: ${s.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new J(Q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(s){throw s instanceof J?s:new J(Q.InvalidRequest,`Failed to cancel task: ${s instanceof Error?s.message:String(s)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,s,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(s,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:s})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),J.fromError(Q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){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=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let s=this._transport?.onmessage;this._transport.onmessage=(o,i)=>{s?.(o,i),an(o)||Bo(o)?this._onresponse(o):Cn(o)?this._onrequest(o,i):TS(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=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=J.fromError(Q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,s=this._transport,o=e.params?._meta?.[Pn]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Q.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},s?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):s?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=SS(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,s?.sessionId):void 0,u={signal:i.signal,sessionId:s?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new J(Q.ConnectionClosed,"Request was cancelled");let g={...p,relatedRequestId:e.id};o&&!g.relatedTask&&(g.relatedTask={taskId:o});let h=g.relatedTask?.taskId??o;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,g)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},s?.sessionId):await s?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},s?.sessionId):await s?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,s=Number(r),o=this._progressHandlers.get(s);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(s),a=this._timeoutInfo.get(s);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(s)}catch(c){this._responseHandlers.delete(s),this._progressHandlers.delete(s),this._cleanupTimeout(s),i(c);return}o(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),an(e))n(e);else{let i=new J(e.error.code,e.error.message,e.error.data);n(i)}return}let s=this._responseHandlers.get(r);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(an(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(o=!0,this._taskProgressTokens.set(a.taskId,r))}}if(o||this._progressHandlers.delete(r),an(e))s(e);else{let i=J.fromError(e.error.code,e.error.message,e.error.data);s(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:s}=n??{};if(!s){try{yield{type:"result",result:await this.request(e,r,n)}}catch(i){yield{type:"error",error:i instanceof J?i:new J(Q.InternalError,String(i))}}return}let o;try{let i=await this.request(e,Ho,n);if(i.task)o=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new J(Q.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:a},Nn(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:a.status==="failed"?yield{type:"error",error:new J(Q.InternalError,`Task ${o} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new J(Q.InternalError,`Task ${o} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof J?i:new J(Q.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),g.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(g.params={...g.params,task:a}),c&&(g.params={...g.params,_meta:{...g.params?._meta||{},[Pn]:c}});let h=w=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(w)}},{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let x=w instanceof J?w:new J(Q.RequestTimeout,String(w));l(x)};this._responseHandlers.set(p,w=>{if(!n?.signal?.aborted){if(w instanceof Error)return l(w);try{let x=In(r,w.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let m=n?.timeout??aD,_=()=>h(J.fromError(Q.RequestTimeout,"Request timed out",{timeout:m}));this._setupTimeout(p,m,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let w=x=>{let T=this._responseHandlers.get(p);T?T(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage(b,{type:"request",message:g,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),l(x)})}else this._transport.send(g,{relatedRequestId:s,resumptionToken:o,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Gu,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Yu,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},IS,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Pn]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Pn]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Pn]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=rg(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(s,o)=>{let i=ng(e,s);return Promise.resolve(r(i,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=rg(e);this._notificationHandlers.set(n,s=>{let o=ng(e,s);return Promise.resolve(r(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let s=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,s)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let s of n)if(s.type==="request"&&Cn(s.message)){let o=s.message.id,i=this._requestResolvers.get(o);i?(i(new J(Q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let s=await this._taskStore?.getTask(e);s?.pollInterval&&(n=s.pollInterval)}catch{}return new Promise((s,o)=>{if(r.aborted){o(new J(Q.InvalidRequest,"Request cancelled"));return}let i=setTimeout(s,n);r.addEventListener("abort",()=>{clearTimeout(i),o(new J(Q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async s=>{if(!e)throw new Error("No request provided");return await n.createTask(s,e.id,{method:e.method,params:e.params},r)},getTask:async s=>{let o=await n.getTask(s,r);if(!o)throw new J(Q.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(s,o,i)=>{await n.storeTaskResult(s,o,i,r);let a=await n.getTask(s,r);if(a){let c=xa.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Nn(a.status)&&this._cleanupTaskProgressHandler(s)}},getTaskResult:s=>n.getTaskResult(s,r),updateTaskStatus:async(s,o,i)=>{let a=await n.getTask(s,r);if(!a)throw new J(Q.InvalidParams,`Task "${s}" not found - it may have been cleaned up`);if(Nn(a.status))throw new J(Q.InvalidParams,`Cannot update task "${s}" from terminal status "${a.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(s,o,i,r);let c=await n.getTask(s,r);if(c){let u=xa.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Nn(c.status)&&this._cleanupTaskProgressHandler(s)}},listTasks:s=>n.listTasks(s,r)}}};function hk(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function mk(t,e){let r={...t};for(let n in e){let s=n,o=e[s];if(o===void 0)continue;let i=r[s];hk(i)&&hk(o)?r[s]={...i,...o}:r[s]=o}return r}f();var t$=se(Fy(),1),r$=se(e$(),1);function X9(){let t=new t$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,r$.default)(t),t}var Kl=class{constructor(e){this._ajv=e??X9()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};f();var Gl=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages[e.messages.length-1],o=Array.isArray(s.content)?s.content:[s.content],i=o.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(o.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(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(o.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))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:e},Ea,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),s=e.mode??"form";switch(s){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 o=s==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Jo,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};f();function n$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function s$(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Jl=class extends dl{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ka.options.map((n,s)=>[n,s])),this.isMessageIgnored=(n,s)=>{let o=this._loggingLevels.get(s);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Kl,this.setRequestHandler(Vu,n=>this._oninitialize(n)),this.setNotificationHandler(Zm,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Km,async(n,s)=>{let o=s.sessionId||s.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=ka.safeParse(i);return a.success&&this._loggingLevels.set(o,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Gl(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=mk(this._capabilities,e)}setRequestHandler(e,r){let s=On(e)?.method;if(!s)throw new Error("Schema is missing a method literal");let o;if(Qt(s)){let a=s;o=a._zod?.def?.value??a.value}else{let a=s;o=a._def?.value??a.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let a=async(c,u)=>{let l=In(Go,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new J(Q.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=In(Ho,p);if(!h.success){let m=h.error instanceof Error?h.error.message:String(h.error);throw new J(Q.InvalidParams,`Invalid task creation result: ${m}`)}return h.data}let g=In(ol,p);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new J(Q.InvalidParams,`Invalid tools/call result: ${h}`)}return g.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){s$(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&n$(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Vo.includes(r)?r:jm,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"},Fu)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],o=s.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(o){if(s.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(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Gm,r):this.request({method:"sampling/createMessage",params:e},Ea,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let s=e;return this.request({method:"elicitation/create",params:s},Jo,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let s=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:s},Jo,r);if(o.action==="accept"&&o.content&&s.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(s.requestedSchema)(o.content);if(!a.valid)throw new J(Q.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof J?i:new J(Q.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return o}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Jm,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};f();var i$=Symbol.for("mcp.completable");function Wy(t){return!!t&&typeof t=="object"&&i$ in t}function a$(t){return t[i$]?.complete}var o$;(function(t){t.Completable="McpCompletable"})(o$||(o$={}));f();f();var Q9=/^[A-Za-z0-9._-]{1,128}$/;function eV(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Q9.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,s,o)=>o.indexOf(n)===s);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function tV(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Yy(t){let e=eV(t);return tV(t,e.warnings),e.isValid}f();var Wl=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){let s={taskSupport:"required",...r.execution};if(s.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,s,r._meta,n)}};f();var pi=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Jl(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Wl(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Dn(sl)),this.server.assertCanSetRequestHandler(Dn(Go)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(sl,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let s=Fo(r.inputSchema);return s?tg(s,{strictUnions:!0,pipeStrategy:"input"}):rV})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let s=Fo(r.outputSchema);s&&(n.outputSchema=tg(s,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Go,async(e,r)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new J(Q.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new J(Q.InvalidParams,`Tool ${e.params.name} disabled`);let s=!!e.params.task,o=n.execution?.taskSupport,i="createTask"in n.handler;if((o==="required"||o==="optional")&&!i)throw new J(Q.InternalError,`Tool ${e.params.name} has taskSupport '${o}' but was not registered with registerToolTask`);if(o==="required"&&!s)throw new J(Q.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(o==="optional"&&!s&&i)return await this.handleAutomaticTaskPolling(n,e,r);let a=await this.validateToolInput(n,e.params.arguments,e.params.name),c=await this.executeToolHandler(n,a,r);return s||await this.validateToolOutput(n,c,e.params.name),c}catch(n){if(n instanceof J&&n.code===Q.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;let o=Fo(e.inputSchema)??e.inputSchema,i=await Ru(o,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=ju(a);throw new J(Q.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return i.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new J(Q.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let s=Fo(e.outputSchema),o=await Ru(s,r.structuredContent);if(!o.success){let i="error"in o?o.error:"Unknown error",a=ju(i);throw new J(Q.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(e,r,n){let s=e.handler;if("createTask"in s){if(!n.taskStore)throw new Error("No task store provided.");let i={...n,taskStore:n.taskStore};if(e.inputSchema){let a=s;return await Promise.resolve(a.createTask(r,i))}else{let a=s;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=s;return await Promise.resolve(i(r,n))}else{let i=s;return await Promise.resolve(i(n))}}async handleAutomaticTaskPolling(e,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let s=await this.validateToolInput(e,r.params.arguments,r.params.name),o=e.handler,i={...n,taskStore:n.taskStore},a=s?await Promise.resolve(o.createTask(s,i)):await Promise.resolve(o.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(p=>setTimeout(p,l));let d=await n.taskStore.getTask(c);if(!d)throw new J(Q.InternalError,`Task ${c} not found during polling`);u=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Dn(il)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(il,async e=>{switch(e.params.ref.type){case"ref/prompt":return RS(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return jS(e),this.handleResourceCompletion(e,e.params.ref);default:throw new J(Q.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new J(Q.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new J(Q.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return rc;let o=On(n.argsSchema)?.[e.params.argument.name];if(!Wy(o))return rc;let i=a$(o);if(!i)return rc;let a=await i(e.params.argument.value,e.params.context);return u$(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return rc;throw new J(Q.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let s=n.resourceTemplate.completeCallback(e.params.argument.name);if(!s)return rc;let o=await s(e.params.argument.value,e.params.context);return u$(o)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Dn(Qu)),this.server.assertCanSetRequestHandler(Dn(el)),this.server.assertCanSetRequestHandler(Dn(tl)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Qu,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([o,i])=>i.enabled).map(([o,i])=>({uri:o,name:i.name,...i.metadata})),s=[];for(let o of Object.values(this._registeredResourceTemplates)){if(!o.resourceTemplate.listCallback)continue;let i=await o.resourceTemplate.listCallback(r);for(let a of i.resources)s.push({...o.metadata,...a})}return{resources:[...n,...s]}}),this.server.setRequestHandler(el,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(tl,async(e,r)=>{let n=new URL(e.params.uri),s=this._registeredResources[n.toString()];if(s){if(!s.enabled)throw new J(Q.InvalidParams,`Resource ${n} disabled`);return s.readCallback(n,r)}for(let o of Object.values(this._registeredResourceTemplates)){let i=o.resourceTemplate.uriTemplate.match(n.toString());if(i)return o.readCallback(n,i,r)}throw new J(Q.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Dn(rl)),this.server.assertCanSetRequestHandler(Dn(nl)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(rl,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?nV(r.argsSchema):void 0}))})),this.server.setRequestHandler(nl,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new J(Q.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new J(Q.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let s=Fo(n.argsSchema),o=await Ru(s,e.params.arguments);if(!o.success){let c="error"in o?o.error:"Unknown error",u=ju(c);throw new J(Q.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=o.data,a=n.callback;return await Promise.resolve(a(i,r))}else{let s=n.callback;return await Promise.resolve(s(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...n){let s;typeof n[0]=="object"&&(s=n.shift());let o=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,s,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,s){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let o=this._createRegisteredResource(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,r,n,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,r,n,s,o){let i={name:e,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,s,o){let i={resourceTemplate:n,title:r,metadata:s,readCallback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!n.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,n,s,o){let i={title:r,description:n,argsSchema:s===void 0?void 0:Ns(s),callback:o,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=Ns(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,s&&Object.values(s).some(c=>{let u=c instanceof Ct?c._def?.innerType:c;return Wy(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,n,s,o,i,a,c,u){Yy(e);let l={title:r,description:n,inputSchema:c$(s),outputSchema:c$(o),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&Yy(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=Ns(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=Ns(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,s,o,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(Xy(c))s=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Xy(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(e,void 0,n,s,o,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:s,description:o,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,s,o,i,a,c,{taskSupport:"forbidden"},u,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let s;r.length>1&&(s=r.shift());let o=r[0],i=this._createRegisteredPrompt(e,void 0,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:s,description:o,argsSchema:i}=r,a=this._createRegisteredPrompt(e,s,o,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var rV={type:"object",properties:{}};function l$(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function d$(t){return"_def"in t||"_zod"in t||l$(t)}function Xy(t){return typeof t!="object"||t===null||d$(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(l$)}function c$(t){if(t){if(Xy(t))return Ns(t);if(!d$(t))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return t}}function nV(t){let e=On(t);return e?Object.entries(e).map(([r,n])=>{let s=Wx(n),o=Yx(n);return{name:r,description:s,required:!o}}):[]}function Dn(t){let r=On(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=zu(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function u$(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var rc={completion:{values:[],hasMore:!1}};var b0=se(wi(),1),w0=se(Pe(),1);f();f();var UO=se(Pe(),1),dG=3e4,lo=class{baseUrl;apiKey;timeoutMs;accessToken;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey,this.accessToken=e.accessToken,this.timeoutMs=e.timeoutMs??dG}async searchTools(e){return this.post("/v1/search",e)}async searchToolsRespond(e){return this.post("/v1/search/respond",e)}async checkCompatibility(e){return this.post("/v1/graph/compatibility",e)}async compareTools(e){return this.post("/v1/graph/compare",e)}async getStack(e){return this.post("/v1/graph/stack",e)}async refineRequirement(e){return this.post("/v1/intelligence/refine",e)}async verifySuggestion(e){return this.post("/v1/intelligence/verify",e)}async checkIssue(e){return this.post("/v1/intelligence/issue",e)}async batchResolve(e){let r=[],n=new Map,s=new Map;if(e.length===0)return{results:[],warnings:r,methods:n,githubUrls:s};try{let o=await this.rawPost("/v1/tools/batch-resolve",{api_version:"1",tools:e});if(o.status===404)return r.push({scope:"batch-resolve",message:"/v1/tools/batch-resolve not deployed on this engine \u2014 falling back to offline classification (source: non_oss)."}),{results:e.map(c=>({input:c,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s};if(!o.ok)return r.push({scope:"batch-resolve",message:`batch-resolve returned HTTP ${o.status} \u2014 all tools marked as non_oss.`}),{results:e.map(c=>({input:c,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s};let i=await o.json();if(!Array.isArray(i.resolved))return r.push({scope:"batch-resolve",message:"batch-resolve returned unexpected body shape \u2014 falling back."}),{results:e.map(c=>({input:c,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s};let a=[];for(let c of i.resolved){let u=c.match_method??(c.matched?"tool_name_exact":"none"),l=c.matched??u!=="none",d=`${c.input.ecosystem}:${c.input.name}`;n.set(d,u),c.tool?.github_url&&s.set(d,c.tool.github_url),a.push({input:c.input,matched:l,match_method:u,tool:c.tool})}return{results:a,warnings:r,methods:n,githubUrls:s}}catch(o){return r.push({scope:"batch-resolve",message:`batch-resolve network failure: ${o instanceof Error?o.message:String(o)}. Tools classified as non_oss.`}),{results:e.map(i=>({input:i,matched:!1,match_method:"none"})),warnings:r,methods:n,githubUrls:s}}}async reportOutcome(e){return this.post("/v1/feedback/outcome",e)}async suggestGraphUpdate(e){return this.post("/v1/feedback/suggest",e)}async register(e){return(await this.rawPost("/v1/register",{client_id:e})).json()}async healthCheck(){try{return(await fetch(`${this.baseUrl}/v1/health`,{signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}async post(e,r){try{let n=await this.rawPost(e,r);if(n.status===429&&n.headers.get("x-toolcairn-limit-exhausted")==="1")try{return{content:[{type:"text",text:(await n.clone().json()).message??"ToolCairn daily limit reached. Join the Pro waitlist for 1 month free: https://toolcairn.neurynae.com/waitlist?source=limit_exhausted"}]}}catch{}let s=await n.json();return s&&typeof s=="object"&&"content"in s?s:{content:[{type:"text",text:JSON.stringify(s)}]}}catch(n){let s=n instanceof Error?n.message:String(n);return{content:[{type:"text",text:JSON.stringify({ok:!1,error:UO.ErrorCode.ERR_NETWORK_UNREACHABLE,message:`ToolCairn API unreachable: ${s}. Check your internet connection or try again later.`})}],isError:!0}}}rawPost(e,r){let n={"Content-Type":"application/json","X-ToolCairn-Key":this.apiKey,"Accept-Encoding":"gzip"};return this.accessToken&&(n.Authorization=`Bearer ${this.accessToken}`),fetch(`${this.baseUrl}${e}`,{method:"POST",headers:n,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeoutMs)})}};f();import{mkdir as VO,readFile as BO,writeFile as HO}from"fs/promises";import{homedir as fG}from"os";import{join as lv}from"path";var Od=lv(fG(),".toolcairn"),KO=lv(Od,"credentials.json"),dv=lv(Od,"pending-auth.json");async function fv(t){await VO(Od,{recursive:!0}),await HO(dv,JSON.stringify(t,null,2),"utf-8")}async function dc(){try{let t=await BO(dv,"utf-8"),e=JSON.parse(t);return new Date(e.expires_at)<new Date?(await fc(),null):e}catch{return null}}async function fc(){try{let{unlink:t}=await import("fs/promises");await t(dv)}catch{}}function Ti(t){if(!t.access_token)return!1;try{let e=t.access_token.split(".");if(e.length!==3)return!1;let r=JSON.parse(Buffer.from(e[1]??"","base64url").toString("utf-8"));return!(r.exp&&r.exp<Date.now()/1e3+300)}catch{return!1}}async function Or(){try{let t=await BO(KO,"utf-8");return JSON.parse(t)}catch{return null}}async function pv(){let t=await Or();if(t)return t;let e={client_id:crypto.randomUUID(),created_at:new Date().toISOString()};return await Pd(e),e}async function Pd(t){await VO(Od,{recursive:!0}),await HO(KO,JSON.stringify(t,null,2),"utf-8")}async function hv(t,e,r){let n=await pv();await Pd({...n,client_id:e,access_token:t,user_id:r.id,user_email:r.email??void 0,user_name:r.name??void 0,authenticated_at:new Date().toISOString()})}async function mv(){let t=await pv();await Pd({client_id:t.client_id,created_at:t.created_at,api_url:t.api_url})}f();var yn=se(Pe(),1);async function pG(t){let{spawn:e}=await import("child_process");try{let r=process.platform,n,s;r==="win32"?(n="cmd",s=["/c","start","",t]):r==="darwin"?(n="open",s=[t]):(n="xdg-open",s=[t]),e(n,s,{detached:!0,stdio:"ignore",shell:!1}).unref()}catch{}}async function Cd(t){let e=await fetch(`${t}/v1/auth/device-code`,{method:"POST"});if(!e.ok)throw new yn.NetworkError({code:yn.ErrorCode.ERR_NETWORK_UNREACHABLE,message:"Failed to start device auth. Check your internet connection."});let r=await e.json();return await fv({device_code:r.device_code,user_code:r.user_code,verification_uri:r.verification_uri,expires_at:new Date(Date.now()+r.expires_in*1e3).toISOString(),api_url:t}),process.stderr.write(`
|
|
208
208
|
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
209
209
|
`),process.stderr.write(` ToolCairn \u2014 Sign In Required
|
|
210
210
|
`),process.stderr.write(`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
@@ -214,15 +214,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
214
214
|
`),process.stderr.write(` URL: ${r.verification_uri}
|
|
215
215
|
`),process.stderr.write(` Code: ${r.user_code}
|
|
216
216
|
|
|
217
|
-
`),await
|
|
217
|
+
`),await pG(r.verification_uri),r}async function pc(t){let e=await dc(),r;e&&e.api_url===t?(r={device_code:e.device_code,user_code:e.user_code,verification_uri:e.verification_uri,expires_in:Math.floor((new Date(e.expires_at).getTime()-Date.now())/1e3),interval:5},process.stderr.write(`
|
|
218
218
|
ToolCairn: Waiting for sign-in confirmation...
|
|
219
219
|
`),process.stderr.write(` URL: ${r.verification_uri}
|
|
220
220
|
`),process.stderr.write(` Code: ${r.user_code}
|
|
221
221
|
|
|
222
|
-
`)):r=await Cd(t);let n=await
|
|
222
|
+
`)):r=await Cd(t);let n=await hG(t,r.device_code,5);return await fc(),await hv(n.access_token,n.api_key,n.user),process.stderr.write(`
|
|
223
223
|
\u2713 Signed in as ${n.user.email}
|
|
224
224
|
|
|
225
|
-
`),{userId:n.user.id,email:n.user.email??"",name:n.user.name}}async function
|
|
225
|
+
`),{userId:n.user.id,email:n.user.email??"",name:n.user.name}}async function hG(t,e,r){let n=Math.max(r,5)*1e3;for(;;){await mG(n);let o=await(await fetch(`${t}/v1/auth/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({device_code:e,grant_type:"device_code"})})).json();if(o.error!=="authorization_pending"){if(o.error==="expired_token")throw await fc(),new yn.AuthError({code:yn.ErrorCode.ERR_AUTH_TOKEN_EXPIRED,message:"Device code expired. Please try again."});if(o.error)throw new yn.AuthError({code:yn.ErrorCode.ERR_AUTH_UNAUTHORIZED,message:`Authorization failed: ${o.error}`});if(o.access_token)return o}}}function mG(t){return new Promise(e=>setTimeout(e,t))}f();var kj=se(wi(),1),Ej=se(Pe(),1);import{existsSync as dee}from"fs";import{join as fee}from"path";f();f();var GO={query:R.string().min(1).max(500),context:R.object({filters:R.record(R.string(),R.unknown())}).optional(),query_id:R.string().uuid().optional(),user_id:R.string().optional()},JO={query_id:R.string().uuid(),answers:R.array(R.object({dimension:R.string(),value:R.string()}))},WO={query_id:R.string().uuid(),chosen_tool:R.string(),reason:R.string().optional(),outcome:R.enum(["success","failure","replaced","pending"]),feedback:R.string().optional(),replaced_by:R.string().optional()},YO={use_case:R.string().min(1),sub_needs:R.array(R.union([R.string().min(1),R.object({sub_need_type:R.string().min(1).max(50).describe('Stack layer type, e.g. "database", "auth", "web-framework"'),keyword_sentence:R.string().min(1).max(500).describe("Comma-separated keywords matching tool vocabulary, max 20 keywords")})])).min(1).max(8).optional().describe("Structured sub-needs from refine_requirement. Each is {sub_need_type, keyword_sentence} for keyword-matched search, or a plain string (legacy). The structured format dramatically improves accuracy."),constraints:R.object({deployment_model:R.enum(["self-hosted","cloud","embedded","serverless"]).optional(),language:R.string().optional(),license:R.string().optional()}).optional(),limit:R.number().int().positive().max(10).default(5)},XO={tool_name:R.string(),issue_title:R.string(),retry_count:R.number().int().min(0).default(0),docs_consulted:R.boolean().default(!1),issue_url:R.string().url().optional()},QO={tool_a:R.string(),tool_b:R.string(),tool_a_version:R.string().optional().describe('Specific version of tool_a to evaluate (e.g., "14.0.0"). Default: latest.'),tool_b_version:R.string().optional().describe('Specific version of tool_b to evaluate (e.g., "18.2.0"). Default: latest.')},eP={suggestion_type:R.enum(["new_tool","new_edge","update_health","new_use_case"]),data:R.object({tool_name:R.string().optional(),github_url:R.string().url().optional(),description:R.string().optional(),tools:R.array(R.object({tool_name:R.string().min(1),github_url:R.string().url().optional(),description:R.string().optional(),ecosystem:R.string().min(1).optional()})).min(1).max(200).optional().describe('Batch of tools to stage for admin review. Use with suggestion_type="new_tool". Each entry may include `ecosystem` (npm/pypi/cargo/\u2026) so the engine can cross-check the authoritative github_url from the package registry. Overrides single-tool fields when present.'),ecosystem:R.string().min(1).optional(),relationship:R.object({source_tool:R.string(),target_tool:R.string(),edge_type:R.enum(["SOLVES","REQUIRES","INTEGRATES_WITH","REPLACES","CONFLICTS_WITH","POPULAR_WITH","BREAKS_FROM","COMPATIBLE_WITH"]),evidence:R.string().optional()}).optional(),use_case:R.object({name:R.string(),description:R.string(),tools:R.array(R.string()).optional()}).optional()}),query_id:R.string().uuid().optional(),confidence:R.number().min(0).max(1).default(.5)},tP={tool_a:R.string().min(1),tool_b:R.string().min(1),use_case:R.string().optional(),project_config:R.string().max(1e5).optional()},rP={agent:R.enum(["claude","cursor","windsurf","copilot","copilot-cli","opencode","generic"]),project_root:R.string().min(1),server_path:R.string().optional()},nP={project_root:R.string().min(1),include_locations:R.boolean().optional()},sP={project_root:R.string().min(1),action:R.enum(["add_tool","remove_tool","update_tool","add_evaluation","mark_suggestions_sent"]),tool_name:R.string().min(1).optional(),data:R.record(R.string(),R.unknown()).optional()},oP={prompt:R.string().min(1).max(2e3),project_tools:R.array(R.string()).optional()},iP={query:R.string().min(1).max(500),agent_suggestions:R.array(R.string().min(1)).min(1).max(10)},aP={prompt:R.string().min(1).max(2e3),classification:R.enum(["tool_discovery","stack_building","tool_comparison","tool_configuration"]),project_context:R.object({existing_tools:R.array(R.string()).optional(),language:R.string().optional(),framework:R.string().optional()}).optional()};f();function Wr(t){return{content:[{type:"text",text:JSON.stringify({ok:!0,data:t})}]}}function dr(t,e){return{content:[{type:"text",text:JSON.stringify({ok:!1,error:t,message:e})}],isError:!0}}f();var uP=se(Pe(),1);var cP=(0,uP.createMcpLogger)({name:"@toolcairn/tools:classify-prompt"}),gG=["tool_discovery","stack_building","tool_comparison"];async function gv(t){try{cP.info({promptLen:t.prompt.length},"classify_prompt called");let e=t.project_tools&&t.project_tools.length>0?`
|
|
226
226
|
|
|
227
227
|
The project already uses: ${t.project_tools.join(", ")}. Consider whether the prompt relates to tools already confirmed in the project.`:"",r=`Classify the following developer prompt into exactly ONE of these categories:
|
|
228
228
|
|
|
@@ -249,63 +249,113 @@ ${t.prompt}
|
|
|
249
249
|
Your response (one category name only):`;return Wr({classification_prompt:r,needs_tool_search_prompt:`Based on this classification, determine if ToolCairn tool search should be invoked.
|
|
250
250
|
Respond with 1 if the classification is one of: tool_discovery, stack_building, tool_comparison
|
|
251
251
|
Respond with 0 if the classification is: tool_configuration, debugging, general_coding
|
|
252
|
-
Respond with ONLY 0 or 1.`,valid_classifications:["tool_discovery","stack_building","tool_comparison","tool_configuration","debugging","general_coding"],tool_required_if:
|
|
253
|
-
`;await(0,
|
|
254
|
-
`;await Bv(r,n,"utf-8"),await
|
|
255
|
-
`).join("");await Bv(r,n,"utf-8"),await
|
|
256
|
-
`,"utf-8")}async function
|
|
257
|
-
`).filter(a=>a.trim().length>0);if(n.length<=
|
|
252
|
+
Respond with ONLY 0 or 1.`,valid_classifications:["tool_discovery","stack_building","tool_comparison","tool_configuration","debugging","general_coding"],tool_required_if:gG,instructions:"Step 1: Send classification_prompt to the LLM and get a classification. Step 2: If classification is in tool_required_if, call refine_requirement with the classification. Otherwise, proceed without ToolCairn search."})}catch(e){return cP.error({err:e},"classify_prompt failed"),dr("classify_error",e instanceof Error?e.message:String(e))}}f();var vj=se(Pe(),1);f();var hj=se(Pe(),1),Ji=se(Md(),1);import{readFile as r0}from"fs/promises";import{resolve as t0}from"path";f();f();import{join as Ld}from"path";var Jn=".toolcairn",Tv="config.json",$v="audit-log.jsonl",Iv="audit-log.archive.jsonl";function pr(t){return Ld(t,Jn)}function Dt(t){return Ld(t,Jn,Tv)}function _n(t){return Ld(t,Jn,$v)}function Ov(t){return Ld(t,Jn,Iv)}f();var hP=se(Pe(),1);import{readFile as OG,rename as PG}from"fs/promises";import{join as CG}from"path";f();import{access as $G,readdir as Npe,stat as IG}from"fs/promises";async function Z(t){try{return await $G(t),!0}catch{return!1}}async function nt(t){try{return(await IG(t)).isDirectory()}catch{return!1}}var po=new Set(["node_modules",".git",".hg",".svn","dist","build","out",".next",".turbo",".nuxt","target","vendor","__pycache__",".venv","venv",".tox",".pytest_cache",".mypy_cache","bin","obj",".gradle",".idea",".vscode",".DS_Store","coverage",".cache",".pnpm-store"]);var Pv=(0,hP.createMcpLogger)({name:"@toolcairn/tools:config-store"});async function $i(t){let e=Dt(t);if(!await Z(e))return{config:null,path:e,corrupt_backup_path:null};let r;try{r=await OG(e,"utf-8")}catch(n){throw Pv.error({err:n,configPath:e},"Failed to read config.json"),n}try{return{config:JSON.parse(r),path:e,corrupt_backup_path:null}}catch(n){let s=new Date().toISOString().replace(/[:.]/g,"-"),o=CG(t,Jn,`config.json.corrupt.${s}`);try{await PG(e,o),Pv.warn({configPath:e,backup:o,err:n},"config.json was unparseable \u2014 moved to backup")}catch(i){Pv.error({err:i,configPath:e,backup:o},"Failed to rename corrupt config.json")}return{config:null,path:e,corrupt_backup_path:o}}}f();var mP=se(Pe(),1),gP=se(Md(),1);import{mkdir as NG}from"fs/promises";var AG=(0,mP.createMcpLogger)({name:"@toolcairn/tools:config-store"});async function qd(t,e){await NG(pr(t),{recursive:!0});let r=Dt(t),n=`${JSON.stringify(e,null,2)}
|
|
253
|
+
`;await(0,gP.default)(r,n),AG.debug({configPath:r,bytes:n.length},"config.json written atomically")}f();var WP=se(Pe(),1),YP=se(Vv(),1),XP=se(Md(),1);import{appendFile as Bv,mkdir as Hv,readFile as JP,rm as bhe,writeFile as uJ}from"fs/promises";f();function _o(t=""){return{version:"1.2",project:{name:t,languages:[],frameworks:[],subprojects:[]},tools:{confirmed:[],pending_evaluation:[],unknown_in_graph:[]},last_audit_entry:null}}var _c=(0,WP.createMcpLogger)({name:"@toolcairn/tools:audit-log"}),lJ=5e3,GP=2500;async function vo(t,e){await Hv(pr(t),{recursive:!0});let r=_n(t),n=`${JSON.stringify(QP(e))}
|
|
254
|
+
`;await Bv(r,n,"utf-8"),await eC(t,r)}function QP(t){return{action:t.action,tool:t.tool,timestamp:t.timestamp,reason:t.reason,mcp_tool:t.mcp_tool??null,query_id:t.query_id??null,duration_ms:t.duration_ms??null,status:t.status??"ok",outcome:t.outcome??null,replaced_by:t.replaced_by??null,candidates:t.candidates??null,metadata:t.metadata??null}}async function Yd(t,e){if(e.length===0)return;await Hv(pr(t),{recursive:!0});let r=_n(t),n=e.map(s=>`${JSON.stringify(QP(s))}
|
|
255
|
+
`).join("");await Bv(r,n,"utf-8"),await eC(t,r)}async function Xd(t,e){try{await dJ(t)}catch(s){_c.debug({err:s,projectRoot:t},"audit-log: bootstrap skipped (read-only?) \u2014 abandoning");return}let r=Dt(t),n=null;try{n=await YP.default.lock(r,{stale:1e4,retries:{retries:5,minTimeout:50,factor:2,maxTimeout:500},realpath:!1}),await vo(t,e)}catch(s){_c.warn({err:s,projectRoot:t},"audit-log: tool-call append failed")}finally{if(n)try{await n()}catch(s){_c.debug({err:s},"audit-log: lock release failed (likely already stale)")}}}async function dJ(t){await Hv(pr(t),{recursive:!0});let e=Dt(t);await Z(e)||await uJ(e,`${JSON.stringify(_o(),null,2)}
|
|
256
|
+
`,"utf-8")}async function Ai(t){let e=_n(t);if(!await Z(e))return[];let r=await JP(e,"utf-8");return fJ(r)}async function eC(t,e){let n=(await JP(e,"utf-8")).split(`
|
|
257
|
+
`).filter(a=>a.trim().length>0);if(n.length<=lJ)return;let s=n.slice(0,GP),o=n.slice(GP),i=Ov(t);try{await Bv(i,`${s.join(`
|
|
258
258
|
`)}
|
|
259
259
|
`,"utf-8");let a=`${o.join(`
|
|
260
260
|
`)}
|
|
261
|
-
`;await(0,
|
|
262
|
-
`))if(r.trim())try{e.push(JSON.parse(r))}catch{}return e}f();async function Qd(t,e){if(t.version==="1.1"||t.version==="1.2"){for(let o of t.tools.confirmed)o.locations||(o.locations=[]);return{migrated:!1,was_v1_0:!1,legacy_audit_entries:[]}}t.project.languages||(t.project.languages=t.project.language?[{name:t.project.language,file_count:0,workspaces:["."]}]:[]),t.project.frameworks||(t.project.frameworks=t.project.framework?[{name:t.project.framework,ecosystem:"npm",workspace:".",source:"local"}]:[]),t.project.subprojects||(t.project.subprojects=[]);for(let o of t.tools.confirmed)o.locations||(o.locations=[]);let r=t.audit_log??[];delete t.audit_log;let s={action:"migrate",tool:"__schema__",timestamp:new Date().toISOString(),reason:"Schema 1.0 \u2192 1.1: audit_log relocated to audit-log.jsonl; languages/frameworks expanded to arrays"};return t.last_audit_entry=s,t.version="1.1",await Yd(e,[...r,s]),{migrated:!0,was_v1_0:!0,legacy_audit_entries:r}}async function ef(t,e){if(t.version==="1.2")return t.tools.unknown_in_graph||(t.tools.unknown_in_graph=[]),{migrated:!1};if(t.version!=="1.1")return{migrated:!1};t.tools.unknown_in_graph||(t.tools.unknown_in_graph=[]),t.version="1.2";let n={action:"migrate",tool:"__schema__",timestamp:new Date().toISOString(),reason:"Schema 1.1 \u2192 1.2: added tools.unknown_in_graph for suggest_graph_update drain tracking"};return t.last_audit_entry=n,await vo(e,n),{migrated:!0}}f();var
|
|
263
|
-
`,"utf-8")}catch(r){Kv.debug({err:r,configPath:e},"Bootstrap seed skipped (likely race)")}}f();f();var
|
|
261
|
+
`;await(0,XP.default)(e,a),_c.info({archived:s.length,retained:o.length},"audit-log.jsonl rotated")}catch(a){_c.warn({err:a,auditPath:e,archivePath:i},"Audit-log rotation failed \u2014 live file intact")}}function fJ(t){let e=[];for(let r of t.split(`
|
|
262
|
+
`))if(r.trim())try{e.push(JSON.parse(r))}catch{}return e}f();async function Qd(t,e){if(t.version==="1.1"||t.version==="1.2"){for(let o of t.tools.confirmed)o.locations||(o.locations=[]);return{migrated:!1,was_v1_0:!1,legacy_audit_entries:[]}}t.project.languages||(t.project.languages=t.project.language?[{name:t.project.language,file_count:0,workspaces:["."]}]:[]),t.project.frameworks||(t.project.frameworks=t.project.framework?[{name:t.project.framework,ecosystem:"npm",workspace:".",source:"local"}]:[]),t.project.subprojects||(t.project.subprojects=[]);for(let o of t.tools.confirmed)o.locations||(o.locations=[]);let r=t.audit_log??[];delete t.audit_log;let s={action:"migrate",tool:"__schema__",timestamp:new Date().toISOString(),reason:"Schema 1.0 \u2192 1.1: audit_log relocated to audit-log.jsonl; languages/frameworks expanded to arrays"};return t.last_audit_entry=s,t.version="1.1",await Yd(e,[...r,s]),{migrated:!0,was_v1_0:!0,legacy_audit_entries:r}}async function ef(t,e){if(t.version==="1.2")return t.tools.unknown_in_graph||(t.tools.unknown_in_graph=[]),{migrated:!1};if(t.version!=="1.1")return{migrated:!1};t.tools.unknown_in_graph||(t.tools.unknown_in_graph=[]),t.version="1.2";let n={action:"migrate",tool:"__schema__",timestamp:new Date().toISOString(),reason:"Schema 1.1 \u2192 1.2: added tools.unknown_in_graph for suggest_graph_update drain tracking"};return t.last_audit_entry=n,await vo(e,n),{migrated:!0}}f();var tC=se(Pe(),1),rC=se(Vv(),1);import{mkdir as pJ,writeFile as hJ}from"fs/promises";var Kv=(0,tC.createMcpLogger)({name:"@toolcairn/tools:config-store"});async function Xr(t,e,r){let n=Dt(t),s=await Z(n);await mJ(t);let o=Date.now(),i=await rC.default.lock(n,{stale:1e4,retries:{retries:5,minTimeout:50,factor:2,maxTimeout:500},realpath:!1});try{let{config:a}=await $i(t),c,u=!s,l=!1;if(a?c=a:(c=_o(),Kv.info({projectRoot:t},"Bootstrapping fresh .toolcairn/config.json")),c.version==="1.0")l=(await Qd(c,t)).migrated;else{for(let h of c.tools.confirmed)h.locations||(h.locations=[]);c.project.languages||(c.project.languages=[]),c.project.frameworks||(c.project.frameworks=[]),c.project.subprojects||(c.project.subprojects=[])}if(c.version==="1.1"){let h=await ef(c,t);l=l||h.migrated}else c.tools.unknown_in_graph||(c.tools.unknown_in_graph=[]);await e(c);let d=new Date().toISOString(),p=Date.now()-o,g={...r,timestamp:d,duration_ms:r.duration_ms??p,status:r.status??"ok"};return c.last_audit_entry=g,c.version="1.2",await qd(t,c),await vo(t,g),{config:c,audit_entry:g,bootstrapped:u,migrated:l}}finally{try{await i()}catch(a){Kv.warn({err:a,configPath:n},"Failed to release config lock \u2014 may be stale")}}}async function mJ(t){await pJ(pr(t),{recursive:!0});let e=Dt(t);if(!await Z(e))try{await hJ(e,`${JSON.stringify(_o(),null,2)}
|
|
263
|
+
`,"utf-8")}catch(r){Kv.debug({err:r,configPath:e},"Bootstrap seed skipped (likely race)")}}f();f();var rj=se(Pe(),1);import{readFile as zQ}from"fs/promises";import{basename as MQ,resolve as Ww}from"path";f();import{readdir as gJ}from"fs/promises";import{join as yJ}from"path";var _J={npm:["package.json"],pypi:["pyproject.toml","requirements.txt","requirements-dev.txt","setup.py","Pipfile"],cargo:["Cargo.toml"],go:["go.mod"],rubygems:["Gemfile"],maven:["pom.xml"],gradle:["build.gradle","build.gradle.kts","gradle.lockfile"],composer:["composer.json"],hex:["mix.exs"],pub:["pubspec.yaml"],nuget:["packages.config"],"swift-pm":["Package.swift"]},vJ={".csproj":"nuget",".fsproj":"nuget"};async function nC(t){let e=new Set;for(let[r,n]of Object.entries(_J))for(let s of n)if(await Z(yJ(t,s))){e.add(r);break}try{let r=await gJ(t);for(let n of r)for(let[s,o]of Object.entries(vJ))if(n.endsWith(s)){e.add(o);break}}catch{}return Array.from(e)}f();var bJ={npm:{next:"Next.js",react:"React",vue:"Vue",nuxt:"Nuxt",svelte:"Svelte","@sveltejs/kit":"SvelteKit",astro:"Astro","solid-js":"SolidJS",express:"Express",fastify:"Fastify",koa:"Koa",hono:"Hono","@nestjs/core":"NestJS",remix:"Remix","@remix-run/react":"Remix",gatsby:"Gatsby",electron:"Electron","react-native":"React Native",expo:"Expo",angular:"Angular","@angular/core":"Angular",turbo:"Turborepo",nx:"Nx",vite:"Vite",webpack:"Webpack"},pypi:{django:"Django",flask:"Flask",fastapi:"FastAPI",starlette:"Starlette",pyramid:"Pyramid",tornado:"Tornado",aiohttp:"aiohttp",litestar:"Litestar",sanic:"Sanic",bottle:"Bottle",quart:"Quart",celery:"Celery",streamlit:"Streamlit",gradio:"Gradio",torch:"PyTorch",tensorflow:"TensorFlow",transformers:"Transformers",langchain:"LangChain","llama-index":"LlamaIndex"},cargo:{"actix-web":"Actix Web",axum:"Axum",rocket:"Rocket",warp:"Warp",tide:"Tide",poem:"Poem",salvo:"Salvo",leptos:"Leptos",dioxus:"Dioxus",yew:"Yew",tauri:"Tauri",bevy:"Bevy",tokio:"Tokio"},go:{"github.com/gin-gonic/gin":"Gin","github.com/labstack/echo":"Echo","github.com/labstack/echo/v4":"Echo","github.com/gofiber/fiber":"Fiber","github.com/gofiber/fiber/v2":"Fiber","github.com/beego/beego":"Beego","github.com/go-chi/chi":"Chi","github.com/gorilla/mux":"Gorilla","github.com/revel/revel":"Revel"},rubygems:{rails:"Ruby on Rails",sinatra:"Sinatra",hanami:"Hanami",roda:"Roda",rack:"Rack"},maven:{"org.springframework.boot:spring-boot-starter":"Spring Boot","org.springframework.boot:spring-boot-starter-web":"Spring Boot","io.quarkus:quarkus-core":"Quarkus","io.micronaut:micronaut-core":"Micronaut","io.vertx:vertx-core":"Vert.x","com.google.inject:guice":"Guice"},gradle:{"org.springframework.boot:spring-boot-starter":"Spring Boot","io.quarkus:quarkus-core":"Quarkus","io.micronaut:micronaut-core":"Micronaut","io.ktor:ktor-server-core":"Ktor"},composer:{"laravel/framework":"Laravel","symfony/framework-bundle":"Symfony","cakephp/cakephp":"CakePHP","yiisoft/yii2":"Yii","slim/slim":"Slim"},hex:{phoenix:"Phoenix",ecto:"Ecto",nerves:"Nerves",ash:"Ash"},pub:{flutter:"Flutter",flutter_bloc:"Flutter BLoC"},nuget:{"Microsoft.AspNetCore.App":"ASP.NET Core","Microsoft.AspNetCore":"ASP.NET Core","Microsoft.EntityFrameworkCore":"Entity Framework Core","Microsoft.NET.Sdk.Web":"ASP.NET Core",Avalonia:"Avalonia",MAUI:".NET MAUI"},"swift-pm":{vapor:"Vapor",kitura:"Kitura",perfect:"Perfect"}},wJ=new Set(["framework","web-framework","ui-framework","meta-framework","backend-framework","frontend-framework","mobile-framework"]);function sC(t,e){let r=[],n=new Set;for(let s of t){if(s.section==="dev")continue;let o=s.workspace_path||".",i=`${s.ecosystem}:${s.name}`,a=e.get(i),c=null,u="local";if(a?.matched&&a.tool&&(a.tool.categories??[]).some(p=>wJ.has(p.toLowerCase()))&&(c=a.tool.canonical_name,u="graph"),!c){let d=bJ[s.ecosystem]?.[s.name];d&&(c=d,u="local")}if(!c)continue;let l=`${c}:${o}`;n.has(l)||(n.add(l),r.push({name:c,ecosystem:s.ecosystem,workspace:o,source:u}))}return r}f();import{readdir as xJ}from"fs/promises";import{join as SJ,relative as kJ,sep as EJ}from"path";var TJ={".ts":"TypeScript",".tsx":"TypeScript",".js":"JavaScript",".jsx":"JavaScript",".mjs":"JavaScript",".cjs":"JavaScript",".py":"Python",".pyi":"Python",".rs":"Rust",".go":"Go",".rb":"Ruby",".java":"Java",".kt":"Kotlin",".kts":"Kotlin",".scala":"Scala",".php":"PHP",".ex":"Elixir",".exs":"Elixir",".erl":"Erlang",".dart":"Dart",".cs":"C#",".fs":"F#",".vb":"Visual Basic",".swift":"Swift",".c":"C",".h":"C",".cpp":"C++",".cxx":"C++",".cc":"C++",".hpp":"C++",".m":"Objective-C",".mm":"Objective-C",".lua":"Lua",".r":"R",".jl":"Julia",".nim":"Nim",".zig":"Zig",".clj":"Clojure",".cljs":"Clojure",".hs":"Haskell",".elm":"Elm",".ml":"OCaml",".mli":"OCaml",".vue":"Vue",".svelte":"Svelte",".astro":"Astro"};async function oC(t,e){let r=new Map,n=new Map,s=[...e,""].filter((o,i,a)=>a.indexOf(o)===i).sort((o,i)=>i.length-o.length);for(let o of s)n.set(o,new Map);return await iC(t,t,r,n,s),[...r.entries()].map(([o,i])=>{let a=s.filter(c=>(n.get(c)?.get(o)??0)>0).map(c=>c||".");return{name:o,file_count:i,workspaces:a}}).filter(o=>o.file_count>0).sort((o,i)=>i.file_count-o.file_count)}async function iC(t,e,r,n,s){let o;try{o=await xJ(e,{withFileTypes:!0})}catch{return}for(let i of o){if(i.name.startsWith(".")&&i.name!==".github"&&![".toolcairn",".claude"].includes(i.name)||po.has(i.name))continue;let a=SJ(e,i.name);if(i.isDirectory())await iC(t,a,r,n,s);else if(i.isFile()){let c=$J(i.name);if(!c)continue;let u=TJ[c];if(!u)continue;r.set(u,(r.get(u)??0)+1);let l=kJ(t,a).split(EJ).join("/");for(let d of s)if(d===""||l===d||l.startsWith(`${d}/`)){let p=n.get(d);p&&p.set(u,(p.get(u)??0)+1);break}}}}function $J(t){let e=t.lastIndexOf(".");return e<0||e===0?null:t.slice(e).toLowerCase()}f();f();import{readFile as pC}from"fs/promises";import{join as hC}from"path";f();f();f();f();f();f();function IJ(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function OJ(t,e,r){let n=t.split(/\r\n|\n|\r/g),s="",o=(Math.log10(e+1)|0)+1;for(let i=e-1;i<=e+1;i++){let a=n[i-1];a&&(s+=i.toString().padEnd(o," "),s+=": ",s+=a,s+=`
|
|
264
264
|
`,i===e&&(s+=" ".repeat(o+r+2),s+=`^
|
|
265
|
-
`))}return s}var fe=class extends Error{line;column;codeblock;constructor(e,r){let[n,s]=
|
|
265
|
+
`))}return s}var fe=class extends Error{line;column;codeblock;constructor(e,r){let[n,s]=IJ(r.toml,r.ptr),o=OJ(r.toml,n,s);super(`Invalid TOML document: ${e}
|
|
266
266
|
|
|
267
|
-
${o}`,r),this.line=n,this.column=s,this.codeblock=o}};function
|
|
267
|
+
${o}`,r),this.line=n,this.column=s,this.codeblock=o}};function PJ(t,e){let r=0;for(;t[e-++r]==="\\";);return--r&&r%2}function tf(t,e=0,r=t.length){let n=t.indexOf(`
|
|
268
268
|
`,e);return t[n-1]==="\r"&&n--,n<=r?n:-1}function Ri(t,e){for(let r=e;r<t.length;r++){let n=t[r];if(n===`
|
|
269
269
|
`)return r;if(n==="\r"&&t[r+1]===`
|
|
270
270
|
`)return r+1;if(n<" "&&n!==" "||n==="\x7F")throw new fe("control characters are not allowed in comments",{toml:t,ptr:e})}return t.length}function Jt(t,e,r,n){let s;for(;;){for(;(s=t[e])===" "||s===" "||!r&&(s===`
|
|
271
271
|
`||s==="\r"&&t[e+1]===`
|
|
272
|
-
`);)e++;if(n||s!=="#")break;e=Ri(t,e)}return e}function
|
|
272
|
+
`);)e++;if(n||s!=="#")break;e=Ri(t,e)}return e}function aC(t,e,r,n,s=!1){if(!n)return e=tf(t,e),e<0?t.length:e;for(let o=e;o<t.length;o++){let i=t[o];if(i==="#")o=tf(t,o);else{if(i===r)return o+1;if(i===n||s&&(i===`
|
|
273
273
|
`||i==="\r"&&t[o+1]===`
|
|
274
|
-
`))return o}}throw new fe("cannot find end of structure",{toml:t,ptr:e})}function rf(t,e){let r=t[e],n=r===t[e+1]&&t[e+1]===t[e+2]?t.slice(e,e+3):r;e+=n.length-1;do e=t.indexOf(n,++e);while(e>-1&&r!=="'"&&
|
|
274
|
+
`))return o}}throw new fe("cannot find end of structure",{toml:t,ptr:e})}function rf(t,e){let r=t[e],n=r===t[e+1]&&t[e+1]===t[e+2]?t.slice(e,e+3):r;e+=n.length-1;do e=t.indexOf(n,++e);while(e>-1&&r!=="'"&&PJ(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}f();var CJ=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,vc=class t extends Date{#r=!1;#t=!1;#e=null;constructor(e){let r=!0,n=!0,s="Z";if(typeof e=="string"){let o=e.match(CJ);o?(o[1]||(r=!1,e=`0000-01-01T${e}`),n=!!o[2],n&&e[10]===" "&&(e=e.replace(" ","T")),o[2]&&+o[2]>23?e="":(s=o[3]||null,e=e.toUpperCase(),!s&&n&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#r=r,this.#t=n,this.#e=s)}isDateTime(){return this.#r&&this.#t}isLocal(){return!this.#r||!this.#t||!this.#e}isDate(){return this.#r&&!this.#t}isTime(){return this.#t&&!this.#r}isValid(){return this.#r||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,r="Z"){let n=new t(e);return n.#e=r,n}static wrapAsLocalDateTime(e){let r=new t(e);return r.#e=null,r}static wrapAsLocalDate(e){let r=new t(e);return r.#t=!1,r.#e=null,r}static wrapAsLocalTime(e){let r=new t(e);return r.#r=!1,r.#e=null,r}};var NJ=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,AJ=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,RJ=/^[+-]?0[0-9_]/,jJ=/^[0-9a-f]{2,8}$/i,cC={b:"\b",t:" ",n:`
|
|
275
275
|
`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function nf(t,e=0,r=t.length){let n=t[e]==="'",s=t[e++]===t[e]&&t[e]===t[e+1];s&&(r-=2,t[e+=2]==="\r"&&e++,t[e]===`
|
|
276
276
|
`&&e++);let o=0,i,a="",c=e;for(;e<r-1;){let u=t[e++];if(u===`
|
|
277
277
|
`||u==="\r"&&t[e]===`
|
|
278
|
-
`){if(!s)throw new fe("newlines are not allowed in strings",{toml:t,ptr:e-1})}else if(u<" "&&u!==" "||u==="\x7F")throw new fe("control characters are not allowed in strings",{toml:t,ptr:e-1});if(i){if(i=!1,u==="x"||u==="u"||u==="U"){let l=t.slice(e,e+=u==="x"?2:u==="u"?4:8);if(!
|
|
278
|
+
`){if(!s)throw new fe("newlines are not allowed in strings",{toml:t,ptr:e-1})}else if(u<" "&&u!==" "||u==="\x7F")throw new fe("control characters are not allowed in strings",{toml:t,ptr:e-1});if(i){if(i=!1,u==="x"||u==="u"||u==="U"){let l=t.slice(e,e+=u==="x"?2:u==="u"?4:8);if(!jJ.test(l))throw new fe("invalid unicode escape",{toml:t,ptr:o});try{a+=String.fromCodePoint(parseInt(l,16))}catch{throw new fe("invalid unicode escape",{toml:t,ptr:o})}}else if(s&&(u===`
|
|
279
279
|
`||u===" "||u===" "||u==="\r")){if(e=Jt(t,e-1,!0),t[e]!==`
|
|
280
|
-
`&&t[e]!=="\r")throw new fe("invalid escape: only line-ending whitespace may be escaped",{toml:t,ptr:o});e=Jt(t,e)}else if(u in
|
|
281
|
-
`&&t[i]!=="\r")throw new fe("unexpected character encountered",{toml:t,ptr:i});i+=+(t[i]===",")}return[c,i]}i=
|
|
282
|
-
`&&i!=="\r"){let a,c=s,u=!1,[l,d]=sf(t,e-1);for(let h=0;h<l.length;h++){if(h&&(c=u?c[a]:c[a]={}),a=l[h],(u=Object.hasOwn(c,a))&&(typeof c[a]!="object"||o.has(c[a])))throw new fe("trying to redefine an already defined value",{toml:t,ptr:e});!u&&a==="__proto__"&&Object.defineProperty(c,a,{enumerable:!0,configurable:!0,writable:!0})}if(u)throw new fe("trying to redefine an already defined value",{toml:t,ptr:e});let[p,g]=bc(t,d,"}",r-1,n);o.add(p),c[a]=p,e=g}}if(!i)throw new fe("unfinished table encountered",{toml:t,ptr:e});return[s,e]}function
|
|
283
|
-
`&&o!=="\r"){let i=bc(t,e-1,"]",r-1,n);s.push(i[0]),e=i[1]}}if(!o)throw new fe("unfinished array encountered",{toml:t,ptr:e});return[s,e]}function
|
|
284
|
-
`&&t[a]!=="\r")throw new fe("each key-value declaration must be followed by an end-of-line",{toml:t,ptr:a});a=Jt(t,a)}return n}f();var
|
|
285
|
-
`),n=!1;for(let s of r){let o=s.replace(/\/\/.*$/,"").trim(),i=s.match(/\/\/\s*(.*)$/)?.[1]??"",a=/\bindirect\b/.test(i);if(o){if(o==="require ("){n=!0;continue}if(o===")"){n=!1;continue}if(o.startsWith("require ")){let c=o.slice(8).trim().split(/\s+/);c[0]&&c[1]&&e.push({name:c[0],version:c[1],indirect:a});continue}if(n){let c=o.split(/\s+/);c[0]&&c[1]&&e.push({name:c[0],version:c[1],indirect:a})}}}return e}var
|
|
286
|
-
`)){let n=r.trim();if(!n||n.startsWith("#"))continue;let s=n.match(/^([^:]+):([^:]+):([^=]+)=(.*)$/);s?.[1]&&s[2]&&s[3]&&e.push({group:s[1],name:s[2],version:s[3],configurations:(s[4]??"").split(",").map(o=>o.trim())})}return e}function
|
|
287
|
-
`)){let g=sp(p);g&&n.push({name:g.name,ecosystem:"pypi",version_constraint:g.constraint,resolved_version:s.get(g.name.toLowerCase()),section:c,manifest_file:d,workspace_path:e})}}catch(l){r.push({scope:"parser:pypi",path:u,message:`Failed to read ${a}: ${l instanceof Error?l.message:String(l)}`})}}return{ecosystem:"pypi",tools:n,warnings:r}};f();import{readFile as Vw}from"fs/promises";import{join as
|
|
288
|
-
`),n=!1;for(let s of r){if(s.trim()==="specs:"){n=!0;continue}if(n){if(!s.startsWith(" ")){n=!1;continue}let o=s.match(/^ {4}([A-Za-z0-9_\-.]+) \(([^)]+)\)/);o?.[1]&&o[2]&&e.push({name:o[1],version:o[2]})}}return e}function
|
|
289
|
-
`),n=0,s=!1;for(let o of r){let i=o.split("#")[0]?.trim()??"";if(!i)continue;let a=i.match(/^group\s+(:[\w,\s:]+?)\s*do\s*$/);if(a&&a[1]){n++,s=/\b(development|test)\b/.test(a[1]);continue}if(i==="end"&&n>0){n--,n===0&&(s=!1);continue}let c=i.match(/^gem\s+(['"])([A-Za-z0-9_\-.]+)\1(?:\s*,\s*(['"])([^'"]+)\3)?/);c?.[2]&&e.push({name:c[2],constraint:c[4],dev:s})}return e}var pR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=dR(t,"Gemfile.lock"),o=dR(t,"Gemfile");if(await Z(s))try{let i=await Vw(s,"utf-8"),a=e?`${e}/Gemfile.lock`:"Gemfile.lock",c=new Set;if(await Z(o))try{let u=await Vw(o,"utf-8");for(let l of fR(u))c.add(l.name)}catch{}for(let u of AX(i))c.size>0&&!c.has(u.name)||n.push({name:u.name,ecosystem:"rubygems",version_constraint:void 0,resolved_version:u.version,section:"dep",manifest_file:a,workspace_path:e});if(n.length>0)return{ecosystem:"rubygems",tools:n,warnings:r}}catch(i){r.push({scope:"parser:ruby",path:s,message:`Failed to parse Gemfile.lock: ${i instanceof Error?i.message:String(i)}`})}if(await Z(o))try{let i=await Vw(o,"utf-8"),a=e?`${e}/Gemfile`:"Gemfile";for(let c of fR(i))n.push({name:c.name,ecosystem:"rubygems",version_constraint:c.constraint,section:c.dev?"dev":"dep",manifest_file:a,workspace_path:e});r.push({scope:"parser:ruby",path:a,message:"No Gemfile.lock \u2014 resolved_version unavailable."})}catch(i){r.push({scope:"parser:ruby",path:o,message:`Failed to parse Gemfile: ${i instanceof Error?i.message:String(i)}`})}return{ecosystem:"rubygems",tools:n,warnings:r}};f();import{readFile as hR}from"fs/promises";import{join as mR}from"path";function NX(t){let e;try{e=JSON.parse(t)}catch{return[]}let r=[];for(let n of e.pins??[])n.identity&&r.push({name:n.identity,version:n.state?.version});for(let n of e.object?.pins??[])n.package&&r.push({name:n.package,version:n.state?.version});return r}function RX(t){let e=[],r=/\.package\(\s*(?:name:\s*"[^"]+"\s*,\s*)?url:\s*"([^"]+)"\s*,\s*([^)]+)\)/g,n;for(;(n=r.exec(t))!==null;){let s=n[1],o=n[2]?.trim();if(!s)continue;let i=s.split("/").pop()?.replace(/\.git$/,"");i&&e.push({name:i,constraint:o})}return e}var gR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=mR(t,"Package.resolved");if(await Z(s))try{let i=await hR(s,"utf-8"),a=e?`${e}/Package.resolved`:"Package.resolved";for(let c of NX(i))n.push({name:c.name,ecosystem:"swift-pm",resolved_version:c.version,section:"dep",manifest_file:a,workspace_path:e});if(n.length>0)return{ecosystem:"swift-pm",tools:n,warnings:r}}catch(i){r.push({scope:"parser:swift",path:s,message:`Failed to parse Package.resolved: ${i instanceof Error?i.message:String(i)}`})}let o=mR(t,"Package.swift");if(await Z(o))try{let i=await hR(o,"utf-8"),a=e?`${e}/Package.swift`:"Package.swift";for(let c of RX(i))n.push({name:c.name,ecosystem:"swift-pm",version_constraint:c.constraint,section:"dep",manifest_file:a,workspace_path:e});r.push({scope:"parser:swift",path:a,message:"No Package.resolved \u2014 resolved_version unavailable."})}catch(i){r.push({scope:"parser:swift",path:o,message:`Failed to parse Package.swift: ${i instanceof Error?i.message:String(i)}`})}return{ecosystem:"swift-pm",tools:n,warnings:r}};var yR={npm:uR,pypi:lR,cargo:m1,go:XN,rubygems:pR,maven:sR,gradle:tR,composer:v1,hex:aR,pub:lN,nuget:YN,"swift-pm":gR};f();f();var vR=se(Oe(),1);import{readFile as jX,readdir as _R}from"fs/promises";import{homedir as zX}from"os";import{join as Bw}from"path";f();function Ke(t){if(!t)return;let e=t.trim();if(!e||(e.startsWith("git+")&&(e=e.slice(4)),e.startsWith("github:")&&(e=`https://github.com/${e.slice(7)}`),/^[A-Za-z0-9_.\-]+\/[A-Za-z0-9_.\-]+$/.test(e)&&(e=`https://github.com/${e}`),e=e.replace(/^git@github\.com:/,"https://github.com/"),e=e.replace(/^ssh:\/\/git@github\.com\//,"https://github.com/"),e=e.replace(/^http:\/\//,"https://"),!/^https:\/\/github\.com\//.test(e)))return;e=e.replace(/\.git$/,""),e=e.replace(/\/$/,"");let r=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)/);if(r)return`https://github.com/${r[1]}/${r[2]}`}var MX=(0,vR.createMcpLogger)({name:"@toolcairn/tools:resolver:cargo"});async function LX(t,e){let r=Bw(zX(),".cargo","registry","src");if(!await nt(r))return null;let n;try{n=await _R(r)}catch{return null}let s=[];for(let o of n){let i=Bw(r,o);if(!await nt(i))continue;let a;try{a=await _R(i)}catch{continue}for(let c of a){if(!c.startsWith(`${t}-`)||e&&c!==`${t}-${e}`)continue;let u=Bw(i,c,"Cargo.toml");await Z(u)&&s.push(u)}}return s.length===0?null:(s.sort(),s[s.length-1]??null)}async function bR(t,e,r,n={}){let s=await LX(r,n.resolved_version);if(!s)return{};try{let o=await jX(s,"utf-8"),a=Or(o).package;if(!a)return{};let c={};a.name&&a.name!==r&&(c.canonical_package_name=a.name),a.version&&(c.resolved_version=a.version);let u=Ke(a.repository??a.homepage);return u&&(c.github_url=u),c}catch(o){return MX.debug({err:o instanceof Error?o.message:String(o),manifestPath:s},"Failed to parse cached Cargo.toml"),{}}}f();var wR=se(Oe(),1);import{readFile as qX}from"fs/promises";import{join as ZX}from"path";var DX=(0,wR.createMcpLogger)({name:"@toolcairn/tools:resolver:composer"});async function xR(t,e,r){let n=ZX(t,"vendor",r,"composer.json");if(!await Z(n))return{};try{let s=JSON.parse(await qX(n,"utf-8")),o={};s.name&&s.name!==r&&(o.canonical_package_name=s.name),s.version&&(o.resolved_version=s.version);let i=s.source?.url??s.support?.source??s.homepage,a=Ke(i);return a&&(o.github_url=a),o}catch(s){return DX.debug({err:s instanceof Error?s.message:String(s),path:n},"Failed to parse installed composer.json"),{}}}f();function SR(t,e,r){if(!r.startsWith("github.com/"))return{};let s=r.slice(11).split("/");if(s.length<2||!s[0]||!s[1])return{};let o=s[0],i=s[1];i=i.replace(/\.git$/,"");let a=Ke(`https://github.com/${o}/${i}`);return a?{github_url:a}:{}}f();import{readdir as TR}from"fs/promises";import{homedir as VX}from"os";import{join as Hw}from"path";f();var kR=se(Oe(),1),ER=se(ru(),1);import{readFile as FX}from"fs/promises";var UX=(0,kR.createMcpLogger)({name:"@toolcairn/tools:resolver:pom"});async function op(t,e){if(!await Z(t))return{};try{let r=await FX(t,"utf-8"),o=new ER.XMLParser({ignoreAttributes:!0,parseTagValue:!0}).parse(r).project;if(!o)return{};let i={},a=o.groupId&&o.artifactId?`${o.groupId}:${o.artifactId}`:void 0;a&&a!==e&&(i.canonical_package_name=a),o.version&&(i.resolved_version=o.version);let c=[o.scm?.url,o.scm?.connection,o.scm?.developerConnection,o.url];for(let u of c){let l=Ke(u);if(l){i.github_url=l;break}}return i}catch(r){return UX.debug({err:r instanceof Error?r.message:String(r),path:t},"Failed to parse .pom"),{}}}async function BX(t,e,r){let n=Hw(VX(),".gradle","caches","modules-2","files-2.1",t,e);if(!await nt(n))return null;let s;try{s=await TR(n)}catch{return null}let o=r&&s.includes(r)?r:s.sort().at(-1);if(!o)return null;let i=Hw(n,o),a;try{a=await TR(i)}catch{return null}for(let c of a)return Hw(i,c,`${e}-${o}.pom`);return null}async function $R(t,e,r,n={}){let s=r.indexOf(":");if(s<0)return{};let o=r.slice(0,s),i=r.slice(s+1);if(!o||!i)return{};let a=await BX(o,i,n.resolved_version);return a?op(a,r):{}}f();var PR=se(Oe(),1);import{readFile as IR}from"fs/promises";import{join as Kw}from"path";var HX=(0,PR.createMcpLogger)({name:"@toolcairn/tools:resolver:hex"});function KX(t){let e=t.match(/<<"GitHub">>\s*,\s*<<"([^"]+)">>/i);if(e?.[1]||(e=t.match(/<<"[^"]*github[^"]*">>\s*,\s*<<"(https?:\/\/[^"]+)">>/i),e?.[1]))return e[1]}function GX(t){let e=t.match(/@source_url\s*\(?\s*["']([^"']+)["']/);if(e?.[1])return e[1];let r=t.match(/\bsource_url\s*:\s*["']([^"']+)["']/);if(r?.[1])return r[1]}async function OR(t,e,r){let n=Kw(t,"deps",r),s={},o=Kw(n,"hex_metadata.config");if(await Z(o))try{let i=await IR(o,"utf-8"),a=KX(i),c=Ke(a);c&&(s.github_url=c)}catch(i){HX.debug({err:i instanceof Error?i.message:String(i),metaPath:o},"Failed to read hex_metadata.config")}if(!s.github_url){let i=Kw(n,"mix.exs");if(await Z(i))try{let a=await IR(i,"utf-8"),c=GX(a),u=Ke(c);u&&(s.github_url=u)}catch{}}return s}f();import{readdir as JX}from"fs/promises";import{homedir as WX}from"os";import{join as CR}from"path";async function YX(t,e,r){let n=t.replace(/\./g,"/"),s=CR(WX(),".m2","repository",n,e);if(!await nt(s))return null;let o;try{o=await JX(s)}catch{return null}let i;return r&&o.includes(r)?i=r:(o.sort(),i=o[o.length-1]),i?CR(s,i,`${e}-${i}.pom`):null}async function AR(t,e,r,n={}){let s=r.indexOf(":");if(s<0)return{};let o=r.slice(0,s),i=r.slice(s+1);if(!o||!i)return{};let a=await YX(o,i,n.resolved_version);return a?op(a,r):{}}f();var RR=se(Oe(),1);import{readFile as XX}from"fs/promises";import{join as NR}from"path";var QX=(0,RR.createMcpLogger)({name:"@toolcairn/tools:resolver:npm"});function eQ(t){let e=t.repository;if(e)return typeof e=="string"?e:e.url}async function tQ(t,e,r){let n=t,s=e;for(let o=0;o<10;o++){let i=NR(n,"node_modules",r,"package.json");if(await Z(i))return i;if(n===s)break;let a=NR(n,"..");if(a===n)break;n=a}return null}async function jR(t,e,r){let n=await tQ(t,e,r);if(!n)return{};let s;try{s=JSON.parse(await XX(n,"utf-8"))}catch(c){return QX.debug({err:c instanceof Error?c.message:String(c),manifestPath:n},"Failed to parse installed package.json \u2014 skipping url resolution"),{}}let o={};s.name&&s.name!==r&&(o.canonical_package_name=s.name),s.version&&(o.resolved_version=s.version);let i=eQ(s),a=Ke(i);return a&&(o.github_url=a),o}f();var MR=se(Oe(),1),LR=se(ru(),1);import{readFile as rQ,readdir as nQ}from"fs/promises";import{homedir as sQ}from"os";import{join as zR}from"path";var oQ=(0,MR.createMcpLogger)({name:"@toolcairn/tools:resolver:nuget"});async function iQ(t,e){let r=zR(sQ(),".nuget","packages",t.toLowerCase());if(!await nt(r))return null;let n;try{n=await nQ(r)}catch{return null}let s=e&&n.includes(e)?e:n.sort().at(-1);if(!s)return null;let o=zR(r,s,`${t.toLowerCase()}.nuspec`);return await Z(o)?o:null}async function qR(t,e,r,n={}){let s=await iQ(r,n.resolved_version);if(!s)return{};try{let o=await rQ(s,"utf-8"),c=new LR.XMLParser({ignoreAttributes:!1}).parse(o).package?.metadata;if(!c)return{};let u={};c.id&&c.id!==r&&(u.canonical_package_name=c.id),c.version&&(u.resolved_version=c.version);let l=c.repository?.["@_url"]??c.repository?.url,d=Ke(l??c.projectUrl);return d&&(u.github_url=d),u}catch(o){return oQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to parse .nuspec"),{}}}f();var ZR=se(Oe(),1),DR=se(Xc(),1);import{readFile as aQ}from"fs/promises";import{homedir as cQ,platform as uQ}from"os";import{join as ip}from"path";var lQ=(0,ZR.createMcpLogger)({name:"@toolcairn/tools:resolver:pub"});function dQ(){if(uQ()==="win32"){let t=process.env.LOCALAPPDATA;if(t)return ip(t,"Pub","Cache","hosted","pub.dev")}return ip(cQ(),".pub-cache","hosted","pub.dev")}async function fQ(t,e){let r=dQ();if(e){let n=ip(r,`${t}-${e}`,"pubspec.yaml");return await Z(n)?n:null}try{let{readdir:n}=await import("fs/promises"),i=(await n(r)).filter(c=>c.startsWith(`${t}-`)).sort().at(-1);if(!i)return null;let a=ip(r,i,"pubspec.yaml");return await Z(a)?a:null}catch{return null}}async function FR(t,e,r,n={}){let s=await fQ(r,n.resolved_version);if(!s)return{};try{let o=await aQ(s,"utf-8"),i=(0,DR.parse)(o),a={};i.name&&i.name!==r&&(a.canonical_package_name=i.name),i.version&&(a.resolved_version=i.version);let c=Ke(i.repository??i.homepage);return c&&(a.github_url=c),a}catch(o){return lQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to parse pubspec.yaml"),{}}}f();var VR=se(Oe(),1);import{readFile as pQ,readdir as UR}from"fs/promises";import{join as nu}from"path";var hQ=(0,VR.createMcpLogger)({name:"@toolcairn/tools:resolver:pypi"});async function mQ(t){let e=[],r=[".venv","venv",".virtualenv"];for(let n of r){let s=nu(t,n);if(!await nt(s))continue;let o=nu(s,"Lib","site-packages");await nt(o)&&e.push(o);let i=nu(s,"lib");if(await nt(i))try{for(let a of await UR(i)){if(!a.startsWith("python"))continue;let c=nu(i,a,"site-packages");await nt(c)&&e.push(c)}}catch{}}return e}function ap(t){return t.toLowerCase().replace(/[._]+/g,"-")}async function gQ(t,e){let r=ap(e),n;try{n=await UR(t)}catch{return null}for(let s of n){if(!s.endsWith(".dist-info"))continue;let o=s.replace(/-[^-]+\.dist-info$/,"");if(ap(o)===r){let i=nu(t,s,"METADATA");if(await Z(i))return i}}return null}function yQ(t){let e=[],r,n,s=t.split(`
|
|
290
|
-
`);for(let o of s){if(o.trim()==="")break;let i=o.indexOf(":");if(i<0)continue;let a=o.slice(0,i).trim(),c=o.slice(i+1).trim();if(a==="Name"&&!r)r=c;else if(a==="Version"&&!n)n=c;else if(a==="Home-page")e.push(c);else if(a==="Project-URL"){let u=c.indexOf(",");u>=0?e.push(c.slice(u+1).trim()):e.push(c)}}return{name:r,version:n,urls:e}}async function
|
|
280
|
+
`&&t[e]!=="\r")throw new fe("invalid escape: only line-ending whitespace may be escaped",{toml:t,ptr:o});e=Jt(t,e)}else if(u in cC)a+=cC[u];else throw new fe("unrecognized escape sequence",{toml:t,ptr:o});c=e}else!n&&u==="\\"&&(o=e-1,i=!0,a+=t.slice(c,o))}return a+t.slice(c,r-1)}function uC(t,e,r,n){if(t==="true")return!0;if(t==="false")return!1;if(t==="-inf")return-1/0;if(t==="inf"||t==="+inf")return 1/0;if(t==="nan"||t==="+nan"||t==="-nan")return NaN;if(t==="-0")return n?0n:0;let s=NJ.test(t);if(s||AJ.test(t)){if(RJ.test(t))throw new fe("leading zeroes are not allowed",{toml:e,ptr:r});t=t.replace(/_/g,"");let i=+t;if(isNaN(i))throw new fe("invalid number",{toml:e,ptr:r});if(s){if((s=!Number.isSafeInteger(i))&&!n)throw new fe("integer value cannot be represented losslessly",{toml:e,ptr:r});(s||n===!0)&&(i=BigInt(t))}return i}let o=new vc(t);if(!o.isValid())throw new fe("invalid value",{toml:e,ptr:r});return o}f();function zJ(t,e,r){let n=t.slice(e,r),s=n.indexOf("#");return s>-1&&(Ri(t,s),n=n.slice(0,s)),[n.trimEnd(),s]}function bc(t,e,r,n,s){if(n===0)throw new fe("document contains excessively nested structures. aborting.",{toml:t,ptr:e});let o=t[e];if(o==="["||o==="{"){let[c,u]=o==="["?dC(t,e,n,s):lC(t,e,n,s);if(r){if(u=Jt(t,u),t[u]===",")u++;else if(t[u]!==r)throw new fe("expected comma or end of structure",{toml:t,ptr:u})}return[c,u]}let i;if(o==='"'||o==="'"){i=rf(t,e);let c=nf(t,e,i);if(r){if(i=Jt(t,i),t[i]&&t[i]!==","&&t[i]!==r&&t[i]!==`
|
|
281
|
+
`&&t[i]!=="\r")throw new fe("unexpected character encountered",{toml:t,ptr:i});i+=+(t[i]===",")}return[c,i]}i=aC(t,e,",",r);let a=zJ(t,e,i-+(t[i-1]===","));if(!a[0])throw new fe("incomplete key-value declaration: no value specified",{toml:t,ptr:e});return r&&a[1]>-1&&(i=Jt(t,e+a[1]),i+=+(t[i]===",")),[uC(a[0],t,e,s),i]}var MJ=/^[a-zA-Z0-9-_]+[ \t]*$/;function sf(t,e,r="="){let n=e-1,s=[],o=t.indexOf(r,e);if(o<0)throw new fe("incomplete key-value: cannot find end of key",{toml:t,ptr:e});do{let i=t[e=++n];if(i!==" "&&i!==" ")if(i==='"'||i==="'"){if(i===t[e+1]&&i===t[e+2])throw new fe("multiline strings are not allowed in keys",{toml:t,ptr:e});let a=rf(t,e);if(a<0)throw new fe("unfinished string encountered",{toml:t,ptr:e});n=t.indexOf(".",a);let c=t.slice(a,n<0||n>o?o:n),u=tf(c);if(u>-1)throw new fe("newlines are not allowed in keys",{toml:t,ptr:e+n+u});if(c.trimStart())throw new fe("found extra tokens after the string part",{toml:t,ptr:a});if(o<a&&(o=t.indexOf(r,a),o<0))throw new fe("incomplete key-value: cannot find end of key",{toml:t,ptr:e});s.push(nf(t,e,a))}else{n=t.indexOf(".",e);let a=t.slice(e,n<0||n>o?o:n);if(!MJ.test(a))throw new fe("only letter, numbers, dashes and underscores are allowed in keys",{toml:t,ptr:e});s.push(a.trimEnd())}}while(n+1&&n<o);return[s,Jt(t,o+1,!0,!0)]}function lC(t,e,r,n){let s={},o=new Set,i;for(e++;(i=t[e++])!=="}"&&i;){if(i===",")throw new fe("expected value, found comma",{toml:t,ptr:e-1});if(i==="#")e=Ri(t,e);else if(i!==" "&&i!==" "&&i!==`
|
|
282
|
+
`&&i!=="\r"){let a,c=s,u=!1,[l,d]=sf(t,e-1);for(let h=0;h<l.length;h++){if(h&&(c=u?c[a]:c[a]={}),a=l[h],(u=Object.hasOwn(c,a))&&(typeof c[a]!="object"||o.has(c[a])))throw new fe("trying to redefine an already defined value",{toml:t,ptr:e});!u&&a==="__proto__"&&Object.defineProperty(c,a,{enumerable:!0,configurable:!0,writable:!0})}if(u)throw new fe("trying to redefine an already defined value",{toml:t,ptr:e});let[p,g]=bc(t,d,"}",r-1,n);o.add(p),c[a]=p,e=g}}if(!i)throw new fe("unfinished table encountered",{toml:t,ptr:e});return[s,e]}function dC(t,e,r,n){let s=[],o;for(e++;(o=t[e++])!=="]"&&o;){if(o===",")throw new fe("expected value, found comma",{toml:t,ptr:e-1});if(o==="#")e=Ri(t,e);else if(o!==" "&&o!==" "&&o!==`
|
|
283
|
+
`&&o!=="\r"){let i=bc(t,e-1,"]",r-1,n);s.push(i[0]),e=i[1]}}if(!o)throw new fe("unfinished array encountered",{toml:t,ptr:e});return[s,e]}function fC(t,e,r,n){let s=e,o=r,i,a=!1,c;for(let u=0;u<t.length;u++){if(u){if(s=a?s[i]:s[i]={},o=(c=o[i]).c,n===0&&(c.t===1||c.t===2))return null;if(c.t===2){let l=s.length-1;s=s[l],o=o[l].c}}if(i=t[u],(a=Object.hasOwn(s,i))&&o[i]?.t===0&&o[i]?.d)return null;a||(i==="__proto__"&&(Object.defineProperty(s,i,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(o,i,{enumerable:!0,configurable:!0,writable:!0})),o[i]={t:u<t.length-1&&n===2?3:n,d:!1,i:0,c:{}})}if(c=o[i],c.t!==n&&!(n===1&&c.t===3)||(n===2&&(c.d||(c.d=!0,s[i]=[]),s[i].push(s={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,n===1)s=a?s[i]:s[i]={};else if(n===0&&a)return null;return[i,s,c.c]}function Pr(t,{maxDepth:e=1e3,integersAsBigInt:r}={}){let n={},s={},o=n,i=s;for(let a=Jt(t,0);a<t.length;){if(t[a]==="["){let c=t[++a]==="[",u=sf(t,a+=+c,"]");if(c){if(t[u[1]-1]!=="]")throw new fe("expected end of table declaration",{toml:t,ptr:u[1]-1});u[1]++}let l=fC(u[0],n,s,c?2:1);if(!l)throw new fe("trying to redefine an already defined table or value",{toml:t,ptr:a});i=l[2],o=l[1],a=u[1]}else{let c=sf(t,a),u=fC(c[0],o,i,0);if(!u)throw new fe("trying to redefine an already defined table or value",{toml:t,ptr:a});let l=bc(t,c[1],void 0,e,r);u[1][u[0]]=l[0],a=l[1]}if(a=Jt(t,a,!0),t[a]&&t[a]!==`
|
|
284
|
+
`&&t[a]!=="\r")throw new fe("each key-value declaration must be followed by an end-of-line",{toml:t,ptr:a});a=Jt(t,a)}return n}f();var LJ=[["dependencies","dep"],["dev-dependencies","dev"],["build-dependencies","build"]];function mC(t,e,r,n,s,o){if(t)for(let[i,a]of Object.entries(t)){let c=typeof a=="string"?a:a.version;n.push({name:i,ecosystem:"cargo",version_constraint:c,resolved_version:r.get(i),section:e,manifest_file:s,workspace_path:o})}}var gC=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=hC(t,"Cargo.toml");if(!await Z(s))return{ecosystem:"cargo",tools:n,warnings:r};let o;try{o=Pr(await pC(s,"utf-8"))}catch(u){return r.push({scope:"parser:cargo",path:s,message:`Failed to parse Cargo.toml: ${u instanceof Error?u.message:String(u)}`}),{ecosystem:"cargo",tools:n,warnings:r}}let i=new Map,a=hC(t,"Cargo.lock");if(await Z(a))try{let u=Pr(await pC(a,"utf-8"));for(let l of u.package??[])l.name&&l.version&&i.set(l.name,l.version)}catch(u){r.push({scope:"parser:cargo",path:a,message:`Failed to parse Cargo.lock: ${u instanceof Error?u.message:String(u)}`})}let c=e?`${e}/Cargo.toml`:"Cargo.toml";for(let[u,l]of LJ)mC(o[u],l,i,n,c,e);return mC(o.workspace?.dependencies,"dep",i,n,c,e),{ecosystem:"cargo",tools:n,warnings:r}};f();import{readFile as yC}from"fs/promises";import{join as _C}from"path";function vC(t){return t==="php"||t.startsWith("ext-")||t.startsWith("lib-")}var bC=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=_C(t,"composer.lock"),o=_C(t,"composer.json");if(await Z(s))try{let i=JSON.parse(await yC(s,"utf-8")),a=e?`${e}/composer.lock`:"composer.lock";for(let[c,u]of[[i.packages??[],"dep"],[i["packages-dev"]??[],"dev"]])for(let l of c)!l.name||vC(l.name)||n.push({name:l.name,ecosystem:"composer",version_constraint:void 0,resolved_version:l.version,section:u,manifest_file:a,workspace_path:e});if(n.length>0)return{ecosystem:"composer",tools:n,warnings:r}}catch(i){r.push({scope:"parser:composer",path:s,message:`Failed to parse composer.lock: ${i instanceof Error?i.message:String(i)}`})}if(await Z(o))try{let i=JSON.parse(await yC(o,"utf-8")),a=e?`${e}/composer.json`:"composer.json";for(let[c,u]of[[i.require,"dep"],[i["require-dev"],"dev"]])for(let[l,d]of Object.entries(c??{}))vC(l)||n.push({name:l,ecosystem:"composer",version_constraint:d,section:u,manifest_file:a,workspace_path:e})}catch(i){r.push({scope:"parser:composer",path:o,message:`Failed to parse composer.json: ${i instanceof Error?i.message:String(i)}`})}return{ecosystem:"composer",tools:n,warnings:r}};f();var Iw=se(Xc(),1);import{readFile as cA}from"fs/promises";import{join as uA}from"path";function f7(t){if(typeof t=="object"&&t!==null){let e=t;if(e.sdk||e.path)return!0}return!1}function lA(t,e,r,n,s,o){if(t)for(let[i,a]of Object.entries(t)){if(f7(a))continue;let c=typeof a=="string"?a:a.version;n.push({name:i,ecosystem:"pub",version_constraint:c,resolved_version:r.get(i),section:e,manifest_file:s,workspace_path:o})}}var dA=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=uA(t,"pubspec.yaml");if(!await Z(s))return{ecosystem:"pub",tools:n,warnings:r};let o;try{o=(0,Iw.parse)(await cA(s,"utf-8"))}catch(u){return r.push({scope:"parser:dart",path:s,message:`Failed to parse pubspec.yaml: ${u instanceof Error?u.message:String(u)}`}),{ecosystem:"pub",tools:n,warnings:r}}let i=new Map,a=uA(t,"pubspec.lock");if(await Z(a))try{let u=(0,Iw.parse)(await cA(a,"utf-8"));for(let[l,d]of Object.entries(u.packages??{}))d.version&&i.set(l,d.version)}catch(u){r.push({scope:"parser:dart",path:a,message:`Failed to parse pubspec.lock: ${u instanceof Error?u.message:String(u)}`})}let c=e?`${e}/pubspec.yaml`:"pubspec.yaml";return lA(o.dependencies,"dep",i,n,c,e),lA(o.dev_dependencies,"dev",i,n,c,e),{ecosystem:"pub",tools:n,warnings:r}};f();var YA=se(ru(),1);import{readFile as KA,readdir as bX}from"fs/promises";import{join as GA,relative as JA}from"path";function WA(t){return t===void 0?[]:Array.isArray(t)?t:[t]}var XA=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=[];try{s=await bX(t)}catch{return{ecosystem:"nuget",tools:n,warnings:r}}let o=s.filter(c=>c.endsWith(".csproj")||c.endsWith(".fsproj")),i=new YA.XMLParser({ignoreAttributes:!1});for(let c of o){let u=GA(t,c);try{let l=await KA(u,"utf-8"),d=i.parse(l),p=Array.isArray(d.Project?.ItemGroup)?d.Project?.ItemGroup??[]:d.Project?.ItemGroup?[d.Project.ItemGroup]:[],g=e?`${e}/${JA(t,u)}`:JA(t,u);for(let h of p)for(let m of WA(h.PackageReference)){let _=m["@_Include"];if(!_)continue;let b=m["@_Version"];n.push({name:_,ecosystem:"nuget",version_constraint:b,resolved_version:b,section:m["@_PrivateAssets"]?"build":"dep",manifest_file:g,workspace_path:e})}}catch(l){r.push({scope:"parser:dotnet",path:u,message:`Failed to parse ${c}: ${l instanceof Error?l.message:String(l)}`})}}let a=GA(t,"packages.config");if(await Z(a))try{let c=await KA(a,"utf-8"),u=i.parse(c),l=e?`${e}/packages.config`:"packages.config";for(let d of WA(u.packages?.package)){let p=d["@_Include"];p&&n.push({name:p,ecosystem:"nuget",version_constraint:d["@_Version"],resolved_version:d["@_Version"],section:"dep",manifest_file:l,workspace_path:e})}}catch(c){r.push({scope:"parser:dotnet",path:a,message:`Failed to parse packages.config: ${c instanceof Error?c.message:String(c)}`})}return{ecosystem:"nuget",tools:n,warnings:r}};f();import{readFile as wX}from"fs/promises";import{join as xX}from"path";function SX(t){let e=[],r=t.split(`
|
|
285
|
+
`),n=!1;for(let s of r){let o=s.replace(/\/\/.*$/,"").trim(),i=s.match(/\/\/\s*(.*)$/)?.[1]??"",a=/\bindirect\b/.test(i);if(o){if(o==="require ("){n=!0;continue}if(o===")"){n=!1;continue}if(o.startsWith("require ")){let c=o.slice(8).trim().split(/\s+/);c[0]&&c[1]&&e.push({name:c[0],version:c[1],indirect:a});continue}if(n){let c=o.split(/\s+/);c[0]&&c[1]&&e.push({name:c[0],version:c[1],indirect:a})}}}return e}var QA=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=xX(t,"go.mod");if(!await Z(s))return{ecosystem:"go",tools:n,warnings:r};try{let o=await wX(s,"utf-8"),i=e?`${e}/go.mod`:"go.mod";for(let a of SX(o))n.push({name:a.name,ecosystem:"go",version_constraint:a.version,resolved_version:a.version,section:a.indirect?"optional":"dep",manifest_file:i,workspace_path:e})}catch(o){r.push({scope:"parser:go",path:s,message:`Failed to parse go.mod: ${o instanceof Error?o.message:String(o)}`})}return{ecosystem:"go",tools:n,warnings:r}};f();import{readFile as eR}from"fs/promises";import{join as tR}from"path";function kX(t){let e=[];for(let r of t.split(`
|
|
286
|
+
`)){let n=r.trim();if(!n||n.startsWith("#"))continue;let s=n.match(/^([^:]+):([^:]+):([^=]+)=(.*)$/);s?.[1]&&s[2]&&s[3]&&e.push({group:s[1],name:s[2],version:s[3],configurations:(s[4]??"").split(",").map(o=>o.trim())})}return e}function EX(t){let e=t.join(" ").toLowerCase();return e.includes("test")?"dev":e.includes("annotationprocessor")||e.includes("kapt")?"build":"dep"}function TX(t){let e=[],r=[/(implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|annotationProcessor|kapt|ksp)\s*\(?\s*(['"])([A-Za-z0-9_.\-]+:[A-Za-z0-9_.\-]+:[^'"]+)\2/g];for(let n of r){let s;for(;(s=n.exec(t))!==null;)s[1]&&s[3]&&e.push({spec:s[3],config:s[1]})}return e}function $X(t){let e=t.toLowerCase();return e.startsWith("test")?"dev":e.includes("annotationprocessor")||e==="kapt"||e==="ksp"?"build":"dep"}var rR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=tR(t,"gradle.lockfile");if(await Z(s))try{let o=await eR(s,"utf-8"),i=e?`${e}/gradle.lockfile`:"gradle.lockfile";for(let a of kX(o))n.push({name:`${a.group}:${a.name}`,ecosystem:"gradle",version_constraint:a.version,resolved_version:a.version,section:EX(a.configurations),manifest_file:i,workspace_path:e});if(n.length>0)return{ecosystem:"gradle",tools:n,warnings:r}}catch(o){r.push({scope:"parser:gradle",path:s,message:`Failed to parse gradle.lockfile: ${o instanceof Error?o.message:String(o)}`})}for(let o of["build.gradle.kts","build.gradle"]){let i=tR(t,o);if(await Z(i))try{let a=await eR(i,"utf-8"),c=e?`${e}/${o}`:o,u=!1;for(let l of TX(a)){let d=l.spec.split(":");if(d.length<3||!d[0]||!d[1])continue;let p=d.slice(2).join(":");if(p.startsWith("$")||p.includes("${")){u=!0;continue}n.push({name:`${d[0]}:${d[1]}`,ecosystem:"gradle",version_constraint:p,section:$X(l.config),manifest_file:c,workspace_path:e})}r.push({scope:"parser:gradle",path:c,message:"Shallow parse of build.gradle \u2014 results may be incomplete. Add `dependencyLocking` to the project for deterministic discovery."}),u&&r.push({scope:"parser:gradle",path:c,message:"Some deps use variable interpolation ($ver / ${var}) \u2014 skipped."});break}catch(a){r.push({scope:"parser:gradle",path:i,message:`Failed to read ${o}: ${a instanceof Error?a.message:String(a)}`})}}return{ecosystem:"gradle",tools:n,warnings:r}};f();var sR=se(ru(),1);import{readFile as IX}from"fs/promises";import{join as OX}from"path";function PX(t,e){if(e)return"optional";switch(t){case"test":case"provided":return"dev";default:return"dep"}}function nR(t){return t===void 0?[]:Array.isArray(t)?t:[t]}var oR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=OX(t,"pom.xml");if(!await Z(s))return{ecosystem:"maven",tools:n,warnings:r};let o;try{let l=await IX(s,"utf-8");o=new sR.XMLParser({ignoreAttributes:!0,parseTagValue:!0}).parse(l)}catch(l){return r.push({scope:"parser:maven",path:s,message:`Failed to parse pom.xml: ${l instanceof Error?l.message:String(l)}`}),{ecosystem:"maven",tools:n,warnings:r}}let i=e?`${e}/pom.xml`:"pom.xml",a=nR(o.project?.dependencies?.dependency),c=nR(o.project?.dependencyManagement?.dependencies?.dependency),u=!1;for(let l of[...a,...c]){if(!l.groupId||!l.artifactId)continue;let d=`${l.groupId}:${l.artifactId}`,p=typeof l.version=="string"?l.version:void 0;p&&p.includes("${")&&(u=!0);let g=l.optional===!0||l.optional==="true";n.push({name:d,ecosystem:"maven",version_constraint:p,resolved_version:p&&!p.includes("${")?p:void 0,section:PX(l.scope,g),manifest_file:i,workspace_path:e})}return u&&r.push({scope:"parser:maven",path:s,message:"Some dependencies use ${...} variable interpolation which is not resolved \u2014 version info may be incomplete."}),{ecosystem:"maven",tools:n,warnings:r}};f();import{readFile as iR}from"fs/promises";import{join as aR}from"path";function CX(t){let e=[],r=/"([^"]+)":\s*\{\s*:hex\s*,\s*:[A-Za-z_][A-Za-z0-9_]*\s*,\s*"([^"]+)"/g,n;for(;(n=r.exec(t))!==null;)n[1]&&n[2]&&e.push({name:n[1],version:n[2]});return e}function NX(t){let e=[],r=/\{:([a-z_][a-z0-9_]*)\s*,\s*"([^"]+)"(?:[^}]*only:\s*(?:\[?:?([a-z_]+))?[^}]*)?\}/g,n;for(;(n=r.exec(t))!==null;)if(n[1]){let s=n[3];e.push({name:n[1],constraint:n[2],dev:s==="dev"||s==="test"})}return e}var cR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=aR(t,"mix.lock");if(await Z(s))try{let i=await iR(s,"utf-8"),a=e?`${e}/mix.lock`:"mix.lock";for(let c of CX(i))n.push({name:c.name,ecosystem:"hex",version_constraint:void 0,resolved_version:c.version,section:"dep",manifest_file:a,workspace_path:e});if(n.length>0)return{ecosystem:"hex",tools:n,warnings:r}}catch(i){r.push({scope:"parser:mix",path:s,message:`Failed to parse mix.lock: ${i instanceof Error?i.message:String(i)}`})}let o=aR(t,"mix.exs");if(await Z(o))try{let i=await iR(o,"utf-8"),a=e?`${e}/mix.exs`:"mix.exs";for(let c of NX(i))n.push({name:c.name,ecosystem:"hex",version_constraint:c.constraint,section:c.dev?"dev":"dep",manifest_file:a,workspace_path:e})}catch(i){r.push({scope:"parser:mix",path:o,message:`Failed to parse mix.exs: ${i instanceof Error?i.message:String(i)}`})}return{ecosystem:"hex",tools:n,warnings:r}};f();var uR=se(Xc(),1);import{readFile as Zw}from"fs/promises";import{join as np}from"path";var AX=[["dependencies","dep"],["devDependencies","dev"],["peerDependencies","peer"],["optionalDependencies","optional"]];function RX(t){let e=t.lastIndexOf("@");if(e<=0)return;let r=t.slice(e+1),n=r.indexOf("(");return n>=0?r.slice(0,n):r||void 0}function jX(t,e,r,n){let o=t.importers?.[e]?.[r]?.[n];if(o){if(typeof o=="string")return o;if(o.version){let i=o.version.indexOf("(");return i>=0?o.version.slice(0,i):o.version}}}function zX(t,e){let r=`node_modules/${e}`;return t.packages?.[r]?.version??t.dependencies?.[e]?.version}var lR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=np(t,"package.json");if(!await Z(s))return{ecosystem:"npm",tools:n,warnings:r};let o;try{o=JSON.parse(await Zw(s,"utf-8"))}catch(p){return r.push({scope:"parser:npm",path:s,message:`Failed to parse package.json: ${p instanceof Error?p.message:String(p)}`}),{ecosystem:"npm",tools:n,warnings:r}}let i,a,c=np(t,"pnpm-lock.yaml"),u=np(t,"package-lock.json");if(await Z(c))try{i=(0,uR.parse)(await Zw(c,"utf-8"))}catch(p){r.push({scope:"parser:npm",path:c,message:`Failed to parse pnpm-lock.yaml, falling back to manifest: ${p instanceof Error?p.message:String(p)}`})}else if(await Z(u))try{a=JSON.parse(await Zw(u,"utf-8"))}catch(p){r.push({scope:"parser:npm",path:u,message:`Failed to parse package-lock.json, falling back to manifest: ${p instanceof Error?p.message:String(p)}`})}else await Z(np(t,"yarn.lock"))||r.push({scope:"parser:npm",path:s,message:"No lockfile present \u2014 resolved_version will be absent."});let l=e?`${e}/package.json`:"package.json",d=e||".";for(let[p,g]of AX){let h=o[p];if(h)for(let[m,_]of Object.entries(h)){let b;i?b=jX(i,d,p,m):a&&(b=zX(a,m)),n.push({name:m,ecosystem:"npm",version_constraint:_,resolved_version:b,section:g,manifest_file:l,workspace_path:e})}}return{ecosystem:"npm",tools:n,warnings:r}};f();import{readFile as Dw}from"fs/promises";import{join as Fw}from"path";function sp(t){let e=t.trim();if(!e||e.startsWith("#"))return null;let r=e.match(/^([A-Za-z0-9_.\-]+)(\[[^\]]*\])?(.*)$/);if(!r||!r[1])return null;let n=(r[3]??"").trim();return{name:r[1],constraint:n||void 0}}function Uw(t,e,r,n,s,o){if(t)for(let[i,a]of Object.entries(t)){if(i==="python")continue;let c=typeof a=="string"?a:a.version;r.push({name:i,ecosystem:"pypi",version_constraint:c,resolved_version:o.get(i.toLowerCase()),section:e,manifest_file:n,workspace_path:s})}}var dR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=new Map,o=Fw(t,"uv.lock");if(await Z(o))try{let a=Pr(await Dw(o,"utf-8"));for(let c of a.package??[])c.name&&c.version&&s.set(c.name.toLowerCase(),c.version)}catch(a){r.push({scope:"parser:pypi",path:o,message:`Failed to parse uv.lock: ${a instanceof Error?a.message:String(a)}`})}let i=Fw(t,"pyproject.toml");if(await Z(i))try{let a=Pr(await Dw(i,"utf-8")),c=e?`${e}/pyproject.toml`:"pyproject.toml";for(let u of a.project?.dependencies??[]){let l=sp(u);l&&n.push({name:l.name,ecosystem:"pypi",version_constraint:l.constraint,resolved_version:s.get(l.name.toLowerCase()),section:"dep",manifest_file:c,workspace_path:e})}for(let[u,l]of Object.entries(a.project?.["optional-dependencies"]??{}))for(let d of l){let p=sp(d);p&&n.push({name:p.name,ecosystem:"pypi",version_constraint:p.constraint,resolved_version:s.get(p.name.toLowerCase()),section:u==="dev"?"dev":"optional",manifest_file:c,workspace_path:e})}for(let[u,l]of Object.entries(a["dependency-groups"]??{}))for(let d of l){let p=sp(d);p&&n.push({name:p.name,ecosystem:"pypi",version_constraint:p.constraint,resolved_version:s.get(p.name.toLowerCase()),section:u==="dev"?"dev":"optional",manifest_file:c,workspace_path:e})}Uw(a.tool?.poetry?.dependencies,"dep",n,c,e,s),Uw(a.tool?.poetry?.["dev-dependencies"],"dev",n,c,e,s);for(let u of Object.values(a.tool?.poetry?.group??{}))Uw(u.dependencies,"dev",n,c,e,s);if(n.length>0)return{ecosystem:"pypi",tools:n,warnings:r}}catch(a){r.push({scope:"parser:pypi",path:i,message:`Failed to parse pyproject.toml: ${a instanceof Error?a.message:String(a)}`})}for(let[a,c]of[["requirements.txt","dep"],["requirements-dev.txt","dev"],["dev-requirements.txt","dev"]]){let u=Fw(t,a);if(await Z(u))try{let l=await Dw(u,"utf-8"),d=e?`${e}/${a}`:a;for(let p of l.split(`
|
|
287
|
+
`)){let g=sp(p);g&&n.push({name:g.name,ecosystem:"pypi",version_constraint:g.constraint,resolved_version:s.get(g.name.toLowerCase()),section:c,manifest_file:d,workspace_path:e})}}catch(l){r.push({scope:"parser:pypi",path:u,message:`Failed to read ${a}: ${l instanceof Error?l.message:String(l)}`})}}return{ecosystem:"pypi",tools:n,warnings:r}};f();import{readFile as Vw}from"fs/promises";import{join as fR}from"path";function MX(t){let e=[],r=t.split(`
|
|
288
|
+
`),n=!1;for(let s of r){if(s.trim()==="specs:"){n=!0;continue}if(n){if(!s.startsWith(" ")){n=!1;continue}let o=s.match(/^ {4}([A-Za-z0-9_\-.]+) \(([^)]+)\)/);o?.[1]&&o[2]&&e.push({name:o[1],version:o[2]})}}return e}function pR(t){let e=[],r=t.split(`
|
|
289
|
+
`),n=0,s=!1;for(let o of r){let i=o.split("#")[0]?.trim()??"";if(!i)continue;let a=i.match(/^group\s+(:[\w,\s:]+?)\s*do\s*$/);if(a&&a[1]){n++,s=/\b(development|test)\b/.test(a[1]);continue}if(i==="end"&&n>0){n--,n===0&&(s=!1);continue}let c=i.match(/^gem\s+(['"])([A-Za-z0-9_\-.]+)\1(?:\s*,\s*(['"])([^'"]+)\3)?/);c?.[2]&&e.push({name:c[2],constraint:c[4],dev:s})}return e}var hR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=fR(t,"Gemfile.lock"),o=fR(t,"Gemfile");if(await Z(s))try{let i=await Vw(s,"utf-8"),a=e?`${e}/Gemfile.lock`:"Gemfile.lock",c=new Set;if(await Z(o))try{let u=await Vw(o,"utf-8");for(let l of pR(u))c.add(l.name)}catch{}for(let u of MX(i))c.size>0&&!c.has(u.name)||n.push({name:u.name,ecosystem:"rubygems",version_constraint:void 0,resolved_version:u.version,section:"dep",manifest_file:a,workspace_path:e});if(n.length>0)return{ecosystem:"rubygems",tools:n,warnings:r}}catch(i){r.push({scope:"parser:ruby",path:s,message:`Failed to parse Gemfile.lock: ${i instanceof Error?i.message:String(i)}`})}if(await Z(o))try{let i=await Vw(o,"utf-8"),a=e?`${e}/Gemfile`:"Gemfile";for(let c of pR(i))n.push({name:c.name,ecosystem:"rubygems",version_constraint:c.constraint,section:c.dev?"dev":"dep",manifest_file:a,workspace_path:e});r.push({scope:"parser:ruby",path:a,message:"No Gemfile.lock \u2014 resolved_version unavailable."})}catch(i){r.push({scope:"parser:ruby",path:o,message:`Failed to parse Gemfile: ${i instanceof Error?i.message:String(i)}`})}return{ecosystem:"rubygems",tools:n,warnings:r}};f();import{readFile as mR}from"fs/promises";import{join as gR}from"path";function LX(t){let e;try{e=JSON.parse(t)}catch{return[]}let r=[];for(let n of e.pins??[])n.identity&&r.push({name:n.identity,version:n.state?.version});for(let n of e.object?.pins??[])n.package&&r.push({name:n.package,version:n.state?.version});return r}function qX(t){let e=[],r=/\.package\(\s*(?:name:\s*"[^"]+"\s*,\s*)?url:\s*"([^"]+)"\s*,\s*([^)]+)\)/g,n;for(;(n=r.exec(t))!==null;){let s=n[1],o=n[2]?.trim();if(!s)continue;let i=s.split("/").pop()?.replace(/\.git$/,"");i&&e.push({name:i,constraint:o})}return e}var yR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=gR(t,"Package.resolved");if(await Z(s))try{let i=await mR(s,"utf-8"),a=e?`${e}/Package.resolved`:"Package.resolved";for(let c of LX(i))n.push({name:c.name,ecosystem:"swift-pm",resolved_version:c.version,section:"dep",manifest_file:a,workspace_path:e});if(n.length>0)return{ecosystem:"swift-pm",tools:n,warnings:r}}catch(i){r.push({scope:"parser:swift",path:s,message:`Failed to parse Package.resolved: ${i instanceof Error?i.message:String(i)}`})}let o=gR(t,"Package.swift");if(await Z(o))try{let i=await mR(o,"utf-8"),a=e?`${e}/Package.swift`:"Package.swift";for(let c of qX(i))n.push({name:c.name,ecosystem:"swift-pm",version_constraint:c.constraint,section:"dep",manifest_file:a,workspace_path:e});r.push({scope:"parser:swift",path:a,message:"No Package.resolved \u2014 resolved_version unavailable."})}catch(i){r.push({scope:"parser:swift",path:o,message:`Failed to parse Package.swift: ${i instanceof Error?i.message:String(i)}`})}return{ecosystem:"swift-pm",tools:n,warnings:r}};var _R={npm:lR,pypi:dR,cargo:gC,go:QA,rubygems:hR,maven:oR,gradle:rR,composer:bC,hex:cR,pub:dA,nuget:XA,"swift-pm":yR};f();f();var bR=se(Pe(),1);import{readFile as ZX,readdir as vR}from"fs/promises";import{homedir as DX}from"os";import{join as Bw}from"path";f();function Ke(t){if(!t)return;let e=t.trim();if(!e||(e.startsWith("git+")&&(e=e.slice(4)),e.startsWith("github:")&&(e=`https://github.com/${e.slice(7)}`),/^[A-Za-z0-9_.\-]+\/[A-Za-z0-9_.\-]+$/.test(e)&&(e=`https://github.com/${e}`),e=e.replace(/^git@github\.com:/,"https://github.com/"),e=e.replace(/^ssh:\/\/git@github\.com\//,"https://github.com/"),e=e.replace(/^http:\/\//,"https://"),!/^https:\/\/github\.com\//.test(e)))return;e=e.replace(/\.git$/,""),e=e.replace(/\/$/,"");let r=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)/);if(r)return`https://github.com/${r[1]}/${r[2]}`}var FX=(0,bR.createMcpLogger)({name:"@toolcairn/tools:resolver:cargo"});async function UX(t,e){let r=Bw(DX(),".cargo","registry","src");if(!await nt(r))return null;let n;try{n=await vR(r)}catch{return null}let s=[];for(let o of n){let i=Bw(r,o);if(!await nt(i))continue;let a;try{a=await vR(i)}catch{continue}for(let c of a){if(!c.startsWith(`${t}-`)||e&&c!==`${t}-${e}`)continue;let u=Bw(i,c,"Cargo.toml");await Z(u)&&s.push(u)}}return s.length===0?null:(s.sort(),s[s.length-1]??null)}async function wR(t,e,r,n={}){let s=await UX(r,n.resolved_version);if(!s)return{};try{let o=await ZX(s,"utf-8"),a=Pr(o).package;if(!a)return{};let c={};a.name&&a.name!==r&&(c.canonical_package_name=a.name),a.version&&(c.resolved_version=a.version);let u=Ke(a.repository??a.homepage);return u&&(c.github_url=u),c}catch(o){return FX.debug({err:o instanceof Error?o.message:String(o),manifestPath:s},"Failed to parse cached Cargo.toml"),{}}}f();var xR=se(Pe(),1);import{readFile as VX}from"fs/promises";import{join as BX}from"path";var HX=(0,xR.createMcpLogger)({name:"@toolcairn/tools:resolver:composer"});async function SR(t,e,r){let n=BX(t,"vendor",r,"composer.json");if(!await Z(n))return{};try{let s=JSON.parse(await VX(n,"utf-8")),o={};s.name&&s.name!==r&&(o.canonical_package_name=s.name),s.version&&(o.resolved_version=s.version);let i=s.source?.url??s.support?.source??s.homepage,a=Ke(i);return a&&(o.github_url=a),o}catch(s){return HX.debug({err:s instanceof Error?s.message:String(s),path:n},"Failed to parse installed composer.json"),{}}}f();function kR(t,e,r){if(!r.startsWith("github.com/"))return{};let s=r.slice(11).split("/");if(s.length<2||!s[0]||!s[1])return{};let o=s[0],i=s[1];i=i.replace(/\.git$/,"");let a=Ke(`https://github.com/${o}/${i}`);return a?{github_url:a}:{}}f();import{readdir as $R}from"fs/promises";import{homedir as JX}from"os";import{join as Hw}from"path";f();var ER=se(Pe(),1),TR=se(ru(),1);import{readFile as KX}from"fs/promises";var GX=(0,ER.createMcpLogger)({name:"@toolcairn/tools:resolver:pom"});async function op(t,e){if(!await Z(t))return{};try{let r=await KX(t,"utf-8"),o=new TR.XMLParser({ignoreAttributes:!0,parseTagValue:!0}).parse(r).project;if(!o)return{};let i={},a=o.groupId&&o.artifactId?`${o.groupId}:${o.artifactId}`:void 0;a&&a!==e&&(i.canonical_package_name=a),o.version&&(i.resolved_version=o.version);let c=[o.scm?.url,o.scm?.connection,o.scm?.developerConnection,o.url];for(let u of c){let l=Ke(u);if(l){i.github_url=l;break}}return i}catch(r){return GX.debug({err:r instanceof Error?r.message:String(r),path:t},"Failed to parse .pom"),{}}}async function WX(t,e,r){let n=Hw(JX(),".gradle","caches","modules-2","files-2.1",t,e);if(!await nt(n))return null;let s;try{s=await $R(n)}catch{return null}let o=r&&s.includes(r)?r:s.sort().at(-1);if(!o)return null;let i=Hw(n,o),a;try{a=await $R(i)}catch{return null}for(let c of a)return Hw(i,c,`${e}-${o}.pom`);return null}async function IR(t,e,r,n={}){let s=r.indexOf(":");if(s<0)return{};let o=r.slice(0,s),i=r.slice(s+1);if(!o||!i)return{};let a=await WX(o,i,n.resolved_version);return a?op(a,r):{}}f();var PR=se(Pe(),1);import{readFile as OR}from"fs/promises";import{join as Kw}from"path";var YX=(0,PR.createMcpLogger)({name:"@toolcairn/tools:resolver:hex"});function XX(t){let e=t.match(/<<"GitHub">>\s*,\s*<<"([^"]+)">>/i);if(e?.[1]||(e=t.match(/<<"[^"]*github[^"]*">>\s*,\s*<<"(https?:\/\/[^"]+)">>/i),e?.[1]))return e[1]}function QX(t){let e=t.match(/@source_url\s*\(?\s*["']([^"']+)["']/);if(e?.[1])return e[1];let r=t.match(/\bsource_url\s*:\s*["']([^"']+)["']/);if(r?.[1])return r[1]}async function CR(t,e,r){let n=Kw(t,"deps",r),s={},o=Kw(n,"hex_metadata.config");if(await Z(o))try{let i=await OR(o,"utf-8"),a=XX(i),c=Ke(a);c&&(s.github_url=c)}catch(i){YX.debug({err:i instanceof Error?i.message:String(i),metaPath:o},"Failed to read hex_metadata.config")}if(!s.github_url){let i=Kw(n,"mix.exs");if(await Z(i))try{let a=await OR(i,"utf-8"),c=QX(a),u=Ke(c);u&&(s.github_url=u)}catch{}}return s}f();import{readdir as eQ}from"fs/promises";import{homedir as tQ}from"os";import{join as NR}from"path";async function rQ(t,e,r){let n=t.replace(/\./g,"/"),s=NR(tQ(),".m2","repository",n,e);if(!await nt(s))return null;let o;try{o=await eQ(s)}catch{return null}let i;return r&&o.includes(r)?i=r:(o.sort(),i=o[o.length-1]),i?NR(s,i,`${e}-${i}.pom`):null}async function AR(t,e,r,n={}){let s=r.indexOf(":");if(s<0)return{};let o=r.slice(0,s),i=r.slice(s+1);if(!o||!i)return{};let a=await rQ(o,i,n.resolved_version);return a?op(a,r):{}}f();var jR=se(Pe(),1);import{readFile as nQ}from"fs/promises";import{join as RR}from"path";var sQ=(0,jR.createMcpLogger)({name:"@toolcairn/tools:resolver:npm"});function oQ(t){let e=t.repository;if(e)return typeof e=="string"?e:e.url}async function iQ(t,e,r){let n=t,s=e;for(let o=0;o<10;o++){let i=RR(n,"node_modules",r,"package.json");if(await Z(i))return i;if(n===s)break;let a=RR(n,"..");if(a===n)break;n=a}return null}async function zR(t,e,r){let n=await iQ(t,e,r);if(!n)return{};let s;try{s=JSON.parse(await nQ(n,"utf-8"))}catch(c){return sQ.debug({err:c instanceof Error?c.message:String(c),manifestPath:n},"Failed to parse installed package.json \u2014 skipping url resolution"),{}}let o={};s.name&&s.name!==r&&(o.canonical_package_name=s.name),s.version&&(o.resolved_version=s.version);let i=oQ(s),a=Ke(i);return a&&(o.github_url=a),o}f();var LR=se(Pe(),1),qR=se(ru(),1);import{readFile as aQ,readdir as cQ}from"fs/promises";import{homedir as uQ}from"os";import{join as MR}from"path";var lQ=(0,LR.createMcpLogger)({name:"@toolcairn/tools:resolver:nuget"});async function dQ(t,e){let r=MR(uQ(),".nuget","packages",t.toLowerCase());if(!await nt(r))return null;let n;try{n=await cQ(r)}catch{return null}let s=e&&n.includes(e)?e:n.sort().at(-1);if(!s)return null;let o=MR(r,s,`${t.toLowerCase()}.nuspec`);return await Z(o)?o:null}async function ZR(t,e,r,n={}){let s=await dQ(r,n.resolved_version);if(!s)return{};try{let o=await aQ(s,"utf-8"),c=new qR.XMLParser({ignoreAttributes:!1}).parse(o).package?.metadata;if(!c)return{};let u={};c.id&&c.id!==r&&(u.canonical_package_name=c.id),c.version&&(u.resolved_version=c.version);let l=c.repository?.["@_url"]??c.repository?.url,d=Ke(l??c.projectUrl);return d&&(u.github_url=d),u}catch(o){return lQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to parse .nuspec"),{}}}f();var DR=se(Pe(),1),FR=se(Xc(),1);import{readFile as fQ}from"fs/promises";import{homedir as pQ,platform as hQ}from"os";import{join as ip}from"path";var mQ=(0,DR.createMcpLogger)({name:"@toolcairn/tools:resolver:pub"});function gQ(){if(hQ()==="win32"){let t=process.env.LOCALAPPDATA;if(t)return ip(t,"Pub","Cache","hosted","pub.dev")}return ip(pQ(),".pub-cache","hosted","pub.dev")}async function yQ(t,e){let r=gQ();if(e){let n=ip(r,`${t}-${e}`,"pubspec.yaml");return await Z(n)?n:null}try{let{readdir:n}=await import("fs/promises"),i=(await n(r)).filter(c=>c.startsWith(`${t}-`)).sort().at(-1);if(!i)return null;let a=ip(r,i,"pubspec.yaml");return await Z(a)?a:null}catch{return null}}async function UR(t,e,r,n={}){let s=await yQ(r,n.resolved_version);if(!s)return{};try{let o=await fQ(s,"utf-8"),i=(0,FR.parse)(o),a={};i.name&&i.name!==r&&(a.canonical_package_name=i.name),i.version&&(a.resolved_version=i.version);let c=Ke(i.repository??i.homepage);return c&&(a.github_url=c),a}catch(o){return mQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to parse pubspec.yaml"),{}}}f();var BR=se(Pe(),1);import{readFile as _Q,readdir as VR}from"fs/promises";import{join as nu}from"path";var vQ=(0,BR.createMcpLogger)({name:"@toolcairn/tools:resolver:pypi"});async function bQ(t){let e=[],r=[".venv","venv",".virtualenv"];for(let n of r){let s=nu(t,n);if(!await nt(s))continue;let o=nu(s,"Lib","site-packages");await nt(o)&&e.push(o);let i=nu(s,"lib");if(await nt(i))try{for(let a of await VR(i)){if(!a.startsWith("python"))continue;let c=nu(i,a,"site-packages");await nt(c)&&e.push(c)}}catch{}}return e}function ap(t){return t.toLowerCase().replace(/[._]+/g,"-")}async function wQ(t,e){let r=ap(e),n;try{n=await VR(t)}catch{return null}for(let s of n){if(!s.endsWith(".dist-info"))continue;let o=s.replace(/-[^-]+\.dist-info$/,"");if(ap(o)===r){let i=nu(t,s,"METADATA");if(await Z(i))return i}}return null}function xQ(t){let e=[],r,n,s=t.split(`
|
|
290
|
+
`);for(let o of s){if(o.trim()==="")break;let i=o.indexOf(":");if(i<0)continue;let a=o.slice(0,i).trim(),c=o.slice(i+1).trim();if(a==="Name"&&!r)r=c;else if(a==="Version"&&!n)n=c;else if(a==="Home-page")e.push(c);else if(a==="Project-URL"){let u=c.indexOf(",");u>=0?e.push(c.slice(u+1).trim()):e.push(c)}}return{name:r,version:n,urls:e}}async function HR(t,e,r){let n=await bQ(t);for(let s of n){let o=await wQ(s,r);if(o)try{let i=await _Q(o,"utf-8"),{name:a,version:c,urls:u}=xQ(i),l={};a&&ap(a)!==ap(r)&&(l.canonical_package_name=a),c&&(l.resolved_version=c);for(let d of u){let p=Ke(d);if(p){l.github_url=p;break}}return l}catch(i){vQ.debug({err:i instanceof Error?i.message:String(i),path:o},"Failed to parse METADATA")}}return{}}f();var GR=se(Pe(),1);import{readFile as SQ,readdir as KR}from"fs/promises";import{homedir as kQ}from"os";import{join as cp}from"path";var EQ=(0,GR.createMcpLogger)({name:"@toolcairn/tools:resolver:ruby"});async function TQ(t,e,r){let n=[],s=cp(t,"vendor","bundle","ruby");if(await nt(s))try{for(let i of await KR(s)){let a=cp(s,i,"specifications");await nt(a)&&n.push(a)}}catch{}let o=cp(kQ(),".gem","specifications");await nt(o)&&n.push(o);for(let i of n){let a;try{a=await KR(i)}catch{continue}let u=a.filter(l=>l.endsWith(".gemspec")&&l.startsWith(`${e}-`)).filter(l=>r?l===`${e}-${r}.gemspec`:!0).sort().at(-1);if(u){let l=cp(i,u);if(await Z(l))return l}}return null}function $Q(t){let e={},r=n=>{let s=t.match(n);return s?s[1]:void 0};return e.name=r(/(?:s|spec)\.name\s*=\s*(['"])([^'"]+)\1/)?t.match(/(?:s|spec)\.name\s*=\s*['"]([^'"]+)['"]/)?.[1]:void 0,e.version=t.match(/(?:s|spec)\.version\s*=\s*['"]([^'"]+)['"]/)?.[1],e.homepage=t.match(/(?:s|spec)\.homepage\s*=\s*['"]([^'"]+)['"]/)?.[1],e.source_code_uri=t.match(/["']source_code_uri["']\s*=>\s*["']([^'"]+)["']/)?.[1],e}async function JR(t,e,r,n={}){let s=await TQ(t,r,n.resolved_version);if(!s)return{};try{let o=await SQ(s,"utf-8"),i=$Q(o),a={};i.name&&i.name!==r&&(a.canonical_package_name=i.name),i.version&&(a.resolved_version=i.version);let c=Ke(i.source_code_uri??i.homepage);return c&&(a.github_url=c),a}catch(o){return EQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to read/parse gemspec"),{}}}f();var WR=se(Pe(),1);import{readFile as IQ}from"fs/promises";import{join as OQ}from"path";var PQ=(0,WR.createMcpLogger)({name:"@toolcairn/tools:resolver:swift-pm"});async function YR(t,e,r){let n=OQ(t,"Package.resolved");if(!await Z(n))return{};try{let s=await IQ(n,"utf-8"),o=JSON.parse(s),i={};for(let a of o.pins??[])if(a.identity===r){a.state?.version&&(i.resolved_version=a.state.version);let c=Ke(a.location);return c&&(i.github_url=c),i}for(let a of o.object?.pins??[])if(a.package===r){a.state?.version&&(i.resolved_version=a.state.version);let c=Ke(a.repositoryURL);return c&&(i.github_url=c),i}return{}}catch(s){return PQ.debug({err:s instanceof Error?s.message:String(s),path:n},"Failed to parse Package.resolved during resolve"),{}}}var XR={npm:zR,pypi:HR,cargo:wR,go:(t,e,r)=>kR(t,e,r),rubygems:JR,maven:AR,gradle:IR,composer:SR,hex:CR,pub:UR,nuget:ZR,"swift-pm":YR};f();import{readdir as QR}from"fs/promises";import{join as Gw,relative as CQ,sep as NQ}from"path";async function ej(t,e){let r=new Set,n=new Set;for(let s of e){let o=s.trim();if(!o)continue;let i=o.startsWith("!"),c=(i?o.slice(1):o).replace(/\\/g,"/"),u=await AQ(t,c),l=i?r:n;for(let d of u)l.add(d)}return[...n].filter(s=>!r.has(s)).sort()}async function AQ(t,e){let r=e.split("/").filter(Boolean),n=[];return await su(t,t,r,0,n),n}async function su(t,e,r,n,s){if(n>=r.length){await nt(e)&&s.push(e);return}let o=r[n];if(o){if(o==="**"){await su(t,e,r,n+1,s);try{let i=await QR(e,{withFileTypes:!0});for(let a of i)!a.isDirectory()||po.has(a.name)||await su(t,Gw(e,a.name),r,n,s)}catch{}return}if(o.includes("*")){let i=RQ(o);try{let a=await QR(e,{withFileTypes:!0});for(let c of a)!c.isDirectory()||po.has(c.name)||i.test(c.name)&&await su(t,Gw(e,c.name),r,n+1,s)}catch{}return}await su(t,Gw(e,o),r,n+1,s)}}function RQ(t){let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${e}$`)}function up(t,e){return CQ(t,e).split(NQ).join("/")}f();import{readFile as Ki}from"fs/promises";import{join as Gi}from"path";var tj=se(Xc(),1);async function lp(t,e=5){let r=[],n=new Set([t]),s=new Set,o=[{dir:t,depth:0}];for(;o.length>0;){let{dir:i,depth:a}=o.shift();if(s.has(i)||a>e)continue;s.add(i);let c=await jQ(i,r);if(c.length===0)continue;let u=await ej(i,c);for(let l of u)n.has(l)||(n.add(l),o.push({dir:l,depth:a+1}))}return{paths:[...n].sort(),warnings:r}}async function jQ(t,e){let r=[],n=Gi(t,"pnpm-workspace.yaml");if(await Z(n))try{let u=(0,tj.parse)(await Ki(n,"utf-8"));Array.isArray(u.packages)&&r.push(...u.packages)}catch(u){e.push({scope:"workspace:pnpm",path:n,message:`Failed to parse pnpm-workspace.yaml: ${u instanceof Error?u.message:String(u)}`})}let s=Gi(t,"package.json");if(await Z(s))try{let u=JSON.parse(await Ki(s,"utf-8"));Array.isArray(u.workspaces)?r.push(...u.workspaces):u.workspaces&&Array.isArray(u.workspaces.packages)&&r.push(...u.workspaces.packages)}catch(u){e.push({scope:"workspace:package-json",path:s,message:`Failed to parse package.json#workspaces: ${u instanceof Error?u.message:String(u)}`})}let o=Gi(t,"Cargo.toml");if(await Z(o))try{let u=Pr(await Ki(o,"utf-8"));Array.isArray(u.workspace?.members)&&r.push(...u.workspace.members)}catch(u){e.push({scope:"workspace:cargo",path:o,message:`Failed to parse Cargo workspace: ${u instanceof Error?u.message:String(u)}`})}let i=Gi(t,"go.work");if(await Z(i))try{let u=await Ki(i,"utf-8"),l=u.match(/use\s*\(([^)]*)\)/s);if(l?.[1])for(let d of l[1].split(`
|
|
291
291
|
`)){let p=d.trim().replace(/^['"]|['"]$/g,"");p&&!p.startsWith("//")&&r.push(p)}else for(let d of u.split(`
|
|
292
|
-
`)){let p=d.match(/^\s*use\s+(.+)$/);p?.[1]&&r.push(p[1].trim().replace(/^['"]|['"]$/g,""))}}catch(u){e.push({scope:"workspace:go",path:i,message:`Failed to parse go.work: ${u instanceof Error?u.message:String(u)}`})}let a=Gi(t,"lerna.json");if(await Z(a))try{let u=JSON.parse(await Ki(a,"utf-8"));Array.isArray(u.packages)&&r.push(...u.packages)}catch(u){e.push({scope:"workspace:lerna",path:a,message:`Failed to parse lerna.json: ${u instanceof Error?u.message:String(u)}`})}let c=Gi(t,"nx.json");if(await Z(c))try{let l=JSON.parse(await Ki(c,"utf-8")).workspaceLayout?.projectsDir??"packages";r.push(`${l}/*`)}catch(u){e.push({scope:"workspace:nx",path:c,message:`Failed to parse nx.json: ${u instanceof Error?u.message:String(u)}`})}return r}var Jw=(0,tj.createMcpLogger)({name:"@toolcairn/tools:scan-project"});async function Yw(t,e={}){let r=Date.now(),{batchResolve:n,maxDepth:s=5}=e,o=Ww(t),i=[];Jw.info({projectRoot:o},"Starting project scan");let{paths:a,warnings:c}=await lp(o,s);i.push(...c);let u=[],l=new Set,d=[],p=[],g=[];for(let C of a){let z=up(o,C),V=await r1(C);for(let te of V){l.add(te);let pe=yR[te];g.push(pe({workspace_dir:C,workspace_rel:z,project_root:o}).then(ee=>{u.push(...ee.tools),i.push(...ee.warnings),ee.tools.length>0&&z!==""&&(p.find(Fe=>Fe.path===z&&Fe.ecosystem===te)||p.push({path:z,manifest:NQ(te),ecosystem:te}))}).catch(ee=>{d.push(`${te}@${z||"."}`),i.push({scope:`parser:${te}`,path:z||".",message:`Parser crashed: ${ee instanceof Error?ee.message:String(ee)}`})}))}}await Promise.all(g);let h=new Map;for(let C of u){let z=`${C.ecosystem}:${C.name}`,V={workspace_path:C.workspace_path,manifest_file:C.manifest_file,section:C.section,ecosystem:C.ecosystem,version_constraint:C.version_constraint,resolved_version:C.resolved_version},te=h.get(z);te?te.locations.some(ee=>ee.workspace_path===V.workspace_path&&ee.manifest_file===V.manifest_file&&ee.section===V.section)||te.locations.push(V):h.set(z,{name:C.name,ecosystem:C.ecosystem,locations:[V]})}await Promise.all([...h.values()].map(async C=>{let z=YR[C.ecosystem];if(z)for(let V of C.locations){let te=Ww(o,V.workspace_path),pe={resolved_version:V.resolved_version};try{let ee=await z(te,o,C.name,pe);if(ee.canonical_package_name&&(C.canonical_package_name=ee.canonical_package_name),ee.github_url&&(C.local_github_url=ee.github_url),ee.canonical_package_name||ee.github_url)break}catch(ee){Jw.debug({ecosystem:C.ecosystem,name:C.name,workspace:V.workspace_path,err:ee instanceof Error?ee.message:String(ee)},"Resolver threw \u2014 skipping this location")}}}));let m=a.map(C=>up(o,C)),_=await s1(o,m),b=[...h.values()].map(({name:C,ecosystem:z,canonical_package_name:V,local_github_url:te})=>({name:C,ecosystem:z,canonical_package_name:V,github_url:te})),w=new Map,x=new Map,T=new Map;if(n&&b.length>0)try{let C=await n(b);for(let z of C.results){let V=`${z.input.ecosystem}:${z.input.name}`;w.set(V,z)}for(let[z,V]of C.methods)x.set(z,V);for(let[z,V]of C.githubUrls)T.set(z,V);i.push(...C.warnings)}catch(C){i.push({scope:"batch-resolve",message:`Failed to resolve tools against graph: ${C instanceof Error?C.message:String(C)}. Falling back to local classification.`})}else n||i.push({scope:"batch-resolve",message:"No batchResolve client provided \u2014 running in offline-only mode; all tools classified as non_oss."});let P=n1(u,w),L=new Date().toISOString(),U=[],$=0;for(let{name:C,ecosystem:z,locations:V,local_github_url:te}of h.values()){let pe=`${z}:${C}`,ee=w.get(pe),Ie=x.get(pe)??"none",Fe=ee?.matched===!0;Fe&&$++;let Ne=Fe?"toolcairn":"non_oss",lu=ee?.tool?.canonical_name,Kj=ee?.tool?.categories,Gj=T.get(pe)??te,Jj=V.find(xp=>xp.resolved_version)?.resolved_version??V[0]?.version_constraint,gr=ee?.tool,wp=gr?.docs?{readme_url:gr.docs.readme_url??void 0,docs_url:gr.docs.docs_url??void 0,api_url:gr.docs.api_url??void 0,changelog_url:gr.docs.changelog_url??void 0}:void 0,Wj=wp&&Object.values(wp).some(xp=>xp!==void 0);U.push({name:C,source:Ne,github_url:Gj,version:Jj,chosen_at:L,chosen_reason:"Auto-detected from manifest during toolcairn_init scan",alternatives_considered:[],canonical_name:lu,categories:Kj,match_method:Ie,locations:V,description:gr?.description??void 0,license:gr?.license??void 0,homepage_url:gr?.homepage_url??void 0,docs:Wj?wp:void 0,package_managers:gr?.package_managers&&gr.package_managers.length>0?gr.package_managers:void 0})}U.sort((C,z)=>{let V=te=>te.source==="toolcairn"?0:1;return V(C)!==V(z)?V(C)-V(z):C.name.localeCompare(z.name)}),p.sort((C,z)=>C.path.localeCompare(z.path));let N=await RQ(o),F={ecosystems_scanned:[...l].sort(),parsers_failed:d.sort(),tools_resolved:$,tools_unresolved:U.length-$,duration_ms:Date.now()-r,completed_at:L};return Jw.info({projectRoot:o,workspaces:a.length,ecosystems:F.ecosystems_scanned,tools:U.length,resolved:$,languages:_.map(C=>C.name),frameworks:P.map(C=>C.name),duration_ms:F.duration_ms},"Project scan complete"),{name:N,languages:_,frameworks:P,subprojects:p,tools:U,warnings:i,scan_metadata:F}}function NQ(t){switch(t){case"npm":return"package.json";case"pypi":return"pyproject.toml";case"cargo":return"Cargo.toml";case"go":return"go.mod";case"rubygems":return"Gemfile";case"maven":return"pom.xml";case"gradle":return"build.gradle";case"composer":return"composer.json";case"hex":return"mix.exs";case"pub":return"pubspec.yaml";case"nuget":return"*.csproj";case"swift-pm":return"Package.swift"}}async function RQ(t){let e=Ww(t,"package.json");if(await Z(e))try{let r=JSON.parse(await CQ(e,"utf-8"));if(r.name)return r.name}catch{}return AQ(t)}f();var sj=se(Oe(),1);import{readdir as nj}from"fs/promises";import{resolve as Xw}from"path";var rj=(0,sj.createMcpLogger)({name:"@toolcairn/tools:discover-roots"}),jQ=["package.json","Cargo.toml","pyproject.toml","requirements.txt","setup.py","setup.cfg","go.mod","Gemfile","pom.xml","build.gradle","build.gradle.kts","composer.json","mix.exs","pubspec.yaml","Package.swift"],zQ=[".csproj",".fsproj",".sln"];async function Qw(t,e={}){let{maxDepth:r=5}=e,n=Xw(t),s=await MQ(n,r);if(s.length===0)return rj.info({cwd:n},"No project roots discovered \u2014 falling back to cwd itself"),{roots:[n],usedFallback:!0};s.sort((a,c)=>a.split(/[\\/]/).length-c.split(/[\\/]/).length||a.localeCompare(c));let o=new Set(s);for(let a of s){if(!o.has(a))continue;let c=await lp(a,r).catch(()=>({paths:[a]}));if(!(c.paths.length<=1))for(let u of c.paths)u!==a&&o.has(u)&&o.delete(u)}let i=[...o].sort();return rj.info({cwd:n,candidates:s.length,roots:i.length},"Discovered project roots"),{roots:i,usedFallback:!1}}async function MQ(t,e){let r=[],n=[{dir:t,depth:0}];for(;n.length>0;){let s=n.shift();if(!s)break;let{dir:o,depth:i}=s;if(i>e)continue;await LQ(o)&&r.push(o);let a;try{a=await nj(o,{withFileTypes:!0})}catch{continue}for(let c of a)c.isDirectory()&&(po.has(c.name)||c.name.startsWith(".")||n.push({dir:Xw(o,c.name),depth:i+1}))}return[...new Set(r)]}async function LQ(t){if(!await nt(t))return!1;for(let r of jQ)if(await Z(Xw(t,r)))return!0;let e;try{e=await nj(t)}catch{return!1}for(let r of e)for(let n of zQ)if(r.endsWith(n))return!0;return!1}f();var oj=process.platform==="win32",qQ=oj?{toolcairn:{command:"cmd",args:["/c","npx","-y","@neurynae/toolcairn-mcp"]}}:{toolcairn:{command:"npx",args:["-y","@neurynae/toolcairn-mcp"]}},Io='\n## ToolCairn MCP \u2014 Tool Intelligence\n\nGraph-backed catalog of tools with health, compatibility, and issue data. Always consult before recommending a tool/library/framework. The server owns `.toolcairn/config.json` + `audit-log.jsonl` under a cross-process lock \u2014 never read/write these files directly; use the MCP tools.\n\n### First-turn protocol\n\n1. `read_project_config({ project_root })`. If `status:"not_initialized"`, call `toolcairn_init`. (Auto-init usually ran during `toolcairn_auth` already.)\n2. **If `unknown_tools[]` is non-empty** \u2014 BEFORE replying to the user:\n - `suggest_graph_update({ suggestion_type:"new_tool", data:{ tools: <unknown_tools array> } })` \u2014 entries are STAGED for admin review, NOT live.\n - `update_project_config({ action:"mark_suggestions_sent", data:{ tool_names: <names that staged ok> } })`.\n - Repeat per root in monorepos (each has its own list).\n\n### Tool reference\n\n| Tool | Trigger |\n|------|---------|\n| `classify_prompt` | User describes a task \u2014 decide whether tool search is needed |\n| `refine_requirement` | Decompose a use case into searchable sub-needs (required input for `get_stack`) |\n| `search_tools` | Find the best tool for one specific need |\n| `search_tools_respond` | Submit clarification answers for an in-progress search session |\n| `get_stack` | Build a version-compatible multi-layer stack for a use case |\n| `compare_tools` | Head-to-head comparison of two tools |\n| `check_compatibility` | Version-aware compatibility check between two tools |\n| `check_issue` | LAST RESORT \u2014 known-bug lookup after 4+ retries + docs review |\n| `verify_suggestion` | Validate agent-picked tool names against the graph |\n| `report_outcome` | Fire-and-forget feedback after using a recommended tool |\n| `suggest_graph_update` | Stage a new tool / edge / use-case for admin review (never writes live) |\n| `toolcairn_init` | Manual project re-scan (auto-init usually covers it) |\n| `read_project_config` | Load project snapshot (confirmed, pending, unknown, stale, metadata) |\n| `update_project_config` | Mutate confirmed tools or mark unknown suggestions sent |\n| `toolcairn_auth` | Login / status / logout for ToolCairn credentials |\n\n### Rules\n\n- Never recommend a tool that isn\'t in `confirmed_tools` without first hitting `search_tools` / `get_stack`.\n- After selecting a tool: `update_project_config({ action:"add_tool", tool_name, data: {...} })`. Pass `data.source:"non_oss"` for proprietary picks.\n- After using a tool (success or failure): `report_outcome`.\n- Use `check_issue` only after docs + 4 retries \u2014 it\'s network-heavy.\n- Confirmed tools in config.json carry graph enrichment: `description`, `license`, `homepage_url`, `docs.{readme_url,docs_url,api_url,changelog_url}`, and `package_managers[]` with install commands. Prefer these over re-fetching.\n- Suggestions are STAGED; admin approval gates live-graph promotion.\n';function ZQ(){return{file_path:"CLAUDE.md",mode:"append",content:Io}}function DQ(){return{file_path:".cursorrules",mode:"append",content:Io}}function FQ(){return{file_path:".windsurfrules",mode:"append",content:Io}}function UQ(){return{file_path:".github/copilot-instructions.md",mode:"create",content:`# GitHub Copilot Instructions
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
`)){let p=d.match(/^\s*use\s+(.+)$/);p?.[1]&&r.push(p[1].trim().replace(/^['"]|['"]$/g,""))}}catch(u){e.push({scope:"workspace:go",path:i,message:`Failed to parse go.work: ${u instanceof Error?u.message:String(u)}`})}let a=Gi(t,"lerna.json");if(await Z(a))try{let u=JSON.parse(await Ki(a,"utf-8"));Array.isArray(u.packages)&&r.push(...u.packages)}catch(u){e.push({scope:"workspace:lerna",path:a,message:`Failed to parse lerna.json: ${u instanceof Error?u.message:String(u)}`})}let c=Gi(t,"nx.json");if(await Z(c))try{let l=JSON.parse(await Ki(c,"utf-8")).workspaceLayout?.projectsDir??"packages";r.push(`${l}/*`)}catch(u){e.push({scope:"workspace:nx",path:c,message:`Failed to parse nx.json: ${u instanceof Error?u.message:String(u)}`})}return r}var Jw=(0,rj.createMcpLogger)({name:"@toolcairn/tools:scan-project"});async function Yw(t,e={}){let r=Date.now(),{batchResolve:n,maxDepth:s=5}=e,o=Ww(t),i=[];Jw.info({projectRoot:o},"Starting project scan");let{paths:a,warnings:c}=await lp(o,s);i.push(...c);let u=[],l=new Set,d=[],p=[],g=[];for(let C of a){let z=up(o,C),V=await nC(C);for(let te of V){l.add(te);let pe=_R[te];g.push(pe({workspace_dir:C,workspace_rel:z,project_root:o}).then(ee=>{u.push(...ee.tools),i.push(...ee.warnings),ee.tools.length>0&&z!==""&&(p.find(Fe=>Fe.path===z&&Fe.ecosystem===te)||p.push({path:z,manifest:LQ(te),ecosystem:te}))}).catch(ee=>{d.push(`${te}@${z||"."}`),i.push({scope:`parser:${te}`,path:z||".",message:`Parser crashed: ${ee instanceof Error?ee.message:String(ee)}`})}))}}await Promise.all(g);let h=new Map;for(let C of u){let z=`${C.ecosystem}:${C.name}`,V={workspace_path:C.workspace_path,manifest_file:C.manifest_file,section:C.section,ecosystem:C.ecosystem,version_constraint:C.version_constraint,resolved_version:C.resolved_version},te=h.get(z);te?te.locations.some(ee=>ee.workspace_path===V.workspace_path&&ee.manifest_file===V.manifest_file&&ee.section===V.section)||te.locations.push(V):h.set(z,{name:C.name,ecosystem:C.ecosystem,locations:[V]})}await Promise.all([...h.values()].map(async C=>{let z=XR[C.ecosystem];if(z)for(let V of C.locations){let te=Ww(o,V.workspace_path),pe={resolved_version:V.resolved_version};try{let ee=await z(te,o,C.name,pe);if(ee.canonical_package_name&&(C.canonical_package_name=ee.canonical_package_name),ee.github_url&&(C.local_github_url=ee.github_url),ee.canonical_package_name||ee.github_url)break}catch(ee){Jw.debug({ecosystem:C.ecosystem,name:C.name,workspace:V.workspace_path,err:ee instanceof Error?ee.message:String(ee)},"Resolver threw \u2014 skipping this location")}}}));let m=a.map(C=>up(o,C)),_=await oC(o,m),b=[...h.values()].map(({name:C,ecosystem:z,canonical_package_name:V,local_github_url:te})=>({name:C,ecosystem:z,canonical_package_name:V,github_url:te})),w=new Map,x=new Map,T=new Map;if(n&&b.length>0)try{let C=await n(b);for(let z of C.results){let V=`${z.input.ecosystem}:${z.input.name}`;w.set(V,z)}for(let[z,V]of C.methods)x.set(z,V);for(let[z,V]of C.githubUrls)T.set(z,V);i.push(...C.warnings)}catch(C){i.push({scope:"batch-resolve",message:`Failed to resolve tools against graph: ${C instanceof Error?C.message:String(C)}. Falling back to local classification.`})}else n||i.push({scope:"batch-resolve",message:"No batchResolve client provided \u2014 running in offline-only mode; all tools classified as non_oss."});let O=sC(u,w),L=new Date().toISOString(),U=[],$=0;for(let{name:C,ecosystem:z,locations:V,local_github_url:te}of h.values()){let pe=`${z}:${C}`,ee=w.get(pe),Ie=x.get(pe)??"none",Fe=ee?.matched===!0;Fe&&$++;let Ae=Fe?"toolcairn":"non_oss",lu=ee?.tool?.canonical_name,Xj=ee?.tool?.categories,Qj=T.get(pe)??te,ez=V.find(xp=>xp.resolved_version)?.resolved_version??V[0]?.version_constraint,gr=ee?.tool,wp=gr?.docs?{readme_url:gr.docs.readme_url??void 0,docs_url:gr.docs.docs_url??void 0,api_url:gr.docs.api_url??void 0,changelog_url:gr.docs.changelog_url??void 0}:void 0,tz=wp&&Object.values(wp).some(xp=>xp!==void 0);U.push({name:C,source:Ae,github_url:Qj,version:ez,chosen_at:L,chosen_reason:"Auto-detected from manifest during toolcairn_init scan",alternatives_considered:[],canonical_name:lu,categories:Xj,match_method:Ie,locations:V,description:gr?.description??void 0,license:gr?.license??void 0,homepage_url:gr?.homepage_url??void 0,docs:tz?wp:void 0,package_managers:gr?.package_managers&&gr.package_managers.length>0?gr.package_managers:void 0})}U.sort((C,z)=>{let V=te=>te.source==="toolcairn"?0:1;return V(C)!==V(z)?V(C)-V(z):C.name.localeCompare(z.name)}),p.sort((C,z)=>C.path.localeCompare(z.path));let A=await qQ(o),F={ecosystems_scanned:[...l].sort(),parsers_failed:d.sort(),tools_resolved:$,tools_unresolved:U.length-$,duration_ms:Date.now()-r,completed_at:L};return Jw.info({projectRoot:o,workspaces:a.length,ecosystems:F.ecosystems_scanned,tools:U.length,resolved:$,languages:_.map(C=>C.name),frameworks:O.map(C=>C.name),duration_ms:F.duration_ms},"Project scan complete"),{name:A,languages:_,frameworks:O,subprojects:p,tools:U,warnings:i,scan_metadata:F}}function LQ(t){switch(t){case"npm":return"package.json";case"pypi":return"pyproject.toml";case"cargo":return"Cargo.toml";case"go":return"go.mod";case"rubygems":return"Gemfile";case"maven":return"pom.xml";case"gradle":return"build.gradle";case"composer":return"composer.json";case"hex":return"mix.exs";case"pub":return"pubspec.yaml";case"nuget":return"*.csproj";case"swift-pm":return"Package.swift"}}async function qQ(t){let e=Ww(t,"package.json");if(await Z(e))try{let r=JSON.parse(await zQ(e,"utf-8"));if(r.name)return r.name}catch{}return MQ(t)}f();var oj=se(Pe(),1);import{readdir as sj}from"fs/promises";import{resolve as Xw}from"path";var nj=(0,oj.createMcpLogger)({name:"@toolcairn/tools:discover-roots"}),ZQ=["package.json","Cargo.toml","pyproject.toml","requirements.txt","setup.py","setup.cfg","go.mod","Gemfile","pom.xml","build.gradle","build.gradle.kts","composer.json","mix.exs","pubspec.yaml","Package.swift"],DQ=[".csproj",".fsproj",".sln"];async function Qw(t,e={}){let{maxDepth:r=5}=e,n=Xw(t),s=await FQ(n,r);if(s.length===0)return nj.info({cwd:n},"No project roots discovered \u2014 falling back to cwd itself"),{roots:[n],usedFallback:!0};s.sort((a,c)=>a.split(/[\\/]/).length-c.split(/[\\/]/).length||a.localeCompare(c));let o=new Set(s);for(let a of s){if(!o.has(a))continue;let c=await lp(a,r).catch(()=>({paths:[a]}));if(!(c.paths.length<=1))for(let u of c.paths)u!==a&&o.has(u)&&o.delete(u)}let i=[...o].sort();return nj.info({cwd:n,candidates:s.length,roots:i.length},"Discovered project roots"),{roots:i,usedFallback:!1}}async function FQ(t,e){let r=[],n=[{dir:t,depth:0}];for(;n.length>0;){let s=n.shift();if(!s)break;let{dir:o,depth:i}=s;if(i>e)continue;await UQ(o)&&r.push(o);let a;try{a=await sj(o,{withFileTypes:!0})}catch{continue}for(let c of a)c.isDirectory()&&(po.has(c.name)||c.name.startsWith(".")||n.push({dir:Xw(o,c.name),depth:i+1}))}return[...new Set(r)]}async function UQ(t){if(!await nt(t))return!1;for(let r of ZQ)if(await Z(Xw(t,r)))return!0;let e;try{e=await sj(t)}catch{return!1}for(let r of e)for(let n of DQ)if(r.endsWith(n))return!0;return!1}f();var ij=process.platform==="win32",VQ=ij?{toolcairn:{command:"cmd",args:["/c","npx","-y","@neurynae/toolcairn-mcp"]}}:{toolcairn:{command:"npx",args:["-y","@neurynae/toolcairn-mcp"]}},aj="<!-- toolcairn:start -->",cj="<!-- toolcairn:end -->",Io=`${aj}
|
|
293
|
+
<!-- ToolCairn MCP \u2014 15-tool flow guide. Managed by @neurynae/toolcairn-mcp;
|
|
294
|
+
do not edit between markers. -->
|
|
295
|
+
|
|
296
|
+
### ToolCairn \u2014 when to call which tool
|
|
297
|
+
|
|
298
|
+
Always consult ToolCairn before recommending a library / CLI / framework.
|
|
299
|
+
|
|
300
|
+
**Session entry.** Call \`toolcairn_auth\` once. The auth response auto-runs \`toolcairn_init\` for every project root under CWD; call \`toolcairn_init\` explicitly only when \`read_project_config\` returns \`not_initialized\`.
|
|
301
|
+
|
|
302
|
+
**Before answering ANY user request \u2014 per project root**
|
|
303
|
+
|
|
304
|
+
1. \`read_project_config\` \u2014 load the snapshot.
|
|
305
|
+
2. Drain non-empty \`unknown_tools[]\`: \`suggest_graph_update\` (stages them for admin review) \u2192 \`update_project_config\` action \`mark_suggestions_sent\`.
|
|
306
|
+
3. Each \`pending_outcomes[]\` entry still owes a \`report_outcome\` \u2014 fire it as soon as the underlying tool is used.
|
|
307
|
+
|
|
308
|
+
**Use the on-disk state, not just MCP tools**
|
|
309
|
+
|
|
310
|
+
\`.toolcairn/\` is a local knowledge base \u2014 read it freely, never write directly (mutations go through \`update_project_config\`).
|
|
311
|
+
|
|
312
|
+
- \`.toolcairn/config.json\` \u2192 \`tools.confirmed[]\` carries every tool's full enrichment: \`description\`, \`license\`, \`homepage_url\`, \`docs.{readme_url,docs_url,api_url,changelog_url}\`, \`package_managers[].install_commands[]\`, \`version\` (resolved from the lockfile), \`categories\`, \`locations[]\` (workspaces + manifest paths). When the user asks "how do I install X?", "where are X's docs?", "what version of X are we on?", "where is X used?" \u2014 read config.json. Do NOT call \`search_tools\` or hit the network.
|
|
313
|
+
- \`tools.unknown_in_graph[]\` tracks which candidates still owe \`suggest_graph_update\` (\`suggested:true\` is already drained).
|
|
314
|
+
- \`project.subprojects[]\` + per-tool \`locations[]\` reveal monorepo layout \u2014 pick the right \`project_root\` before mutating.
|
|
315
|
+
- \`.toolcairn/audit-log.jsonl\` is the append-only journal \u2014 tail it to recover a recent \`query_id\` or de-dup against an identical recent search.
|
|
316
|
+
|
|
317
|
+
**Per user request**
|
|
318
|
+
|
|
319
|
+
1. \`classify_prompt\` to decide if ToolCairn is needed at all. Branch on the returned classification:
|
|
320
|
+
2. \`tool_discovery\` (one specific need) \u2192 \`search_tools\`. If the response asks clarification questions \u2192 \`search_tools_respond\` (loop until complete).
|
|
321
|
+
3. \`stack_building\` (multi-layer "build me a \u2026") \u2192 \`refine_requirement\` \u2192 feed its \`sub_needs\` into \`get_stack\`.
|
|
322
|
+
4. \`tool_comparison\` ("X vs Y") \u2192 \`compare_tools\`.
|
|
323
|
+
5. Anything else \u2192 answer directly, ToolCairn isn't the right surface.
|
|
324
|
+
|
|
325
|
+
**Validate + persist (after the agent picks tools)**
|
|
326
|
+
|
|
327
|
+
1. \`verify_suggestion\` to confirm every pick exists in the graph; not-indexed picks route through \`suggest_graph_update\` instead of \`add_tool\`.
|
|
328
|
+
2. \`check_compatibility\` between picks when versions are uncertain.
|
|
329
|
+
3. \`update_project_config\` action \`add_tool\` for each accepted tool \u2014 record the \`query_id\` and \`chosen_reason\`.
|
|
330
|
+
|
|
331
|
+
**Close the loop**
|
|
332
|
+
|
|
333
|
+
- \`report_outcome\` after the user actually uses (or replaces) each tool. Fire-and-forget; never await.
|
|
334
|
+
|
|
335
|
+
**Last resort.** \`check_issue\` for known-bug lookup, ONLY after 4+ retries on the user's actual error and a docs review.
|
|
336
|
+
|
|
337
|
+
**Tracker.** Open \`.toolcairn/tracker.html\` in any browser \u2014 server-rewritten, auto-refreshes, shows every tool call + pending outcomes in real time.
|
|
338
|
+
${cj}`;function BQ(){return{file_path:"CLAUDE.md",mode:"append",content:Io}}function HQ(){return{file_path:".cursorrules",mode:"append",content:Io}}function KQ(){return{file_path:".windsurfrules",mode:"append",content:Io}}function GQ(){return{file_path:".github/copilot-instructions.md",mode:"append",content:Io}}function JQ(){return{file_path:".github/copilot-instructions.md",mode:"append",content:Io}}function WQ(){return{file_path:"AGENTS.md",mode:"append",content:Io}}function YQ(){return{file_path:"AI_INSTRUCTIONS.md",mode:"append",content:Io}}var uj=aj,e0=cj,lj="## ToolCairn MCP \u2014 Tool Intelligence";function dj(t){switch(t){case"claude":return BQ();case"cursor":return HQ();case"windsurf":return KQ();case"copilot":return GQ();case"copilot-cli":return JQ();case"opencode":return WQ();case"generic":return YQ()}}function fj(t){return t?{toolcairn:{command:"node",args:[t]}}:VQ}function pj(t){return t?{toolcairn:{type:"local",command:["node",t],enabled:!0}}:{toolcairn:{type:"local",command:ij?["cmd","/c","npx","-y","@neurynae/toolcairn-mcp"]:["npx","-y","@neurynae/toolcairn-mcp"],enabled:!0}}}var dp=(0,hj.createMcpLogger)({name:"@toolcairn/tools:auto-init"}),mj=`
|
|
295
339
|
# ToolCairn
|
|
296
340
|
.toolcairn/events.jsonl
|
|
297
341
|
.toolcairn/audit-log.jsonl
|
|
298
342
|
.toolcairn/audit-log.archive.jsonl
|
|
299
343
|
.toolcairn/config.json
|
|
300
|
-
`;async function ou(t){let{projectRoot:e,agent:r,batchResolve:n,serverPath:s,reason:o}=t;dp.info({projectRoot:e,agent:r},"autoInitProject starting");let i=await Yw(e,{batchResolve:n}),a=i.warnings.some($=>$.scope==="batch-resolve"&&/offline|falling back|unreachable|http /i.test($.message)),c=new Date().toISOString(),u=a?[]:i.tools.filter($=>$.source==="non_oss"&&!!$.github_url).map($=>{let
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
`}
|
|
344
|
+
`;async function ou(t){let{projectRoot:e,agent:r,batchResolve:n,serverPath:s,reason:o}=t;dp.info({projectRoot:e,agent:r},"autoInitProject starting");let i=await Yw(e,{batchResolve:n}),a=i.warnings.some($=>$.scope==="batch-resolve"&&/offline|falling back|unreachable|http /i.test($.message)),c=new Date().toISOString(),u=a?[]:i.tools.filter($=>$.source==="non_oss"&&!!$.github_url).map($=>{let A=$.locations?.[0]?.ecosystem??"npm";return{name:$.name,ecosystem:A,canonical_package_name:$.canonical_name,github_url:$.github_url,discovered_at:c,suggested:!1}}),l={action:"init",tool:"__project__",reason:o??`Auto-init: scanned ${i.tools.length} tools across ${i.scan_metadata.ecosystems_scanned.length} ecosystems; ${u.length} candidate(s) for graph submission.`,metadata:{project_name:i.name,tools_scanned:i.tools.length,tools_resolved:i.scan_metadata.tools_resolved,tools_unresolved:i.scan_metadata.tools_unresolved,unknown_in_graph:u.length,ecosystems_scanned:i.scan_metadata.ecosystems_scanned,languages:i.languages.map($=>$.name),frameworks:i.frameworks.map($=>$.name),scan_duration_ms:i.scan_metadata.duration_ms,batch_resolve_failed:a}},{config:d,audit_entry:p,bootstrapped:g,migrated:h}=await Xr(e,$=>{if($.project.name=i.name,$.project.languages=i.languages,$.project.frameworks=i.frameworks,$.project.subprojects=i.subprojects,$.scan_metadata=i.scan_metadata,!a){let F=new Map;for(let C of $.tools.confirmed){let z=C.locations?.[0]?.ecosystem??"";F.set(`${z}:${C.name}`,C)}$.tools.confirmed=i.tools.map(C=>{let z=C.locations?.[0]?.ecosystem??"",V=F.get(`${z}:${C.name}`);return V?{...C,chosen_at:V.chosen_at??C.chosen_at,confirmed_at:V.confirmed_at??V.chosen_at??C.chosen_at,last_verified:c,chosen_reason:V.chosen_reason&&V.chosen_reason.length>0?V.chosen_reason:C.chosen_reason,alternatives_considered:V.alternatives_considered&&V.alternatives_considered.length>0?V.alternatives_considered:C.alternatives_considered,query_id:V.query_id??C.query_id,notes:V.notes??C.notes}:C})}let A=new Map;for(let F of $.tools.unknown_in_graph??[])A.set(`${F.ecosystem}:${F.name}`,F);$.tools.unknown_in_graph=u.map(F=>{let C=A.get(`${F.ecosystem}:${F.name}`);return C?.suggested?{...F,suggested:!0,suggested_at:C.suggested_at}:F})},l),m=dj(r),_=r==="opencode",b=_?pj(s):fj(s),w=_?"opencode.json":".mcp.json",x=JSON.stringify(_?{mcp:b}:{mcpServers:b},null,2),T=[{step:1,action:"append-or-create",file:m.file_path,content:m.content,note:`Append the ToolCairn rules block to ${m.file_path} (or create it if missing).`},{step:2,action:"merge-or-create",file:w,content:x,note:_?`Merge the toolcairn entry into ${w} under "mcp".`:`Merge the toolcairn entry into ${w} under "mcpServers".`},{step:3,action:"append",file:".gitignore",content:mj,note:"Ignore runtime/audit files. config.json should be committed so teammates share tool intelligence."}],O=t.skipSetupFileWrites?T.map($=>({file:$.file,action:$.action,applied:!1,reason:"skipSetupFileWrites=true"})):await XQ(e,{agent:r,instructionFile:m.file_path,instructionContent:m.content,mcpConfigFile:w,mcpConfigEntry:b,isOpenCode:_}),L={total:d.tools.confirmed.length,indexed:d.tools.confirmed.filter($=>$.source==="toolcairn").length,non_oss:d.tools.confirmed.filter($=>$.source==="non_oss").length},U=(d.tools.unknown_in_graph??[]).filter($=>!$.suggested);return{project_root:e,instruction_file:m.file_path,config_path:".toolcairn/config.json",audit_log_path:".toolcairn/audit-log.jsonl",events_path:".toolcairn/events.jsonl",mcp_config_entry:b,setup_steps:T,applied_steps:O,scan_summary:{project_name:i.name,languages:i.languages.map($=>({name:$.name,file_count:$.file_count})),frameworks:i.frameworks,subprojects:i.subprojects,tool_counts:L,warnings:i.warnings,scan_metadata:i.scan_metadata},bootstrapped:g,migrated:h,last_audit_entry:p,unknown_tools:U}}async function XQ(t,e){let r=[];return r.push(await QQ(t0(t,e.instructionFile),e.instructionFile,e.instructionContent)),r.push(await tee(t0(t,e.mcpConfigFile),e.mcpConfigFile,e.mcpConfigEntry,e.isOpenCode)),r.push(await nee(t0(t,".gitignore"))),r}async function QQ(t,e,r){try{let n="",s=!1;await Z(t)&&(n=await r0(t,"utf-8"),s=!0);let o=eee(n,s,r);return s&&o===n?{file:e,action:"append-or-create",applied:!1,reason:"content already up to date"}:(await(0,Ji.default)(t,o,"utf-8"),{file:e,action:"append-or-create",applied:!0})}catch(n){let s=n instanceof Error?n.message:String(n);return dp.warn({err:n,file:e},"Failed to write instruction file"),{file:e,action:"append-or-create",applied:!1,reason:s}}}function eee(t,e,r){if(!e||t.length===0)return r;let n=t.indexOf(uj),s=t.indexOf(e0);if(n>=0&&s>n){let a=t.slice(0,n),c=t.slice(s+e0.length);return a+r+c}let o=t.indexOf(lj);if(o>=0){let a=t.slice(0,o).replace(/\s+$/,"");return a+(a.length>0?`
|
|
345
|
+
|
|
346
|
+
`:"")+r+`
|
|
347
|
+
`}return t.replace(/\s+$/,"")+`
|
|
348
|
+
|
|
349
|
+
`+r+`
|
|
350
|
+
`}async function tee(t,e,r,n){try{let s=await Z(t),o=n?"mcp":"mcpServers";if(!s){let p={[o]:r};return await(0,Ji.default)(t,`${JSON.stringify(p,null,2)}
|
|
351
|
+
`,"utf-8"),{file:e,action:"merge-or-create",applied:!0}}let i=await r0(t,"utf-8"),a;try{a=JSON.parse(i)}catch{return{file:e,action:"merge-or-create",applied:!1,reason:"existing file is not valid JSON \u2014 refusing to overwrite; fix manually"}}let c=a[o]&&typeof a[o]=="object"&&!Array.isArray(a[o])?a[o]:{},u=r.toolcairn??r,l={...a,[o]:{...c,toolcairn:u}},d=`${JSON.stringify(l,null,2)}
|
|
352
|
+
`;return i===d?{file:e,action:"merge-or-create",applied:!1,reason:"toolcairn entry already up to date"}:(await(0,Ji.default)(t,d,"utf-8"),{file:e,action:"merge-or-create",applied:!0})}catch(s){let o=s instanceof Error?s.message:String(s);return dp.warn({err:s,file:e},"Failed to write MCP config"),{file:e,action:"merge-or-create",applied:!1,reason:o}}}var gj="# toolcairn:start",yj="# toolcairn:end";function ree(){return`${gj}${mj}${yj}
|
|
353
|
+
`}async function nee(t){let e=".gitignore";try{let r=await Z(t),n=ree();if(!r)return await(0,Ji.default)(t,n,"utf-8"),{file:e,action:"append",applied:!0};let s=await r0(t,"utf-8"),o=s.indexOf(gj),i=s.indexOf(yj),a;if(o!==-1&&i!==-1&&i>o){let c=s.lastIndexOf(`
|
|
304
354
|
`,o)+1,u=s.indexOf(`
|
|
305
355
|
`,i),l=u===-1?s.length:u+1;a=s.slice(0,c)+n+s.slice(l)}else{let c=s.endsWith(`
|
|
306
356
|
`)?"":`
|
|
307
|
-
`;a=`${s}${c}${n}`}return a===s?{file:e,action:"append",applied:!1,reason:"block already up to date"}:(await(0,Ji.default)(t,a,"utf-8"),{file:e,action:"append",applied:!0})}catch(r){let n=r instanceof Error?r.message:String(r);return dp.warn({err:r,file:e},"Failed to write .gitignore"),{file:e,action:"append",applied:!1,reason:n}}}var
|
|
308
|
-
`)})}catch(e){return
|
|
357
|
+
`;a=`${s}${c}${n}`}return a===s?{file:e,action:"append",applied:!1,reason:"block already up to date"}:(await(0,Ji.default)(t,a,"utf-8"),{file:e,action:"append",applied:!0})}catch(r){let n=r instanceof Error?r.message:String(r);return dp.warn({err:r,file:e},"Failed to write .gitignore"),{file:e,action:"append",applied:!1,reason:n}}}var _j=(0,vj.createMcpLogger)({name:"@toolcairn/tools:toolcairn-init"});async function n0(t,e={}){try{_j.info({agent:t.agent,project_root:t.project_root},"toolcairn_init called");let r=await ou({projectRoot:t.project_root,agent:t.agent,batchResolve:e.batchResolve,serverPath:t.server_path,reason:"Explicit toolcairn_init call from agent"});return Wr({agent:t.agent,instruction_file:r.instruction_file,config_path:r.config_path,audit_log_path:r.audit_log_path,events_path:r.events_path,mcp_config_entry:r.mcp_config_entry,setup_steps:r.setup_steps,scan_summary:r.scan_summary,bootstrapped:r.bootstrapped,migrated:r.migrated,last_audit_entry:r.last_audit_entry,unknown_tools:r.unknown_tools,first_turn_directive:see(r.unknown_tools.length),next_steps:'Config written. Apply setup_steps (CLAUDE.md / .mcp.json / .gitignore). If unknown_tools is non-empty, drain it via suggest_graph_update (batch) + update_project_config action="mark_suggestions_sent" before responding to the user.'})}catch(r){return _j.error({err:r},"toolcairn_init failed"),dr("init_error",r instanceof Error?r.message:String(r))}}function see(t){return t===0?"":[`The scan found ${t} tool(s) not currently in the ToolCairn graph.`,'BEFORE responding to the user, call `suggest_graph_update` with suggestion_type="new_tool"',"and `data.tools = <unknown_tools array>` to STAGE them for admin review (they do NOT go live",'until approved). Then call `update_project_config` action="mark_suggestions_sent" with the',"tool_names that staged successfully."].join(" ")}f();var wj=se(Pe(),1);var s0=(0,wj.createMcpLogger)({name:"@toolcairn/tools:read-project-config"}),oee=90,iee=7,aee=new Set(["search_tools","search_tools_respond","get_stack"]);function cee(t){let e=Date.now()-iee*24*60*60*1e3,r=new Map;for(let n of t){if(n.action!=="tool_call"||!n.query_id||n.status==="error")continue;let s=Date.parse(n.timestamp);if(!(Number.isNaN(s)||s<e))if(n.mcp_tool&&aee.has(n.mcp_tool)){let o=typeof n.metadata?.query=="string"?n.metadata.query:typeof n.metadata?.use_case=="string"?n.metadata.use_case:null;r.set(n.query_id,{query_id:n.query_id,mcp_tool:n.mcp_tool,selected_at:n.timestamp,age_hours:Math.round((Date.now()-s)/(1e3*60*60)),candidates:n.candidates??[],query:o})}else n.mcp_tool==="report_outcome"&&r.delete(n.query_id)}return Array.from(r.values()).sort((n,s)=>Date.parse(n.selected_at)-Date.parse(s.selected_at))}function bj(t){return(Date.now()-new Date(t).getTime())/(1e3*60*60*24)}async function o0(t){try{s0.info({project_root:t.project_root},"read_project_config called");let{config:e,corrupt_backup_path:r}=await $i(t.project_root);if(!e)return Wr({status:"not_initialized",project_root:t.project_root,config_path:Dt(t.project_root),audit_log_path:_n(t.project_root),corrupt_backup_path:r,agent_instructions:r?`.toolcairn/config.json was unparseable \u2014 moved to ${r}. Call toolcairn_init with the project_root to re-discover and write a fresh config.`:"No .toolcairn/config.json present. Call toolcairn_init with the project_root to auto-discover the project and bootstrap the config."});let n=e,s=!1;(e.version==="1.0"||e.version==="1.1")&&(n=(await Xr(t.project_root,()=>{},{action:"migrate",tool:"__schema__",reason:`Lazy migration on first read: ${e.version} \u2192 1.2`})).config,s=!0);let o=n.tools.confirmed.map(m=>m.name),i=n.tools.pending_evaluation.map(m=>m.name),a=n.tools.confirmed.filter(m=>{let _=m.last_verified??m.chosen_at??m.confirmed_at;return _?bj(_)>oee:!0}).map(m=>{let _=m.last_verified??m.chosen_at??m.confirmed_at,b=_?Math.round(bj(_)):-1;return{name:m.name,last_verified:_??"unknown",days_since_verified:b,recommendation:"Consider using check_issue to verify no new known issues"}}),c=n.tools.confirmed.filter(m=>m.source==="non_oss").map(m=>m.name),u=(n.tools.unknown_in_graph??[]).filter(m=>!m.suggested),l=[];try{let m=await Ai(t.project_root);l=cee(m)}catch(m){s0.debug({err:m},"pending_outcomes derivation skipped (audit-log unreadable)")}let d=n.tools.confirmed.filter(m=>m.source==="toolcairn"||m.source==="toolpilot").map(m=>m.name),g=t.include_locations===!0?n.tools.confirmed.map(m=>({name:m.name,source:m.source,canonical_name:m.canonical_name,categories:m.categories??[],match_method:m.match_method??"none",github_url:m.github_url,locations:m.locations??[]})):void 0,h=[`Project: ${n.project.name}`,n.project.languages&&n.project.languages.length>0?`Languages: ${n.project.languages.map(m=>`${m.name} (${m.file_count} files)`).join(", ")}`:"",n.project.frameworks&&n.project.frameworks.length>0?`Frameworks: ${n.project.frameworks.map(m=>`${m.name}@${m.workspace}`).join(", ")}`:"",`Confirmed tools (${o.length}): ${o.join(", ")||"none"}`,"When recommending tools, skip any already in confirmed_tools.",c.length>0?`Non-OSS tools in project (handle separately): ${c.join(", ")}`:"",a.length>0?`Tools that may be stale \u2014 worth re-checking: ${a.map(m=>m.name).join(", ")}`:"",u.length>0?`Unknown-to-graph tools awaiting submission (${u.length}): ${u.map(m=>m.name).join(", ")}. BEFORE answering the user, call suggest_graph_update (suggestion_type="new_tool", data.tools=<this list>) to STAGE them for admin review, then update_project_config action="mark_suggestions_sent" with the successful tool_names.`:"",l.length>0?`Pending outcomes (${l.length}) \u2014 recommendations the user used but you have not yet reported on. As soon as the user uses (or replaces) one of the suggested tools, call report_outcome with the matching query_id: ${l.map(m=>`${m.query_id} (${m.mcp_tool}, ${m.age_hours}h ago${m.candidates.length>0?`, candidates: ${m.candidates.slice(0,3).join("/")}`:""})`).join("; ")}.`:""].filter(Boolean);return Wr({status:"ready",schema_version:n.version,migrated:s,project:{name:n.project.name,languages:n.project.languages??[],frameworks:n.project.frameworks??[],subprojects:n.project.subprojects??[]},confirmed_tools:o,pending_tools:i,non_oss_tools:c,toolcairn_indexed_tools:d,stale_tools:a,unknown_tools:u,total_confirmed:o.length,total_pending:i.length,total_unknown_undrained:u.length,pending_outcomes:l,total_pending_outcomes:l.length,last_audit_entry:n.last_audit_entry??null,scan_metadata:n.scan_metadata??null,confirmed_tools_detail:g,agent_instructions:h.join(`
|
|
358
|
+
`)})}catch(e){return s0.error({err:e},"read_project_config failed"),dr("read_config_error",e instanceof Error?e.message:String(e))}}f();var Sj=se(Pe(),1);var xj=(0,Sj.createMcpLogger)({name:"@toolcairn/tools:update-project-config"});async function i0(t){try{xj.info({project_root:t.project_root,action:t.action,tool:t.tool_name},"update_project_config called");let e=t.data??{},r=t.action==="mark_suggestions_sent",n=r?Array.isArray(e.tool_names)?e.tool_names.filter(d=>typeof d=="string"):[]:[];if(!r&&!t.tool_name)return dr("missing_field",`tool_name is required for action "${t.action}"`);if(r&&n.length===0)return dr("missing_field","mark_suggestions_sent requires data.tool_names: string[] with at least one entry");let s=!1,o=0,i=new Date().toISOString(),a={action:t.action,tool:r?`__batch__:${n.length}`:t.tool_name,reason:e.reason??e.chosen_reason??lee(t.action),...t.query_id?{query_id:t.query_id}:{},metadata:uee(t,e)},{config:c,audit_entry:u,bootstrapped:l}=await Xr(t.project_root,d=>{switch(t.action){case"add_tool":{let p=t.tool_name;if(d.tools.pending_evaluation=d.tools.pending_evaluation.filter(g=>g.name!==p),!d.tools.confirmed.some(g=>g.name===p)){let g={name:p,source:e.source??"toolcairn",github_url:e.github_url,version:e.version,chosen_at:i,chosen_reason:e.chosen_reason??"Selected via ToolCairn",alternatives_considered:e.alternatives_considered??[],query_id:e.query_id,notes:e.notes,locations:[]};d.tools.confirmed.push(g)}break}case"remove_tool":{let p=t.tool_name;d.tools.confirmed=d.tools.confirmed.filter(g=>g.name!==p),d.tools.pending_evaluation=d.tools.pending_evaluation.filter(g=>g.name!==p);break}case"update_tool":{let p=t.tool_name,g=d.tools.confirmed.findIndex(m=>m.name===p);if(g===-1){s=!0;return}let h=d.tools.confirmed[g];if(!h){s=!0;return}d.tools.confirmed[g]={...h,...e.version!==void 0?{version:e.version}:{},...e.notes!==void 0?{notes:e.notes}:{},...e.chosen_reason!==void 0?{chosen_reason:e.chosen_reason}:{},...e.alternatives_considered!==void 0?{alternatives_considered:e.alternatives_considered}:{},last_verified:i};break}case"add_evaluation":{let p=t.tool_name,g=d.tools.confirmed.some(m=>m.name===p),h=d.tools.pending_evaluation.some(m=>m.name===p);if(!g&&!h){let m={name:p,category:e.category??"other",added_at:i};d.tools.pending_evaluation.push(m)}break}case"mark_suggestions_sent":{let p=d.tools.unknown_in_graph??[],g=new Set(n);for(let h of p)g.has(h.name)&&!h.suggested&&(h.suggested=!0,h.suggested_at=i,o++);d.tools.unknown_in_graph=p;break}}},a);return s?dr("not_found",`Tool "${t.tool_name}" is not in the confirmed list \u2014 cannot update.`):Wr({action_applied:t.action,tool_name:t.tool_name,tool_names:r?n:void 0,marked_count:r?o:void 0,undrained_unknown_count:(c.tools.unknown_in_graph??[]).filter(d=>!d.suggested).length,confirmed_count:c.tools.confirmed.length,pending_count:c.tools.pending_evaluation.length,last_audit_entry:u,bootstrapped:l,config_path:".toolcairn/config.json",audit_log_path:".toolcairn/audit-log.jsonl"})}catch(e){return xj.error({err:e},"update_project_config failed"),dr("update_config_error",e instanceof Error?e.message:String(e))}}function uee(t,e){let r={config_action:t.action};switch(t.action){case"add_tool":{t.tool_name&&(r.tool_name=t.tool_name),typeof e.source=="string"&&(r.source=e.source),typeof e.version=="string"&&(r.version=e.version),typeof e.github_url=="string"&&(r.github_url=e.github_url),Array.isArray(e.alternatives_considered)&&(r.alternatives_count=e.alternatives_considered.length);break}case"remove_tool":case"update_tool":{t.tool_name&&(r.tool_name=t.tool_name),typeof e.version=="string"&&(r.version=e.version);break}case"add_evaluation":{t.tool_name&&(r.tool_name=t.tool_name);break}case"mark_suggestions_sent":{let n=Array.isArray(e.tool_names)?e.tool_names.filter(s=>typeof s=="string"):[];r.tool_names=n,r.tool_count=n.length;break}}return r}function lee(t){switch(t){case"add_tool":return"Added via ToolCairn recommendation";case"remove_tool":return"Removed from project";case"update_tool":return"Tool details updated";case"add_evaluation":return"Added for evaluation";case"mark_suggestions_sent":return"Agent successfully staged unknown tools via suggest_graph_update"}}var us=(0,Ej.createMcpLogger)({name:"@toolcairn/mcp-server:post-auth-init"});async function pee(){let t=await Or();return t?new lo({baseUrl:kj.config.TOOLPILOT_API_URL,apiKey:t.client_id,accessToken:t.access_token}):null}async function iu(t={}){let e=t.cwd??process.cwd(),r=t.agent??"claude",n=await pee();if(!n)return us.warn("runPostAuthInit called without valid credentials \u2014 skipping"),{cwd:e,roots_discovered:[],used_fallback:!1,projects:[],unknown_tools_total:0,first_turn_directive:""};let{roots:s,usedFallback:o}=await Qw(e);us.info({cwd:e,roots:s.length,usedFallback:o},"Roots discovered post-auth");let i=[];for(let u of s){if(t.onlyMissingConfig){let l=fee(u,".toolcairn","config.json");if(dee(l)){us.debug({projectRoot:u},"Root already has config.json \u2014 skipping");continue}}try{let l=await ou({projectRoot:u,agent:r,batchResolve:d=>n.batchResolve(d),reason:t.onlyMissingConfig?"Startup auto-init (config missing)":"Post-auth auto-init"});i.push({project_root:u,status:"initialized",config_path:l.config_path,audit_log_path:l.audit_log_path,scan_summary:l.scan_summary,setup_steps:l.setup_steps,unknown_tools:l.unknown_tools,bootstrapped:l.bootstrapped,migrated:l.migrated})}catch(l){let d=l instanceof Error?l.message:String(l);us.error({err:l,projectRoot:u},"autoInitProject failed for root"),i.push({project_root:u,status:"failed",error:d})}}if(!t.disableAutoSubmit)for(let u of i){if(u.status!=="initialized")continue;let l=(u.unknown_tools??[]).filter(d=>!!d.github_url);if(l.length!==0)try{let d=await hee(n,l);u.auto_submitted=d;let p=[...d.staged,...d.already_staged,...d.already_indexed];p.length>0&&await mee(u.project_root,p).catch(g=>us.warn({err:g,projectRoot:u.project_root},"Failed to flip suggested flags after auto-submit")),us.info({projectRoot:u.project_root,staged:d.staged.length,already_staged:d.already_staged.length,already_indexed:d.already_indexed.length,rejected:d.rejected.length},"Auto-push to suggest_graph_update complete")}catch(d){us.warn({err:d,projectRoot:u.project_root},"Auto-push to suggest_graph_update failed \u2014 agent directive remains as fallback")}}let a=i.reduce((u,l)=>u+(l.unknown_tools??[]).filter(d=>!d.suggested).length,0),c=gee(i,a);return{cwd:e,roots_discovered:s,used_fallback:o,projects:i,unknown_tools_total:a,first_turn_directive:c}}async function hee(t,e){let n=(await t.suggestGraphUpdate({suggestion_type:"new_tool",data:{tools:e.map(a=>({tool_name:a.name,github_url:a.github_url,ecosystem:a.ecosystem}))},confidence:.5})).content?.[0],s={staged:[],already_staged:[],already_indexed:[],rejected:[]};if(!n||n.type!=="text")return s;let o;try{o=JSON.parse(n.text??"{}")}catch{return s}let i=o.data?.results??[];for(let a of i){let c=a.tool_name??"";c&&(a.already_indexed?s.already_indexed.push(c):a.already_staged?s.already_staged.push(c):a.staged===!0?s.staged.push(c):s.rejected.push({tool_name:c,reason:a.reason??"unknown"}))}return s}async function mee(t,e){let r=new Set(e),n=new Date().toISOString(),s=0;await Xr(t,o=>{let i=o.tools.unknown_in_graph??[];for(let a of i)r.has(a.name)&&!a.suggested&&(a.suggested=!0,a.suggested_at=n,s++);o.tools.unknown_in_graph=i},{action:"mark_suggestions_sent",tool:`__auto_submit__:${e.length}`,reason:"Server auto-pushed unknown_in_graph tools to suggest_graph_update",metadata:{tool_names:e,tool_count:e.length}}),s===0&&us.debug({projectRoot:t,toolNames:e},"No unknown_in_graph entries flipped")}function gee(t,e){if(e===0)return"";let r=t.filter(s=>(s.unknown_tools??[]).filter(o=>!o.suggested).length>0);if(r.length===0)return"";let n=r.map(s=>s.project_root).join(", ");return[`The auto-init scan found ${e} tool(s) not yet in the ToolCairn graph`,`across ${r.length} project root(s): ${n}.`,"The server has already auto-submitted these to the admin review queue,","but you MAY repeat the call below to confirm \u2014 engine-side dedup prevents duplicates:",'(1) call `suggest_graph_update` with suggestion_type="new_tool" and'," data.tools=<that root's unknown_tools array>;",'(2) call `update_project_config` with action="mark_suggestions_sent",'," project_root, and data.tool_names=<names that staged or were already_staged>."].join(" ")}f();var Pj=se(Pe(),1);import{mkdir as See}from"fs/promises";import{platform as kee,type as Eee}from"os";import{join as Tee}from"path";f();var Ij=se(Pe(),1);import{mkdir as _ee,writeFile as vee}from"fs/promises";import{basename as bee,join as wee}from"path";f();function Tj(t){let e={rootName:t.rootName,generatedAt:new Date().toISOString(),entries:t.entries},r=JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");return yee.replace("__AUDIT_DATA_JSON__",r)}var yee=`<!DOCTYPE html>
|
|
309
359
|
<html lang="en">
|
|
310
360
|
<head>
|
|
311
361
|
<meta charset="UTF-8" />
|
|
@@ -770,10 +820,10 @@ startAuto();
|
|
|
770
820
|
|
|
771
821
|
</body>
|
|
772
822
|
</html>
|
|
773
|
-
`;var
|
|
774
|
-
`,"utf-8")}catch(r){Cj.warn({err:r,path:t},"Failed to write event to JSONL file")}}async function Wee(t){try{let e=await Pr();if(!e)return;let r={"Content-Type":"application/json"};e.access_token&&(r.Authorization=`Bearer ${e.access_token}`),e.client_id&&(r["X-ToolCairn-Key"]=e.client_id),await fetch(`${Pj.config.TOOLPILOT_API_URL}/v1/events`,{method:"POST",headers:r,body:JSON.stringify({tool_name:t.tool_name,query_id:t.query_id,duration_ms:t.duration_ms,status:t.status,metadata:t.metadata})})}catch(e){Cj.debug({err:e},"Failed to send event to API \u2014 non-fatal")}}function Aj(t,e){return async r=>{if(!Bee())return e(r);let n=Date.now(),s,o="ok";try{s=await e(r),s.isError&&(o="error")}catch(i){throw o="error",i}finally{let i=Date.now()-n,a={id:crypto.randomUUID(),tool_name:t,query_id:Kee(r),duration_ms:i,status:o,metadata:s?Gee(t,s):null,created_at:new Date().toISOString()};Wee(a).catch(()=>{});let c=Hee();c&&Jee(c,a).catch(()=>{})}return s??{content:[],isError:!0}}}var u0=(0,pp.createMcpLogger)({name:"@toolcairn/mcp-server:prod"}),Yee='\n# ToolCairn \u2014 Agent Setup Instructions\n\nYou are connected to the ToolCairn MCP server. ToolCairn is your active tool intelligence co-pilot.\n\n## The Server Owns .toolcairn/ (v0.10.0+)\n\nThe MCP server reads and writes `.toolcairn/config.json` + `.toolcairn/audit-log.jsonl`\natomically under a cross-process lock. You never touch those files directly.\n\n## On Every Session Start \u2014 Do This First\n\nCall `read_project_config` with `project_root` (absolute path to the user\'s project).\n\nIn most sessions config is already there: when the user ran `toolcairn_auth` the\nserver auto-discovered every project root under its CWD and ran the full 12-ecosystem\nscan + graph classification + config write for each. The auth response carried back\nper-root `projects[]` entries with `setup_steps` (CLAUDE.md / .mcp.json / .gitignore)\nand `unknown_tools[]`.\n\n- If `read_project_config` returns `status: "not_initialized"` for some root\n (rare \u2014 only when auto-init skipped that root): call `toolcairn_init` explicitly\n for that `project_root`.\n- If it returns `status: "ready"`: you have the full snapshot \u2014 review\n `stale_tools` / `pending_tools` / `unknown_tools` and proceed.\n\n## First-Turn Drain Protocol (REQUIRED before replying to the user)\n\nIf the auth response OR `read_project_config` returned non-empty `unknown_tools[]`\nfor a root, you MUST submit them before your first user-facing response:\n\n1. `suggest_graph_update` with `suggestion_type: "new_tool"` and\n `data.tools: <the full unknown_tools array for that root>`. Entries are STAGED\n for admin review \u2014 they do NOT enter the live graph until approved.\n2. `update_project_config` with `action: "mark_suggestions_sent"`,\n `project_root`, and `data.tool_names: [names that staged successfully]`.\n\nIn multi-root workspaces, repeat per root. This closes the learning loop so every\nproject contributes its OSS dependency tail back to the ToolCairn graph.\n\n## Applying Mutations\n\nWhen the user selects / replaces / drops a tool, call `update_project_config`\nwith `project_root`, `action` (add_tool / remove_tool / update_tool / add_evaluation),\nand `tool_name`. The server:\n- atomically updates `.toolcairn/config.json`,\n- appends a new line to `.toolcairn/audit-log.jsonl` (FIFO-archived at 1000 entries),\n- returns the new `last_audit_entry` for your record.\n\nDo NOT construct or write these files yourself \u2014 you do not have the cross-process\nlock that protects them.\n\n## Schema Migration\n\nConfigs written by v0.9.x are on schema 1.0. The first `read_project_config` or\n`update_project_config` call after upgrade migrates in place to 1.1 (languages \u2192\narray, frameworks \u2192 array, `audit_log[]` relocated from config.json to\naudit-log.jsonl). The migration is logged as an audit entry.\n\n## When to Use ToolCairn Tools\n\n| Situation | Tool to call |\n|-----------|-------------|\n| User asks which tool to use for X | `classify_prompt` \u2192 `refine_requirement` \u2192 `search_tools` |\n| User needs to compare two tools | `compare_tools` |\n| User asks if tool A works with tool B | `check_compatibility` |\n| Error persists after 4+ retries AND docs checked | `check_issue` |\n| User asks for a recommended stack | `get_stack` |\n| search_tools returns empty or low confidence | `verify_suggestion` |\n| You discover a new tool relationship | `suggest_graph_update` |\n| A tool worked well or was replaced | `report_outcome` |\n| Tool added/removed from project | `update_project_config` |\n'.trim();async function d0(t){let e=await Pr();if(!e||!Ti(e))throw new Error("ToolCairn: authentication required.");let r=new lo({baseUrl:l0.config.TOOLPILOT_API_URL,apiKey:e.client_id,accessToken:e.access_token});u0.info({user:e.user_email},"Registering production tools");function n(s,o){return Aj(s,Ij(s,(0,pp.withErrorHandling)(s,u0,o)))}t.registerTool("classify_prompt",{description:"Classify a developer prompt to determine if ToolCairn tool search is needed. Returns a structured classification prompt for the agent to evaluate.",inputSchema:sO},n("classify_prompt",async s=>gv(s))),t.registerTool("toolcairn_init",{description:"Bootstrap ToolCairn for the current project. Walks every workspace, parses manifests across 12 ecosystems, classifies tools against the ToolCairn graph, and writes .toolcairn/config.json + audit-log.jsonl atomically. Returns setup_steps for CLAUDE.md / .mcp.json / .gitignore (agent applies those).",inputSchema:tO},n("toolcairn_init",async s=>r0(s,{batchResolve:o=>r.batchResolve(o)}))),t.registerTool("read_project_config",{description:"Read .toolcairn/config.json from disk and return the structured project snapshot: project metadata, confirmed tools, stale tools, pending evaluations, and last audit entry. Auto-migrates v1.0 configs to v1.1 on first read.",inputSchema:rO},n("read_project_config",async s=>s0(s))),t.registerTool("update_project_config",{description:"Apply a mutation to .toolcairn/config.json (add_tool / remove_tool / update_tool / add_evaluation). The server atomically rewrites config.json and appends a new line to audit-log.jsonl under a cross-process lock. Requires project_root.",inputSchema:nO},n("update_project_config",async s=>o0(s))),t.registerTool("search_tools",{description:"Search for the best tool for a specific need using a natural language query. Initiates a guided discovery session with clarification questions when needed.",inputSchema:KP},n("search_tools",async s=>r.searchTools(s))),t.registerTool("search_tools_respond",{description:"Submit clarification answers for an in-progress tool search session and receive refined results.",inputSchema:GP},n("search_tools_respond",async s=>r.searchToolsRespond(s))),t.registerTool("get_stack",{description:'Build a complementary tool stack for a project use case. For best results, call refine_requirement first with classification "stack_building", evaluate its decomposition_prompt to get sub-needs, then pass each {sub_need_type, keyword_sentence} object as a sub_needs entry. This lets get_stack keyword-match per layer (e.g. "web-framework", "database", "auth") instead of one broad search. Falls back to balanced search when sub_needs is omitted. Each tool in the returned stack also carries a `version` object with the recommended version that is cross-compatible with the rest of the stack (downgraded from latest if needed to satisfy peer constraints), plus a top-level `compatibility_matrix` + `stack_compatibility` summarising cross-tool version fit.',inputSchema:WP},n("get_stack",async s=>r.getStack(s))),t.registerTool("check_compatibility",{description:'Check compatibility between two tools with version-aware matching. When both tools have declared dependency metadata (npm peerDependencies, PyPI requires_dist, etc.) the handler evaluates range constraints directly and returns a version_checks array plus runtime_requirements. Pass optional tool_a_version / tool_b_version to evaluate specific versions (e.g. "is next@14 compatible with react@17?"). Falls back to graph-edge + shared-neighbors inference when version metadata is unavailable. Response includes `source`: "declared_dependency" | "graph_edges" | "shared_neighbors".',inputSchema:XP},n("check_compatibility",async s=>r.checkCompatibility(s))),t.registerTool("compare_tools",{description:"Compare two tools head-to-head using health signals, graph relationships, and community data.",inputSchema:eO},n("compare_tools",async s=>r.compareTools(s))),t.registerTool("refine_requirement",{description:"Decompose a vague user use-case into specific, searchable tool requirements.",inputSchema:iO},n("refine_requirement",async s=>r.refineRequirement(s))),t.registerTool("check_issue",{description:"LAST RESORT \u2014 check GitHub Issues for a known error after 4+ retries and docs review.",inputSchema:YP},n("check_issue",async s=>r.checkIssue(s))),t.registerTool("verify_suggestion",{description:"Validate agent-suggested tools against the ToolCairn graph.",inputSchema:oO},n("verify_suggestion",async s=>r.verifySuggestion(s))),t.registerTool("report_outcome",{description:"Report the outcome of using a tool recommended by ToolCairn (fire-and-forget).",inputSchema:JP},n("report_outcome",async s=>r.reportOutcome(s))),t.registerTool("suggest_graph_update",{description:"Suggest a new tool, relationship, use case, or health update to the ToolCairn graph.",inputSchema:QP},n("suggest_graph_update",async s=>r.suggestGraphUpdate(s))),t.registerTool("toolcairn_auth",{description:'Manage your ToolCairn authentication. Use "login" to authenticate via browser (unlocks higher rate limits), "status" to check current auth state, or "logout" to revert to anonymous mode.',inputSchema:R.object({action:R.enum(["login","status","logout"]).describe('"login" opens a browser to authenticate, "status" shows current auth state, "logout" clears authentication')})},n("toolcairn_auth",async s=>{let o=s.action;if(o==="status"){let i=await Pr(),a=i!==null&&Ti(i);return{content:[{type:"text",text:JSON.stringify({authenticated:a,user_email:i?.user_email??null,user_name:i?.user_name??null,authenticated_at:i?.authenticated_at??null})}]}}if(o==="logout")return await mv(),{content:[{type:"text",text:JSON.stringify({ok:!0,message:"Signed out. Restart your agent to sign in again \u2014 authentication will start automatically."})}]};try{let i=await pc(l0.config.TOOLPILOT_API_URL),a=await iu({agent:"claude"}).catch(c=>(u0.warn({err:c},"runPostAuthInit failed post-login \u2014 auth still succeeds"),null));return{content:[{type:"text",text:JSON.stringify({ok:!0,message:`Successfully authenticated as ${i.email}. All tools are now authorized.`,user_email:i.email,user_name:i.name,roots_discovered:a?.roots_discovered??[],projects:a?.projects??[],unknown_tools_total:a?.unknown_tools_total??0,first_turn_directive:a?.first_turn_directive??""})}]}}catch(i){let a=i instanceof Error?i.message:"Authentication failed";return{content:[{type:"text",text:JSON.stringify({ok:!1,error:a})}],isError:!0}}}))}async function Nj(){let t=new pi({name:"toolcairn",version:"0.1.0"},{instructions:Yee});return await d0(t),t}f();f();import jj from"process";f();var hp=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
775
|
-
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
776
|
-
`}var mp=class{constructor(e=jj.stdin,r=jj.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new hp,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=Rj(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};f();f();import{Http2ServerRequest as qj,constants as Qee}from"http2";import{Http2ServerRequest as f0}from"http2";import{Readable as zj}from"stream";import dte from"crypto";var Po=class extends Error{constructor(t,e){super(t,e),this.name="RequestError"}},ete=t=>t instanceof Po?t:new Po(t.message,{cause:t}),tte=global.Request,cu=class extends tte{constructor(t,e){typeof t=="object"&&Xi in t&&(t=t[Xi]()),typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(t,e)}},rte=t=>{let e=[],r=t.rawHeaders;for(let n=0;n<r.length;n+=2){let{[n]:s,[n+1]:o}=r;s.charCodeAt(0)!==58&&e.push([s,o])}return new Headers(e)},Zj=Symbol("wrapBodyStream"),nte=(t,e,r,n,s)=>{let o={method:t,headers:r,signal:s.signal};if(t==="TRACE"){o.method="GET";let i=new cu(e,o);return Object.defineProperty(i,"method",{get(){return"TRACE"}}),i}if(!(t==="GET"||t==="HEAD"))if("rawBody"in n&&n.rawBody instanceof Buffer)o.body=new ReadableStream({start(i){i.enqueue(n.rawBody),i.close()}});else if(n[Zj]){let i;o.body=new ReadableStream({async pull(a){try{i||=zj.toWeb(n).getReader();let{done:c,value:u}=await i.read();c?a.close():a.enqueue(u)}catch(c){a.error(c)}}})}else o.body=zj.toWeb(n);return new cu(e,o)},Xi=Symbol("getRequestCache"),ste=Symbol("requestCache"),gp=Symbol("incomingKey"),yp=Symbol("urlKey"),ote=Symbol("headersKey"),Yi=Symbol("abortControllerKey"),ite=Symbol("getAbortController"),_p={get method(){return this[gp].method||"GET"},get url(){return this[yp]},get headers(){return this[ote]||=rte(this[gp])},[ite](){return this[Xi](),this[Yi]},[Xi](){return this[Yi]||=new AbortController,this[ste]||=nte(this.method,this[yp],this.headers,this[gp],this[Yi])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(t=>{Object.defineProperty(_p,t,{get(){return this[Xi]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(_p,t,{value:function(){return this[Xi]()[t]()}})});Object.setPrototypeOf(_p,cu.prototype);var ate=(t,e)=>{let r=Object.create(_p);r[gp]=t;let n=t.url||"";if(n[0]!=="/"&&(n.startsWith("http://")||n.startsWith("https://"))){if(t instanceof f0)throw new Po("Absolute URL for :path is not allowed in HTTP/2");try{let a=new URL(n);r[yp]=a.href}catch(a){throw new Po("Invalid absolute URL",{cause:a})}return r}let s=(t instanceof f0?t.authority:t.headers.host)||e;if(!s)throw new Po("Missing host header");let o;if(t instanceof f0){if(o=t.scheme,!(o==="http"||o==="https"))throw new Po("Unsupported scheme")}else o=t.socket&&t.socket.encrypted?"https":"http";let i=new URL(`${o}://${s}${n}`);if(i.hostname.length!==s.length&&i.hostname!==s.replace(/:\d+$/,""))throw new Po("Invalid host header");return r[yp]=i.href,r},Mj=Symbol("responseCache"),Wi=Symbol("getResponseCache"),Oo=Symbol("cache"),g0=global.Response,uu=class Dj{#r;#t;[Wi](){return delete this[Oo],this[Mj]||=new g0(this.#r,this.#t)}constructor(e,r){let n;if(this.#r=e,r instanceof Dj){let s=r[Mj];if(s){this.#t=s,this[Wi]();return}else this.#t=r.#t,n=new Headers(r.#t.headers)}else this.#t=r;(typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(this[Oo]=[r?.status||200,e,n||r?.headers])}get headers(){let e=this[Oo];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[Wi]().headers}get status(){return this[Oo]?.[0]??this[Wi]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(uu.prototype,t,{get(){return this[Wi]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(uu.prototype,t,{value:function(){return this[Wi]()[t]()}})});Object.setPrototypeOf(uu,g0);Object.setPrototypeOf(uu.prototype,g0.prototype);async function cte(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}function Fj(t,e,r){let n=a=>{t.cancel(a).catch(()=>{})};return e.on("close",n),e.on("error",n),(r??t.read()).then(i,s),t.closed.finally(()=>{e.off("close",n),e.off("error",n)});function s(a){a&&e.destroy(a)}function o(){t.read().then(i,s)}function i({done:a,value:c}){try{if(a)e.end();else if(!e.write(c))e.once("drain",o);else return t.read().then(i,s)}catch(u){s(u)}}}function ute(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:Fj(t.getReader(),e)}var h0=t=>{let e={};t instanceof Headers||(t=new Headers(t??void 0));let r=[];for(let[n,s]of t)n==="set-cookie"?r.push(s):e[n]=s;return r.length>0&&(e["set-cookie"]=r),e["content-type"]??="text/plain; charset=UTF-8",e},lte="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=dte);var y0=Symbol("outgoingEnded"),Lj=Symbol("incomingDraining"),fte=500,pte=64*1024*1024,p0=t=>{let e=t;if(t.destroyed||e[Lj])return;if(e[Lj]=!0,t instanceof qj){try{t.stream?.close?.(Qee.NGHTTP2_NO_ERROR)}catch{}return}let r=0,n=()=>{clearTimeout(o),t.off("data",i),t.off("end",n),t.off("error",n)},s=()=>{n();let a=t.socket;a&&!a.destroyed&&a.destroySoon()},o=setTimeout(s,fte);o.unref?.();let i=a=>{r+=a.length,r>pte&&s()};t.on("data",i),t.on("end",n),t.on("error",n),t.resume()},hte=()=>new Response(null,{status:400}),Uj=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.constructor.name==="TimeoutError")?504:500}),m0=(t,e)=>{let r=t instanceof Error?t:new Error("unknown error",{cause:t});r.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(t),e.headersSent||e.writeHead(500,{"Content-Type":"text/plain"}),e.end(`Error: ${r.message}`),e.destroy(r))},Vj=t=>{"flushHeaders"in t&&t.writable&&t.flushHeaders()},Bj=async(t,e)=>{let[r,n,s]=t[Oo],o=!1;if(!s)s={"content-type":"text/plain; charset=UTF-8"};else if(s instanceof Headers)o=s.has("content-length"),s=h0(s);else if(Array.isArray(s)){let i=new Headers(s);o=i.has("content-length"),s=h0(i)}else for(let i in s)if(i.length===14&&i.toLowerCase()==="content-length"){o=!0;break}o||(typeof n=="string"?s["Content-Length"]=Buffer.byteLength(n):n instanceof Uint8Array?s["Content-Length"]=n.byteLength:n instanceof Blob&&(s["Content-Length"]=n.size)),e.writeHead(r,s),typeof n=="string"||n instanceof Uint8Array?e.end(n):n instanceof Blob?e.end(new Uint8Array(await n.arrayBuffer())):(Vj(e),await ute(n,e)?.catch(i=>m0(i,e))),e[y0]?.()},mte=t=>typeof t.then=="function",gte=async(t,e,r={})=>{if(mte(t))if(r.errorHandler)try{t=await t}catch(s){let o=await r.errorHandler(s);if(!o)return;t=o}else t=await t.catch(Uj);if(Oo in t)return Bj(t,e);let n=h0(t.headers);if(t.body){let s=t.body.getReader(),o=[],i=!1,a;if(n["transfer-encoding"]!=="chunked"){let c=2;for(let u=0;u<c;u++){a||=s.read();let l=await cte(a).catch(d=>{console.error(d),i=!0});if(!l){if(u===1){await new Promise(d=>setTimeout(d)),c=3;continue}break}if(a=void 0,l.value&&o.push(l.value),l.done){i=!0;break}}i&&!("content-length"in n)&&(n["content-length"]=o.reduce((u,l)=>u+l.length,0))}e.writeHead(t.status,n),o.forEach(c=>{e.write(c)}),i?e.end():(o.length===0&&Vj(e),await Fj(s,e,a))}else n[lte]||(e.writeHead(t.status,n),e.end());e[y0]?.()},_0=(t,e={})=>{let r=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==cu&&(Object.defineProperty(global,"Request",{value:cu}),Object.defineProperty(global,"Response",{value:uu})),async(n,s)=>{let o,i;try{i=ate(n,e.hostname);let a=!r||n.method==="GET"||n.method==="HEAD";if(a||(n[Zj]=!0,n.on("end",()=>{a=!0}),n instanceof qj&&(s[y0]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{p0(n)})})}),s.on("finish",()=>{a||p0(n)})),s.on("close",()=>{i[Yi]&&(n.errored?i[Yi].abort(n.errored.toString()):s.writableFinished||i[Yi].abort("Client connection prematurely closed.")),a||setTimeout(()=>{a||setTimeout(()=>{p0(n)})})}),o=t(i,{incoming:n,outgoing:s}),Oo in o)return Bj(o,s)}catch(a){if(o)return m0(a,s);if(e.errorHandler){if(o=await e.errorHandler(i?a:ete(a)),!o)return}else i?o=Uj(a):o=hte()}try{return await gte(o,s,e)}catch(a){return m0(a,s)}}};f();var vp=class{constructor(e={}){this._started=!1,this._hasHandledRequest=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}createJsonErrorResponse(e,r,n,s){let o={code:r,message:n};return s?.data!==void 0&&(o.data=s.data),new Response(JSON.stringify({jsonrpc:"2.0",error:o,id:null}),{status:e,headers:{"Content-Type":"application/json",...s?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=e.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let n=`Invalid Host header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=e.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let n=`Invalid Origin header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}}}async handleRequest(e,r){if(!this.sessionIdGenerator&&this._hasHandledRequest)throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;let n=this.validateRequestHeaders(e);if(n)return n;switch(e.method){case"POST":return this.handlePostRequest(e,r);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(e,r,n,s){if(!this._eventStore||s<"2025-11-25")return;let o=await this._eventStore.storeEvent(n,{}),i=`id: ${o}
|
|
823
|
+
`;var $j=(0,Ij.createMcpLogger)({name:"@toolcairn/mcp-server:write-tracker"}),xee=750,a0=new Map;async function au(t){try{let e=pr(t);await _ee(e,{recursive:!0});let r=await Ai(t).catch(()=>[]),n=Tj({rootName:bee(t)||t,entries:r});await vee(wee(e,"tracker.html"),n,"utf-8"),$j.debug({projectRoot:t,entryCount:r.length},"tracker.html written with embedded audit data")}catch(e){$j.debug({err:e,projectRoot:t},"tracker.html write skipped (non-fatal)")}}function Oj(t){let e=a0.get(t);e&&clearTimeout(e);let r=setTimeout(()=>{a0.delete(t),au(t)},xee);typeof r.unref=="function"&&r.unref(),a0.set(t,r)}var c0=(0,Pj.createMcpLogger)({name:"@toolcairn/mcp-server:project-setup"});function $ee(){let t=kee();return{platform:t,label:{win32:"Windows",darwin:"macOS",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"Solaris",android:"Android"}[t]??Eee()}}async function Cj(t=process.cwd()){let e=$ee();c0.info({os:e.label,platform:e.platform,projectRoot:t},"Detected OS \u2014 starting project setup");let r=Tee(t,".toolcairn");try{await See(r,{recursive:!0}),await au(t),c0.info({dir:r,os:e.label},".toolcairn tracker ready")}catch(n){c0.warn({err:n,dir:r,os:e.label},"tracker.html setup failed \u2014 continuing (config.json still bootstrapped by handlers)")}}f();var d0=se(wi(),1),pp=se(Pe(),1);f();var Nj=se(Pe(),1);import{existsSync as Iee}from"fs";import{dirname as Oee,isAbsolute as Pee,join as Cee,resolve as Nee}from"path";var Aee=(0,Nj.createMcpLogger)({name:"@toolcairn/mcp-server:audit-logger"}),u0=new Map,Ree=new Set(["search_tools","search_tools_respond","get_stack","refine_requirement"]),jee=new Set([]);function Aj(t,e){return async r=>{let n=Date.now(),s,o="ok",i;try{s=await e(r),s.isError&&(o="error")}catch(c){o="error",i=c}let a=Date.now()-n;if(s&&o==="ok"&&Ree.has(t)&&(s=Bee(s,t)),!jee.has(t)){let c=zee(r);if(c){let u=Lee({toolName:t,args:r,result:s,status:o,duration_ms:a});Xd(c,u).then(()=>{Oj(c)}).catch(l=>{Aee.debug({err:l,toolName:t,projectRoot:c},"audit-log: append failed (non-fatal)")})}}if(i!==void 0)throw i;return s??{content:[],isError:!0}}}function zee(t){let e=t.project_root;return typeof e=="string"&&e.length>0&&Pee(e)?e:Mee(process.cwd())}function Mee(t){let e=u0.get(t);if(e!==void 0)return e;let r=Nee(t);for(;;){if(Iee(Cee(r,".toolcairn","config.json")))return u0.set(t,r),r;let n=Oee(r);if(n===r)return u0.set(t,null),null;r=n}}function Lee(t){let{toolName:e,args:r,result:n,status:s,duration_ms:o}=t,i=typeof r.query_id=="string"?r.query_id:void 0,a=n?Kee(n):void 0,c=typeof a?.query_id=="string"?a.query_id:void 0,u=i??c,l=qee(e,r,a),d=Zee(e,r),p=Dee(e,r),g=Fee(e,a),h=Uee(e,r,a),m=Vee(e,r,s),_={action:"tool_call",tool:l,timestamp:new Date().toISOString(),reason:m,mcp_tool:e,duration_ms:o,status:s};return u&&(_.query_id=u),d&&(_.outcome=d),p&&(_.replaced_by=p),g&&g.length>0&&(_.candidates=g),h&&Object.keys(h).length>0&&(_.metadata=h),_}function qee(t,e,r){return t==="report_outcome"&&typeof e.chosen_tool=="string"?e.chosen_tool:(t==="check_compatibility"||t==="compare_tools")&&typeof e.tool_a=="string"&&typeof e.tool_b=="string"?`${e.tool_a}|${e.tool_b}`:t==="check_issue"&&typeof e.tool_name=="string"?e.tool_name:t==="verify_suggestion"&&Array.isArray(r?.verified)?"__verify__":t==="update_project_config"&&typeof e.tool_name=="string"?e.tool_name:`__call__:${t}`}function Zee(t,e){if(t!=="report_outcome")return;let r=e.outcome;if(r==="success"||r==="failure"||r==="replaced"||r==="pending")return r}function Dee(t,e){if(t==="report_outcome")return typeof e.replaced_by=="string"?e.replaced_by:void 0}function Fee(t,e){if(e){if(t==="search_tools"||t==="search_tools_respond"){let r=e.results;if(Array.isArray(r)){let n=r.map(s=>s&&typeof s=="object"?s.name:void 0).filter(s=>typeof s=="string").slice(0,5);return n.length>0?n:void 0}}if(t==="get_stack"){let r=e.stack;if(Array.isArray(r)){let n=r.map(s=>s&&typeof s=="object"?s.name:void 0).filter(s=>typeof s=="string").slice(0,10);return n.length>0?n:void 0}}}}function Uee(t,e,r){let n={};return typeof e.query=="string"&&(n.query=fp(e.query,200)),typeof e.use_case=="string"&&(n.use_case=fp(e.use_case,200)),typeof e.action=="string"&&(n.config_action=e.action),typeof e.agent=="string"&&(n.agent=e.agent),r&&(typeof r.status=="string"&&(n.response_status=r.status),typeof r.stage=="number"&&(n.stage=r.stage),typeof r.is_two_option=="boolean"&&(n.is_two_option=r.is_two_option),typeof r.compatibility_signal=="string"&&(n.compatibility_signal=r.compatibility_signal),typeof r.recommendation=="string"&&(n.recommendation=r.recommendation),typeof r.staged=="number"&&(n.staged=r.staged)),n}function Vee(t,e,r){if(r==="error")return`MCP tool ${t} failed`;if(t==="report_outcome"&&typeof e.outcome=="string")return`report_outcome: ${typeof e.chosen_tool=="string"?e.chosen_tool:"?"} \u2192 ${e.outcome}`;if(t==="search_tools"&&typeof e.query=="string")return`search_tools: ${fp(e.query,120)}`;if(t==="get_stack"&&typeof e.use_case=="string")return`get_stack: ${fp(e.use_case,120)}`;if(t==="update_project_config"&&typeof e.action=="string"){let n=typeof e.tool_name=="string"?` ${e.tool_name}`:"";return`update_project_config: ${e.action}${n}`}return`MCP tool ${t}`}function fp(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function Bee(t,e){try{let r=t.content?.[0];if(!r||r.type!=="text")return t;let n=JSON.parse(r.text),s=n.data??void 0;if(!s)return t;let o=typeof s.query_id=="string"?s.query_id:void 0;return!o||typeof s.next_action=="string"&&s.next_action.length>0?t:(s.next_action=Hee(e,o),n.data=s,{...t,content:[{type:"text",text:JSON.stringify(n)}]})}catch{return t}}function Hee(t,e){return t==="refine_requirement"?`Use the decomposition to call get_stack or search_tools (passing query_id="${e}"); after the user actually uses the chosen tool, call report_outcome({ query_id: "${e}", chosen_tool, outcome }).`:`After the user actually uses one of the suggested tools (or replaces it), call report_outcome({ query_id: "${e}", chosen_tool, outcome }) to close the feedback loop.`}function Kee(t){try{let e=t.content?.[0];if(!e||e.type!=="text")return;let n=JSON.parse(e.text).data;return n&&typeof n=="object"?n:void 0}catch{return}}f();var Rj=se(wi(),1),jj=se(Pe(),1);import{appendFile as Gee,mkdir as Jee}from"fs/promises";import{dirname as Wee}from"path";var zj=(0,jj.createMcpLogger)({name:"@toolcairn/mcp-server:event-logger"});function Yee(){return process.env.TOOLCAIRN_TRACKING_ENABLED!=="false"}function Xee(){return process.env.TOOLCAIRN_EVENTS_PATH??null}function Qee(t){return typeof t.query_id=="string"?t.query_id:null}function ete(t,e){try{let r=e.content?.[0];if(r?.type!=="text")return null;let s=JSON.parse(r.text).data,o={tool:t};return s&&("status"in s&&(o.status=s.status),"total_confirmed"in s&&(o.total_confirmed=s.total_confirmed),"staged"in s&&(o.staged=s.staged),"auto_graduated"in s&&(o.auto_graduated=s.auto_graduated),"is_two_option"in s&&(o.is_two_option=s.is_two_option),"non_indexed_guidance"in s&&(o.had_non_indexed_guidance=!0),"credibility_warning"in s&&(o.had_credibility_warning=!0),"deprecation_warning"in s&&s.deprecation_warning&&(o.had_deprecation_warning=!0),"recommendation"in s&&(o.recommendation=s.recommendation),"compatibility_signal"in s&&(o.compatibility_signal=s.compatibility_signal),"index_queued"in s&&(o.index_queued=s.index_queued)),o}catch{return null}}async function tte(t,e){try{await Jee(Wee(t),{recursive:!0}),await Gee(t,`${JSON.stringify(e)}
|
|
824
|
+
`,"utf-8")}catch(r){zj.warn({err:r,path:t},"Failed to write event to JSONL file")}}async function rte(t){try{let e=await Or();if(!e)return;let r={"Content-Type":"application/json"};e.access_token&&(r.Authorization=`Bearer ${e.access_token}`),e.client_id&&(r["X-ToolCairn-Key"]=e.client_id),await fetch(`${Rj.config.TOOLPILOT_API_URL}/v1/events`,{method:"POST",headers:r,body:JSON.stringify({tool_name:t.tool_name,query_id:t.query_id,duration_ms:t.duration_ms,status:t.status,metadata:t.metadata})})}catch(e){zj.debug({err:e},"Failed to send event to API \u2014 non-fatal")}}function Mj(t,e){return async r=>{if(!Yee())return e(r);let n=Date.now(),s,o="ok";try{s=await e(r),s.isError&&(o="error")}catch(i){throw o="error",i}finally{let i=Date.now()-n,a={id:crypto.randomUUID(),tool_name:t,query_id:Qee(r),duration_ms:i,status:o,metadata:s?ete(t,s):null,created_at:new Date().toISOString()};rte(a).catch(()=>{});let c=Xee();c&&tte(c,a).catch(()=>{})}return s??{content:[],isError:!0}}}var l0=(0,pp.createMcpLogger)({name:"@toolcairn/mcp-server:prod"}),nte='\n# ToolCairn \u2014 Agent Setup Instructions\n\nYou are connected to the ToolCairn MCP server. ToolCairn is your active tool intelligence co-pilot.\n\n## The Server Owns .toolcairn/ (v0.10.0+)\n\nThe MCP server reads and writes `.toolcairn/config.json` + `.toolcairn/audit-log.jsonl`\natomically under a cross-process lock. You never touch those files directly.\n\n## On Every Session Start \u2014 Do This First\n\nCall `read_project_config` with `project_root` (absolute path to the user\'s project).\n\nIn most sessions config is already there: when the user ran `toolcairn_auth` the\nserver auto-discovered every project root under its CWD and ran the full 12-ecosystem\nscan + graph classification + config write for each. The auth response carried back\nper-root `projects[]` entries with `setup_steps` (CLAUDE.md / .mcp.json / .gitignore)\nand `unknown_tools[]`.\n\n- If `read_project_config` returns `status: "not_initialized"` for some root\n (rare \u2014 only when auto-init skipped that root): call `toolcairn_init` explicitly\n for that `project_root`.\n- If it returns `status: "ready"`: you have the full snapshot \u2014 review\n `stale_tools` / `pending_tools` / `unknown_tools` and proceed.\n\n## First-Turn Drain Protocol (REQUIRED before replying to the user)\n\nIf the auth response OR `read_project_config` returned non-empty `unknown_tools[]`\nfor a root, you MUST submit them before your first user-facing response:\n\n1. `suggest_graph_update` with `suggestion_type: "new_tool"` and\n `data.tools: <the full unknown_tools array for that root>`. Entries are STAGED\n for admin review \u2014 they do NOT enter the live graph until approved.\n2. `update_project_config` with `action: "mark_suggestions_sent"`,\n `project_root`, and `data.tool_names: [names that staged successfully]`.\n\nIn multi-root workspaces, repeat per root. This closes the learning loop so every\nproject contributes its OSS dependency tail back to the ToolCairn graph.\n\n## Applying Mutations\n\nWhen the user selects / replaces / drops a tool, call `update_project_config`\nwith `project_root`, `action` (add_tool / remove_tool / update_tool / add_evaluation),\nand `tool_name`. The server:\n- atomically updates `.toolcairn/config.json`,\n- appends a new line to `.toolcairn/audit-log.jsonl` (FIFO-archived at 1000 entries),\n- returns the new `last_audit_entry` for your record.\n\nDo NOT construct or write these files yourself \u2014 you do not have the cross-process\nlock that protects them.\n\n## Schema Migration\n\nConfigs written by v0.9.x are on schema 1.0. The first `read_project_config` or\n`update_project_config` call after upgrade migrates in place to 1.1 (languages \u2192\narray, frameworks \u2192 array, `audit_log[]` relocated from config.json to\naudit-log.jsonl). The migration is logged as an audit entry.\n\n## When to Use ToolCairn Tools\n\n| Situation | Tool to call |\n|-----------|-------------|\n| User asks which tool to use for X | `classify_prompt` \u2192 `refine_requirement` \u2192 `search_tools` |\n| User needs to compare two tools | `compare_tools` |\n| User asks if tool A works with tool B | `check_compatibility` |\n| Error persists after 4+ retries AND docs checked | `check_issue` |\n| User asks for a recommended stack | `get_stack` |\n| search_tools returns empty or low confidence | `verify_suggestion` |\n| You discover a new tool relationship | `suggest_graph_update` |\n| A tool worked well or was replaced | `report_outcome` |\n| Tool added/removed from project | `update_project_config` |\n'.trim();async function f0(t){let e=await Or();if(!e||!Ti(e))throw new Error("ToolCairn: authentication required.");let r=new lo({baseUrl:d0.config.TOOLPILOT_API_URL,apiKey:e.client_id,accessToken:e.access_token});l0.info({user:e.user_email},"Registering production tools");function n(s,o){return Mj(s,Aj(s,(0,pp.withErrorHandling)(s,l0,o)))}t.registerTool("classify_prompt",{description:"Classify a developer prompt to determine if ToolCairn tool search is needed. Returns a structured classification prompt for the agent to evaluate.",inputSchema:oP},n("classify_prompt",async s=>gv(s))),t.registerTool("toolcairn_init",{description:"Bootstrap ToolCairn for the current project. Walks every workspace, parses manifests across 12 ecosystems, classifies tools against the ToolCairn graph, and writes .toolcairn/config.json + audit-log.jsonl atomically. Returns setup_steps for CLAUDE.md / .mcp.json / .gitignore (agent applies those).",inputSchema:rP},n("toolcairn_init",async s=>n0(s,{batchResolve:o=>r.batchResolve(o)}))),t.registerTool("read_project_config",{description:"Read .toolcairn/config.json from disk and return the structured project snapshot: project metadata, confirmed tools, stale tools, pending evaluations, and last audit entry. Auto-migrates v1.0 configs to v1.1 on first read.",inputSchema:nP},n("read_project_config",async s=>o0(s))),t.registerTool("update_project_config",{description:"Apply a mutation to .toolcairn/config.json (add_tool / remove_tool / update_tool / add_evaluation). The server atomically rewrites config.json and appends a new line to audit-log.jsonl under a cross-process lock. Requires project_root.",inputSchema:sP},n("update_project_config",async s=>i0(s))),t.registerTool("search_tools",{description:"Search for the best tool for a specific need using a natural language query. Initiates a guided discovery session with clarification questions when needed.",inputSchema:GO},n("search_tools",async s=>r.searchTools(s))),t.registerTool("search_tools_respond",{description:"Submit clarification answers for an in-progress tool search session and receive refined results.",inputSchema:JO},n("search_tools_respond",async s=>r.searchToolsRespond(s))),t.registerTool("get_stack",{description:'Build a complementary tool stack for a project use case. For best results, call refine_requirement first with classification "stack_building", evaluate its decomposition_prompt to get sub-needs, then pass each {sub_need_type, keyword_sentence} object as a sub_needs entry. This lets get_stack keyword-match per layer (e.g. "web-framework", "database", "auth") instead of one broad search. Falls back to balanced search when sub_needs is omitted. Each tool in the returned stack also carries a `version` object with the recommended version that is cross-compatible with the rest of the stack (downgraded from latest if needed to satisfy peer constraints), plus a top-level `compatibility_matrix` + `stack_compatibility` summarising cross-tool version fit.',inputSchema:YO},n("get_stack",async s=>r.getStack(s))),t.registerTool("check_compatibility",{description:'Check compatibility between two tools with version-aware matching. When both tools have declared dependency metadata (npm peerDependencies, PyPI requires_dist, etc.) the handler evaluates range constraints directly and returns a version_checks array plus runtime_requirements. Pass optional tool_a_version / tool_b_version to evaluate specific versions (e.g. "is next@14 compatible with react@17?"). Falls back to graph-edge + shared-neighbors inference when version metadata is unavailable. Response includes `source`: "declared_dependency" | "graph_edges" | "shared_neighbors".',inputSchema:QO},n("check_compatibility",async s=>r.checkCompatibility(s))),t.registerTool("compare_tools",{description:"Compare two tools head-to-head using health signals, graph relationships, and community data.",inputSchema:tP},n("compare_tools",async s=>r.compareTools(s))),t.registerTool("refine_requirement",{description:"Decompose a vague user use-case into specific, searchable tool requirements.",inputSchema:aP},n("refine_requirement",async s=>r.refineRequirement(s))),t.registerTool("check_issue",{description:"LAST RESORT \u2014 check GitHub Issues for a known error after 4+ retries and docs review.",inputSchema:XO},n("check_issue",async s=>r.checkIssue(s))),t.registerTool("verify_suggestion",{description:"Validate agent-suggested tools against the ToolCairn graph.",inputSchema:iP},n("verify_suggestion",async s=>r.verifySuggestion(s))),t.registerTool("report_outcome",{description:"Report the outcome of using a tool recommended by ToolCairn (fire-and-forget).",inputSchema:WO},n("report_outcome",async s=>r.reportOutcome(s))),t.registerTool("suggest_graph_update",{description:"Suggest a new tool, relationship, use case, or health update to the ToolCairn graph.",inputSchema:eP},n("suggest_graph_update",async s=>r.suggestGraphUpdate(s))),t.registerTool("toolcairn_auth",{description:'Manage your ToolCairn authentication. Use "login" to authenticate via browser (unlocks higher rate limits), "status" to check current auth state, or "logout" to revert to anonymous mode.',inputSchema:R.object({action:R.enum(["login","status","logout"]).describe('"login" opens a browser to authenticate, "status" shows current auth state, "logout" clears authentication')})},n("toolcairn_auth",async s=>{let o=s.action;if(o==="status"){let i=await Or(),a=i!==null&&Ti(i);return{content:[{type:"text",text:JSON.stringify({authenticated:a,user_email:i?.user_email??null,user_name:i?.user_name??null,authenticated_at:i?.authenticated_at??null})}]}}if(o==="logout")return await mv(),{content:[{type:"text",text:JSON.stringify({ok:!0,message:"Signed out. Restart your agent to sign in again \u2014 authentication will start automatically."})}]};try{let i=await pc(d0.config.TOOLPILOT_API_URL),a=await iu({agent:"claude"}).catch(c=>(l0.warn({err:c},"runPostAuthInit failed post-login \u2014 auth still succeeds"),null));return{content:[{type:"text",text:JSON.stringify({ok:!0,message:`Successfully authenticated as ${i.email}. All tools are now authorized.`,user_email:i.email,user_name:i.name,roots_discovered:a?.roots_discovered??[],projects:a?.projects??[],unknown_tools_total:a?.unknown_tools_total??0,first_turn_directive:a?.first_turn_directive??""})}]}}catch(i){let a=i instanceof Error?i.message:"Authentication failed";return{content:[{type:"text",text:JSON.stringify({ok:!1,error:a})}],isError:!0}}}))}async function Lj(){let t=new pi({name:"toolcairn",version:"0.1.0"},{instructions:nte});return await f0(t),t}f();f();import Zj from"process";f();var hp=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
825
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),ste(r)}clear(){this._buffer=void 0}};function ste(t){return ya.parse(JSON.parse(t))}function qj(t){return JSON.stringify(t)+`
|
|
826
|
+
`}var mp=class{constructor(e=Zj.stdin,r=Zj.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new hp,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let n=qj(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};f();f();import{Http2ServerRequest as Vj,constants as ote}from"http2";import{Http2ServerRequest as p0}from"http2";import{Readable as Dj}from"stream";import yte from"crypto";var Oo=class extends Error{constructor(t,e){super(t,e),this.name="RequestError"}},ite=t=>t instanceof Oo?t:new Oo(t.message,{cause:t}),ate=global.Request,cu=class extends ate{constructor(t,e){typeof t=="object"&&Xi in t&&(t=t[Xi]()),typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(t,e)}},cte=t=>{let e=[],r=t.rawHeaders;for(let n=0;n<r.length;n+=2){let{[n]:s,[n+1]:o}=r;s.charCodeAt(0)!==58&&e.push([s,o])}return new Headers(e)},Bj=Symbol("wrapBodyStream"),ute=(t,e,r,n,s)=>{let o={method:t,headers:r,signal:s.signal};if(t==="TRACE"){o.method="GET";let i=new cu(e,o);return Object.defineProperty(i,"method",{get(){return"TRACE"}}),i}if(!(t==="GET"||t==="HEAD"))if("rawBody"in n&&n.rawBody instanceof Buffer)o.body=new ReadableStream({start(i){i.enqueue(n.rawBody),i.close()}});else if(n[Bj]){let i;o.body=new ReadableStream({async pull(a){try{i||=Dj.toWeb(n).getReader();let{done:c,value:u}=await i.read();c?a.close():a.enqueue(u)}catch(c){a.error(c)}}})}else o.body=Dj.toWeb(n);return new cu(e,o)},Xi=Symbol("getRequestCache"),lte=Symbol("requestCache"),gp=Symbol("incomingKey"),yp=Symbol("urlKey"),dte=Symbol("headersKey"),Yi=Symbol("abortControllerKey"),fte=Symbol("getAbortController"),_p={get method(){return this[gp].method||"GET"},get url(){return this[yp]},get headers(){return this[dte]||=cte(this[gp])},[fte](){return this[Xi](),this[Yi]},[Xi](){return this[Yi]||=new AbortController,this[lte]||=ute(this.method,this[yp],this.headers,this[gp],this[Yi])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(t=>{Object.defineProperty(_p,t,{get(){return this[Xi]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(_p,t,{value:function(){return this[Xi]()[t]()}})});Object.setPrototypeOf(_p,cu.prototype);var pte=(t,e)=>{let r=Object.create(_p);r[gp]=t;let n=t.url||"";if(n[0]!=="/"&&(n.startsWith("http://")||n.startsWith("https://"))){if(t instanceof p0)throw new Oo("Absolute URL for :path is not allowed in HTTP/2");try{let a=new URL(n);r[yp]=a.href}catch(a){throw new Oo("Invalid absolute URL",{cause:a})}return r}let s=(t instanceof p0?t.authority:t.headers.host)||e;if(!s)throw new Oo("Missing host header");let o;if(t instanceof p0){if(o=t.scheme,!(o==="http"||o==="https"))throw new Oo("Unsupported scheme")}else o=t.socket&&t.socket.encrypted?"https":"http";let i=new URL(`${o}://${s}${n}`);if(i.hostname.length!==s.length&&i.hostname!==s.replace(/:\d+$/,""))throw new Oo("Invalid host header");return r[yp]=i.href,r},Fj=Symbol("responseCache"),Wi=Symbol("getResponseCache"),Po=Symbol("cache"),y0=global.Response,uu=class Hj{#r;#t;[Wi](){return delete this[Po],this[Fj]||=new y0(this.#r,this.#t)}constructor(e,r){let n;if(this.#r=e,r instanceof Hj){let s=r[Fj];if(s){this.#t=s,this[Wi]();return}else this.#t=r.#t,n=new Headers(r.#t.headers)}else this.#t=r;(typeof e=="string"||typeof e?.getReader<"u"||e instanceof Blob||e instanceof Uint8Array)&&(this[Po]=[r?.status||200,e,n||r?.headers])}get headers(){let e=this[Po];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":"text/plain; charset=UTF-8"})),e[2]):this[Wi]().headers}get status(){return this[Po]?.[0]??this[Wi]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(uu.prototype,t,{get(){return this[Wi]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(uu.prototype,t,{value:function(){return this[Wi]()[t]()}})});Object.setPrototypeOf(uu,y0);Object.setPrototypeOf(uu.prototype,y0.prototype);async function hte(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}function Kj(t,e,r){let n=a=>{t.cancel(a).catch(()=>{})};return e.on("close",n),e.on("error",n),(r??t.read()).then(i,s),t.closed.finally(()=>{e.off("close",n),e.off("error",n)});function s(a){a&&e.destroy(a)}function o(){t.read().then(i,s)}function i({done:a,value:c}){try{if(a)e.end();else if(!e.write(c))e.once("drain",o);else return t.read().then(i,s)}catch(u){s(u)}}}function mte(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:Kj(t.getReader(),e)}var m0=t=>{let e={};t instanceof Headers||(t=new Headers(t??void 0));let r=[];for(let[n,s]of t)n==="set-cookie"?r.push(s):e[n]=s;return r.length>0&&(e["set-cookie"]=r),e["content-type"]??="text/plain; charset=UTF-8",e},gte="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=yte);var _0=Symbol("outgoingEnded"),Uj=Symbol("incomingDraining"),_te=500,vte=64*1024*1024,h0=t=>{let e=t;if(t.destroyed||e[Uj])return;if(e[Uj]=!0,t instanceof Vj){try{t.stream?.close?.(ote.NGHTTP2_NO_ERROR)}catch{}return}let r=0,n=()=>{clearTimeout(o),t.off("data",i),t.off("end",n),t.off("error",n)},s=()=>{n();let a=t.socket;a&&!a.destroyed&&a.destroySoon()},o=setTimeout(s,_te);o.unref?.();let i=a=>{r+=a.length,r>vte&&s()};t.on("data",i),t.on("end",n),t.on("error",n),t.resume()},bte=()=>new Response(null,{status:400}),Gj=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.constructor.name==="TimeoutError")?504:500}),g0=(t,e)=>{let r=t instanceof Error?t:new Error("unknown error",{cause:t});r.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(t),e.headersSent||e.writeHead(500,{"Content-Type":"text/plain"}),e.end(`Error: ${r.message}`),e.destroy(r))},Jj=t=>{"flushHeaders"in t&&t.writable&&t.flushHeaders()},Wj=async(t,e)=>{let[r,n,s]=t[Po],o=!1;if(!s)s={"content-type":"text/plain; charset=UTF-8"};else if(s instanceof Headers)o=s.has("content-length"),s=m0(s);else if(Array.isArray(s)){let i=new Headers(s);o=i.has("content-length"),s=m0(i)}else for(let i in s)if(i.length===14&&i.toLowerCase()==="content-length"){o=!0;break}o||(typeof n=="string"?s["Content-Length"]=Buffer.byteLength(n):n instanceof Uint8Array?s["Content-Length"]=n.byteLength:n instanceof Blob&&(s["Content-Length"]=n.size)),e.writeHead(r,s),typeof n=="string"||n instanceof Uint8Array?e.end(n):n instanceof Blob?e.end(new Uint8Array(await n.arrayBuffer())):(Jj(e),await mte(n,e)?.catch(i=>g0(i,e))),e[_0]?.()},wte=t=>typeof t.then=="function",xte=async(t,e,r={})=>{if(wte(t))if(r.errorHandler)try{t=await t}catch(s){let o=await r.errorHandler(s);if(!o)return;t=o}else t=await t.catch(Gj);if(Po in t)return Wj(t,e);let n=m0(t.headers);if(t.body){let s=t.body.getReader(),o=[],i=!1,a;if(n["transfer-encoding"]!=="chunked"){let c=2;for(let u=0;u<c;u++){a||=s.read();let l=await hte(a).catch(d=>{console.error(d),i=!0});if(!l){if(u===1){await new Promise(d=>setTimeout(d)),c=3;continue}break}if(a=void 0,l.value&&o.push(l.value),l.done){i=!0;break}}i&&!("content-length"in n)&&(n["content-length"]=o.reduce((u,l)=>u+l.length,0))}e.writeHead(t.status,n),o.forEach(c=>{e.write(c)}),i?e.end():(o.length===0&&Jj(e),await Kj(s,e,a))}else n[gte]||(e.writeHead(t.status,n),e.end());e[_0]?.()},v0=(t,e={})=>{let r=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==cu&&(Object.defineProperty(global,"Request",{value:cu}),Object.defineProperty(global,"Response",{value:uu})),async(n,s)=>{let o,i;try{i=pte(n,e.hostname);let a=!r||n.method==="GET"||n.method==="HEAD";if(a||(n[Bj]=!0,n.on("end",()=>{a=!0}),n instanceof Vj&&(s[_0]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{h0(n)})})}),s.on("finish",()=>{a||h0(n)})),s.on("close",()=>{i[Yi]&&(n.errored?i[Yi].abort(n.errored.toString()):s.writableFinished||i[Yi].abort("Client connection prematurely closed.")),a||setTimeout(()=>{a||setTimeout(()=>{h0(n)})})}),o=t(i,{incoming:n,outgoing:s}),Po in o)return Wj(o,s)}catch(a){if(o)return g0(a,s);if(e.errorHandler){if(o=await e.errorHandler(i?a:ite(a)),!o)return}else i?o=Gj(a):o=bte()}try{return await xte(o,s,e)}catch(a){return g0(a,s)}}};f();var vp=class{constructor(e={}){this._started=!1,this._hasHandledRequest=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=e.enableJsonResponse??!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=e.enableDnsRebindingProtection??!1,this._retryInterval=e.retryInterval}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}createJsonErrorResponse(e,r,n,s){let o={code:r,message:n};return s?.data!==void 0&&(o.data=s.data),new Response(JSON.stringify({jsonrpc:"2.0",error:o,id:null}),{status:e,headers:{"Content-Type":"application/json",...s?.headers}})}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=e.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let n=`Invalid Host header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=e.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let n=`Invalid Origin header: ${r}`;return this.onerror?.(new Error(n)),this.createJsonErrorResponse(403,-32e3,n)}}}}async handleRequest(e,r){if(!this.sessionIdGenerator&&this._hasHandledRequest)throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;let n=this.validateRequestHeaders(e);if(n)return n;switch(e.method){case"POST":return this.handlePostRequest(e,r);case"GET":return this.handleGetRequest(e);case"DELETE":return this.handleDeleteRequest(e);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(e,r,n,s){if(!this._eventStore||s<"2025-11-25")return;let o=await this._eventStore.storeEvent(n,{}),i=`id: ${o}
|
|
777
827
|
data:
|
|
778
828
|
|
|
779
829
|
`;this._retryInterval!==void 0&&(i=`id: ${o}
|
|
@@ -784,7 +834,7 @@ data:
|
|
|
784
834
|
`;return s&&(o+=`id: ${s}
|
|
785
835
|
`),o+=`data: ${JSON.stringify(n)}
|
|
786
836
|
|
|
787
|
-
`,e.enqueue(r.encode(o)),!0}catch(o){return this.onerror?.(o),!1}}handleUnsupportedRequest(){return this.onerror?.(new Error("Method not allowed.")),new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}),{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(e,r){try{let n=e.headers.get("accept");if(!n?.includes("application/json")||!n.includes("text/event-stream"))return this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");let s=e.headers.get("content-type");if(!s||!s.includes("application/json"))return this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let o={headers:Object.fromEntries(e.headers.entries()),url:new URL(e.url)},i;if(r?.parsedBody!==void 0)i=r.parsedBody;else try{i=await e.json()}catch{return this.onerror?.(new Error("Parse error: Invalid JSON")),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}let a;try{Array.isArray(i)?a=i.map(b=>ya.parse(b)):a=[ya.parse(i)]}catch{return this.onerror?.(new Error("Parse error: Invalid JSON-RPC message")),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}let c=a.some(qm);if(c){if(this._initialized&&this.sessionId!==void 0)return this.onerror?.(new Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(a.length>1)return this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!c){let b=this.validateSession(e);if(b)return b;let w=this.validateProtocolVersion(e);if(w)return w}if(!a.some(Cn)){for(let b of a)this.onmessage?.(b,{authInfo:r?.authInfo,requestInfo:o});return new Response(null,{status:202})}let l=crypto.randomUUID(),d=a.find(b=>qm(b)),p=d?d.params.protocolVersion:e.headers.get("mcp-protocol-version")??
|
|
837
|
+
`,e.enqueue(r.encode(o)),!0}catch(o){return this.onerror?.(o),!1}}handleUnsupportedRequest(){return this.onerror?.(new Error("Method not allowed.")),new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}),{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(e,r){try{let n=e.headers.get("accept");if(!n?.includes("application/json")||!n.includes("text/event-stream"))return this.onerror?.(new Error("Not Acceptable: Client must accept both application/json and text/event-stream")),this.createJsonErrorResponse(406,-32e3,"Not Acceptable: Client must accept both application/json and text/event-stream");let s=e.headers.get("content-type");if(!s||!s.includes("application/json"))return this.onerror?.(new Error("Unsupported Media Type: Content-Type must be application/json")),this.createJsonErrorResponse(415,-32e3,"Unsupported Media Type: Content-Type must be application/json");let o={headers:Object.fromEntries(e.headers.entries()),url:new URL(e.url)},i;if(r?.parsedBody!==void 0)i=r.parsedBody;else try{i=await e.json()}catch{return this.onerror?.(new Error("Parse error: Invalid JSON")),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}let a;try{Array.isArray(i)?a=i.map(b=>ya.parse(b)):a=[ya.parse(i)]}catch{return this.onerror?.(new Error("Parse error: Invalid JSON-RPC message")),this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}let c=a.some(qm);if(c){if(this._initialized&&this.sessionId!==void 0)return this.onerror?.(new Error("Invalid Request: Server already initialized")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(a.length>1)return this.onerror?.(new Error("Invalid Request: Only one initialization request is allowed")),this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!c){let b=this.validateSession(e);if(b)return b;let w=this.validateProtocolVersion(e);if(w)return w}if(!a.some(Cn)){for(let b of a)this.onmessage?.(b,{authInfo:r?.authInfo,requestInfo:o});return new Response(null,{status:202})}let l=crypto.randomUUID(),d=a.find(b=>qm(b)),p=d?d.params.protocolVersion:e.headers.get("mcp-protocol-version")??bS;if(this._enableJsonResponse)return new Promise(b=>{this._streamMapping.set(l,{resolveJson:b,cleanup:()=>{this._streamMapping.delete(l)}});for(let w of a)Cn(w)&&this._requestToStreamMapping.set(w.id,l);for(let w of a)this.onmessage?.(w,{authInfo:r?.authInfo,requestInfo:o})});let g=new TextEncoder,h,m=new ReadableStream({start:b=>{h=b},cancel:()=>{this._streamMapping.delete(l)}}),_={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(_["mcp-session-id"]=this.sessionId);for(let b of a)Cn(b)&&(this._streamMapping.set(l,{controller:h,encoder:g,cleanup:()=>{this._streamMapping.delete(l);try{h.close()}catch{}}}),this._requestToStreamMapping.set(b.id,l));await this.writePrimingEvent(h,g,l,p);for(let b of a){let w,x;Cn(b)&&this._eventStore&&p>="2025-11-25"&&(w=()=>{this.closeSSEStream(b.id)},x=()=>{this.closeStandaloneSSEStream()}),this.onmessage?.(b,{authInfo:r?.authInfo,requestInfo:o,closeSSEStream:w,closeStandaloneSSEStream:x})}return new Response(m,{status:200,headers:_})}catch(n){return this.onerror?.(n),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(n)})}}async handleDeleteRequest(e){let r=this.validateSession(e);if(r)return r;let n=this.validateProtocolVersion(e);return n||(await Promise.resolve(this._onsessionclosed?.(this.sessionId)),await this.close(),new Response(null,{status:200}))}validateSession(e){if(this.sessionIdGenerator===void 0)return;if(!this._initialized)return this.onerror?.(new Error("Bad Request: Server not initialized")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Server not initialized");let r=e.headers.get("mcp-session-id");if(!r)return this.onerror?.(new Error("Bad Request: Mcp-Session-Id header is required")),this.createJsonErrorResponse(400,-32e3,"Bad Request: Mcp-Session-Id header is required");if(r!==this.sessionId)return this.onerror?.(new Error("Session not found")),this.createJsonErrorResponse(404,-32001,"Session not found")}validateProtocolVersion(e){let r=e.headers.get("mcp-protocol-version");if(r!==null&&!Vo.includes(r))return this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${r} (supported versions: ${Vo.join(", ")})`)),this.createJsonErrorResponse(400,-32e3,`Bad Request: Unsupported protocol version: ${r} (supported versions: ${Vo.join(", ")})`)}async close(){this._streamMapping.forEach(({cleanup:e})=>{e()}),this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}closeSSEStream(e){let r=this._requestToStreamMapping.get(e);if(!r)return;let n=this._streamMapping.get(r);n&&n.cleanup()}closeStandaloneSSEStream(){let e=this._streamMapping.get(this._standaloneSseStreamId);e&&e.cleanup()}async send(e,r){let n=r?.relatedRequestId;if((an(e)||Bo(e))&&(n=e.id),n===void 0){if(an(e)||Bo(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let i;this._eventStore&&(i=await this._eventStore.storeEvent(this._standaloneSseStreamId,e));let a=this._streamMapping.get(this._standaloneSseStreamId);if(a===void 0)return;a.controller&&a.encoder&&this.writeSSEEvent(a.controller,a.encoder,e,i);return}let s=this._requestToStreamMapping.get(n);if(!s)throw new Error(`No connection established for request ID: ${String(n)}`);let o=this._streamMapping.get(s);if(!this._enableJsonResponse&&o?.controller&&o?.encoder){let i;this._eventStore&&(i=await this._eventStore.storeEvent(s,e)),this.writeSSEEvent(o.controller,o.encoder,e,i)}if(an(e)||Bo(e)){this._requestResponseMap.set(n,e);let i=Array.from(this._requestToStreamMapping.entries()).filter(([c,u])=>u===s).map(([c])=>c);if(i.every(c=>this._requestResponseMap.has(c))){if(!o)throw new Error(`No connection established for request ID: ${String(n)}`);if(this._enableJsonResponse&&o.resolveJson){let c={"Content-Type":"application/json"};this.sessionId!==void 0&&(c["mcp-session-id"]=this.sessionId);let u=i.map(l=>this._requestResponseMap.get(l));u.length===1?o.resolveJson(new Response(JSON.stringify(u[0]),{status:200,headers:c})):o.resolveJson(new Response(JSON.stringify(u),{status:200,headers:c}))}else o.cleanup();for(let c of i)this._requestResponseMap.delete(c),this._requestToStreamMapping.delete(c)}}}};var bp=class{constructor(e={}){this._requestContext=new WeakMap,this._webStandardTransport=new vp(e),this._requestListener=v0(async r=>{let n=this._requestContext.get(r);return this._webStandardTransport.handleRequest(r,{authInfo:n?.authInfo,parsedBody:n?.parsedBody})},{overrideGlobalObjects:!1})}get sessionId(){return this._webStandardTransport.sessionId}set onclose(e){this._webStandardTransport.onclose=e}get onclose(){return this._webStandardTransport.onclose}set onerror(e){this._webStandardTransport.onerror=e}get onerror(){return this._webStandardTransport.onerror}set onmessage(e){this._webStandardTransport.onmessage=e}get onmessage(){return this._webStandardTransport.onmessage}async start(){return this._webStandardTransport.start()}async close(){return this._webStandardTransport.close()}async send(e,r){return this._webStandardTransport.send(e,r)}async handleRequest(e,r,n){let s=e.auth;await v0(async i=>this._webStandardTransport.handleRequest(i,{authInfo:s,parsedBody:n}),{overrideGlobalObjects:!1})(e,r)}closeSSEStream(e){this._webStandardTransport.closeSSEStream(e)}closeStandaloneSSEStream(){this._webStandardTransport.closeStandaloneSSEStream()}};var Ste=se(wi(),1);function Yj(){return process.env.MCP_TRANSPORT==="http"?new bp({sessionIdGenerator:()=>crypto.randomUUID()}):new mp}process.env.TOOLPILOT_MODE="production";var Wt=(0,w0.createMcpLogger)({name:"@toolcairn/mcp-server"});async function kte(){await Cj();let t=await Or(),e=t!==null&&Ti(t),r;if(e)Wt.info({user:t.user_email},"Authenticated \u2014 starting full server"),r=await Lj();else{let s="https://toolcairn.neurynae.com/signup",o="";try{let a=await dc();if(a)s=a.verification_uri,o=a.user_code,Wt.info({userCode:o},"Resuming pending sign-in");else{let c=await Cd(b0.config.TOOLPILOT_API_URL);s=c.verification_uri,o=c.user_code,Wt.info({userCode:o},"New sign-in started")}}catch(a){Wt.error({err:a},"Could not reach ToolCairn API \u2014 check your connection")}let i=o?`# ToolCairn \u2014 Sign In Required
|
|
788
838
|
|
|
789
839
|
A browser window should have opened automatically.
|
|
790
840
|
|
|
@@ -795,7 +845,7 @@ Open the URL, sign in, and confirm the code shown. All 14 tools will appear auto
|
|
|
795
845
|
|
|
796
846
|
After sign-in the server will automatically provision .toolcairn/config.json for every project root under your working directory (scan + graph classification).`:`# ToolCairn \u2014 Sign In Required
|
|
797
847
|
|
|
798
|
-
Visit https://toolcairn.neurynae.com to create an account, then reconnect.`;r=new pi({name:"toolcairn",version:"0.1.0"},{instructions:i}),r.registerTool("toolcairn_auth",{description:"Check ToolCairn sign-in status.",inputSchema:R.object({action:R.enum(["status"])})},async()=>({content:[{type:"text",text:JSON.stringify({authenticated:!1,sign_in_url:s,code:o||null,message:o?`Open ${s} and confirm code "${o}". Tools will appear automatically when confirmed.`:"Visit toolcairn.neurynae.com to sign up."})}]})),pc(
|
|
848
|
+
Visit https://toolcairn.neurynae.com to create an account, then reconnect.`;r=new pi({name:"toolcairn",version:"0.1.0"},{instructions:i}),r.registerTool("toolcairn_auth",{description:"Check ToolCairn sign-in status.",inputSchema:R.object({action:R.enum(["status"])})},async()=>({content:[{type:"text",text:JSON.stringify({authenticated:!1,sign_in_url:s,code:o||null,message:o?`Open ${s} and confirm code "${o}". Tools will appear automatically when confirmed.`:"Visit toolcairn.neurynae.com to sign up."})}]})),pc(b0.config.TOOLPILOT_API_URL).then(async()=>{Wt.info("Sign-in complete \u2014 adding all tools to running server");try{await f0(r),Wt.info("All ToolCairn tools now available")}catch(a){Wt.error({err:a},"Failed to add tools after sign-in \u2014 please reconnect");return}try{let a=await iu({agent:"claude"});Wt.info({roots:a.roots_discovered.length,provisioned:a.projects.length,unknown_tools_total:a.unknown_tools_total},"Post-sign-in auto-init complete")}catch(a){Wt.warn({err:a},"Post-sign-in auto-init failed \u2014 call toolcairn_init manually")}}).catch(a=>{Wt.error({err:a},"Sign-in failed \u2014 please try again")})}let n=Yj();await r.connect(n),Wt.info(e?"ToolCairn MCP ready":"ToolCairn MCP ready (awaiting sign-in)"),e&&iu({agent:"claude"}).then(async s=>{Wt.info({roots:s.roots_discovered.length,provisioned:s.projects.length,unknown_tools_total:s.unknown_tools_total},"Background auto-refresh complete");for(let o of s.roots_discovered)await au(o)}).catch(s=>{Wt.warn({err:s},"Background auto-refresh failed \u2014 config left as-is")})}kte().catch(t=>{(0,w0.createMcpLogger)({name:"@toolcairn/mcp-server"}).error({err:t},"Failed to start MCP server"),process.exit(1)});
|
|
799
849
|
/*! Bundled license information:
|
|
800
850
|
|
|
801
851
|
imurmurhash/imurmurhash.js:
|