@neurynae/toolcairn-mcp 0.10.16 → 0.10.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +38 -38
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,33 +3,33 @@ var Kj=Object.create;var Sp=Object.defineProperty;var Gj=Object.getOwnPropertyDe
3
3
  `:""},this._extScope=e,this._scope=new br.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(br.varKinds.const,e,r,n)}let(e,r,n){return this._def(br.varKinds.let,e,r,n)}var(e,r,n){return this._def(br.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new hl(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?br.varKinds.var:br.varKinds.let){let i=this._scope.toName(e);return this._for(new yg(o,i,r,n),()=>s(i))}forOf(e,r,n,s=br.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 ml("of",s,o,r),()=>n(o))}forIn(e,r,n,s=this.opts.es5?br.varKinds.var:br.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 ml("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 Ca;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ca)}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 Aa,this.code(n)),this._endBlockNode(Na,Aa)}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 Oa(e,r,n)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(Oa)}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 gl(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 cD(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function gk(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,xe._)`!${bg(t)}`}ge.not=gk;var uD=yk(ge.operators.AND);function lD(...t){return t.reduce(uD)}ge.and=lD;var dD=yk(ge.operators.OR);function fD(...t){return t.reduce(dD)}ge.or=fD;function yk(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(),pD=Ia();function hD(t){let e={};for(let r of t)e[r]=!0;return e}ye.toHash=hD;function mD(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(bk(t,e),!wk(e,t.self.RULES.all))}ye.alwaysValidSchema=mD;function bk(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]||kk(t,`unknown keyword: "${o}"`)}ye.checkUnknownRules=bk;function wk(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ye.schemaHasRules=wk;function gD(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=gD;function yD({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=yD;function _D(t){return xk(decodeURIComponent(t))}ye.unescapeFragment=_D;function vD(t){return encodeURIComponent(xg(t))}ye.escapeFragment=vD;function xg(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ye.escapeJsonPointer=xg;function xk(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ye.unescapeJsonPointer=xk;function bD(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ye.eachItem=bD;function _k({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:_k({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:Sk}),items:_k({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 Sk(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=Sk;function Sg(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Me._)`${e}${(0,Me.getProperty)(n)}`,!0))}ye.setEvaluated=Sg;var vk={};function wD(t,e){return t.scopeValue("func",{ref:e,code:vk[e.code]||(vk[e.code]=new pD._Code(e.code))})}ye.useFunc=wD;var wg;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(wg||(ye.Type=wg={}));function xD(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=xD;function kk(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=kk});var ln=S(kg=>{"use strict";f();Object.defineProperty(kg,"__esModule",{value:!0});var wt=me(),SD={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=SD});var Ra=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(),_l=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 kD(t,e=xt.keywordError,r,n){let{it:s}=t,{gen:o,compositeRule:i,allErrors:a}=s,c=$k(t,e,r);n??(i||a)?Ek(o,c):Tk(s,(0,ke._)`[${c}]`)}xt.reportError=kD;function ED(t,e=xt.keywordError,r){let{it:n}=t,{gen:s,compositeRule:o,allErrors:i}=n,a=$k(t,e,r);Ek(s,a),o||i||Tk(n,$t.default.vErrors)}xt.reportExtraError=ED;function TD(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=TD;function $D({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=$D;function Ek(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 Tk(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 $k(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,ke._)`{}`:ID(t,e,r)}function ID(t,e,r={}){let{gen:n,it:s}=t,o=[PD(s,r),OD(t,r)];return CD(t,e,o),n.object(...o)}function PD({errorPath:t},{instancePath:e}){let r=e?(0,ke.str)`${t}${(0,_l.getErrorPath)(e,_l.Type.Str)}`:t;return[$t.default.instancePath,(0,ke.strConcat)($t.default.instancePath,r)]}function OD({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,_l.getErrorPath)(r,_l.Type.Str)}`),[Ms.schemaPath,s]}function CD(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 Pk=S(Xo=>{"use strict";f();Object.defineProperty(Xo,"__esModule",{value:!0});Xo.boolOrEmptySchema=Xo.topBoolOrEmptySchema=void 0;var ND=Ra(),AD=me(),RD=ln(),jD={message:"boolean schema is false"};function zD(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Ik(t,!1):typeof r=="object"&&r.$async===!0?e.return(RD.default.data):(e.assign((0,AD._)`${n}.errors`,null),e.return(!0))}Xo.topBoolOrEmptySchema=zD;function MD(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Ik(t)):r.var(e,!0)}Xo.boolOrEmptySchema=MD;function Ik(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,ND.reportError)(s,jD,void 0,e)}});var Eg=S(Qo=>{"use strict";f();Object.defineProperty(Qo,"__esModule",{value:!0});Qo.getRules=Qo.isJSONType=void 0;var LD=["string","number","integer","boolean","null","object","array"],qD=new Set(LD);function ZD(t){return typeof t=="string"&&qD.has(t)}Qo.isJSONType=ZD;function DD(){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=DD});var Tg=S(An=>{"use strict";f();Object.defineProperty(An,"__esModule",{value:!0});An.shouldUseRule=An.shouldUseGroup=An.schemaHasRulesForType=void 0;function FD({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Ok(t,n)}An.schemaHasRulesForType=FD;function Ok(t,e){return e.rules.some(r=>Ck(t,r))}An.shouldUseGroup=Ok;function Ck(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))}An.shouldUseRule=Ck});var ja=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 UD=Eg(),VD=Tg(),BD=Ra(),de=me(),Nk=Se(),ei;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(ei||(St.DataType=ei={}));function HD(t){let e=Ak(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=HD;function Ak(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(UD.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}St.getJSONTypes=Ak;function KD(t,e){let{gen:r,data:n,opts:s}=t,o=GD(e,s.coerceTypes),i=e.length>0&&!(o.length===0&&e.length===1&&(0,VD.schemaHasRulesForType)(t,e[0]));if(i){let a=Ig(e,n,s.strictNumbers,ei.Wrong);r.if(a,()=>{o.length?JD(t,e,o):Pg(t)})}return i}St.coerceAndCheckDataType=KD;var Rk=new Set(["string","number","integer","boolean","null"]);function GD(t,e){return e?t.filter(r=>Rk.has(r)||e==="array"&&r==="array"):[]}function JD(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)(Rk.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),WD(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 WD({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 YD={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=XD(t);(0,BD.reportError)(e,YD)}St.reportTypeError=Pg;function XD(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 zk=S(vl=>{"use strict";f();Object.defineProperty(vl,"__esModule",{value:!0});vl.assignDefaults=void 0;var ti=me(),QD=Se();function e2(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let s in r)jk(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,o)=>jk(t,o,s.default))}vl.assignDefaults=e2;function jk(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,QD.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(),Rn=ln(),t2=Se();function r2(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=r2;function n2({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=n2;function s2(t,e){t.setParams({missingProperty:e},!0),t.error()}ze.reportMissingProp=s2;function Mk(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ve._)`Object.prototype.hasOwnProperty`})}ze.hasPropFunc=Mk;function Cg(t,e,r){return(0,Ve._)`${Mk(t)}.call(${e}, ${r})`}ze.isOwnProperty=Cg;function o2(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=o2;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 Lk(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ze.allSchemaProperties=Lk;function i2(t,e){return Lk(e).filter(r=>!(0,Og.alwaysValidSchema)(t,e[r]))}ze.schemaProperties=i2;function a2({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=[[Rn.default.instancePath,(0,Ve.strConcat)(Rn.default.instancePath,o)],[Rn.default.parentData,i.parentData],[Rn.default.parentDataProperty,i.parentDataProperty],[Rn.default.rootData,Rn.default.rootData]];i.opts.dynamicRef&&d.push([Rn.default.dynamicAnchors,Rn.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=a2;var c2=(0,Ve._)`new RegExp`;function u2({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"?c2:(0,t2.useFunc)(t,s)}(${r}, ${n})`})}ze.usePattern=u2;function l2(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=l2;function d2(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=d2});var Dk=S(Mr=>{"use strict";f();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.validateKeywordUsage=Mr.validSchemaType=Mr.funcKeywordCode=Mr.macroKeywordCode=void 0;var It=me(),Ls=ln(),f2=nr(),p2=Ra();function h2(t,e){let{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=t,a=e.macro.call(i.self,s,o,i),c=Zk(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))}Mr.macroKeywordCode=h2;function m2(t,e){var r;let{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=t;y2(c,e);let u=!a&&e.compile?e.compile.call(c.self,o,i,c):e.validate,l=Zk(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&&qk(t),y(()=>t.error());else{let b=e.async?g():h();e.modifying&&qk(t),y(()=>g2(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,f2.callValidateCode)(t,l,w,x)}`,e.modifying)}function y(b){var w;n.if((0,It.not)((w=e.valid)!==null&&w!==void 0?w:d),b)}}Mr.funcKeywordCode=m2;function qk(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,It._)`${n.parentData}[${n.parentDataProperty}]`))}function g2(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,p2.extendErrors)(t)},()=>t.error())}function y2({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Zk(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")}Mr.validSchemaType=_2;function v2({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)}}Mr.validateKeywordUsage=v2});var Uk=S(jn=>{"use strict";f();Object.defineProperty(jn,"__esModule",{value:!0});jn.extendSubschemaMode=jn.extendSubschemaData=jn.getSubschema=void 0;var Lr=me(),Fk=Se();function b2(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,Lr._)`${t.schemaPath}${(0,Lr.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Lr._)`${t.schemaPath}${(0,Lr.getProperty)(e)}${(0,Lr.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Fk.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')}jn.getSubschema=b2;function w2(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,Lr._)`${e.data}${(0,Lr.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Lr.str)`${u}${(0,Fk.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Lr._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(s!==void 0){let u=s instanceof Lr.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]}}jn.extendSubschemaData=w2;function x2(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}jn.extendSubschemaMode=x2});var Ag=S((pce,Vk)=>{"use strict";f();Vk.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 Hk=S((mce,Bk)=>{"use strict";f();var zn=Bk.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(){};bl(e,n,s,t,"",t)};zn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zn.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 bl(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 zn.arrayKeywords)for(var p=0;p<d.length;p++)bl(t,e,r,d[p],s+"/"+l+"/"+p,o,s,l,n,p)}else if(l in zn.propsKeywords){if(d&&typeof d=="object")for(var g in d)bl(t,e,r,d[g],s+"/"+l+"/"+S2(g),o,s,l,n,g)}else(l in zn.keywords||t.allKeys&&!(l in zn.skipKeywords))&&bl(t,e,r,d,s+"/"+l,o,s,l,n)}r(n,s,o,i,a,c,u)}}function S2(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var za=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 k2=Se(),E2=Ag(),T2=Hk(),$2=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function I2(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Rg(t):e?Kk(t)<=e:!1}zt.inlineRef=I2;var P2=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Rg(t){for(let e in t){if(P2.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 Kk(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!$2.has(r)&&(typeof t[r]=="object"&&(0,k2.eachItem)(t[r],n=>e+=Kk(n)),e===1/0))return 1/0}return e}function Gk(t,e="",r){r!==!1&&(e=ri(e));let n=t.parse(e);return Jk(t,n)}zt.getFullPath=Gk;function Jk(t,e){return t.serialize(e).split("#")[0]+"#"}zt._getFullPath=Jk;var O2=/#\/?$/;function ri(t){return t?t.replace(O2,""):""}zt.normalizeId=ri;function C2(t,e,r){return r=ri(r),t.resolve(e,r)}zt.resolveUrl=C2;var N2=/^[a-z_][-a-z0-9._]*$/i;function A2(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=ri(t[r]||e),o={"":s},i=Gk(n,s,!1),a={},c=new Set;return T2(t,{allKeys:!0},(d,p,g,h)=>{if(h===void 0)return;let m=i+p,y=o[h];typeof d[r]=="string"&&(y=b.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),o[p]=y;function b(x){let T=this.opts.uriResolver.resolve;if(x=ri(y?T(y,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(!N2.test(x))throw new Error(`invalid anchor "${x}"`);b.call(this,`#${x}`)}}}),a;function u(d,p,g){if(p!==void 0&&!E2(d,p))throw l(g)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}zt.getSchemaRefs=A2});var qa=S(Mn=>{"use strict";f();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.getData=Mn.KeywordCxt=Mn.validateFunctionCode=void 0;var eE=Pk(),Wk=ja(),zg=Tg(),wl=ja(),R2=zk(),La=Dk(),jg=Uk(),Y=me(),ae=ln(),j2=za(),dn=Se(),Ma=Ra();function z2(t){if(nE(t)&&(sE(t),rE(t))){q2(t);return}tE(t,()=>(0,eE.topBoolOrEmptySchema)(t))}Mn.validateFunctionCode=z2;function tE({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"; ${Yk(r,s)}`),L2(t,s),t.code(o)}):t.func(e,(0,Y._)`${ae.default.data}, ${M2(s)}`,n.$async,()=>t.code(Yk(r,s)).code(o))}function M2(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 L2(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 q2(t){let{schema:e,opts:r,gen:n}=t;tE(t,()=>{r.$comment&&e.$comment&&iE(t),V2(t),n.let(ae.default.vErrors,null),n.let(ae.default.errors,0),r.unevaluated&&Z2(t),oE(t),K2(t)})}function Z2(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 Yk(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 D2(t,e){if(nE(t)&&(sE(t),rE(t))){F2(t,e);return}(0,eE.boolOrEmptySchema)(t,e)}function rE({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 nE(t){return typeof t.schema!="boolean"}function F2(t,e){let{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&iE(t),B2(t),H2(t);let o=n.const("_errs",ae.default.errors);oE(t,o),n.var(e,(0,Y._)`${o} === ${ae.default.errors}`)}function sE(t){(0,dn.checkUnknownRules)(t),U2(t)}function oE(t,e){if(t.opts.jtd)return Xk(t,[],!1,e);let r=(0,Wk.getSchemaTypes)(t.schema),n=(0,Wk.coerceAndCheckDataType)(t,r);Xk(t,r,!n,e)}function U2(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 V2(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 B2(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,j2.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function H2(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function iE({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 K2(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&&G2(t),e.return((0,Y._)`${ae.default.errors} === 0`))}function G2({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 Xk(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(()=>cE(t,"$ref",l.all.$ref.definition));return}c.jtd||J2(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,wl.checkDataType)(p.type,i,c.strictNumbers)),Qk(t,p),e.length===1&&e[0]===p.type&&r&&(s.else(),(0,wl.reportTypeError)(t)),s.endIf()):Qk(t,p),a||s.if((0,Y._)`${ae.default.errors} === ${n||0}`))}}function Qk(t,e){let{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,R2.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,zg.shouldUseRule)(n,o)&&cE(t,o.keyword,o.definition,e.type)})}function J2(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(W2(t,e),t.opts.allowUnionTypes||Y2(t,e),X2(t,t.dataTypes))}function W2(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{aE(t.dataTypes,r)||Mg(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),eF(t,e)}}function Y2(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Mg(t,"use allowUnionTypes to allow union type keyword")}function X2(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=>Q2(e,i))&&Mg(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function Q2(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function aE(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function eF(t,e){let r=[];for(let n of t.dataTypes)aE(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 xl=class{constructor(e,r,n){if((0,La.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",uE(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,La.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?Ma.reportExtraError:Ma.reportError)(this,this.def.error,r)}$dataError(){(0,Ma.reportError)(this,this.def.$dataError||Ma.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ma.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,wl.checkDataTypes)(c,r,o.opts.strictNumbers,wl.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 D2(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}};Mn.KeywordCxt=xl;function cE(t,e,r,n){let s=new xl(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,La.funcKeywordCode)(s,r):"macro"in r?(0,La.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,La.funcKeywordCode)(s,r)}var tF=/^\/(?:[^~]|~0|~1)*$/,rF=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function uE(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,o;if(t==="")return ae.default.rootData;if(t[0]==="/"){if(!tF.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,o=ae.default.rootData}else{let u=rF.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}`}}Mn.getData=uE});var Sl=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 Za=S(Fg=>{"use strict";f();Object.defineProperty(Fg,"__esModule",{value:!0});var Zg=za(),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 El=S(sr=>{"use strict";f();Object.defineProperty(sr,"__esModule",{value:!0});sr.resolveSchema=sr.getCompilingSchema=sr.resolveRef=sr.compileSchema=sr.SchemaEnv=void 0;var wr=me(),nF=Sl(),qs=ln(),xr=za(),lE=Se(),sF=qa(),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,xr.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=dE.call(this,t);if(e)return e;let r=(0,xr.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new wr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),a;t.$async&&(a=i.scopeValue("Error",{ref:nF.default,code:(0,wr._)`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:[wr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,wr.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:wr.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,wr._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,sF.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 wr.Name?void 0:h,items:m instanceof wr.Name?void 0:m,dynamicProps:h instanceof wr.Name,dynamicItems:m instanceof wr.Name},g.source&&(g.source.evaluated=(0,wr.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 oF(t,e,r){var n;r=(0,xr.resolveUrl)(this.opts.uriResolver,e,r);let s=t.refs[r];if(s)return s;let o=cF.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]=iF.call(this,o)}sr.resolveRef=oF;function iF(t){return(0,xr.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Vg.call(this,t)}function dE(t){for(let e of this._compilations)if(aF(e,t))return e}sr.getCompilingSchema=dE;function aF(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function cF(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||kl.call(this,t,e)}function kl(t,e){let r=this.opts.uriResolver.parse(e),n=(0,xr._getFullPath)(this.opts.uriResolver,r),s=(0,xr.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,xr.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=kl.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,xr.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,xr.resolveUrl)(this.opts.uriResolver,s,u)),new ni({schema:a,schemaId:c,root:t,baseId:s})}return Ug.call(this,r,i)}}sr.resolveSchema=kl;var uF=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,lE.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!uF.has(a)&&u&&(e=(0,xr.resolveUrl)(this.opts.uriResolver,e,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,lE.schemaHasRulesButRef)(r,this.RULES)){let a=(0,xr.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=kl.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 fE=S(($ce,lF)=>{lF.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((Ice,gE)=>{"use strict";f();var dF=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),hE=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 fF=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function pE(t){return t.length=0,!0}function pF(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 hF(t){let e=0,r={error:!1,address:"",zone:""},n=[],s=[],o=!1,i=!1,a=pF;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=pE}else{s.push(u);continue}}return s.length&&(a===pE?r.zone=s.join(""):i?n.push(s.join("")):n.push(Bg(s))),r.address=n.join(""),r}function mE(t){if(mF(t,":")<2)return{host:t,isIPV6:!1};let e=hF(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 mF(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function gF(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 yF(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(!hE(r)){let n=mE(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}gE.exports={nonSimpleDomain:fF,recomposeAuthority:_F,normalizeComponentEncoding:yF,removeDotSegments:gF,isIPv4:hE,isUUID:dF,normalizeIPv6:mE,stringArrayToHexStripped:Bg}});var wE=S((Oce,bE)=>{"use strict";f();var{isUUID:vF}=Hg(),bF=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,wF=["http","https","ws","wss","urn","urn:uuid"];function xF(t){return wF.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 yE(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function _E(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 SF(t){return t.secure=Kg(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function kF(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 EF(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(bF);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 TF(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 $F(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!vF(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function IF(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var vE={scheme:"http",domainHost:!0,parse:yE,serialize:_E},PF={scheme:"https",domainHost:vE.domainHost,parse:yE,serialize:_E},Tl={scheme:"ws",domainHost:!0,parse:SF,serialize:kF},OF={scheme:"wss",domainHost:Tl.domainHost,parse:Tl.parse,serialize:Tl.serialize},CF={scheme:"urn",parse:EF,serialize:TF,skipNormalize:!0},NF={scheme:"urn:uuid",parse:$F,serialize:IF,skipNormalize:!0},$l={http:vE,https:PF,ws:Tl,wss:OF,urn:CF,"urn:uuid":NF};Object.setPrototypeOf($l,null);function Gg(t){return t&&($l[t]||$l[t.toLowerCase()])||void 0}bE.exports={wsIsSecure:Kg,SCHEMES:$l,isValidSchemeName:xF,getSchemeHandler:Gg}});var kE=S((Nce,Pl)=>{"use strict";f();var{normalizeIPv6:AF,removeDotSegments:Da,recomposeAuthority:RF,normalizeComponentEncoding:Il,isIPv4:jF,nonSimpleDomain:zF}=Hg(),{SCHEMES:MF,getSchemeHandler:xE}=wE();function LF(t,e){return typeof t=="string"?t=qr(fn(t,e),e):typeof t=="object"&&(t=fn(qr(t,e),e)),t}function qF(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=SE(fn(t,n),fn(e,n),n,!0);return n.skipEscape=!0,qr(s,n)}function SE(t,e,r,n){let s={};return n||(t=fn(qr(t,r),r),e=fn(qr(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=Da(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=Da(e.path||""),s.query=e.query):(e.path?(e.path[0]==="/"?s.path=Da(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=Da(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 ZF(t,e,r){return typeof t=="string"?(t=unescape(t),t=qr(Il(fn(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=qr(Il(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=qr(Il(fn(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=qr(Il(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function qr(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=xE(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=RF(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=Da(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 DF=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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(DF);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(jF(n.host)===!1){let c=AF(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=xE(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:MF,normalize:LF,resolve:qF,resolveComponent:SE,equal:ZF,serialize:qr,parse:fn};Pl.exports=Jg;Pl.exports.default=Jg;Pl.exports.fastUri=Jg});var TE=S(Wg=>{"use strict";f();Object.defineProperty(Wg,"__esModule",{value:!0});var EE=kE();EE.code='require("ajv/dist/runtime/uri").default';Wg.default=EE});var RE=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 FF=qa();Object.defineProperty(gt,"KeywordCxt",{enumerable:!0,get:function(){return FF.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 UF=Sl(),CE=Za(),VF=Eg(),Fa=El(),BF=me(),Ua=za(),Ol=ja(),Xg=Se(),$E=fE(),HF=TE(),NE=(t,e)=>new RegExp(t,e);NE.code="new RegExp";var KF=["removeAdditional","useDefaults","coerceTypes"],GF=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),JF={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."},WF={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},IE=200;function YF(t){var e,r,n,s,o,i,a,c,u,l,d,p,g,h,m,y,b,w,x,T,P,L,U,I,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:NE,te=(s=t.uriResolver)!==null&&s!==void 0?s:HF.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:IE,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:IE,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:(I=t.unicodeRegExp)!==null&&I!==void 0?I:!0,int32range:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:te}}var Va=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...YF(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new BF.ValueScope({scope:{},prefixes:GF,es5:r,lines:n}),this.logger=nU(e.logger);let s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,VF.getRules)(),PE.call(this,JF,e,"NOT SUPPORTED"),PE.call(this,WF,e,"DEPRECATED","warn"),this._metaOpts=tU.call(this),e.formats&&QF.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&eU.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),XF.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,s=$E;n==="id"&&(s={...$E},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 CE.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,Ua.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=OE.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,s=new Fa.SchemaEnv({schema:{},schemaId:n});if(r=Fa.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=OE.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,Ua.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(oU.call(this,n,r),!r)return(0,Xg.eachItem)(n,o=>Yg.call(this,o)),this;aU.call(this,r);let s={...r,type:(0,Ol.getJSONTypes)(r.type),schemaType:(0,Ol.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]=AE(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,Ua.normalizeId)(i||n);let u=Ua.getSchemaRefs.call(this,e,n);return c=new Fa.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):Fa.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{Fa.compileSchema.call(this,e)}finally{this.opts=r}}};Va.ValidationError=UF.default;Va.MissingRefError=CE.default;gt.default=Va;function PE(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 OE(t){return t=(0,Ua.normalizeId)(t),this.schemas[t]||this.refs[t]}function XF(){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 QF(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function eU(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 tU(){let t={...this.opts};for(let e of KF)delete t[e];return t}var rU={log(){},warn(){},error(){}};function nU(t){if(t===!1)return rU;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 sU=/^[a-z_$][a-z0-9_$:-]*$/i;function oU(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(!sU.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,Ol.getJSONTypes)(e.type),schemaType:(0,Ol.getJSONTypes)(e.schemaType)}};e.before?iU.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 iU(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 aU(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=AE(e)),t.validateSchema=this.compile(e,!0))}var cU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function AE(t){return{anyOf:[t,cU]}}});var jE=S(Qg=>{"use strict";f();Object.defineProperty(Qg,"__esModule",{value:!0});var uU={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Qg.default=uU});var qE=S(Zs=>{"use strict";f();Object.defineProperty(Zs,"__esModule",{value:!0});Zs.callRef=Zs.getValidate=void 0;var lU=Za(),zE=nr(),Mt=me(),oi=ln(),ME=El(),Cl=Se(),dU={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=ME.resolveRef.call(c,u,s,r);if(l===void 0)throw new lU.default(n.opts.uriResolver,s,r);if(l instanceof ME.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=LE(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}),y=e.name("valid"),b=t.subschema({schema:h,dataTypes:[],schemaPath:Mt.nil,topSchemaRef:m,errSchemaPath:r},y);t.mergeEvaluated(b),t.ok(y)}}};function LE(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=LE;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,zE.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,zE.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 y=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=Cl.mergeEvaluated.props(s,y.props,o.props));else{let b=s.var("props",(0,Mt._)`${h}.evaluated.props`);o.props=Cl.mergeEvaluated.props(s,b,o.props,Mt.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=Cl.mergeEvaluated.items(s,y.items,o.items));else{let b=s.var("items",(0,Mt._)`${h}.evaluated.items`);o.items=Cl.mergeEvaluated.items(s,b,o.items,Mt.Name)}}}Zs.callRef=Nl;Zs.default=dU});var ZE=S(ey=>{"use strict";f();Object.defineProperty(ey,"__esModule",{value:!0});var fU=jE(),pU=qE(),hU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",fU.default,pU.default];ey.default=hU});var DE=S(ty=>{"use strict";f();Object.defineProperty(ty,"__esModule",{value:!0});var Al=me(),Ln=Al.operators,Rl={maximum:{okStr:"<=",ok:Ln.LTE,fail:Ln.GT},minimum:{okStr:">=",ok:Ln.GTE,fail:Ln.LT},exclusiveMaximum:{okStr:"<",ok:Ln.LT,fail:Ln.GTE},exclusiveMinimum:{okStr:">",ok:Ln.GT,fail:Ln.LTE}},mU={message:({keyword:t,schemaCode:e})=>(0,Al.str)`must be ${Rl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Al._)`{comparison: ${Rl[t].okStr}, limit: ${e}}`},gU={keyword:Object.keys(Rl),type:"number",schemaType:"number",$data:!0,error:mU,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Al._)`${r} ${Rl[e].fail} ${n} || isNaN(${r})`)}};ty.default=gU});var FE=S(ry=>{"use strict";f();Object.defineProperty(ry,"__esModule",{value:!0});var Ba=me(),yU={message:({schemaCode:t})=>(0,Ba.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Ba._)`{multipleOf: ${t}}`},_U={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:yU,code(t){let{gen:e,data:r,schemaCode:n,it:s}=t,o=s.opts.multipleOfPrecision,i=e.let("res"),a=o?(0,Ba._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Ba._)`${i} !== parseInt(${i})`;t.fail$data((0,Ba._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};ry.default=_U});var VE=S(ny=>{"use strict";f();Object.defineProperty(ny,"__esModule",{value:!0});function UE(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=UE;UE.code='require("ajv/dist/runtime/ucs2length").default'});var BE=S(sy=>{"use strict";f();Object.defineProperty(sy,"__esModule",{value:!0});var Ds=me(),vU=Se(),bU=VE(),wU={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}}`},xU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:wU,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,vU.useFunc)(t.gen,bU.default)}(${r})`;t.fail$data((0,Ds._)`${i} ${o} ${n}`)}};sy.default=xU});var HE=S(oy=>{"use strict";f();Object.defineProperty(oy,"__esModule",{value:!0});var SU=nr(),kU=Se(),ii=me(),EU={message:({schemaCode:t})=>(0,ii.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ii._)`{pattern: ${t}}`},TU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:EU,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,kU.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,SU.usePattern)(t,s);t.fail$data((0,ii._)`!${c}.test(${r})`)}}};oy.default=TU});var KE=S(iy=>{"use strict";f();Object.defineProperty(iy,"__esModule",{value:!0});var Ha=me(),$U={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Ha.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Ha._)`{limit: ${t}}`},IU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:$U,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?Ha.operators.GT:Ha.operators.LT;t.fail$data((0,Ha._)`Object.keys(${r}).length ${s} ${n}`)}};iy.default=IU});var GE=S(ay=>{"use strict";f();Object.defineProperty(ay,"__esModule",{value:!0});var Ka=nr(),Ga=me(),PU=Se(),OU={message:({params:{missingProperty:t}})=>(0,Ga.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ga._)`{missingProperty: ${t}}`},CU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:OU,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 y=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${m}" is not defined at "${y}" (strictRequired)`;(0,PU.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||o)t.block$data(Ga.nil,d);else for(let g of r)(0,Ka.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,Ka.checkMissingProp)(t,r,g)),(0,Ka.reportMissingProp)(t,g),e.else()}function d(){e.forOf("prop",n,g=>{t.setParams({missingProperty:g}),e.if((0,Ka.noPropertyInData)(e,s,g,a.ownProperties),()=>t.error())})}function p(g,h){t.setParams({missingProperty:g}),e.forOf(g,n,()=>{e.assign(h,(0,Ka.propertyInData)(e,s,g,a.ownProperties)),e.if((0,Ga.not)(h),()=>{t.error(),e.break()})},Ga.nil)}}};ay.default=CU});var JE=S(cy=>{"use strict";f();Object.defineProperty(cy,"__esModule",{value:!0});var Ja=me(),NU={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ja.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ja._)`{limit: ${t}}`},AU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:NU,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?Ja.operators.GT:Ja.operators.LT;t.fail$data((0,Ja._)`${r}.length ${s} ${n}`)}};cy.default=AU});var jl=S(uy=>{"use strict";f();Object.defineProperty(uy,"__esModule",{value:!0});var WE=Ag();WE.code='require("ajv/dist/runtime/equal").default';uy.default=WE});var YE=S(dy=>{"use strict";f();Object.defineProperty(dy,"__esModule",{value:!0});var ly=ja(),yt=me(),RU=Se(),jU=jl(),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}}`},MU={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 y=e.name("item"),b=(0,ly.checkDataTypes)(u,y,a.opts.strictNumbers,ly.DataType.Wrong),w=e.const("indices",(0,yt._)`{}`);e.for((0,yt._)`;${h}--;`,()=>{e.let(y,(0,yt._)`${r}[${h}]`),e.if(b,(0,yt._)`continue`),u.length>1&&e.if((0,yt._)`typeof ${y} == "string"`,(0,yt._)`${y} += "_"`),e.if((0,yt._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(m,(0,yt._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,yt._)`${w}[${y}] = ${h}`)})}function g(h,m){let y=(0,RU.useFunc)(e,jU.default),b=e.name("outer");e.label(b).for((0,yt._)`;${h}--;`,()=>e.for((0,yt._)`${m} = ${h}; ${m}--;`,()=>e.if((0,yt._)`${y}(${r}[${h}], ${r}[${m}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};dy.default=MU});var XE=S(py=>{"use strict";f();Object.defineProperty(py,"__esModule",{value:!0});var fy=me(),LU=Se(),qU=jl(),ZU={message:"must be equal to constant",params:({schemaCode:t})=>(0,fy._)`{allowedValue: ${t}}`},DU={keyword:"const",$data:!0,error:ZU,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,LU.useFunc)(e,qU.default)}(${r}, ${s})`):t.fail((0,fy._)`${o} !== ${r}`)}};py.default=DU});var QE=S(hy=>{"use strict";f();Object.defineProperty(hy,"__esModule",{value:!0});var Wa=me(),FU=Se(),UU=jl(),VU={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Wa._)`{allowedValues: ${t}}`},BU={keyword:"enum",schemaType:"array",$data:!0,error:VU,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,FU.useFunc)(e,UU.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,Wa.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,Wa._)`${u()}(${r}, ${g})`,()=>e.assign(l,!0).break()))}function p(g,h){let m=s[h];return typeof m=="object"&&m!==null?(0,Wa._)`${u()}(${r}, ${g}[${h}])`:(0,Wa._)`${r} === ${m}`}}};hy.default=BU});var eT=S(my=>{"use strict";f();Object.defineProperty(my,"__esModule",{value:!0});var HU=DE(),KU=FE(),GU=BE(),JU=HE(),WU=KE(),YU=GE(),XU=JE(),QU=YE(),e4=XE(),t4=QE(),r4=[HU.default,KU.default,GU.default,JU.default,WU.default,YU.default,XU.default,QU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},e4.default,t4.default];my.default=r4});var yy=S(Ya=>{"use strict";f();Object.defineProperty(Ya,"__esModule",{value:!0});Ya.validateAdditionalItems=void 0;var Fs=me(),gy=Se(),n4={message:({params:{len:t}})=>(0,Fs.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Fs._)`{limit: ${t}}`},s4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:n4,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}tT(t,n)}};function tT(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())})}}Ya.validateAdditionalItems=tT;Ya.default=s4});var _y=S(Xa=>{"use strict";f();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.validateTuple=void 0;var rT=me(),zl=Se(),o4=nr(),i4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return nT(t,"additionalItems",e);r.items=!0,!(0,zl.alwaysValidSchema)(r,e)&&t.ok((0,o4.validateArray)(t))}};function nT(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=zl.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,rT._)`${o}.length`);r.forEach((d,p)=>{(0,zl.alwaysValidSchema)(a,d)||(n.if((0,rT._)`${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 y=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${g}"`;(0,zl.checkStrictMode)(a,y,p.strictTuples)}}}Xa.validateTuple=nT;Xa.default=i4});var sT=S(vy=>{"use strict";f();Object.defineProperty(vy,"__esModule",{value:!0});var a4=_y(),c4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,a4.validateTuple)(t,"items")};vy.default=c4});var iT=S(by=>{"use strict";f();Object.defineProperty(by,"__esModule",{value:!0});var oT=me(),u4=Se(),l4=nr(),d4=yy(),f4={message:({params:{len:t}})=>(0,oT.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,oT._)`{limit: ${t}}`},p4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:f4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,u4.alwaysValidSchema)(n,e)&&(s?(0,d4.validateAdditionalItems)(t,s):t.ok((0,l4.validateArray)(t)))}};by.default=p4});var aT=S(wy=>{"use strict";f();Object.defineProperty(wy,"__esModule",{value:!0});var or=me(),Ml=Se(),h4={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}}`},m4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:h4,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,Ml.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Ml.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ml.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"),y=e.let("count",0);g(m,()=>e.if(m,()=>h(y)))}function g(m,y){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:Ml.Type.Num,compositeRule:!0},m),y()})}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=m4});var lT=S(Zr=>{"use strict";f();Object.defineProperty(Zr,"__esModule",{value:!0});Zr.validateSchemaDeps=Zr.validatePropertyDeps=Zr.error=void 0;var xy=me(),g4=Se(),Qa=nr();Zr.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 WD({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 YD={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=XD(t);(0,BD.reportError)(e,YD)}St.reportTypeError=Pg;function XD(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 zk=S(vl=>{"use strict";f();Object.defineProperty(vl,"__esModule",{value:!0});vl.assignDefaults=void 0;var ti=me(),QD=Se();function e2(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let s in r)jk(t,s,r[s].default);else e==="array"&&Array.isArray(n)&&n.forEach((s,o)=>jk(t,o,s.default))}vl.assignDefaults=e2;function jk(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,QD.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(),Rn=ln(),t2=Se();function r2(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=r2;function n2({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=n2;function s2(t,e){t.setParams({missingProperty:e},!0),t.error()}ze.reportMissingProp=s2;function Mk(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Ve._)`Object.prototype.hasOwnProperty`})}ze.hasPropFunc=Mk;function Cg(t,e,r){return(0,Ve._)`${Mk(t)}.call(${e}, ${r})`}ze.isOwnProperty=Cg;function o2(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=o2;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 Lk(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ze.allSchemaProperties=Lk;function i2(t,e){return Lk(e).filter(r=>!(0,Og.alwaysValidSchema)(t,e[r]))}ze.schemaProperties=i2;function a2({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=[[Rn.default.instancePath,(0,Ve.strConcat)(Rn.default.instancePath,o)],[Rn.default.parentData,i.parentData],[Rn.default.parentDataProperty,i.parentDataProperty],[Rn.default.rootData,Rn.default.rootData]];i.opts.dynamicRef&&d.push([Rn.default.dynamicAnchors,Rn.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=a2;var c2=(0,Ve._)`new RegExp`;function u2({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"?c2:(0,t2.useFunc)(t,s)}(${r}, ${n})`})}ze.usePattern=u2;function l2(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=l2;function d2(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=d2});var Dk=S(Mr=>{"use strict";f();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.validateKeywordUsage=Mr.validSchemaType=Mr.funcKeywordCode=Mr.macroKeywordCode=void 0;var It=me(),Ls=ln(),f2=nr(),p2=Ra();function h2(t,e){let{gen:r,keyword:n,schema:s,parentSchema:o,it:i}=t,a=e.macro.call(i.self,s,o,i),c=Zk(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))}Mr.macroKeywordCode=h2;function m2(t,e){var r;let{gen:n,keyword:s,schema:o,parentSchema:i,$data:a,it:c}=t;y2(c,e);let u=!a&&e.compile?e.compile.call(c.self,o,i,c):e.validate,l=Zk(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&&qk(t),y(()=>t.error());else{let b=e.async?g():h();e.modifying&&qk(t),y(()=>g2(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,f2.callValidateCode)(t,l,w,x)}`,e.modifying)}function y(b){var w;n.if((0,It.not)((w=e.valid)!==null&&w!==void 0?w:d),b)}}Mr.funcKeywordCode=m2;function qk(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,It._)`${n.parentData}[${n.parentDataProperty}]`))}function g2(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,p2.extendErrors)(t)},()=>t.error())}function y2({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Zk(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")}Mr.validSchemaType=_2;function v2({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)}}Mr.validateKeywordUsage=v2});var Uk=S(jn=>{"use strict";f();Object.defineProperty(jn,"__esModule",{value:!0});jn.extendSubschemaMode=jn.extendSubschemaData=jn.getSubschema=void 0;var Lr=me(),Fk=Se();function b2(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,Lr._)`${t.schemaPath}${(0,Lr.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Lr._)`${t.schemaPath}${(0,Lr.getProperty)(e)}${(0,Lr.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Fk.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')}jn.getSubschema=b2;function w2(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,Lr._)`${e.data}${(0,Lr.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Lr.str)`${u}${(0,Fk.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Lr._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(s!==void 0){let u=s instanceof Lr.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]}}jn.extendSubschemaData=w2;function x2(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}jn.extendSubschemaMode=x2});var Ag=S((hce,Vk)=>{"use strict";f();Vk.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 Hk=S((gce,Bk)=>{"use strict";f();var zn=Bk.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(){};bl(e,n,s,t,"",t)};zn.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zn.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zn.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zn.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 bl(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 zn.arrayKeywords)for(var p=0;p<d.length;p++)bl(t,e,r,d[p],s+"/"+l+"/"+p,o,s,l,n,p)}else if(l in zn.propsKeywords){if(d&&typeof d=="object")for(var g in d)bl(t,e,r,d[g],s+"/"+l+"/"+S2(g),o,s,l,n,g)}else(l in zn.keywords||t.allKeys&&!(l in zn.skipKeywords))&&bl(t,e,r,d,s+"/"+l,o,s,l,n)}r(n,s,o,i,a,c,u)}}function S2(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var za=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 k2=Se(),E2=Ag(),T2=Hk(),$2=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function I2(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Rg(t):e?Kk(t)<=e:!1}zt.inlineRef=I2;var P2=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Rg(t){for(let e in t){if(P2.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 Kk(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!$2.has(r)&&(typeof t[r]=="object"&&(0,k2.eachItem)(t[r],n=>e+=Kk(n)),e===1/0))return 1/0}return e}function Gk(t,e="",r){r!==!1&&(e=ri(e));let n=t.parse(e);return Jk(t,n)}zt.getFullPath=Gk;function Jk(t,e){return t.serialize(e).split("#")[0]+"#"}zt._getFullPath=Jk;var O2=/#\/?$/;function ri(t){return t?t.replace(O2,""):""}zt.normalizeId=ri;function C2(t,e,r){return r=ri(r),t.resolve(e,r)}zt.resolveUrl=C2;var N2=/^[a-z_][-a-z0-9._]*$/i;function A2(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,s=ri(t[r]||e),o={"":s},i=Gk(n,s,!1),a={},c=new Set;return T2(t,{allKeys:!0},(d,p,g,h)=>{if(h===void 0)return;let m=i+p,y=o[h];typeof d[r]=="string"&&(y=b.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),o[p]=y;function b(x){let T=this.opts.uriResolver.resolve;if(x=ri(y?T(y,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(!N2.test(x))throw new Error(`invalid anchor "${x}"`);b.call(this,`#${x}`)}}}),a;function u(d,p,g){if(p!==void 0&&!E2(d,p))throw l(g)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}zt.getSchemaRefs=A2});var qa=S(Mn=>{"use strict";f();Object.defineProperty(Mn,"__esModule",{value:!0});Mn.getData=Mn.KeywordCxt=Mn.validateFunctionCode=void 0;var eE=Pk(),Wk=ja(),zg=Tg(),wl=ja(),R2=zk(),La=Dk(),jg=Uk(),Y=me(),ae=ln(),j2=za(),dn=Se(),Ma=Ra();function z2(t){if(nE(t)&&(sE(t),rE(t))){q2(t);return}tE(t,()=>(0,eE.topBoolOrEmptySchema)(t))}Mn.validateFunctionCode=z2;function tE({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"; ${Yk(r,s)}`),L2(t,s),t.code(o)}):t.func(e,(0,Y._)`${ae.default.data}, ${M2(s)}`,n.$async,()=>t.code(Yk(r,s)).code(o))}function M2(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 L2(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 q2(t){let{schema:e,opts:r,gen:n}=t;tE(t,()=>{r.$comment&&e.$comment&&iE(t),V2(t),n.let(ae.default.vErrors,null),n.let(ae.default.errors,0),r.unevaluated&&Z2(t),oE(t),K2(t)})}function Z2(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 Yk(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 D2(t,e){if(nE(t)&&(sE(t),rE(t))){F2(t,e);return}(0,eE.boolOrEmptySchema)(t,e)}function rE({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 nE(t){return typeof t.schema!="boolean"}function F2(t,e){let{schema:r,gen:n,opts:s}=t;s.$comment&&r.$comment&&iE(t),B2(t),H2(t);let o=n.const("_errs",ae.default.errors);oE(t,o),n.var(e,(0,Y._)`${o} === ${ae.default.errors}`)}function sE(t){(0,dn.checkUnknownRules)(t),U2(t)}function oE(t,e){if(t.opts.jtd)return Xk(t,[],!1,e);let r=(0,Wk.getSchemaTypes)(t.schema),n=(0,Wk.coerceAndCheckDataType)(t,r);Xk(t,r,!n,e)}function U2(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 V2(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 B2(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,j2.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function H2(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function iE({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 K2(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&&G2(t),e.return((0,Y._)`${ae.default.errors} === 0`))}function G2({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 Xk(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(()=>cE(t,"$ref",l.all.$ref.definition));return}c.jtd||J2(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,wl.checkDataType)(p.type,i,c.strictNumbers)),Qk(t,p),e.length===1&&e[0]===p.type&&r&&(s.else(),(0,wl.reportTypeError)(t)),s.endIf()):Qk(t,p),a||s.if((0,Y._)`${ae.default.errors} === ${n||0}`))}}function Qk(t,e){let{gen:r,schema:n,opts:{useDefaults:s}}=t;s&&(0,R2.assignDefaults)(t,e.type),r.block(()=>{for(let o of e.rules)(0,zg.shouldUseRule)(n,o)&&cE(t,o.keyword,o.definition,e.type)})}function J2(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(W2(t,e),t.opts.allowUnionTypes||Y2(t,e),X2(t,t.dataTypes))}function W2(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{aE(t.dataTypes,r)||Mg(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),eF(t,e)}}function Y2(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Mg(t,"use allowUnionTypes to allow union type keyword")}function X2(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=>Q2(e,i))&&Mg(t,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function Q2(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function aE(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function eF(t,e){let r=[];for(let n of t.dataTypes)aE(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 xl=class{constructor(e,r,n){if((0,La.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",uE(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,La.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?Ma.reportExtraError:Ma.reportError)(this,this.def.error,r)}$dataError(){(0,Ma.reportError)(this,this.def.$dataError||Ma.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ma.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,wl.checkDataTypes)(c,r,o.opts.strictNumbers,wl.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 D2(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}};Mn.KeywordCxt=xl;function cE(t,e,r,n){let s=new xl(t,r,e);"code"in r?r.code(s,n):s.$data&&r.validate?(0,La.funcKeywordCode)(s,r):"macro"in r?(0,La.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,La.funcKeywordCode)(s,r)}var tF=/^\/(?:[^~]|~0|~1)*$/,rF=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function uE(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let s,o;if(t==="")return ae.default.rootData;if(t[0]==="/"){if(!tF.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);s=t,o=ae.default.rootData}else{let u=rF.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}`}}Mn.getData=uE});var Sl=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 Za=S(Fg=>{"use strict";f();Object.defineProperty(Fg,"__esModule",{value:!0});var Zg=za(),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 El=S(sr=>{"use strict";f();Object.defineProperty(sr,"__esModule",{value:!0});sr.resolveSchema=sr.getCompilingSchema=sr.resolveRef=sr.compileSchema=sr.SchemaEnv=void 0;var wr=me(),nF=Sl(),qs=ln(),xr=za(),lE=Se(),sF=qa(),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,xr.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=dE.call(this,t);if(e)return e;let r=(0,xr.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:s}=this.opts.code,{ownProperties:o}=this.opts,i=new wr.CodeGen(this.scope,{es5:n,lines:s,ownProperties:o}),a;t.$async&&(a=i.scopeValue("Error",{ref:nF.default,code:(0,wr._)`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:[wr.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,wr.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:wr.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,wr._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,sF.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 wr.Name?void 0:h,items:m instanceof wr.Name?void 0:m,dynamicProps:h instanceof wr.Name,dynamicItems:m instanceof wr.Name},g.source&&(g.source.evaluated=(0,wr.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 oF(t,e,r){var n;r=(0,xr.resolveUrl)(this.opts.uriResolver,e,r);let s=t.refs[r];if(s)return s;let o=cF.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]=iF.call(this,o)}sr.resolveRef=oF;function iF(t){return(0,xr.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Vg.call(this,t)}function dE(t){for(let e of this._compilations)if(aF(e,t))return e}sr.getCompilingSchema=dE;function aF(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function cF(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||kl.call(this,t,e)}function kl(t,e){let r=this.opts.uriResolver.parse(e),n=(0,xr._getFullPath)(this.opts.uriResolver,r),s=(0,xr.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,xr.normalizeId)(n),i=this.refs[o]||this.schemas[o];if(typeof i=="string"){let a=kl.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,xr.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(s=(0,xr.resolveUrl)(this.opts.uriResolver,s,u)),new ni({schema:a,schemaId:c,root:t,baseId:s})}return Ug.call(this,r,i)}}sr.resolveSchema=kl;var uF=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,lE.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!uF.has(a)&&u&&(e=(0,xr.resolveUrl)(this.opts.uriResolver,e,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,lE.schemaHasRulesButRef)(r,this.RULES)){let a=(0,xr.resolveUrl)(this.opts.uriResolver,e,r.$ref);o=kl.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 fE=S((Ice,lF)=>{lF.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((Pce,gE)=>{"use strict";f();var dF=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),hE=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 fF=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function pE(t){return t.length=0,!0}function pF(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 hF(t){let e=0,r={error:!1,address:"",zone:""},n=[],s=[],o=!1,i=!1,a=pF;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=pE}else{s.push(u);continue}}return s.length&&(a===pE?r.zone=s.join(""):i?n.push(s.join("")):n.push(Bg(s))),r.address=n.join(""),r}function mE(t){if(mF(t,":")<2)return{host:t,isIPV6:!1};let e=hF(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 mF(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function gF(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 yF(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(!hE(r)){let n=mE(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}gE.exports={nonSimpleDomain:fF,recomposeAuthority:_F,normalizeComponentEncoding:yF,removeDotSegments:gF,isIPv4:hE,isUUID:dF,normalizeIPv6:mE,stringArrayToHexStripped:Bg}});var wE=S((Cce,bE)=>{"use strict";f();var{isUUID:vF}=Hg(),bF=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,wF=["http","https","ws","wss","urn","urn:uuid"];function xF(t){return wF.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 yE(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function _E(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 SF(t){return t.secure=Kg(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function kF(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 EF(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(bF);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 TF(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 $F(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!vF(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function IF(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var vE={scheme:"http",domainHost:!0,parse:yE,serialize:_E},PF={scheme:"https",domainHost:vE.domainHost,parse:yE,serialize:_E},Tl={scheme:"ws",domainHost:!0,parse:SF,serialize:kF},OF={scheme:"wss",domainHost:Tl.domainHost,parse:Tl.parse,serialize:Tl.serialize},CF={scheme:"urn",parse:EF,serialize:TF,skipNormalize:!0},NF={scheme:"urn:uuid",parse:$F,serialize:IF,skipNormalize:!0},$l={http:vE,https:PF,ws:Tl,wss:OF,urn:CF,"urn:uuid":NF};Object.setPrototypeOf($l,null);function Gg(t){return t&&($l[t]||$l[t.toLowerCase()])||void 0}bE.exports={wsIsSecure:Kg,SCHEMES:$l,isValidSchemeName:xF,getSchemeHandler:Gg}});var kE=S((Ace,Pl)=>{"use strict";f();var{normalizeIPv6:AF,removeDotSegments:Da,recomposeAuthority:RF,normalizeComponentEncoding:Il,isIPv4:jF,nonSimpleDomain:zF}=Hg(),{SCHEMES:MF,getSchemeHandler:xE}=wE();function LF(t,e){return typeof t=="string"?t=qr(fn(t,e),e):typeof t=="object"&&(t=fn(qr(t,e),e)),t}function qF(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=SE(fn(t,n),fn(e,n),n,!0);return n.skipEscape=!0,qr(s,n)}function SE(t,e,r,n){let s={};return n||(t=fn(qr(t,r),r),e=fn(qr(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=Da(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=Da(e.path||""),s.query=e.query):(e.path?(e.path[0]==="/"?s.path=Da(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=Da(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 ZF(t,e,r){return typeof t=="string"?(t=unescape(t),t=qr(Il(fn(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=qr(Il(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=qr(Il(fn(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=qr(Il(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function qr(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=xE(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=RF(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=Da(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 DF=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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(DF);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(jF(n.host)===!1){let c=AF(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=xE(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:MF,normalize:LF,resolve:qF,resolveComponent:SE,equal:ZF,serialize:qr,parse:fn};Pl.exports=Jg;Pl.exports.default=Jg;Pl.exports.fastUri=Jg});var TE=S(Wg=>{"use strict";f();Object.defineProperty(Wg,"__esModule",{value:!0});var EE=kE();EE.code='require("ajv/dist/runtime/uri").default';Wg.default=EE});var RE=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 FF=qa();Object.defineProperty(gt,"KeywordCxt",{enumerable:!0,get:function(){return FF.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 UF=Sl(),CE=Za(),VF=Eg(),Fa=El(),BF=me(),Ua=za(),Ol=ja(),Xg=Se(),$E=fE(),HF=TE(),NE=(t,e)=>new RegExp(t,e);NE.code="new RegExp";var KF=["removeAdditional","useDefaults","coerceTypes"],GF=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),JF={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."},WF={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},IE=200;function YF(t){var e,r,n,s,o,i,a,c,u,l,d,p,g,h,m,y,b,w,x,T,P,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:NE,te=(s=t.uriResolver)!==null&&s!==void 0?s:HF.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:IE,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:IE,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:(A=t.int32range)!==null&&A!==void 0?A:!0,uriResolver:te}}var Va=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...YF(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new BF.ValueScope({scope:{},prefixes:GF,es5:r,lines:n}),this.logger=nU(e.logger);let s=e.validateFormats;e.validateFormats=!1,this.RULES=(0,VF.getRules)(),PE.call(this,JF,e,"NOT SUPPORTED"),PE.call(this,WF,e,"DEPRECATED","warn"),this._metaOpts=tU.call(this),e.formats&&QF.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&eU.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),XF.call(this),e.validateFormats=s}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,s=$E;n==="id"&&(s={...$E},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 CE.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,Ua.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=OE.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,s=new Fa.SchemaEnv({schema:{},schemaId:n});if(r=Fa.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=OE.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,Ua.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(oU.call(this,n,r),!r)return(0,Xg.eachItem)(n,o=>Yg.call(this,o)),this;aU.call(this,r);let s={...r,type:(0,Ol.getJSONTypes)(r.type),schemaType:(0,Ol.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]=AE(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,Ua.normalizeId)(i||n);let u=Ua.getSchemaRefs.call(this,e,n);return c=new Fa.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):Fa.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{Fa.compileSchema.call(this,e)}finally{this.opts=r}}};Va.ValidationError=UF.default;Va.MissingRefError=CE.default;gt.default=Va;function PE(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 OE(t){return t=(0,Ua.normalizeId)(t),this.schemas[t]||this.refs[t]}function XF(){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 QF(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function eU(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 tU(){let t={...this.opts};for(let e of KF)delete t[e];return t}var rU={log(){},warn(){},error(){}};function nU(t){if(t===!1)return rU;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 sU=/^[a-z_$][a-z0-9_$:-]*$/i;function oU(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(!sU.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,Ol.getJSONTypes)(e.type),schemaType:(0,Ol.getJSONTypes)(e.schemaType)}};e.before?iU.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 iU(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 aU(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=AE(e)),t.validateSchema=this.compile(e,!0))}var cU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function AE(t){return{anyOf:[t,cU]}}});var jE=S(Qg=>{"use strict";f();Object.defineProperty(Qg,"__esModule",{value:!0});var uU={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Qg.default=uU});var qE=S(Zs=>{"use strict";f();Object.defineProperty(Zs,"__esModule",{value:!0});Zs.callRef=Zs.getValidate=void 0;var lU=Za(),zE=nr(),Mt=me(),oi=ln(),ME=El(),Cl=Se(),dU={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=ME.resolveRef.call(c,u,s,r);if(l===void 0)throw new lU.default(n.opts.uriResolver,s,r);if(l instanceof ME.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=LE(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}),y=e.name("valid"),b=t.subschema({schema:h,dataTypes:[],schemaPath:Mt.nil,topSchemaRef:m,errSchemaPath:r},y);t.mergeEvaluated(b),t.ok(y)}}};function LE(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=LE;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,zE.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,zE.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 y=(m=r?.validate)===null||m===void 0?void 0:m.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=Cl.mergeEvaluated.props(s,y.props,o.props));else{let b=s.var("props",(0,Mt._)`${h}.evaluated.props`);o.props=Cl.mergeEvaluated.props(s,b,o.props,Mt.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=Cl.mergeEvaluated.items(s,y.items,o.items));else{let b=s.var("items",(0,Mt._)`${h}.evaluated.items`);o.items=Cl.mergeEvaluated.items(s,b,o.items,Mt.Name)}}}Zs.callRef=Nl;Zs.default=dU});var ZE=S(ey=>{"use strict";f();Object.defineProperty(ey,"__esModule",{value:!0});var fU=jE(),pU=qE(),hU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",fU.default,pU.default];ey.default=hU});var DE=S(ty=>{"use strict";f();Object.defineProperty(ty,"__esModule",{value:!0});var Al=me(),Ln=Al.operators,Rl={maximum:{okStr:"<=",ok:Ln.LTE,fail:Ln.GT},minimum:{okStr:">=",ok:Ln.GTE,fail:Ln.LT},exclusiveMaximum:{okStr:"<",ok:Ln.LT,fail:Ln.GTE},exclusiveMinimum:{okStr:">",ok:Ln.GT,fail:Ln.LTE}},mU={message:({keyword:t,schemaCode:e})=>(0,Al.str)`must be ${Rl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Al._)`{comparison: ${Rl[t].okStr}, limit: ${e}}`},gU={keyword:Object.keys(Rl),type:"number",schemaType:"number",$data:!0,error:mU,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Al._)`${r} ${Rl[e].fail} ${n} || isNaN(${r})`)}};ty.default=gU});var FE=S(ry=>{"use strict";f();Object.defineProperty(ry,"__esModule",{value:!0});var Ba=me(),yU={message:({schemaCode:t})=>(0,Ba.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Ba._)`{multipleOf: ${t}}`},_U={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:yU,code(t){let{gen:e,data:r,schemaCode:n,it:s}=t,o=s.opts.multipleOfPrecision,i=e.let("res"),a=o?(0,Ba._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${o}`:(0,Ba._)`${i} !== parseInt(${i})`;t.fail$data((0,Ba._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};ry.default=_U});var VE=S(ny=>{"use strict";f();Object.defineProperty(ny,"__esModule",{value:!0});function UE(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=UE;UE.code='require("ajv/dist/runtime/ucs2length").default'});var BE=S(sy=>{"use strict";f();Object.defineProperty(sy,"__esModule",{value:!0});var Ds=me(),vU=Se(),bU=VE(),wU={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}}`},xU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:wU,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,vU.useFunc)(t.gen,bU.default)}(${r})`;t.fail$data((0,Ds._)`${i} ${o} ${n}`)}};sy.default=xU});var HE=S(oy=>{"use strict";f();Object.defineProperty(oy,"__esModule",{value:!0});var SU=nr(),kU=Se(),ii=me(),EU={message:({schemaCode:t})=>(0,ii.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,ii._)`{pattern: ${t}}`},TU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:EU,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,kU.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,SU.usePattern)(t,s);t.fail$data((0,ii._)`!${c}.test(${r})`)}}};oy.default=TU});var KE=S(iy=>{"use strict";f();Object.defineProperty(iy,"__esModule",{value:!0});var Ha=me(),$U={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Ha.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Ha._)`{limit: ${t}}`},IU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:$U,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxProperties"?Ha.operators.GT:Ha.operators.LT;t.fail$data((0,Ha._)`Object.keys(${r}).length ${s} ${n}`)}};iy.default=IU});var GE=S(ay=>{"use strict";f();Object.defineProperty(ay,"__esModule",{value:!0});var Ka=nr(),Ga=me(),PU=Se(),OU={message:({params:{missingProperty:t}})=>(0,Ga.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ga._)`{missingProperty: ${t}}`},CU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:OU,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 y=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${m}" is not defined at "${y}" (strictRequired)`;(0,PU.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||o)t.block$data(Ga.nil,d);else for(let g of r)(0,Ka.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,Ka.checkMissingProp)(t,r,g)),(0,Ka.reportMissingProp)(t,g),e.else()}function d(){e.forOf("prop",n,g=>{t.setParams({missingProperty:g}),e.if((0,Ka.noPropertyInData)(e,s,g,a.ownProperties),()=>t.error())})}function p(g,h){t.setParams({missingProperty:g}),e.forOf(g,n,()=>{e.assign(h,(0,Ka.propertyInData)(e,s,g,a.ownProperties)),e.if((0,Ga.not)(h),()=>{t.error(),e.break()})},Ga.nil)}}};ay.default=CU});var JE=S(cy=>{"use strict";f();Object.defineProperty(cy,"__esModule",{value:!0});var Ja=me(),NU={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ja.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ja._)`{limit: ${t}}`},AU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:NU,code(t){let{keyword:e,data:r,schemaCode:n}=t,s=e==="maxItems"?Ja.operators.GT:Ja.operators.LT;t.fail$data((0,Ja._)`${r}.length ${s} ${n}`)}};cy.default=AU});var jl=S(uy=>{"use strict";f();Object.defineProperty(uy,"__esModule",{value:!0});var WE=Ag();WE.code='require("ajv/dist/runtime/equal").default';uy.default=WE});var YE=S(dy=>{"use strict";f();Object.defineProperty(dy,"__esModule",{value:!0});var ly=ja(),yt=me(),RU=Se(),jU=jl(),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}}`},MU={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 y=e.name("item"),b=(0,ly.checkDataTypes)(u,y,a.opts.strictNumbers,ly.DataType.Wrong),w=e.const("indices",(0,yt._)`{}`);e.for((0,yt._)`;${h}--;`,()=>{e.let(y,(0,yt._)`${r}[${h}]`),e.if(b,(0,yt._)`continue`),u.length>1&&e.if((0,yt._)`typeof ${y} == "string"`,(0,yt._)`${y} += "_"`),e.if((0,yt._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(m,(0,yt._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,yt._)`${w}[${y}] = ${h}`)})}function g(h,m){let y=(0,RU.useFunc)(e,jU.default),b=e.name("outer");e.label(b).for((0,yt._)`;${h}--;`,()=>e.for((0,yt._)`${m} = ${h}; ${m}--;`,()=>e.if((0,yt._)`${y}(${r}[${h}], ${r}[${m}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};dy.default=MU});var XE=S(py=>{"use strict";f();Object.defineProperty(py,"__esModule",{value:!0});var fy=me(),LU=Se(),qU=jl(),ZU={message:"must be equal to constant",params:({schemaCode:t})=>(0,fy._)`{allowedValue: ${t}}`},DU={keyword:"const",$data:!0,error:ZU,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,LU.useFunc)(e,qU.default)}(${r}, ${s})`):t.fail((0,fy._)`${o} !== ${r}`)}};py.default=DU});var QE=S(hy=>{"use strict";f();Object.defineProperty(hy,"__esModule",{value:!0});var Wa=me(),FU=Se(),UU=jl(),VU={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Wa._)`{allowedValues: ${t}}`},BU={keyword:"enum",schemaType:"array",$data:!0,error:VU,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,FU.useFunc)(e,UU.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,Wa.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,Wa._)`${u()}(${r}, ${g})`,()=>e.assign(l,!0).break()))}function p(g,h){let m=s[h];return typeof m=="object"&&m!==null?(0,Wa._)`${u()}(${r}, ${g}[${h}])`:(0,Wa._)`${r} === ${m}`}}};hy.default=BU});var eT=S(my=>{"use strict";f();Object.defineProperty(my,"__esModule",{value:!0});var HU=DE(),KU=FE(),GU=BE(),JU=HE(),WU=KE(),YU=GE(),XU=JE(),QU=YE(),e4=XE(),t4=QE(),r4=[HU.default,KU.default,GU.default,JU.default,WU.default,YU.default,XU.default,QU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},e4.default,t4.default];my.default=r4});var yy=S(Ya=>{"use strict";f();Object.defineProperty(Ya,"__esModule",{value:!0});Ya.validateAdditionalItems=void 0;var Fs=me(),gy=Se(),n4={message:({params:{len:t}})=>(0,Fs.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Fs._)`{limit: ${t}}`},s4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:n4,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}tT(t,n)}};function tT(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())})}}Ya.validateAdditionalItems=tT;Ya.default=s4});var _y=S(Xa=>{"use strict";f();Object.defineProperty(Xa,"__esModule",{value:!0});Xa.validateTuple=void 0;var rT=me(),zl=Se(),o4=nr(),i4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return nT(t,"additionalItems",e);r.items=!0,!(0,zl.alwaysValidSchema)(r,e)&&t.ok((0,o4.validateArray)(t))}};function nT(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=zl.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,rT._)`${o}.length`);r.forEach((d,p)=>{(0,zl.alwaysValidSchema)(a,d)||(n.if((0,rT._)`${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 y=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${g}"`;(0,zl.checkStrictMode)(a,y,p.strictTuples)}}}Xa.validateTuple=nT;Xa.default=i4});var sT=S(vy=>{"use strict";f();Object.defineProperty(vy,"__esModule",{value:!0});var a4=_y(),c4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,a4.validateTuple)(t,"items")};vy.default=c4});var iT=S(by=>{"use strict";f();Object.defineProperty(by,"__esModule",{value:!0});var oT=me(),u4=Se(),l4=nr(),d4=yy(),f4={message:({params:{len:t}})=>(0,oT.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,oT._)`{limit: ${t}}`},p4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:f4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:s}=r;n.items=!0,!(0,u4.alwaysValidSchema)(n,e)&&(s?(0,d4.validateAdditionalItems)(t,s):t.ok((0,l4.validateArray)(t)))}};by.default=p4});var aT=S(wy=>{"use strict";f();Object.defineProperty(wy,"__esModule",{value:!0});var or=me(),Ml=Se(),h4={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}}`},m4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:h4,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,Ml.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Ml.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ml.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"),y=e.let("count",0);g(m,()=>e.if(m,()=>h(y)))}function g(m,y){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:Ml.Type.Num,compositeRule:!0},m),y()})}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=m4});var lT=S(Zr=>{"use strict";f();Object.defineProperty(Zr,"__esModule",{value:!0});Zr.validateSchemaDeps=Zr.validatePropertyDeps=Zr.error=void 0;var xy=me(),g4=Se(),Qa=nr();Zr.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 y4={keyword:"dependencies",type:"object",schemaType:"object",error:Zr.error,code(t){let[e,r]=_4(t);cT(t,e),uT(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 cT(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,Qa.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,Qa.checkReportMissingProp)(t,u)}):(r.if((0,xy._)`${c} && (${(0,Qa.checkMissingProp)(t,a,o)})`),(0,Qa.reportMissingProp)(t,o),r.else())}}Zr.validatePropertyDeps=cT;function uT(t,e=t.schema){let{gen:r,data:n,keyword:s,it:o}=t,i=r.name("valid");for(let a in e)(0,g4.alwaysValidSchema)(o,e[a])||(r.if((0,Qa.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))}Zr.validateSchemaDeps=uT;Zr.default=y4});var fT=S(Sy=>{"use strict";f();Object.defineProperty(Sy,"__esModule",{value:!0});var dT=me(),v4=Se(),b4={message:"property name must be valid",params:({params:t})=>(0,dT._)`{propertyName: ${t.propertyName}}`},w4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:b4,code(t){let{gen:e,schema:r,data:n,it:s}=t;if((0,v4.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,dT.not)(o),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(o)}};Sy.default=w4});var Ey=S(ky=>{"use strict";f();Object.defineProperty(ky,"__esModule",{value:!0});var Ll=nr(),Sr=me(),x4=ln(),ql=Se(),S4={message:"must NOT have additional properties",params:({params:t})=>(0,Sr._)`{additionalProperty: ${t.additionalProperty}}`},k4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:S4,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,ql.alwaysValidSchema)(i,r))return;let u=(0,Ll.allSchemaProperties)(n.properties),l=(0,Ll.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Sr._)`${o} === ${x4.default.errors}`);function d(){e.forIn("key",s,y=>{!u.length&&!l.length?h(y):e.if(p(y),()=>h(y))})}function p(y){let b;if(u.length>8){let w=(0,ql.schemaRefOrVal)(i,n.properties,"properties");b=(0,Ll.isOwnProperty)(e,w,y)}else u.length?b=(0,Sr.or)(...u.map(w=>(0,Sr._)`${y} === ${w}`)):b=Sr.nil;return l.length&&(b=(0,Sr.or)(b,...l.map(w=>(0,Sr._)`${(0,Ll.usePattern)(t,w)}.test(${y})`))),(0,Sr.not)(b)}function g(y){e.code((0,Sr._)`delete ${s}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){g(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ql.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(m(y,b,!1),e.if((0,Sr.not)(b),()=>{t.reset(),g(y)})):(m(y,b),a||e.if((0,Sr.not)(b),()=>e.break()))}}function m(y,b,w){let x={keyword:"additionalProperties",dataProp:y,dataPropType:ql.Type.Str};w===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,b)}}};ky.default=k4});var mT=S($y=>{"use strict";f();Object.defineProperty($y,"__esModule",{value:!0});var E4=qa(),pT=nr(),Ty=Se(),hT=Ey(),T4={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&&hT.default.code(new E4.KeywordCxt(o,hT.default,"additionalProperties"));let i=(0,pT.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,pT.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=T4});var vT=S(Iy=>{"use strict";f();Object.defineProperty(Iy,"__esModule",{value:!0});var gT=nr(),Zl=me(),yT=Se(),_T=Se(),$4={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,gT.allSchemaProperties)(r),c=a.filter(m=>(0,yT.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 Zl.Name)&&(o.props=(0,_T.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 y in u)new RegExp(m).test(y)&&(0,yT.checkStrictMode)(o,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){e.forIn("key",n,y=>{e.if((0,Zl._)`${(0,gT.usePattern)(t,m)}.test(${y})`,()=>{let b=c.includes(m);b||t.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:_T.Type.Str},l),o.opts.unevaluated&&d!==!0?e.assign((0,Zl._)`${d}[${y}]`,!0):!b&&!o.allErrors&&e.if((0,Zl.not)(l),()=>e.break())})})}}};Iy.default=$4});var bT=S(Py=>{"use strict";f();Object.defineProperty(Py,"__esModule",{value:!0});var I4=Se(),P4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,I4.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=P4});var wT=S(Oy=>{"use strict";f();Object.defineProperty(Oy,"__esModule",{value:!0});var O4=nr(),C4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:O4.validateUnion,error:{message:"must match a schema in anyOf"}};Oy.default=C4});var xT=S(Cy=>{"use strict";f();Object.defineProperty(Cy,"__esModule",{value:!0});var Dl=me(),N4=Se(),A4={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Dl._)`{passingSchemas: ${t.passing}}`},R4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:A4,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,N4.alwaysValidSchema)(s,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Dl._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Dl._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Dl.Name)})})}}};Cy.default=R4});var ST=S(Ny=>{"use strict";f();Object.defineProperty(Ny,"__esModule",{value:!0});var j4=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,j4.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:i},s);t.ok(s),t.mergeEvaluated(a)})}};Ny.default=z4});var TT=S(Ay=>{"use strict";f();Object.defineProperty(Ay,"__esModule",{value:!0});var Fl=me(),ET=Se(),M4={message:({params:t})=>(0,Fl.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Fl._)`{failingKeyword: ${t.ifClause}}`},L4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:M4,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ET.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=kT(n,"then"),o=kT(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,Fl.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,Fl._)`${l}`):t.setParams({ifClause:l})}}}};function kT(t,e){let r=t.schema[e];return r!==void 0&&!(0,ET.alwaysValidSchema)(t,r)}Ay.default=L4});var $T=S(Ry=>{"use strict";f();Object.defineProperty(Ry,"__esModule",{value:!0});var q4=Se(),Z4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,q4.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ry.default=Z4});var IT=S(jy=>{"use strict";f();Object.defineProperty(jy,"__esModule",{value:!0});var D4=yy(),F4=sT(),U4=_y(),V4=iT(),B4=aT(),H4=lT(),K4=fT(),G4=Ey(),J4=mT(),W4=vT(),Y4=bT(),X4=wT(),Q4=xT(),e9=ST(),t9=TT(),r9=$T();function n9(t=!1){let e=[Y4.default,X4.default,Q4.default,e9.default,t9.default,r9.default,K4.default,G4.default,H4.default,J4.default,W4.default];return t?e.push(F4.default,V4.default):e.push(D4.default,U4.default),e.push(B4.default),e}jy.default=n9});var PT=S(zy=>{"use strict";f();Object.defineProperty(zy,"__esModule",{value:!0});var st=me(),s9={message:({schemaCode:t})=>(0,st.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,st._)`{format: ${t}}`},o9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:s9,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}]`),y=r.let("fType"),b=r.let("format");r.if((0,st._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,(0,st._)`${m}.type || "string"`).assign(b,(0,st._)`${m}.validate`),()=>r.assign(y,(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 && ${y} === ${e} && !${P}`}}function g(){let h=d.formats[o];if(!h){w();return}if(h===!0)return;let[m,y,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 y=="function"?(0,st._)`${b}(${n})`:(0,st._)`${b}.test(${n})`}}}};zy.default=o9});var OT=S(My=>{"use strict";f();Object.defineProperty(My,"__esModule",{value:!0});var i9=PT(),a9=[i9.default];My.default=a9});var CT=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 AT=S(Ly=>{"use strict";f();Object.defineProperty(Ly,"__esModule",{value:!0});var c9=ZE(),u9=eT(),l9=IT(),d9=OT(),NT=CT(),f9=[c9.default,u9.default,(0,l9.default)(),d9.default,NT.metadataVocabulary,NT.contentVocabulary];Ly.default=f9});var jT=S(Ul=>{"use strict";f();Object.defineProperty(Ul,"__esModule",{value:!0});Ul.DiscrError=void 0;var RT;(function(t){t.Tag="tag",t.Mapping="mapping"})(RT||(Ul.DiscrError=RT={}))});var MT=S(Zy=>{"use strict";f();Object.defineProperty(Zy,"__esModule",{value:!0});var ci=me(),qy=jT(),zT=El(),p9=Za(),h9=Se(),m9={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}}`},g9={keyword:"discriminator",type:"object",schemaType:"object",error:m9,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),y=!0;for(let T=0;T<i.length;T++){let P=i[T];if(P?.$ref&&!(0,h9.schemaHasRulesButRef)(P,o.self.RULES)){let U=P.$ref;if(P=zT.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,U),P instanceof zT.SchemaEnv&&(P=P.schema),P===void 0)throw new p9.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}"`);y=y&&(m||b(P)),w(L,T)}if(!y)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=g9});var LT=S((cle,y9)=>{y9.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=RE(),v9=AT(),b9=MT(),qT=LT(),w9=["/properties"],Vl="http://json-schema.org/draft-07/schema",ui=class extends _9.default{_addVocabularies(){super._addVocabularies(),v9.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(b9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(qT,w9):qT;this.addMetaSchema(e,Vl,!1),this.refs["http://json-schema.org/schema"]=Vl}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Vl)?Vl:void 0)}};Be.Ajv=ui;Dy.exports=Be=ui;Dy.exports.Ajv=ui;Object.defineProperty(Be,"__esModule",{value:!0});Be.default=ui;var x9=qa();Object.defineProperty(Be,"KeywordCxt",{enumerable:!0,get:function(){return x9.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 S9=Sl();Object.defineProperty(Be,"ValidationError",{enumerable:!0,get:function(){return S9.default}});var k9=Za();Object.defineProperty(Be,"MissingRefError",{enumerable:!0,get:function(){return k9.default}})});var KT=S(Fr=>{"use strict";f();Object.defineProperty(Fr,"__esModule",{value:!0});Fr.formatNames=Fr.fastFormats=Fr.fullFormats=void 0;function Dr(t,e){return{validate:t,compare:e}}Fr.fullFormats={date:Dr(UT,Hy),time:Dr(Vy(!0),Ky),"date-time":Dr(ZT(!0),BT),"iso-time":Dr(Vy(),VT),"iso-date-time":Dr(ZT(),HT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:O9,"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:M9,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:C9,int32:{type:"number",validate:R9},int64:{type:"number",validate:j9},float:{type:"number",validate:FT},double:{type:"number",validate:FT},password:!0,binary:!0};Fr.fastFormats={...Fr.fullFormats,date:Dr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Hy),time:Dr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ky),"date-time":Dr(/^\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,BT),"iso-time":Dr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,VT),"iso-date-time":Dr(/^\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,HT),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};Fr.formatNames=Object.keys(Fr.fullFormats);function E9(t){return t%4===0&&(t%100!==0||t%400===0)}var T9=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,$9=[0,31,28,31,30,31,30,31,31,30,31,30,31];function UT(t){let e=T9.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&&E9(r)?29:$9[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 VT(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 ZT(t){let e=Vy(t);return function(n){let s=n.split(By);return s.length===2&&UT(s[0])&&e(s[1])}}function BT(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function HT(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 I9=/\/|:/,P9=/^(?:[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 O9(t){return I9.test(t)&&P9.test(t)}var DT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function C9(t){return DT.lastIndex=0,DT.test(t)}var N9=-(2**31),A9=2**31-1;function R9(t){return Number.isInteger(t)&&t<=A9&&t>=N9}function j9(t){return Number.isInteger(t)}function FT(){return!0}var z9=/[^\\]\\Z/;function M9(t){if(z9.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var GT=S(di=>{"use strict";f();Object.defineProperty(di,"__esModule",{value:!0});di.formatLimitDefinition=void 0;var L9=Fy(),kr=me(),qn=kr.operators,Bl={formatMaximum:{okStr:"<=",ok:qn.LTE,fail:qn.GT},formatMinimum:{okStr:">=",ok:qn.GTE,fail:qn.LT},formatExclusiveMaximum:{okStr:"<",ok:qn.LT,fail:qn.GTE},formatExclusiveMinimum:{okStr:">",ok:qn.GT,fail:qn.LTE}},q9={message:({keyword:t,schemaCode:e})=>(0,kr.str)`should be ${Bl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,kr._)`{comparison: ${Bl[t].okStr}, limit: ${e}}`};di.formatLimitDefinition={keyword:Object.keys(Bl),type:"string",schemaType:"string",$data:!0,error:q9,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 L9.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,kr._)`${p}[${c.schemaCode}]`);t.fail$data((0,kr.or)((0,kr._)`typeof ${g} != "object"`,(0,kr._)`${g} instanceof RegExp`,(0,kr._)`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,kr._)`${i.code.formats}${(0,kr.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,kr._)`${p}.compare(${r}, ${n}) ${Bl[s].fail} 0`}},dependencies:["format"]};var Z9=t=>(t.addKeyword(di.formatLimitDefinition),t);di.default=Z9});var XT=S((ec,YT)=>{"use strict";f();Object.defineProperty(ec,"__esModule",{value:!0});var fi=KT(),D9=GT(),Gy=me(),JT=new Gy.Name("fullFormats"),F9=new Gy.Name("fastFormats"),Jy=(t,e={keywords:!0})=>{if(Array.isArray(e))return WT(t,e,fi.fullFormats,JT),t;let[r,n]=e.mode==="fast"?[fi.fastFormats,F9]:[fi.fullFormats,JT],s=e.formats||fi.formatNames;return WT(t,s,r,n),e.keywords&&(0,D9.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 WT(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])}YT.exports=ec=Jy;Object.defineProperty(ec,"__esModule",{value:!0});ec.default=Jy});var rc=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 l$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(l$||(De.objectUtil=l$={}));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 J9=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=J9});var Wl=S(Dn=>{"use strict";f();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.ZodError=Dn.quotelessJson=Dn.ZodIssueCode=void 0;var d$=rc();Dn.ZodIssueCode=d$.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 W9=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Dn.quotelessJson=W9;var nc=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,d$.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()}};Dn.ZodError=nc;nc.create=t=>new nc(t)});var t_=S(e_=>{"use strict";f();Object.defineProperty(e_,"__esModule",{value:!0});var kt=Wl(),Us=rc(),Y9=(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=Y9});var Yl=S(Fn=>{"use strict";f();var X9=Fn&&Fn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.defaultErrorMap=void 0;Fn.setErrorMap=Q9;Fn.getErrorMap=eV;var f$=X9(t_());Fn.defaultErrorMap=f$.default;var p$=f$.default;function Q9(t){p$=t}function eV(){return p$}});var n_=S(Re=>{"use strict";f();var tV=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=sV;var rV=Yl(),h$=tV(t_()),nV=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=nV;Re.EMPTY_PATH=[];function sV(t,e){let r=(0,rV.getErrorMap)(),n=(0,Re.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===h$.default?void 0:h$.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 oV=t=>({status:"dirty",value:t});Re.DIRTY=oV;var iV=t=>({status:"valid",value:t});Re.OK=iV;var aV=t=>t.status==="aborted";Re.isAborted=aV;var cV=t=>t.status==="dirty";Re.isDirty=cV;var uV=t=>t.status==="valid";Re.isValid=uV;var lV=t=>typeof Promise<"u"&&t instanceof Promise;Re.isAsync=lV});var g$=S(m$=>{"use strict";f();Object.defineProperty(m$,"__esModule",{value:!0})});var _$=S(Xl=>{"use strict";f();Object.defineProperty(Xl,"__esModule",{value:!0});Xl.errorUtil=void 0;var y$;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(y$||(Xl.errorUtil=y$={}))});var O$=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=S$;k.custom=E$;var q=Wl(),Ql=Yl(),X=_$(),E=n_(),D=rc(),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}},v$=(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 v$(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 v$(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 Vr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mn.create(this)}promise(){return Bn.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 sc({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 oc.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 dV=/^c[^\s-]{8,}$/i,fV=/^[0-9a-z]+$/,pV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hV=/^[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,mV=/^[a-z0-9_-]{21}$/i,gV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yV=/^[-+]?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,vV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",s_,bV=/^(?:(?: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])$/,wV=/^(?:(?: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])$/,xV=/^(([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]))$/,SV=/^(([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])$/,kV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,EV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w$="((\\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])))",TV=new RegExp(`^${w$}$`);function x$(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 $V(t){return new RegExp(`^${x$(t)}$`)}function S$(t){let e=`${w$}T${x$(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 IV(t,e){return!!((e==="v4"||!e)&&bV.test(t)||(e==="v6"||!e)&&xV.test(t))}function PV(t,e){if(!gV.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 OV(t,e){return!!((e==="v4"||!e)&&wV.test(t)||(e==="v6"||!e)&&SV.test(t))}var Un=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(vV,"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")hV.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")mV.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")dV.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")fV.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")pV.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"?S$(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"?TV.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"?$V(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"?yV.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"?IV(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"?PV(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"?OV(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"?kV.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"?EV.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=Un;Un.create=t=>new Un({checks:[],typeName:ie.ZodString,coerce:t?.coerce??!1,...ue(t)});function CV(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"?CV(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 Vn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,E.OK)(e.data)}};k.ZodAny=Vn;Vn.create=t=>new Vn({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 Er=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=Er;Er.create=t=>new Er({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 Vr?Vr.create(hi(t.unwrap())):t instanceof Ur?Ur.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 Er&&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 Er){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 k$(D.util.objectKeys(this.shape))}};k.ZodObject=Lt;Lt.create=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strip",catchall:Er.create(),typeName:ie.ZodObject,...ue(e)});Lt.strictCreate=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strict",catchall:Er.create(),typeName:ie.ZodObject,...ue(e)});Lt.lazycreate=(t,e)=>new Lt({shape:t,unknownKeys:"strip",catchall:Er.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 Vr?[null,...pn(t.unwrap())]:t instanceof sc||t instanceof so?pn(t.unwrap()):t instanceof no?pn(t._def.innerType):[],ed=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=ed;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 Ur=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=Ur;Ur.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ur({items:t,typeName:ie.ZodTuple,rest:null,...ue(e)})};var td=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:Un.create(),valueType:e,typeName:ie.ZodRecord,...ue(r)})}};k.ZodRecord=td;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 rd=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,Ql.getErrorMap)(),Ql.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,Ql.getErrorMap)(),Ql.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 Bn){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:Ur.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||Ur.create([]).rest(hn.create()),returns:r||hn.create(),typeName:ie.ZodFunction,...ue(n)})}};k.ZodFunction=rd;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 k$(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=k$;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 Bn=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=Bn;Bn.create=(t,e)=>new Bn({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 Vr=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=Vr;Vr.create=(t,e)=>new Vr({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 sc=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=sc;var oc=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=oc;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 b$(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function E$(t,e={},r){return t?Vn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=b$(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=b$(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):Vn.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 NV=(t,e={message:`Input not instance of ${t.name}`})=>E$(r=>r instanceof t,e);k.instanceof=NV;var T$=Un.create;k.string=T$;var $$=Vs.create;k.number=$$;var AV=vi.create;k.nan=AV;var RV=Bs.create;k.bigint=RV;var I$=Hs.create;k.boolean=I$;var jV=Ks.create;k.date=jV;var zV=mi.create;k.symbol=zV;var MV=Gs.create;k.undefined=MV;var LV=Js.create;k.null=LV;var qV=Vn.create;k.any=qV;var ZV=hn.create;k.unknown=ZV;var DV=Er.create;k.never=DV;var FV=gi.create;k.void=FV;var UV=mn.create;k.array=UV;var VV=Lt.create;k.object=VV;var BV=Lt.strictCreate;k.strictObject=BV;var HV=Ws.create;k.union=HV;var KV=ed.create;k.discriminatedUnion=KV;var GV=Ys.create;k.intersection=GV;var JV=Ur.create;k.tuple=JV;var WV=td.create;k.record=WV;var YV=yi.create;k.map=YV;var XV=_i.create;k.set=XV;var QV=rd.create;k.function=QV;var eB=Xs.create;k.lazy=eB;var tB=Qs.create;k.literal=tB;var rB=eo.create;k.enum=rB;var nB=to.create;k.nativeEnum=nB;var sB=Bn.create;k.promise=sB;var P$=Gt.create;k.effect=P$;k.transformer=P$;var oB=ir.create;k.optional=oB;var iB=Vr.create;k.nullable=iB;var aB=Gt.createWithPreprocess;k.preprocess=aB;var cB=oc.create;k.pipeline=cB;var uB=()=>T$().optional();k.ostring=uB;var lB=()=>$$().optional();k.onumber=lB;var dB=()=>I$().optional();k.oboolean=dB;k.coerce={string:(t=>Un.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 fB=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)&&fB(e,t,r)};Object.defineProperty(cr,"__esModule",{value:!0});bi(Yl(),cr);bi(n_(),cr);bi(g$(),cr);bi(rc(),cr);bi(O$(),cr);bi(Wl(),cr)});var A$=S(qt=>{"use strict";f();var C$=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]})),pB=qt&&qt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),hB=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)&&C$(e,t,r);return pB(e,t),e},mB=qt&&qt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&C$(e,t,r)};Object.defineProperty(qt,"__esModule",{value:!0});qt.z=void 0;var N$=hB(i_());qt.z=N$;mB(i_(),qt);qt.default=N$});var wi=S(nd=>{"use strict";f();Object.defineProperty(nd,"__esModule",{value:!0});nd.config=void 0;var oo=A$(),gB=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 yB(){let t=gB.safeParse(process.env);return t.success||(console.error("\u274C Invalid environment configuration:"),console.error(t.error.format()),process.exit(1)),t.data}nd.config=yB()});var od=S(sd=>{"use strict";f();Object.defineProperty(sd,"__esModule",{value:!0});sd.ErrorCode=void 0;sd.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 id=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=od(),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=vB;var _B=id();function vB(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(($de,z$)=>{"use strict";f();var ic=t=>t&&typeof t.message=="string",__=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return ic(r)?r:void 0}else return ic(e)?e:void 0},R$=(t,e)=>{if(!ic(t))return"";let r=t.stack||"";if(e.has(t))return r+`
9
+ deps: ${r}}`};var y4={keyword:"dependencies",type:"object",schemaType:"object",error:Zr.error,code(t){let[e,r]=_4(t);cT(t,e),uT(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 cT(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,Qa.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,Qa.checkReportMissingProp)(t,u)}):(r.if((0,xy._)`${c} && (${(0,Qa.checkMissingProp)(t,a,o)})`),(0,Qa.reportMissingProp)(t,o),r.else())}}Zr.validatePropertyDeps=cT;function uT(t,e=t.schema){let{gen:r,data:n,keyword:s,it:o}=t,i=r.name("valid");for(let a in e)(0,g4.alwaysValidSchema)(o,e[a])||(r.if((0,Qa.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))}Zr.validateSchemaDeps=uT;Zr.default=y4});var fT=S(Sy=>{"use strict";f();Object.defineProperty(Sy,"__esModule",{value:!0});var dT=me(),v4=Se(),b4={message:"property name must be valid",params:({params:t})=>(0,dT._)`{propertyName: ${t.propertyName}}`},w4={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:b4,code(t){let{gen:e,schema:r,data:n,it:s}=t;if((0,v4.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,dT.not)(o),()=>{t.error(!0),s.allErrors||e.break()})}),t.ok(o)}};Sy.default=w4});var Ey=S(ky=>{"use strict";f();Object.defineProperty(ky,"__esModule",{value:!0});var Ll=nr(),Sr=me(),x4=ln(),ql=Se(),S4={message:"must NOT have additional properties",params:({params:t})=>(0,Sr._)`{additionalProperty: ${t.additionalProperty}}`},k4={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:S4,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,ql.alwaysValidSchema)(i,r))return;let u=(0,Ll.allSchemaProperties)(n.properties),l=(0,Ll.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Sr._)`${o} === ${x4.default.errors}`);function d(){e.forIn("key",s,y=>{!u.length&&!l.length?h(y):e.if(p(y),()=>h(y))})}function p(y){let b;if(u.length>8){let w=(0,ql.schemaRefOrVal)(i,n.properties,"properties");b=(0,Ll.isOwnProperty)(e,w,y)}else u.length?b=(0,Sr.or)(...u.map(w=>(0,Sr._)`${y} === ${w}`)):b=Sr.nil;return l.length&&(b=(0,Sr.or)(b,...l.map(w=>(0,Sr._)`${(0,Ll.usePattern)(t,w)}.test(${y})`))),(0,Sr.not)(b)}function g(y){e.code((0,Sr._)`delete ${s}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){g(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ql.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(m(y,b,!1),e.if((0,Sr.not)(b),()=>{t.reset(),g(y)})):(m(y,b),a||e.if((0,Sr.not)(b),()=>e.break()))}}function m(y,b,w){let x={keyword:"additionalProperties",dataProp:y,dataPropType:ql.Type.Str};w===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,b)}}};ky.default=k4});var mT=S($y=>{"use strict";f();Object.defineProperty($y,"__esModule",{value:!0});var E4=qa(),pT=nr(),Ty=Se(),hT=Ey(),T4={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&&hT.default.code(new E4.KeywordCxt(o,hT.default,"additionalProperties"));let i=(0,pT.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,pT.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=T4});var vT=S(Iy=>{"use strict";f();Object.defineProperty(Iy,"__esModule",{value:!0});var gT=nr(),Zl=me(),yT=Se(),_T=Se(),$4={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,gT.allSchemaProperties)(r),c=a.filter(m=>(0,yT.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 Zl.Name)&&(o.props=(0,_T.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 y in u)new RegExp(m).test(y)&&(0,yT.checkStrictMode)(o,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){e.forIn("key",n,y=>{e.if((0,Zl._)`${(0,gT.usePattern)(t,m)}.test(${y})`,()=>{let b=c.includes(m);b||t.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:_T.Type.Str},l),o.opts.unevaluated&&d!==!0?e.assign((0,Zl._)`${d}[${y}]`,!0):!b&&!o.allErrors&&e.if((0,Zl.not)(l),()=>e.break())})})}}};Iy.default=$4});var bT=S(Py=>{"use strict";f();Object.defineProperty(Py,"__esModule",{value:!0});var I4=Se(),P4={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,I4.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=P4});var wT=S(Oy=>{"use strict";f();Object.defineProperty(Oy,"__esModule",{value:!0});var O4=nr(),C4={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:O4.validateUnion,error:{message:"must match a schema in anyOf"}};Oy.default=C4});var xT=S(Cy=>{"use strict";f();Object.defineProperty(Cy,"__esModule",{value:!0});var Dl=me(),N4=Se(),A4={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Dl._)`{passingSchemas: ${t.passing}}`},R4={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:A4,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,N4.alwaysValidSchema)(s,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Dl._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Dl._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Dl.Name)})})}}};Cy.default=R4});var ST=S(Ny=>{"use strict";f();Object.defineProperty(Ny,"__esModule",{value:!0});var j4=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,j4.alwaysValidSchema)(n,o))return;let a=t.subschema({keyword:"allOf",schemaProp:i},s);t.ok(s),t.mergeEvaluated(a)})}};Ny.default=z4});var TT=S(Ay=>{"use strict";f();Object.defineProperty(Ay,"__esModule",{value:!0});var Fl=me(),ET=Se(),M4={message:({params:t})=>(0,Fl.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Fl._)`{failingKeyword: ${t.ifClause}}`},L4={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:M4,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ET.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let s=kT(n,"then"),o=kT(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,Fl.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,Fl._)`${l}`):t.setParams({ifClause:l})}}}};function kT(t,e){let r=t.schema[e];return r!==void 0&&!(0,ET.alwaysValidSchema)(t,r)}Ay.default=L4});var $T=S(Ry=>{"use strict";f();Object.defineProperty(Ry,"__esModule",{value:!0});var q4=Se(),Z4={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,q4.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ry.default=Z4});var IT=S(jy=>{"use strict";f();Object.defineProperty(jy,"__esModule",{value:!0});var D4=yy(),F4=sT(),U4=_y(),V4=iT(),B4=aT(),H4=lT(),K4=fT(),G4=Ey(),J4=mT(),W4=vT(),Y4=bT(),X4=wT(),Q4=xT(),e9=ST(),t9=TT(),r9=$T();function n9(t=!1){let e=[Y4.default,X4.default,Q4.default,e9.default,t9.default,r9.default,K4.default,G4.default,H4.default,J4.default,W4.default];return t?e.push(F4.default,V4.default):e.push(D4.default,U4.default),e.push(B4.default),e}jy.default=n9});var PT=S(zy=>{"use strict";f();Object.defineProperty(zy,"__esModule",{value:!0});var st=me(),s9={message:({schemaCode:t})=>(0,st.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,st._)`{format: ${t}}`},o9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:s9,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}]`),y=r.let("fType"),b=r.let("format");r.if((0,st._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,(0,st._)`${m}.type || "string"`).assign(b,(0,st._)`${m}.validate`),()=>r.assign(y,(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 && ${y} === ${e} && !${P}`}}function g(){let h=d.formats[o];if(!h){w();return}if(h===!0)return;let[m,y,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 y=="function"?(0,st._)`${b}(${n})`:(0,st._)`${b}.test(${n})`}}}};zy.default=o9});var OT=S(My=>{"use strict";f();Object.defineProperty(My,"__esModule",{value:!0});var i9=PT(),a9=[i9.default];My.default=a9});var CT=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 AT=S(Ly=>{"use strict";f();Object.defineProperty(Ly,"__esModule",{value:!0});var c9=ZE(),u9=eT(),l9=IT(),d9=OT(),NT=CT(),f9=[c9.default,u9.default,(0,l9.default)(),d9.default,NT.metadataVocabulary,NT.contentVocabulary];Ly.default=f9});var jT=S(Ul=>{"use strict";f();Object.defineProperty(Ul,"__esModule",{value:!0});Ul.DiscrError=void 0;var RT;(function(t){t.Tag="tag",t.Mapping="mapping"})(RT||(Ul.DiscrError=RT={}))});var MT=S(Zy=>{"use strict";f();Object.defineProperty(Zy,"__esModule",{value:!0});var ci=me(),qy=jT(),zT=El(),p9=Za(),h9=Se(),m9={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}}`},g9={keyword:"discriminator",type:"object",schemaType:"object",error:m9,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),y=!0;for(let T=0;T<i.length;T++){let P=i[T];if(P?.$ref&&!(0,h9.schemaHasRulesButRef)(P,o.self.RULES)){let U=P.$ref;if(P=zT.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,U),P instanceof zT.SchemaEnv&&(P=P.schema),P===void 0)throw new p9.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}"`);y=y&&(m||b(P)),w(L,T)}if(!y)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=g9});var LT=S((ule,y9)=>{y9.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=RE(),v9=AT(),b9=MT(),qT=LT(),w9=["/properties"],Vl="http://json-schema.org/draft-07/schema",ui=class extends _9.default{_addVocabularies(){super._addVocabularies(),v9.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(b9.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(qT,w9):qT;this.addMetaSchema(e,Vl,!1),this.refs["http://json-schema.org/schema"]=Vl}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Vl)?Vl:void 0)}};Be.Ajv=ui;Dy.exports=Be=ui;Dy.exports.Ajv=ui;Object.defineProperty(Be,"__esModule",{value:!0});Be.default=ui;var x9=qa();Object.defineProperty(Be,"KeywordCxt",{enumerable:!0,get:function(){return x9.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 S9=Sl();Object.defineProperty(Be,"ValidationError",{enumerable:!0,get:function(){return S9.default}});var k9=Za();Object.defineProperty(Be,"MissingRefError",{enumerable:!0,get:function(){return k9.default}})});var KT=S(Fr=>{"use strict";f();Object.defineProperty(Fr,"__esModule",{value:!0});Fr.formatNames=Fr.fastFormats=Fr.fullFormats=void 0;function Dr(t,e){return{validate:t,compare:e}}Fr.fullFormats={date:Dr(UT,Hy),time:Dr(Vy(!0),Ky),"date-time":Dr(ZT(!0),BT),"iso-time":Dr(Vy(),VT),"iso-date-time":Dr(ZT(),HT),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:O9,"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:M9,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:C9,int32:{type:"number",validate:R9},int64:{type:"number",validate:j9},float:{type:"number",validate:FT},double:{type:"number",validate:FT},password:!0,binary:!0};Fr.fastFormats={...Fr.fullFormats,date:Dr(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Hy),time:Dr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ky),"date-time":Dr(/^\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,BT),"iso-time":Dr(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,VT),"iso-date-time":Dr(/^\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,HT),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};Fr.formatNames=Object.keys(Fr.fullFormats);function E9(t){return t%4===0&&(t%100!==0||t%400===0)}var T9=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,$9=[0,31,28,31,30,31,30,31,31,30,31,30,31];function UT(t){let e=T9.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&&E9(r)?29:$9[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 VT(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 ZT(t){let e=Vy(t);return function(n){let s=n.split(By);return s.length===2&&UT(s[0])&&e(s[1])}}function BT(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function HT(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 I9=/\/|:/,P9=/^(?:[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 O9(t){return I9.test(t)&&P9.test(t)}var DT=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function C9(t){return DT.lastIndex=0,DT.test(t)}var N9=-(2**31),A9=2**31-1;function R9(t){return Number.isInteger(t)&&t<=A9&&t>=N9}function j9(t){return Number.isInteger(t)}function FT(){return!0}var z9=/[^\\]\\Z/;function M9(t){if(z9.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var GT=S(di=>{"use strict";f();Object.defineProperty(di,"__esModule",{value:!0});di.formatLimitDefinition=void 0;var L9=Fy(),kr=me(),qn=kr.operators,Bl={formatMaximum:{okStr:"<=",ok:qn.LTE,fail:qn.GT},formatMinimum:{okStr:">=",ok:qn.GTE,fail:qn.LT},formatExclusiveMaximum:{okStr:"<",ok:qn.LT,fail:qn.GTE},formatExclusiveMinimum:{okStr:">",ok:qn.GT,fail:qn.LTE}},q9={message:({keyword:t,schemaCode:e})=>(0,kr.str)`should be ${Bl[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,kr._)`{comparison: ${Bl[t].okStr}, limit: ${e}}`};di.formatLimitDefinition={keyword:Object.keys(Bl),type:"string",schemaType:"string",$data:!0,error:q9,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 L9.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,kr._)`${p}[${c.schemaCode}]`);t.fail$data((0,kr.or)((0,kr._)`typeof ${g} != "object"`,(0,kr._)`${g} instanceof RegExp`,(0,kr._)`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,kr._)`${i.code.formats}${(0,kr.getProperty)(p)}`:void 0});t.fail$data(d(h))}function d(p){return(0,kr._)`${p}.compare(${r}, ${n}) ${Bl[s].fail} 0`}},dependencies:["format"]};var Z9=t=>(t.addKeyword(di.formatLimitDefinition),t);di.default=Z9});var XT=S((ec,YT)=>{"use strict";f();Object.defineProperty(ec,"__esModule",{value:!0});var fi=KT(),D9=GT(),Gy=me(),JT=new Gy.Name("fullFormats"),F9=new Gy.Name("fastFormats"),Jy=(t,e={keywords:!0})=>{if(Array.isArray(e))return WT(t,e,fi.fullFormats,JT),t;let[r,n]=e.mode==="fast"?[fi.fastFormats,F9]:[fi.fullFormats,JT],s=e.formats||fi.formatNames;return WT(t,s,r,n),e.keywords&&(0,D9.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 WT(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])}YT.exports=ec=Jy;Object.defineProperty(ec,"__esModule",{value:!0});ec.default=Jy});var rc=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 l$;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(l$||(De.objectUtil=l$={}));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 J9=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=J9});var Wl=S(Dn=>{"use strict";f();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.ZodError=Dn.quotelessJson=Dn.ZodIssueCode=void 0;var d$=rc();Dn.ZodIssueCode=d$.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 W9=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");Dn.quotelessJson=W9;var nc=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,d$.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()}};Dn.ZodError=nc;nc.create=t=>new nc(t)});var t_=S(e_=>{"use strict";f();Object.defineProperty(e_,"__esModule",{value:!0});var kt=Wl(),Us=rc(),Y9=(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=Y9});var Yl=S(Fn=>{"use strict";f();var X9=Fn&&Fn.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.defaultErrorMap=void 0;Fn.setErrorMap=Q9;Fn.getErrorMap=eV;var f$=X9(t_());Fn.defaultErrorMap=f$.default;var p$=f$.default;function Q9(t){p$=t}function eV(){return p$}});var n_=S(Re=>{"use strict";f();var tV=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=sV;var rV=Yl(),h$=tV(t_()),nV=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=nV;Re.EMPTY_PATH=[];function sV(t,e){let r=(0,rV.getErrorMap)(),n=(0,Re.makeIssue)({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===h$.default?void 0:h$.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 oV=t=>({status:"dirty",value:t});Re.DIRTY=oV;var iV=t=>({status:"valid",value:t});Re.OK=iV;var aV=t=>t.status==="aborted";Re.isAborted=aV;var cV=t=>t.status==="dirty";Re.isDirty=cV;var uV=t=>t.status==="valid";Re.isValid=uV;var lV=t=>typeof Promise<"u"&&t instanceof Promise;Re.isAsync=lV});var g$=S(m$=>{"use strict";f();Object.defineProperty(m$,"__esModule",{value:!0})});var _$=S(Xl=>{"use strict";f();Object.defineProperty(Xl,"__esModule",{value:!0});Xl.errorUtil=void 0;var y$;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(y$||(Xl.errorUtil=y$={}))});var O$=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=S$;k.custom=E$;var q=Wl(),Ql=Yl(),X=_$(),E=n_(),D=rc(),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}},v$=(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 v$(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 v$(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 Vr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return mn.create(this)}promise(){return Bn.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 sc({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 oc.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 dV=/^c[^\s-]{8,}$/i,fV=/^[0-9a-z]+$/,pV=/^[0-9A-HJKMNP-TV-Z]{26}$/i,hV=/^[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,mV=/^[a-z0-9_-]{21}$/i,gV=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yV=/^[-+]?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,vV="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",s_,bV=/^(?:(?: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])$/,wV=/^(?:(?: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])$/,xV=/^(([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]))$/,SV=/^(([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])$/,kV=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,EV=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w$="((\\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])))",TV=new RegExp(`^${w$}$`);function x$(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 $V(t){return new RegExp(`^${x$(t)}$`)}function S$(t){let e=`${w$}T${x$(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 IV(t,e){return!!((e==="v4"||!e)&&bV.test(t)||(e==="v6"||!e)&&xV.test(t))}function PV(t,e){if(!gV.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 OV(t,e){return!!((e==="v4"||!e)&&wV.test(t)||(e==="v6"||!e)&&SV.test(t))}var Un=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(vV,"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")hV.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")mV.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")dV.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")fV.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")pV.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"?S$(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"?TV.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"?$V(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"?yV.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"?IV(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"?PV(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"?OV(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"?kV.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"?EV.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=Un;Un.create=t=>new Un({checks:[],typeName:ie.ZodString,coerce:t?.coerce??!1,...ue(t)});function CV(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"?CV(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 Vn=class extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return(0,E.OK)(e.data)}};k.ZodAny=Vn;Vn.create=t=>new Vn({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 Er=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=Er;Er.create=t=>new Er({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 Vr?Vr.create(hi(t.unwrap())):t instanceof Ur?Ur.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 Er&&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 Er){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 k$(D.util.objectKeys(this.shape))}};k.ZodObject=Lt;Lt.create=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strip",catchall:Er.create(),typeName:ie.ZodObject,...ue(e)});Lt.strictCreate=(t,e)=>new Lt({shape:()=>t,unknownKeys:"strict",catchall:Er.create(),typeName:ie.ZodObject,...ue(e)});Lt.lazycreate=(t,e)=>new Lt({shape:t,unknownKeys:"strip",catchall:Er.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 Vr?[null,...pn(t.unwrap())]:t instanceof sc||t instanceof so?pn(t.unwrap()):t instanceof no?pn(t._def.innerType):[],ed=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=ed;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 Ur=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=Ur;Ur.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ur({items:t,typeName:ie.ZodTuple,rest:null,...ue(e)})};var td=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:Un.create(),valueType:e,typeName:ie.ZodRecord,...ue(r)})}};k.ZodRecord=td;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 rd=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,Ql.getErrorMap)(),Ql.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,Ql.getErrorMap)(),Ql.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 Bn){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:Ur.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||Ur.create([]).rest(hn.create()),returns:r||hn.create(),typeName:ie.ZodFunction,...ue(n)})}};k.ZodFunction=rd;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 k$(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=k$;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 Bn=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=Bn;Bn.create=(t,e)=>new Bn({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 Vr=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=Vr;Vr.create=(t,e)=>new Vr({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 sc=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=sc;var oc=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=oc;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 b$(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function E$(t,e={},r){return t?Vn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=b$(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=b$(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):Vn.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 NV=(t,e={message:`Input not instance of ${t.name}`})=>E$(r=>r instanceof t,e);k.instanceof=NV;var T$=Un.create;k.string=T$;var $$=Vs.create;k.number=$$;var AV=vi.create;k.nan=AV;var RV=Bs.create;k.bigint=RV;var I$=Hs.create;k.boolean=I$;var jV=Ks.create;k.date=jV;var zV=mi.create;k.symbol=zV;var MV=Gs.create;k.undefined=MV;var LV=Js.create;k.null=LV;var qV=Vn.create;k.any=qV;var ZV=hn.create;k.unknown=ZV;var DV=Er.create;k.never=DV;var FV=gi.create;k.void=FV;var UV=mn.create;k.array=UV;var VV=Lt.create;k.object=VV;var BV=Lt.strictCreate;k.strictObject=BV;var HV=Ws.create;k.union=HV;var KV=ed.create;k.discriminatedUnion=KV;var GV=Ys.create;k.intersection=GV;var JV=Ur.create;k.tuple=JV;var WV=td.create;k.record=WV;var YV=yi.create;k.map=YV;var XV=_i.create;k.set=XV;var QV=rd.create;k.function=QV;var eB=Xs.create;k.lazy=eB;var tB=Qs.create;k.literal=tB;var rB=eo.create;k.enum=rB;var nB=to.create;k.nativeEnum=nB;var sB=Bn.create;k.promise=sB;var P$=Gt.create;k.effect=P$;k.transformer=P$;var oB=ir.create;k.optional=oB;var iB=Vr.create;k.nullable=iB;var aB=Gt.createWithPreprocess;k.preprocess=aB;var cB=oc.create;k.pipeline=cB;var uB=()=>T$().optional();k.ostring=uB;var lB=()=>$$().optional();k.onumber=lB;var dB=()=>I$().optional();k.oboolean=dB;k.coerce={string:(t=>Un.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 fB=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)&&fB(e,t,r)};Object.defineProperty(cr,"__esModule",{value:!0});bi(Yl(),cr);bi(n_(),cr);bi(g$(),cr);bi(rc(),cr);bi(O$(),cr);bi(Wl(),cr)});var A$=S(qt=>{"use strict";f();var C$=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]})),pB=qt&&qt.__setModuleDefault||(Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e}),hB=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)&&C$(e,t,r);return pB(e,t),e},mB=qt&&qt.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&C$(e,t,r)};Object.defineProperty(qt,"__esModule",{value:!0});qt.z=void 0;var N$=hB(i_());qt.z=N$;mB(i_(),qt);qt.default=N$});var wi=S(nd=>{"use strict";f();Object.defineProperty(nd,"__esModule",{value:!0});nd.config=void 0;var oo=A$(),gB=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 yB(){let t=gB.safeParse(process.env);return t.success||(console.error("\u274C Invalid environment configuration:"),console.error(t.error.format()),process.exit(1)),t.data}nd.config=yB()});var od=S(sd=>{"use strict";f();Object.defineProperty(sd,"__esModule",{value:!0});sd.ErrorCode=void 0;sd.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 id=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=od(),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=vB;var _B=id();function vB(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((Ide,z$)=>{"use strict";f();var ic=t=>t&&typeof t.message=="string",__=t=>{if(!t)return;let e=t.cause;if(typeof e=="function"){let r=t.cause();return ic(r)?r:void 0}else return ic(e)?e:void 0},R$=(t,e)=>{if(!ic(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: `+R$(n,e)):r},bB=t=>R$(t,new Set),j$=(t,e,r)=>{if(!ic(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?"":": ")+j$(s,e,o)}else return n},wB=t=>j$(t,new Set);z$.exports={isErrorLike:ic,getErrorCause:__,stackWithCauses:bB,messageWithCauses:wB}});var b_=S((Pde,L$)=>{"use strict";f();var xB=Symbol("circular-ref-tag"),ad=Symbol("pino-raw-err-ref"),M$=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[ad]},set:function(t){this[ad]=t}}});Object.defineProperty(M$,ad,{writable:!0,value:{}});L$.exports={pinoErrProto:M$,pinoErrorSymbols:{seen:xB,rawSymbol:ad}}});var D$=S((Cde,Z$)=>{"use strict";f();Z$.exports=x_;var{messageWithCauses:SB,stackWithCauses:kB,isErrorLike:q$}=v_(),{pinoErrProto:EB,pinoErrorSymbols:TB}=b_(),{seen:w_}=TB,{toString:$B}=Object.prototype;function x_(t){if(!q$(t))return t;t[w_]=void 0;let e=Object.create(EB);e.type=$B.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=SB(t),e.stack=kB(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];q$(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 U$=S((Ade,F$)=>{"use strict";f();F$.exports=ud;var{isErrorLike:S_}=v_(),{pinoErrProto:IB,pinoErrorSymbols:PB}=b_(),{seen:cd}=PB,{toString:OB}=Object.prototype;function ud(t){if(!S_(t))return t;t[cd]=void 0;let e=Object.create(IB);e.type=OB.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=>ud(r))),S_(t.cause)&&!Object.prototype.hasOwnProperty.call(t.cause,cd)&&(e.cause=ud(t.cause));for(let r in t)if(e[r]===void 0){let n=t[r];S_(n)?Object.prototype.hasOwnProperty.call(n,cd)||(e[r]=ud(n)):e[r]=n}return delete t[cd],e.raw=t,e}});var K$=S((jde,H$)=>{"use strict";f();H$.exports={mapHttpRequest:CB,reqSerializer:B$};var k_=Symbol("pino-raw-req-ref"),V$=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(V$,k_,{writable:!0,value:{}});function B$(t){let e=t.info||t.socket,r=Object.create(V$);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 CB(t){return{req:B$(t)}}});var Y$=S((Mde,W$)=>{"use strict";f();W$.exports={mapHttpResponse:NB,resSerializer:J$};var E_=Symbol("pino-raw-res-ref"),G$=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(G$,E_,{writable:!0,value:{}});function J$(t){let e=Object.create(G$);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function NB(t){return{res:J$(t)}}});var $_=S((qde,X$)=>{"use strict";f();var T_=D$(),AB=U$(),ld=K$(),dd=Y$();X$.exports={err:T_,errWithCause:AB,mapHttpRequest:ld.mapHttpRequest,mapHttpResponse:dd.mapHttpResponse,req:ld.reqSerializer,res:dd.resSerializer,wrapErrorSerializer:function(e){return e===T_?e:function(n){return e(T_(n))}},wrapRequestSerializer:function(e){return e===ld.reqSerializer?e:function(n){return e(ld.reqSerializer(n))}},wrapResponseSerializer:function(e){return e===dd.resSerializer?e:function(n){return e(dd.resSerializer(n))}}}});var I_=S((Dde,Q$)=>{"use strict";f();function RB(t,e){return e}Q$.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=RB;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 oI=S((Ude,sI)=>{"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 eI(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 tI(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 rI(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 fd=Symbol("PATH_NOT_FOUND");function jB(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||r===null||!(n in r))return fd;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 MB(t,e,r,n=!1){for(let s of e){let o=eI(s);if(o.includes("*"))nI(t,o,r,s,n);else if(n)rI(t,o);else{let i=jB(t,o);if(i===fd)continue;let a=typeof r=="function"?r(i,o):r;tI(t,o,a)}}}function nI(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 LB(t,e,r,o,n,s)}function LB(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("*"))nI(l,a,typeof r=="function"?(g,h)=>{let m=[...c.slice(0,d),...h];return r(g,m)}:r,s,o);else if(o)rI(l,a);else{let p=typeof r=="function"?r(zB(l,a),[...c.slice(0,d),...a]):r;tI(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 qB(t){if(t.length===0)return null;let e=new Map;for(let r of t){let n=eI(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 ZB(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 DB(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 FB(t){if(!Array.isArray(t))throw new TypeError("paths must be an array");for(let e of t)DB(e)}function UB(t={}){let{paths:e=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:s=!0,remove:o=!1}=t;FB(e);let i=qB(e);return function(c){if(s&&(c===null||typeof c!="object")&&(c==null||typeof c!="object"))return n?n(c):c;let u=ZB(c,i),l=c,d=r;return typeof r=="function"&&(d=r),MB(u,e,d,o),n===!1?(u.restore=function(){return P_(l)},u):typeof n=="function"?n(u):JSON.stringify(u)}}sI.exports=UB});var xi=S((Bde,iI)=>{"use strict";f();var VB=Symbol("pino.setLevel"),BB=Symbol("pino.getLevel"),HB=Symbol("pino.levelVal"),KB=Symbol("pino.levelComp"),GB=Symbol("pino.useLevelLabels"),JB=Symbol("pino.useOnlyCustomLevels"),WB=Symbol("pino.mixin"),YB=Symbol("pino.lsCache"),XB=Symbol("pino.chindings"),QB=Symbol("pino.asJson"),eH=Symbol("pino.write"),tH=Symbol("pino.redactFmt"),rH=Symbol("pino.time"),nH=Symbol("pino.timeSliceIndex"),sH=Symbol("pino.stream"),oH=Symbol("pino.stringify"),iH=Symbol("pino.stringifySafe"),aH=Symbol("pino.stringifiers"),cH=Symbol("pino.end"),uH=Symbol("pino.formatOpts"),lH=Symbol("pino.messageKey"),dH=Symbol("pino.errorKey"),fH=Symbol("pino.nestedKey"),pH=Symbol("pino.nestedKeyStr"),hH=Symbol("pino.mixinMergeStrategy"),mH=Symbol("pino.msgPrefix"),gH=Symbol("pino.wildcardFirst"),yH=Symbol.for("pino.serializers"),_H=Symbol.for("pino.formatters"),vH=Symbol.for("pino.hooks"),bH=Symbol.for("pino.metadata");iI.exports={setLevelSym:VB,getLevelSym:BB,levelValSym:HB,levelCompSym:KB,useLevelLabelsSym:GB,mixinSym:WB,lsCacheSym:YB,chindingsSym:XB,asJsonSym:QB,writeSym:eH,serializersSym:yH,redactFmtSym:tH,timeSym:rH,timeSliceIndexSym:nH,streamSym:sH,stringifySym:oH,stringifySafeSym:iH,stringifiersSym:aH,endSym:cH,formatOptsSym:uH,messageKeySym:lH,errorKeySym:dH,nestedKeySym:fH,wildcardFirstSym:gH,needsMetadataGsym:bH,useOnlyCustomLevelsSym:JB,formattersSym:_H,hooksSym:vH,nestedKeyStrSym:pH,mixinMergeStrategySym:hH,msgPrefixSym:mH}});var C_=S((Kde,lI)=>{"use strict";f();var aI=oI(),{redactFmtSym:wH,wildcardFirstSym:pd}=xi(),O_=/[^.[\]]+|\[([^[\]]*?)\]/g,cI="[Redacted]",uI=!1;function xH(t,e){let{paths:r,censor:n,remove:s}=SH(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=pd),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!==pd&&c[p].length===0&&c[p].push(...c[pd]||[]),p===pd&&Object.keys(c).forEach(function(m){c[m]&&c[m].push(h)}),c[p].push(h),c},{}),i={[wH]:aI({paths:r,censor:n,serialize:e,strict:uI,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]=aI({paths:o[u],censor:l,serialize:e,strict:uI,remove:s})}return c},i)}function SH(t){if(Array.isArray(t))return t={paths:t,censor:cI},t;let{paths:e,censor:r=cI,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}}lI.exports=xH});var pI=S((Jde,fI)=>{"use strict";f();var kH=()=>"",EH=()=>`,"time":${Date.now()}`,TH=()=>`,"time":${Math.round(Date.now()/1e3)}`,$H=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,IH=1000000n,dI=1000000000n,PH=BigInt(Date.now())*IH,OH=process.hrtime.bigint(),CH=()=>{let t=process.hrtime.bigint()-OH,e=PH+t,r=e/dI,n=e%dI,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"`};fI.exports={nullTime:kH,epochTime:EH,unixTime:TH,isoTime:$H,isoTimeNano:CH}});var mI=S((Yde,hI)=>{"use strict";f();function NH(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}hI.exports=AH;function AH(t,e,r){var n=r&&r.stringify||NH,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((Qde,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 SI=S((tfe,xI)=>{"use strict";f();var He=Te("fs"),RH=Te("events"),jH=Te("util").inherits,gI=Te("path"),j_=A_(),zH=Te("assert"),hd=100,md=Buffer.allocUnsafe(0),MH=16*1024,yI="buffer",_I="utf8",[LH,qH]=(process.versions.node||"0.0").split(".").map(Number),ZH=LH>=22&&qH>=7;function vI(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(gI.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(gI.dirname(t),{recursive:!0},o=>{if(o)return r(o);He.open(t,n,s,r)}):He.open(t,n,s,r)}function Tr(t){if(!(this instanceof Tr))return new Tr(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||MH,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===yI)this._writingBuf=md,this.write=UH,this.flush=BH,this.flushSync=KH,this._actualWrite=JH,h=()=>He.writeSync(this.fd,this._writingBuf),m=()=>He.write(this.fd,this._writingBuf,this.release);else if(p===void 0||p===_I)this._writingBuf="",this.write=FH,this.flush=VH,this.flushSync=HH,this._actualWrite=GH,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 "${_I}" and "${yI}", but passed ${p}`);if(typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")vI(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=(y,b)=>{if(y){if((y.code==="EAGAIN"||y.code==="EBUSY")&&this.retryEAGAIN(y,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{j_(hd),this.release(void 0,0)}catch(T){this.release(T)}else setTimeout(m,hd);else this._writing=!1,this.emit("error",y);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,gd(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(DH,this)):this.emit("drain"))},this.on("newListener",function(y){y==="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 DH(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}jH(Tr,RH);function bI(t,e){return t.length===0?md:t.length===1?t[0]:Buffer.concat(t,e)}function FH(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 UH(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 wI(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 VH(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&&wI.call(this,t),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function BH(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&&wI.call(this,t),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}Tr.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)})}),vI(this.file,this)};Tr.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():gd(this)))};function HH(){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_(hd)}}try{He.fsyncSync(this.fd)}catch{}}function KH(){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=md);let t=md;for(;this._bufs.length||t.length;){t.length<=0&&(t=bI(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_(hd)}}}Tr.prototype.destroy=function(){this.destroyed||gd(this)};function GH(){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 JH(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:bI(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 ZH&&(this._writingBuf=Buffer.from(this._writingBuf)),He.write(this.fd,this._writingBuf,t)}function gd(t){if(t.fd===-1){t.once("ready",gd.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")}}Tr.SonicBoom=Tr;Tr.default=Tr;xI.exports=Tr});var z_=S((nfe,II)=>{"use strict";f();var $r={exit:[],beforeExit:[]},kI={exit:XH,beforeExit:QH},Si;function WH(){Si===void 0&&(Si=new FinalizationRegistry(e6))}function YH(t){$r[t].length>0||process.on(t,kI[t])}function EI(t){$r[t].length>0||(process.removeListener(t,kI[t]),$r.exit.length===0&&$r.beforeExit.length===0&&(Si=void 0))}function XH(){TI("exit")}function QH(){TI("beforeExit")}function TI(t){for(let e of $r[t]){let r=e.deref(),n=e.fn;r!==void 0&&n(r,t)}$r[t]=[]}function e6(t){for(let e of["exit","beforeExit"]){let r=$r[e].indexOf(t);$r[e].splice(r,r+1),EI(e)}}function $I(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");YH(t);let n=new WeakRef(e);n.fn=r,WH(),Si.register(e,n),$r[t].push(n)}function t6(t,e){$I("exit",t,e)}function r6(t,e){$I("beforeExit",t,e)}function n6(t){if(Si!==void 0){Si.unregister(t);for(let e of["exit","beforeExit"])$r[e]=$r[e].filter(r=>{let n=r.deref();return n&&n!==t}),EI(e)}}II.exports={register:t6,registerBeforeExit:r6,unregister:n6}});var PI=S((ofe,s6)=>{s6.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 CI=S((ife,OI)=>{"use strict";f();function o6(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 i6(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)}OI.exports={wait:o6,waitDiff:i6}});var AI=S((cfe,NI)=>{"use strict";f();NI.exports={WRITE_INDEX:4,READ_INDEX:8}});var LI=S((lfe,MI)=>{"use strict";f();var{version:a6}=PI(),{EventEmitter:c6}=Te("events"),{Worker:u6}=Te("worker_threads"),{join:l6}=Te("path"),{pathToFileURL:d6}=Te("url"),{wait:f6}=CI(),{WRITE_INDEX:Zt,READ_INDEX:Br}=AI(),p6=Te("buffer"),h6=Te("assert"),N=Symbol("kImpl"),m6=p6.constants.MAX_STRING_LENGTH,ac=class{constructor(e){this._value=e}deref(){return this._value}},_d=class{register(){}unregister(){}},g6=process.env.NODE_V8_COVERAGE?_d:global.FinalizationRegistry||_d,y6=process.env.NODE_V8_COVERAGE?ac:global.WeakRef||ac,RI=new g6(t=>{t.exited||t.terminate()});function _6(t,e){let{filename:r,workerData:n}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||l6(_,"lib","worker.js"),i=new u6(o,{...e.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:d6(r).href,dataBuf:t[N].dataBuf,stateBuf:t[N].stateBuf,workerData:{$context:{threadStreamVersion:a6},...n}}});return i.stream=new ac(t),i.on("message",v6),i.on("exit",zI),RI.register(t,i),i}function jI(t){h6(!t[N].sync),t[N].needDrain&&(t[N].needDrain=!1,t.emit("drain"))}function yd(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(jI,t);return}let n=t[N].buf.slice(0,r),s=Buffer.byteLength(n);s<=r?(t[N].buf=t[N].buf.slice(r),vd(t,n,yd.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[N].state,Br,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),vd(t,n,yd.bind(null,t))}})}else if(r===0){if(e===0&&t[N].buf.length===0)return;t.flush(()=>{Atomics.store(t[N].state,Br,0),Atomics.store(t[N].state,Zt,0),yd(t)})}else Hr(t,new Error("overwritten"))}function v6(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new y6(e),e.flush(()=>{e[N].ready=!0,e.emit("ready")});break;case"ERROR":Hr(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:Hr(e,new Error("this should not happen: "+t.code))}}function zI(t){let e=this.stream.deref();e!==void 0&&(RI.unregister(e),e.worker.exited=!0,e.worker.off("exit",zI),Hr(e,t!==0?new Error("the worker thread exited"):null))}var L_=class extends c6{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>=m6)try{M_(this),this[N].flushing=!0}catch(r){return Hr(this,r),!1}if(this[N].buf+=e,this[N].sync)try{return M_(this),!0}catch(r){return Hr(this,r),!1}return this[N].flushing||(this[N].flushing=!0,setImmediate(yd,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);f6(this[N].state,Br,r,1/0,(n,s)=>{if(n){Hr(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 Hr(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 vd(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,Br);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,Br,e,1e3),e=Atomics.load(t[N].state,Br),e===-2){Hr(t,new Error("end() failed"));return}if(++r===10){Hr(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[N].finished=!0,t.emit("finish")})}catch(e){Hr(t,e)}}}function M_(t){let e=()=>{t[N].ending?D_(t):t[N].needDrain&&process.nextTick(jI,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,Br,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),vd(t,s,e);else{for(Z_(t),Atomics.store(t[N].state,Br,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),vd(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,Br);if(n===-2)throw Error("_flushSync failed");if(n!==e)Atomics.wait(t[N].state,Br,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}MI.exports=L_});var V_=S((ffe,qI)=>{"use strict";f();var{createRequire:b6}=Te("module"),w6=I_(),{join:F_,isAbsolute:x6,sep:S6}=Te("path"),k6=A_(),U_=z_(),E6=LI();function T6(t){U_.register(t,I6),U_.registerBeforeExit(t,P6),t.on("close",function(){U_.unregister(t)})}function $6(t,e,r,n){let s=new E6({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&&T6(s)}function i(){s.closed||(s.flushSync(),k6(100),s.end())}return s}function I6(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function P6(t){t.flushSync()}function O6(t){let{pipeline:e,targets:r,levels:n,dedupe:s,worker:o={},caller:i=w6(),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_(_,"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_(_,"worker.js"),c.pipelines=[e.map(g=>({...g,target:p(g.target)}))]),n&&(c.levels=n),s&&(c.dedupe=s),c.pinoWillSendConfig=!0,$6(p(d),c,o,a);function p(g){if(g=l[g]||g,x6(g)||g.indexOf("file://")===0)return g;if(g==="pino/file")return F_(_,"..","file.js");let h;for(let m of u)try{let y=m==="node:repl"?process.cwd()+S6:m;h=b6(y).resolve(g);break}catch{continue}if(!h)throw new Error(`unable to determine transport target for "${g}"`);return h}}qI.exports=O6});var Sd=S((hfe,XI)=>{"use strict";f();var ZI=Te("diagnostics_channel"),DI=mI(),{mapHttpRequest:C6,mapHttpResponse:N6}=$_(),H_=SI(),FI=z_(),{lsCacheSym:A6,chindingsSym:HI,writeSym:UI,serializersSym:KI,formatOptsSym:VI,endSym:R6,stringifiersSym:GI,stringifySym:JI,stringifySafeSym:K_,wildcardFirstSym:WI,nestedKeySym:j6,formattersSym:YI,messageKeySym:z6,errorKeySym:M6,nestedKeyStrSym:L6,msgPrefixSym:bd}=xi(),{isMainThread:q6}=Te("worker_threads"),Z6=V_(),xd;typeof ZI.tracingChannel=="function"?xd=ZI.tracingChannel("pino_asJson"):xd={hasSubscribers:!1,traceSync(t,e,r,...n){return t.call(r,...n)}};function ki(){}function D6(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=C6(n):typeof n.setHeader=="function"&&(n=N6(n)));let i;o===null&&s.length===0?i=[null]:(o=s.shift(),i=s),typeof this[bd]=="string"&&o!==void 0&&o!==null&&(o=this[bd]+o),this[UI](n,DI(o,i,this[VI]),t)}else{let o=n===void 0?s.shift():n;typeof this[bd]=="string"&&o!==void 0&&o!==null&&(o=this[bd]+o),this[UI](null,DI(o,s,this[VI]),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 F6(t,e,r,n){if(xd.hasSubscribers===!1)return BI.call(this,t,e,r,n);let s={instance:this,arguments};return xd.traceSync(BI,s,this,t,e,r,n)}function BI(t,e,r,n){let s=this[JI],o=this[K_],i=this[GI],a=this[R6],c=this[HI],u=this[KI],l=this[YI],d=this[z6],p=this[M6],g=this[A6][r]+n;g=g+c;let h;l.log&&(t=l.log(t));let m=i[WI],y="";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);y+=","+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[j6]&&y?g+this[L6]+y.slice(1)+"}"+b+a:g+y+b+a}function U6(t,e){let r,n=t[HI],s=t[JI],o=t[K_],i=t[GI],a=i[WI],c=t[KI],u=t[YI].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 V6(t){return t.write!==t.constructor.prototype.write}function wd(t){let e=new H_(t);return e.on("error",r),!t.sync&&q6&&(FI.register(e,B6),e.on("close",function(){FI.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 B6(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function H6(t){return function(r,n,s={},o){if(typeof s=="string")o=wd({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=wd({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=Z6({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||(V6(process.stdout)?o=process.stdout:o=wd({fd:process.stdout.fd||1})),{opts:s,stream:o}}}function K6(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 G6(t,e,r){return{level:t,bindings:e,log:r}}function J6(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t===void 0?1:t}XI.exports={noop:ki,buildSafeSonicBoom:wd,asChindings:U6,asJson:F6,genLog:D6,createArgsNormalizer:H6,stringify:K6,buildFormatters:G6,normalizeDestFileDescriptor:J6}});var kd=S((gfe,QI)=>{"use strict";f();var W6={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Y6={ASC:"ASC",DESC:"DESC"};QI.exports={DEFAULT_LEVELS:W6,SORTING_ORDER:Y6}});var W_=S((_fe,nP)=>{"use strict";f();var{lsCacheSym:X6,levelValSym:G_,useOnlyCustomLevelsSym:Q6,streamSym:eK,formattersSym:tK,hooksSym:rK,levelCompSym:eP}=xi(),{noop:nK,genLog:io}=Sd(),{DEFAULT_LEVELS:Kr,SORTING_ORDER:tP}=kd(),rP={fatal:t=>{let e=io(Kr.fatal,t);return function(...r){let n=this[eK];if(e.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:t=>io(Kr.error,t),warn:t=>io(Kr.warn,t),info:t=>io(Kr.info,t),debug:t=>io(Kr.debug,t),trace:t=>io(Kr.trace,t)},J_=Object.keys(Kr).reduce((t,e)=>(t[Kr[e]]=e,t),{}),sK=Object.keys(J_).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function oK(t){let e=t[tK].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[X6]=n,t}function iK(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 aK(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[Q6],i=this[eP],a=this[rK].logMethod;for(let c in r){if(i(r[c],s)===!1){this[c]=nK;continue}this[c]=iK(c,o)?rP[c](a):io(r[c],a)}this.emit("level-change",t,s,e[n],n,this)}function cK(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function uK(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&this[eP](r,this[G_])}function lK(t,e,r){return t===tP.DESC?e<=r:e>=r}function dK(t){return typeof t=="string"?lK.bind(null,t):t}function fK(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:Kr,t);return{labels:n,values:s}}function pK(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:Kr,e);if(!(t in n))throw Error(`default level:${t} must be included in custom levels`)}function hK(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 mK(t){if(typeof t!="function"&&!(typeof t=="string"&&Object.values(tP).includes(t)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}nP.exports={initialLsCache:sK,genLsCache:oK,levelMethods:rP,getLevel:cK,setLevel:aK,isLevelEnabled:uK,mappings:fK,assertNoLevelCollisions:hK,assertDefaultLevelFound:pK,genLevelComparison:dK,assertLevelComparison:mK}});var Y_=S((bfe,sP)=>{"use strict";f();sP.exports={version:"9.14.0"}});var fP=S((Sfe,dP)=>{"use strict";f();var{EventEmitter:gK}=Te("events"),{lsCacheSym:yK,levelValSym:_K,setLevelSym:Td,getLevelSym:oP,chindingsSym:$d,parsedChindingsSym:vK,mixinSym:bK,asJsonSym:aP,writeSym:wK,mixinMergeStrategySym:xK,timeSym:SK,timeSliceIndexSym:kK,streamSym:cP,serializersSym:ao,formattersSym:cc,errorKeySym:EK,messageKeySym:TK,useOnlyCustomLevelsSym:$K,needsMetadataGsym:IK,redactFmtSym:PK,stringifySym:OK,formatOptsSym:CK,stringifiersSym:NK,msgPrefixSym:Q_,hooksSym:AK}=xi(),{getLevel:RK,setLevel:jK,isLevelEnabled:zK,mappings:MK,initialLsCache:LK,genLsCache:qK,assertNoLevelCollisions:ZK}=W_(),{asChindings:ev,asJson:DK,buildFormatters:X_,stringify:iP,noop:uP}=Sd(),{version:FK}=Y_(),UK=C_(),VK=class{},lP={constructor:VK,child:BK,bindings:HK,setBindings:KK,flush:WK,isLevelEnabled:zK,version:FK,get level(){return this[oP]()},set level(t){this[Td](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"},[yK]:LK,[wK]:JK,[aP]:DK,[oP]:RK,[Td]:jK};Object.setPrototypeOf(lP,gK.prototype);dP.exports=function(){return Object.create(lP)};var Ed=t=>t;function BK(t,e){if(!t)throw Error("missing bindings for child Pino");let r=this[ao],n=this[cc],s=Object.create(this);if(e==null)return s[cc].bindings!==Ed&&(s[cc]=X_(n.level,Ed,n.log)),s[$d]=ev(s,t),s[Td](this.level),this.onChild!==uP&&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[cc]=X_(c||n.level,u||Ed,l||n.log)}else s[cc]=X_(n.level,Ed,n.log);if(e.hasOwnProperty("customLevels")===!0&&(ZK(this.levels,e.customLevels),s.levels=MK(e.customLevels,s[$K]),qK(s)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){s.redact=e.redact;let c=UK(s.redact,iP),u={stringify:c[PK]};s[OK]=iP,s[NK]=c,s[CK]=u}typeof e.msgPrefix=="string"&&(s[Q_]=(this[Q_]||"")+e.msgPrefix),s[$d]=ev(s,t);let a=e.level||this.level;return s[Td](a),this.onChild(s),s}function HK(){let e=`{${this[$d].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function KK(t){let e=ev(this,t);this[$d]=e,delete this[vK]}function GK(t,e){return Object.assign(e,t)}function JK(t,e,r){let n=this[SK](),s=this[bK],o=this[EK],i=this[TK],a=this[xK]||GK,c,u=this[AK].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[aP](c,e,r,n),d=this[cP];d[IK]===!0&&(d.lastLevel=r,d.lastObj=c,d.lastMsg=e,d.lastTime=n.slice(this[kK]),d.lastLogger=this),d.write(u?u(l):l)}function WK(t){if(t!=null&&typeof t!="function")throw Error("callback must be a function");let e=this[cP];typeof e.flush=="function"?e.flush(t||uP):t&&t()}});var gP=S((sv,mP)=>{"use strict";f();var{hasOwnProperty:uc}=Object.prototype,uo=nv();uo.configure=nv;uo.stringify=uo;uo.default=uo;sv.stringify=uo;sv.configure=nv;mP.exports=uo;var YK=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Hn(t){return t.length<5e3&&!YK.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 XK=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function rv(t){return XK.call(t)!==void 0&&t.length!==0}function pP(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 QK(t){if(uc.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 e3(t){let e;if(uc.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 t3(t,e){let r;if(uc.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 hP(t,e){let r;if(uc.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 r3(t){let e=new Set;for(let r of t)(typeof r=="string"||typeof r=="number")&&e.add(String(r));return e}function n3(t){if(uc.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=n3(t);e&&(t.bigint===void 0&&(t.bigint=!1),"circularValue"in t||(t.circularValue=Error));let r=QK(t),n=t3(t,"bigint"),s=e3(t),o=typeof s=="function"?s:void 0,i=hP(t,"maximumDepth"),a=hP(t,"maximumBreadth");function c(g,h,m,y,b,w){let x=h[g];switch(typeof x=="object"&&x!==null&&typeof x.toJSON=="function"&&(x=x.toJSON(g)),x=y.call(h,g,x),typeof x){case"string":return Hn(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+=`
11
+ caused by: `+R$(n,e)):r},bB=t=>R$(t,new Set),j$=(t,e,r)=>{if(!ic(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?"":": ")+j$(s,e,o)}else return n},wB=t=>j$(t,new Set);z$.exports={isErrorLike:ic,getErrorCause:__,stackWithCauses:bB,messageWithCauses:wB}});var b_=S((Ode,L$)=>{"use strict";f();var xB=Symbol("circular-ref-tag"),ad=Symbol("pino-raw-err-ref"),M$=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[ad]},set:function(t){this[ad]=t}}});Object.defineProperty(M$,ad,{writable:!0,value:{}});L$.exports={pinoErrProto:M$,pinoErrorSymbols:{seen:xB,rawSymbol:ad}}});var D$=S((Nde,Z$)=>{"use strict";f();Z$.exports=x_;var{messageWithCauses:SB,stackWithCauses:kB,isErrorLike:q$}=v_(),{pinoErrProto:EB,pinoErrorSymbols:TB}=b_(),{seen:w_}=TB,{toString:$B}=Object.prototype;function x_(t){if(!q$(t))return t;t[w_]=void 0;let e=Object.create(EB);e.type=$B.call(t.constructor)==="[object Function]"?t.constructor.name:t.name,e.message=SB(t),e.stack=kB(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];q$(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 U$=S((Rde,F$)=>{"use strict";f();F$.exports=ud;var{isErrorLike:S_}=v_(),{pinoErrProto:IB,pinoErrorSymbols:PB}=b_(),{seen:cd}=PB,{toString:OB}=Object.prototype;function ud(t){if(!S_(t))return t;t[cd]=void 0;let e=Object.create(IB);e.type=OB.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=>ud(r))),S_(t.cause)&&!Object.prototype.hasOwnProperty.call(t.cause,cd)&&(e.cause=ud(t.cause));for(let r in t)if(e[r]===void 0){let n=t[r];S_(n)?Object.prototype.hasOwnProperty.call(n,cd)||(e[r]=ud(n)):e[r]=n}return delete t[cd],e.raw=t,e}});var K$=S((zde,H$)=>{"use strict";f();H$.exports={mapHttpRequest:CB,reqSerializer:B$};var k_=Symbol("pino-raw-req-ref"),V$=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(V$,k_,{writable:!0,value:{}});function B$(t){let e=t.info||t.socket,r=Object.create(V$);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 CB(t){return{req:B$(t)}}});var Y$=S((Lde,W$)=>{"use strict";f();W$.exports={mapHttpResponse:NB,resSerializer:J$};var E_=Symbol("pino-raw-res-ref"),G$=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(G$,E_,{writable:!0,value:{}});function J$(t){let e=Object.create(G$);return e.statusCode=t.headersSent?t.statusCode:null,e.headers=t.getHeaders?t.getHeaders():t._headers,e.raw=t,e}function NB(t){return{res:J$(t)}}});var $_=S((Zde,X$)=>{"use strict";f();var T_=D$(),AB=U$(),ld=K$(),dd=Y$();X$.exports={err:T_,errWithCause:AB,mapHttpRequest:ld.mapHttpRequest,mapHttpResponse:dd.mapHttpResponse,req:ld.reqSerializer,res:dd.resSerializer,wrapErrorSerializer:function(e){return e===T_?e:function(n){return e(T_(n))}},wrapRequestSerializer:function(e){return e===ld.reqSerializer?e:function(n){return e(ld.reqSerializer(n))}},wrapResponseSerializer:function(e){return e===dd.resSerializer?e:function(n){return e(dd.resSerializer(n))}}}});var I_=S((Fde,Q$)=>{"use strict";f();function RB(t,e){return e}Q$.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=RB;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 oI=S((Vde,sI)=>{"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 eI(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 tI(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 rI(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 fd=Symbol("PATH_NOT_FOUND");function jB(t,e){let r=t;for(let n of e){if(r==null||typeof r!="object"||r===null||!(n in r))return fd;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 MB(t,e,r,n=!1){for(let s of e){let o=eI(s);if(o.includes("*"))nI(t,o,r,s,n);else if(n)rI(t,o);else{let i=jB(t,o);if(i===fd)continue;let a=typeof r=="function"?r(i,o):r;tI(t,o,a)}}}function nI(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 LB(t,e,r,o,n,s)}function LB(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("*"))nI(l,a,typeof r=="function"?(g,h)=>{let m=[...c.slice(0,d),...h];return r(g,m)}:r,s,o);else if(o)rI(l,a);else{let p=typeof r=="function"?r(zB(l,a),[...c.slice(0,d),...a]):r;tI(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 qB(t){if(t.length===0)return null;let e=new Map;for(let r of t){let n=eI(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 ZB(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 DB(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 FB(t){if(!Array.isArray(t))throw new TypeError("paths must be an array");for(let e of t)DB(e)}function UB(t={}){let{paths:e=[],censor:r="[REDACTED]",serialize:n=JSON.stringify,strict:s=!0,remove:o=!1}=t;FB(e);let i=qB(e);return function(c){if(s&&(c===null||typeof c!="object")&&(c==null||typeof c!="object"))return n?n(c):c;let u=ZB(c,i),l=c,d=r;return typeof r=="function"&&(d=r),MB(u,e,d,o),n===!1?(u.restore=function(){return P_(l)},u):typeof n=="function"?n(u):JSON.stringify(u)}}sI.exports=UB});var xi=S((Hde,iI)=>{"use strict";f();var VB=Symbol("pino.setLevel"),BB=Symbol("pino.getLevel"),HB=Symbol("pino.levelVal"),KB=Symbol("pino.levelComp"),GB=Symbol("pino.useLevelLabels"),JB=Symbol("pino.useOnlyCustomLevels"),WB=Symbol("pino.mixin"),YB=Symbol("pino.lsCache"),XB=Symbol("pino.chindings"),QB=Symbol("pino.asJson"),eH=Symbol("pino.write"),tH=Symbol("pino.redactFmt"),rH=Symbol("pino.time"),nH=Symbol("pino.timeSliceIndex"),sH=Symbol("pino.stream"),oH=Symbol("pino.stringify"),iH=Symbol("pino.stringifySafe"),aH=Symbol("pino.stringifiers"),cH=Symbol("pino.end"),uH=Symbol("pino.formatOpts"),lH=Symbol("pino.messageKey"),dH=Symbol("pino.errorKey"),fH=Symbol("pino.nestedKey"),pH=Symbol("pino.nestedKeyStr"),hH=Symbol("pino.mixinMergeStrategy"),mH=Symbol("pino.msgPrefix"),gH=Symbol("pino.wildcardFirst"),yH=Symbol.for("pino.serializers"),_H=Symbol.for("pino.formatters"),vH=Symbol.for("pino.hooks"),bH=Symbol.for("pino.metadata");iI.exports={setLevelSym:VB,getLevelSym:BB,levelValSym:HB,levelCompSym:KB,useLevelLabelsSym:GB,mixinSym:WB,lsCacheSym:YB,chindingsSym:XB,asJsonSym:QB,writeSym:eH,serializersSym:yH,redactFmtSym:tH,timeSym:rH,timeSliceIndexSym:nH,streamSym:sH,stringifySym:oH,stringifySafeSym:iH,stringifiersSym:aH,endSym:cH,formatOptsSym:uH,messageKeySym:lH,errorKeySym:dH,nestedKeySym:fH,wildcardFirstSym:gH,needsMetadataGsym:bH,useOnlyCustomLevelsSym:JB,formattersSym:_H,hooksSym:vH,nestedKeyStrSym:pH,mixinMergeStrategySym:hH,msgPrefixSym:mH}});var C_=S((Gde,lI)=>{"use strict";f();var aI=oI(),{redactFmtSym:wH,wildcardFirstSym:pd}=xi(),O_=/[^.[\]]+|\[([^[\]]*?)\]/g,cI="[Redacted]",uI=!1;function xH(t,e){let{paths:r,censor:n,remove:s}=SH(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=pd),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!==pd&&c[p].length===0&&c[p].push(...c[pd]||[]),p===pd&&Object.keys(c).forEach(function(m){c[m]&&c[m].push(h)}),c[p].push(h),c},{}),i={[wH]:aI({paths:r,censor:n,serialize:e,strict:uI,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]=aI({paths:o[u],censor:l,serialize:e,strict:uI,remove:s})}return c},i)}function SH(t){if(Array.isArray(t))return t={paths:t,censor:cI},t;let{paths:e,censor:r=cI,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}}lI.exports=xH});var pI=S((Wde,fI)=>{"use strict";f();var kH=()=>"",EH=()=>`,"time":${Date.now()}`,TH=()=>`,"time":${Math.round(Date.now()/1e3)}`,$H=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,IH=1000000n,dI=1000000000n,PH=BigInt(Date.now())*IH,OH=process.hrtime.bigint(),CH=()=>{let t=process.hrtime.bigint()-OH,e=PH+t,r=e/dI,n=e%dI,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"`};fI.exports={nullTime:kH,epochTime:EH,unixTime:TH,isoTime:$H,isoTimeNano:CH}});var mI=S((Xde,hI)=>{"use strict";f();function NH(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}hI.exports=AH;function AH(t,e,r){var n=r&&r.stringify||NH,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((efe,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 SI=S((rfe,xI)=>{"use strict";f();var He=Te("fs"),RH=Te("events"),jH=Te("util").inherits,gI=Te("path"),j_=A_(),zH=Te("assert"),hd=100,md=Buffer.allocUnsafe(0),MH=16*1024,yI="buffer",_I="utf8",[LH,qH]=(process.versions.node||"0.0").split(".").map(Number),ZH=LH>=22&&qH>=7;function vI(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(gI.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(gI.dirname(t),{recursive:!0},o=>{if(o)return r(o);He.open(t,n,s,r)}):He.open(t,n,s,r)}function Tr(t){if(!(this instanceof Tr))return new Tr(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||MH,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===yI)this._writingBuf=md,this.write=UH,this.flush=BH,this.flushSync=KH,this._actualWrite=JH,h=()=>He.writeSync(this.fd,this._writingBuf),m=()=>He.write(this.fd,this._writingBuf,this.release);else if(p===void 0||p===_I)this._writingBuf="",this.write=FH,this.flush=VH,this.flushSync=HH,this._actualWrite=GH,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 "${_I}" and "${yI}", but passed ${p}`);if(typeof e=="number")this.fd=e,process.nextTick(()=>this.emit("ready"));else if(typeof e=="string")vI(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=(y,b)=>{if(y){if((y.code==="EAGAIN"||y.code==="EBUSY")&&this.retryEAGAIN(y,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{j_(hd),this.release(void 0,0)}catch(T){this.release(T)}else setTimeout(m,hd);else this._writing=!1,this.emit("error",y);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,gd(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(DH,this)):this.emit("drain"))},this.on("newListener",function(y){y==="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 DH(t){t.listenerCount("drain")>0&&(t._asyncDrainScheduled=!1,t.emit("drain"))}jH(Tr,RH);function bI(t,e){return t.length===0?md:t.length===1?t[0]:Buffer.concat(t,e)}function FH(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 UH(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 wI(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 VH(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&&wI.call(this,t),!this._writing&&(this._bufs.length===0&&this._bufs.push(""),this._actualWrite())}function BH(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&&wI.call(this,t),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}Tr.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)})}),vI(this.file,this)};Tr.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():gd(this)))};function HH(){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_(hd)}}try{He.fsyncSync(this.fd)}catch{}}function KH(){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=md);let t=md;for(;this._bufs.length||t.length;){t.length<=0&&(t=bI(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_(hd)}}}Tr.prototype.destroy=function(){this.destroyed||gd(this)};function GH(){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 JH(){let t=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:bI(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 ZH&&(this._writingBuf=Buffer.from(this._writingBuf)),He.write(this.fd,this._writingBuf,t)}function gd(t){if(t.fd===-1){t.once("ready",gd.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")}}Tr.SonicBoom=Tr;Tr.default=Tr;xI.exports=Tr});var z_=S((sfe,II)=>{"use strict";f();var $r={exit:[],beforeExit:[]},kI={exit:XH,beforeExit:QH},Si;function WH(){Si===void 0&&(Si=new FinalizationRegistry(e6))}function YH(t){$r[t].length>0||process.on(t,kI[t])}function EI(t){$r[t].length>0||(process.removeListener(t,kI[t]),$r.exit.length===0&&$r.beforeExit.length===0&&(Si=void 0))}function XH(){TI("exit")}function QH(){TI("beforeExit")}function TI(t){for(let e of $r[t]){let r=e.deref(),n=e.fn;r!==void 0&&n(r,t)}$r[t]=[]}function e6(t){for(let e of["exit","beforeExit"]){let r=$r[e].indexOf(t);$r[e].splice(r,r+1),EI(e)}}function $I(t,e,r){if(e===void 0)throw new Error("the object can't be undefined");YH(t);let n=new WeakRef(e);n.fn=r,WH(),Si.register(e,n),$r[t].push(n)}function t6(t,e){$I("exit",t,e)}function r6(t,e){$I("beforeExit",t,e)}function n6(t){if(Si!==void 0){Si.unregister(t);for(let e of["exit","beforeExit"])$r[e]=$r[e].filter(r=>{let n=r.deref();return n&&n!==t}),EI(e)}}II.exports={register:t6,registerBeforeExit:r6,unregister:n6}});var PI=S((ife,s6)=>{s6.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 CI=S((afe,OI)=>{"use strict";f();function o6(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 i6(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)}OI.exports={wait:o6,waitDiff:i6}});var AI=S((ufe,NI)=>{"use strict";f();NI.exports={WRITE_INDEX:4,READ_INDEX:8}});var LI=S((dfe,MI)=>{"use strict";f();var{version:a6}=PI(),{EventEmitter:c6}=Te("events"),{Worker:u6}=Te("worker_threads"),{join:l6}=Te("path"),{pathToFileURL:d6}=Te("url"),{wait:f6}=CI(),{WRITE_INDEX:Zt,READ_INDEX:Br}=AI(),p6=Te("buffer"),h6=Te("assert"),N=Symbol("kImpl"),m6=p6.constants.MAX_STRING_LENGTH,ac=class{constructor(e){this._value=e}deref(){return this._value}},_d=class{register(){}unregister(){}},g6=process.env.NODE_V8_COVERAGE?_d:global.FinalizationRegistry||_d,y6=process.env.NODE_V8_COVERAGE?ac:global.WeakRef||ac,RI=new g6(t=>{t.exited||t.terminate()});function _6(t,e){let{filename:r,workerData:n}=e,o=("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||l6(_,"lib","worker.js"),i=new u6(o,{...e.workerOpts,trackUnmanagedFds:!1,workerData:{filename:r.indexOf("file://")===0?r:d6(r).href,dataBuf:t[N].dataBuf,stateBuf:t[N].stateBuf,workerData:{$context:{threadStreamVersion:a6},...n}}});return i.stream=new ac(t),i.on("message",v6),i.on("exit",zI),RI.register(t,i),i}function jI(t){h6(!t[N].sync),t[N].needDrain&&(t[N].needDrain=!1,t.emit("drain"))}function yd(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(jI,t);return}let n=t[N].buf.slice(0,r),s=Buffer.byteLength(n);s<=r?(t[N].buf=t[N].buf.slice(r),vd(t,n,yd.bind(null,t))):t.flush(()=>{if(!t.destroyed){for(Atomics.store(t[N].state,Br,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),vd(t,n,yd.bind(null,t))}})}else if(r===0){if(e===0&&t[N].buf.length===0)return;t.flush(()=>{Atomics.store(t[N].state,Br,0),Atomics.store(t[N].state,Zt,0),yd(t)})}else Hr(t,new Error("overwritten"))}function v6(t){let e=this.stream.deref();if(e===void 0){this.exited=!0,this.terminate();return}switch(t.code){case"READY":this.stream=new y6(e),e.flush(()=>{e[N].ready=!0,e.emit("ready")});break;case"ERROR":Hr(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:Hr(e,new Error("this should not happen: "+t.code))}}function zI(t){let e=this.stream.deref();e!==void 0&&(RI.unregister(e),e.worker.exited=!0,e.worker.off("exit",zI),Hr(e,t!==0?new Error("the worker thread exited"):null))}var L_=class extends c6{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>=m6)try{M_(this),this[N].flushing=!0}catch(r){return Hr(this,r),!1}if(this[N].buf+=e,this[N].sync)try{return M_(this),!0}catch(r){return Hr(this,r),!1}return this[N].flushing||(this[N].flushing=!0,setImmediate(yd,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);f6(this[N].state,Br,r,1/0,(n,s)=>{if(n){Hr(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 Hr(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 vd(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,Br);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,Br,e,1e3),e=Atomics.load(t[N].state,Br),e===-2){Hr(t,new Error("end() failed"));return}if(++r===10){Hr(t,new Error("end() took too long (10s)"));return}}process.nextTick(()=>{t[N].finished=!0,t.emit("finish")})}catch(e){Hr(t,e)}}}function M_(t){let e=()=>{t[N].ending?D_(t):t[N].needDrain&&process.nextTick(jI,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,Br,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),vd(t,s,e);else{for(Z_(t),Atomics.store(t[N].state,Br,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),vd(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,Br);if(n===-2)throw Error("_flushSync failed");if(n!==e)Atomics.wait(t[N].state,Br,n,1e3);else break;if(++r===10)throw new Error("_flushSync took too long (10s)")}}MI.exports=L_});var V_=S((pfe,qI)=>{"use strict";f();var{createRequire:b6}=Te("module"),w6=I_(),{join:F_,isAbsolute:x6,sep:S6}=Te("path"),k6=A_(),U_=z_(),E6=LI();function T6(t){U_.register(t,I6),U_.registerBeforeExit(t,P6),t.on("close",function(){U_.unregister(t)})}function $6(t,e,r,n){let s=new E6({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&&T6(s)}function i(){s.closed||(s.flushSync(),k6(100),s.end())}return s}function I6(t){t.ref(),t.flushSync(),t.end(),t.once("close",function(){t.unref()})}function P6(t){t.flushSync()}function O6(t){let{pipeline:e,targets:r,levels:n,dedupe:s,worker:o={},caller:i=w6(),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_(_,"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_(_,"worker.js"),c.pipelines=[e.map(g=>({...g,target:p(g.target)}))]),n&&(c.levels=n),s&&(c.dedupe=s),c.pinoWillSendConfig=!0,$6(p(d),c,o,a);function p(g){if(g=l[g]||g,x6(g)||g.indexOf("file://")===0)return g;if(g==="pino/file")return F_(_,"..","file.js");let h;for(let m of u)try{let y=m==="node:repl"?process.cwd()+S6:m;h=b6(y).resolve(g);break}catch{continue}if(!h)throw new Error(`unable to determine transport target for "${g}"`);return h}}qI.exports=O6});var Sd=S((mfe,XI)=>{"use strict";f();var ZI=Te("diagnostics_channel"),DI=mI(),{mapHttpRequest:C6,mapHttpResponse:N6}=$_(),H_=SI(),FI=z_(),{lsCacheSym:A6,chindingsSym:HI,writeSym:UI,serializersSym:KI,formatOptsSym:VI,endSym:R6,stringifiersSym:GI,stringifySym:JI,stringifySafeSym:K_,wildcardFirstSym:WI,nestedKeySym:j6,formattersSym:YI,messageKeySym:z6,errorKeySym:M6,nestedKeyStrSym:L6,msgPrefixSym:bd}=xi(),{isMainThread:q6}=Te("worker_threads"),Z6=V_(),xd;typeof ZI.tracingChannel=="function"?xd=ZI.tracingChannel("pino_asJson"):xd={hasSubscribers:!1,traceSync(t,e,r,...n){return t.call(r,...n)}};function ki(){}function D6(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=C6(n):typeof n.setHeader=="function"&&(n=N6(n)));let i;o===null&&s.length===0?i=[null]:(o=s.shift(),i=s),typeof this[bd]=="string"&&o!==void 0&&o!==null&&(o=this[bd]+o),this[UI](n,DI(o,i,this[VI]),t)}else{let o=n===void 0?s.shift():n;typeof this[bd]=="string"&&o!==void 0&&o!==null&&(o=this[bd]+o),this[UI](null,DI(o,s,this[VI]),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 F6(t,e,r,n){if(xd.hasSubscribers===!1)return BI.call(this,t,e,r,n);let s={instance:this,arguments};return xd.traceSync(BI,s,this,t,e,r,n)}function BI(t,e,r,n){let s=this[JI],o=this[K_],i=this[GI],a=this[R6],c=this[HI],u=this[KI],l=this[YI],d=this[z6],p=this[M6],g=this[A6][r]+n;g=g+c;let h;l.log&&(t=l.log(t));let m=i[WI],y="";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);y+=","+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[j6]&&y?g+this[L6]+y.slice(1)+"}"+b+a:g+y+b+a}function U6(t,e){let r,n=t[HI],s=t[JI],o=t[K_],i=t[GI],a=i[WI],c=t[KI],u=t[YI].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 V6(t){return t.write!==t.constructor.prototype.write}function wd(t){let e=new H_(t);return e.on("error",r),!t.sync&&q6&&(FI.register(e,B6),e.on("close",function(){FI.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 B6(t,e){t.destroyed||(e==="beforeExit"?(t.flush(),t.on("drain",function(){t.end()})):t.flushSync())}function H6(t){return function(r,n,s={},o){if(typeof s=="string")o=wd({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=wd({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=Z6({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||(V6(process.stdout)?o=process.stdout:o=wd({fd:process.stdout.fd||1})),{opts:s,stream:o}}}function K6(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 G6(t,e,r){return{level:t,bindings:e,log:r}}function J6(t){let e=Number(t);return typeof t=="string"&&Number.isFinite(e)?e:t===void 0?1:t}XI.exports={noop:ki,buildSafeSonicBoom:wd,asChindings:U6,asJson:F6,genLog:D6,createArgsNormalizer:H6,stringify:K6,buildFormatters:G6,normalizeDestFileDescriptor:J6}});var kd=S((yfe,QI)=>{"use strict";f();var W6={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},Y6={ASC:"ASC",DESC:"DESC"};QI.exports={DEFAULT_LEVELS:W6,SORTING_ORDER:Y6}});var W_=S((vfe,nP)=>{"use strict";f();var{lsCacheSym:X6,levelValSym:G_,useOnlyCustomLevelsSym:Q6,streamSym:eK,formattersSym:tK,hooksSym:rK,levelCompSym:eP}=xi(),{noop:nK,genLog:io}=Sd(),{DEFAULT_LEVELS:Kr,SORTING_ORDER:tP}=kd(),rP={fatal:t=>{let e=io(Kr.fatal,t);return function(...r){let n=this[eK];if(e.call(this,...r),typeof n.flushSync=="function")try{n.flushSync()}catch{}}},error:t=>io(Kr.error,t),warn:t=>io(Kr.warn,t),info:t=>io(Kr.info,t),debug:t=>io(Kr.debug,t),trace:t=>io(Kr.trace,t)},J_=Object.keys(Kr).reduce((t,e)=>(t[Kr[e]]=e,t),{}),sK=Object.keys(J_).reduce((t,e)=>(t[e]='{"level":'+Number(e),t),{});function oK(t){let e=t[tK].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[X6]=n,t}function iK(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 aK(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[Q6],i=this[eP],a=this[rK].logMethod;for(let c in r){if(i(r[c],s)===!1){this[c]=nK;continue}this[c]=iK(c,o)?rP[c](a):io(r[c],a)}this.emit("level-change",t,s,e[n],n,this)}function cK(t){let{levels:e,levelVal:r}=this;return e&&e.labels?e.labels[r]:""}function uK(t){let{values:e}=this.levels,r=e[t];return r!==void 0&&this[eP](r,this[G_])}function lK(t,e,r){return t===tP.DESC?e<=r:e>=r}function dK(t){return typeof t=="string"?lK.bind(null,t):t}function fK(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:Kr,t);return{labels:n,values:s}}function pK(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:Kr,e);if(!(t in n))throw Error(`default level:${t} must be included in custom levels`)}function hK(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 mK(t){if(typeof t!="function"&&!(typeof t=="string"&&Object.values(tP).includes(t)))throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}nP.exports={initialLsCache:sK,genLsCache:oK,levelMethods:rP,getLevel:cK,setLevel:aK,isLevelEnabled:uK,mappings:fK,assertNoLevelCollisions:hK,assertDefaultLevelFound:pK,genLevelComparison:dK,assertLevelComparison:mK}});var Y_=S((wfe,sP)=>{"use strict";f();sP.exports={version:"9.14.0"}});var fP=S((kfe,dP)=>{"use strict";f();var{EventEmitter:gK}=Te("events"),{lsCacheSym:yK,levelValSym:_K,setLevelSym:Td,getLevelSym:oP,chindingsSym:$d,parsedChindingsSym:vK,mixinSym:bK,asJsonSym:aP,writeSym:wK,mixinMergeStrategySym:xK,timeSym:SK,timeSliceIndexSym:kK,streamSym:cP,serializersSym:ao,formattersSym:cc,errorKeySym:EK,messageKeySym:TK,useOnlyCustomLevelsSym:$K,needsMetadataGsym:IK,redactFmtSym:PK,stringifySym:OK,formatOptsSym:CK,stringifiersSym:NK,msgPrefixSym:Q_,hooksSym:AK}=xi(),{getLevel:RK,setLevel:jK,isLevelEnabled:zK,mappings:MK,initialLsCache:LK,genLsCache:qK,assertNoLevelCollisions:ZK}=W_(),{asChindings:ev,asJson:DK,buildFormatters:X_,stringify:iP,noop:uP}=Sd(),{version:FK}=Y_(),UK=C_(),VK=class{},lP={constructor:VK,child:BK,bindings:HK,setBindings:KK,flush:WK,isLevelEnabled:zK,version:FK,get level(){return this[oP]()},set level(t){this[Td](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"},[yK]:LK,[wK]:JK,[aP]:DK,[oP]:RK,[Td]:jK};Object.setPrototypeOf(lP,gK.prototype);dP.exports=function(){return Object.create(lP)};var Ed=t=>t;function BK(t,e){if(!t)throw Error("missing bindings for child Pino");let r=this[ao],n=this[cc],s=Object.create(this);if(e==null)return s[cc].bindings!==Ed&&(s[cc]=X_(n.level,Ed,n.log)),s[$d]=ev(s,t),s[Td](this.level),this.onChild!==uP&&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[cc]=X_(c||n.level,u||Ed,l||n.log)}else s[cc]=X_(n.level,Ed,n.log);if(e.hasOwnProperty("customLevels")===!0&&(ZK(this.levels,e.customLevels),s.levels=MK(e.customLevels,s[$K]),qK(s)),typeof e.redact=="object"&&e.redact!==null||Array.isArray(e.redact)){s.redact=e.redact;let c=UK(s.redact,iP),u={stringify:c[PK]};s[OK]=iP,s[NK]=c,s[CK]=u}typeof e.msgPrefix=="string"&&(s[Q_]=(this[Q_]||"")+e.msgPrefix),s[$d]=ev(s,t);let a=e.level||this.level;return s[Td](a),this.onChild(s),s}function HK(){let e=`{${this[$d].substr(1)}}`,r=JSON.parse(e);return delete r.pid,delete r.hostname,r}function KK(t){let e=ev(this,t);this[$d]=e,delete this[vK]}function GK(t,e){return Object.assign(e,t)}function JK(t,e,r){let n=this[SK](),s=this[bK],o=this[EK],i=this[TK],a=this[xK]||GK,c,u=this[AK].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[aP](c,e,r,n),d=this[cP];d[IK]===!0&&(d.lastLevel=r,d.lastObj=c,d.lastMsg=e,d.lastTime=n.slice(this[kK]),d.lastLogger=this),d.write(u?u(l):l)}function WK(t){if(t!=null&&typeof t!="function")throw Error("callback must be a function");let e=this[cP];typeof e.flush=="function"?e.flush(t||uP):t&&t()}});var gP=S((sv,mP)=>{"use strict";f();var{hasOwnProperty:uc}=Object.prototype,uo=nv();uo.configure=nv;uo.stringify=uo;uo.default=uo;sv.stringify=uo;sv.configure=nv;mP.exports=uo;var YK=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function Hn(t){return t.length<5e3&&!YK.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 XK=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function rv(t){return XK.call(t)!==void 0&&t.length!==0}function pP(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 QK(t){if(uc.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 e3(t){let e;if(uc.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 t3(t,e){let r;if(uc.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 hP(t,e){let r;if(uc.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 r3(t){let e=new Set;for(let r of t)(typeof r=="string"||typeof r=="number")&&e.add(String(r));return e}function n3(t){if(uc.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=n3(t);e&&(t.bigint===void 0&&(t.bigint=!1),"circularValue"in t||(t.circularValue=Error));let r=QK(t),n=t3(t,"bigint"),s=e3(t),o=typeof s=="function"?s:void 0,i=hP(t,"maximumDepth"),a=hP(t,"maximumBreadth");function c(g,h,m,y,b,w){let x=h[g];switch(typeof x=="object"&&x!==null&&typeof x.toJSON=="function"&&(x=x.toJSON(g)),x=y.call(h,g,x),typeof x){case"string":return Hn(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
12
  ${w}`,P=`,
13
13
  ${w}`);let z=Math.min(x.length,a),V=0;for(;V<z-1;V++){let pe=c(String(V),x,m,y,b,w);T+=pe!==void 0?pe:"null",T+=P}let te=c(String(V),x,m,y,b,w);if(T+=te!==void 0?te:"null",x.length-1>a){let pe=x.length-a-1;T+=`${P}"... ${co(pe)} not stringified"`}return b!==""&&(T+=`
14
- ${L}`),m.pop(),`[${T}]`}let U=Object.keys(x),I=U.length;if(I===0)return"{}";if(i<m.length+1)return'"[Object]"';let A="",F="";b!==""&&(w+=b,P=`,
15
- ${w}`,A=" ");let C=Math.min(I,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,y,b,w);te!==void 0&&(T+=`${F}${Hn(V)}:${A}${te}`,F=P)}if(I>a){let z=I-a;T+=`${F}"...":${A}"${co(z)} not stringified"`,F=P}return b!==""&&F.length>1&&(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,P=`,
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,y,b,w);te!==void 0&&(T+=`${F}${Hn(V)}:${A}${te}`,F=P)}if($>a){let z=$-a;T+=`${F}"...":${A}"${co(z)} not stringified"`,F=P}return b!==""&&F.length>1&&(T=`
16
16
  ${w}${T}
17
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,y,b,w){switch(typeof h=="object"&&h!==null&&typeof h.toJSON=="function"&&(h=h.toJSON(g)),typeof h){case"string":return Hn(h);case"object":{if(h===null)return"null";if(m.indexOf(h)!==-1)return r;let x=w,T="",P=",";if(Array.isArray(h)){if(h.length===0)return"[]";if(i<m.length+1)return'"[Array]"';m.push(h),b!==""&&(w+=b,T+=`
18
18
  ${w}`,P=`,
19
- ${w}`);let I=Math.min(h.length,a),A=0;for(;A<I-1;A++){let C=u(String(A),h[A],m,y,b,w);T+=C!==void 0?C:"null",T+=P}let F=u(String(A),h[A],m,y,b,w);if(T+=F!==void 0?F:"null",h.length-1>a){let C=h.length-a-1;T+=`${P}"... ${co(C)} not stringified"`}return b!==""&&(T+=`
19
+ ${w}`);let $=Math.min(h.length,a),A=0;for(;A<$-1;A++){let C=u(String(A),h[A],m,y,b,w);T+=C!==void 0?C:"null",T+=P}let F=u(String(A),h[A],m,y,b,w);if(T+=F!==void 0?F:"null",h.length-1>a){let C=h.length-a-1;T+=`${P}"... ${co(C)} not stringified"`}return b!==""&&(T+=`
20
20
  ${x}`),m.pop(),`[${T}]`}m.push(h);let L="";b!==""&&(w+=b,P=`,
21
- ${w}`,L=" ");let U="";for(let I of y){let A=u(I,h[I],m,y,b,w);A!==void 0&&(T+=`${U}${Hn(I)}:${L}${A}`,U=P)}return b!==""&&U.length>1&&(T=`
21
+ ${w}`,L=" ");let U="";for(let $ of y){let A=u($,h[$],m,y,b,w);A!==void 0&&(T+=`${U}${Hn($)}:${L}${A}`,U=P)}return b!==""&&U.length>1&&(T=`
22
22
  ${w}${T}
23
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,y,b){switch(typeof h){case"string":return Hn(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,y,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+=y;let A=`
24
24
  ${b}`,F=`,
25
25
  ${b}`,C=Math.min(h.length,a),z=0;for(;z<C-1;z++){let te=l(String(z),h[z],m,y,b);A+=te!==void 0?te:"null",A+=F}let V=l(String(z),h[z],m,y,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
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+=y;let P=`,
27
- ${b}`,L="",U="",I=Math.min(T,a);rv(h)&&(L+=pP(h,P,a),x=x.slice(h.length),I-=h.length,U=P),s&&(x=tv(x,o)),m.push(h);for(let A=0;A<I;A++){let F=x[A],C=l(F,h[F],m,y,b);C!==void 0&&(L+=`${U}${Hn(F)}: ${C}`,U=P)}if(T>a){let A=T-a;L+=`${U}"...": "${co(A)} not stringified"`,U=P}return U!==""&&(L=`
27
+ ${b}`,L="",U="",$=Math.min(T,a);rv(h)&&(L+=pP(h,P,a),x=x.slice(h.length),$-=h.length,U=P),s&&(x=tv(x,o)),m.push(h);for(let A=0;A<$;A++){let F=x[A],C=l(F,h[F],m,y,b);C!==void 0&&(L+=`${U}${Hn(F)}: ${C}`,U=P)}if(T>a){let A=T-a;L+=`${U}"...": "${co(A)} not stringified"`,U=P}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 Hn(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 y="",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);y+=A!==void 0?A:"null",y+=","}let I=d(String(U),h[U],m);if(y+=I!==void 0?I:"null",h.length-1>a){let A=h.length-a-1;y+=`,"... ${co(A)} not stringified"`}return m.pop(),`[${y}]`}let w=Object.keys(h),x=w.length;if(x===0)return"{}";if(i<m.length+1)return'"[Object]"';let T="",P=Math.min(x,a);b&&rv(h)&&(y+=pP(h,",",a),w=w.slice(h.length),P-=h.length,T=","),s&&(w=tv(w,o)),m.push(h);for(let L=0;L<P;L++){let U=w[L],I=d(U,h[U],m);I!==void 0&&(y+=`${T}${Hn(U)}:${I}`,T=",")}if(x>a){let L=x-a;y+=`${T}"...":"${co(L)} not stringified"`}return m.pop(),`{${y}}`}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 y="";if(typeof m=="number"?y=" ".repeat(Math.min(m,10)):typeof m=="string"&&(y=m.slice(0,10)),h!=null){if(typeof h=="function")return c("",{"":g},[],h,y,"");if(Array.isArray(h))return u("",g,[],r3(h),y,"")}if(y.length!==0)return l("",g,[],y,"")}return d("",g,[])}return p}});var bP=S((Tfe,vP)=>{"use strict";f();var ov=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:_P}=kd(),s3=_P.info;function o3(t,e){t=t||[],e=e||{dedupe:!1};let r=Object.create(_P);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,y;for(let b=i3(h.length,e.dedupe);c3(b,h.length,e.dedupe);b=a3(b,e.dedupe))if(p=h[b],p.level<=g){if(m!==0&&m!==p.level)break;if(y=p.stream,y[ov]){let{lastTime:w,lastMsg:x,lastObj:T,lastLogger:P}=this;y.lastLevel=g,y.lastTime=w,y.lastMsg=x,y.lastObj=T,y.lastLogger=P}y.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,y;typeof d.levelVal=="number"?y=d.levelVal:typeof d.level=="string"?y=m[d.level]:typeof d.level=="number"?y=d.level:y=s3;let b={stream:g,level:y,levelVal:void 0,id:++n.lastId};return h.unshift(b),h.sort(yP),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(yP),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 yP(t,e){return t.level-e.level}function i3(t,e){return e?t-1:0}function a3(t,e){return e?t-1:t+1}function c3(t,e,r){return r?t>=0:t<e}vP.exports=o3});var RP=S((Ife,lr)=>{"use strict";f();var u3=Te("os"),IP=$_(),l3=I_(),d3=C_(),PP=pI(),f3=fP(),OP=xi(),{configure:p3}=gP(),{assertDefaultLevelFound:h3,mappings:CP,genLsCache:m3,genLevelComparison:g3,assertLevelComparison:y3}=W_(),{DEFAULT_LEVELS:NP,SORTING_ORDER:_3}=kd(),{createArgsNormalizer:v3,asChindings:b3,buildSafeSonicBoom:wP,buildFormatters:w3,stringify:iv,normalizeDestFileDescriptor:xP,noop:x3}=Sd(),{version:S3}=Y_(),{chindingsSym:SP,redactFmtSym:k3,serializersSym:kP,timeSym:E3,timeSliceIndexSym:T3,streamSym:$3,stringifySym:EP,stringifySafeSym:av,stringifiersSym:TP,setLevelSym:I3,endSym:P3,formatOptsSym:O3,messageKeySym:C3,errorKeySym:N3,nestedKeySym:A3,mixinSym:R3,levelCompSym:j3,useOnlyCustomLevelsSym:z3,formattersSym:$P,hooksSym:M3,nestedKeyStrSym:L3,mixinMergeStrategySym:q3,msgPrefixSym:Z3}=OP,{epochTime:AP,nullTime:D3}=PP,{pid:F3}=process,U3=u3.hostname(),V3=IP.err,B3={level:"info",levelComparison:_3.ASC,levels:NP,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:F3,hostname:U3},serializers:Object.assign(Object.create(null),{err:V3}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:AP,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},H3=v3(B3),K3=Object.assign(Object.create(null),IP);function cv(...t){let e={},{opts:r,stream:n}=H3(e,l3(),...t);r.level&&typeof r.level=="string"&&NP[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:y,mixinMergeStrategy:b,useOnlyCustomLevels:w,formatters:x,hooks:T,depthLimit:P,edgeLimit:L,onChild:U,msgPrefix:I}=r,A=p3({maximumDepth:P,maximumBreadth:L}),F=w3(x.level,x.bindings,x.log),C=iv.bind({[av]:A}),z=s?d3(s,C):{},V=s?{stringify:z[k3]}:{stringify:C},te="}"+(o?`\r
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 Hn(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 y="",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);y+=A!==void 0?A:"null",y+=","}let $=d(String(U),h[U],m);if(y+=$!==void 0?$:"null",h.length-1>a){let A=h.length-a-1;y+=`,"... ${co(A)} not stringified"`}return m.pop(),`[${y}]`}let w=Object.keys(h),x=w.length;if(x===0)return"{}";if(i<m.length+1)return'"[Object]"';let T="",P=Math.min(x,a);b&&rv(h)&&(y+=pP(h,",",a),w=w.slice(h.length),P-=h.length,T=","),s&&(w=tv(w,o)),m.push(h);for(let L=0;L<P;L++){let U=w[L],$=d(U,h[U],m);$!==void 0&&(y+=`${T}${Hn(U)}:${$}`,T=",")}if(x>a){let L=x-a;y+=`${T}"...":"${co(L)} not stringified"`}return m.pop(),`{${y}}`}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 y="";if(typeof m=="number"?y=" ".repeat(Math.min(m,10)):typeof m=="string"&&(y=m.slice(0,10)),h!=null){if(typeof h=="function")return c("",{"":g},[],h,y,"");if(Array.isArray(h))return u("",g,[],r3(h),y,"")}if(y.length!==0)return l("",g,[],y,"")}return d("",g,[])}return p}});var bP=S(($fe,vP)=>{"use strict";f();var ov=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:_P}=kd(),s3=_P.info;function o3(t,e){t=t||[],e=e||{dedupe:!1};let r=Object.create(_P);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,y;for(let b=i3(h.length,e.dedupe);c3(b,h.length,e.dedupe);b=a3(b,e.dedupe))if(p=h[b],p.level<=g){if(m!==0&&m!==p.level)break;if(y=p.stream,y[ov]){let{lastTime:w,lastMsg:x,lastObj:T,lastLogger:P}=this;y.lastLevel=g,y.lastTime=w,y.lastMsg=x,y.lastObj=T,y.lastLogger=P}y.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,y;typeof d.levelVal=="number"?y=d.levelVal:typeof d.level=="string"?y=m[d.level]:typeof d.level=="number"?y=d.level:y=s3;let b={stream:g,level:y,levelVal:void 0,id:++n.lastId};return h.unshift(b),h.sort(yP),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(yP),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 yP(t,e){return t.level-e.level}function i3(t,e){return e?t-1:0}function a3(t,e){return e?t-1:t+1}function c3(t,e,r){return r?t>=0:t<e}vP.exports=o3});var RP=S((Pfe,lr)=>{"use strict";f();var u3=Te("os"),IP=$_(),l3=I_(),d3=C_(),PP=pI(),f3=fP(),OP=xi(),{configure:p3}=gP(),{assertDefaultLevelFound:h3,mappings:CP,genLsCache:m3,genLevelComparison:g3,assertLevelComparison:y3}=W_(),{DEFAULT_LEVELS:NP,SORTING_ORDER:_3}=kd(),{createArgsNormalizer:v3,asChindings:b3,buildSafeSonicBoom:wP,buildFormatters:w3,stringify:iv,normalizeDestFileDescriptor:xP,noop:x3}=Sd(),{version:S3}=Y_(),{chindingsSym:SP,redactFmtSym:k3,serializersSym:kP,timeSym:E3,timeSliceIndexSym:T3,streamSym:$3,stringifySym:EP,stringifySafeSym:av,stringifiersSym:TP,setLevelSym:I3,endSym:P3,formatOptsSym:O3,messageKeySym:C3,errorKeySym:N3,nestedKeySym:A3,mixinSym:R3,levelCompSym:j3,useOnlyCustomLevelsSym:z3,formattersSym:$P,hooksSym:M3,nestedKeyStrSym:L3,mixinMergeStrategySym:q3,msgPrefixSym:Z3}=OP,{epochTime:AP,nullTime:D3}=PP,{pid:F3}=process,U3=u3.hostname(),V3=IP.err,B3={level:"info",levelComparison:_3.ASC,levels:NP,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:F3,hostname:U3},serializers:Object.assign(Object.create(null),{err:V3}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:AP,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},H3=v3(B3),K3=Object.assign(Object.create(null),IP);function cv(...t){let e={},{opts:r,stream:n}=H3(e,l3(),...t);r.level&&typeof r.level=="string"&&NP[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:y,mixinMergeStrategy:b,useOnlyCustomLevels:w,formatters:x,hooks:T,depthLimit:P,edgeLimit:L,onChild:U,msgPrefix:$}=r,A=p3({maximumDepth:P,maximumBreadth:L}),F=w3(x.level,x.bindings,x.log),C=iv.bind({[av]:A}),z=s?d3(s,C):{},V=s?{stringify:z[k3]}:{stringify:C},te="}"+(o?`\r
30
30
  `:`
31
- `),pe=b3.bind(null,{[SP]:"",[kP]:i,[TP]:z,[EP]:iv,[av]:A,[$P]:F}),ee="";d!==null&&(p===void 0?ee=pe(d):ee=pe(Object.assign({},d,{name:p})));let Ie=a instanceof Function?a:a?AP:D3,Fe=Ie().indexOf(":")+1;if(w&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(y&&typeof y!="function")throw Error(`Unknown mixin type "${typeof y}" - expected "function"`);if(I&&typeof I!="string")throw Error(`Unknown msgPrefix type "${typeof I}" - expected "string"`);h3(g,h,w);let Ae=CP(h,w);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:Ae,messageKey:c,errorKey:u}}),y3(m);let uu=g3(m);return Object.assign(e,{levels:Ae,[j3]:uu,[z3]:w,[$3]:n,[E3]:Ie,[T3]:Fe,[EP]:iv,[av]:A,[TP]:z,[P3]:te,[O3]:V,[C3]:c,[N3]:u,[A3]:l,[L3]:l?`,${JSON.stringify(l)}:{`:"",[kP]:i,[R3]:y,[q3]:b,[SP]:ee,[$P]:F,[M3]:T,silent:x3,onChild:U,[Z3]:I}),Object.setPrototypeOf(e,f3()),m3(e),e[I3](g),e}lr.exports=cv;lr.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=xP(t.dest||process.stdout.fd),wP(t)):wP({dest:xP(t),minLength:0});lr.exports.transport=V_();lr.exports.multistream=bP();lr.exports.levels=CP();lr.exports.stdSerializers=K3;lr.exports.stdTimeFunctions=Object.assign({},PP);lr.exports.symbols=OP;lr.exports.version=S3;lr.exports.default=cv;lr.exports.pino=cv});var LP=S(Ei=>{"use strict";f();var G3=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.createMcpLogger=MP;Ei.createLogger=MP;var jP=G3(RP()),zP=y_(),J3=["password","token","accessToken","access_token","refreshToken","refresh_token","apiKey","api_key","secret","TOOLPILOT_API_KEY","authorization","cookie","*.password","*.token","*.secret","*.apiKey","*.api_key"];function MP(t){let e=t.level??process.env.LOG_LEVEL??(process.env.NODE_ENV!=="production"?"debug":"info"),r={name:t.name,level:e,serializers:{err:zP.errorSerializer,error:zP.errorSerializer},redact:{paths:J3,censor:"[REDACTED]"},timestamp:jP.default.stdTimeFunctions.isoTime,base:{pid:process.pid,...t.defaultFields}};return(0,jP.default)(r,process.stderr)}});var qP=S(uv=>{"use strict";f();Object.defineProperty(uv,"__esModule",{value:!0});uv.withErrorHandling=X3;var W3=od(),Y3=id();function X3(t,e,r){return async n=>{try{return await r(n)}catch(s){if(s instanceof Y3.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:W3.ErrorCode.ERR_MCP_HANDLER,message:s instanceof Error?s.message:String(s)})}],isError:!0}}}}});var Ce=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 Q3=od();Object.defineProperty(Pe,"ErrorCode",{enumerable:!0,get:function(){return Q3.ErrorCode}});var Gr=id();Object.defineProperty(Pe,"AppError",{enumerable:!0,get:function(){return Gr.AppError}});Object.defineProperty(Pe,"DatabaseError",{enumerable:!0,get:function(){return Gr.DatabaseError}});Object.defineProperty(Pe,"NetworkError",{enumerable:!0,get:function(){return Gr.NetworkError}});Object.defineProperty(Pe,"ValidationError",{enumerable:!0,get:function(){return Gr.ValidationError}});Object.defineProperty(Pe,"AuthError",{enumerable:!0,get:function(){return Gr.AuthError}});Object.defineProperty(Pe,"ExternalServiceError",{enumerable:!0,get:function(){return Gr.ExternalServiceError}});Object.defineProperty(Pe,"QueueError",{enumerable:!0,get:function(){return Gr.QueueError}});Object.defineProperty(Pe,"SearchError",{enumerable:!0,get:function(){return Gr.SearchError}});Object.defineProperty(Pe,"IndexerError",{enumerable:!0,get:function(){return Gr.IndexerError}});Object.defineProperty(Pe,"VectorError",{enumerable:!0,get:function(){return Gr.VectorError}});var eG=y_();Object.defineProperty(Pe,"errorSerializer",{enumerable:!0,get:function(){return eG.errorSerializer}});var ZP=LP();Object.defineProperty(Pe,"createMcpLogger",{enumerable:!0,get:function(){return ZP.createMcpLogger}});Object.defineProperty(Pe,"createLogger",{enumerable:!0,get:function(){return ZP.createLogger}});var tG=qP();Object.defineProperty(Pe,"withErrorHandling",{enumerable:!0,get:function(){return tG.withErrorHandling}})});var cO=S((ipe,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 uO=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 lO=S(Wr=>{"use strict";f();var Cd;Object.defineProperty(Wr,"__esModule",{value:!0});Wr.unload=Wr.load=Wr.onExit=Wr.signals=void 0;var Nd=uO();Object.defineProperty(Wr,"signals",{enumerable:!0,get:function(){return Nd.signals}});var Ad=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,cG=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];cG(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}},Rd=class{},uG=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),wv=class extends Rd{onExit(){return()=>{}}load(){}unload(){}},xv=class extends Rd{#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(!Ad(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 Ad(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"&&Ad(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;Cd=uG(Ad(Sv)?new xv(Sv):new wv),Wr.onExit=Cd.onExit,Wr.load=Cd.load,Wr.unload=Cd.unload});var zd=S((fpe,pc)=>{"use strict";f();pc.exports=gG;pc.exports.sync=yG;pc.exports._getTmpname=kv;pc.exports._cleanupOnExit=Ev;var Xe=Te("fs"),lG=cO(),{onExit:dO}=lO(),dG=Te("path"),{promisify:fr}=Te("util"),Kn={},fG=(function(){try{return Te("worker_threads").threadId}catch{return 0}})(),pG=0;function kv(t){return t+"."+lG(v).hash(String(process.pid)).hash(String(fG)).hash(String(++pG)).result()}function Ev(t){return()=>{try{Xe.unlinkSync(typeof t=="function"?t():t)}catch{}}}function hG(t){return new Promise(e=>{Kn[t]||(Kn[t]=[]),Kn[t].push(e),Kn[t].length===1&&e()})}function jd(t){return t.code==="ENOSYS"||(!process.getuid||process.getuid()!==0)&&(t.code==="EINVAL"||t.code==="EPERM")}async function mG(t,e,r={}){typeof r=="string"&&(r={encoding:r});let n,s,o=dO(Ev(()=>s)),i=dG.resolve(t);try{await hG(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(!jd(c))throw c}),r.mode&&await fr(Xe.chmod)(s,r.mode).catch(c=>{if(!jd(c))throw c}),await fr(Xe.rename)(s,a)}finally{n&&await fr(Xe.close)(n).catch(()=>{}),o(),await fr(Xe.unlink)(s).catch(()=>{}),Kn[i].shift(),Kn[i].length>0?Kn[i][0]():delete Kn[i]}}async function gG(t,e,r,n){r instanceof Function&&(n=r,r={});let s=mG(t,e,r);if(n)try{let o=await s;return n(o)}catch(o){return n(o)}return s}function yG(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=dO(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(!jd(c))throw c}if(r.mode)try{Xe.chmodSync(n,r.mode)}catch(c){if(!jd(c))throw c}Xe.renameSync(n,t),a=!1}finally{if(s)try{Xe.closeSync(s)}catch{}i(),a&&o()}}});var gO=S((Cpe,mO)=>{"use strict";f();var Wn=Te("constants"),EG=process.cwd,qd=null,TG=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return qd||(qd=EG.call(process)),qd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cv=process.chdir,process.chdir=function(t){qd=null,Cv.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cv));var Cv;mO.exports=$G;function $G(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(){}),TG==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function d(p,g,h){var m=Date.now(),y=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)})},y),y<100&&(y+=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,y,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,y,w);b.apply(this,arguments)}}return l.call(t,p,g,h,m,y,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 y=0;;)try{return l.call(t,d,p,g,h,m)}catch(b){if(b.code==="EAGAIN"&&y<10){y++;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(y){l.close(m,function(b){g&&g(y||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,y){if(m){h&&h(m);return}l.futimes(y,p,g,function(b){l.close(y,function(w){h&&h(b||w)})})})},l.lutimesSync=function(d,p,g){var h=l.openSync(d,Wn.O_SYMLINK),m,y=!0;try{m=l.futimesSync(h,p,g),y=!1}finally{if(y)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,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.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 vO=S((Ape,_O)=>{"use strict";f();var yO=Te("stream").Stream;_O.exports=IG;function IG(t){return{ReadStream:e,WriteStream:r};function e(n,s){if(!(this instanceof e))return new e(n,s);yO.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);yO.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 wO=S((jpe,bO)=>{"use strict";f();bO.exports=OG;var PG=Object.getPrototypeOf||function(t){return t.__proto__};function OG(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:PG(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((Mpe,Rv)=>{"use strict";f();var tt=Te("fs"),CG=gO(),NG=vO(),AG=wO(),Zd=Te("util"),_t,Fd;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_t=Symbol.for("graceful-fs.queue"),Fd=Symbol.for("graceful-fs.previous")):(_t="___graceful-fs.queue",Fd="___graceful-fs.previous");function RG(){}function kO(t,e){Object.defineProperty(t,_t,{get:function(){return e}})}var ho=RG;Zd.debuglog?ho=Zd.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ho=function(){var t=Zd.format.apply(Zd,arguments);t="GFS4: "+t.split(/\n/).join(`
32
- GFS4: `),console.error(t)});tt[_t]||(xO=global[_t]||[],kO(tt,xO),tt.close=(function(t){function e(r,n){return t.call(tt,r,function(s){s||SO(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Fd,{value:t}),e})(tt.close),tt.closeSync=(function(t){function e(r){t.apply(tt,arguments),SO()}return Object.defineProperty(e,Fd,{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 xO;global[_t]||kO(global,tt[_t]);Rv.exports=Nv(AG(tt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!tt.__patched&&(Rv.exports=Nv(tt),tt.__patched=!0);function Nv(t){CG(t),t.gracefulify=Nv,t.createReadStream=P,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=NG(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 y=x;Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(A){y=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;I(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;I(A.path,A.flags,A.mode,function(F,C){F?(A.destroy(),A.emit("error",F)):(A.fd=C,A.emit("open",C))})}function P(A,F){return new t.ReadStream(A,F)}function L(A,F){return new t.WriteStream(A,F)}var U=t.open;t.open=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 U(te,pe,ee,function(Ae,uu){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 Dd;function SO(){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(Dd),Dd=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)}Dd===void 0&&(Dd=setTimeout(Av,0))}}});var TO=S((qpe,EO)=>{"use strict";f();function pr(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))}EO.exports=pr;pr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};pr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};pr.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};pr.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)};pr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};pr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};pr.prototype.start=pr.prototype.try;pr.prototype.errors=function(){return this._errors};pr.prototype.attempts=function(){return this._attempts};pr.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 $O=S(mo=>{"use strict";f();var jG=TO();mo.operation=function(t){var e=mo.timeouts(t);return new jG(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 PO=S((Upe,IO)=>{"use strict";f();IO.exports=$O()});var OO=S((Bpe,Ud)=>{"use strict";f();Ud.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Ud.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ud.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var jO=S((Kpe,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)?(CO=Te("assert"),Pi=OO(),NO=/^win/i.test(Qe.platform),hc=Te("events"),typeof hc!="function"&&(hc=hc.EventEmitter),Qe.__signal_exit_emitter__?dt=Qe.__signal_exit_emitter__:(dt=Qe.__signal_exit_emitter__=new hc,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(){};CO.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&&Vd()};return dt.on(r,t),n},Vd=function(){!Oi||!go(global.process)||(Oi=!1,Pi.forEach(function(e){try{Qe.removeListener(e,Bd[e])}catch{}}),Qe.emit=Hd,Qe.reallyExit=Mv,dt.count-=1)},Ci.exports.unload=Vd,yo=function(e,r,n){dt.emitted[e]||(dt.emitted[e]=!0,dt.emit(e,r,n))},Bd={},Pi.forEach(function(t){Bd[t]=function(){if(go(global.process)){var r=Qe.listeners(t);r.length===dt.count&&(Vd(),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,Bd[e]),!0}catch{return!1}}),Qe.emit=RO,Qe.reallyExit=AO)},Ci.exports.load=zv,Mv=Qe.reallyExit,AO=function(e){go(global.process)&&(Qe.exitCode=e||0,yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),Mv.call(Qe,Qe.exitCode))},Hd=Qe.emit,RO=function(e,r){if(e==="exit"&&go(global.process)){r!==void 0&&(Qe.exitCode=r);var n=Hd.apply(this,arguments);return yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),n}else return Hd.apply(this,arguments)}):Ci.exports=function(){return function(){}};var CO,Pi,NO,hc,dt,Vd,yo,Bd,Oi,zv,Mv,AO,Hd,RO});var MO=S((Jpe,Lv)=>{"use strict";f();var zO=Symbol();function zG(t,e,r){let n=e[zO];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,zO,{value:c}),r(null,a.mtime,c)})})}function MG(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Lv.exports.probe=zG;Lv.exports.getMtime=MG});var FO=S((Ype,gc)=>{"use strict";f();var LG=Te("path"),Dv=jv(),qG=PO(),ZG=jO(),LO=MO(),_n={};function mc(t,e){return e.lockfilePath||`${t}.lock`}function Fv(t,e,r){if(!e.realpath)return r(null,LG.resolve(t));e.fs.realpath(t,r)}function Zv(t,e,r){let n=mc(t,e);e.fs.mkdir(n,s=>{if(!s)return LO.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(!qO(i,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));ZO(t,e,a=>{if(a)return r(a);Zv(t,{...e,stale:0},r)})})})}function qO(t,e){return t.mtime.getTime()<Date.now()-e.stale}function ZO(t,e,r){e.fs.rmdir(mc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Kd(t,e){let r=_n[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,Kd(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=LO.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,Kd(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Kd(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function qv(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),_n[t]===e&&delete _n[t],e.options.onCompromised(r)}function DG(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=qG.operation(e.retries);o.attempt(()=>{Zv(s,e,(i,a,c)=>{if(o.retry(i))return;if(i)return r(o.mainError());let u=_n[s]={lockfilePath:mc(s,e),mtime:a,mtimePrecision:c,options:e,lastUpdate:Date.now()};Kd(s,e),r(null,l=>{if(u.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));DO(s,{...e,realpath:!1},l)})})})})}function DO(t,e,r){e={fs:Dv,realpath:!0,...e},Fv(t,e,(n,s)=>{if(n)return r(n);let o=_n[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 _n[s],ZO(s,e,r)})}function FG(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(mc(s,e),(o,i)=>o?o.code==="ENOENT"?r(null,!1):r(o):r(null,!qO(i,e)))})}function UG(){return _n}ZG(()=>{for(let t in _n){let e=_n[t].options;try{e.fs.rmdirSync(mc(t,e))}catch{}}});gc.exports.lock=DG;gc.exports.unlock=DO;gc.exports.check=FG;gc.exports.getLocks=UG});var VO=S((Qpe,UO)=>{"use strict";f();var VG=jv();function BG(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 HG(t){return(...e)=>new Promise((r,n)=>{e.push((s,o)=>{s?n(s):r(o)}),t(...e)})}function KG(t){return(...e)=>{let r,n;if(e.push((s,o)=>{r=s,n=o}),t(...e),r)throw r;return n}}function GG(t){if(t={...t},t.fs=BG(t.fs||VG),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}UO.exports={toPromise:HG,toSync:KG,toSyncOptions:GG}});var Vv=S((the,Yn)=>{"use strict";f();var Ni=FO(),{toPromise:Gd,toSync:Jd,toSyncOptions:Uv}=VO();async function BO(t,e){let r=await Gd(Ni.lock)(t,e);return Gd(r)}function JG(t,e){let r=Jd(Ni.lock)(t,Uv(e));return Jd(r)}function WG(t,e){return Gd(Ni.unlock)(t,e)}function YG(t,e){return Jd(Ni.unlock)(t,Uv(e))}function XG(t,e){return Gd(Ni.check)(t,e)}function QG(t,e){return Jd(Ni.check)(t,Uv(e))}Yn.exports=BO;Yn.exports.lock=BO;Yn.exports.unlock=WG;Yn.exports.lockSync=JG;Yn.exports.unlockSync=YG;Yn.exports.check=XG;Yn.exports.checkSync=QG});var Ee=S(vt=>{"use strict";f();var Gv=Symbol.for("yaml.alias"),vC=Symbol.for("yaml.document"),of=Symbol.for("yaml.map"),bC=Symbol.for("yaml.pair"),Jv=Symbol.for("yaml.scalar"),af=Symbol.for("yaml.seq"),vn=Symbol.for("yaml.node.type"),OJ=t=>!!t&&typeof t=="object"&&t[vn]===Gv,CJ=t=>!!t&&typeof t=="object"&&t[vn]===vC,NJ=t=>!!t&&typeof t=="object"&&t[vn]===of,AJ=t=>!!t&&typeof t=="object"&&t[vn]===bC,wC=t=>!!t&&typeof t=="object"&&t[vn]===Jv,RJ=t=>!!t&&typeof t=="object"&&t[vn]===af;function xC(t){if(t&&typeof t=="object")switch(t[vn]){case of:case af:return!0}return!1}function jJ(t){if(t&&typeof t=="object")switch(t[vn]){case Gv:case of:case Jv:case af:return!0}return!1}var zJ=t=>(wC(t)||xC(t))&&!!t.anchor;vt.ALIAS=Gv;vt.DOC=vC;vt.MAP=of;vt.NODE_TYPE=vn;vt.PAIR=bC;vt.SCALAR=Jv;vt.SEQ=af;vt.hasAnchor=zJ;vt.isAlias=OJ;vt.isCollection=xC;vt.isDocument=CJ;vt.isMap=NJ;vt.isNode=jJ;vt.isPair=AJ;vt.isScalar=wC;vt.isSeq=RJ});var bc=S(Wv=>{"use strict";f();var ut=Ee(),Ft=Symbol("break visit"),SC=Symbol("skip children"),Qr=Symbol("remove node");function cf(t,e){let r=kC(e);ut.isDocument(t)?Ri(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):Ri(null,t,r,Object.freeze([]))}cf.BREAK=Ft;cf.SKIP=SC;cf.REMOVE=Qr;function Ri(t,e,r,n){let s=EC(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return TC(t,n,s),Ri(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=Ri(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=Ri("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=Ri("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}async function uf(t,e){let r=kC(e);ut.isDocument(t)?await ji(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):await ji(null,t,r,Object.freeze([]))}uf.BREAK=Ft;uf.SKIP=SC;uf.REMOVE=Qr;async function ji(t,e,r,n){let s=await EC(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return TC(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=await 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=await ji("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=await ji("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}function kC(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 EC(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 TC(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(IC=>{"use strict";f();var $C=Ee(),MJ=bc(),LJ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},qJ=t=>t.replace(/[!,[\]{}]/g,e=>LJ[e]),wc=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+qJ(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&&$C.isNode(e.contents)){let o={};MJ.visit(e.contents,(i,a)=>{$C.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(`
31
+ `),pe=b3.bind(null,{[SP]:"",[kP]:i,[TP]:z,[EP]:iv,[av]:A,[$P]:F}),ee="";d!==null&&(p===void 0?ee=pe(d):ee=pe(Object.assign({},d,{name:p})));let Ie=a instanceof Function?a:a?AP:D3,Fe=Ie().indexOf(":")+1;if(w&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(y&&typeof y!="function")throw Error(`Unknown mixin type "${typeof y}" - expected "function"`);if($&&typeof $!="string")throw Error(`Unknown msgPrefix type "${typeof $}" - expected "string"`);h3(g,h,w);let Ae=CP(h,w);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:Ae,messageKey:c,errorKey:u}}),y3(m);let uu=g3(m);return Object.assign(e,{levels:Ae,[j3]:uu,[z3]:w,[$3]:n,[E3]:Ie,[T3]:Fe,[EP]:iv,[av]:A,[TP]:z,[P3]:te,[O3]:V,[C3]:c,[N3]:u,[A3]:l,[L3]:l?`,${JSON.stringify(l)}:{`:"",[kP]:i,[R3]:y,[q3]:b,[SP]:ee,[$P]:F,[M3]:T,silent:x3,onChild:U,[Z3]:$}),Object.setPrototypeOf(e,f3()),m3(e),e[I3](g),e}lr.exports=cv;lr.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=xP(t.dest||process.stdout.fd),wP(t)):wP({dest:xP(t),minLength:0});lr.exports.transport=V_();lr.exports.multistream=bP();lr.exports.levels=CP();lr.exports.stdSerializers=K3;lr.exports.stdTimeFunctions=Object.assign({},PP);lr.exports.symbols=OP;lr.exports.version=S3;lr.exports.default=cv;lr.exports.pino=cv});var LP=S(Ei=>{"use strict";f();var G3=Ei&&Ei.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ei,"__esModule",{value:!0});Ei.createMcpLogger=MP;Ei.createLogger=MP;var jP=G3(RP()),zP=y_(),J3=["password","token","accessToken","access_token","refreshToken","refresh_token","apiKey","api_key","secret","TOOLPILOT_API_KEY","authorization","cookie","*.password","*.token","*.secret","*.apiKey","*.api_key"];function MP(t){let e=t.level??process.env.LOG_LEVEL??(process.env.NODE_ENV!=="production"?"debug":"info"),r={name:t.name,level:e,serializers:{err:zP.errorSerializer,error:zP.errorSerializer},redact:{paths:J3,censor:"[REDACTED]"},timestamp:jP.default.stdTimeFunctions.isoTime,base:{pid:process.pid,...t.defaultFields}};return(0,jP.default)(r,process.stderr)}});var qP=S(uv=>{"use strict";f();Object.defineProperty(uv,"__esModule",{value:!0});uv.withErrorHandling=X3;var W3=od(),Y3=id();function X3(t,e,r){return async n=>{try{return await r(n)}catch(s){if(s instanceof Y3.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:W3.ErrorCode.ERR_MCP_HANDLER,message:s instanceof Error?s.message:String(s)})}],isError:!0}}}}});var Ce=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 Q3=od();Object.defineProperty(Pe,"ErrorCode",{enumerable:!0,get:function(){return Q3.ErrorCode}});var Gr=id();Object.defineProperty(Pe,"AppError",{enumerable:!0,get:function(){return Gr.AppError}});Object.defineProperty(Pe,"DatabaseError",{enumerable:!0,get:function(){return Gr.DatabaseError}});Object.defineProperty(Pe,"NetworkError",{enumerable:!0,get:function(){return Gr.NetworkError}});Object.defineProperty(Pe,"ValidationError",{enumerable:!0,get:function(){return Gr.ValidationError}});Object.defineProperty(Pe,"AuthError",{enumerable:!0,get:function(){return Gr.AuthError}});Object.defineProperty(Pe,"ExternalServiceError",{enumerable:!0,get:function(){return Gr.ExternalServiceError}});Object.defineProperty(Pe,"QueueError",{enumerable:!0,get:function(){return Gr.QueueError}});Object.defineProperty(Pe,"SearchError",{enumerable:!0,get:function(){return Gr.SearchError}});Object.defineProperty(Pe,"IndexerError",{enumerable:!0,get:function(){return Gr.IndexerError}});Object.defineProperty(Pe,"VectorError",{enumerable:!0,get:function(){return Gr.VectorError}});var eG=y_();Object.defineProperty(Pe,"errorSerializer",{enumerable:!0,get:function(){return eG.errorSerializer}});var ZP=LP();Object.defineProperty(Pe,"createMcpLogger",{enumerable:!0,get:function(){return ZP.createMcpLogger}});Object.defineProperty(Pe,"createLogger",{enumerable:!0,get:function(){return ZP.createLogger}});var tG=qP();Object.defineProperty(Pe,"withErrorHandling",{enumerable:!0,get:function(){return tG.withErrorHandling}})});var cO=S((ape,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 uO=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 lO=S(Wr=>{"use strict";f();var Cd;Object.defineProperty(Wr,"__esModule",{value:!0});Wr.unload=Wr.load=Wr.onExit=Wr.signals=void 0;var Nd=uO();Object.defineProperty(Wr,"signals",{enumerable:!0,get:function(){return Nd.signals}});var Ad=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,cG=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];cG(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}},Rd=class{},uG=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),wv=class extends Rd{onExit(){return()=>{}}load(){}unload(){}},xv=class extends Rd{#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(!Ad(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 Ad(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"&&Ad(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;Cd=uG(Ad(Sv)?new xv(Sv):new wv),Wr.onExit=Cd.onExit,Wr.load=Cd.load,Wr.unload=Cd.unload});var zd=S((ppe,pc)=>{"use strict";f();pc.exports=gG;pc.exports.sync=yG;pc.exports._getTmpname=kv;pc.exports._cleanupOnExit=Ev;var Xe=Te("fs"),lG=cO(),{onExit:dO}=lO(),dG=Te("path"),{promisify:fr}=Te("util"),Kn={},fG=(function(){try{return Te("worker_threads").threadId}catch{return 0}})(),pG=0;function kv(t){return t+"."+lG(v).hash(String(process.pid)).hash(String(fG)).hash(String(++pG)).result()}function Ev(t){return()=>{try{Xe.unlinkSync(typeof t=="function"?t():t)}catch{}}}function hG(t){return new Promise(e=>{Kn[t]||(Kn[t]=[]),Kn[t].push(e),Kn[t].length===1&&e()})}function jd(t){return t.code==="ENOSYS"||(!process.getuid||process.getuid()!==0)&&(t.code==="EINVAL"||t.code==="EPERM")}async function mG(t,e,r={}){typeof r=="string"&&(r={encoding:r});let n,s,o=dO(Ev(()=>s)),i=dG.resolve(t);try{await hG(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(!jd(c))throw c}),r.mode&&await fr(Xe.chmod)(s,r.mode).catch(c=>{if(!jd(c))throw c}),await fr(Xe.rename)(s,a)}finally{n&&await fr(Xe.close)(n).catch(()=>{}),o(),await fr(Xe.unlink)(s).catch(()=>{}),Kn[i].shift(),Kn[i].length>0?Kn[i][0]():delete Kn[i]}}async function gG(t,e,r,n){r instanceof Function&&(n=r,r={});let s=mG(t,e,r);if(n)try{let o=await s;return n(o)}catch(o){return n(o)}return s}function yG(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=dO(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(!jd(c))throw c}if(r.mode)try{Xe.chmodSync(n,r.mode)}catch(c){if(!jd(c))throw c}Xe.renameSync(n,t),a=!1}finally{if(s)try{Xe.closeSync(s)}catch{}i(),a&&o()}}});var gO=S((Npe,mO)=>{"use strict";f();var Wn=Te("constants"),EG=process.cwd,qd=null,TG=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return qd||(qd=EG.call(process)),qd};try{process.cwd()}catch{}typeof process.chdir=="function"&&(Cv=process.chdir,process.chdir=function(t){qd=null,Cv.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,Cv));var Cv;mO.exports=$G;function $G(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(){}),TG==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(l){function d(p,g,h){var m=Date.now(),y=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)})},y),y<100&&(y+=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,y,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,y,w);b.apply(this,arguments)}}return l.call(t,p,g,h,m,y,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 y=0;;)try{return l.call(t,d,p,g,h,m)}catch(b){if(b.code==="EAGAIN"&&y<10){y++;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(y){l.close(m,function(b){g&&g(y||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,y){if(m){h&&h(m);return}l.futimes(y,p,g,function(b){l.close(y,function(w){h&&h(b||w)})})})},l.lutimesSync=function(d,p,g){var h=l.openSync(d,Wn.O_SYMLINK),m,y=!0;try{m=l.futimesSync(h,p,g),y=!1}finally{if(y)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,y){y&&(y.uid<0&&(y.uid+=4294967296),y.gid<0&&(y.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 vO=S((Rpe,_O)=>{"use strict";f();var yO=Te("stream").Stream;_O.exports=IG;function IG(t){return{ReadStream:e,WriteStream:r};function e(n,s){if(!(this instanceof e))return new e(n,s);yO.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);yO.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 wO=S((zpe,bO)=>{"use strict";f();bO.exports=OG;var PG=Object.getPrototypeOf||function(t){return t.__proto__};function OG(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:PG(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((Lpe,Rv)=>{"use strict";f();var tt=Te("fs"),CG=gO(),NG=vO(),AG=wO(),Zd=Te("util"),_t,Fd;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_t=Symbol.for("graceful-fs.queue"),Fd=Symbol.for("graceful-fs.previous")):(_t="___graceful-fs.queue",Fd="___graceful-fs.previous");function RG(){}function kO(t,e){Object.defineProperty(t,_t,{get:function(){return e}})}var ho=RG;Zd.debuglog?ho=Zd.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(ho=function(){var t=Zd.format.apply(Zd,arguments);t="GFS4: "+t.split(/\n/).join(`
32
+ GFS4: `),console.error(t)});tt[_t]||(xO=global[_t]||[],kO(tt,xO),tt.close=(function(t){function e(r,n){return t.call(tt,r,function(s){s||SO(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Fd,{value:t}),e})(tt.close),tt.closeSync=(function(t){function e(r){t.apply(tt,arguments),SO()}return Object.defineProperty(e,Fd,{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 xO;global[_t]||kO(global,tt[_t]);Rv.exports=Nv(AG(tt));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!tt.__patched&&(Rv.exports=Nv(tt),tt.__patched=!0);function Nv(t){CG(t),t.gracefulify=Nv,t.createReadStream=P,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=NG(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 y=x;Object.defineProperty(t,"FileWriteStream",{get:function(){return y},set:function(A){y=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 P(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,uu){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 Dd;function SO(){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(Dd),Dd=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)}Dd===void 0&&(Dd=setTimeout(Av,0))}}});var TO=S((Zpe,EO)=>{"use strict";f();function pr(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))}EO.exports=pr;pr.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};pr.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null};pr.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};pr.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)};pr.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)};pr.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)};pr.prototype.start=pr.prototype.try;pr.prototype.errors=function(){return this._errors};pr.prototype.attempts=function(){return this._attempts};pr.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 $O=S(mo=>{"use strict";f();var jG=TO();mo.operation=function(t){var e=mo.timeouts(t);return new jG(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 PO=S((Vpe,IO)=>{"use strict";f();IO.exports=$O()});var OO=S((Hpe,Ud)=>{"use strict";f();Ud.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&Ud.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ud.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var jO=S((Gpe,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)?(CO=Te("assert"),Pi=OO(),NO=/^win/i.test(Qe.platform),hc=Te("events"),typeof hc!="function"&&(hc=hc.EventEmitter),Qe.__signal_exit_emitter__?dt=Qe.__signal_exit_emitter__:(dt=Qe.__signal_exit_emitter__=new hc,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(){};CO.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&&Vd()};return dt.on(r,t),n},Vd=function(){!Oi||!go(global.process)||(Oi=!1,Pi.forEach(function(e){try{Qe.removeListener(e,Bd[e])}catch{}}),Qe.emit=Hd,Qe.reallyExit=Mv,dt.count-=1)},Ci.exports.unload=Vd,yo=function(e,r,n){dt.emitted[e]||(dt.emitted[e]=!0,dt.emit(e,r,n))},Bd={},Pi.forEach(function(t){Bd[t]=function(){if(go(global.process)){var r=Qe.listeners(t);r.length===dt.count&&(Vd(),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,Bd[e]),!0}catch{return!1}}),Qe.emit=RO,Qe.reallyExit=AO)},Ci.exports.load=zv,Mv=Qe.reallyExit,AO=function(e){go(global.process)&&(Qe.exitCode=e||0,yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),Mv.call(Qe,Qe.exitCode))},Hd=Qe.emit,RO=function(e,r){if(e==="exit"&&go(global.process)){r!==void 0&&(Qe.exitCode=r);var n=Hd.apply(this,arguments);return yo("exit",Qe.exitCode,null),yo("afterexit",Qe.exitCode,null),n}else return Hd.apply(this,arguments)}):Ci.exports=function(){return function(){}};var CO,Pi,NO,hc,dt,Vd,yo,Bd,Oi,zv,Mv,AO,Hd,RO});var MO=S((Wpe,Lv)=>{"use strict";f();var zO=Symbol();function zG(t,e,r){let n=e[zO];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,zO,{value:c}),r(null,a.mtime,c)})})}function MG(t){let e=Date.now();return t==="s"&&(e=Math.ceil(e/1e3)*1e3),new Date(e)}Lv.exports.probe=zG;Lv.exports.getMtime=MG});var FO=S((Xpe,gc)=>{"use strict";f();var LG=Te("path"),Dv=jv(),qG=PO(),ZG=jO(),LO=MO(),_n={};function mc(t,e){return e.lockfilePath||`${t}.lock`}function Fv(t,e,r){if(!e.realpath)return r(null,LG.resolve(t));e.fs.realpath(t,r)}function Zv(t,e,r){let n=mc(t,e);e.fs.mkdir(n,s=>{if(!s)return LO.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(!qO(i,e))return r(Object.assign(new Error("Lock file is already being held"),{code:"ELOCKED",file:t}));ZO(t,e,a=>{if(a)return r(a);Zv(t,{...e,stale:0},r)})})})}function qO(t,e){return t.mtime.getTime()<Date.now()-e.stale}function ZO(t,e,r){e.fs.rmdir(mc(t,e),n=>{if(n&&n.code!=="ENOENT")return r(n);r()})}function Kd(t,e){let r=_n[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,Kd(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=LO.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,Kd(t,e));r.mtime=a,r.lastUpdate=Date.now(),r.updateDelay=null,Kd(t,e)}})})},r.updateDelay),r.updateTimeout.unref&&r.updateTimeout.unref())}function qv(t,e,r){e.released=!0,e.updateTimeout&&clearTimeout(e.updateTimeout),_n[t]===e&&delete _n[t],e.options.onCompromised(r)}function DG(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=qG.operation(e.retries);o.attempt(()=>{Zv(s,e,(i,a,c)=>{if(o.retry(i))return;if(i)return r(o.mainError());let u=_n[s]={lockfilePath:mc(s,e),mtime:a,mtimePrecision:c,options:e,lastUpdate:Date.now()};Kd(s,e),r(null,l=>{if(u.released)return l&&l(Object.assign(new Error("Lock is already released"),{code:"ERELEASED"}));DO(s,{...e,realpath:!1},l)})})})})}function DO(t,e,r){e={fs:Dv,realpath:!0,...e},Fv(t,e,(n,s)=>{if(n)return r(n);let o=_n[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 _n[s],ZO(s,e,r)})}function FG(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(mc(s,e),(o,i)=>o?o.code==="ENOENT"?r(null,!1):r(o):r(null,!qO(i,e)))})}function UG(){return _n}ZG(()=>{for(let t in _n){let e=_n[t].options;try{e.fs.rmdirSync(mc(t,e))}catch{}}});gc.exports.lock=DG;gc.exports.unlock=DO;gc.exports.check=FG;gc.exports.getLocks=UG});var VO=S((ehe,UO)=>{"use strict";f();var VG=jv();function BG(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 HG(t){return(...e)=>new Promise((r,n)=>{e.push((s,o)=>{s?n(s):r(o)}),t(...e)})}function KG(t){return(...e)=>{let r,n;if(e.push((s,o)=>{r=s,n=o}),t(...e),r)throw r;return n}}function GG(t){if(t={...t},t.fs=BG(t.fs||VG),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}UO.exports={toPromise:HG,toSync:KG,toSyncOptions:GG}});var Vv=S((rhe,Yn)=>{"use strict";f();var Ni=FO(),{toPromise:Gd,toSync:Jd,toSyncOptions:Uv}=VO();async function BO(t,e){let r=await Gd(Ni.lock)(t,e);return Gd(r)}function JG(t,e){let r=Jd(Ni.lock)(t,Uv(e));return Jd(r)}function WG(t,e){return Gd(Ni.unlock)(t,e)}function YG(t,e){return Jd(Ni.unlock)(t,Uv(e))}function XG(t,e){return Gd(Ni.check)(t,e)}function QG(t,e){return Jd(Ni.check)(t,Uv(e))}Yn.exports=BO;Yn.exports.lock=BO;Yn.exports.unlock=WG;Yn.exports.lockSync=JG;Yn.exports.unlockSync=YG;Yn.exports.check=XG;Yn.exports.checkSync=QG});var Ee=S(vt=>{"use strict";f();var Gv=Symbol.for("yaml.alias"),vC=Symbol.for("yaml.document"),of=Symbol.for("yaml.map"),bC=Symbol.for("yaml.pair"),Jv=Symbol.for("yaml.scalar"),af=Symbol.for("yaml.seq"),vn=Symbol.for("yaml.node.type"),OJ=t=>!!t&&typeof t=="object"&&t[vn]===Gv,CJ=t=>!!t&&typeof t=="object"&&t[vn]===vC,NJ=t=>!!t&&typeof t=="object"&&t[vn]===of,AJ=t=>!!t&&typeof t=="object"&&t[vn]===bC,wC=t=>!!t&&typeof t=="object"&&t[vn]===Jv,RJ=t=>!!t&&typeof t=="object"&&t[vn]===af;function xC(t){if(t&&typeof t=="object")switch(t[vn]){case of:case af:return!0}return!1}function jJ(t){if(t&&typeof t=="object")switch(t[vn]){case Gv:case of:case Jv:case af:return!0}return!1}var zJ=t=>(wC(t)||xC(t))&&!!t.anchor;vt.ALIAS=Gv;vt.DOC=vC;vt.MAP=of;vt.NODE_TYPE=vn;vt.PAIR=bC;vt.SCALAR=Jv;vt.SEQ=af;vt.hasAnchor=zJ;vt.isAlias=OJ;vt.isCollection=xC;vt.isDocument=CJ;vt.isMap=NJ;vt.isNode=jJ;vt.isPair=AJ;vt.isScalar=wC;vt.isSeq=RJ});var bc=S(Wv=>{"use strict";f();var ut=Ee(),Ft=Symbol("break visit"),SC=Symbol("skip children"),Qr=Symbol("remove node");function cf(t,e){let r=kC(e);ut.isDocument(t)?Ri(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):Ri(null,t,r,Object.freeze([]))}cf.BREAK=Ft;cf.SKIP=SC;cf.REMOVE=Qr;function Ri(t,e,r,n){let s=EC(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return TC(t,n,s),Ri(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=Ri(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=Ri("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=Ri("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}async function uf(t,e){let r=kC(e);ut.isDocument(t)?await ji(null,t.contents,r,Object.freeze([t]))===Qr&&(t.contents=null):await ji(null,t,r,Object.freeze([]))}uf.BREAK=Ft;uf.SKIP=SC;uf.REMOVE=Qr;async function ji(t,e,r,n){let s=await EC(t,e,r,n);if(ut.isNode(s)||ut.isPair(s))return TC(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=await 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=await ji("key",e.key,r,n);if(o===Ft)return Ft;o===Qr&&(e.key=null);let i=await ji("value",e.value,r,n);if(i===Ft)return Ft;i===Qr&&(e.value=null)}}return s}function kC(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 EC(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 TC(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(IC=>{"use strict";f();var $C=Ee(),MJ=bc(),LJ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},qJ=t=>t.replace(/[!,[\]{}]/g,e=>LJ[e]),wc=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+qJ(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&&$C.isNode(e.contents)){let o={};MJ.visit(e.contents,(i,a)=>{$C.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
33
  `)}};wc.defaultYaml={explicit:!1,version:"1.2"};wc.defaultTags={"!!":"tag:yaml.org,2002:"};IC.Directives=wc});var lf=S(xc=>{"use strict";f();var PC=Ee(),ZJ=bc();function DJ(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 OC(t){let e=new Set;return ZJ.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function CC(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function FJ(t,e){let r=[],n=new Map,s=null;return{onAnchor:o=>{r.push(o),s??(s=OC(t));let i=CC(e,s);return s.add(i),i},setAnchors:()=>{for(let o of r){let i=n.get(o);if(typeof i=="object"&&i.anchor&&(PC.isScalar(i.node)||PC.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}}xc.anchorIsValid=DJ;xc.anchorNames=OC;xc.createNodeAnchors=FJ;xc.findNewAnchor=CC});var Xv=S(NC=>{"use strict";f();function Sc(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=Sc(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=Sc(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=Sc(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=Sc(t,n,s,o);i===void 0?delete n[s]:i!==o&&(n[s]=i)}return t.call(e,r,n)}NC.applyReviver=Sc});var Xn=S(RC=>{"use strict";f();var UJ=Ee();function AC(t,e,r){if(Array.isArray(t))return t.map((n,s)=>AC(n,String(s),r));if(t&&typeof t.toJSON=="function"){if(!r||!UJ.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}RC.toJS=AC});var df=S(zC=>{"use strict";f();var VJ=Xv(),jC=Ee(),BJ=Xn(),Qv=class{constructor(e){Object.defineProperty(this,jC.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(!jC.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=BJ.toJS(this,"",i);if(typeof s=="function")for(let{count:c,res:u}of i.anchors.values())s(u,c);return typeof o=="function"?VJ.applyReviver(o,{"":a},"",a):a}};zC.NodeBase=Qv});var kc=S(MC=>{"use strict";f();var HJ=lf(),KJ=bc(),zi=Ee(),GJ=df(),JJ=Xn(),eb=class extends GJ.NodeBase{constructor(e){super(zi.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=[],KJ.visit(e,{Node:(o,i)=>{(zi.isAlias(i)||zi.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||(JJ.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(HJ.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(zi.isAlias(e)){let n=e.resolve(t),s=r&&n&&r.get(n);return s?s.count*s.aliasCount:0}else if(zi.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(zi.isPair(e)){let n=ff(t,e.key,r),s=ff(t,e.value,r);return Math.max(n,s)}return 1}MC.Alias=eb});var it=S(tb=>{"use strict";f();var WJ=Ee(),YJ=df(),XJ=Xn(),QJ=t=>!t||typeof t!="function"&&typeof t!="object",Qn=class extends YJ.NodeBase{constructor(e){super(WJ.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:XJ.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=QJ});var Ec=S(qC=>{"use strict";f();var e5=kc(),bo=Ee(),LC=it(),t5="tag:yaml.org,2002:";function r5(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 n5(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 e5.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=t5+e.slice(2));let u=r5(t,e,i.tags);if(!u){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new LC.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 LC.Scalar(t);return e?l.tag=e:u.default||(l.tag=u.tag),c&&(c.node=l),l}qC.createNode=n5});var hf=S(pf=>{"use strict";f();var s5=Ec(),en=Ee(),o5=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 s5.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 ZC=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,nb=class extends o5.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(ZC(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=ZC});var Tc=S(mf=>{"use strict";f();var i5=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function sb(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var a5=(t,e,r)=>t.endsWith(`
34
34
  `)?sb(r,e):r.includes(`
35
35
  `)?`
@@ -55,8 +55,8 @@ ${r}`)+"'";return e.implicitKey?n:es.foldFlowLines(n,r,es.FOLD_FLOW,_f(e,!1))}fu
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
56
  `&&(g=g.slice(0,-1)),g=g.replace(ab,`$&${u}`));let m=!1,y,b=-1;for(y=0;y<r.length;++y){let P=r[y];if(P===" ")m=!0;else if(P===`
57
57
  `)b=y;else break}let w=r.substring(0,b<y?b+1:y);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 P=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!==Or.Scalar.BLOCK_FOLDED&&(U.onOverflow=()=>{L=!0});let I=es.foldFlowLines(`${w}${P}${g}`,u,es.FOLD_BLOCK,U);if(!L)return`>${T}
59
- ${u}${I}`}return r=r.replace(/\n+/g,`$&${u}`),`|${T}
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!==Or.Scalar.BLOCK_FOLDED&&(U.onOverflow=()=>{L=!0});let $=es.foldFlowLines(`${w}${P}${g}`,u,es.FOLD_BLOCK,U);if(!L)return`>${T}
59
+ ${u}${$}`}return r=r.replace(/\n+/g,`$&${u}`),`|${T}
60
60
  ${u}${w}${r}${g}`}function d5(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 Mi(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||l||!o.includes(`
62
62
  `)?Mi(o,e):yf(t,e,r,n);if(!a&&!l&&s!==Or.Scalar.PLAIN&&o.includes(`
@@ -69,8 +69,8 @@ ${Cc.indentComment(U,r.indent)}`}P===""&&!r.inFlow?L===`
69
69
  `&&x&&(L=`
70
70
 
71
71
  `):L+=`
72
- ${r.indent}`}else if(!g&&bn.isCollection(e)){let U=P[0],I=P.indexOf(`
73
- `),A=I!==-1,F=r.inFlow??e.flow??e.items.length===0;if(A||!F){let C=!1;if(A&&(U==="&"||U==="!")){let z=P.indexOf(" ");U==="&"&&z!==-1&&z<I&&P[z+1]==="!"&&(z=P.indexOf(" ",z+1)),(z===-1||I<z)&&(C=!0)}C||(L=`
72
+ ${r.indent}`}else if(!g&&bn.isCollection(e)){let U=P[0],$=P.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=P.indexOf(" ");U==="&"&&z!==-1&&z<$&&P[z+1]==="!"&&(z=P.indexOf(" ",z+1)),(z===-1||$<z)&&(C=!0)}C||(L=`
74
74
  ${r.indent}`)}}else(P===""||P[0]===`
75
75
  `)&&(L="");return y+=L+P,r.inFlow?T&&n&&n():x&&!T?y+=Cc.lineComment(y,r.indent,u(x)):m&&s&&s(),y}HC.stringifyPair=b5});var lb=S(ub=>{"use strict";f();var GC=Te("process");function w5(t,...e){t==="debug"&&console.log(...e)}function x5(t,e){(t==="debug"||t==="warn")&&(typeof GC.emitWarning=="function"?GC.emitWarning(e):console.warn(e))}ub.debug=w5;ub.warn=x5});var Sf=S(xf=>{"use strict";f();var Nc=Ee(),JC=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 JC.Scalar(Symbol(bf)),{addToJSMap:WC}),stringify:()=>bf},S5=(t,e)=>(wf.identify(e)||Nc.isScalar(e)&&(!e.type||e.type===JC.Scalar.PLAIN)&&wf.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===wf.tag&&r.default);function WC(t,e,r){if(r=t&&Nc.isAlias(r)?r.resolve(t.doc):r,Nc.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&&Nc.isAlias(r)?r.resolve(t.doc):r;if(!Nc.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=WC;xf.isMergeKey=S5;xf.merge=wf});var pb=S(QC=>{"use strict";f();var k5=lb(),YC=Sf(),E5=Oc(),XC=Ee(),fb=Xn();function T5(t,e,{key:r,value:n}){if(XC.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(YC.isMergeKey(t,r))YC.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=$5(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 $5(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(XC.isNode(t)&&r?.doc){let n=E5.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)+'..."'),k5.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)}QC.addPairToJSMap=T5});var rs=S(hb=>{"use strict";f();var e1=Ec(),I5=KC(),P5=pb(),kf=Ee();function O5(t,e,r){let n=e1.createNode(t,void 0,r),s=e1.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 P5.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?I5.stringifyPair(this,e,r,n):JSON.stringify(this)}};hb.Pair=Ef;hb.createPair=O5});var mb=S(r1=>{"use strict";f();var wo=Ee(),t1=Oc(),Tf=Tc();function C5(t,e,r){return(e.inFlow??t.flow?A5:N5)(t,e,r)}function N5({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],y=null;if(wo.isNode(m))!d&&m.spaceBefore&&p.push(""),$f(r,p,m.commentBefore,d),m.comment&&(y=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=t1.stringify(m,l,()=>y=null,()=>d=!0);y&&(b+=Tf.lineComment(b,o,u(y))),d&&y&&(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}`:`
@@ -90,13 +90,13 @@ ${o.comment}`:n.comment}n=s}t.items[r]=zf.isPair(n)?n:new Ib.Pair(n)}}else e("Ex
90
90
 
91
91
  ${i}
92
92
  ${u}
93
- `}};Uc.YAMLError=Fc;Uc.YAMLParseError=Yb;Uc.YAMLWarning=Xb;Uc.prettifyError=d8});var Bc=S(eN=>{"use strict";f();function f8(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,y=null,b=null,w=null,x=null,T=null,P=null;for(let I of t)switch(h&&(I.type!=="space"&&I.type!=="newline"&&I.type!=="comma"&&o(I.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h=!1),m&&(u&&I.type!=="comment"&&I.type!=="newline"&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),I.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&I.source.includes(" ")&&(m=I),l=!0;break;case"comment":{l||o(I,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let A=I.source.substring(1)||" ";d?d+=p+A:d=A,p="",u=!1;break}case"newline":u?d?d+=I.source:(!T||r!=="seq-item-ind")&&(c=!0):p+=I.source,u=!0,g=!0,(y||b)&&(w=I),l=!0;break;case"anchor":y&&o(I,"MULTIPLE_ANCHORS","A node can have at most one anchor"),I.source.endsWith(":")&&o(I.offset+I.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=I,P??(P=I.offset),u=!1,l=!1,h=!0;break;case"tag":{b&&o(I,"MULTIPLE_TAGS","A node can have at most one tag"),b=I,P??(P=I.offset),u=!1,l=!1,h=!0;break}case r:(y||b)&&o(I,"BAD_PROP_ORDER",`Anchors and tags must be after the ${I.source} indicator`),T&&o(I,"UNEXPECTED_TOKEN",`Unexpected ${I.source} in ${e??"collection"}`),T=I,u=r==="seq-item-ind"||r==="explicit-key-ind",l=!1;break;case"comma":if(e){x&&o(I,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),x=I,u=!1,l=!1;break}default:o(I,"UNEXPECTED_TOKEN",`Unexpected ${I.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:y,tag:b,newlineAfterProp:w,end:U,start:P??U}}eN.resolveProps=f8});var Gf=S(tN=>{"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(`
93
+ `}};Uc.YAMLError=Fc;Uc.YAMLParseError=Yb;Uc.YAMLWarning=Xb;Uc.prettifyError=d8});var Bc=S(eN=>{"use strict";f();function f8(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,y=null,b=null,w=null,x=null,T=null,P=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,(y||b)&&(w=$),l=!0;break;case"anchor":y&&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),y=$,P??(P=$.offset),u=!1,l=!1,h=!0;break;case"tag":{b&&o($,"MULTIPLE_TAGS","A node can have at most one tag"),b=$,P??(P=$.offset),u=!1,l=!1,h=!0;break}case r:(y||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:y,tag:b,newlineAfterProp:w,end:U,start:P??U}}eN.resolveProps=f8});var Gf=S(tN=>{"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
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}}tN.containsNewline=Qb});var ew=S(rN=>{"use strict";f();var p8=Gf();function h8(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&p8.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}rN.flowIndentCheck=h8});var tw=S(sN=>{"use strict";f();var nN=Ee();function m8(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let s=typeof n=="function"?n:(o,i)=>o===i||nN.isScalar(o)&&nN.isScalar(i)&&o.value===i.value;return e.some(o=>s(o.key,r))}sN.mapIncludes=m8});var lN=S(uN=>{"use strict";f();var oN=rs(),g8=ss(),iN=Bc(),y8=Gf(),aN=ew(),_8=tw(),cN="All mapping items must start at the same column";function v8({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=o?.nodeClass??g8.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=iN.resolveProps(d,{indicator:"explicit-key-ind",next:p??g?.[0],offset:c,onError:s,parentIndent:n.indent,startOnNewline:!0}),y=!m.found;if(y){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",cN)),!m.anchor&&!m.tag&&!g){u=m.end,m.comment&&(a.comment?a.comment+=`
95
95
  `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||y8.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",cN);r.atKey=!0;let b=m.end,w=p?t(r,p,m,s):e(r,b,d,null,m,s);r.schema.compat&&aN.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=iN.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){y&&(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&&aN.flowIndentCheck(n.indent,h,s),c=T.range[2];let P=new oN.Pair(w,T);r.options.keepSourceTokens&&(P.srcToken=l),a.items.push(P)}else{y&&s(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),x.comment&&(w.comment?w.comment+=`
96
96
  `+x.comment:w.comment=x.comment);let T=new oN.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}uN.resolveBlockMap=v8});var fN=S(dN=>{"use strict";f();var b8=os(),w8=Bc(),x8=ew();function S8({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=o?.nodeClass??b8.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=w8.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&&x8.flowIndentCheck(n.indent,d,s),c=g.range[2],a.items.push(g)}return a.range=[n.offset,c,u??c],a}dN.resolveBlockSeq=S8});var Ui=S(pN=>{"use strict";f();function k8(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}}pN.resolveEnd=k8});var yN=S(gN=>{"use strict";f();var E8=Ee(),T8=rs(),hN=ss(),$8=os(),I8=Ui(),mN=Bc(),P8=Gf(),O8=tw(),rw="Block collections are not allowed within flow collections",nw=t=>t&&(t.type==="block-map"||t.type==="block-seq");function C8({composeNode:t,composeEmptyNode:e},r,n,s,o){let i=n.start.source==="{",a=i?"flow map":"flow sequence",c=o?.nodeClass??(i?hN.YAMLMap:$8.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 y=0;y<n.items.length;++y){let b=n.items[y],{start:w,key:x,sep:T,value:P}=b,L=mN.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&&!P){y===0&&L.comma?s(L.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<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&&P8.containsNewline(x)&&s(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===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 I of w)switch(I.type){case"comma":case"space":break;case"comment":U=I.source.substring(1);break e;default:break e}if(U){let I=u.items[u.items.length-1];E8.isPair(I)&&(I=I.value??I.key),I.comment?I.comment+=`
98
- `+U:I.comment=U,L.comment=L.comment.substring(U.length+1)}}if(!i&&!T&&!L.found){let U=P?t(r,P,L,s):e(r,L.end,T,null,L,s);u.items.push(U),d=U.range[2],nw(P)&&s(U.range,"BLOCK_IN_FLOW",rw)}else{r.atKey=!0;let U=L.end,I=x?t(r,x,L,s):e(r,U,w,null,L,s);nw(x)&&s(I.range,"BLOCK_IN_FLOW",rw),r.atKey=!1;let A=mN.resolveProps(T??[],{flow:a,indicator:"map-value-ind",next:P,offset:I.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 P&&("source"in P&&P.source?.[0]===":"?s(P,"MISSING_CHAR",`Missing space after : in ${a}`):s(A.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let F=P?t(r,P,A,s):A.found?e(r,A.end,T,null,A,s):null;F?nw(P)&&s(F.range,"BLOCK_IN_FLOW",rw):A.comment&&(I.comment?I.comment+=`
99
- `+A.comment:I.comment=A.comment);let C=new T8.Pair(I,F);if(r.options.keepSourceTokens&&(C.srcToken=b),i){let z=u;O8.mapIncludes(r,z.items,I)&&s(U,"DUPLICATE_KEY","Map keys must be unique"),z.items.push(C)}else{let z=new hN.YAMLMap(r.schema);z.flow=!0,z.items.push(C);let V=(F??I).range;z.range=[I.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 y=a[0].toUpperCase()+a.substring(1),b=l?`${y} must end with a ${p}`:`${y} 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 y=I8.resolveEnd(h,m,r.options.strict,s);y.comment&&(u.comment?u.comment+=`
97
+ `+L.comment:u.comment=L.comment),d=L.end;continue}!i&&r.options.strict&&P8.containsNewline(x)&&s(x,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===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];E8.isPair($)&&($=$.value??$.key),$.comment?$.comment+=`
98
+ `+U:$.comment=U,L.comment=L.comment.substring(U.length+1)}}if(!i&&!T&&!L.found){let U=P?t(r,P,L,s):e(r,L.end,T,null,L,s);u.items.push(U),d=U.range[2],nw(P)&&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=mN.resolveProps(T??[],{flow:a,indicator:"map-value-ind",next:P,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 P&&("source"in P&&P.source?.[0]===":"?s(P,"MISSING_CHAR",`Missing space after : in ${a}`):s(A.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let F=P?t(r,P,A,s):A.found?e(r,A.end,T,null,A,s):null;F?nw(P)&&s(F.range,"BLOCK_IN_FLOW",rw):A.comment&&($.comment?$.comment+=`
99
+ `+A.comment:$.comment=A.comment);let C=new T8.Pair($,F);if(r.options.keepSourceTokens&&(C.srcToken=b),i){let z=u;O8.mapIncludes(r,z.items,$)&&s(U,"DUPLICATE_KEY","Map keys must be unique"),z.items.push(C)}else{let z=new hN.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 y=a[0].toUpperCase()+a.substring(1),b=l?`${y} must end with a ${p}`:`${y} 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 y=I8.resolveEnd(h,m,r.options.strict,s);y.comment&&(u.comment?u.comment+=`
100
100
  `+y.comment:u.comment=y.comment),u.range=[n.offset,m,y.offset]}else u.range=[n.offset,m,m];return u}gN.resolveFlowCollection=C8});var vN=S(_N=>{"use strict";f();var N8=Ee(),A8=it(),R8=ss(),j8=os(),z8=lN(),M8=fN(),L8=yN();function sw(t,e,r,n,s,o){let i=r.type==="block-map"?z8.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?M8.resolveBlockSeq(t,e,r,n,o):L8.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 q8(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===R8.YAMLMap.tagName&&a==="map"||i===j8.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=N8.isNode(l)?l:new A8.Scalar(l);return d.range=u.range,d.tag=i,c?.format&&(d.format=c.format),d}_N.composeCollection=q8});var iw=S(bN=>{"use strict";f();var ow=it();function Z8(t,e,r){let n=e.offset,s=D8(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?F8(e.source):[],a=i.length;for(let m=i.length-1;m>=0;--m){let y=i[m][1];if(y===""||y==="\r")a=m;else break}if(a===0){let m=s.chomp==="+"&&i.length>0?`
101
101
  `.repeat(Math.max(1,i.length-1)):"",y=n+s.length;return e.source&&(y+=e.source.length),{value:m,type:o,comment:s.comment,range:[n,y,y]}}let c=e.indent+s.indent,u=e.offset+s.length,l=0;for(let m=0;m<a;++m){let[y,b]=i[m];if(b===""||b==="\r")s.indent===0&&y.length>c&&(c=y.length);else{y.length<c&&r(u+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(c=y.length),l=m,c===0&&!t.atRoot&&r(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=y.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[y,b]=i[m];u+=y.length+b.length+1;let w=b[b.length-1]==="\r";if(w&&(b=b.slice(0,-1)),b&&y.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),y=""}o===ow.Scalar.BLOCK_LITERAL?(d+=p+y.slice(c)+b,p=`
@@ -169,11 +169,11 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
169
169
  `)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
170
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=Vi(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=Vi(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())}}};QN.Parser=Ew});var sA=S(Wc=>{"use strict";f();var eA=fw(),LY=Dc(),Jc=Vc(),qY=lb(),ZY=Ee(),DY=kw(),tA=Tw();function rA(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new DY.LineCounter||null,prettyErrors:e}}function FY(t,e={}){let{lineCounter:r,prettyErrors:n}=rA(e),s=new tA.Parser(r?.addNewLine),o=new eA.Composer(e),i=Array.from(o.compose(s.parse(t)));if(n&&r)for(let a of i)a.errors.forEach(Jc.prettifyError(t,r)),a.warnings.forEach(Jc.prettifyError(t,r));return i.length>0?i:Object.assign([],{empty:!0},o.streamInfo())}function nA(t,e={}){let{lineCounter:r,prettyErrors:n}=rA(e),s=new tA.Parser(r?.addNewLine),o=new eA.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 Jc.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(i.errors.forEach(Jc.prettifyError(t,r)),i.warnings.forEach(Jc.prettifyError(t,r))),i}function UY(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let s=nA(t,r);if(!s)return null;if(s.warnings.forEach(o=>qY.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 VY(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 ZY.isDocument(t)&&!n?t.toString(r):new LY.Document(t,n,r).toString(r)}Wc.parse=UY;Wc.parseAllDocuments=FY;Wc.parseDocument=nA;Wc.stringify=VY});var Yc=S(Ne=>{"use strict";f();var BY=fw(),HY=Dc(),KY=Hb(),$w=Vc(),GY=kc(),as=Ee(),JY=rs(),WY=it(),YY=ss(),XY=os(),QY=Xf(),e7=xw(),t7=kw(),r7=Tw(),tp=sA(),oA=bc();Ne.Composer=BY.Composer;Ne.Document=HY.Document;Ne.Schema=KY.Schema;Ne.YAMLError=$w.YAMLError;Ne.YAMLParseError=$w.YAMLParseError;Ne.YAMLWarning=$w.YAMLWarning;Ne.Alias=GY.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=JY.Pair;Ne.Scalar=WY.Scalar;Ne.YAMLMap=YY.YAMLMap;Ne.YAMLSeq=XY.YAMLSeq;Ne.CST=QY;Ne.Lexer=e7.Lexer;Ne.LineCounter=t7.LineCounter;Ne.Parser=r7.Parser;Ne.parse=tp.parse;Ne.parseAllDocuments=tp.parseAllDocuments;Ne.parseDocument=tp.parseDocument;Ne.stringify=tp.stringify;Ne.visit=oA.visit;Ne.visitAsync=oA.visitAsync});var Xc=S(Nr=>{"use strict";f();var lA=":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",s7=lA+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",dA="["+lA+"]["+s7+"]*",o7=new RegExp("^"+dA+"$"),i7=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},a7=function(t){let e=o7.exec(t);return!(e===null||typeof e>"u")};Nr.isExist=function(t){return typeof t<"u"};Nr.isEmptyObject=function(t){return Object.keys(t).length===0};Nr.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]]}};Nr.getValue=function(t){return Nr.isExist(t)?t:""};var c7=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],u7=["__proto__","constructor","prototype"];Nr.isName=a7;Nr.getAllMatches=i7;Nr.nameRegexp=dA;Nr.DANGEROUS_PROPERTY_NAMES=c7;Nr.criticalProperties=u7});var Ow=S(gA=>{"use strict";f();var Pw=Xc(),l7={allowBooleanAttributes:!1,unpairedTags:[]};gA.validate=function(t,e){e=Object.assign({},l7,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=pA(t,o),o.err)return o}else if(t[o]==="<"){let i=o;if(o++,t[o]==="!"){o=hA(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
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,Pt(t,o))}let u=p7(t,o);if(u===!1)return ot("InvalidAttr","Attributes for '"+c+"' have open quote.",Pt(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=mA(l,e);if(p===!0)n=!0;else return ot(p.err.code,p.err.msg,Pt(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.",Pt(t,i));if(r.length===0)return ot("InvalidTag","Closing tag '"+c+"' has not been opened.",Pt(t,i));{let d=r.pop();if(c!==d.tagName){let p=Pt(t,d.tagStartPos);return ot("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+c+"'.",Pt(t,i))}r.length==0&&(s=!0)}}else return ot("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",Pt(t,o));else{let d=mA(l,e);if(d!==!0)return ot(d.err.code,d.err.msg,Pt(t,o-l.length+d.err.line));if(s===!0)return ot("InvalidXml","Multiple possible root nodes found.",Pt(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=hA(t,o);continue}else if(t[o+1]==="?"){if(o=pA(t,++o),o.err)return o}else break;else if(t[o]==="&"){let d=g7(t,o);if(d==-1)return ot("InvalidChar","char '&' is not expected.",Pt(t,o));o=d}else if(s===!0&&!fA(t[o]))return ot("InvalidXml","Extra text at the end",Pt(t,o));t[o]==="<"&&o--}}else{if(fA(t[o]))continue;return ot("InvalidChar","char '"+t[o]+"' is not expected.",Pt(t,o))}if(n){if(r.length==1)return ot("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",Pt(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 fA(t){return t===" "||t===" "||t===`
172
- `||t==="\r"}function pA(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 hA(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 d7='"',f7="'";function p7(t,e){let r="",n="",s=!1;for(;e<t.length;e++){if(t[e]===d7||t[e]===f7)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 h7=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function mA(t,e){let r=Pw.getAllMatches(t,h7),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.",Qc(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",Qc(r[s]));if(r[s][3]===void 0&&!e.allowBooleanAttributes)return ot("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",Qc(r[s]));let o=r[s][2];if(!y7(o))return ot("InvalidAttr","Attribute '"+o+"' is an invalid name.",Qc(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return ot("InvalidAttr","Attribute '"+o+"' is repeated.",Qc(r[s]))}return!0}function m7(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 g7(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,m7(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 y7(t){return Pw.isName(t)}function _7(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 Qc(t){return t.startIndex+t[1].length}});var wA=S(Cw=>{"use strict";f();var{DANGEROUS_PROPERTY_NAMES:yA,criticalProperties:v7}=Xc(),_A=t=>yA.includes(t)?"__"+t:t,vA={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:_A};function b7(t,e){if(typeof t!="string")return;let r=t.toLowerCase();if(yA.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(v7.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function bA(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}:bA(!0)}var w7=function(t){let e=Object.assign({},vA,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&&b7(n,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=_A),e.processEntities=bA(e.processEntities),e};Cw.buildOptions=w7;Cw.defaultOptions=vA});var SA=S((M_e,xA)=>{"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})}};xA.exports=Nw});var TA=S((q_e,EA)=>{"use strict";f();var kA=Xc(),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(eu(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&&eu(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&&!kA.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++;eu(n),r=Vt(e,r);let s="";for(;r<e.length&&!/\s/.test(e[r]);)s+=e[r],r++;if(!eu(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(),!eu(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 eu(t){if(kA.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}EA.exports=Aw});var IA=S((D_e,$A)=>{"use strict";f();var x7=/^[-+]?0x[a-fA-F0-9]+$/,S7=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,k7={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function E7(t,e={}){if(e=Object.assign({},k7,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&&x7.test(r))return $7(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=S7.exec(r);if(n){let s=n[1],o=n[2],i=T7(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 T7(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 $7(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")}$A.exports=E7});var Rw=S((U_e,PA)=>{"use strict";f();function I7(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}PA.exports=I7});var NA=S((B_e,CA)=>{"use strict";f();var rp=Xc(),Bi=SA(),P7=TA(),O7=IA(),C7=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)=>OA(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>OA(n,16,"&#x")}},this.addExternalEntities=N7,this.parseXml=M7,this.parseTextData=A7,this.resolveNameSpace=R7,this.buildAttributesMap=z7,this.isItStopNode=D7,this.replaceEntitiesValue=q7,this.readStopNodeData=U7,this.saveTextToParentTag=Z7,this.addChild=L7,this.ignoreAttributesFn=C7(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 N7(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 A7(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 R7(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 j7=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,j7),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=V7(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 M7=function(t){t=t.replace(/\r\n?/g,`
173
- `);let e=new Bi("!xml"),r=e,n="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;let o=new P7(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 Bi(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 y=this.options.transformTagName(u);d===u&&(d=y),u=y}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 y="";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,y=w.tagContent}let b=new Bi(u);u!==d&&p&&(b[":@"]=this.buildAttributesMap(d,s,u)),y&&(y=this.parseTextData(y,u,s,!0,p,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),b.add(this.options.textNodeName,y),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 y=new Bi(u);u!==d&&p&&(y[":@"]=this.buildAttributesMap(d,s,u)),this.addChild(r,y,s,m),s=s.substr(0,s.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(u)!==-1){let y=new Bi(u);u!==d&&p&&(y[":@"]=this.buildAttributesMap(d,s)),this.addChild(r,y,s,m),s=s.substr(0,s.lastIndexOf(".")),i=c.closeIndex;continue}else{let y=new Bi(u);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),u!==d&&p&&(y[":@"]=this.buildAttributesMap(d,s,u)),this.addChild(r,y,s),r=y}n="",i=g}}else n+=t[i];return e.child};function L7(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 q7=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 Z7(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 D7(t,e,r,n){return!!(e&&e.has(n)||t&&t.has(r))}function F7(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=F7(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 U7(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:O7(t,r)}else return rp.isExist(t)?t:""}function OA(t,e,r){let n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):r+t+";"}function V7(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}CA.exports=jw});var jA=S(RA=>{"use strict";f();function B7(t,e){return AA(t,e)}function AA(t,e,r){let n,s={};for(let o=0;o<t.length;o++){let i=t[o],a=H7(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=AA(i[a],e,c),l=G7(u,e);i[":@"]?K7(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 H7(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function K7(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 G7(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))}RA.prettify=B7});var MA=S((J_e,zA)=>{"use strict";f();var{buildOptions:J7}=wA(),W7=NA(),{prettify:Y7}=jA(),X7=Ow(),Lw=class{constructor(e){this.externalEntities={},this.options=J7(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=X7.validate(e,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let n=new W7(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(e);return this.options.preserveOrder||s===void 0?s:Y7(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 '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};zA.exports=Lw});var DA=S((Y_e,ZA)=>{"use strict";f();function Q7(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=`
174
- `),qA(t,e,"",r)}function qA(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=eX(a);if(c===void 0)continue;let u="";if(r.length===0?u=c:u=`${r}.${c}`,c===e.textNodeName){let h=a[c];tX(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=LA(a[":@"],e),m=c==="?xml"?"":n,y=a[c][0][e.textNodeName];y=y.length!==0?" "+y:"",s+=m+`<${c}${y}${h}?>`,o=!0;continue}let l=n;l!==""&&(l+=e.indentBy);let d=LA(a[":@"],e),p=n+`<${c}${d}`,g=qA(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 eX(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 LA(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 tX(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}ZA.exports=Q7});var UA=S((Q_e,FA)=>{"use strict";f();var rX=DA(),nX=Rw(),sX={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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function cs(t){this.options=Object.assign({},sX,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=nX(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=aX),this.processTextOrObjNode=oX,this.options.format?(this.indentate=iX,this.tagEndChar=`>
172
+ `||t==="\r"}function pA(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 hA(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 d7='"',f7="'";function p7(t,e){let r="",n="",s=!1;for(;e<t.length;e++){if(t[e]===d7||t[e]===f7)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 h7=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function mA(t,e){let r=Pw.getAllMatches(t,h7),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.",Qc(r[s]));if(r[s][3]!==void 0&&r[s][4]===void 0)return ot("InvalidAttr","Attribute '"+r[s][2]+"' is without value.",Qc(r[s]));if(r[s][3]===void 0&&!e.allowBooleanAttributes)return ot("InvalidAttr","boolean attribute '"+r[s][2]+"' is not allowed.",Qc(r[s]));let o=r[s][2];if(!y7(o))return ot("InvalidAttr","Attribute '"+o+"' is an invalid name.",Qc(r[s]));if(!n.hasOwnProperty(o))n[o]=1;else return ot("InvalidAttr","Attribute '"+o+"' is repeated.",Qc(r[s]))}return!0}function m7(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 g7(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,m7(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 y7(t){return Pw.isName(t)}function _7(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 Qc(t){return t.startIndex+t[1].length}});var wA=S(Cw=>{"use strict";f();var{DANGEROUS_PROPERTY_NAMES:yA,criticalProperties:v7}=Xc(),_A=t=>yA.includes(t)?"__"+t:t,vA={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:_A};function b7(t,e){if(typeof t!="string")return;let r=t.toLowerCase();if(yA.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(v7.some(n=>r===n.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function bA(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}:bA(!0)}var w7=function(t){let e=Object.assign({},vA,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&&b7(n,s);return e.onDangerousProperty===null&&(e.onDangerousProperty=_A),e.processEntities=bA(e.processEntities),e};Cw.buildOptions=w7;Cw.defaultOptions=vA});var SA=S((L_e,xA)=>{"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})}};xA.exports=Nw});var TA=S((Z_e,EA)=>{"use strict";f();var kA=Xc(),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(eu(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&&eu(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&&!kA.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++;eu(n),r=Vt(e,r);let s="";for(;r<e.length&&!/\s/.test(e[r]);)s+=e[r],r++;if(!eu(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(),!eu(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 eu(t){if(kA.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}EA.exports=Aw});var IA=S((F_e,$A)=>{"use strict";f();var x7=/^[-+]?0x[a-fA-F0-9]+$/,S7=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,k7={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function E7(t,e={}){if(e=Object.assign({},k7,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&&x7.test(r))return $7(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=S7.exec(r);if(n){let s=n[1],o=n[2],i=T7(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 T7(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 $7(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")}$A.exports=E7});var Rw=S((V_e,PA)=>{"use strict";f();function I7(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}PA.exports=I7});var NA=S((H_e,CA)=>{"use strict";f();var rp=Xc(),Bi=SA(),P7=TA(),O7=IA(),C7=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)=>OA(n,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>OA(n,16,"&#x")}},this.addExternalEntities=N7,this.parseXml=M7,this.parseTextData=A7,this.resolveNameSpace=R7,this.buildAttributesMap=z7,this.isItStopNode=D7,this.replaceEntitiesValue=q7,this.readStopNodeData=U7,this.saveTextToParentTag=Z7,this.addChild=L7,this.ignoreAttributesFn=C7(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 N7(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 A7(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 R7(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 j7=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,j7),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=V7(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 M7=function(t){t=t.replace(/\r\n?/g,`
173
+ `);let e=new Bi("!xml"),r=e,n="",s="";this.entityExpansionCount=0,this.currentExpandedLength=0;let o=new P7(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 Bi(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 y=this.options.transformTagName(u);d===u&&(d=y),u=y}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 y="";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,y=w.tagContent}let b=new Bi(u);u!==d&&p&&(b[":@"]=this.buildAttributesMap(d,s,u)),y&&(y=this.parseTextData(y,u,s,!0,p,!0,!0)),s=s.substr(0,s.lastIndexOf(".")),b.add(this.options.textNodeName,y),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 y=new Bi(u);u!==d&&p&&(y[":@"]=this.buildAttributesMap(d,s,u)),this.addChild(r,y,s,m),s=s.substr(0,s.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(u)!==-1){let y=new Bi(u);u!==d&&p&&(y[":@"]=this.buildAttributesMap(d,s)),this.addChild(r,y,s,m),s=s.substr(0,s.lastIndexOf(".")),i=c.closeIndex;continue}else{let y=new Bi(u);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(r),u!==d&&p&&(y[":@"]=this.buildAttributesMap(d,s,u)),this.addChild(r,y,s),r=y}n="",i=g}}else n+=t[i];return e.child};function L7(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 q7=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 Z7(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 D7(t,e,r,n){return!!(e&&e.has(n)||t&&t.has(r))}function F7(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=F7(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 U7(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:O7(t,r)}else return rp.isExist(t)?t:""}function OA(t,e,r){let n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):r+t+";"}function V7(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}CA.exports=jw});var jA=S(RA=>{"use strict";f();function B7(t,e){return AA(t,e)}function AA(t,e,r){let n,s={};for(let o=0;o<t.length;o++){let i=t[o],a=H7(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=AA(i[a],e,c),l=G7(u,e);i[":@"]?K7(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 H7(t){let e=Object.keys(t);for(let r=0;r<e.length;r++){let n=e[r];if(n!==":@")return n}}function K7(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 G7(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))}RA.prettify=B7});var MA=S((W_e,zA)=>{"use strict";f();var{buildOptions:J7}=wA(),W7=NA(),{prettify:Y7}=jA(),X7=Ow(),Lw=class{constructor(e){this.externalEntities={},this.options=J7(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=X7.validate(e,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}let n=new W7(this.options);n.addExternalEntities(this.externalEntities);let s=n.parseXml(e);return this.options.preserveOrder||s===void 0?s:Y7(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 '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};zA.exports=Lw});var DA=S((X_e,ZA)=>{"use strict";f();function Q7(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=`
174
+ `),qA(t,e,"",r)}function qA(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=eX(a);if(c===void 0)continue;let u="";if(r.length===0?u=c:u=`${r}.${c}`,c===e.textNodeName){let h=a[c];tX(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=LA(a[":@"],e),m=c==="?xml"?"":n,y=a[c][0][e.textNodeName];y=y.length!==0?" "+y:"",s+=m+`<${c}${y}${h}?>`,o=!0;continue}let l=n;l!==""&&(l+=e.indentBy);let d=LA(a[":@"],e),p=n+`<${c}${d}`,g=qA(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 eX(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 LA(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 tX(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}ZA.exports=Q7});var UA=S((eve,FA)=>{"use strict";f();var rX=DA(),nX=Rw(),sX={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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function cs(t){this.options=Object.assign({},sX,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=nX(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=aX),this.processTextOrObjNode=oX,this.options.format?(this.indentate=iX,this.tagEndChar=`>
175
175
  `,this.newLine=`
176
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}cs.prototype.build=function(t){return this.options.preserveOrder?rX(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 oX(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 iX(t){return this.options.indentBy.repeat(t)}function aX(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}FA.exports=cs});var tu=S((tve,VA)=>{"use strict";f();var cX=Ow(),uX=MA(),lX=UA();VA.exports={XMLParser:uX,XMLValidator:cX,XMLBuilder:lX}});f();f();f();f();f();var R={};kp(R,{BRAND:()=>Iz,DIRTY:()=>ls,EMPTY_PATH:()=>iz,INVALID:()=>re,NEVER:()=>dM,OK:()=>bt,ParseStatus:()=>ft,Schema:()=>he,ZodAny:()=>Sn,ZodArray:()=>sn,ZodBigInt:()=>fs,ZodBoolean:()=>ps,ZodBranded:()=>Qi,ZodCatch:()=>ks,ZodDate:()=>hs,ZodDefault:()=>Ss,ZodDiscriminatedUnion:()=>fu,ZodEffects:()=>Xt,ZodEnum:()=>ws,ZodError:()=>Ot,ZodFirstPartyTypeKind:()=>M,ZodFunction:()=>hu,ZodIntersection:()=>_s,ZodIssueCode:()=>j,ZodLazy:()=>vs,ZodLiteral:()=>bs,ZodMap:()=>zo,ZodNaN:()=>Lo,ZodNativeEnum:()=>xs,ZodNever:()=>gr,ZodNull:()=>gs,ZodNullable:()=>jr,ZodNumber:()=>ds,ZodObject:()=>Nt,ZodOptional:()=>Ct,ZodParsedType:()=>H,ZodPipeline:()=>ea,ZodPromise:()=>kn,ZodReadonly:()=>Es,ZodRecord:()=>pu,ZodSchema:()=>he,ZodSet:()=>Mo,ZodString:()=>xn,ZodSymbol:()=>Ro,ZodTransformer:()=>Xt,ZodTuple:()=>Rr,ZodType:()=>he,ZodUndefined:()=>ms,ZodUnion:()=>ys,ZodUnknown:()=>nn,ZodVoid:()=>jo,addIssueToContext:()=>B,any:()=>Mz,array:()=>Dz,bigint:()=>Nz,boolean:()=>C0,coerce:()=>lM,custom:()=>I0,date:()=>Az,datetimeRegex:()=>T0,defaultErrorMap:()=>tn,discriminatedUnion:()=>Vz,effect:()=>rM,enum:()=>Qz,function:()=>Wz,getErrorMap:()=>Co,getParsedType:()=>Ar,instanceof:()=>Oz,intersection:()=>Bz,isAborted:()=>lu,isAsync:()=>No,isDirty:()=>du,isValid:()=>wn,late:()=>Pz,lazy:()=>Yz,literal:()=>Xz,makeIssue:()=>Xi,map:()=>Gz,nan:()=>Cz,nativeEnum:()=>eM,never:()=>qz,null:()=>zz,nullable:()=>sM,number:()=>O0,object:()=>Ip,objectUtil:()=>Ep,oboolean:()=>uM,onumber:()=>cM,optional:()=>nM,ostring:()=>aM,pipeline:()=>iM,preprocess:()=>oM,promise:()=>tM,quotelessJson:()=>nz,record:()=>Kz,set:()=>Jz,setErrorMap:()=>oz,strictObject:()=>Fz,string:()=>P0,symbol:()=>Rz,transformer:()=>rM,tuple:()=>Hz,undefined:()=>jz,union:()=>Uz,unknown:()=>Lz,util:()=>_e,void:()=>Zz});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"]),Ar=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"]),nz=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 sz=(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=sz;var w0=tn;function oz(t){w0=t}function Co(){return w0}f();var Xi=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}},iz=[];function B(t,e){let r=Co(),n=Xi({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}),lu=t=>t.status==="aborted",du=t=>t.status==="dirty",wn=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}},x0=(t,e)=>{if(wn(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 Ar(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ar(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:Ar(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:Ar(e)},s=this._parseSync({data:e,path:n.path,parent:n});return x0(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ar(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return wn(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=>wn(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:Ar(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(No(s)?s:Promise.resolve(s));return x0(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 jr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return kn.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 Qi({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 ea.create(this,e)}readonly(){return Es.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},az=/^c[^\s-]{8,}$/i,cz=/^[0-9a-z]+$/,uz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lz=/^[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,dz=/^[a-z0-9_-]{21}$/i,fz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pz=/^[-+]?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)?)??$/,hz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tp,gz=/^(?:(?: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])$/,yz=/^(?:(?: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]))$/,vz=/^(([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])$/,bz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k0="((\\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])))",xz=new RegExp(`^${k0}$`);function E0(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 Sz(t){return new RegExp(`^${E0(t)}$`)}function T0(t){let e=`${k0}T${E0(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 kz(t,e){return!!((e==="v4"||!e)&&gz.test(t)||(e==="v6"||!e)&&_z.test(t))}function Ez(t,e){if(!fz.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 Tz(t,e){return!!((e==="v4"||!e)&&yz.test(t)||(e==="v6"||!e)&&vz.test(t))}var xn=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")hz.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(mz,"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")lz.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")dz.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")az.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")cz.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")uz.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"?T0(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"?xz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Sz(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"?pz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"duration",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?kz(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"?Ez(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"?Tz(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"?bz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"base64",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?wz.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}};xn.create=t=>new xn({checks:[],typeName:M.ZodString,coerce:t?.coerce??!1,...ce(t)});function $z(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"?$z(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 Sn=class extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return bt(e.data)}};Sn.create=t=>new Sn({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 gr=class extends he{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:j.invalid_type,expected:H.never,received:r.parsedType}),re}};gr.create=t=>new gr({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 jr?jr.create(Ao(t.unwrap())):t instanceof Rr?Rr.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 gr&&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 gr){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 $0(_e.objectKeys(this.shape))}};Nt.create=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strip",catchall:gr.create(),typeName:M.ZodObject,...ce(e)});Nt.strictCreate=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strict",catchall:gr.create(),typeName:M.ZodObject,...ce(e)});Nt.lazycreate=(t,e)=>new Nt({shape:t,unknownKeys:"strip",catchall:gr.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 jr?[null,...rn(t.unwrap())]:t instanceof Qi||t instanceof Es?rn(t.unwrap()):t instanceof ks?rn(t._def.innerType):[],fu=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=Ar(t),n=Ar(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(lu(o)||lu(i))return re;let a=$p(o.value,i.value);return a.valid?((du(o)||du(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 Rr=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})}};Rr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Rr({items:t,typeName:M.ZodTuple,rest:null,...ce(e)})};var pu=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:xn.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 hu=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 Xi({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 Xi({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 kn){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:Rr.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||Rr.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 $0(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=$0;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 kn=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})))}};kn.create=(t,e)=>new kn({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(!wn(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=>wn(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 jr=class extends he{_parse(e){return this._getType(e)===H.null?bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jr.create=(t,e)=>new jr({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 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 Iz=Symbol("zod_brand"),Qi=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}},ea=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=>(wn(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 S0(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function I0(t,e={},r){return t?Sn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=S0(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=S0(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):Sn.create()}var Pz={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 Oz=(t,e={message:`Input not instance of ${t.name}`})=>I0(r=>r instanceof t,e),P0=xn.create,O0=ds.create,Cz=Lo.create,Nz=fs.create,C0=ps.create,Az=hs.create,Rz=Ro.create,jz=ms.create,zz=gs.create,Mz=Sn.create,Lz=nn.create,qz=gr.create,Zz=jo.create,Dz=sn.create,Ip=Nt.create,Fz=Nt.strictCreate,Uz=ys.create,Vz=fu.create,Bz=_s.create,Hz=Rr.create,Kz=pu.create,Gz=zo.create,Jz=Mo.create,Wz=hu.create,Yz=vs.create,Xz=bs.create,Qz=ws.create,eM=xs.create,tM=kn.create,rM=Xt.create,nM=Ct.create,sM=jr.create,oM=Xt.createWithPreprocess,iM=ea.create,aM=()=>P0().optional(),cM=()=>O0().optional(),uM=()=>C0().optional(),lM={string:(t=>xn.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 dM=re;f();f();f();var fM=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.")}},mu={};function Bt(t){return t&&Object.assign(mu,t),mu}f();f();var ve={};kp(ve,{BIGINT_FORMAT_RANGES:()=>A0,Class:()=>Op,NUMBER_FORMAT_RANGES:()=>Mp,aborted:()=>$s,allowsEval:()=>Rp,assert:()=>yM,assertEqual:()=>pM,assertIs:()=>mM,assertNever:()=>gM,assertNotEqual:()=>hM,assignProp:()=>Ap,cached:()=>na,captureStackTrace:()=>yu,cleanEnum:()=>OM,cleanRegex:()=>oa,clone:()=>Ht,createTransparentProxy:()=>SM,defineLazy:()=>Le,esc:()=>Ts,escapeRegex:()=>En,extend:()=>TM,finalizeIssue:()=>yr,floatSafeRemainder:()=>Np,getElementAtPath:()=>_M,getEnumValues:()=>ra,getLengthableOrigin:()=>ia,getParsedType:()=>xM,getSizableOrigin:()=>R0,isObject:()=>qo,isPlainObject:()=>Zo,issue:()=>Lp,joinValues:()=>gu,jsonStringifyReplacer:()=>Cp,merge:()=>$M,normalizeParams:()=>ne,nullish:()=>sa,numKeys:()=>wM,omit:()=>EM,optionalKeys:()=>zp,partial:()=>IM,pick:()=>kM,prefixIssues:()=>zr,primitiveTypes:()=>N0,promiseAllObject:()=>vM,propertyKeyTypes:()=>jp,randomString:()=>bM,required:()=>PM,stringifyPrimitive:()=>_u,unwrapMessage:()=>ta});f();function pM(t){return t}function hM(t){return t}function mM(t){}function gM(t){throw new Error}function yM(t){}function ra(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 gu(t,e="|"){return t.map(r=>_u(r)).join(e)}function Cp(t,e){return typeof e=="bigint"?e.toString():e}function na(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function sa(t){return t==null}function oa(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 vM(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 bM(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 yu=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function qo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Rp=na(()=>{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 wM(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var xM=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 En(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 SM(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 _u(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]},A0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kM(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 EM(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 TM(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 $M(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 IM(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 PM(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 zr(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function ta(t){return typeof t=="string"?t:t?.message}function yr(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let s=ta(t.inst?._zod.def?.error?.(t))??ta(e?.error?.(t))??ta(r.customError?.(t))??ta(r.localeError?.(t))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function R0(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function ia(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 OM(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Op=class{constructor(...e){}};var j0=(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})},vu=O("$ZodError",j0),aa=O("$ZodError",j0,{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=>yr(c,o,Bt())));throw yu(a,s?.callee),a}return i.value},Fp=Dp(aa),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=>yr(c,o,Bt())));throw yu(a,s?.callee),a}return i.value},Vp=Up(aa),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??vu)(o.issues.map(i=>yr(i,s,Bt())))}:{success:!0,data:o.value}},Is=Bp(aa),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=>yr(i,s,Bt())))}:{success:!0,data:o.value}},Ps=Hp(aa);f();f();f();var z0=/^[cC][^\s-]{8,}$/,M0=/^[0-9a-z]+$/,L0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,q0=/^[0-9a-vA-V]{20}$/,Z0=/^[A-Za-z0-9]{27}$/,D0=/^[a-zA-Z0-9_-]{21}$/,F0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var U0=/^([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 V0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var NM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function B0(){return new RegExp(NM,"u")}var H0=/^(?:(?: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])$/,K0=/^(([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})$/,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])\/([0-9]|[1-2][0-9]|3[0-2])$/,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})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,W0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gp=/^[A-Za-z0-9_-]*$/,Y0=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var X0=/^\+(?:[0-9]){6,14}[0-9]$/,Q0="(?:(?:\\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])))",ex=new RegExp(`^${Q0}$`);function tx(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 rx(t){return new RegExp(`^${tx(t)}$`)}function nx(t){let e=tx({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(`^${Q0}T(?:${n})$`)}var sx=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var ox=/^\d+$/,ix=/^-?\d+(?:\.\d+)?/i,ax=/true|false/i,cx=/null/i;var ux=/^[^A-Z]*$/,lx=/^[^a-z]*$/;var pt=O("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),dx={number:"number",bigint:"bigint",object:"date"},Jp=O("$ZodCheckLessThan",(t,e)=>{pt.init(t,e);let r=dx[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=dx[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})}}),fx=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):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})}}),px=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=ox)}),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 hx=O("$ZodCheckMaxLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!sa(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=ia(s);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),mx=O("$ZodCheckMinLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!sa(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=ia(s);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),gx=O("$ZodCheckLengthEquals",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!sa(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=ia(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})}}),ca=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=()=>{})}),yx=O("$ZodCheckRegex",(t,e)=>{ca.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})}}),_x=O("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=ux),ca.init(t,e)}),vx=O("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=lx),ca.init(t,e)}),bx=O("$ZodCheckIncludes",(t,e)=>{pt.init(t,e);let r=En(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})}}),wx=O("$ZodCheckStartsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`^${En(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})}}),xx=O("$ZodCheckEndsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`.*${En(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 Sx=O("$ZodCheckOverwrite",(t,e)=>{pt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});f();var wu=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?rX(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 oX(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 iX(t){return this.options.indentBy.repeat(t)}function aX(t){return t.startsWith(this.options.attributeNamePrefix)&&t!==this.options.textNodeName?t.substr(this.attrPrefixLen):!1}FA.exports=cs});var tu=S((rve,VA)=>{"use strict";f();var cX=Ow(),uX=MA(),lX=UA();VA.exports={XMLParser:uX,XMLValidator:cX,XMLBuilder:lX}});f();f();f();f();f();var R={};kp(R,{BRAND:()=>Iz,DIRTY:()=>ls,EMPTY_PATH:()=>iz,INVALID:()=>re,NEVER:()=>dM,OK:()=>bt,ParseStatus:()=>ft,Schema:()=>he,ZodAny:()=>Sn,ZodArray:()=>sn,ZodBigInt:()=>fs,ZodBoolean:()=>ps,ZodBranded:()=>Qi,ZodCatch:()=>ks,ZodDate:()=>hs,ZodDefault:()=>Ss,ZodDiscriminatedUnion:()=>fu,ZodEffects:()=>Xt,ZodEnum:()=>ws,ZodError:()=>Ot,ZodFirstPartyTypeKind:()=>M,ZodFunction:()=>hu,ZodIntersection:()=>_s,ZodIssueCode:()=>j,ZodLazy:()=>vs,ZodLiteral:()=>bs,ZodMap:()=>zo,ZodNaN:()=>Lo,ZodNativeEnum:()=>xs,ZodNever:()=>gr,ZodNull:()=>gs,ZodNullable:()=>jr,ZodNumber:()=>ds,ZodObject:()=>Nt,ZodOptional:()=>Ct,ZodParsedType:()=>H,ZodPipeline:()=>ea,ZodPromise:()=>kn,ZodReadonly:()=>Es,ZodRecord:()=>pu,ZodSchema:()=>he,ZodSet:()=>Mo,ZodString:()=>xn,ZodSymbol:()=>Ro,ZodTransformer:()=>Xt,ZodTuple:()=>Rr,ZodType:()=>he,ZodUndefined:()=>ms,ZodUnion:()=>ys,ZodUnknown:()=>nn,ZodVoid:()=>jo,addIssueToContext:()=>B,any:()=>Mz,array:()=>Dz,bigint:()=>Nz,boolean:()=>C0,coerce:()=>lM,custom:()=>I0,date:()=>Az,datetimeRegex:()=>T0,defaultErrorMap:()=>tn,discriminatedUnion:()=>Vz,effect:()=>rM,enum:()=>Qz,function:()=>Wz,getErrorMap:()=>Co,getParsedType:()=>Ar,instanceof:()=>Oz,intersection:()=>Bz,isAborted:()=>lu,isAsync:()=>No,isDirty:()=>du,isValid:()=>wn,late:()=>Pz,lazy:()=>Yz,literal:()=>Xz,makeIssue:()=>Xi,map:()=>Gz,nan:()=>Cz,nativeEnum:()=>eM,never:()=>qz,null:()=>zz,nullable:()=>sM,number:()=>O0,object:()=>Ip,objectUtil:()=>Ep,oboolean:()=>uM,onumber:()=>cM,optional:()=>nM,ostring:()=>aM,pipeline:()=>iM,preprocess:()=>oM,promise:()=>tM,quotelessJson:()=>nz,record:()=>Kz,set:()=>Jz,setErrorMap:()=>oz,strictObject:()=>Fz,string:()=>P0,symbol:()=>Rz,transformer:()=>rM,tuple:()=>Hz,undefined:()=>jz,union:()=>Uz,unknown:()=>Lz,util:()=>_e,void:()=>Zz});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"]),Ar=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"]),nz=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 sz=(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=sz;var w0=tn;function oz(t){w0=t}function Co(){return w0}f();var Xi=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}},iz=[];function B(t,e){let r=Co(),n=Xi({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}),lu=t=>t.status==="aborted",du=t=>t.status==="dirty",wn=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}},x0=(t,e)=>{if(wn(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 Ar(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ar(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:Ar(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:Ar(e)},s=this._parseSync({data:e,path:n.path,parent:n});return x0(n,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ar(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return wn(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=>wn(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:Ar(e)},s=this._parse({data:e,path:n.path,parent:n}),o=await(No(s)?s:Promise.resolve(s));return x0(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 jr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return sn.create(this)}promise(){return kn.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 Qi({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 ea.create(this,e)}readonly(){return Es.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},az=/^c[^\s-]{8,}$/i,cz=/^[0-9a-z]+$/,uz=/^[0-9A-HJKMNP-TV-Z]{26}$/i,lz=/^[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,dz=/^[a-z0-9_-]{21}$/i,fz=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,pz=/^[-+]?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)?)??$/,hz=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,mz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Tp,gz=/^(?:(?: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])$/,yz=/^(?:(?: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]))$/,vz=/^(([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])$/,bz=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wz=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k0="((\\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])))",xz=new RegExp(`^${k0}$`);function E0(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 Sz(t){return new RegExp(`^${E0(t)}$`)}function T0(t){let e=`${k0}T${E0(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 kz(t,e){return!!((e==="v4"||!e)&&gz.test(t)||(e==="v6"||!e)&&_z.test(t))}function Ez(t,e){if(!fz.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 Tz(t,e){return!!((e==="v4"||!e)&&yz.test(t)||(e==="v6"||!e)&&vz.test(t))}var xn=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")hz.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(mz,"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")lz.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")dz.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")az.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")cz.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")uz.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"?T0(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"?xz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{code:j.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?Sz(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"?pz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"duration",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?kz(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"?Ez(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"?Tz(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"?bz.test(e.data)||(s=this._getOrReturnCtx(e,s),B(s,{validation:"base64",code:j.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?wz.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}};xn.create=t=>new xn({checks:[],typeName:M.ZodString,coerce:t?.coerce??!1,...ce(t)});function $z(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"?$z(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 Sn=class extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return bt(e.data)}};Sn.create=t=>new Sn({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 gr=class extends he{_parse(e){let r=this._getOrReturnCtx(e);return B(r,{code:j.invalid_type,expected:H.never,received:r.parsedType}),re}};gr.create=t=>new gr({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 jr?jr.create(Ao(t.unwrap())):t instanceof Rr?Rr.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 gr&&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 gr){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 $0(_e.objectKeys(this.shape))}};Nt.create=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strip",catchall:gr.create(),typeName:M.ZodObject,...ce(e)});Nt.strictCreate=(t,e)=>new Nt({shape:()=>t,unknownKeys:"strict",catchall:gr.create(),typeName:M.ZodObject,...ce(e)});Nt.lazycreate=(t,e)=>new Nt({shape:t,unknownKeys:"strip",catchall:gr.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 jr?[null,...rn(t.unwrap())]:t instanceof Qi||t instanceof Es?rn(t.unwrap()):t instanceof ks?rn(t._def.innerType):[],fu=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=Ar(t),n=Ar(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(lu(o)||lu(i))return re;let a=$p(o.value,i.value);return a.valid?((du(o)||du(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 Rr=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})}};Rr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Rr({items:t,typeName:M.ZodTuple,rest:null,...ce(e)})};var pu=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:xn.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 hu=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 Xi({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 Xi({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 kn){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:Rr.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||Rr.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 $0(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=$0;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 kn=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})))}};kn.create=(t,e)=>new kn({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(!wn(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=>wn(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 jr=class extends he{_parse(e){return this._getType(e)===H.null?bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jr.create=(t,e)=>new jr({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 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 Iz=Symbol("zod_brand"),Qi=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}},ea=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=>(wn(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 S0(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function I0(t,e={},r){return t?Sn.create().superRefine((n,s)=>{let o=t(n);if(o instanceof Promise)return o.then(i=>{if(!i){let a=S0(e,n),c=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:c})}});if(!o){let i=S0(e,n),a=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:a})}}):Sn.create()}var Pz={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 Oz=(t,e={message:`Input not instance of ${t.name}`})=>I0(r=>r instanceof t,e),P0=xn.create,O0=ds.create,Cz=Lo.create,Nz=fs.create,C0=ps.create,Az=hs.create,Rz=Ro.create,jz=ms.create,zz=gs.create,Mz=Sn.create,Lz=nn.create,qz=gr.create,Zz=jo.create,Dz=sn.create,Ip=Nt.create,Fz=Nt.strictCreate,Uz=ys.create,Vz=fu.create,Bz=_s.create,Hz=Rr.create,Kz=pu.create,Gz=zo.create,Jz=Mo.create,Wz=hu.create,Yz=vs.create,Xz=bs.create,Qz=ws.create,eM=xs.create,tM=kn.create,rM=Xt.create,nM=Ct.create,sM=jr.create,oM=Xt.createWithPreprocess,iM=ea.create,aM=()=>P0().optional(),cM=()=>O0().optional(),uM=()=>C0().optional(),lM={string:(t=>xn.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 dM=re;f();f();f();var fM=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.")}},mu={};function Bt(t){return t&&Object.assign(mu,t),mu}f();f();var ve={};kp(ve,{BIGINT_FORMAT_RANGES:()=>A0,Class:()=>Op,NUMBER_FORMAT_RANGES:()=>Mp,aborted:()=>$s,allowsEval:()=>Rp,assert:()=>yM,assertEqual:()=>pM,assertIs:()=>mM,assertNever:()=>gM,assertNotEqual:()=>hM,assignProp:()=>Ap,cached:()=>na,captureStackTrace:()=>yu,cleanEnum:()=>OM,cleanRegex:()=>oa,clone:()=>Ht,createTransparentProxy:()=>SM,defineLazy:()=>Le,esc:()=>Ts,escapeRegex:()=>En,extend:()=>TM,finalizeIssue:()=>yr,floatSafeRemainder:()=>Np,getElementAtPath:()=>_M,getEnumValues:()=>ra,getLengthableOrigin:()=>ia,getParsedType:()=>xM,getSizableOrigin:()=>R0,isObject:()=>qo,isPlainObject:()=>Zo,issue:()=>Lp,joinValues:()=>gu,jsonStringifyReplacer:()=>Cp,merge:()=>$M,normalizeParams:()=>ne,nullish:()=>sa,numKeys:()=>wM,omit:()=>EM,optionalKeys:()=>zp,partial:()=>IM,pick:()=>kM,prefixIssues:()=>zr,primitiveTypes:()=>N0,promiseAllObject:()=>vM,propertyKeyTypes:()=>jp,randomString:()=>bM,required:()=>PM,stringifyPrimitive:()=>_u,unwrapMessage:()=>ta});f();function pM(t){return t}function hM(t){return t}function mM(t){}function gM(t){throw new Error}function yM(t){}function ra(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 gu(t,e="|"){return t.map(r=>_u(r)).join(e)}function Cp(t,e){return typeof e=="bigint"?e.toString():e}function na(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function sa(t){return t==null}function oa(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 vM(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 bM(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 yu=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function qo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Rp=na(()=>{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 wM(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var xM=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 En(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 SM(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 _u(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]},A0={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kM(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 EM(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 TM(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 $M(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 IM(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 PM(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 zr(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function ta(t){return typeof t=="string"?t:t?.message}function yr(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let s=ta(t.inst?._zod.def?.error?.(t))??ta(e?.error?.(t))??ta(r.customError?.(t))??ta(r.localeError?.(t))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function R0(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function ia(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 OM(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Op=class{constructor(...e){}};var j0=(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})},vu=O("$ZodError",j0),aa=O("$ZodError",j0,{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=>yr(c,o,Bt())));throw yu(a,s?.callee),a}return i.value},Fp=Dp(aa),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=>yr(c,o,Bt())));throw yu(a,s?.callee),a}return i.value},Vp=Up(aa),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??vu)(o.issues.map(i=>yr(i,s,Bt())))}:{success:!0,data:o.value}},Is=Bp(aa),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=>yr(i,s,Bt())))}:{success:!0,data:o.value}},Ps=Hp(aa);f();f();f();var z0=/^[cC][^\s-]{8,}$/,M0=/^[0-9a-z]+$/,L0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,q0=/^[0-9a-vA-V]{20}$/,Z0=/^[A-Za-z0-9]{27}$/,D0=/^[a-zA-Z0-9_-]{21}$/,F0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var U0=/^([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 V0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var NM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function B0(){return new RegExp(NM,"u")}var H0=/^(?:(?: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])$/,K0=/^(([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})$/,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])\/([0-9]|[1-2][0-9]|3[0-2])$/,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})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,W0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gp=/^[A-Za-z0-9_-]*$/,Y0=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var X0=/^\+(?:[0-9]){6,14}[0-9]$/,Q0="(?:(?:\\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])))",ex=new RegExp(`^${Q0}$`);function tx(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 rx(t){return new RegExp(`^${tx(t)}$`)}function nx(t){let e=tx({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(`^${Q0}T(?:${n})$`)}var sx=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var ox=/^\d+$/,ix=/^-?\d+(?:\.\d+)?/i,ax=/true|false/i,cx=/null/i;var ux=/^[^A-Z]*$/,lx=/^[^a-z]*$/;var pt=O("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),dx={number:"number",bigint:"bigint",object:"date"},Jp=O("$ZodCheckLessThan",(t,e)=>{pt.init(t,e);let r=dx[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=dx[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})}}),fx=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):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})}}),px=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=ox)}),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 hx=O("$ZodCheckMaxLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!sa(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=ia(s);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),mx=O("$ZodCheckMinLength",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!sa(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=ia(s);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:s,inst:t,continue:!e.abort})}}),gx=O("$ZodCheckLengthEquals",(t,e)=>{var r;pt.init(t,e),(r=t._zod.def).when??(r.when=n=>{let s=n.value;return!sa(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=ia(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})}}),ca=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=()=>{})}),yx=O("$ZodCheckRegex",(t,e)=>{ca.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})}}),_x=O("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=ux),ca.init(t,e)}),vx=O("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=lx),ca.init(t,e)}),bx=O("$ZodCheckIncludes",(t,e)=>{pt.init(t,e);let r=En(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})}}),wx=O("$ZodCheckStartsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`^${En(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})}}),xx=O("$ZodCheckEndsWith",(t,e)=>{pt.init(t,e);let r=new RegExp(`.*${En(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 Sx=O("$ZodCheckOverwrite",(t,e)=>{pt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});f();var wu=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
178
  `))}};f();var Ex={major:4,minor:0,patch:0};var je=O("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Ex;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 Ps(t,s).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),ua=O("$ZodString",(t,e)=>{je.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??sx(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=O("$ZodStringFormat",(t,e)=>{ca.init(t,e),ua.init(t,e)}),Xp=O("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=U0),qe.init(t,e)}),Qp=O("$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=O("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=V0),qe.init(t,e)}),th=O("$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:Y0.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=O("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=B0()),qe.init(t,e)}),nh=O("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=D0),qe.init(t,e)}),sh=O("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=z0),qe.init(t,e)}),oh=O("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=M0),qe.init(t,e)}),ih=O("$ZodULID",(t,e)=>{e.pattern??(e.pattern=L0),qe.init(t,e)}),ah=O("$ZodXID",(t,e)=>{e.pattern??(e.pattern=q0),qe.init(t,e)}),ch=O("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Z0),qe.init(t,e)}),jx=O("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=nx(e)),qe.init(t,e)}),zx=O("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=ex),qe.init(t,e)}),Mx=O("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=rx(e)),qe.init(t,e)}),Lx=O("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=F0),qe.init(t,e)}),uh=O("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=H0),qe.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),lh=O("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=K0),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=O("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=G0),qe.init(t,e)}),fh=O("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=J0),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 qx(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var ph=O("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=W0),qe.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{qx(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function AM(t){if(!Gp.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return qx(r)}var hh=O("$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=>{AM(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),mh=O("$ZodE164",(t,e)=>{e.pattern??(e.pattern=X0),qe.init(t,e)});function RM(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=O("$ZodJWT",(t,e)=>{qe.init(t,e),t._zod.check=r=>{RM(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var Su=O("$ZodNumber",(t,e)=>{je.init(t,e),t._zod.pattern=t._zod.bag.pattern??ix,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=O("$ZodNumber",(t,e)=>{px.init(t,e),Su.init(t,e)}),_h=O("$ZodBoolean",(t,e)=>{je.init(t,e),t._zod.pattern=ax,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=O("$ZodNull",(t,e)=>{je.init(t,e),t._zod.pattern=cx,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=O("$ZodUnknown",(t,e)=>{je.init(t,e),t._zod.parse=r=>r}),wh=O("$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 Tx(t,e,r){t.issues.length&&e.issues.push(...zr(r,t.issues)),e.value[r]=t.value}var xh=O("$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=>Tx(u,r,i))):Tx(c,r,i)}return o.length?Promise.all(o).then(()=>r):r}});function xu(t,e,r){t.issues.length&&e.issues.push(...zr(r,t.issues)),e.value[r]=t.value}function $x(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(...zr(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}var ku=O("$ZodObject",(t,e)=>{je.init(t,e);let r=na(()=>{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 wu(["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),y=0;for(let w of g.keys)m[w]=`key_${y++}`;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) {
@@ -198,9 +198,9 @@ ${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=!mu.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(I=>U?$x(I,d,T,g):xu(I,d,T))):U?$x(L,d,T,g):xu(L,d,T)}}if(!u)return h.length?Promise.all(h).then(()=>d):d;let m=[],y=l.keySet,b=u._zod,w=b.def.type;for(let x of Object.keys(g)){if(y.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=>xu(P,d,x))):xu(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 Ix(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=>yr(o,n,Bt())))}),e}var Eu=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=>oa(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=>Ix(i,r,t,n)):Ix(o,r,t,n)}}),Sh=O("$ZodDiscriminatedUnion",(t,e)=>{Eu.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=na(()=>{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])=>Px(r,c,u)):Px(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 Px(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(...zr(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...zr(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=>yr(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(...zr(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...zr(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=ra(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"?En(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"?En(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(`^(${oa(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(`^(${oa(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=>Ox(o,e)):Ox(s,e)}});function Ox(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Nh=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))}),Ah=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=>Cx(o,t)):Cx(s,t)}});function Cx(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=>yr(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=>yr(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(Ax):Ax(s)}});function Ax(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=>Rx(o,r,n,t));Rx(s,r,n,t)}});function Rx(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 jM=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 ${jM(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${_u(n.values[0])}`:`Invalid option: expected one of ${gu(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":""}: ${gu(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 Zx(){return{localeError:zM()}}f();var la=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 Dx(){return new la}var Tn=Dx();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 Tu(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 Fx(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ne(e)})}function Ux(t,e){return new t({type:"string",format:"date",check:"string_format",...ne(e)})}function Vx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ne(e)})}function Bx(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 $u(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!1})}function da(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!0})}function Iu(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!1})}function fa(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!0})}function Pu(t,e){return new fx({check:"multiple_of",...ne(e),value:t})}function Ou(t,e){return new hx({check:"max_length",...ne(e),maximum:t})}function Do(t,e){return new mx({check:"min_length",...ne(e),minimum:t})}function Cu(t,e){return new gx({check:"length_equals",...ne(e),length:t})}function fm(t,e){return new yx({check:"string_format",format:"regex",...ne(e),pattern:t})}function pm(t){return new _x({check:"string_format",format:"lowercase",...ne(t)})}function hm(t){return new vx({check:"string_format",format:"uppercase",...ne(t)})}function mm(t,e){return new bx({check:"string_format",format:"includes",...ne(e),includes:t})}function gm(t,e){return new wx({check:"string_format",format:"starts_with",...ne(e),prefix:t})}function ym(t,e){return new xx({check:"string_format",format:"ends_with",...ne(e),suffix:t})}function Os(t){return new Sx({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 Hx(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??Tn,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:y,format:b,patterns:w,contentEncoding:x}=e._zod.bag;if(typeof m=="number"&&(h.minLength=m),typeof y=="number"&&(h.maxLength=y),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:y,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 y=="number"&&(h.maximum=y,typeof x=="number"&&(x<=y?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:y}=e._zod.bag;typeof m=="number"&&(h.minItems=m),typeof y=="number"&&(h.maxItems=y),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 y=new Set(Object.keys(m)),b=new Set([...y].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,y)=>this.process(m,{...d,path:[...d.path,"anyOf",y]}));break}case"intersection":{let h=g,m=this.process(s.left,{...d,path:[...d.path,"allOf",0]}),y=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(y)?y.allOf:[y]];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:y,maximum:b}=e._zod.bag;typeof y=="number"&&(h.minItems=y),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=ra(s.entries);m.every(y=>typeof y=="number")&&(h.type="number"),m.every(y=>typeof y=="string")&&(h.type="string"),h.enum=m;break}case"literal":{let h=g,m=[];for(let y of s.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(y))}else m.push(y);if(m.length!==0)if(m.length===1){let y=m[0];h.type=y===null?"null":typeof y,h.const=y}else m.every(y=>typeof y=="number")&&(h.type="number"),m.every(y=>typeof y=="string")&&(h.type="string"),m.every(y=>typeof y=="boolean")&&(h.type="string"),m.every(y=>y===null)&&(h.type="null"),h.enum=m;break}case"file":{let h=g,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:b,mime:w}=e._zod.bag;y!==void 0&&(m.minLength=y),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,y=n.external.uri??(w=>w);if(m)return{ref:y(m)};let b=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=b,{defId:b,ref:`${y("__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=!mu.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?$x($,d,T,g):xu($,d,T))):U?$x(L,d,T,g):xu(L,d,T)}}if(!u)return h.length?Promise.all(h).then(()=>d):d;let m=[],y=l.keySet,b=u._zod,w=b.def.type;for(let x of Object.keys(g)){if(y.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=>xu(P,d,x))):xu(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 Ix(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=>yr(o,n,Bt())))}),e}var Eu=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=>oa(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=>Ix(i,r,t,n)):Ix(o,r,t,n)}}),Sh=O("$ZodDiscriminatedUnion",(t,e)=>{Eu.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=na(()=>{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])=>Px(r,c,u)):Px(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 Px(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(...zr(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...zr(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=>yr(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(...zr(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...zr(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=ra(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"?En(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"?En(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(`^(${oa(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(`^(${oa(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=>Ox(o,e)):Ox(s,e)}});function Ox(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Nh=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))}),Ah=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=>Cx(o,t)):Cx(s,t)}});function Cx(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=>yr(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=>yr(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(Ax):Ax(s)}});function Ax(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=>Rx(o,r,n,t));Rx(s,r,n,t)}});function Rx(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 jM=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 ${jM(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${_u(n.values[0])}`:`Invalid option: expected one of ${gu(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":""}: ${gu(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 Zx(){return{localeError:zM()}}f();var la=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 Dx(){return new la}var Tn=Dx();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 Tu(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 Fx(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ne(e)})}function Ux(t,e){return new t({type:"string",format:"date",check:"string_format",...ne(e)})}function Vx(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...ne(e)})}function Bx(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 $u(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!1})}function da(t,e){return new Jp({check:"less_than",...ne(e),value:t,inclusive:!0})}function Iu(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!1})}function fa(t,e){return new Wp({check:"greater_than",...ne(e),value:t,inclusive:!0})}function Pu(t,e){return new fx({check:"multiple_of",...ne(e),value:t})}function Ou(t,e){return new hx({check:"max_length",...ne(e),maximum:t})}function Do(t,e){return new mx({check:"min_length",...ne(e),minimum:t})}function Cu(t,e){return new gx({check:"length_equals",...ne(e),length:t})}function fm(t,e){return new yx({check:"string_format",format:"regex",...ne(e),pattern:t})}function pm(t){return new _x({check:"string_format",format:"lowercase",...ne(t)})}function hm(t){return new vx({check:"string_format",format:"uppercase",...ne(t)})}function mm(t,e){return new bx({check:"string_format",format:"includes",...ne(e),includes:t})}function gm(t,e){return new wx({check:"string_format",format:"starts_with",...ne(e),prefix:t})}function ym(t,e){return new xx({check:"string_format",format:"ends_with",...ne(e),suffix:t})}function Os(t){return new Sx({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 Hx(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??Tn,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:y,format:b,patterns:w,contentEncoding:x}=e._zod.bag;if(typeof m=="number"&&(h.minLength=m),typeof y=="number"&&(h.maxLength=y),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:y,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 y=="number"&&(h.maximum=y,typeof x=="number"&&(x<=y?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:y}=e._zod.bag;typeof m=="number"&&(h.minItems=m),typeof y=="number"&&(h.maxItems=y),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 y=new Set(Object.keys(m)),b=new Set([...y].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,y)=>this.process(m,{...d,path:[...d.path,"anyOf",y]}));break}case"intersection":{let h=g,m=this.process(s.left,{...d,path:[...d.path,"allOf",0]}),y=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(y)?y.allOf:[y]];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:y,maximum:b}=e._zod.bag;typeof y=="number"&&(h.minItems=y),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=ra(s.entries);m.every(y=>typeof y=="number")&&(h.type="number"),m.every(y=>typeof y=="string")&&(h.type="string"),h.enum=m;break}case"literal":{let h=g,m=[];for(let y of s.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");m.push(Number(y))}else m.push(y);if(m.length!==0)if(m.length===1){let y=m[0];h.type=y===null?"null":typeof y,h.const=y}else m.every(y=>typeof y=="number")&&(h.type="number"),m.every(y=>typeof y=="string")&&(h.type="string"),m.every(y=>typeof y=="boolean")&&(h.type="string"),m.every(y=>y===null)&&(h.type="null"),h.enum=m;break}case"file":{let h=g,m={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:b,mime:w}=e._zod.bag;y!==void 0&&(m.minLength=y),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,y=n.external.uri??(w=>w);if(m)return{ref:y(m)};let b=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=b,{defId:b,ref:`${y("__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 y=this.seen.get(m).schema;y.$ref&&d.target==="draft-7"?(g.allOf=g.allOf??[],g.allOf.push(y)):(Object.assign(g,y),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 la){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 yL=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 _L=O("ZodMiniObject",(t,e)=>{ku.init(t,e),yL.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 $n(t,e){return Qt(t)?Is(t,e):t.safeParse(e)}async function Au(t,e){return Qt(t)?await Ps(t,e):await t.safeParseAsync(e)}function In(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 Ru(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 Gx(t){return t.description}function Jx(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 ju(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 pa={};kp(pa,{ZodISODate:()=>Yx,ZodISODateTime:()=>Wx,ZodISODuration:()=>Qx,ZodISOTime:()=>Xx,date:()=>$m,datetime:()=>Tm,duration:()=>Pm,time:()=>Im});f();var Wx=O("ZodISODateTime",(t,e)=>{jx.init(t,e),Ge.init(t,e)});function Tm(t){return Fx(Wx,t)}var Yx=O("ZodISODate",(t,e)=>{zx.init(t,e),Ge.init(t,e)});function $m(t){return Ux(Yx,t)}var Xx=O("ZodISOTime",(t,e)=>{Mx.init(t,e),Ge.init(t,e)});function Im(t){return Vx(Xx,t)}var Qx=O("ZodISODuration",(t,e)=>{Lx.init(t,e),Ge.init(t,e)});function Pm(t){return Bx(Qx,t)}f();f();var eS=(t,e)=>{vu.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}}})},bne=O("ZodError",eS),ha=O("ZodError",eS,{Parent:Error});var tS=Dp(ha),rS=Up(ha),nS=Bp(ha),sS=Hp(ha);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)=>tS(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>nS(t,r,n),t.parseAsync=async(r,n)=>rS(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>sS(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(mq(r,n)),t.superRefine=r=>t.check(gq(r)),t.overwrite=r=>t.check(Os(r)),t.optional=()=>We(t),t.nullable=()=>aS(t),t.nullish=()=>We(aS(t)),t.nonoptional=r=>cq(t,r),t.array=()=>be(t),t.or=r=>Ue([t,r]),t.and=r=>Mu(t,r),t.transform=r=>Cm(t,pS(r)),t.default=r=>oq(t,r),t.prefault=r=>aq(t,r),t.catch=r=>lq(t,r),t.pipe=r=>Cm(t,r),t.readonly=()=>pq(t),t.describe=r=>{let n=t.clone();return Tn.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Tn.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Tn.get(t);let n=t.clone();return Tn.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),cS=O("_ZodString",(t,e)=>{ua.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(Ou(...n)),t.length=(...n)=>t.check(Cu(...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())}),$L=O("ZodString",(t,e)=>{ua.init(t,e),cS.init(t,e),t.email=r=>t.check(qh(IL,r)),t.url=r=>t.check(Vh(PL,r)),t.jwt=r=>t.check(om(VL,r)),t.emoji=r=>t.check(Bh(OL,r)),t.guid=r=>t.check(Tu(oS,r)),t.uuid=r=>t.check(Zh(zu,r)),t.uuidv4=r=>t.check(Dh(zu,r)),t.uuidv6=r=>t.check(Fh(zu,r)),t.uuidv7=r=>t.check(Uh(zu,r)),t.nanoid=r=>t.check(Hh(CL,r)),t.guid=r=>t.check(Tu(oS,r)),t.cuid=r=>t.check(Kh(NL,r)),t.cuid2=r=>t.check(Gh(AL,r)),t.ulid=r=>t.check(Jh(RL,r)),t.base64=r=>t.check(rm(DL,r)),t.base64url=r=>t.check(nm(FL,r)),t.xid=r=>t.check(Wh(jL,r)),t.ksuid=r=>t.check(Yh(zL,r)),t.ipv4=r=>t.check(Xh(ML,r)),t.ipv6=r=>t.check(Qh(LL,r)),t.cidrv4=r=>t.check(em(qL,r)),t.cidrv6=r=>t.check(tm(ZL,r)),t.e164=r=>t.check(sm(UL,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 $(t){return Lh($L,t)}var Ge=O("ZodStringFormat",(t,e)=>{qe.init(t,e),cS.init(t,e)}),IL=O("ZodEmail",(t,e)=>{eh.init(t,e),Ge.init(t,e)});var oS=O("ZodGUID",(t,e)=>{Xp.init(t,e),Ge.init(t,e)});var zu=O("ZodUUID",(t,e)=>{Qp.init(t,e),Ge.init(t,e)});var PL=O("ZodURL",(t,e)=>{th.init(t,e),Ge.init(t,e)});var OL=O("ZodEmoji",(t,e)=>{rh.init(t,e),Ge.init(t,e)});var CL=O("ZodNanoID",(t,e)=>{nh.init(t,e),Ge.init(t,e)});var NL=O("ZodCUID",(t,e)=>{sh.init(t,e),Ge.init(t,e)});var AL=O("ZodCUID2",(t,e)=>{oh.init(t,e),Ge.init(t,e)});var RL=O("ZodULID",(t,e)=>{ih.init(t,e),Ge.init(t,e)});var jL=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 ML=O("ZodIPv4",(t,e)=>{uh.init(t,e),Ge.init(t,e)});var LL=O("ZodIPv6",(t,e)=>{lh.init(t,e),Ge.init(t,e)});var qL=O("ZodCIDRv4",(t,e)=>{dh.init(t,e),Ge.init(t,e)});var ZL=O("ZodCIDRv6",(t,e)=>{fh.init(t,e),Ge.init(t,e)});var DL=O("ZodBase64",(t,e)=>{ph.init(t,e),Ge.init(t,e)});var FL=O("ZodBase64URL",(t,e)=>{hh.init(t,e),Ge.init(t,e)});var UL=O("ZodE164",(t,e)=>{mh.init(t,e),Ge.init(t,e)});var VL=O("ZodJWT",(t,e)=>{gh.init(t,e),Ge.init(t,e)});var uS=O("ZodNumber",(t,e)=>{Su.init(t,e),et.init(t,e),t.gt=(n,s)=>t.check(Iu(n,s)),t.gte=(n,s)=>t.check(fa(n,s)),t.min=(n,s)=>t.check(fa(n,s)),t.lt=(n,s)=>t.check($u(n,s)),t.lte=(n,s)=>t.check(da(n,s)),t.max=(n,s)=>t.check(da(n,s)),t.int=n=>t.check(iS(n)),t.safe=n=>t.check(iS(n)),t.positive=n=>t.check(Iu(0,n)),t.nonnegative=n=>t.check(fa(0,n)),t.negative=n=>t.check($u(0,n)),t.nonpositive=n=>t.check(da(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 Oe(t){return im(uS,t)}var BL=O("ZodNumberFormat",(t,e)=>{yh.init(t,e),uS.init(t,e)});function iS(t){return am(BL,t)}var HL=O("ZodBoolean",(t,e)=>{_h.init(t,e),et.init(t,e)});function lt(t){return cm(HL,t)}var KL=O("ZodNull",(t,e)=>{vh.init(t,e),et.init(t,e)});function lS(t){return um(KL,t)}var GL=O("ZodUnknown",(t,e)=>{bh.init(t,e),et.init(t,e)});function Je(){return lm(GL)}var JL=O("ZodNever",(t,e)=>{wh.init(t,e),et.init(t,e)});function WL(t){return dm(JL,t)}var YL=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(Ou(r,n)),t.length=(r,n)=>t.check(Cu(r,n)),t.unwrap=()=>t.element});function be(t,e){return Hx(YL,t,e)}var dS=O("ZodObject",(t,e)=>{ku.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:WL()}),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(hS,t,r[0]),t.required=(...r)=>ve.required(mS,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 dS(r)}function Et(t,e){return new dS({type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},catchall:Je(),...ve.normalizeParams(e)})}var fS=O("ZodUnion",(t,e)=>{Eu.init(t,e),et.init(t,e),t.options=e.options});function Ue(t,e){return new fS({type:"union",options:t,...ve.normalizeParams(e)})}var XL=O("ZodDiscriminatedUnion",(t,e)=>{fS.init(t,e),Sh.init(t,e)});function Nm(t,e,r){return new XL({type:"union",options:e,discriminator:t,...ve.normalizeParams(r)})}var QL=O("ZodIntersection",(t,e)=>{kh.init(t,e),et.init(t,e)});function Mu(t,e){return new QL({type:"intersection",left:t,right:e})}var eq=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 eq({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 At(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 tq=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 tq({type:"literal",values:Array.isArray(t)?t:[t],...ve.normalizeParams(e)})}var rq=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 pS(t){return new rq({type:"transform",transform:t})}var hS=O("ZodOptional",(t,e)=>{Ph.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function We(t){return new hS({type:"optional",innerType:t})}var nq=O("ZodNullable",(t,e)=>{Oh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function aS(t){return new nq({type:"nullable",innerType:t})}var sq=O("ZodDefault",(t,e)=>{Ch.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function oq(t,e){return new sq({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var iq=O("ZodPrefault",(t,e)=>{Nh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function aq(t,e){return new iq({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var mS=O("ZodNonOptional",(t,e)=>{Ah.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cq(t,e){return new mS({type:"nonoptional",innerType:t,...ve.normalizeParams(e)})}var uq=O("ZodCatch",(t,e)=>{Rh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function lq(t,e){return new uq({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var dq=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 dq({type:"pipe",in:t,out:e})}var fq=O("ZodReadonly",(t,e)=>{zh.init(t,e),et.init(t,e)});function pq(t){return new fq({type:"readonly",innerType:t})}var gS=O("ZodCustom",(t,e)=>{Mh.init(t,e),et.init(t,e)});function hq(t){let e=new pt({check:"custom"});return e._zod.check=t,e}function yS(t,e){return xm(gS,t??(()=>!0),e)}function mq(t,e={}){return Sm(gS,t,e)}function gq(t){let e=hq(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(pS(t),e)}Bt(Zx());var jm="2025-11-25",_S="2025-03-26",Vo=[jm,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Pn="io.modelcontextprotocol/related-task",qu="2.0",ct=yS(t=>t!==null&&(typeof t=="object"||typeof t=="function")),vS=Ue([$(),Oe().int()]),bS=$(),Lne=Et({ttl:Oe().optional(),pollInterval:Oe().optional()}),yq=K({ttl:Oe().optional()}),_q=K({taskId:$()}),zm=Et({progressToken:vS.optional(),[Pn]:_q.optional()}),Kt=K({_meta:zm.optional()}),ma=Kt.extend({task:yq.optional()}),wS=t=>ma.safeParse(t).success,ht=K({method:$(),params:Kt.loose().optional()}),er=K({_meta:zm.optional()}),tr=K({method:$(),params:er.loose().optional()}),mt=Et({_meta:zm.optional()}),Zu=Ue([$(),Oe().int()]),xS=K({jsonrpc:W(qu),id:Zu,...ht.shape}).strict(),On=t=>xS.safeParse(t).success,SS=K({jsonrpc:W(qu),...tr.shape}).strict(),kS=t=>SS.safeParse(t).success,Mm=K({jsonrpc:W(qu),id:Zu,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(qu),id:Zu.optional(),error:K({code:Oe().int(),message:$(),data:Je().optional()})}).strict();var Bo=t=>Lm.safeParse(t).success;var ga=Ue([xS,SS,Mm,Lm]),qne=Ue([Mm,Lm]),Du=mt.strict(),vq=er.extend({requestId:Zu.optional(),reason:$().optional()}),Fu=tr.extend({method:W("notifications/cancelled"),params:vq}),bq=K({src:$(),mimeType:$().optional(),sizes:be($()).optional(),theme:At(["light","dark"]).optional()}),ya=K({icons:be(bq).optional()}),Uo=K({name:$(),title:$().optional()}),ES=Uo.extend({...Uo.shape,...ya.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),wq=Mu(K({applyDefaults:lt().optional()}),Ze($(),Je())),xq=Am(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Mu(K({form:wq.optional(),url:ct.optional()}),Ze($(),Je()).optional())),Sq=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({sampling:Et({createMessage:ct.optional()}).optional(),elicitation:Et({create:ct.optional()}).optional()}).optional()}),kq=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({tools:Et({call:ct.optional()}).optional()}).optional()}),Eq=K({experimental:Ze($(),ct).optional(),sampling:K({context:ct.optional(),tools:ct.optional()}).optional(),elicitation:xq.optional(),roots:K({listChanged:lt().optional()}).optional(),tasks:Sq.optional(),extensions:Ze($(),ct).optional()}),Tq=Kt.extend({protocolVersion:$(),capabilities:Eq,clientInfo:ES}),Uu=ht.extend({method:W("initialize"),params:Tq}),qm=t=>Uu.safeParse(t).success,$q=K({experimental:Ze($(),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:kq.optional(),extensions:Ze($(),ct).optional()}),Iq=mt.extend({protocolVersion:$(),capabilities:$q,serverInfo:ES,instructions:$().optional()}),Zm=tr.extend({method:W("notifications/initialized"),params:er.optional()});var Vu=ht.extend({method:W("ping"),params:Kt.optional()}),Pq=K({progress:Oe(),total:We(Oe()),message:We($())}),Oq=K({...er.shape,...Pq.shape,progressToken:vS}),Bu=tr.extend({method:W("notifications/progress"),params:Oq}),Cq=Kt.extend({cursor:bS.optional()}),_a=ht.extend({params:Cq.optional()}),va=mt.extend({nextCursor:bS.optional()}),Nq=At(["working","input_required","completed","failed","cancelled"]),ba=K({taskId:$(),status:Nq,ttl:Ue([Oe(),lS()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:We(Oe()),statusMessage:We($())}),Ho=mt.extend({task:ba}),Aq=er.merge(ba),wa=tr.extend({method:W("notifications/tasks/status"),params:Aq}),Hu=ht.extend({method:W("tasks/get"),params:Kt.extend({taskId:$()})}),Ku=mt.merge(ba),Gu=ht.extend({method:W("tasks/result"),params:Kt.extend({taskId:$()})}),Zne=mt.loose(),Ju=_a.extend({method:W("tasks/list")}),Wu=va.extend({tasks:be(ba)}),Yu=ht.extend({method:W("tasks/cancel"),params:Kt.extend({taskId:$()})}),TS=mt.merge(ba),$S=K({uri:$(),mimeType:We($()),_meta:Ze($(),Je()).optional()}),IS=$S.extend({text:$()}),Dm=$().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),PS=$S.extend({blob:Dm}),xa=At(["user","assistant"]),Ko=K({audience:be(xa).optional(),priority:Oe().min(0).max(1).optional(),lastModified:pa.datetime({offset:!0}).optional()}),OS=K({...Uo.shape,...ya.shape,uri:$(),description:We($()),mimeType:We($()),size:We(Oe()),annotations:Ko.optional(),_meta:We(Et({}))}),Rq=K({...Uo.shape,...ya.shape,uriTemplate:$(),description:We($()),mimeType:We($()),annotations:Ko.optional(),_meta:We(Et({}))}),Xu=_a.extend({method:W("resources/list")}),jq=va.extend({resources:be(OS)}),Qu=_a.extend({method:W("resources/templates/list")}),zq=va.extend({resourceTemplates:be(Rq)}),Fm=Kt.extend({uri:$()}),Mq=Fm,el=ht.extend({method:W("resources/read"),params:Mq}),Lq=mt.extend({contents:be(Ue([IS,PS]))}),qq=tr.extend({method:W("notifications/resources/list_changed"),params:er.optional()}),Zq=Fm,Dq=ht.extend({method:W("resources/subscribe"),params:Zq}),Fq=Fm,Uq=ht.extend({method:W("resources/unsubscribe"),params:Fq}),Vq=er.extend({uri:$()}),Bq=tr.extend({method:W("notifications/resources/updated"),params:Vq}),Hq=K({name:$(),description:We($()),required:We(lt())}),Kq=K({...Uo.shape,...ya.shape,description:We($()),arguments:We(be(Hq)),_meta:We(Et({}))}),tl=_a.extend({method:W("prompts/list")}),Gq=va.extend({prompts:be(Kq)}),Jq=Kt.extend({name:$(),arguments:Ze($(),$()).optional()}),rl=ht.extend({method:W("prompts/get"),params:Jq}),Um=K({type:W("text"),text:$(),annotations:Ko.optional(),_meta:Ze($(),Je()).optional()}),Vm=K({type:W("image"),data:Dm,mimeType:$(),annotations:Ko.optional(),_meta:Ze($(),Je()).optional()}),Bm=K({type:W("audio"),data:Dm,mimeType:$(),annotations:Ko.optional(),_meta:Ze($(),Je()).optional()}),Wq=K({type:W("tool_use"),name:$(),id:$(),input:Ze($(),Je()),_meta:Ze($(),Je()).optional()}),Yq=K({type:W("resource"),resource:Ue([IS,PS]),annotations:Ko.optional(),_meta:Ze($(),Je()).optional()}),Xq=OS.extend({type:W("resource_link")}),Hm=Ue([Um,Vm,Bm,Xq,Yq]),Qq=K({role:xa,content:Hm}),eZ=mt.extend({description:$().optional(),messages:be(Qq)}),tZ=tr.extend({method:W("notifications/prompts/list_changed"),params:er.optional()}),rZ=K({title:$().optional(),readOnlyHint:lt().optional(),destructiveHint:lt().optional(),idempotentHint:lt().optional(),openWorldHint:lt().optional()}),nZ=K({taskSupport:At(["required","optional","forbidden"]).optional()}),CS=K({...Uo.shape,...ya.shape,description:$().optional(),inputSchema:K({type:W("object"),properties:Ze($(),ct).optional(),required:be($()).optional()}).catchall(Je()),outputSchema:K({type:W("object"),properties:Ze($(),ct).optional(),required:be($()).optional()}).catchall(Je()).optional(),annotations:rZ.optional(),execution:nZ.optional(),_meta:Ze($(),Je()).optional()}),nl=_a.extend({method:W("tools/list")}),sZ=va.extend({tools:be(CS)}),sl=mt.extend({content:be(Hm).default([]),structuredContent:Ze($(),Je()).optional(),isError:lt().optional()}),Dne=sl.or(mt.extend({toolResult:Je()})),oZ=ma.extend({name:$(),arguments:Ze($(),Je()).optional()}),Go=ht.extend({method:W("tools/call"),params:oZ}),iZ=tr.extend({method:W("notifications/tools/list_changed"),params:er.optional()}),Fne=K({autoRefresh:lt().default(!0),debounceMs:Oe().int().nonnegative().default(300)}),Sa=At(["debug","info","notice","warning","error","critical","alert","emergency"]),aZ=Kt.extend({level:Sa}),Km=ht.extend({method:W("logging/setLevel"),params:aZ}),cZ=er.extend({level:Sa,logger:$().optional(),data:Je()}),uZ=tr.extend({method:W("notifications/message"),params:cZ}),lZ=K({name:$().optional()}),dZ=K({hints:be(lZ).optional(),costPriority:Oe().min(0).max(1).optional(),speedPriority:Oe().min(0).max(1).optional(),intelligencePriority:Oe().min(0).max(1).optional()}),fZ=K({mode:At(["auto","required","none"]).optional()}),pZ=K({type:W("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:be(Hm).default([]),structuredContent:K({}).loose().optional(),isError:lt().optional(),_meta:Ze($(),Je()).optional()}),hZ=Nm("type",[Um,Vm,Bm]),Lu=Nm("type",[Um,Vm,Bm,Wq,pZ]),mZ=K({role:xa,content:Ue([Lu,be(Lu)]),_meta:Ze($(),Je()).optional()}),gZ=ma.extend({messages:be(mZ),modelPreferences:dZ.optional(),systemPrompt:$().optional(),includeContext:At(["none","thisServer","allServers"]).optional(),temperature:Oe().optional(),maxTokens:Oe().int(),stopSequences:be($()).optional(),metadata:ct.optional(),tools:be(CS).optional(),toolChoice:fZ.optional()}),yZ=ht.extend({method:W("sampling/createMessage"),params:gZ}),ka=mt.extend({model:$(),stopReason:We(At(["endTurn","stopSequence","maxTokens"]).or($())),role:xa,content:hZ}),Gm=mt.extend({model:$(),stopReason:We(At(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:xa,content:Ue([Lu,be(Lu)])}),_Z=K({type:W("boolean"),title:$().optional(),description:$().optional(),default:lt().optional()}),vZ=K({type:W("string"),title:$().optional(),description:$().optional(),minLength:Oe().optional(),maxLength:Oe().optional(),format:At(["email","uri","date","date-time"]).optional(),default:$().optional()}),bZ=K({type:At(["number","integer"]),title:$().optional(),description:$().optional(),minimum:Oe().optional(),maximum:Oe().optional(),default:Oe().optional()}),wZ=K({type:W("string"),title:$().optional(),description:$().optional(),enum:be($()),default:$().optional()}),xZ=K({type:W("string"),title:$().optional(),description:$().optional(),oneOf:be(K({const:$(),title:$()})),default:$().optional()}),SZ=K({type:W("string"),title:$().optional(),description:$().optional(),enum:be($()),enumNames:be($()).optional(),default:$().optional()}),kZ=Ue([wZ,xZ]),EZ=K({type:W("array"),title:$().optional(),description:$().optional(),minItems:Oe().optional(),maxItems:Oe().optional(),items:K({type:W("string"),enum:be($())}),default:be($()).optional()}),TZ=K({type:W("array"),title:$().optional(),description:$().optional(),minItems:Oe().optional(),maxItems:Oe().optional(),items:K({anyOf:be(K({const:$(),title:$()}))}),default:be($()).optional()}),$Z=Ue([EZ,TZ]),IZ=Ue([SZ,kZ,$Z]),PZ=Ue([IZ,_Z,vZ,bZ]),OZ=ma.extend({mode:W("form").optional(),message:$(),requestedSchema:K({type:W("object"),properties:Ze($(),PZ),required:be($()).optional()})}),CZ=ma.extend({mode:W("url"),message:$(),elicitationId:$(),url:$().url()}),NZ=Ue([OZ,CZ]),AZ=ht.extend({method:W("elicitation/create"),params:NZ}),RZ=er.extend({elicitationId:$()}),jZ=tr.extend({method:W("notifications/elicitation/complete"),params:RZ}),Jo=mt.extend({action:At(["accept","decline","cancel"]),content:Am(t=>t===null?void 0:t,Ze($(),Ue([$(),Oe(),lt(),be($())])).optional())}),zZ=K({type:W("ref/resource"),uri:$()});var MZ=K({type:W("ref/prompt"),name:$()}),LZ=Kt.extend({ref:Ue([MZ,zZ]),argument:K({name:$(),value:$()}),context:K({arguments:Ze($(),$()).optional()}).optional()}),ol=ht.extend({method:W("completion/complete"),params:LZ});function NS(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function AS(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var qZ=mt.extend({completion:Et({values:be($()).max(100),total:We(Oe().int()),hasMore:We(lt())})}),ZZ=K({uri:$().startsWith("file://"),name:$().optional(),_meta:Ze($(),Je()).optional()}),DZ=ht.extend({method:W("roots/list"),params:Kt.optional()}),Jm=mt.extend({roots:be(ZZ)}),FZ=tr.extend({method:W("notifications/roots/list_changed"),params:er.optional()}),Une=Ue([Vu,Uu,ol,Km,rl,tl,Xu,Qu,el,Dq,Uq,Go,nl,Hu,Gu,Ju,Yu]),Vne=Ue([Fu,Bu,Zm,FZ,wa]),Bne=Ue([Du,ka,Gm,Jo,Jm,Ku,Wu,Ho]),Hne=Ue([Vu,yZ,AZ,DZ,Hu,Gu,Ju,Yu]),Kne=Ue([Fu,Bu,uZ,Bq,qq,iZ,tZ,wa,jZ]),Gne=Ue([Du,Iq,qZ,eZ,Gq,jq,zq,Lq,sl,sZ,Ku,Wu,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 Cn(t){return t==="completed"||t==="failed"||t==="cancelled"}f();f();f();var jS=Symbol("Let zodToJsonSchema decide on which parser to use");var RS={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"},zS=t=>typeof t=="string"?{...RS,name:t}:{...RS,...t};f();var MS=t=>{let e=zS(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 il=(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"?il(e,t.currentPath):e.join("/")}}f();function LS(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 qS(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 ZS(){return{type:"boolean"}}f();function al(t,e){return oe(t.type._def,e)}f();var DS=(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 UZ(t,e)}}var UZ=(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 FS(t,e){return{...oe(t.innerType._def,e),default:t.defaultValue()}}f();function US(t,e){return e.effectStrategy==="input"?oe(t.schema._def,e):Ye(e)}f();function VS(t){return{type:"string",enum:Array.from(t.values)}}f();var VZ=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function BS(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(VZ(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 HS(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,_r={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 cl(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":vr(r,"email",n.message,e);break;case"format:idn-email":vr(r,"idn-email",n.message,e);break;case"pattern:zod":Tt(r,_r.email,n.message,e);break}break;case"url":vr(r,"uri",n.message,e);break;case"uuid":vr(r,"uuid",n.message,e);break;case"regex":Tt(r,n.regex,n.message,e);break;case"cuid":Tt(r,_r.cuid,n.message,e);break;case"cuid2":Tt(r,_r.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":vr(r,"date-time",n.message,e);break;case"date":vr(r,"date",n.message,e);break;case"time":vr(r,"time",n.message,e);break;case"duration":vr(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"&&vr(r,"ipv4",n.message,e),n.version!=="v4"&&vr(r,"ipv6",n.message,e);break}case"base64url":Tt(r,_r.base64url,n.message,e);break;case"jwt":Tt(r,_r.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Tt(r,_r.ipv4Cidr,n.message,e),n.version!=="v4"&&Tt(r,_r.ipv6Cidr,n.message,e);break}case"emoji":Tt(r,_r.emoji(),n.message,e);break;case"ulid":{Tt(r,_r.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{vr(r,"binary",n.message,e);break}case"contentEncoding:base64":{we(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Tt(r,_r.base64,n.message,e);break}}break}case"nanoid":Tt(r,_r.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Qm(t,e){return e.patternStrategy==="escape"?HZ(t):t}var BZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function HZ(t){let e="";for(let r=0;r<t.length;r++)BZ.has(t[r])||(e+="\\"),e+=t[r];return e}function vr(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:KS(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):we(t,"pattern",KS(e,n),r,n)}function KS(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 y=this.seen.get(m).schema;y.$ref&&d.target==="draft-7"?(g.allOf=g.allOf??[],g.allOf.push(y)):(Object.assign(g,y),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 la){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 yL=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 _L=O("ZodMiniObject",(t,e)=>{ku.init(t,e),yL.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 $n(t,e){return Qt(t)?Is(t,e):t.safeParse(e)}async function Au(t,e){return Qt(t)?await Ps(t,e):await t.safeParseAsync(e)}function In(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 Ru(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 Gx(t){return t.description}function Jx(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 ju(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 pa={};kp(pa,{ZodISODate:()=>Yx,ZodISODateTime:()=>Wx,ZodISODuration:()=>Qx,ZodISOTime:()=>Xx,date:()=>$m,datetime:()=>Tm,duration:()=>Pm,time:()=>Im});f();var Wx=O("ZodISODateTime",(t,e)=>{jx.init(t,e),Ge.init(t,e)});function Tm(t){return Fx(Wx,t)}var Yx=O("ZodISODate",(t,e)=>{zx.init(t,e),Ge.init(t,e)});function $m(t){return Ux(Yx,t)}var Xx=O("ZodISOTime",(t,e)=>{Mx.init(t,e),Ge.init(t,e)});function Im(t){return Vx(Xx,t)}var Qx=O("ZodISODuration",(t,e)=>{Lx.init(t,e),Ge.init(t,e)});function Pm(t){return Bx(Qx,t)}f();f();var eS=(t,e)=>{vu.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}}})},wne=O("ZodError",eS),ha=O("ZodError",eS,{Parent:Error});var tS=Dp(ha),rS=Up(ha),nS=Bp(ha),sS=Hp(ha);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)=>tS(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>nS(t,r,n),t.parseAsync=async(r,n)=>rS(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>sS(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(mq(r,n)),t.superRefine=r=>t.check(gq(r)),t.overwrite=r=>t.check(Os(r)),t.optional=()=>We(t),t.nullable=()=>aS(t),t.nullish=()=>We(aS(t)),t.nonoptional=r=>cq(t,r),t.array=()=>be(t),t.or=r=>Ue([t,r]),t.and=r=>Mu(t,r),t.transform=r=>Cm(t,pS(r)),t.default=r=>oq(t,r),t.prefault=r=>aq(t,r),t.catch=r=>lq(t,r),t.pipe=r=>Cm(t,r),t.readonly=()=>pq(t),t.describe=r=>{let n=t.clone();return Tn.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Tn.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Tn.get(t);let n=t.clone();return Tn.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),cS=O("_ZodString",(t,e)=>{ua.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(Ou(...n)),t.length=(...n)=>t.check(Cu(...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())}),$L=O("ZodString",(t,e)=>{ua.init(t,e),cS.init(t,e),t.email=r=>t.check(qh(IL,r)),t.url=r=>t.check(Vh(PL,r)),t.jwt=r=>t.check(om(VL,r)),t.emoji=r=>t.check(Bh(OL,r)),t.guid=r=>t.check(Tu(oS,r)),t.uuid=r=>t.check(Zh(zu,r)),t.uuidv4=r=>t.check(Dh(zu,r)),t.uuidv6=r=>t.check(Fh(zu,r)),t.uuidv7=r=>t.check(Uh(zu,r)),t.nanoid=r=>t.check(Hh(CL,r)),t.guid=r=>t.check(Tu(oS,r)),t.cuid=r=>t.check(Kh(NL,r)),t.cuid2=r=>t.check(Gh(AL,r)),t.ulid=r=>t.check(Jh(RL,r)),t.base64=r=>t.check(rm(DL,r)),t.base64url=r=>t.check(nm(FL,r)),t.xid=r=>t.check(Wh(jL,r)),t.ksuid=r=>t.check(Yh(zL,r)),t.ipv4=r=>t.check(Xh(ML,r)),t.ipv6=r=>t.check(Qh(LL,r)),t.cidrv4=r=>t.check(em(qL,r)),t.cidrv6=r=>t.check(tm(ZL,r)),t.e164=r=>t.check(sm(UL,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($L,t)}var Ge=O("ZodStringFormat",(t,e)=>{qe.init(t,e),cS.init(t,e)}),IL=O("ZodEmail",(t,e)=>{eh.init(t,e),Ge.init(t,e)});var oS=O("ZodGUID",(t,e)=>{Xp.init(t,e),Ge.init(t,e)});var zu=O("ZodUUID",(t,e)=>{Qp.init(t,e),Ge.init(t,e)});var PL=O("ZodURL",(t,e)=>{th.init(t,e),Ge.init(t,e)});var OL=O("ZodEmoji",(t,e)=>{rh.init(t,e),Ge.init(t,e)});var CL=O("ZodNanoID",(t,e)=>{nh.init(t,e),Ge.init(t,e)});var NL=O("ZodCUID",(t,e)=>{sh.init(t,e),Ge.init(t,e)});var AL=O("ZodCUID2",(t,e)=>{oh.init(t,e),Ge.init(t,e)});var RL=O("ZodULID",(t,e)=>{ih.init(t,e),Ge.init(t,e)});var jL=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 ML=O("ZodIPv4",(t,e)=>{uh.init(t,e),Ge.init(t,e)});var LL=O("ZodIPv6",(t,e)=>{lh.init(t,e),Ge.init(t,e)});var qL=O("ZodCIDRv4",(t,e)=>{dh.init(t,e),Ge.init(t,e)});var ZL=O("ZodCIDRv6",(t,e)=>{fh.init(t,e),Ge.init(t,e)});var DL=O("ZodBase64",(t,e)=>{ph.init(t,e),Ge.init(t,e)});var FL=O("ZodBase64URL",(t,e)=>{hh.init(t,e),Ge.init(t,e)});var UL=O("ZodE164",(t,e)=>{mh.init(t,e),Ge.init(t,e)});var VL=O("ZodJWT",(t,e)=>{gh.init(t,e),Ge.init(t,e)});var uS=O("ZodNumber",(t,e)=>{Su.init(t,e),et.init(t,e),t.gt=(n,s)=>t.check(Iu(n,s)),t.gte=(n,s)=>t.check(fa(n,s)),t.min=(n,s)=>t.check(fa(n,s)),t.lt=(n,s)=>t.check($u(n,s)),t.lte=(n,s)=>t.check(da(n,s)),t.max=(n,s)=>t.check(da(n,s)),t.int=n=>t.check(iS(n)),t.safe=n=>t.check(iS(n)),t.positive=n=>t.check(Iu(0,n)),t.nonnegative=n=>t.check(fa(0,n)),t.negative=n=>t.check($u(0,n)),t.nonpositive=n=>t.check(da(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 Oe(t){return im(uS,t)}var BL=O("ZodNumberFormat",(t,e)=>{yh.init(t,e),uS.init(t,e)});function iS(t){return am(BL,t)}var HL=O("ZodBoolean",(t,e)=>{_h.init(t,e),et.init(t,e)});function lt(t){return cm(HL,t)}var KL=O("ZodNull",(t,e)=>{vh.init(t,e),et.init(t,e)});function lS(t){return um(KL,t)}var GL=O("ZodUnknown",(t,e)=>{bh.init(t,e),et.init(t,e)});function Je(){return lm(GL)}var JL=O("ZodNever",(t,e)=>{wh.init(t,e),et.init(t,e)});function WL(t){return dm(JL,t)}var YL=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(Ou(r,n)),t.length=(r,n)=>t.check(Cu(r,n)),t.unwrap=()=>t.element});function be(t,e){return Hx(YL,t,e)}var dS=O("ZodObject",(t,e)=>{ku.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:WL()}),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(hS,t,r[0]),t.required=(...r)=>ve.required(mS,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 dS(r)}function Et(t,e){return new dS({type:"object",get shape(){return ve.assignProp(this,"shape",{...t}),this.shape},catchall:Je(),...ve.normalizeParams(e)})}var fS=O("ZodUnion",(t,e)=>{Eu.init(t,e),et.init(t,e),t.options=e.options});function Ue(t,e){return new fS({type:"union",options:t,...ve.normalizeParams(e)})}var XL=O("ZodDiscriminatedUnion",(t,e)=>{fS.init(t,e),Sh.init(t,e)});function Nm(t,e,r){return new XL({type:"union",options:e,discriminator:t,...ve.normalizeParams(r)})}var QL=O("ZodIntersection",(t,e)=>{kh.init(t,e),et.init(t,e)});function Mu(t,e){return new QL({type:"intersection",left:t,right:e})}var eq=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 eq({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 At(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 tq=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 tq({type:"literal",values:Array.isArray(t)?t:[t],...ve.normalizeParams(e)})}var rq=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 pS(t){return new rq({type:"transform",transform:t})}var hS=O("ZodOptional",(t,e)=>{Ph.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function We(t){return new hS({type:"optional",innerType:t})}var nq=O("ZodNullable",(t,e)=>{Oh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function aS(t){return new nq({type:"nullable",innerType:t})}var sq=O("ZodDefault",(t,e)=>{Ch.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function oq(t,e){return new sq({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var iq=O("ZodPrefault",(t,e)=>{Nh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function aq(t,e){return new iq({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var mS=O("ZodNonOptional",(t,e)=>{Ah.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType});function cq(t,e){return new mS({type:"nonoptional",innerType:t,...ve.normalizeParams(e)})}var uq=O("ZodCatch",(t,e)=>{Rh.init(t,e),et.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function lq(t,e){return new uq({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var dq=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 dq({type:"pipe",in:t,out:e})}var fq=O("ZodReadonly",(t,e)=>{zh.init(t,e),et.init(t,e)});function pq(t){return new fq({type:"readonly",innerType:t})}var gS=O("ZodCustom",(t,e)=>{Mh.init(t,e),et.init(t,e)});function hq(t){let e=new pt({check:"custom"});return e._zod.check=t,e}function yS(t,e){return xm(gS,t??(()=>!0),e)}function mq(t,e={}){return Sm(gS,t,e)}function gq(t){let e=hq(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(pS(t),e)}Bt(Zx());var jm="2025-11-25",_S="2025-03-26",Vo=[jm,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Pn="io.modelcontextprotocol/related-task",qu="2.0",ct=yS(t=>t!==null&&(typeof t=="object"||typeof t=="function")),vS=Ue([I(),Oe().int()]),bS=I(),qne=Et({ttl:Oe().optional(),pollInterval:Oe().optional()}),yq=K({ttl:Oe().optional()}),_q=K({taskId:I()}),zm=Et({progressToken:vS.optional(),[Pn]:_q.optional()}),Kt=K({_meta:zm.optional()}),ma=Kt.extend({task:yq.optional()}),wS=t=>ma.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()}),Zu=Ue([I(),Oe().int()]),xS=K({jsonrpc:W(qu),id:Zu,...ht.shape}).strict(),On=t=>xS.safeParse(t).success,SS=K({jsonrpc:W(qu),...tr.shape}).strict(),kS=t=>SS.safeParse(t).success,Mm=K({jsonrpc:W(qu),id:Zu,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(qu),id:Zu.optional(),error:K({code:Oe().int(),message:I(),data:Je().optional()})}).strict();var Bo=t=>Lm.safeParse(t).success;var ga=Ue([xS,SS,Mm,Lm]),Zne=Ue([Mm,Lm]),Du=mt.strict(),vq=er.extend({requestId:Zu.optional(),reason:I().optional()}),Fu=tr.extend({method:W("notifications/cancelled"),params:vq}),bq=K({src:I(),mimeType:I().optional(),sizes:be(I()).optional(),theme:At(["light","dark"]).optional()}),ya=K({icons:be(bq).optional()}),Uo=K({name:I(),title:I().optional()}),ES=Uo.extend({...Uo.shape,...ya.shape,version:I(),websiteUrl:I().optional(),description:I().optional()}),wq=Mu(K({applyDefaults:lt().optional()}),Ze(I(),Je())),xq=Am(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Mu(K({form:wq.optional(),url:ct.optional()}),Ze(I(),Je()).optional())),Sq=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({sampling:Et({createMessage:ct.optional()}).optional(),elicitation:Et({create:ct.optional()}).optional()}).optional()}),kq=Et({list:ct.optional(),cancel:ct.optional(),requests:Et({tools:Et({call:ct.optional()}).optional()}).optional()}),Eq=K({experimental:Ze(I(),ct).optional(),sampling:K({context:ct.optional(),tools:ct.optional()}).optional(),elicitation:xq.optional(),roots:K({listChanged:lt().optional()}).optional(),tasks:Sq.optional(),extensions:Ze(I(),ct).optional()}),Tq=Kt.extend({protocolVersion:I(),capabilities:Eq,clientInfo:ES}),Uu=ht.extend({method:W("initialize"),params:Tq}),qm=t=>Uu.safeParse(t).success,$q=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:kq.optional(),extensions:Ze(I(),ct).optional()}),Iq=mt.extend({protocolVersion:I(),capabilities:$q,serverInfo:ES,instructions:I().optional()}),Zm=tr.extend({method:W("notifications/initialized"),params:er.optional()});var Vu=ht.extend({method:W("ping"),params:Kt.optional()}),Pq=K({progress:Oe(),total:We(Oe()),message:We(I())}),Oq=K({...er.shape,...Pq.shape,progressToken:vS}),Bu=tr.extend({method:W("notifications/progress"),params:Oq}),Cq=Kt.extend({cursor:bS.optional()}),_a=ht.extend({params:Cq.optional()}),va=mt.extend({nextCursor:bS.optional()}),Nq=At(["working","input_required","completed","failed","cancelled"]),ba=K({taskId:I(),status:Nq,ttl:Ue([Oe(),lS()]),createdAt:I(),lastUpdatedAt:I(),pollInterval:We(Oe()),statusMessage:We(I())}),Ho=mt.extend({task:ba}),Aq=er.merge(ba),wa=tr.extend({method:W("notifications/tasks/status"),params:Aq}),Hu=ht.extend({method:W("tasks/get"),params:Kt.extend({taskId:I()})}),Ku=mt.merge(ba),Gu=ht.extend({method:W("tasks/result"),params:Kt.extend({taskId:I()})}),Dne=mt.loose(),Ju=_a.extend({method:W("tasks/list")}),Wu=va.extend({tasks:be(ba)}),Yu=ht.extend({method:W("tasks/cancel"),params:Kt.extend({taskId:I()})}),TS=mt.merge(ba),$S=K({uri:I(),mimeType:We(I()),_meta:Ze(I(),Je()).optional()}),IS=$S.extend({text:I()}),Dm=I().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),PS=$S.extend({blob:Dm}),xa=At(["user","assistant"]),Ko=K({audience:be(xa).optional(),priority:Oe().min(0).max(1).optional(),lastModified:pa.datetime({offset:!0}).optional()}),OS=K({...Uo.shape,...ya.shape,uri:I(),description:We(I()),mimeType:We(I()),size:We(Oe()),annotations:Ko.optional(),_meta:We(Et({}))}),Rq=K({...Uo.shape,...ya.shape,uriTemplate:I(),description:We(I()),mimeType:We(I()),annotations:Ko.optional(),_meta:We(Et({}))}),Xu=_a.extend({method:W("resources/list")}),jq=va.extend({resources:be(OS)}),Qu=_a.extend({method:W("resources/templates/list")}),zq=va.extend({resourceTemplates:be(Rq)}),Fm=Kt.extend({uri:I()}),Mq=Fm,el=ht.extend({method:W("resources/read"),params:Mq}),Lq=mt.extend({contents:be(Ue([IS,PS]))}),qq=tr.extend({method:W("notifications/resources/list_changed"),params:er.optional()}),Zq=Fm,Dq=ht.extend({method:W("resources/subscribe"),params:Zq}),Fq=Fm,Uq=ht.extend({method:W("resources/unsubscribe"),params:Fq}),Vq=er.extend({uri:I()}),Bq=tr.extend({method:W("notifications/resources/updated"),params:Vq}),Hq=K({name:I(),description:We(I()),required:We(lt())}),Kq=K({...Uo.shape,...ya.shape,description:We(I()),arguments:We(be(Hq)),_meta:We(Et({}))}),tl=_a.extend({method:W("prompts/list")}),Gq=va.extend({prompts:be(Kq)}),Jq=Kt.extend({name:I(),arguments:Ze(I(),I()).optional()}),rl=ht.extend({method:W("prompts/get"),params:Jq}),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()}),Wq=K({type:W("tool_use"),name:I(),id:I(),input:Ze(I(),Je()),_meta:Ze(I(),Je()).optional()}),Yq=K({type:W("resource"),resource:Ue([IS,PS]),annotations:Ko.optional(),_meta:Ze(I(),Je()).optional()}),Xq=OS.extend({type:W("resource_link")}),Hm=Ue([Um,Vm,Bm,Xq,Yq]),Qq=K({role:xa,content:Hm}),eZ=mt.extend({description:I().optional(),messages:be(Qq)}),tZ=tr.extend({method:W("notifications/prompts/list_changed"),params:er.optional()}),rZ=K({title:I().optional(),readOnlyHint:lt().optional(),destructiveHint:lt().optional(),idempotentHint:lt().optional(),openWorldHint:lt().optional()}),nZ=K({taskSupport:At(["required","optional","forbidden"]).optional()}),CS=K({...Uo.shape,...ya.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:rZ.optional(),execution:nZ.optional(),_meta:Ze(I(),Je()).optional()}),nl=_a.extend({method:W("tools/list")}),sZ=va.extend({tools:be(CS)}),sl=mt.extend({content:be(Hm).default([]),structuredContent:Ze(I(),Je()).optional(),isError:lt().optional()}),Fne=sl.or(mt.extend({toolResult:Je()})),oZ=ma.extend({name:I(),arguments:Ze(I(),Je()).optional()}),Go=ht.extend({method:W("tools/call"),params:oZ}),iZ=tr.extend({method:W("notifications/tools/list_changed"),params:er.optional()}),Une=K({autoRefresh:lt().default(!0),debounceMs:Oe().int().nonnegative().default(300)}),Sa=At(["debug","info","notice","warning","error","critical","alert","emergency"]),aZ=Kt.extend({level:Sa}),Km=ht.extend({method:W("logging/setLevel"),params:aZ}),cZ=er.extend({level:Sa,logger:I().optional(),data:Je()}),uZ=tr.extend({method:W("notifications/message"),params:cZ}),lZ=K({name:I().optional()}),dZ=K({hints:be(lZ).optional(),costPriority:Oe().min(0).max(1).optional(),speedPriority:Oe().min(0).max(1).optional(),intelligencePriority:Oe().min(0).max(1).optional()}),fZ=K({mode:At(["auto","required","none"]).optional()}),pZ=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()}),hZ=Nm("type",[Um,Vm,Bm]),Lu=Nm("type",[Um,Vm,Bm,Wq,pZ]),mZ=K({role:xa,content:Ue([Lu,be(Lu)]),_meta:Ze(I(),Je()).optional()}),gZ=ma.extend({messages:be(mZ),modelPreferences:dZ.optional(),systemPrompt:I().optional(),includeContext:At(["none","thisServer","allServers"]).optional(),temperature:Oe().optional(),maxTokens:Oe().int(),stopSequences:be(I()).optional(),metadata:ct.optional(),tools:be(CS).optional(),toolChoice:fZ.optional()}),yZ=ht.extend({method:W("sampling/createMessage"),params:gZ}),ka=mt.extend({model:I(),stopReason:We(At(["endTurn","stopSequence","maxTokens"]).or(I())),role:xa,content:hZ}),Gm=mt.extend({model:I(),stopReason:We(At(["endTurn","stopSequence","maxTokens","toolUse"]).or(I())),role:xa,content:Ue([Lu,be(Lu)])}),_Z=K({type:W("boolean"),title:I().optional(),description:I().optional(),default:lt().optional()}),vZ=K({type:W("string"),title:I().optional(),description:I().optional(),minLength:Oe().optional(),maxLength:Oe().optional(),format:At(["email","uri","date","date-time"]).optional(),default:I().optional()}),bZ=K({type:At(["number","integer"]),title:I().optional(),description:I().optional(),minimum:Oe().optional(),maximum:Oe().optional(),default:Oe().optional()}),wZ=K({type:W("string"),title:I().optional(),description:I().optional(),enum:be(I()),default:I().optional()}),xZ=K({type:W("string"),title:I().optional(),description:I().optional(),oneOf:be(K({const:I(),title:I()})),default:I().optional()}),SZ=K({type:W("string"),title:I().optional(),description:I().optional(),enum:be(I()),enumNames:be(I()).optional(),default:I().optional()}),kZ=Ue([wZ,xZ]),EZ=K({type:W("array"),title:I().optional(),description:I().optional(),minItems:Oe().optional(),maxItems:Oe().optional(),items:K({type:W("string"),enum:be(I())}),default:be(I()).optional()}),TZ=K({type:W("array"),title:I().optional(),description:I().optional(),minItems:Oe().optional(),maxItems:Oe().optional(),items:K({anyOf:be(K({const:I(),title:I()}))}),default:be(I()).optional()}),$Z=Ue([EZ,TZ]),IZ=Ue([SZ,kZ,$Z]),PZ=Ue([IZ,_Z,vZ,bZ]),OZ=ma.extend({mode:W("form").optional(),message:I(),requestedSchema:K({type:W("object"),properties:Ze(I(),PZ),required:be(I()).optional()})}),CZ=ma.extend({mode:W("url"),message:I(),elicitationId:I(),url:I().url()}),NZ=Ue([OZ,CZ]),AZ=ht.extend({method:W("elicitation/create"),params:NZ}),RZ=er.extend({elicitationId:I()}),jZ=tr.extend({method:W("notifications/elicitation/complete"),params:RZ}),Jo=mt.extend({action:At(["accept","decline","cancel"]),content:Am(t=>t===null?void 0:t,Ze(I(),Ue([I(),Oe(),lt(),be(I())])).optional())}),zZ=K({type:W("ref/resource"),uri:I()});var MZ=K({type:W("ref/prompt"),name:I()}),LZ=Kt.extend({ref:Ue([MZ,zZ]),argument:K({name:I(),value:I()}),context:K({arguments:Ze(I(),I()).optional()}).optional()}),ol=ht.extend({method:W("completion/complete"),params:LZ});function NS(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function AS(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var qZ=mt.extend({completion:Et({values:be(I()).max(100),total:We(Oe().int()),hasMore:We(lt())})}),ZZ=K({uri:I().startsWith("file://"),name:I().optional(),_meta:Ze(I(),Je()).optional()}),DZ=ht.extend({method:W("roots/list"),params:Kt.optional()}),Jm=mt.extend({roots:be(ZZ)}),FZ=tr.extend({method:W("notifications/roots/list_changed"),params:er.optional()}),Vne=Ue([Vu,Uu,ol,Km,rl,tl,Xu,Qu,el,Dq,Uq,Go,nl,Hu,Gu,Ju,Yu]),Bne=Ue([Fu,Bu,Zm,FZ,wa]),Hne=Ue([Du,ka,Gm,Jo,Jm,Ku,Wu,Ho]),Kne=Ue([Vu,yZ,AZ,DZ,Hu,Gu,Ju,Yu]),Gne=Ue([Fu,Bu,uZ,Bq,qq,iZ,tZ,wa,jZ]),Jne=Ue([Du,Iq,qZ,eZ,Gq,jq,zq,Lq,sl,sZ,Ku,Wu,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 Cn(t){return t==="completed"||t==="failed"||t==="cancelled"}f();f();f();var jS=Symbol("Let zodToJsonSchema decide on which parser to use");var RS={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"},zS=t=>typeof t=="string"?{...RS,name:t}:{...RS,...t};f();var MS=t=>{let e=zS(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 il=(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"?il(e,t.currentPath):e.join("/")}}f();function LS(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 qS(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 ZS(){return{type:"boolean"}}f();function al(t,e){return oe(t.type._def,e)}f();var DS=(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 UZ(t,e)}}var UZ=(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 FS(t,e){return{...oe(t.innerType._def,e),default:t.defaultValue()}}f();function US(t,e){return e.effectStrategy==="input"?oe(t.schema._def,e):Ye(e)}f();function VS(t){return{type:"string",enum:Array.from(t.values)}}f();var VZ=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function BS(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(VZ(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 HS(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,_r={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 cl(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":vr(r,"email",n.message,e);break;case"format:idn-email":vr(r,"idn-email",n.message,e);break;case"pattern:zod":Tt(r,_r.email,n.message,e);break}break;case"url":vr(r,"uri",n.message,e);break;case"uuid":vr(r,"uuid",n.message,e);break;case"regex":Tt(r,n.regex,n.message,e);break;case"cuid":Tt(r,_r.cuid,n.message,e);break;case"cuid2":Tt(r,_r.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":vr(r,"date-time",n.message,e);break;case"date":vr(r,"date",n.message,e);break;case"time":vr(r,"time",n.message,e);break;case"duration":vr(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"&&vr(r,"ipv4",n.message,e),n.version!=="v4"&&vr(r,"ipv6",n.message,e);break}case"base64url":Tt(r,_r.base64url,n.message,e);break;case"jwt":Tt(r,_r.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Tt(r,_r.ipv4Cidr,n.message,e),n.version!=="v4"&&Tt(r,_r.ipv6Cidr,n.message,e);break}case"emoji":Tt(r,_r.emoji(),n.message,e);break;case"ulid":{Tt(r,_r.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{vr(r,"binary",n.message,e);break}case"contentEncoding:base64":{we(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Tt(r,_r.base64,n.message,e);break}}break}case"nanoid":Tt(r,_r.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Qm(t,e){return e.patternStrategy==="escape"?HZ(t):t}var BZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function HZ(t){let e="";for(let r=0;r<t.length;r++)BZ.has(t[r])||(e+="\\"),e+=t[r];return e}function vr(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:KS(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):we(t,"pattern",KS(e,n),r,n)}function KS(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
@@ -222,7 +222,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
222
222
  `)):r=await Od(t);let n=await oG(t,r.device_code,5);return await dc(),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 oG(t,e,r){let n=Math.max(r,5)*1e3;for(;;){await iG(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 dc(),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 iG(t){return new Promise(e=>setTimeout(e,t))}f();var _j=se(wi(),1),vj=se(Ce(),1);import{existsSync as eee}from"fs";import{join as tee}from"path";f();f();var HP={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()},KP={query_id:R.string().uuid(),answers:R.array(R.object({dimension:R.string(),value:R.string()}))},GP={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()},JP={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)},WP={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()},YP={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.')},XP={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)},QP={tool_a:R.string().min(1),tool_b:R.string().min(1),use_case:R.string().optional(),project_config:R.string().max(1e5).optional()},eO={agent:R.enum(["claude","cursor","windsurf","copilot","copilot-cli","opencode","generic"]),project_root:R.string().min(1),server_path:R.string().optional()},tO={project_root:R.string().min(1),include_locations:R.boolean().optional()},rO={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()},nO={prompt:R.string().min(1).max(2e3),project_tools:R.array(R.string()).optional()},sO={query:R.string().min(1).max(500),agent_suggestions:R.array(R.string().min(1)).min(1).max(10)},oO={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 Jr(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 aO=se(Ce(),1);var iO=(0,aO.createMcpLogger)({name:"@toolcairn/tools:classify-prompt"}),aG=["tool_discovery","stack_building","tool_comparison"];async function gv(t){try{iO.info({promptLen:t.prompt.length},"classify_prompt called");let e=t.project_tools&&t.project_tools.length>0?`
225
+ `),{userId:n.user.id,email:n.user.email??"",name:n.user.name}}async function oG(t,e,r){let n=Math.max(r,5)*1e3;for(;;){await iG(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 dc(),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 iG(t){return new Promise(e=>setTimeout(e,t))}f();var _j=se(wi(),1),vj=se(Ce(),1);import{existsSync as tee}from"fs";import{join as ree}from"path";f();f();var HP={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()},KP={query_id:R.string().uuid(),answers:R.array(R.object({dimension:R.string(),value:R.string()}))},GP={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()},JP={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)},WP={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()},YP={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.')},XP={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)},QP={tool_a:R.string().min(1),tool_b:R.string().min(1),use_case:R.string().optional(),project_config:R.string().max(1e5).optional()},eO={agent:R.enum(["claude","cursor","windsurf","copilot","copilot-cli","opencode","generic"]),project_root:R.string().min(1),server_path:R.string().optional()},tO={project_root:R.string().min(1),include_locations:R.boolean().optional()},rO={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()},nO={prompt:R.string().min(1).max(2e3),project_tools:R.array(R.string()).optional()},sO={query:R.string().min(1).max(500),agent_suggestions:R.array(R.string().min(1)).min(1).max(10)},oO={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 Jr(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 aO=se(Ce(),1);var iO=(0,aO.createMcpLogger)({name:"@toolcairn/tools:classify-prompt"}),aG=["tool_discovery","stack_building","tool_comparison"];async function gv(t){try{iO.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,8 +249,8 @@ ${t.prompt}
249
249
  Your response (one category name only):`;return Jr({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:aG,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 iO.error({err:e},"classify_prompt failed"),dr("classify_error",e instanceof Error?e.message:String(e))}}f();var pj=se(Ce(),1);f();var cj=se(Ce(),1),Gi=se(zd(),1);import{readFile as t0}from"fs/promises";import{resolve as e0}from"path";f();f();import{join as Md}from"path";var Gn=".toolcairn",Tv="config.json",$v="audit-log.jsonl",Iv="audit-log.archive.jsonl";function Yr(t){return Md(t,Gn)}function Dt(t){return Md(t,Gn,Tv)}function Jn(t){return Md(t,Gn,$v)}function Pv(t){return Md(t,Gn,Iv)}f();var fO=se(Ce(),1);import{readFile as bG,rename as wG}from"fs/promises";import{join as xG}from"path";f();import{access as _G,readdir as _pe,stat as vG}from"fs/promises";async function Z(t){try{return await _G(t),!0}catch{return!1}}async function nt(t){try{return(await vG(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 Ov=(0,fO.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 bG(e,"utf-8")}catch(n){throw Ov.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=xG(t,Gn,`config.json.corrupt.${s}`);try{await wG(e,o),Ov.warn({configPath:e,backup:o,err:n},"config.json was unparseable \u2014 moved to backup")}catch(i){Ov.error({err:i,configPath:e,backup:o},"Failed to rename corrupt config.json")}return{config:null,path:e,corrupt_backup_path:o}}}f();var pO=se(Ce(),1),hO=se(zd(),1);import{mkdir as SG}from"fs/promises";var kG=(0,pO.createMcpLogger)({name:"@toolcairn/tools:config-store"});async function Ld(t,e){await SG(Yr(t),{recursive:!0});let r=Dt(t),n=`${JSON.stringify(e,null,2)}
253
- `;await(0,hO.default)(r,n),kG.debug({configPath:r,bytes:n.length},"config.json written atomically")}f();var GO=se(Ce(),1),JO=se(Vv(),1),WO=se(zd(),1);import{appendFile as Bv,mkdir as Hv,readFile as KO,rm as ihe,writeFile as eJ}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 yc=(0,GO.createMcpLogger)({name:"@toolcairn/tools:audit-log"}),tJ=5e3,HO=2500;async function vo(t,e){await Hv(Yr(t),{recursive:!0});let r=Jn(t),n=`${JSON.stringify(YO(e))}
252
+ Respond with ONLY 0 or 1.`,valid_classifications:["tool_discovery","stack_building","tool_comparison","tool_configuration","debugging","general_coding"],tool_required_if:aG,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 iO.error({err:e},"classify_prompt failed"),dr("classify_error",e instanceof Error?e.message:String(e))}}f();var pj=se(Ce(),1);f();var cj=se(Ce(),1),Gi=se(zd(),1);import{readFile as t0}from"fs/promises";import{resolve as e0}from"path";f();f();import{join as Md}from"path";var Gn=".toolcairn",Tv="config.json",$v="audit-log.jsonl",Iv="audit-log.archive.jsonl";function Yr(t){return Md(t,Gn)}function Dt(t){return Md(t,Gn,Tv)}function Jn(t){return Md(t,Gn,$v)}function Pv(t){return Md(t,Gn,Iv)}f();var fO=se(Ce(),1);import{readFile as bG,rename as wG}from"fs/promises";import{join as xG}from"path";f();import{access as _G,readdir as vpe,stat as vG}from"fs/promises";async function Z(t){try{return await _G(t),!0}catch{return!1}}async function nt(t){try{return(await vG(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 Ov=(0,fO.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 bG(e,"utf-8")}catch(n){throw Ov.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=xG(t,Gn,`config.json.corrupt.${s}`);try{await wG(e,o),Ov.warn({configPath:e,backup:o,err:n},"config.json was unparseable \u2014 moved to backup")}catch(i){Ov.error({err:i,configPath:e,backup:o},"Failed to rename corrupt config.json")}return{config:null,path:e,corrupt_backup_path:o}}}f();var pO=se(Ce(),1),hO=se(zd(),1);import{mkdir as SG}from"fs/promises";var kG=(0,pO.createMcpLogger)({name:"@toolcairn/tools:config-store"});async function Ld(t,e){await SG(Yr(t),{recursive:!0});let r=Dt(t),n=`${JSON.stringify(e,null,2)}
253
+ `;await(0,hO.default)(r,n),kG.debug({configPath:r,bytes:n.length},"config.json written atomically")}f();var GO=se(Ce(),1),JO=se(Vv(),1),WO=se(zd(),1);import{appendFile as Bv,mkdir as Hv,readFile as KO,rm as ahe,writeFile as eJ}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 yc=(0,GO.createMcpLogger)({name:"@toolcairn/tools:audit-log"}),tJ=5e3,HO=2500;async function vo(t,e){await Hv(Yr(t),{recursive:!0});let r=Jn(t),n=`${JSON.stringify(YO(e))}
254
254
  `;await Bv(r,n,"utf-8"),await XO(t,r)}function YO(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 Wd(t,e){if(e.length===0)return;await Hv(Yr(t),{recursive:!0});let r=Jn(t),n=e.map(s=>`${JSON.stringify(YO(s))}
255
255
  `).join("");await Bv(r,n,"utf-8"),await XO(t,r)}async function Yd(t,e){try{await rJ(t)}catch(s){yc.debug({err:s,projectRoot:t},"audit-log: bootstrap skipped (read-only?) \u2014 abandoning");return}let r=Dt(t),n=null;try{n=await JO.default.lock(r,{stale:1e4,retries:{retries:5,minTimeout:50,factor:2,maxTimeout:500},realpath:!1}),await vo(t,e)}catch(s){yc.warn({err:s,projectRoot:t},"audit-log: tool-call append failed")}finally{if(n)try{await n()}catch(s){yc.debug({err:s},"audit-log: lock release failed (likely already stale)")}}}async function rJ(t){await Hv(Yr(t),{recursive:!0});let e=Dt(t);await Z(e)||await eJ(e,`${JSON.stringify(_o(),null,2)}
256
256
  `,"utf-8")}async function Xd(t){let e=Jn(t);if(!await Z(e))return[];let r=await KO(e,"utf-8");return nJ(r)}async function XO(t,e){let n=(await KO(e,"utf-8")).split(`
@@ -259,7 +259,7 @@ Respond with ONLY 0 or 1.`,valid_classifications:["tool_discovery","stack_buildi
259
259
  `,"utf-8");let a=`${o.join(`
260
260
  `)}
261
261
  `;await(0,WO.default)(e,a),yc.info({archived:s.length,retained:o.length},"audit-log.jsonl rotated")}catch(a){yc.warn({err:a,auditPath:e,archivePath:i},"Audit-log rotation failed \u2014 live file intact")}}function nJ(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 Wd(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 QO=se(Ce(),1),eC=se(Vv(),1);import{mkdir as sJ,writeFile as oJ}from"fs/promises";var Kv=(0,QO.createMcpLogger)({name:"@toolcairn/tools:config-store"});async function Xr(t,e,r){let n=Dt(t),s=await Z(n);await iJ(t);let o=await eC.default.lock(n,{stale:1e4,retries:{retries:5,minTimeout:50,factor:2,maxTimeout:500},realpath:!1});try{let{config:i}=await $i(t),a,c=!s,u=!1;if(i?a=i:(a=_o(),Kv.info({projectRoot:t},"Bootstrapping fresh .toolcairn/config.json")),a.version==="1.0")u=(await Qd(a,t)).migrated;else{for(let p of a.tools.confirmed)p.locations||(p.locations=[]);a.project.languages||(a.project.languages=[]),a.project.frameworks||(a.project.frameworks=[]),a.project.subprojects||(a.project.subprojects=[])}if(a.version==="1.1"){let p=await ef(a,t);u=u||p.migrated}else a.tools.unknown_in_graph||(a.tools.unknown_in_graph=[]);await e(a);let l=new Date().toISOString(),d={...r,timestamp:l};return a.last_audit_entry=d,a.version="1.2",await Ld(t,a),await vo(t,d),{config:a,audit_entry:d,bootstrapped:c,migrated:u}}finally{try{await o()}catch(i){Kv.warn({err:i,configPath:n},"Failed to release config lock \u2014 may be stale")}}}async function iJ(t){await sJ(Yr(t),{recursive:!0});let e=Dt(t);if(!await Z(e))try{await oJ(e,`${JSON.stringify(_o(),null,2)}
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 Wd(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 QO=se(Ce(),1),eC=se(Vv(),1);import{mkdir as sJ,writeFile as oJ}from"fs/promises";var Kv=(0,QO.createMcpLogger)({name:"@toolcairn/tools:config-store"});async function Xr(t,e,r){let n=Dt(t),s=await Z(n);await iJ(t);let o=Date.now(),i=await eC.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 Ld(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 iJ(t){await sJ(Yr(t),{recursive:!0});let e=Dt(t);if(!await Z(e))try{await oJ(e,`${JSON.stringify(_o(),null,2)}
263
263
  `,"utf-8")}catch(r){Kv.debug({err:r,configPath:e},"Bootstrap seed skipped (likely race)")}}f();f();var ej=se(Ce(),1);import{readFile as $Q}from"fs/promises";import{basename as IQ,resolve as Ww}from"path";f();import{readdir as aJ}from"fs/promises";import{join as cJ}from"path";var uJ={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"]},lJ={".csproj":"nuget",".fsproj":"nuget"};async function tC(t){let e=new Set;for(let[r,n]of Object.entries(uJ))for(let s of n)if(await Z(cJ(t,s))){e.add(r);break}try{let r=await aJ(t);for(let n of r)for(let[s,o]of Object.entries(lJ))if(n.endsWith(s)){e.add(o);break}}catch{}return Array.from(e)}f();var dJ={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"}},fJ=new Set(["framework","web-framework","ui-framework","meta-framework","backend-framework","frontend-framework","mobile-framework"]);function rC(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=>fJ.has(p.toLowerCase()))&&(c=a.tool.canonical_name,u="graph"),!c){let d=dJ[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 pJ}from"fs/promises";import{join as hJ,relative as mJ,sep as gJ}from"path";var yJ={".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 nC(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 sC(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 sC(t,e,r,n,s){let o;try{o=await pJ(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=hJ(e,i.name);if(i.isDirectory())await sC(t,a,r,n,s);else if(i.isFile()){let c=_J(i.name);if(!c)continue;let u=yJ[c];if(!u)continue;r.set(u,(r.get(u)??0)+1);let l=mJ(t,a).split(gJ).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 dC}from"fs/promises";import{join as fC}from"path";f();f();f();f();f();f();function vJ(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function bJ(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
265
  `))}return s}var fe=class extends Error{line;column;codeblock;constructor(e,r){let[n,s]=vJ(r.toml,r.ptr),o=bJ(r.toml,n,s);super(`Invalid TOML document: ${e}
@@ -289,7 +289,7 @@ ${o}`,r),this.line=n,this.column=s,this.codeblock=o}};function wJ(t,e){let r=0;f
289
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 fR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=lR(t,"Gemfile.lock"),o=lR(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 dR(u))c.add(l.name)}catch{}for(let u of IX(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 dR(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 pR}from"fs/promises";import{join as hR}from"path";function PX(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 OX(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 mR=async({workspace_dir:t,workspace_rel:e})=>{let r=[],n=[],s=hR(t,"Package.resolved");if(await Z(s))try{let i=await pR(s,"utf-8"),a=e?`${e}/Package.resolved`:"Package.resolved";for(let c of PX(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=hR(t,"Package.swift");if(await Z(o))try{let i=await pR(o,"utf-8"),a=e?`${e}/Package.swift`:"Package.swift";for(let c of OX(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 gR={npm:cR,pypi:uR,cargo:hC,go:YA,rubygems:fR,maven:nR,gradle:eR,composer:_C,hex:iR,pub:uA,nuget:WA,"swift-pm":mR};f();f();var _R=se(Ce(),1);import{readFile as CX,readdir as yR}from"fs/promises";import{homedir as NX}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 AX=(0,_R.createMcpLogger)({name:"@toolcairn/tools:resolver:cargo"});async function RX(t,e){let r=Bw(NX(),".cargo","registry","src");if(!await nt(r))return null;let n;try{n=await yR(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 yR(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 vR(t,e,r,n={}){let s=await RX(r,n.resolved_version);if(!s)return{};try{let o=await CX(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 AX.debug({err:o instanceof Error?o.message:String(o),manifestPath:s},"Failed to parse cached Cargo.toml"),{}}}f();var bR=se(Ce(),1);import{readFile as jX}from"fs/promises";import{join as zX}from"path";var MX=(0,bR.createMcpLogger)({name:"@toolcairn/tools:resolver:composer"});async function wR(t,e,r){let n=zX(t,"vendor",r,"composer.json");if(!await Z(n))return{};try{let s=JSON.parse(await jX(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 MX.debug({err:s instanceof Error?s.message:String(s),path:n},"Failed to parse installed composer.json"),{}}}f();function xR(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 ER}from"fs/promises";import{homedir as ZX}from"os";import{join as Hw}from"path";f();var SR=se(Ce(),1),kR=se(tu(),1);import{readFile as LX}from"fs/promises";var qX=(0,SR.createMcpLogger)({name:"@toolcairn/tools:resolver:pom"});async function op(t,e){if(!await Z(t))return{};try{let r=await LX(t,"utf-8"),o=new kR.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 qX.debug({err:r instanceof Error?r.message:String(r),path:t},"Failed to parse .pom"),{}}}async function DX(t,e,r){let n=Hw(ZX(),".gradle","caches","modules-2","files-2.1",t,e);if(!await nt(n))return null;let s;try{s=await ER(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 ER(i)}catch{return null}for(let c of a)return Hw(i,c,`${e}-${o}.pom`);return null}async function TR(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 DX(o,i,n.resolved_version);return a?op(a,r):{}}f();var IR=se(Ce(),1);import{readFile as $R}from"fs/promises";import{join as Kw}from"path";var FX=(0,IR.createMcpLogger)({name:"@toolcairn/tools:resolver:hex"});function UX(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 VX(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 PR(t,e,r){let n=Kw(t,"deps",r),s={},o=Kw(n,"hex_metadata.config");if(await Z(o))try{let i=await $R(o,"utf-8"),a=UX(i),c=Ke(a);c&&(s.github_url=c)}catch(i){FX.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 $R(i,"utf-8"),c=VX(a),u=Ke(c);u&&(s.github_url=u)}catch{}}return s}f();import{readdir as BX}from"fs/promises";import{homedir as HX}from"os";import{join as OR}from"path";async function KX(t,e,r){let n=t.replace(/\./g,"/"),s=OR(HX(),".m2","repository",n,e);if(!await nt(s))return null;let o;try{o=await BX(s)}catch{return null}let i;return r&&o.includes(r)?i=r:(o.sort(),i=o[o.length-1]),i?OR(s,i,`${e}-${i}.pom`):null}async function CR(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 KX(o,i,n.resolved_version);return a?op(a,r):{}}f();var AR=se(Ce(),1);import{readFile as GX}from"fs/promises";import{join as NR}from"path";var JX=(0,AR.createMcpLogger)({name:"@toolcairn/tools:resolver:npm"});function WX(t){let e=t.repository;if(e)return typeof e=="string"?e:e.url}async function YX(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 RR(t,e,r){let n=await YX(t,e,r);if(!n)return{};let s;try{s=JSON.parse(await GX(n,"utf-8"))}catch(c){return JX.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=WX(s),a=Ke(i);return a&&(o.github_url=a),o}f();var zR=se(Ce(),1),MR=se(tu(),1);import{readFile as XX,readdir as QX}from"fs/promises";import{homedir as eQ}from"os";import{join as jR}from"path";var tQ=(0,zR.createMcpLogger)({name:"@toolcairn/tools:resolver:nuget"});async function rQ(t,e){let r=jR(eQ(),".nuget","packages",t.toLowerCase());if(!await nt(r))return null;let n;try{n=await QX(r)}catch{return null}let s=e&&n.includes(e)?e:n.sort().at(-1);if(!s)return null;let o=jR(r,s,`${t.toLowerCase()}.nuspec`);return await Z(o)?o:null}async function LR(t,e,r,n={}){let s=await rQ(r,n.resolved_version);if(!s)return{};try{let o=await XX(s,"utf-8"),c=new MR.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 tQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to parse .nuspec"),{}}}f();var qR=se(Ce(),1),ZR=se(Yc(),1);import{readFile as nQ}from"fs/promises";import{homedir as sQ,platform as oQ}from"os";import{join as ip}from"path";var iQ=(0,qR.createMcpLogger)({name:"@toolcairn/tools:resolver:pub"});function aQ(){if(oQ()==="win32"){let t=process.env.LOCALAPPDATA;if(t)return ip(t,"Pub","Cache","hosted","pub.dev")}return ip(sQ(),".pub-cache","hosted","pub.dev")}async function cQ(t,e){let r=aQ();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 DR(t,e,r,n={}){let s=await cQ(r,n.resolved_version);if(!s)return{};try{let o=await nQ(s,"utf-8"),i=(0,ZR.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 iQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to parse pubspec.yaml"),{}}}f();var UR=se(Ce(),1);import{readFile as uQ,readdir as FR}from"fs/promises";import{join as ru}from"path";var lQ=(0,UR.createMcpLogger)({name:"@toolcairn/tools:resolver:pypi"});async function dQ(t){let e=[],r=[".venv","venv",".virtualenv"];for(let n of r){let s=ru(t,n);if(!await nt(s))continue;let o=ru(s,"Lib","site-packages");await nt(o)&&e.push(o);let i=ru(s,"lib");if(await nt(i))try{for(let a of await FR(i)){if(!a.startsWith("python"))continue;let c=ru(i,a,"site-packages");await nt(c)&&e.push(c)}}catch{}}return e}function ap(t){return t.toLowerCase().replace(/[._]+/g,"-")}async function fQ(t,e){let r=ap(e),n;try{n=await FR(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=ru(t,s,"METADATA");if(await Z(i))return i}}return null}function pQ(t){let e=[],r,n,s=t.split(`
290
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 VR(t,e,r){let n=await dQ(t);for(let s of n){let o=await fQ(s,r);if(o)try{let i=await uQ(o,"utf-8"),{name:a,version:c,urls:u}=pQ(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){lQ.debug({err:i instanceof Error?i.message:String(i),path:o},"Failed to parse METADATA")}}return{}}f();var HR=se(Ce(),1);import{readFile as hQ,readdir as BR}from"fs/promises";import{homedir as mQ}from"os";import{join as cp}from"path";var gQ=(0,HR.createMcpLogger)({name:"@toolcairn/tools:resolver:ruby"});async function yQ(t,e,r){let n=[],s=cp(t,"vendor","bundle","ruby");if(await nt(s))try{for(let i of await BR(s)){let a=cp(s,i,"specifications");await nt(a)&&n.push(a)}}catch{}let o=cp(mQ(),".gem","specifications");await nt(o)&&n.push(o);for(let i of n){let a;try{a=await BR(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 KR(t,e,r,n={}){let s=await yQ(t,r,n.resolved_version);if(!s)return{};try{let o=await hQ(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 gQ.debug({err:o instanceof Error?o.message:String(o),path:s},"Failed to read/parse gemspec"),{}}}f();var GR=se(Ce(),1);import{readFile as vQ}from"fs/promises";import{join as bQ}from"path";var wQ=(0,GR.createMcpLogger)({name:"@toolcairn/tools:resolver:swift-pm"});async function JR(t,e,r){let n=bQ(t,"Package.resolved");if(!await Z(n))return{};try{let s=await vQ(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 wQ.debug({err:s instanceof Error?s.message:String(s),path:n},"Failed to parse Package.resolved during resolve"),{}}}var WR={npm:RR,pypi:VR,cargo:vR,go:(t,e,r)=>xR(t,e,r),rubygems:KR,maven:CR,gradle:TR,composer:wR,hex:PR,pub:DR,nuget:LR,"swift-pm":JR};f();import{readdir as YR}from"fs/promises";import{join as Gw,relative as xQ,sep as SQ}from"path";async function XR(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 kQ(t,c),l=i?r:n;for(let d of u)l.add(d)}return[...n].filter(s=>!r.has(s)).sort()}async function kQ(t,e){let r=e.split("/").filter(Boolean),n=[];return await nu(t,t,r,0,n),n}async function nu(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 nu(t,e,r,n+1,s);try{let i=await YR(e,{withFileTypes:!0});for(let a of i)!a.isDirectory()||po.has(a.name)||await nu(t,Gw(e,a.name),r,n,s)}catch{}return}if(o.includes("*")){let i=EQ(o);try{let a=await YR(e,{withFileTypes:!0});for(let c of a)!c.isDirectory()||po.has(c.name)||i.test(c.name)&&await nu(t,Gw(e,c.name),r,n+1,s)}catch{}return}await nu(t,Gw(e,o),r,n+1,s)}}function EQ(t){let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${e}$`)}function up(t,e){return xQ(t,e).split(SQ).join("/")}f();import{readFile as Hi}from"fs/promises";import{join as Ki}from"path";var QR=se(Yc(),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 TQ(i,r);if(c.length===0)continue;let u=await XR(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 TQ(t,e){let r=[],n=Ki(t,"pnpm-workspace.yaml");if(await Z(n))try{let u=(0,QR.parse)(await Hi(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=Ki(t,"package.json");if(await Z(s))try{let u=JSON.parse(await Hi(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=Ki(t,"Cargo.toml");if(await Z(o))try{let u=Pr(await Hi(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=Ki(t,"go.work");if(await Z(i))try{let u=await Hi(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=Ki(t,"lerna.json");if(await Z(a))try{let u=JSON.parse(await Hi(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=Ki(t,"nx.json");if(await Z(c))try{let l=JSON.parse(await Hi(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,ej.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 tC(C);for(let te of V){l.add(te);let pe=gR[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:PQ(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=WR[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)),y=await nC(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=rC(u,w),L=new Date().toISOString(),U=[],I=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&&I++;let Ae=Fe?"toolcairn":"non_oss",uu=ee?.tool?.canonical_name,Uj=ee?.tool?.categories,Vj=T.get(pe)??te,Bj=V.find(xp=>xp.resolved_version)?.resolved_version??V[0]?.version_constraint,mr=ee?.tool,wp=mr?.docs?{readme_url:mr.docs.readme_url??void 0,docs_url:mr.docs.docs_url??void 0,api_url:mr.docs.api_url??void 0,changelog_url:mr.docs.changelog_url??void 0}:void 0,Hj=wp&&Object.values(wp).some(xp=>xp!==void 0);U.push({name:C,source:Ae,github_url:Vj,version:Bj,chosen_at:L,chosen_reason:"Auto-detected from manifest during toolcairn_init scan",alternatives_considered:[],canonical_name:uu,categories:Uj,match_method:Ie,locations:V,description:mr?.description??void 0,license:mr?.license??void 0,homepage_url:mr?.homepage_url??void 0,docs:Hj?wp:void 0,package_managers:mr?.package_managers&&mr.package_managers.length>0?mr.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 OQ(o),F={ecosystems_scanned:[...l].sort(),parsers_failed:d.sort(),tools_resolved:I,tools_unresolved:U.length-I,duration_ms:Date.now()-r,completed_at:L};return Jw.info({projectRoot:o,workspaces:a.length,ecosystems:F.ecosystems_scanned,tools:U.length,resolved:I,languages:y.map(C=>C.name),frameworks:P.map(C=>C.name),duration_ms:F.duration_ms},"Project scan complete"),{name:A,languages:y,frameworks:P,subprojects:p,tools:U,warnings:i,scan_metadata:F}}function PQ(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 OQ(t){let e=Ww(t,"package.json");if(await Z(e))try{let r=JSON.parse(await $Q(e,"utf-8"));if(r.name)return r.name}catch{}return IQ(t)}f();var nj=se(Ce(),1);import{readdir as rj}from"fs/promises";import{resolve as Xw}from"path";var tj=(0,nj.createMcpLogger)({name:"@toolcairn/tools:discover-roots"}),CQ=["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"],NQ=[".csproj",".fsproj",".sln"];async function Qw(t,e={}){let{maxDepth:r=5}=e,n=Xw(t),s=await AQ(n,r);if(s.length===0)return tj.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 tj.info({cwd:n,candidates:s.length,roots:i.length},"Discovered project roots"),{roots:i,usedFallback:!1}}async function AQ(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 RQ(o)&&r.push(o);let a;try{a=await rj(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 RQ(t){if(!await nt(t))return!1;for(let r of CQ)if(await Z(Xw(t,r)))return!0;let e;try{e=await rj(t)}catch{return!1}for(let r of e)for(let n of NQ)if(r.endsWith(n))return!0;return!1}f();var sj=process.platform==="win32",jQ=sj?{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 MQ(){return{file_path:".cursorrules",mode:"append",content:Io}}function LQ(){return{file_path:".windsurfrules",mode:"append",content:Io}}function qQ(){return{file_path:".github/copilot-instructions.md",mode:"create",content:`# GitHub Copilot Instructions
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=Ki(t,"lerna.json");if(await Z(a))try{let u=JSON.parse(await Hi(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=Ki(t,"nx.json");if(await Z(c))try{let l=JSON.parse(await Hi(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,ej.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 tC(C);for(let te of V){l.add(te);let pe=gR[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:PQ(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=WR[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)),y=await nC(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=rC(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",uu=ee?.tool?.canonical_name,Uj=ee?.tool?.categories,Vj=T.get(pe)??te,Bj=V.find(xp=>xp.resolved_version)?.resolved_version??V[0]?.version_constraint,mr=ee?.tool,wp=mr?.docs?{readme_url:mr.docs.readme_url??void 0,docs_url:mr.docs.docs_url??void 0,api_url:mr.docs.api_url??void 0,changelog_url:mr.docs.changelog_url??void 0}:void 0,Hj=wp&&Object.values(wp).some(xp=>xp!==void 0);U.push({name:C,source:Ae,github_url:Vj,version:Bj,chosen_at:L,chosen_reason:"Auto-detected from manifest during toolcairn_init scan",alternatives_considered:[],canonical_name:uu,categories:Uj,match_method:Ie,locations:V,description:mr?.description??void 0,license:mr?.license??void 0,homepage_url:mr?.homepage_url??void 0,docs:Hj?wp:void 0,package_managers:mr?.package_managers&&mr.package_managers.length>0?mr.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 OQ(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:y.map(C=>C.name),frameworks:P.map(C=>C.name),duration_ms:F.duration_ms},"Project scan complete"),{name:A,languages:y,frameworks:P,subprojects:p,tools:U,warnings:i,scan_metadata:F}}function PQ(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 OQ(t){let e=Ww(t,"package.json");if(await Z(e))try{let r=JSON.parse(await $Q(e,"utf-8"));if(r.name)return r.name}catch{}return IQ(t)}f();var nj=se(Ce(),1);import{readdir as rj}from"fs/promises";import{resolve as Xw}from"path";var tj=(0,nj.createMcpLogger)({name:"@toolcairn/tools:discover-roots"}),CQ=["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"],NQ=[".csproj",".fsproj",".sln"];async function Qw(t,e={}){let{maxDepth:r=5}=e,n=Xw(t),s=await AQ(n,r);if(s.length===0)return tj.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 tj.info({cwd:n,candidates:s.length,roots:i.length},"Discovered project roots"),{roots:i,usedFallback:!1}}async function AQ(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 RQ(o)&&r.push(o);let a;try{a=await rj(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 RQ(t){if(!await nt(t))return!1;for(let r of CQ)if(await Z(Xw(t,r)))return!0;let e;try{e=await rj(t)}catch{return!1}for(let r of e)for(let n of NQ)if(r.endsWith(n))return!0;return!1}f();var sj=process.platform==="win32",jQ=sj?{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 MQ(){return{file_path:".cursorrules",mode:"append",content:Io}}function LQ(){return{file_path:".windsurfrules",mode:"append",content:Io}}function qQ(){return{file_path:".github/copilot-instructions.md",mode:"create",content:`# GitHub Copilot Instructions
293
293
  ${Io}`}}function ZQ(){return{file_path:".github/copilot-instructions.md",mode:"append",content:Io}}function DQ(){return{file_path:"AGENTS.md",mode:"append",content:Io}}function FQ(){return{file_path:"AI_INSTRUCTIONS.md",mode:"create",content:`# AI Assistant Instructions
294
294
  ${Io}`}}function oj(t){switch(t){case"claude":return zQ();case"cursor":return MQ();case"windsurf":return LQ();case"copilot":return qQ();case"copilot-cli":return ZQ();case"opencode":return DQ();case"generic":return FQ()}}function ij(t){return t?{toolcairn:{command:"node",args:[t]}}:jQ}function aj(t){return t?{toolcairn:{type:"local",command:["node",t],enabled:!0}}:{toolcairn:{type:"local",command:sj?["cmd","/c","npx","-y","@neurynae/toolcairn-mcp"]:["npx","-y","@neurynae/toolcairn-mcp"],enabled:!0}}}var dp=(0,cj.createMcpLogger)({name:"@toolcairn/tools:auto-init"}),uj=`
295
295
  # ToolCairn
@@ -297,7 +297,7 @@ ${Io}`}}function oj(t){switch(t){case"claude":return zQ();case"cursor":return MQ
297
297
  .toolcairn/audit-log.jsonl
298
298
  .toolcairn/audit-log.archive.jsonl
299
299
  .toolcairn/config.json
300
- `;async function su(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(I=>I.scope==="batch-resolve"&&/offline|falling back|unreachable|http /i.test(I.message)),c=new Date().toISOString(),u=a?[]:i.tools.filter(I=>I.source==="non_oss"&&!!I.github_url).map(I=>{let A=I.locations?.[0]?.ecosystem??"npm";return{name:I.name,ecosystem:A,canonical_package_name:I.canonical_name,github_url:I.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.`},{config:d,audit_entry:p,bootstrapped:g,migrated:h}=await Xr(e,I=>{if(I.project.name=i.name,I.project.languages=i.languages,I.project.frameworks=i.frameworks,I.project.subprojects=i.subprojects,I.scan_metadata=i.scan_metadata,!a){let F=new Map;for(let C of I.tools.confirmed){let z=C.locations?.[0]?.ecosystem??"";F.set(`${z}:${C.name}`,C)}I.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 I.tools.unknown_in_graph??[])A.set(`${F.ecosystem}:${F.name}`,F);I.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=oj(r),y=r==="opencode",b=y?aj(s):ij(s),w=y?"opencode.json":".mcp.json",x=JSON.stringify(y?{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:y?`Merge the toolcairn entry into ${w} under "mcp".`:`Merge the toolcairn entry into ${w} under "mcpServers".`},{step:3,action:"append",file:".gitignore",content:uj,note:"Ignore runtime/audit files. config.json should be committed so teammates share tool intelligence."}],P=t.skipSetupFileWrites?T.map(I=>({file:I.file,action:I.action,applied:!1,reason:"skipSetupFileWrites=true"})):await UQ(e,{agent:r,instructionFile:m.file_path,instructionContent:m.content,mcpConfigFile:w,mcpConfigEntry:b,isOpenCode:y}),L={total:d.tools.confirmed.length,indexed:d.tools.confirmed.filter(I=>I.source==="toolcairn").length,non_oss:d.tools.confirmed.filter(I=>I.source==="non_oss").length},U=(d.tools.unknown_in_graph??[]).filter(I=>!I.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:P,scan_summary:{project_name:i.name,languages:i.languages.map(I=>({name:I.name,file_count:I.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 UQ(t,e){let r=[];return r.push(await VQ(e0(t,e.instructionFile),e.instructionFile,e.instructionContent)),r.push(await BQ(e0(t,e.mcpConfigFile),e.mcpConfigFile,e.mcpConfigEntry,e.isOpenCode)),r.push(await KQ(e0(t,".gitignore"))),r}async function VQ(t,e,r){try{return await Z(t)&&await t0(t,"utf-8")===r?{file:e,action:"append-or-create",applied:!1,reason:"content already up to date"}:(await(0,Gi.default)(t,r,"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}}}async function BQ(t,e,r,n){try{let s=await Z(t),o=n?"mcp":"mcpServers";if(!s){let p={[o]:r};return await(0,Gi.default)(t,`${JSON.stringify(p,null,2)}
300
+ `;async function su(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=oj(r),y=r==="opencode",b=y?aj(s):ij(s),w=y?"opencode.json":".mcp.json",x=JSON.stringify(y?{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:y?`Merge the toolcairn entry into ${w} under "mcp".`:`Merge the toolcairn entry into ${w} under "mcpServers".`},{step:3,action:"append",file:".gitignore",content:uj,note:"Ignore runtime/audit files. config.json should be committed so teammates share tool intelligence."}],P=t.skipSetupFileWrites?T.map($=>({file:$.file,action:$.action,applied:!1,reason:"skipSetupFileWrites=true"})):await UQ(e,{agent:r,instructionFile:m.file_path,instructionContent:m.content,mcpConfigFile:w,mcpConfigEntry:b,isOpenCode:y}),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:P,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 UQ(t,e){let r=[];return r.push(await VQ(e0(t,e.instructionFile),e.instructionFile,e.instructionContent)),r.push(await BQ(e0(t,e.mcpConfigFile),e.mcpConfigFile,e.mcpConfigEntry,e.isOpenCode)),r.push(await KQ(e0(t,".gitignore"))),r}async function VQ(t,e,r){try{return await Z(t)&&await t0(t,"utf-8")===r?{file:e,action:"append-or-create",applied:!1,reason:"content already up to date"}:(await(0,Gi.default)(t,r,"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}}}async function BQ(t,e,r,n){try{let s=await Z(t),o=n?"mcp":"mcpServers";if(!s){let p={[o]:r};return await(0,Gi.default)(t,`${JSON.stringify(p,null,2)}
301
301
  `,"utf-8"),{file:e,action:"merge-or-create",applied:!0}}let i=await t0(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)}
302
302
  `;return i===d?{file:e,action:"merge-or-create",applied:!1,reason:"toolcairn entry already up to date"}:(await(0,Gi.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 lj="# toolcairn:start",dj="# toolcairn:end";function HQ(){return`${lj}${uj}${dj}
303
303
  `}async function KQ(t){let e=".gitignore";try{let r=await Z(t),n=HQ();if(!r)return await(0,Gi.default)(t,n,"utf-8"),{file:e,action:"append",applied:!0};let s=await t0(t,"utf-8"),o=s.indexOf(lj),i=s.indexOf(dj),a;if(o!==-1&&i!==-1&&i>o){let c=s.lastIndexOf(`
@@ -305,7 +305,7 @@ ${Io}`}}function oj(t){switch(t){case"claude":return zQ();case"cursor":return MQ
305
305
  `,i),l=u===-1?s.length:u+1;a=s.slice(0,c)+n+s.slice(l)}else{let c=s.endsWith(`
306
306
  `)?"":`
307
307
  `;a=`${s}${c}${n}`}return a===s?{file:e,action:"append",applied:!1,reason:"block already up to date"}:(await(0,Gi.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 fj=(0,pj.createMcpLogger)({name:"@toolcairn/tools:toolcairn-init"});async function r0(t,e={}){try{fj.info({agent:t.agent,project_root:t.project_root},"toolcairn_init called");let r=await su({projectRoot:t.project_root,agent:t.agent,batchResolve:e.batchResolve,serverPath:t.server_path,reason:"Explicit toolcairn_init call from agent"});return Jr({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:GQ(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 fj.error({err:r},"toolcairn_init failed"),dr("init_error",r instanceof Error?r.message:String(r))}}function GQ(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 mj=se(Ce(),1);var n0=(0,mj.createMcpLogger)({name:"@toolcairn/tools:read-project-config"}),JQ=90,WQ=7,YQ=new Set(["search_tools","search_tools_respond","get_stack"]);function XQ(t){let e=Date.now()-WQ*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&&YQ.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 hj(t){return(Date.now()-new Date(t).getTime())/(1e3*60*60*24)}async function s0(t){try{n0.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 Jr({status:"not_initialized",project_root:t.project_root,config_path:Dt(t.project_root),audit_log_path:Jn(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 y=m.last_verified??m.chosen_at??m.confirmed_at;return y?hj(y)>JQ:!0}).map(m=>{let y=m.last_verified??m.chosen_at??m.confirmed_at,b=y?Math.round(hj(y)):-1;return{name:m.name,last_verified:y??"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 Xd(t.project_root);l=XQ(m)}catch(m){n0.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 Jr({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(`
308
- `)})}catch(e){return n0.error({err:e},"read_project_config failed"),dr("read_config_error",e instanceof Error?e.message:String(e))}}f();var yj=se(Ce(),1);var gj=(0,yj.createMcpLogger)({name:"@toolcairn/tools:update-project-config"});async function o0(t){try{gj.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??QQ(t.action)},{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.`):Jr({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 gj.error({err:e},"update_project_config failed"),dr("update_config_error",e instanceof Error?e.message:String(e))}}function QQ(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,vj.createMcpLogger)({name:"@toolcairn/mcp-server:post-auth-init"});async function ree(){let t=await Ir();return t?new lo({baseUrl:_j.config.TOOLPILOT_API_URL,apiKey:t.client_id,accessToken:t.access_token}):null}async function ou(t={}){let e=t.cwd??process.cwd(),r=t.agent??"claude",n=await ree();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=tee(u,".toolcairn","config.json");if(eee(l)){us.debug({projectRoot:u},"Root already has config.json \u2014 skipping");continue}}try{let l=await su({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 nee(n,l);u.auto_submitted=d;let p=[...d.staged,...d.already_staged,...d.already_indexed];p.length>0&&await see(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=oee(i,a);return{cwd:e,roots_discovered:s,used_fallback:o,projects:i,unknown_tools_total:a,first_turn_directive:c}}async function nee(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 see(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"}),s===0&&us.debug({projectRoot:t,toolNames:e},"No unknown_in_graph entries flipped")}function oee(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 wj=se(Ce(),1);import{access as iee,mkdir as aee,writeFile as cee}from"fs/promises";import{platform as uee,type as lee}from"os";import{join as i0}from"path";f();function bj(t){return`<!DOCTYPE html>
308
+ `)})}catch(e){return n0.error({err:e},"read_project_config failed"),dr("read_config_error",e instanceof Error?e.message:String(e))}}f();var yj=se(Ce(),1);var gj=(0,yj.createMcpLogger)({name:"@toolcairn/tools:update-project-config"});async function o0(t){try{gj.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??eee(t.action),...t.query_id?{query_id:t.query_id}:{},metadata:QQ(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.`):Jr({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 gj.error({err:e},"update_project_config failed"),dr("update_config_error",e instanceof Error?e.message:String(e))}}function QQ(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 eee(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,vj.createMcpLogger)({name:"@toolcairn/mcp-server:post-auth-init"});async function nee(){let t=await Ir();return t?new lo({baseUrl:_j.config.TOOLPILOT_API_URL,apiKey:t.client_id,accessToken:t.access_token}):null}async function ou(t={}){let e=t.cwd??process.cwd(),r=t.agent??"claude",n=await nee();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=ree(u,".toolcairn","config.json");if(tee(l)){us.debug({projectRoot:u},"Root already has config.json \u2014 skipping");continue}}try{let l=await su({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 see(n,l);u.auto_submitted=d;let p=[...d.staged,...d.already_staged,...d.already_indexed];p.length>0&&await oee(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=iee(i,a);return{cwd:e,roots_discovered:s,used_fallback:o,projects:i,unknown_tools_total:a,first_turn_directive:c}}async function see(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 oee(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 iee(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 wj=se(Ce(),1);import{access as aee,mkdir as cee,writeFile as uee}from"fs/promises";import{platform as lee,type as dee}from"os";import{join as i0}from"path";f();function bj(t){return`<!DOCTYPE html>
309
309
  <html lang="en">
310
310
  <head>
311
311
  <meta charset="UTF-8" />
@@ -704,10 +704,10 @@ if (!EVENTS_PATH || EVENTS_PATH === 'null') {
704
704
  }
705
705
  </script>
706
706
  </body>
707
- </html>`}var iu=(0,wj.createMcpLogger)({name:"@toolcairn/mcp-server:project-setup"});function dee(){let t=uee();return{platform:t,label:{win32:"Windows",darwin:"macOS",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"Solaris",android:"Android"}[t]??lee()}}function fee(t){return t.replace(/\\/g,"/")}async function xj(t=process.cwd()){let e=dee();iu.info({os:e.label,platform:e.platform,projectRoot:t},"Detected OS \u2014 starting project setup");let r=i0(t,".toolcairn"),n=i0(r,"tracker.html"),s=i0(r,"events.jsonl"),o=fee(s);try{await aee(r,{recursive:!0}),await pee(n,bj(o),"tracker.html"),iu.info({dir:r,os:e.label},".toolcairn tracker ready")}catch(i){iu.warn({err:i,dir:r,os:e.label},"tracker.html setup failed \u2014 continuing (config.json still bootstrapped by handlers)")}}async function pee(t,e,r){try{await iee(t),iu.debug({file:r},"Already exists \u2014 skipping")}catch{await cee(t,e,"utf-8"),iu.info({file:r},"Created")}}f();var u0=se(wi(),1),pp=se(Ce(),1);f();var Sj=se(Ce(),1);import{existsSync as hee}from"fs";import{dirname as mee,isAbsolute as gee,join as yee,resolve as _ee}from"path";var vee=(0,Sj.createMcpLogger)({name:"@toolcairn/mcp-server:audit-logger"}),a0=new Map,bee=new Set(["search_tools","search_tools_respond","get_stack","refine_requirement"]),wee=new Set([]);function kj(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"&&bee.has(t)&&(s=Cee(s,t)),!wee.has(t)){let c=xee(r);if(c){let u=kee({toolName:t,args:r,result:s,status:o,duration_ms:a});Yd(c,u).catch(l=>{vee.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 xee(t){let e=t.project_root;return typeof e=="string"&&e.length>0&&gee(e)?e:See(process.cwd())}function See(t){let e=a0.get(t);if(e!==void 0)return e;let r=_ee(t);for(;;){if(hee(yee(r,".toolcairn","config.json")))return a0.set(t,r),r;let n=mee(r);if(n===r)return a0.set(t,null),null;r=n}}function kee(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?Aee(n):void 0,c=typeof a?.query_id=="string"?a.query_id:void 0,u=i??c,l=Eee(e,r,a),d=Tee(e,r),p=$ee(e,r),g=Iee(e,a),h=Pee(e,r,a),m=Oee(e,r,s),y={action:"tool_call",tool:l,timestamp:new Date().toISOString(),reason:m,mcp_tool:e,duration_ms:o,status:s};return u&&(y.query_id=u),d&&(y.outcome=d),p&&(y.replaced_by=p),g&&g.length>0&&(y.candidates=g),h&&Object.keys(h).length>0&&(y.metadata=h),y}function Eee(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 Tee(t,e){if(t!=="report_outcome")return;let r=e.outcome;if(r==="success"||r==="failure"||r==="replaced"||r==="pending")return r}function $ee(t,e){if(t==="report_outcome")return typeof e.replaced_by=="string"?e.replaced_by:void 0}function Iee(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 Pee(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 Oee(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 Cee(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=Nee(e,o),n.data=s,{...t,content:[{type:"text",text:JSON.stringify(n)}]})}catch{return t}}function Nee(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 Aee(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 Ej=se(wi(),1),Tj=se(Ce(),1);import{appendFile as Ree,mkdir as jee}from"fs/promises";import{dirname as zee}from"path";var $j=(0,Tj.createMcpLogger)({name:"@toolcairn/mcp-server:event-logger"});function Mee(){return process.env.TOOLCAIRN_TRACKING_ENABLED!=="false"}function Lee(){return process.env.TOOLCAIRN_EVENTS_PATH??null}function qee(t){return typeof t.query_id=="string"?t.query_id:null}function Zee(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 Dee(t,e){try{await jee(zee(t),{recursive:!0}),await Ree(t,`${JSON.stringify(e)}
708
- `,"utf-8")}catch(r){$j.warn({err:r,path:t},"Failed to write event to JSONL file")}}async function Fee(t){try{let e=await Ir();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(`${Ej.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){$j.debug({err:e},"Failed to send event to API \u2014 non-fatal")}}function Ij(t,e){return async r=>{if(!Mee())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?Zee(t,s):null,created_at:new Date().toISOString()};Fee(a).catch(()=>{});let c=Lee();c&&Dee(c,a).catch(()=>{})}return s??{content:[],isError:!0}}}var c0=(0,pp.createMcpLogger)({name:"@toolcairn/mcp-server:prod"}),Uee='\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 l0(t){let e=await Ir();if(!e||!Ti(e))throw new Error("ToolCairn: authentication required.");let r=new lo({baseUrl:u0.config.TOOLPILOT_API_URL,apiKey:e.client_id,accessToken:e.access_token});c0.info({user:e.user_email},"Registering production tools");function n(s,o){return Ij(s,kj(s,(0,pp.withErrorHandling)(s,c0,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:nO},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:eO},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:tO},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:rO},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:HP},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:KP},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:JP},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:YP},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:QP},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:oO},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:WP},n("check_issue",async s=>r.checkIssue(s))),t.registerTool("verify_suggestion",{description:"Validate agent-suggested tools against the ToolCairn graph.",inputSchema:sO},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:GP},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:XP},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 Ir(),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 fc(u0.config.TOOLPILOT_API_URL),a=await ou({agent:"claude"}).catch(c=>(c0.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 Pj(){let t=new pi({name:"toolcairn",version:"0.1.0"},{instructions:Uee});return await l0(t),t}f();f();import Cj 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(`
709
- `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Vee(r)}clear(){this._buffer=void 0}};function Vee(t){return ga.parse(JSON.parse(t))}function Oj(t){return JSON.stringify(t)+`
710
- `}var mp=class{constructor(e=Cj.stdin,r=Cj.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=Oj(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};f();f();import{Http2ServerRequest as jj,constants as Bee}from"http2";import{Http2ServerRequest as d0}from"http2";import{Readable as Nj}from"stream";import nte from"crypto";var Po=class extends Error{constructor(t,e){super(t,e),this.name="RequestError"}},Hee=t=>t instanceof Po?t:new Po(t.message,{cause:t}),Kee=global.Request,au=class extends Kee{constructor(t,e){typeof t=="object"&&Yi in t&&(t=t[Yi]()),typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(t,e)}},Gee=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"),Jee=(t,e,r,n,s)=>{let o={method:t,headers:r,signal:s.signal};if(t==="TRACE"){o.method="GET";let i=new au(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||=Nj.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=Nj.toWeb(n);return new au(e,o)},Yi=Symbol("getRequestCache"),Wee=Symbol("requestCache"),gp=Symbol("incomingKey"),yp=Symbol("urlKey"),Yee=Symbol("headersKey"),Wi=Symbol("abortControllerKey"),Xee=Symbol("getAbortController"),_p={get method(){return this[gp].method||"GET"},get url(){return this[yp]},get headers(){return this[Yee]||=Gee(this[gp])},[Xee](){return this[Yi](),this[Wi]},[Yi](){return this[Wi]||=new AbortController,this[Wee]||=Jee(this.method,this[yp],this.headers,this[gp],this[Wi])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(t=>{Object.defineProperty(_p,t,{get(){return this[Yi]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(_p,t,{value:function(){return this[Yi]()[t]()}})});Object.setPrototypeOf(_p,au.prototype);var Qee=(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 d0)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 d0?t.authority:t.headers.host)||e;if(!s)throw new Po("Missing host header");let o;if(t instanceof d0){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},Aj=Symbol("responseCache"),Ji=Symbol("getResponseCache"),Oo=Symbol("cache"),m0=global.Response,cu=class Mj{#r;#t;[Ji](){return delete this[Oo],this[Aj]||=new m0(this.#r,this.#t)}constructor(e,r){let n;if(this.#r=e,r instanceof Mj){let s=r[Aj];if(s){this.#t=s,this[Ji]();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[Ji]().headers}get status(){return this[Oo]?.[0]??this[Ji]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(cu.prototype,t,{get(){return this[Ji]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(cu.prototype,t,{value:function(){return this[Ji]()[t]()}})});Object.setPrototypeOf(cu,m0);Object.setPrototypeOf(cu.prototype,m0.prototype);async function ete(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}function Lj(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 tte(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:Lj(t.getReader(),e)}var p0=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},rte="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=nte);var g0=Symbol("outgoingEnded"),Rj=Symbol("incomingDraining"),ste=500,ote=64*1024*1024,f0=t=>{let e=t;if(t.destroyed||e[Rj])return;if(e[Rj]=!0,t instanceof jj){try{t.stream?.close?.(Bee.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,ste);o.unref?.();let i=a=>{r+=a.length,r>ote&&s()};t.on("data",i),t.on("end",n),t.on("error",n),t.resume()},ite=()=>new Response(null,{status:400}),qj=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.constructor.name==="TimeoutError")?504:500}),h0=(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))},Zj=t=>{"flushHeaders"in t&&t.writable&&t.flushHeaders()},Dj=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=p0(s);else if(Array.isArray(s)){let i=new Headers(s);o=i.has("content-length"),s=p0(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())):(Zj(e),await tte(n,e)?.catch(i=>h0(i,e))),e[g0]?.()},ate=t=>typeof t.then=="function",cte=async(t,e,r={})=>{if(ate(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(qj);if(Oo in t)return Dj(t,e);let n=p0(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 ete(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&&Zj(e),await Lj(s,e,a))}else n[rte]||(e.writeHead(t.status,n),e.end());e[g0]?.()},y0=(t,e={})=>{let r=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==au&&(Object.defineProperty(global,"Request",{value:au}),Object.defineProperty(global,"Response",{value:cu})),async(n,s)=>{let o,i;try{i=Qee(n,e.hostname);let a=!r||n.method==="GET"||n.method==="HEAD";if(a||(n[zj]=!0,n.on("end",()=>{a=!0}),n instanceof jj&&(s[g0]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{f0(n)})})}),s.on("finish",()=>{a||f0(n)})),s.on("close",()=>{i[Wi]&&(n.errored?i[Wi].abort(n.errored.toString()):s.writableFinished||i[Wi].abort("Client connection prematurely closed.")),a||setTimeout(()=>{a||setTimeout(()=>{f0(n)})})}),o=t(i,{incoming:n,outgoing:s}),Oo in o)return Dj(o,s)}catch(a){if(o)return h0(a,s);if(e.errorHandler){if(o=await e.errorHandler(i?a:Hee(a)),!o)return}else i?o=qj(a):o=ite()}try{return await cte(o,s,e)}catch(a){return h0(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}
707
+ </html>`}var iu=(0,wj.createMcpLogger)({name:"@toolcairn/mcp-server:project-setup"});function fee(){let t=lee();return{platform:t,label:{win32:"Windows",darwin:"macOS",linux:"Linux",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"Solaris",android:"Android"}[t]??dee()}}function pee(t){return t.replace(/\\/g,"/")}async function xj(t=process.cwd()){let e=fee();iu.info({os:e.label,platform:e.platform,projectRoot:t},"Detected OS \u2014 starting project setup");let r=i0(t,".toolcairn"),n=i0(r,"tracker.html"),s=i0(r,"events.jsonl"),o=pee(s);try{await cee(r,{recursive:!0}),await hee(n,bj(o),"tracker.html"),iu.info({dir:r,os:e.label},".toolcairn tracker ready")}catch(i){iu.warn({err:i,dir:r,os:e.label},"tracker.html setup failed \u2014 continuing (config.json still bootstrapped by handlers)")}}async function hee(t,e,r){try{await aee(t),iu.debug({file:r},"Already exists \u2014 skipping")}catch{await uee(t,e,"utf-8"),iu.info({file:r},"Created")}}f();var u0=se(wi(),1),pp=se(Ce(),1);f();var Sj=se(Ce(),1);import{existsSync as mee}from"fs";import{dirname as gee,isAbsolute as yee,join as _ee,resolve as vee}from"path";var bee=(0,Sj.createMcpLogger)({name:"@toolcairn/mcp-server:audit-logger"}),a0=new Map,wee=new Set(["search_tools","search_tools_respond","get_stack","refine_requirement"]),xee=new Set([]);function kj(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"&&wee.has(t)&&(s=Nee(s,t)),!xee.has(t)){let c=See(r);if(c){let u=Eee({toolName:t,args:r,result:s,status:o,duration_ms:a});Yd(c,u).catch(l=>{bee.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 See(t){let e=t.project_root;return typeof e=="string"&&e.length>0&&yee(e)?e:kee(process.cwd())}function kee(t){let e=a0.get(t);if(e!==void 0)return e;let r=vee(t);for(;;){if(mee(_ee(r,".toolcairn","config.json")))return a0.set(t,r),r;let n=gee(r);if(n===r)return a0.set(t,null),null;r=n}}function Eee(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?Ree(n):void 0,c=typeof a?.query_id=="string"?a.query_id:void 0,u=i??c,l=Tee(e,r,a),d=$ee(e,r),p=Iee(e,r),g=Pee(e,a),h=Oee(e,r,a),m=Cee(e,r,s),y={action:"tool_call",tool:l,timestamp:new Date().toISOString(),reason:m,mcp_tool:e,duration_ms:o,status:s};return u&&(y.query_id=u),d&&(y.outcome=d),p&&(y.replaced_by=p),g&&g.length>0&&(y.candidates=g),h&&Object.keys(h).length>0&&(y.metadata=h),y}function Tee(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 $ee(t,e){if(t!=="report_outcome")return;let r=e.outcome;if(r==="success"||r==="failure"||r==="replaced"||r==="pending")return r}function Iee(t,e){if(t==="report_outcome")return typeof e.replaced_by=="string"?e.replaced_by:void 0}function Pee(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 Oee(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 Cee(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 Nee(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=Aee(e,o),n.data=s,{...t,content:[{type:"text",text:JSON.stringify(n)}]})}catch{return t}}function Aee(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 Ree(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 Ej=se(wi(),1),Tj=se(Ce(),1);import{appendFile as jee,mkdir as zee}from"fs/promises";import{dirname as Mee}from"path";var $j=(0,Tj.createMcpLogger)({name:"@toolcairn/mcp-server:event-logger"});function Lee(){return process.env.TOOLCAIRN_TRACKING_ENABLED!=="false"}function qee(){return process.env.TOOLCAIRN_EVENTS_PATH??null}function Zee(t){return typeof t.query_id=="string"?t.query_id:null}function Dee(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 Fee(t,e){try{await zee(Mee(t),{recursive:!0}),await jee(t,`${JSON.stringify(e)}
708
+ `,"utf-8")}catch(r){$j.warn({err:r,path:t},"Failed to write event to JSONL file")}}async function Uee(t){try{let e=await Ir();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(`${Ej.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){$j.debug({err:e},"Failed to send event to API \u2014 non-fatal")}}function Ij(t,e){return async r=>{if(!Lee())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:Zee(r),duration_ms:i,status:o,metadata:s?Dee(t,s):null,created_at:new Date().toISOString()};Uee(a).catch(()=>{});let c=qee();c&&Fee(c,a).catch(()=>{})}return s??{content:[],isError:!0}}}var c0=(0,pp.createMcpLogger)({name:"@toolcairn/mcp-server:prod"}),Vee='\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 l0(t){let e=await Ir();if(!e||!Ti(e))throw new Error("ToolCairn: authentication required.");let r=new lo({baseUrl:u0.config.TOOLPILOT_API_URL,apiKey:e.client_id,accessToken:e.access_token});c0.info({user:e.user_email},"Registering production tools");function n(s,o){return Ij(s,kj(s,(0,pp.withErrorHandling)(s,c0,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:nO},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:eO},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:tO},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:rO},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:HP},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:KP},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:JP},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:YP},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:QP},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:oO},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:WP},n("check_issue",async s=>r.checkIssue(s))),t.registerTool("verify_suggestion",{description:"Validate agent-suggested tools against the ToolCairn graph.",inputSchema:sO},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:GP},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:XP},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 Ir(),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 fc(u0.config.TOOLPILOT_API_URL),a=await ou({agent:"claude"}).catch(c=>(c0.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 Pj(){let t=new pi({name:"toolcairn",version:"0.1.0"},{instructions:Vee});return await l0(t),t}f();f();import Cj 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(`
709
+ `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Bee(r)}clear(){this._buffer=void 0}};function Bee(t){return ga.parse(JSON.parse(t))}function Oj(t){return JSON.stringify(t)+`
710
+ `}var mp=class{constructor(e=Cj.stdin,r=Cj.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=Oj(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};f();f();import{Http2ServerRequest as jj,constants as Hee}from"http2";import{Http2ServerRequest as d0}from"http2";import{Readable as Nj}from"stream";import ste from"crypto";var Po=class extends Error{constructor(t,e){super(t,e),this.name="RequestError"}},Kee=t=>t instanceof Po?t:new Po(t.message,{cause:t}),Gee=global.Request,au=class extends Gee{constructor(t,e){typeof t=="object"&&Yi in t&&(t=t[Yi]()),typeof e?.body?.getReader<"u"&&(e.duplex??="half"),super(t,e)}},Jee=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"),Wee=(t,e,r,n,s)=>{let o={method:t,headers:r,signal:s.signal};if(t==="TRACE"){o.method="GET";let i=new au(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||=Nj.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=Nj.toWeb(n);return new au(e,o)},Yi=Symbol("getRequestCache"),Yee=Symbol("requestCache"),gp=Symbol("incomingKey"),yp=Symbol("urlKey"),Xee=Symbol("headersKey"),Wi=Symbol("abortControllerKey"),Qee=Symbol("getAbortController"),_p={get method(){return this[gp].method||"GET"},get url(){return this[yp]},get headers(){return this[Xee]||=Jee(this[gp])},[Qee](){return this[Yi](),this[Wi]},[Yi](){return this[Wi]||=new AbortController,this[Yee]||=Wee(this.method,this[yp],this.headers,this[gp],this[Wi])}};["body","bodyUsed","cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","signal","keepalive"].forEach(t=>{Object.defineProperty(_p,t,{get(){return this[Yi]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(_p,t,{value:function(){return this[Yi]()[t]()}})});Object.setPrototypeOf(_p,au.prototype);var ete=(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 d0)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 d0?t.authority:t.headers.host)||e;if(!s)throw new Po("Missing host header");let o;if(t instanceof d0){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},Aj=Symbol("responseCache"),Ji=Symbol("getResponseCache"),Oo=Symbol("cache"),m0=global.Response,cu=class Mj{#r;#t;[Ji](){return delete this[Oo],this[Aj]||=new m0(this.#r,this.#t)}constructor(e,r){let n;if(this.#r=e,r instanceof Mj){let s=r[Aj];if(s){this.#t=s,this[Ji]();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[Ji]().headers}get status(){return this[Oo]?.[0]??this[Ji]().status}get ok(){let e=this.status;return e>=200&&e<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(t=>{Object.defineProperty(cu.prototype,t,{get(){return this[Ji]()[t]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(t=>{Object.defineProperty(cu.prototype,t,{value:function(){return this[Ji]()[t]()}})});Object.setPrototypeOf(cu,m0);Object.setPrototypeOf(cu.prototype,m0.prototype);async function tte(t){return Promise.race([t,Promise.resolve().then(()=>Promise.resolve(void 0))])}function Lj(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 rte(t,e){if(t.locked)throw new TypeError("ReadableStream is locked.");return e.destroyed?void 0:Lj(t.getReader(),e)}var p0=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},nte="x-hono-already-sent";typeof global.crypto>"u"&&(global.crypto=ste);var g0=Symbol("outgoingEnded"),Rj=Symbol("incomingDraining"),ote=500,ite=64*1024*1024,f0=t=>{let e=t;if(t.destroyed||e[Rj])return;if(e[Rj]=!0,t instanceof jj){try{t.stream?.close?.(Hee.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,ote);o.unref?.();let i=a=>{r+=a.length,r>ite&&s()};t.on("data",i),t.on("end",n),t.on("error",n),t.resume()},ate=()=>new Response(null,{status:400}),qj=t=>new Response(null,{status:t instanceof Error&&(t.name==="TimeoutError"||t.constructor.name==="TimeoutError")?504:500}),h0=(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))},Zj=t=>{"flushHeaders"in t&&t.writable&&t.flushHeaders()},Dj=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=p0(s);else if(Array.isArray(s)){let i=new Headers(s);o=i.has("content-length"),s=p0(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())):(Zj(e),await rte(n,e)?.catch(i=>h0(i,e))),e[g0]?.()},cte=t=>typeof t.then=="function",ute=async(t,e,r={})=>{if(cte(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(qj);if(Oo in t)return Dj(t,e);let n=p0(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 tte(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&&Zj(e),await Lj(s,e,a))}else n[nte]||(e.writeHead(t.status,n),e.end());e[g0]?.()},y0=(t,e={})=>{let r=e.autoCleanupIncoming??!0;return e.overrideGlobalObjects!==!1&&global.Request!==au&&(Object.defineProperty(global,"Request",{value:au}),Object.defineProperty(global,"Response",{value:cu})),async(n,s)=>{let o,i;try{i=ete(n,e.hostname);let a=!r||n.method==="GET"||n.method==="HEAD";if(a||(n[zj]=!0,n.on("end",()=>{a=!0}),n instanceof jj&&(s[g0]=()=>{a||setTimeout(()=>{a||setTimeout(()=>{f0(n)})})}),s.on("finish",()=>{a||f0(n)})),s.on("close",()=>{i[Wi]&&(n.errored?i[Wi].abort(n.errored.toString()):s.writableFinished||i[Wi].abort("Client connection prematurely closed.")),a||setTimeout(()=>{a||setTimeout(()=>{f0(n)})})}),o=t(i,{incoming:n,outgoing:s}),Oo in o)return Dj(o,s)}catch(a){if(o)return h0(a,s);if(e.errorHandler){if(o=await e.errorHandler(i?a:Kee(a)),!o)return}else i?o=qj(a):o=ate()}try{return await ute(o,s,e)}catch(a){return h0(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}
711
711
  data:
712
712
 
713
713
  `;this._retryInterval!==void 0&&(i=`id: ${o}
@@ -718,7 +718,7 @@ data:
718
718
  `;return s&&(o+=`id: ${s}
719
719
  `),o+=`data: ${JSON.stringify(n)}
720
720
 
721
- `,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=>ga.parse(b)):a=[ga.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(On)){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")??_S;if(this._enableJsonResponse)return new Promise(b=>{this._streamMapping.set(l,{resolveJson:b,cleanup:()=>{this._streamMapping.delete(l)}});for(let w of a)On(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)}}),y={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(y["mcp-session-id"]=this.sessionId);for(let b of a)On(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;On(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:y})}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=y0(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 y0(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 ute=se(wi(),1);function Fj(){return process.env.MCP_TRANSPORT==="http"?new bp({sessionIdGenerator:()=>crypto.randomUUID()}):new mp}process.env.TOOLPILOT_MODE="production";var Wt=(0,v0.createMcpLogger)({name:"@toolcairn/mcp-server"});async function lte(){await xj();let t=await Ir(),e=t!==null&&Ti(t),r;if(e)Wt.info({user:t.user_email},"Authenticated \u2014 starting full server"),r=await Pj();else{let s="https://toolcairn.neurynae.com/signup",o="";try{let a=await lc();if(a)s=a.verification_uri,o=a.user_code,Wt.info({userCode:o},"Resuming pending sign-in");else{let c=await Od(_0.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
721
+ `,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=>ga.parse(b)):a=[ga.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(On)){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")??_S;if(this._enableJsonResponse)return new Promise(b=>{this._streamMapping.set(l,{resolveJson:b,cleanup:()=>{this._streamMapping.delete(l)}});for(let w of a)On(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)}}),y={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(y["mcp-session-id"]=this.sessionId);for(let b of a)On(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;On(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:y})}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=y0(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 y0(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 lte=se(wi(),1);function Fj(){return process.env.MCP_TRANSPORT==="http"?new bp({sessionIdGenerator:()=>crypto.randomUUID()}):new mp}process.env.TOOLPILOT_MODE="production";var Wt=(0,v0.createMcpLogger)({name:"@toolcairn/mcp-server"});async function dte(){await xj();let t=await Ir(),e=t!==null&&Ti(t),r;if(e)Wt.info({user:t.user_email},"Authenticated \u2014 starting full server"),r=await Pj();else{let s="https://toolcairn.neurynae.com/signup",o="";try{let a=await lc();if(a)s=a.verification_uri,o=a.user_code,Wt.info({userCode:o},"Resuming pending sign-in");else{let c=await Od(_0.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
722
722
 
723
723
  A browser window should have opened automatically.
724
724
 
@@ -729,7 +729,7 @@ Open the URL, sign in, and confirm the code shown. All 14 tools will appear auto
729
729
 
730
730
  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
731
731
 
732
- 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."})}]})),fc(_0.config.TOOLPILOT_API_URL).then(async()=>{Wt.info("Sign-in complete \u2014 adding all tools to running server");try{await l0(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 ou({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=Fj();await r.connect(n),Wt.info(e?"ToolCairn MCP ready":"ToolCairn MCP ready (awaiting sign-in)"),e&&ou({agent:"claude"}).then(s=>{Wt.info({roots:s.roots_discovered.length,provisioned:s.projects.length,unknown_tools_total:s.unknown_tools_total},"Background auto-refresh complete")}).catch(s=>{Wt.warn({err:s},"Background auto-refresh failed \u2014 config left as-is")})}lte().catch(t=>{(0,v0.createMcpLogger)({name:"@toolcairn/mcp-server"}).error({err:t},"Failed to start MCP server"),process.exit(1)});
732
+ 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."})}]})),fc(_0.config.TOOLPILOT_API_URL).then(async()=>{Wt.info("Sign-in complete \u2014 adding all tools to running server");try{await l0(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 ou({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=Fj();await r.connect(n),Wt.info(e?"ToolCairn MCP ready":"ToolCairn MCP ready (awaiting sign-in)"),e&&ou({agent:"claude"}).then(s=>{Wt.info({roots:s.roots_discovered.length,provisioned:s.projects.length,unknown_tools_total:s.unknown_tools_total},"Background auto-refresh complete")}).catch(s=>{Wt.warn({err:s},"Background auto-refresh failed \u2014 config left as-is")})}dte().catch(t=>{(0,v0.createMcpLogger)({name:"@toolcairn/mcp-server"}).error({err:t},"Failed to start MCP server"),process.exit(1)});
733
733
  /*! Bundled license information:
734
734
 
735
735
  imurmurhash/imurmurhash.js: