lexic-mcp 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.cjs CHANGED
@@ -3,12 +3,12 @@
3
3
  `:""},this._extScope=t,this._scope=new lt.Scope({parent:t}),this._nodes=[new kd]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new vd(t,i,n)),i}const(t,r,n){return this._def(lt.varKinds.const,t,r,n)}let(t,r,n){return this._def(lt.varKinds.let,t,r,n)}var(t,r,n){return this._def(lt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Pa(t,r,n))}add(t,r){return this._leafNode(new _d(t,H.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==ee.nil&&this._leafNode(new xd(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,ee.addCodeArg)(r,o));return r.push("}"),new ee._Code(r)}if(t,r,n){if(this._blockNode(new gr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new gr(t))}else(){return this._elseNode(new Yr)}endIf(){return this._endBlockNode(gr,Yr)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new wd(t),r)}forRange(t,r,n,o,i=this.opts.es5?lt.varKinds.var:lt.varKinds.let){let a=this._scope.toName(t);return this._for(new Sd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=lt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof ee.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ee._)`${a}.length`,s=>{this.var(i,(0,ee._)`${a}[${s}]`),n(i)})}return this._for(new Ta("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?lt.varKinds.var:lt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,ee._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Ta("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(vr)}label(t){return this._leafNode(new yd(t))}break(t){return this._leafNode(new $d(t))}return(t){let r=new Oo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Oo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new zd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new No(i),r(i)}return n&&(this._currNode=o.finally=new Do,this.code(n)),this._endBlockNode(No,Do)}throw(t){return this._leafNode(new bd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=ee.nil,n,o){return this._blockNode(new Eo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Eo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof gr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};H.CodeGen=Id;function _r(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ja(e,t){return t instanceof ee._CodeOrName?_r(e,t.names):e}function Qr(e,t,r){if(e instanceof ee.Name)return n(e);if(!o(e))return e;return new ee._Code(e._items.reduce((i,a)=>(a instanceof ee.Name&&(a=n(a)),a instanceof ee._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof ee._Code&&i._items.some(a=>a instanceof ee.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function Zw(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Dg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,ee._)`!${Pd(e)}`}H.not=Dg;var Rw=Zg(H.operators.AND);function Uw(...e){return e.reduce(Rw)}H.and=Uw;var Aw=Zg(H.operators.OR);function Cw(...e){return e.reduce(Aw)}H.or=Cw;function Zg(e){return(t,r)=>t===ee.nil?r:r===ee.nil?t:(0,ee._)`${Pd(t)} ${e} ${Pd(r)}`}function Pd(e){return e instanceof ee.Name?e:(0,ee._)`(${e})`}});var ne=w(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.checkStrictMode=X.getErrorPath=X.Type=X.useFunc=X.setEvaluated=X.evaluatedPropsToName=X.mergeEvaluated=X.eachItem=X.unescapeJsonPointer=X.escapeJsonPointer=X.escapeFragment=X.unescapeFragment=X.schemaRefOrVal=X.schemaHasRulesButRef=X.schemaHasRules=X.checkUnknownRules=X.alwaysValidSchema=X.toHash=void 0;var de=G(),Mw=To();function qw(e){let t={};for(let r of e)t[r]=!0;return t}X.toHash=qw;function Lw(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Ag(e,t),!Cg(t,e.self.RULES.all))}X.alwaysValidSchema=Lw;function Ag(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||Lg(e,`unknown keyword: "${i}"`)}X.checkUnknownRules=Ag;function Cg(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}X.schemaHasRules=Cg;function Vw(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}X.schemaHasRulesButRef=Vw;function Fw({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,de._)`${r}`}return(0,de._)`${e}${t}${(0,de.getProperty)(n)}`}X.schemaRefOrVal=Fw;function Jw(e){return Mg(decodeURIComponent(e))}X.unescapeFragment=Jw;function Kw(e){return encodeURIComponent(jd(e))}X.escapeFragment=Kw;function jd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}X.escapeJsonPointer=jd;function Mg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}X.unescapeJsonPointer=Mg;function Gw(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}X.eachItem=Gw;function Rg({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof de.Name?(i instanceof de.Name?e(o,i,a):t(o,i,a),a):i instanceof de.Name?(t(o,a,i),i):r(i,a);return s===de.Name&&!(c instanceof de.Name)?n(o,c):c}}X.mergeEvaluated={props:Rg({mergeNames:(e,t,r)=>e.if((0,de._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,de._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,de._)`${r} || {}`).code((0,de._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,de._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,de._)`${r} || {}`),Ed(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:qg}),items:Rg({mergeNames:(e,t,r)=>e.if((0,de._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,de._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,de._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,de._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function qg(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,de._)`{}`);return t!==void 0&&Ed(e,r,t),r}X.evaluatedPropsToName=qg;function Ed(e,t,r){Object.keys(r).forEach(n=>e.assign((0,de._)`${t}${(0,de.getProperty)(n)}`,!0))}X.setEvaluated=Ed;var Ug={};function Bw(e,t){return e.scopeValue("func",{ref:t,code:Ug[t.code]||(Ug[t.code]=new Mw._Code(t.code))})}X.useFunc=Bw;var Td;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Td||(X.Type=Td={}));function Hw(e,t,r){if(e instanceof de.Name){let n=t===Td.Num;return r?n?(0,de._)`"[" + ${e} + "]"`:(0,de._)`"['" + ${e} + "']"`:n?(0,de._)`"/" + ${e}`:(0,de._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,de.getProperty)(e).toString():"/"+jd(e)}X.getErrorPath=Hw;function Lg(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}X.checkStrictMode=Lg});var At=w(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});var Te=G(),Ww={data:new Te.Name("data"),valCxt:new Te.Name("valCxt"),instancePath:new Te.Name("instancePath"),parentData:new Te.Name("parentData"),parentDataProperty:new Te.Name("parentDataProperty"),rootData:new Te.Name("rootData"),dynamicAnchors:new Te.Name("dynamicAnchors"),vErrors:new Te.Name("vErrors"),errors:new Te.Name("errors"),this:new Te.Name("this"),self:new Te.Name("self"),scope:new Te.Name("scope"),json:new Te.Name("json"),jsonPos:new Te.Name("jsonPos"),jsonLen:new Te.Name("jsonLen"),jsonPart:new Te.Name("jsonPart")};Od.default=Ww});var Zo=w(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.extendErrors=je.resetErrorsCount=je.reportExtraError=je.reportError=je.keyword$DataError=je.keywordError=void 0;var te=G(),Oa=ne(),Ue=At();je.keywordError={message:({keyword:e})=>(0,te.str)`must pass "${e}" keyword validation`};je.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,te.str)`"${e}" keyword must be ${t} ($data)`:(0,te.str)`"${e}" keyword is invalid ($data)`};function Xw(e,t=je.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=Jg(e,t,r);n??(a||s)?Vg(i,c):Fg(o,(0,te._)`[${c}]`)}je.reportError=Xw;function Yw(e,t=je.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=Jg(e,t,r);Vg(o,s),i||a||Fg(n,Ue.default.vErrors)}je.reportExtraError=Yw;function Qw(e,t){e.assign(Ue.default.errors,t),e.if((0,te._)`${Ue.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,te._)`${Ue.default.vErrors}.length`,t),()=>e.assign(Ue.default.vErrors,null)))}je.resetErrorsCount=Qw;function eS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ue.default.errors,s=>{e.const(a,(0,te._)`${Ue.default.vErrors}[${s}]`),e.if((0,te._)`${a}.instancePath === undefined`,()=>e.assign((0,te._)`${a}.instancePath`,(0,te.strConcat)(Ue.default.instancePath,i.errorPath))),e.assign((0,te._)`${a}.schemaPath`,(0,te.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,te._)`${a}.schema`,r),e.assign((0,te._)`${a}.data`,n))})}je.extendErrors=eS;function Vg(e,t){let r=e.const("err",t);e.if((0,te._)`${Ue.default.vErrors} === null`,()=>e.assign(Ue.default.vErrors,(0,te._)`[${r}]`),(0,te._)`${Ue.default.vErrors}.push(${r})`),e.code((0,te._)`${Ue.default.errors}++`)}function Fg(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,te._)`new ${e.ValidationError}(${t})`):(r.assign((0,te._)`${n}.errors`,t),r.return(!1))}var yr={keyword:new te.Name("keyword"),schemaPath:new te.Name("schemaPath"),params:new te.Name("params"),propertyName:new te.Name("propertyName"),message:new te.Name("message"),schema:new te.Name("schema"),parentSchema:new te.Name("parentSchema")};function Jg(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,te._)`{}`:tS(e,t,r)}function tS(e,t,r={}){let{gen:n,it:o}=e,i=[rS(o,r),nS(e,r)];return oS(e,t,i),n.object(...i)}function rS({errorPath:e},{instancePath:t}){let r=t?(0,te.str)`${e}${(0,Oa.getErrorPath)(t,Oa.Type.Str)}`:e;return[Ue.default.instancePath,(0,te.strConcat)(Ue.default.instancePath,r)]}function nS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,te.str)`${t}/${e}`;return r&&(o=(0,te.str)`${o}${(0,Oa.getErrorPath)(r,Oa.Type.Str)}`),[yr.schemaPath,o]}function oS(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([yr.keyword,o],[yr.params,typeof t=="function"?t(e):t||(0,te._)`{}`]),c.messages&&n.push([yr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([yr.schema,a],[yr.parentSchema,(0,te._)`${l}${d}`],[Ue.default.data,i]),u&&n.push([yr.propertyName,u])}});var Gg=w(en=>{"use strict";Object.defineProperty(en,"__esModule",{value:!0});en.boolOrEmptySchema=en.topBoolOrEmptySchema=void 0;var iS=Zo(),aS=G(),sS=At(),cS={message:"boolean schema is false"};function uS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Kg(e,!1):typeof r=="object"&&r.$async===!0?t.return(sS.default.data):(t.assign((0,aS._)`${n}.errors`,null),t.return(!0))}en.topBoolOrEmptySchema=uS;function lS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Kg(e)):r.var(t,!0)}en.boolOrEmptySchema=lS;function Kg(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,iS.reportError)(o,cS,void 0,t)}});var Nd=w(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});tn.getRules=tn.isJSONType=void 0;var dS=["string","number","integer","boolean","null","object","array"],pS=new Set(dS);function fS(e){return typeof e=="string"&&pS.has(e)}tn.isJSONType=fS;function mS(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}tn.getRules=mS});var Dd=w(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.shouldUseRule=Qt.shouldUseGroup=Qt.schemaHasRulesForType=void 0;function hS({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Bg(e,n)}Qt.schemaHasRulesForType=hS;function Bg(e,t){return t.rules.some(r=>Hg(e,r))}Qt.shouldUseGroup=Bg;function Hg(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Qt.shouldUseRule=Hg});var Ro=w(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.reportTypeError=Ee.checkDataTypes=Ee.checkDataType=Ee.coerceAndCheckDataType=Ee.getJSONTypes=Ee.getSchemaTypes=Ee.DataType=void 0;var gS=Nd(),vS=Dd(),_S=Zo(),J=G(),Wg=ne(),rn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(rn||(Ee.DataType=rn={}));function yS(e){let t=Xg(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Ee.getSchemaTypes=yS;function Xg(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(gS.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ee.getJSONTypes=Xg;function $S(e,t){let{gen:r,data:n,opts:o}=e,i=bS(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,vS.schemaHasRulesForType)(e,t[0]));if(a){let s=Rd(t,n,o.strictNumbers,rn.Wrong);r.if(s,()=>{i.length?xS(e,t,i):Ud(e)})}return a}Ee.coerceAndCheckDataType=$S;var Yg=new Set(["string","number","integer","boolean","null"]);function bS(e,t){return t?e.filter(r=>Yg.has(r)||t==="array"&&r==="array"):[]}function xS(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,J._)`typeof ${o}`),s=n.let("coerced",(0,J._)`undefined`);i.coerceTypes==="array"&&n.if((0,J._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,J._)`${o}[0]`).assign(a,(0,J._)`typeof ${o}`).if(Rd(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,J._)`${s} !== undefined`);for(let u of r)(Yg.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Ud(e),n.endIf(),n.if((0,J._)`${s} !== undefined`,()=>{n.assign(o,s),kS(e,s)});function c(u){switch(u){case"string":n.elseIf((0,J._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,J._)`"" + ${o}`).elseIf((0,J._)`${o} === null`).assign(s,(0,J._)`""`);return;case"number":n.elseIf((0,J._)`${a} == "boolean" || ${o} === null
4
4
  || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,J._)`+${o}`);return;case"integer":n.elseIf((0,J._)`${a} === "boolean" || ${o} === null
5
5
  || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,J._)`+${o}`);return;case"boolean":n.elseIf((0,J._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,J._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,J._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,J._)`${a} === "string" || ${a} === "number"
6
- || ${a} === "boolean" || ${o} === null`).assign(s,(0,J._)`[${o}]`)}}}function kS({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,J._)`${t} !== undefined`,()=>e.assign((0,J._)`${t}[${r}]`,n))}function Zd(e,t,r,n=rn.Correct){let o=n===rn.Correct?J.operators.EQ:J.operators.NEQ,i;switch(e){case"null":return(0,J._)`${t} ${o} null`;case"array":i=(0,J._)`Array.isArray(${t})`;break;case"object":i=(0,J._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,J._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,J._)`typeof ${t} ${o} ${e}`}return n===rn.Correct?i:(0,J.not)(i);function a(s=J.nil){return(0,J.and)((0,J._)`typeof ${t} == "number"`,s,r?(0,J._)`isFinite(${t})`:J.nil)}}Ee.checkDataType=Zd;function Rd(e,t,r,n){if(e.length===1)return Zd(e[0],t,r,n);let o,i=(0,Wg.toHash)(e);if(i.array&&i.object){let a=(0,J._)`typeof ${t} != "object"`;o=i.null?a:(0,J._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=J.nil;i.number&&delete i.integer;for(let a in i)o=(0,J.and)(o,Zd(a,t,r,n));return o}Ee.checkDataTypes=Rd;var wS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,J._)`{type: ${e}}`:(0,J._)`{type: ${t}}`};function Ud(e){let t=SS(e);(0,_S.reportError)(t,wS)}Ee.reportTypeError=Ud;function SS(e){let{gen:t,data:r,schema:n}=e,o=(0,Wg.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var ev=w(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.assignDefaults=void 0;var nn=G(),zS=ne();function IS(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Qg(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Qg(e,i,o.default))}Na.assignDefaults=IS;function Qg(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,nn._)`${i}${(0,nn.getProperty)(t)}`;if(o){(0,zS.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,nn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,nn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,nn._)`${s} = ${(0,nn.stringify)(r)}`)}});var rt=w(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.validateUnion=se.validateArray=se.usePattern=se.callValidateCode=se.schemaProperties=se.allSchemaProperties=se.noPropertyInData=se.propertyInData=se.isOwnProperty=se.hasPropFunc=se.reportMissingProp=se.checkMissingProp=se.checkReportMissingProp=void 0;var he=G(),Ad=ne(),er=At(),PS=ne();function TS(e,t){let{gen:r,data:n,it:o}=e;r.if(Md(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,he._)`${t}`},!0),e.error()})}se.checkReportMissingProp=TS;function jS({gen:e,data:t,it:{opts:r}},n,o){return(0,he.or)(...n.map(i=>(0,he.and)(Md(e,t,i,r.ownProperties),(0,he._)`${o} = ${i}`)))}se.checkMissingProp=jS;function ES(e,t){e.setParams({missingProperty:t},!0),e.error()}se.reportMissingProp=ES;function tv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}se.hasPropFunc=tv;function Cd(e,t,r){return(0,he._)`${tv(e)}.call(${t}, ${r})`}se.isOwnProperty=Cd;function OS(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${Cd(e,t,r)}`:o}se.propertyInData=OS;function Md(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(Cd(e,t,r))):o}se.noPropertyInData=Md;function rv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}se.allSchemaProperties=rv;function NS(e,t){return rv(t).filter(r=>!(0,Ad.alwaysValidSchema)(e,t[r]))}se.schemaProperties=NS;function DS({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,he._)`${e}, ${t}, ${n}${o}`:t,d=[[er.default.instancePath,(0,he.strConcat)(er.default.instancePath,i)],[er.default.parentData,a.parentData],[er.default.parentDataProperty,a.parentDataProperty],[er.default.rootData,er.default.rootData]];a.opts.dynamicRef&&d.push([er.default.dynamicAnchors,er.default.dynamicAnchors]);let m=(0,he._)`${l}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${s}.call(${c}, ${m})`:(0,he._)`${s}(${m})`}se.callValidateCode=DS;var ZS=(0,he._)`new RegExp`;function RS({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,he._)`${o.code==="new RegExp"?ZS:(0,PS.useFunc)(e,o)}(${r}, ${n})`})}se.usePattern=RS;function US(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,he._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Ad.Type.Num},i),t.if((0,he.not)(i),s)})}}se.validateArray=US;function AS(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ad.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,he._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,he.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}se.validateUnion=AS});var iv=w($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.validateKeywordUsage=$t.validSchemaType=$t.funcKeywordCode=$t.macroKeywordCode=void 0;var Ae=G(),$r=At(),CS=rt(),MS=Zo();function qS(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=ov(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ae.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}$t.macroKeywordCode=qS;function LS(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;FS(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=ov(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)g(),t.modifying&&nv(e),$(()=>e.error());else{let b=t.async?f():h();t.modifying&&nv(e),$(()=>VS(e,b))}}function f(){let b=n.let("ruleErrs",null);return n.try(()=>g((0,Ae._)`await `),P=>n.assign(d,!1).if((0,Ae._)`${P} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Ae._)`${P}.errors`),()=>n.throw(P))),b}function h(){let b=(0,Ae._)`${l}.errors`;return n.assign(b,null),g(Ae.nil),b}function g(b=t.async?(0,Ae._)`await `:Ae.nil){let P=c.opts.passContext?$r.default.this:$r.default.self,I=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ae._)`${b}${(0,CS.callValidateCode)(e,l,P,I)}`,t.modifying)}function $(b){var P;n.if((0,Ae.not)((P=t.valid)!==null&&P!==void 0?P:d),b)}}$t.funcKeywordCode=LS;function nv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ae._)`${n.parentData}[${n.parentDataProperty}]`))}function VS(e,t){let{gen:r}=e;r.if((0,Ae._)`Array.isArray(${t})`,()=>{r.assign($r.default.vErrors,(0,Ae._)`${$r.default.vErrors} === null ? ${t} : ${$r.default.vErrors}.concat(${t})`).assign($r.default.errors,(0,Ae._)`${$r.default.vErrors}.length`),(0,MS.extendErrors)(e)},()=>e.error())}function FS({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function ov(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ae.stringify)(r)})}function JS(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}$t.validSchemaType=JS;function KS({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}$t.validateKeywordUsage=KS});var sv=w(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.extendSubschemaMode=tr.extendSubschemaData=tr.getSubschema=void 0;var bt=G(),av=ne();function GS(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}${(0,bt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,av.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}tr.getSubschema=GS;function BS(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=s.let("data",(0,bt._)`${t.data}${(0,bt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,bt.str)`${u}${(0,av.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,bt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof bt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}tr.extendSubschemaData=BS;function HS(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}tr.extendSubschemaMode=HS});var qd=w((pU,cv)=>{"use strict";cv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var lv=w((fU,uv)=>{"use strict";var rr=uv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Da(t,n,o,e,"",e)};rr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};rr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};rr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};rr.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 Da(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in rr.arrayKeywords)for(var m=0;m<d.length;m++)Da(e,t,r,d[m],o+"/"+l+"/"+m,i,o,l,n,m)}else if(l in rr.propsKeywords){if(d&&typeof d=="object")for(var f in d)Da(e,t,r,d[f],o+"/"+l+"/"+WS(f),i,o,l,n,f)}else(l in rr.keywords||e.allKeys&&!(l in rr.skipKeywords))&&Da(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function WS(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Uo=w(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.getSchemaRefs=Le.resolveUrl=Le.normalizeId=Le._getFullPath=Le.getFullPath=Le.inlineRef=void 0;var XS=ne(),YS=qd(),QS=lv(),ez=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function tz(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ld(e):t?dv(e)<=t:!1}Le.inlineRef=tz;var rz=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ld(e){for(let t in e){if(rz.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ld)||typeof r=="object"&&Ld(r))return!0}return!1}function dv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!ez.has(r)&&(typeof e[r]=="object"&&(0,XS.eachItem)(e[r],n=>t+=dv(n)),t===1/0))return 1/0}return t}function pv(e,t="",r){r!==!1&&(t=on(t));let n=e.parse(t);return fv(e,n)}Le.getFullPath=pv;function fv(e,t){return e.serialize(t).split("#")[0]+"#"}Le._getFullPath=fv;var nz=/#\/?$/;function on(e){return e?e.replace(nz,""):""}Le.normalizeId=on;function oz(e,t,r){return r=on(r),e.resolve(t,r)}Le.resolveUrl=oz;var iz=/^[a-z_][-a-z0-9._]*$/i;function az(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=on(e[r]||t),i={"":o},a=pv(n,o,!1),s={},c=new Set;return QS(e,{allKeys:!0},(d,m,f,h)=>{if(h===void 0)return;let g=a+m,$=i[h];typeof d[r]=="string"&&($=b.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),i[m]=$;function b(I){let A=this.opts.uriResolver.resolve;if(I=on($?A($,I):I),c.has(I))throw l(I);c.add(I);let O=this.refs[I];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?u(d,O.schema,I):I!==on(g)&&(I[0]==="#"?(u(d,s[I],I),s[I]=d):this.refs[I]=g),I}function P(I){if(typeof I=="string"){if(!iz.test(I))throw new Error(`invalid anchor "${I}"`);b.call(this,`#${I}`)}}}),s;function u(d,m,f){if(m!==void 0&&!YS(d,m))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Le.getSchemaRefs=az});var Mo=w(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.getData=nr.KeywordCxt=nr.validateFunctionCode=void 0;var _v=Gg(),mv=Ro(),Fd=Dd(),Za=Ro(),sz=ev(),Co=iv(),Vd=sv(),E=G(),C=At(),cz=Uo(),Ct=ne(),Ao=Zo();function uz(e){if(bv(e)&&(xv(e),$v(e))){pz(e);return}yv(e,()=>(0,_v.topBoolOrEmptySchema)(e))}nr.validateFunctionCode=uz;function yv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,E._)`${C.default.data}, ${C.default.valCxt}`,n.$async,()=>{e.code((0,E._)`"use strict"; ${hv(r,o)}`),dz(e,o),e.code(i)}):e.func(t,(0,E._)`${C.default.data}, ${lz(o)}`,n.$async,()=>e.code(hv(r,o)).code(i))}function lz(e){return(0,E._)`{${C.default.instancePath}="", ${C.default.parentData}, ${C.default.parentDataProperty}, ${C.default.rootData}=${C.default.data}${e.dynamicRef?(0,E._)`, ${C.default.dynamicAnchors}={}`:E.nil}}={}`}function dz(e,t){e.if(C.default.valCxt,()=>{e.var(C.default.instancePath,(0,E._)`${C.default.valCxt}.${C.default.instancePath}`),e.var(C.default.parentData,(0,E._)`${C.default.valCxt}.${C.default.parentData}`),e.var(C.default.parentDataProperty,(0,E._)`${C.default.valCxt}.${C.default.parentDataProperty}`),e.var(C.default.rootData,(0,E._)`${C.default.valCxt}.${C.default.rootData}`),t.dynamicRef&&e.var(C.default.dynamicAnchors,(0,E._)`${C.default.valCxt}.${C.default.dynamicAnchors}`)},()=>{e.var(C.default.instancePath,(0,E._)`""`),e.var(C.default.parentData,(0,E._)`undefined`),e.var(C.default.parentDataProperty,(0,E._)`undefined`),e.var(C.default.rootData,C.default.data),t.dynamicRef&&e.var(C.default.dynamicAnchors,(0,E._)`{}`)})}function pz(e){let{schema:t,opts:r,gen:n}=e;yv(e,()=>{r.$comment&&t.$comment&&wv(e),vz(e),n.let(C.default.vErrors,null),n.let(C.default.errors,0),r.unevaluated&&fz(e),kv(e),$z(e)})}function fz(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,E._)`${r}.evaluated`),t.if((0,E._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,E._)`${e.evaluated}.props`,(0,E._)`undefined`)),t.if((0,E._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,E._)`${e.evaluated}.items`,(0,E._)`undefined`))}function hv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,E._)`/*# sourceURL=${r} */`:E.nil}function mz(e,t){if(bv(e)&&(xv(e),$v(e))){hz(e,t);return}(0,_v.boolOrEmptySchema)(e,t)}function $v({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function bv(e){return typeof e.schema!="boolean"}function hz(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&wv(e),_z(e),yz(e);let i=n.const("_errs",C.default.errors);kv(e,i),n.var(t,(0,E._)`${i} === ${C.default.errors}`)}function xv(e){(0,Ct.checkUnknownRules)(e),gz(e)}function kv(e,t){if(e.opts.jtd)return gv(e,[],!1,t);let r=(0,mv.getSchemaTypes)(e.schema),n=(0,mv.coerceAndCheckDataType)(e,r);gv(e,r,!n,t)}function gz(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ct.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function vz(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ct.checkStrictMode)(e,"default is ignored in the schema root")}function _z(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,cz.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function yz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function wv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,E._)`${C.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,E.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,E._)`${C.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function $z(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,E._)`${C.default.errors} === 0`,()=>t.return(C.default.data),()=>t.throw((0,E._)`new ${o}(${C.default.vErrors})`)):(t.assign((0,E._)`${n}.errors`,C.default.vErrors),i.unevaluated&&bz(e),t.return((0,E._)`${C.default.errors} === 0`))}function bz({gen:e,evaluated:t,props:r,items:n}){r instanceof E.Name&&e.assign((0,E._)`${t}.props`,r),n instanceof E.Name&&e.assign((0,E._)`${t}.items`,n)}function gv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Ct.schemaHasRulesButRef)(i,l))){o.block(()=>zv(e,"$ref",l.all.$ref.definition));return}c.jtd||xz(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,Fd.shouldUseGroup)(i,m)&&(m.type?(o.if((0,Za.checkDataType)(m.type,a,c.strictNumbers)),vv(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Za.reportTypeError)(e)),o.endIf()):vv(e,m),s||o.if((0,E._)`${C.default.errors} === ${n||0}`))}}function vv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,sz.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,Fd.shouldUseRule)(n,i)&&zv(e,i.keyword,i.definition,t.type)})}function xz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(kz(e,t),e.opts.allowUnionTypes||wz(e,t),Sz(e,e.dataTypes))}function kz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Sv(e.dataTypes,r)||Jd(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Iz(e,t)}}function wz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Jd(e,"use allowUnionTypes to allow union type keyword")}function Sz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Fd.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>zz(t,a))&&Jd(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function zz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Sv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Iz(e,t){let r=[];for(let n of e.dataTypes)Sv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Jd(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ct.checkStrictMode)(e,t,e.opts.strictTypes)}var Ra=class{constructor(t,r,n){if((0,Co.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ct.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Iv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Co.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",C.default.errors))}result(t,r,n){this.failResult((0,E.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,E.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,E._)`${r} !== undefined && (${(0,E.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ao.reportExtraError:Ao.reportError)(this,this.def.error,r)}$dataError(){(0,Ao.reportError)(this,this.def.$dataError||Ao.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ao.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=E.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=E.nil,r=E.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,E.or)((0,E._)`${o} === undefined`,r)),t!==E.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==E.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,E.or)(a(),s());function a(){if(n.length){if(!(r instanceof E.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,E._)`${(0,Za.checkDataTypes)(c,r,i.opts.strictNumbers,Za.DataType.Wrong)}`}return E.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,E._)`!${c}(${r})`}return E.nil}}subschema(t,r){let n=(0,Vd.getSubschema)(this.it,t);(0,Vd.extendSubschemaData)(n,this.it,t),(0,Vd.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return mz(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ct.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ct.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,E.Name)),!0}};nr.KeywordCxt=Ra;function zv(e,t,r,n){let o=new Ra(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Co.funcKeywordCode)(o,r):"macro"in r?(0,Co.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Co.funcKeywordCode)(o,r)}var Pz=/^\/(?:[^~]|~0|~1)*$/,Tz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Iv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return C.default.rootData;if(e[0]==="/"){if(!Pz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=C.default.rootData}else{let u=Tz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,E._)`${i}${(0,E.getProperty)((0,Ct.unescapeJsonPointer)(u))}`,a=(0,E._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}nr.getData=Iv});var Ua=w(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var Kd=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Gd.default=Kd});var qo=w(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});var Bd=Uo(),Hd=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Bd.resolveUrl)(t,r,n),this.missingSchema=(0,Bd.normalizeId)((0,Bd.getFullPath)(t,this.missingRef))}};Wd.default=Hd});var Ca=w(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.resolveSchema=nt.getCompilingSchema=nt.resolveRef=nt.compileSchema=nt.SchemaEnv=void 0;var dt=G(),jz=Ua(),br=At(),pt=Uo(),Pv=ne(),Ez=Mo(),an=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,pt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};nt.SchemaEnv=an;function Yd(e){let t=Tv.call(this,e);if(t)return t;let r=(0,pt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new dt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:jz.default,code:(0,dt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:br.default.data,parentData:br.default.parentData,parentDataProperty:br.default.parentDataProperty,dataNames:[br.default.data],dataPathArr:[dt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,dt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:dt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,dt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,Ez.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(br.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${br.default.self}`,`${br.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:g}=u;f.evaluated={props:h instanceof dt.Name?void 0:h,items:g instanceof dt.Name?void 0:g,dynamicProps:h instanceof dt.Name,dynamicItems:g instanceof dt.Name},f.source&&(f.source.evaluated=(0,dt.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}nt.compileSchema=Yd;function Oz(e,t,r){var n;r=(0,pt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=Zz.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new an({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=Nz.call(this,i)}nt.resolveRef=Oz;function Nz(e){return(0,pt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Yd.call(this,e)}function Tv(e){for(let t of this._compilations)if(Dz(t,e))return t}nt.getCompilingSchema=Tv;function Dz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Zz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Aa.call(this,e,t)}function Aa(e,t){let r=this.opts.uriResolver.parse(t),n=(0,pt._getFullPath)(this.opts.uriResolver,r),o=(0,pt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Xd.call(this,r,e);let i=(0,pt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Aa.call(this,e,a);return typeof s?.schema!="object"?void 0:Xd.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||Yd.call(this,a),i===(0,pt.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,pt.resolveUrl)(this.opts.uriResolver,o,u)),new an({schema:s,schemaId:c,root:e,baseId:o})}return Xd.call(this,r,a)}}nt.resolveSchema=Aa;var Rz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xd(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Pv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Rz.has(s)&&u&&(t=(0,pt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Pv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,pt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Aa.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new an({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var jv=w((yU,Uz)=>{Uz.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 ep=w(($U,Dv)=>{"use strict";var Az=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Ov=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Qd(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Cz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Ev(e){return e.length=0,!0}function Mz(e,t,r){if(e.length){let n=Qd(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function qz(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=Mz;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=Ev}else{o.push(u);continue}}return o.length&&(s===Ev?r.zone=o.join(""):a?n.push(o.join("")):n.push(Qd(o))),r.address=n.join(""),r}function Nv(e){if(Lz(e,":")<2)return{host:e,isIPV6:!1};let t=qz(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function Lz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Vz(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function Fz(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function Jz(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Ov(r)){let n=Nv(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Dv.exports={nonSimpleDomain:Cz,recomposeAuthority:Jz,normalizeComponentEncoding:Fz,removeDotSegments:Vz,isIPv4:Ov,isUUID:Az,normalizeIPv6:Nv,stringArrayToHexStripped:Qd}});var Cv=w((bU,Av)=>{"use strict";var{isUUID:Kz}=ep(),Gz=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Bz=["http","https","ws","wss","urn","urn:uuid"];function Hz(e){return Bz.indexOf(e)!==-1}function tp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Zv(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Rv(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function Wz(e){return e.secure=tp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Xz(e){if((e.port===(tp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Yz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Gz);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=rp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Qz(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=rp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function e0(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Kz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function t0(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Uv={scheme:"http",domainHost:!0,parse:Zv,serialize:Rv},r0={scheme:"https",domainHost:Uv.domainHost,parse:Zv,serialize:Rv},Ma={scheme:"ws",domainHost:!0,parse:Wz,serialize:Xz},n0={scheme:"wss",domainHost:Ma.domainHost,parse:Ma.parse,serialize:Ma.serialize},o0={scheme:"urn",parse:Yz,serialize:Qz,skipNormalize:!0},i0={scheme:"urn:uuid",parse:e0,serialize:t0,skipNormalize:!0},qa={http:Uv,https:r0,ws:Ma,wss:n0,urn:o0,"urn:uuid":i0};Object.setPrototypeOf(qa,null);function rp(e){return e&&(qa[e]||qa[e.toLowerCase()])||void 0}Av.exports={wsIsSecure:tp,SCHEMES:qa,isValidSchemeName:Hz,getSchemeHandler:rp}});var Lv=w((xU,Va)=>{"use strict";var{normalizeIPv6:a0,removeDotSegments:Lo,recomposeAuthority:s0,normalizeComponentEncoding:La,isIPv4:c0,nonSimpleDomain:u0}=ep(),{SCHEMES:l0,getSchemeHandler:Mv}=Cv();function d0(e,t){return typeof e=="string"?e=xt(Mt(e,t),t):typeof e=="object"&&(e=Mt(xt(e,t),t)),e}function p0(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=qv(Mt(e,n),Mt(t,n),n,!0);return n.skipEscape=!0,xt(o,n)}function qv(e,t,r,n){let o={};return n||(e=Mt(xt(e,r),r),t=Mt(xt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Lo(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Lo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Lo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=Lo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function f0(e,t,r){return typeof e=="string"?(e=unescape(e),e=xt(La(Mt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=xt(La(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=xt(La(Mt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=xt(La(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function xt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],i=Mv(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=s0(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Lo(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var m0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Mt(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(m0);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(c0(n.host)===!1){let c=a0(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Mv(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&u0(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var np={SCHEMES:l0,normalize:d0,resolve:p0,resolveComponent:qv,equal:f0,serialize:xt,parse:Mt};Va.exports=np;Va.exports.default=np;Va.exports.fastUri=np});var Fv=w(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var Vv=Lv();Vv.code='require("ajv/dist/runtime/uri").default';op.default=Vv});var Yv=w(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.CodeGen=we.Name=we.nil=we.stringify=we.str=we._=we.KeywordCxt=void 0;var h0=Mo();Object.defineProperty(we,"KeywordCxt",{enumerable:!0,get:function(){return h0.KeywordCxt}});var sn=G();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return sn._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return sn.str}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return sn.stringify}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return sn.nil}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return sn.Name}});Object.defineProperty(we,"CodeGen",{enumerable:!0,get:function(){return sn.CodeGen}});var g0=Ua(),Hv=qo(),v0=Nd(),Vo=Ca(),_0=G(),Fo=Uo(),Fa=Ro(),ap=ne(),Jv=jv(),y0=Fv(),Wv=(e,t)=>new RegExp(e,t);Wv.code="new RegExp";var $0=["removeAdditional","useDefaults","coerceTypes"],b0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),x0={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."},k0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Kv=200;function w0(e){var t,r,n,o,i,a,s,c,u,l,d,m,f,h,g,$,b,P,I,A,O,it,at,fs,ms;let gn=e.strict,hs=(t=e.code)===null||t===void 0?void 0:t.optimize,lf=hs===!0||hs===void 0?1:hs||0,df=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Wv,Dy=(o=e.uriResolver)!==null&&o!==void 0?o:y0.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:gn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:gn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:gn)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:gn)!==null&&m!==void 0?m:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:gn)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:lf,regExp:df}:{optimize:lf,regExp:df},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Kv,loopEnum:($=e.loopEnum)!==null&&$!==void 0?$:Kv,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(I=e.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(O=e.addUsedSchema)!==null&&O!==void 0?O:!0,validateSchema:(it=e.validateSchema)!==null&&it!==void 0?it:!0,validateFormats:(at=e.validateFormats)!==null&&at!==void 0?at:!0,unicodeRegExp:(fs=e.unicodeRegExp)!==null&&fs!==void 0?fs:!0,int32range:(ms=e.int32range)!==null&&ms!==void 0?ms:!0,uriResolver:Dy}}var Jo=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...w0(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new _0.ValueScope({scope:{},prefixes:b0,es5:r,lines:n}),this.logger=j0(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,v0.getRules)(),Gv.call(this,x0,t,"NOT SUPPORTED"),Gv.call(this,k0,t,"DEPRECATED","warn"),this._metaOpts=P0.call(this),t.formats&&z0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&I0.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),S0.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Jv;n==="id"&&(o={...Jv},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||a.call(this,m)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Hv.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Fo.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=Bv.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Vo.SchemaEnv({schema:{},schemaId:n});if(r=Vo.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Bv.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,Fo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(O0.call(this,n,r),!r)return(0,ap.eachItem)(n,i=>ip.call(this,i)),this;D0.call(this,r);let o={...r,type:(0,Fa.getJSONTypes)(r.type),schemaType:(0,Fa.getJSONTypes)(r.schemaType)};return(0,ap.eachItem)(n,o.type.length===0?i=>ip.call(this,i,o):i=>o.type.forEach(a=>ip.call(this,i,o,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Xv(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,Fo.normalizeId)(a||n);let u=Fo.getSchemaRefs.call(this,t,n);return c=new Vo.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Vo.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Vo.compileSchema.call(this,t)}finally{this.opts=r}}};Jo.ValidationError=g0.default;Jo.MissingRefError=Hv.default;we.default=Jo;function Gv(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function Bv(e){return e=(0,Fo.normalizeId)(e),this.schemas[e]||this.refs[e]}function S0(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function z0(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function I0(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function P0(){let e={...this.opts};for(let t of $0)delete e[t];return e}var T0={log(){},warn(){},error(){}};function j0(e){if(e===!1)return T0;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var E0=/^[a-z_$][a-z0-9_$:-]*$/i;function O0(e,t){let{RULES:r}=this;if((0,ap.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!E0.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function ip(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,Fa.getJSONTypes)(t.type),schemaType:(0,Fa.getJSONTypes)(t.schemaType)}};t.before?N0.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function N0(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function D0(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Xv(t)),e.validateSchema=this.compile(t,!0))}var Z0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Xv(e){return{anyOf:[e,Z0]}}});var Qv=w(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});var R0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};sp.default=R0});var n_=w(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.callRef=xr.getValidate=void 0;var U0=qo(),e_=rt(),Ve=G(),cn=At(),t_=Ca(),Ja=ne(),A0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=t_.resolveRef.call(c,u,o,r);if(l===void 0)throw new U0.default(n.opts.uriResolver,o,r);if(l instanceof t_.SchemaEnv)return m(l);return f(l);function d(){if(i===u)return Ka(e,a,i,i.$async);let h=t.scopeValue("root",{ref:u});return Ka(e,(0,Ve._)`${h}.validate`,u,u.$async)}function m(h){let g=r_(e,h);Ka(e,g,h,h.$async)}function f(h){let g=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Ve.stringify)(h)}:{ref:h}),$=t.name("valid"),b=e.subschema({schema:h,dataTypes:[],schemaPath:Ve.nil,topSchemaRef:g,errSchemaPath:r},$);e.mergeEvaluated(b),e.ok($)}}};function r_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ve._)`${r.scopeValue("wrapper",{ref:t})}.validate`}xr.getValidate=r_;function Ka(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?cn.default.this:Ve.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Ve._)`await ${(0,e_.callValidateCode)(e,t,u)}`),f(t),a||o.assign(h,!0)},g=>{o.if((0,Ve._)`!(${g} instanceof ${i.ValidationError})`,()=>o.throw(g)),m(g),a||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,e_.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(h){let g=(0,Ve._)`${h}.errors`;o.assign(cn.default.vErrors,(0,Ve._)`${cn.default.vErrors} === null ? ${g} : ${cn.default.vErrors}.concat(${g})`),o.assign(cn.default.errors,(0,Ve._)`${cn.default.vErrors}.length`)}function f(h){var g;if(!i.opts.unevaluated)return;let $=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(i.props=Ja.mergeEvaluated.props(o,$.props,i.props));else{let b=o.var("props",(0,Ve._)`${h}.evaluated.props`);i.props=Ja.mergeEvaluated.props(o,b,i.props,Ve.Name)}if(i.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(i.items=Ja.mergeEvaluated.items(o,$.items,i.items));else{let b=o.var("items",(0,Ve._)`${h}.evaluated.items`);i.items=Ja.mergeEvaluated.items(o,b,i.items,Ve.Name)}}}xr.callRef=Ka;xr.default=A0});var o_=w(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});var C0=Qv(),M0=n_(),q0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",C0.default,M0.default];cp.default=q0});var i_=w(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});var Ga=G(),or=Ga.operators,Ba={maximum:{okStr:"<=",ok:or.LTE,fail:or.GT},minimum:{okStr:">=",ok:or.GTE,fail:or.LT},exclusiveMaximum:{okStr:"<",ok:or.LT,fail:or.GTE},exclusiveMinimum:{okStr:">",ok:or.GT,fail:or.LTE}},L0={message:({keyword:e,schemaCode:t})=>(0,Ga.str)`must be ${Ba[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ga._)`{comparison: ${Ba[e].okStr}, limit: ${t}}`},V0={keyword:Object.keys(Ba),type:"number",schemaType:"number",$data:!0,error:L0,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ga._)`${r} ${Ba[t].fail} ${n} || isNaN(${r})`)}};up.default=V0});var a_=w(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var Ko=G(),F0={message:({schemaCode:e})=>(0,Ko.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Ko._)`{multipleOf: ${e}}`},J0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:F0,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,Ko._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,Ko._)`${a} !== parseInt(${a})`;e.fail$data((0,Ko._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};lp.default=J0});var c_=w(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});function s_(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}dp.default=s_;s_.code='require("ajv/dist/runtime/ucs2length").default'});var u_=w(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var kr=G(),K0=ne(),G0=c_(),B0={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,kr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,kr._)`{limit: ${e}}`},H0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:B0,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?kr.operators.GT:kr.operators.LT,a=o.opts.unicode===!1?(0,kr._)`${r}.length`:(0,kr._)`${(0,K0.useFunc)(e.gen,G0.default)}(${r})`;e.fail$data((0,kr._)`${a} ${i} ${n}`)}};pp.default=H0});var l_=w(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var W0=rt(),Ha=G(),X0={message:({schemaCode:e})=>(0,Ha.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Ha._)`{pattern: ${e}}`},Y0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:X0,code(e){let{data:t,$data:r,schema:n,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"",s=r?(0,Ha._)`(new RegExp(${o}, ${a}))`:(0,W0.usePattern)(e,n);e.fail$data((0,Ha._)`!${s}.test(${t})`)}};fp.default=Y0});var d_=w(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var Go=G(),Q0={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Go.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Go._)`{limit: ${e}}`},eI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Q0,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Go.operators.GT:Go.operators.LT;e.fail$data((0,Go._)`Object.keys(${r}).length ${o} ${n}`)}};mp.default=eI});var p_=w(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var Bo=rt(),Ho=G(),tI=ne(),rI={message:({params:{missingProperty:e}})=>(0,Ho.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Ho._)`{missingProperty: ${e}}`},nI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:rI,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if(f?.[g]===void 0&&!h.has(g)){let $=a.schemaEnv.baseId+a.errSchemaPath,b=`required property "${g}" is not defined at "${$}" (strictRequired)`;(0,tI.checkStrictMode)(a,b,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(Ho.nil,d);else for(let f of r)(0,Bo.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||i){let h=t.let("valid",!0);e.block$data(h,()=>m(f,h)),e.ok(h)}else t.if((0,Bo.checkMissingProp)(e,r,f)),(0,Bo.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,Bo.noPropertyInData)(t,o,f,s.ownProperties),()=>e.error())})}function m(f,h){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(h,(0,Bo.propertyInData)(t,o,f,s.ownProperties)),t.if((0,Ho.not)(h),()=>{e.error(),t.break()})},Ho.nil)}}};hp.default=nI});var f_=w(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var Wo=G(),oI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Wo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Wo._)`{limit: ${e}}`},iI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:oI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Wo.operators.GT:Wo.operators.LT;e.fail$data((0,Wo._)`${r}.length ${o} ${n}`)}};gp.default=iI});var Wa=w(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});var m_=qd();m_.code='require("ajv/dist/runtime/equal").default';vp.default=m_});var h_=w(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var _p=Ro(),Se=G(),aI=ne(),sI=Wa(),cI={message:({params:{i:e,j:t}})=>(0,Se.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Se._)`{i: ${e}, j: ${t}}`},uI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:cI,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,_p.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Se._)`${a} === false`),e.ok(c);function l(){let h=t.let("i",(0,Se._)`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if((0,Se._)`${h} > 1`,()=>(d()?m:f)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function m(h,g){let $=t.name("item"),b=(0,_p.checkDataTypes)(u,$,s.opts.strictNumbers,_p.DataType.Wrong),P=t.const("indices",(0,Se._)`{}`);t.for((0,Se._)`;${h}--;`,()=>{t.let($,(0,Se._)`${r}[${h}]`),t.if(b,(0,Se._)`continue`),u.length>1&&t.if((0,Se._)`typeof ${$} == "string"`,(0,Se._)`${$} += "_"`),t.if((0,Se._)`typeof ${P}[${$}] == "number"`,()=>{t.assign(g,(0,Se._)`${P}[${$}]`),e.error(),t.assign(c,!1).break()}).code((0,Se._)`${P}[${$}] = ${h}`)})}function f(h,g){let $=(0,aI.useFunc)(t,sI.default),b=t.name("outer");t.label(b).for((0,Se._)`;${h}--;`,()=>t.for((0,Se._)`${g} = ${h}; ${g}--;`,()=>t.if((0,Se._)`${$}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};yp.default=uI});var g_=w(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var $p=G(),lI=ne(),dI=Wa(),pI={message:"must be equal to constant",params:({schemaCode:e})=>(0,$p._)`{allowedValue: ${e}}`},fI={keyword:"const",$data:!0,error:pI,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,$p._)`!${(0,lI.useFunc)(t,dI.default)}(${r}, ${o})`):e.fail((0,$p._)`${i} !== ${r}`)}};bp.default=fI});var v_=w(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var Xo=G(),mI=ne(),hI=Wa(),gI={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Xo._)`{allowedValues: ${e}}`},vI={keyword:"enum",schemaType:"array",$data:!0,error:gI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,mI.useFunc)(t,hI.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",i);l=(0,Xo.or)(...o.map((h,g)=>m(f,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,f=>t.if((0,Xo._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,h){let g=o[h];return typeof g=="object"&&g!==null?(0,Xo._)`${u()}(${r}, ${f}[${h}])`:(0,Xo._)`${r} === ${g}`}}};xp.default=vI});var __=w(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var _I=i_(),yI=a_(),$I=u_(),bI=l_(),xI=d_(),kI=p_(),wI=f_(),SI=h_(),zI=g_(),II=v_(),PI=[_I.default,yI.default,$I.default,bI.default,xI.default,kI.default,wI.default,SI.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},zI.default,II.default];kp.default=PI});var Sp=w(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.validateAdditionalItems=void 0;var wr=G(),wp=ne(),TI={message:({params:{len:e}})=>(0,wr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,wr._)`{limit: ${e}}`},jI={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:TI,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,wp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}y_(e,n)}};function y_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,wr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,wr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,wp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,wr._)`${s} <= ${t.length}`);r.if((0,wr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:wp.Type.Num},u),a.allErrors||r.if((0,wr.not)(u),()=>r.break())})}}Yo.validateAdditionalItems=y_;Yo.default=jI});var zp=w(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.validateTuple=void 0;var $_=G(),Xa=ne(),EI=rt(),OI={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return b_(e,"additionalItems",t);r.items=!0,!(0,Xa.alwaysValidSchema)(r,t)&&e.ok((0,EI.validateArray)(e))}};function b_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Xa.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,$_._)`${i}.length`);r.forEach((d,m)=>{(0,Xa.alwaysValidSchema)(s,d)||(n.if((0,$_._)`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:f}=s,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(m.strictTuples&&!g){let $=`"${a}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Xa.checkStrictMode)(s,$,m.strictTuples)}}}Qo.validateTuple=b_;Qo.default=OI});var x_=w(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var NI=zp(),DI={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,NI.validateTuple)(e,"items")};Ip.default=DI});var w_=w(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var k_=G(),ZI=ne(),RI=rt(),UI=Sp(),AI={message:({params:{len:e}})=>(0,k_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,k_._)`{limit: ${e}}`},CI={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:AI,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,ZI.alwaysValidSchema)(n,t)&&(o?(0,UI.validateAdditionalItems)(e,o):e.ok((0,RI.validateArray)(e)))}};Pp.default=CI});var S_=w(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var ot=G(),Ya=ne(),MI={message:({params:{min:e,max:t}})=>t===void 0?(0,ot.str)`must contain at least ${e} valid item(s)`:(0,ot.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ot._)`{minContains: ${e}}`:(0,ot._)`{minContains: ${e}, maxContains: ${t}}`},qI={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:MI,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ot._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,Ya.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Ya.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Ya.alwaysValidSchema)(i,r)){let g=(0,ot._)`${l} >= ${a}`;s!==void 0&&(g=(0,ot._)`${g} && ${l} <= ${s}`),e.pass(g);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?f(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ot._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let g=t.name("_valid"),$=t.let("count",0);f(g,()=>t.if(g,()=>h($)))}function f(g,$){t.forRange("i",0,l,b=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:Ya.Type.Num,compositeRule:!0},g),$()})}function h(g){t.code((0,ot._)`${g}++`),s===void 0?t.if((0,ot._)`${g} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ot._)`${g} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ot._)`${g} >= ${a}`,()=>t.assign(d,!0)))}}};Tp.default=qI});var P_=w(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.validateSchemaDeps=kt.validatePropertyDeps=kt.error=void 0;var jp=G(),LI=ne(),ei=rt();kt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,jp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,jp._)`{property: ${e},
6
+ || ${a} === "boolean" || ${o} === null`).assign(s,(0,J._)`[${o}]`)}}}function kS({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,J._)`${t} !== undefined`,()=>e.assign((0,J._)`${t}[${r}]`,n))}function Zd(e,t,r,n=rn.Correct){let o=n===rn.Correct?J.operators.EQ:J.operators.NEQ,i;switch(e){case"null":return(0,J._)`${t} ${o} null`;case"array":i=(0,J._)`Array.isArray(${t})`;break;case"object":i=(0,J._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,J._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,J._)`typeof ${t} ${o} ${e}`}return n===rn.Correct?i:(0,J.not)(i);function a(s=J.nil){return(0,J.and)((0,J._)`typeof ${t} == "number"`,s,r?(0,J._)`isFinite(${t})`:J.nil)}}Ee.checkDataType=Zd;function Rd(e,t,r,n){if(e.length===1)return Zd(e[0],t,r,n);let o,i=(0,Wg.toHash)(e);if(i.array&&i.object){let a=(0,J._)`typeof ${t} != "object"`;o=i.null?a:(0,J._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=J.nil;i.number&&delete i.integer;for(let a in i)o=(0,J.and)(o,Zd(a,t,r,n));return o}Ee.checkDataTypes=Rd;var wS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,J._)`{type: ${e}}`:(0,J._)`{type: ${t}}`};function Ud(e){let t=SS(e);(0,_S.reportError)(t,wS)}Ee.reportTypeError=Ud;function SS(e){let{gen:t,data:r,schema:n}=e,o=(0,Wg.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var ev=w(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.assignDefaults=void 0;var nn=G(),zS=ne();function IS(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Qg(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Qg(e,i,o.default))}Na.assignDefaults=IS;function Qg(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,nn._)`${i}${(0,nn.getProperty)(t)}`;if(o){(0,zS.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,nn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,nn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,nn._)`${s} = ${(0,nn.stringify)(r)}`)}});var rt=w(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.validateUnion=se.validateArray=se.usePattern=se.callValidateCode=se.schemaProperties=se.allSchemaProperties=se.noPropertyInData=se.propertyInData=se.isOwnProperty=se.hasPropFunc=se.reportMissingProp=se.checkMissingProp=se.checkReportMissingProp=void 0;var he=G(),Ad=ne(),er=At(),PS=ne();function TS(e,t){let{gen:r,data:n,it:o}=e;r.if(Md(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,he._)`${t}`},!0),e.error()})}se.checkReportMissingProp=TS;function jS({gen:e,data:t,it:{opts:r}},n,o){return(0,he.or)(...n.map(i=>(0,he.and)(Md(e,t,i,r.ownProperties),(0,he._)`${o} = ${i}`)))}se.checkMissingProp=jS;function ES(e,t){e.setParams({missingProperty:t},!0),e.error()}se.reportMissingProp=ES;function tv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,he._)`Object.prototype.hasOwnProperty`})}se.hasPropFunc=tv;function Cd(e,t,r){return(0,he._)`${tv(e)}.call(${t}, ${r})`}se.isOwnProperty=Cd;function OS(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} !== undefined`;return n?(0,he._)`${o} && ${Cd(e,t,r)}`:o}se.propertyInData=OS;function Md(e,t,r,n){let o=(0,he._)`${t}${(0,he.getProperty)(r)} === undefined`;return n?(0,he.or)(o,(0,he.not)(Cd(e,t,r))):o}se.noPropertyInData=Md;function rv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}se.allSchemaProperties=rv;function NS(e,t){return rv(t).filter(r=>!(0,Ad.alwaysValidSchema)(e,t[r]))}se.schemaProperties=NS;function DS({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,he._)`${e}, ${t}, ${n}${o}`:t,d=[[er.default.instancePath,(0,he.strConcat)(er.default.instancePath,i)],[er.default.parentData,a.parentData],[er.default.parentDataProperty,a.parentDataProperty],[er.default.rootData,er.default.rootData]];a.opts.dynamicRef&&d.push([er.default.dynamicAnchors,er.default.dynamicAnchors]);let m=(0,he._)`${l}, ${r.object(...d)}`;return c!==he.nil?(0,he._)`${s}.call(${c}, ${m})`:(0,he._)`${s}(${m})`}se.callValidateCode=DS;var ZS=(0,he._)`new RegExp`;function RS({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,he._)`${o.code==="new RegExp"?ZS:(0,PS.useFunc)(e,o)}(${r}, ${n})`})}se.usePattern=RS;function US(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,he._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Ad.Type.Num},i),t.if((0,he.not)(i),s)})}}se.validateArray=US;function AS(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ad.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,he._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,he.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}se.validateUnion=AS});var iv=w($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.validateKeywordUsage=$t.validSchemaType=$t.funcKeywordCode=$t.macroKeywordCode=void 0;var Ae=G(),$r=At(),CS=rt(),MS=Zo();function qS(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=ov(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ae.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}$t.macroKeywordCode=qS;function LS(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;FS(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=ov(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)g(),t.modifying&&nv(e),y(()=>e.error());else{let b=t.async?f():h();t.modifying&&nv(e),y(()=>VS(e,b))}}function f(){let b=n.let("ruleErrs",null);return n.try(()=>g((0,Ae._)`await `),P=>n.assign(d,!1).if((0,Ae._)`${P} instanceof ${c.ValidationError}`,()=>n.assign(b,(0,Ae._)`${P}.errors`),()=>n.throw(P))),b}function h(){let b=(0,Ae._)`${l}.errors`;return n.assign(b,null),g(Ae.nil),b}function g(b=t.async?(0,Ae._)`await `:Ae.nil){let P=c.opts.passContext?$r.default.this:$r.default.self,I=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ae._)`${b}${(0,CS.callValidateCode)(e,l,P,I)}`,t.modifying)}function y(b){var P;n.if((0,Ae.not)((P=t.valid)!==null&&P!==void 0?P:d),b)}}$t.funcKeywordCode=LS;function nv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ae._)`${n.parentData}[${n.parentDataProperty}]`))}function VS(e,t){let{gen:r}=e;r.if((0,Ae._)`Array.isArray(${t})`,()=>{r.assign($r.default.vErrors,(0,Ae._)`${$r.default.vErrors} === null ? ${t} : ${$r.default.vErrors}.concat(${t})`).assign($r.default.errors,(0,Ae._)`${$r.default.vErrors}.length`),(0,MS.extendErrors)(e)},()=>e.error())}function FS({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function ov(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ae.stringify)(r)})}function JS(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}$t.validSchemaType=JS;function KS({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}$t.validateKeywordUsage=KS});var sv=w(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.extendSubschemaMode=tr.extendSubschemaData=tr.getSubschema=void 0;var bt=G(),av=ne();function GS(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,bt._)`${e.schemaPath}${(0,bt.getProperty)(t)}${(0,bt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,av.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}tr.getSubschema=GS;function BS(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=s.let("data",(0,bt._)`${t.data}${(0,bt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,bt.str)`${u}${(0,av.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,bt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof bt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}tr.extendSubschemaData=BS;function HS(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}tr.extendSubschemaMode=HS});var qd=w((pU,cv)=>{"use strict";cv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var lv=w((fU,uv)=>{"use strict";var rr=uv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Da(t,n,o,e,"",e)};rr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};rr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};rr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};rr.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 Da(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in rr.arrayKeywords)for(var m=0;m<d.length;m++)Da(e,t,r,d[m],o+"/"+l+"/"+m,i,o,l,n,m)}else if(l in rr.propsKeywords){if(d&&typeof d=="object")for(var f in d)Da(e,t,r,d[f],o+"/"+l+"/"+WS(f),i,o,l,n,f)}else(l in rr.keywords||e.allKeys&&!(l in rr.skipKeywords))&&Da(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function WS(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Uo=w(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.getSchemaRefs=Le.resolveUrl=Le.normalizeId=Le._getFullPath=Le.getFullPath=Le.inlineRef=void 0;var XS=ne(),YS=qd(),QS=lv(),e0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function t0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Ld(e):t?dv(e)<=t:!1}Le.inlineRef=t0;var r0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ld(e){for(let t in e){if(r0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ld)||typeof r=="object"&&Ld(r))return!0}return!1}function dv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!e0.has(r)&&(typeof e[r]=="object"&&(0,XS.eachItem)(e[r],n=>t+=dv(n)),t===1/0))return 1/0}return t}function pv(e,t="",r){r!==!1&&(t=on(t));let n=e.parse(t);return fv(e,n)}Le.getFullPath=pv;function fv(e,t){return e.serialize(t).split("#")[0]+"#"}Le._getFullPath=fv;var n0=/#\/?$/;function on(e){return e?e.replace(n0,""):""}Le.normalizeId=on;function o0(e,t,r){return r=on(r),e.resolve(t,r)}Le.resolveUrl=o0;var i0=/^[a-z_][-a-z0-9._]*$/i;function a0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=on(e[r]||t),i={"":o},a=pv(n,o,!1),s={},c=new Set;return QS(e,{allKeys:!0},(d,m,f,h)=>{if(h===void 0)return;let g=a+m,y=i[h];typeof d[r]=="string"&&(y=b.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),i[m]=y;function b(I){let A=this.opts.uriResolver.resolve;if(I=on(y?A(y,I):I),c.has(I))throw l(I);c.add(I);let O=this.refs[I];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?u(d,O.schema,I):I!==on(g)&&(I[0]==="#"?(u(d,s[I],I),s[I]=d):this.refs[I]=g),I}function P(I){if(typeof I=="string"){if(!i0.test(I))throw new Error(`invalid anchor "${I}"`);b.call(this,`#${I}`)}}}),s;function u(d,m,f){if(m!==void 0&&!YS(d,m))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Le.getSchemaRefs=a0});var Mo=w(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.getData=nr.KeywordCxt=nr.validateFunctionCode=void 0;var _v=Gg(),mv=Ro(),Fd=Dd(),Za=Ro(),s0=ev(),Co=iv(),Vd=sv(),E=G(),C=At(),c0=Uo(),Ct=ne(),Ao=Zo();function u0(e){if(bv(e)&&(xv(e),$v(e))){p0(e);return}yv(e,()=>(0,_v.topBoolOrEmptySchema)(e))}nr.validateFunctionCode=u0;function yv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,E._)`${C.default.data}, ${C.default.valCxt}`,n.$async,()=>{e.code((0,E._)`"use strict"; ${hv(r,o)}`),d0(e,o),e.code(i)}):e.func(t,(0,E._)`${C.default.data}, ${l0(o)}`,n.$async,()=>e.code(hv(r,o)).code(i))}function l0(e){return(0,E._)`{${C.default.instancePath}="", ${C.default.parentData}, ${C.default.parentDataProperty}, ${C.default.rootData}=${C.default.data}${e.dynamicRef?(0,E._)`, ${C.default.dynamicAnchors}={}`:E.nil}}={}`}function d0(e,t){e.if(C.default.valCxt,()=>{e.var(C.default.instancePath,(0,E._)`${C.default.valCxt}.${C.default.instancePath}`),e.var(C.default.parentData,(0,E._)`${C.default.valCxt}.${C.default.parentData}`),e.var(C.default.parentDataProperty,(0,E._)`${C.default.valCxt}.${C.default.parentDataProperty}`),e.var(C.default.rootData,(0,E._)`${C.default.valCxt}.${C.default.rootData}`),t.dynamicRef&&e.var(C.default.dynamicAnchors,(0,E._)`${C.default.valCxt}.${C.default.dynamicAnchors}`)},()=>{e.var(C.default.instancePath,(0,E._)`""`),e.var(C.default.parentData,(0,E._)`undefined`),e.var(C.default.parentDataProperty,(0,E._)`undefined`),e.var(C.default.rootData,C.default.data),t.dynamicRef&&e.var(C.default.dynamicAnchors,(0,E._)`{}`)})}function p0(e){let{schema:t,opts:r,gen:n}=e;yv(e,()=>{r.$comment&&t.$comment&&wv(e),v0(e),n.let(C.default.vErrors,null),n.let(C.default.errors,0),r.unevaluated&&f0(e),kv(e),$0(e)})}function f0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,E._)`${r}.evaluated`),t.if((0,E._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,E._)`${e.evaluated}.props`,(0,E._)`undefined`)),t.if((0,E._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,E._)`${e.evaluated}.items`,(0,E._)`undefined`))}function hv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,E._)`/*# sourceURL=${r} */`:E.nil}function m0(e,t){if(bv(e)&&(xv(e),$v(e))){h0(e,t);return}(0,_v.boolOrEmptySchema)(e,t)}function $v({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function bv(e){return typeof e.schema!="boolean"}function h0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&wv(e),_0(e),y0(e);let i=n.const("_errs",C.default.errors);kv(e,i),n.var(t,(0,E._)`${i} === ${C.default.errors}`)}function xv(e){(0,Ct.checkUnknownRules)(e),g0(e)}function kv(e,t){if(e.opts.jtd)return gv(e,[],!1,t);let r=(0,mv.getSchemaTypes)(e.schema),n=(0,mv.coerceAndCheckDataType)(e,r);gv(e,r,!n,t)}function g0(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Ct.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function v0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Ct.checkStrictMode)(e,"default is ignored in the schema root")}function _0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,c0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function y0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function wv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,E._)`${C.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,E.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,E._)`${C.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function $0(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,E._)`${C.default.errors} === 0`,()=>t.return(C.default.data),()=>t.throw((0,E._)`new ${o}(${C.default.vErrors})`)):(t.assign((0,E._)`${n}.errors`,C.default.vErrors),i.unevaluated&&b0(e),t.return((0,E._)`${C.default.errors} === 0`))}function b0({gen:e,evaluated:t,props:r,items:n}){r instanceof E.Name&&e.assign((0,E._)`${t}.props`,r),n instanceof E.Name&&e.assign((0,E._)`${t}.items`,n)}function gv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Ct.schemaHasRulesButRef)(i,l))){o.block(()=>zv(e,"$ref",l.all.$ref.definition));return}c.jtd||x0(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,Fd.shouldUseGroup)(i,m)&&(m.type?(o.if((0,Za.checkDataType)(m.type,a,c.strictNumbers)),vv(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Za.reportTypeError)(e)),o.endIf()):vv(e,m),s||o.if((0,E._)`${C.default.errors} === ${n||0}`))}}function vv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,s0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,Fd.shouldUseRule)(n,i)&&zv(e,i.keyword,i.definition,t.type)})}function x0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(k0(e,t),e.opts.allowUnionTypes||w0(e,t),S0(e,e.dataTypes))}function k0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Sv(e.dataTypes,r)||Jd(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),I0(e,t)}}function w0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Jd(e,"use allowUnionTypes to allow union type keyword")}function S0(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Fd.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>z0(t,a))&&Jd(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function z0(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Sv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function I0(e,t){let r=[];for(let n of e.dataTypes)Sv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Jd(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Ct.checkStrictMode)(e,t,e.opts.strictTypes)}var Ra=class{constructor(t,r,n){if((0,Co.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ct.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",Iv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Co.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",C.default.errors))}result(t,r,n){this.failResult((0,E.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,E.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,E._)`${r} !== undefined && (${(0,E.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Ao.reportExtraError:Ao.reportError)(this,this.def.error,r)}$dataError(){(0,Ao.reportError)(this,this.def.$dataError||Ao.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ao.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=E.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=E.nil,r=E.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,E.or)((0,E._)`${o} === undefined`,r)),t!==E.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==E.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,E.or)(a(),s());function a(){if(n.length){if(!(r instanceof E.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,E._)`${(0,Za.checkDataTypes)(c,r,i.opts.strictNumbers,Za.DataType.Wrong)}`}return E.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,E._)`!${c}(${r})`}return E.nil}}subschema(t,r){let n=(0,Vd.getSubschema)(this.it,t);(0,Vd.extendSubschemaData)(n,this.it,t),(0,Vd.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return m0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Ct.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Ct.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,E.Name)),!0}};nr.KeywordCxt=Ra;function zv(e,t,r,n){let o=new Ra(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Co.funcKeywordCode)(o,r):"macro"in r?(0,Co.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Co.funcKeywordCode)(o,r)}var P0=/^\/(?:[^~]|~0|~1)*$/,T0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Iv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return C.default.rootData;if(e[0]==="/"){if(!P0.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=C.default.rootData}else{let u=T0.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,E._)`${i}${(0,E.getProperty)((0,Ct.unescapeJsonPointer)(u))}`,a=(0,E._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}nr.getData=Iv});var Ua=w(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var Kd=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};Gd.default=Kd});var qo=w(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});var Bd=Uo(),Hd=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Bd.resolveUrl)(t,r,n),this.missingSchema=(0,Bd.normalizeId)((0,Bd.getFullPath)(t,this.missingRef))}};Wd.default=Hd});var Ca=w(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.resolveSchema=nt.getCompilingSchema=nt.resolveRef=nt.compileSchema=nt.SchemaEnv=void 0;var dt=G(),j0=Ua(),br=At(),pt=Uo(),Pv=ne(),E0=Mo(),an=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,pt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};nt.SchemaEnv=an;function Yd(e){let t=Tv.call(this,e);if(t)return t;let r=(0,pt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new dt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:j0.default,code:(0,dt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:br.default.data,parentData:br.default.parentData,parentDataProperty:br.default.parentDataProperty,dataNames:[br.default.data],dataPathArr:[dt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,dt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:dt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,dt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,E0.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(br.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${br.default.self}`,`${br.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:g}=u;f.evaluated={props:h instanceof dt.Name?void 0:h,items:g instanceof dt.Name?void 0:g,dynamicProps:h instanceof dt.Name,dynamicItems:g instanceof dt.Name},f.source&&(f.source.evaluated=(0,dt.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}nt.compileSchema=Yd;function O0(e,t,r){var n;r=(0,pt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=Z0.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new an({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=N0.call(this,i)}nt.resolveRef=O0;function N0(e){return(0,pt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Yd.call(this,e)}function Tv(e){for(let t of this._compilations)if(D0(t,e))return t}nt.getCompilingSchema=Tv;function D0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Z0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Aa.call(this,e,t)}function Aa(e,t){let r=this.opts.uriResolver.parse(t),n=(0,pt._getFullPath)(this.opts.uriResolver,r),o=(0,pt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Xd.call(this,r,e);let i=(0,pt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Aa.call(this,e,a);return typeof s?.schema!="object"?void 0:Xd.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||Yd.call(this,a),i===(0,pt.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,pt.resolveUrl)(this.opts.uriResolver,o,u)),new an({schema:s,schemaId:c,root:e,baseId:o})}return Xd.call(this,r,a)}}nt.resolveSchema=Aa;var R0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xd(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Pv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!R0.has(s)&&u&&(t=(0,pt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Pv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,pt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Aa.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new an({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var jv=w((yU,U0)=>{U0.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var ep=w(($U,Dv)=>{"use strict";var A0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Ov=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Qd(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var C0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Ev(e){return e.length=0,!0}function M0(e,t,r){if(e.length){let n=Qd(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function q0(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=M0;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=Ev}else{o.push(u);continue}}return o.length&&(s===Ev?r.zone=o.join(""):a?n.push(o.join("")):n.push(Qd(o))),r.address=n.join(""),r}function Nv(e){if(L0(e,":")<2)return{host:e,isIPV6:!1};let t=q0(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function L0(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function V0(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function F0(e,t){let r=t!==!0?escape:unescape;return e.scheme!==void 0&&(e.scheme=r(e.scheme)),e.userinfo!==void 0&&(e.userinfo=r(e.userinfo)),e.host!==void 0&&(e.host=r(e.host)),e.path!==void 0&&(e.path=r(e.path)),e.query!==void 0&&(e.query=r(e.query)),e.fragment!==void 0&&(e.fragment=r(e.fragment)),e}function J0(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Ov(r)){let n=Nv(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=e.host}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}Dv.exports={nonSimpleDomain:C0,recomposeAuthority:J0,normalizeComponentEncoding:F0,removeDotSegments:V0,isIPv4:Ov,isUUID:A0,normalizeIPv6:Nv,stringArrayToHexStripped:Qd}});var Cv=w((bU,Av)=>{"use strict";var{isUUID:K0}=ep(),G0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,B0=["http","https","ws","wss","urn","urn:uuid"];function H0(e){return B0.indexOf(e)!==-1}function tp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function Zv(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Rv(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function W0(e){return e.secure=tp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function X0(e){if((e.port===(tp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Y0(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(G0);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=rp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Q0(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=rp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function ez(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!K0(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function tz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Uv={scheme:"http",domainHost:!0,parse:Zv,serialize:Rv},rz={scheme:"https",domainHost:Uv.domainHost,parse:Zv,serialize:Rv},Ma={scheme:"ws",domainHost:!0,parse:W0,serialize:X0},nz={scheme:"wss",domainHost:Ma.domainHost,parse:Ma.parse,serialize:Ma.serialize},oz={scheme:"urn",parse:Y0,serialize:Q0,skipNormalize:!0},iz={scheme:"urn:uuid",parse:ez,serialize:tz,skipNormalize:!0},qa={http:Uv,https:rz,ws:Ma,wss:nz,urn:oz,"urn:uuid":iz};Object.setPrototypeOf(qa,null);function rp(e){return e&&(qa[e]||qa[e.toLowerCase()])||void 0}Av.exports={wsIsSecure:tp,SCHEMES:qa,isValidSchemeName:H0,getSchemeHandler:rp}});var Lv=w((xU,Va)=>{"use strict";var{normalizeIPv6:az,removeDotSegments:Lo,recomposeAuthority:sz,normalizeComponentEncoding:La,isIPv4:cz,nonSimpleDomain:uz}=ep(),{SCHEMES:lz,getSchemeHandler:Mv}=Cv();function dz(e,t){return typeof e=="string"?e=xt(Mt(e,t),t):typeof e=="object"&&(e=Mt(xt(e,t),t)),e}function pz(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=qv(Mt(e,n),Mt(t,n),n,!0);return n.skipEscape=!0,xt(o,n)}function qv(e,t,r,n){let o={};return n||(e=Mt(xt(e,r),r),t=Mt(xt(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Lo(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Lo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Lo(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=Lo(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function fz(e,t,r){return typeof e=="string"?(e=unescape(e),e=xt(La(Mt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=xt(La(e,!0),{...r,skipEscape:!0})),typeof t=="string"?(t=unescape(t),t=xt(La(Mt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=xt(La(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()}function xt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],i=Mv(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=sz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Lo(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var mz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Mt(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(mz);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(cz(n.host)===!1){let c=az(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Mv(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&uz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var np={SCHEMES:lz,normalize:dz,resolve:pz,resolveComponent:qv,equal:fz,serialize:xt,parse:Mt};Va.exports=np;Va.exports.default=np;Va.exports.fastUri=np});var Fv=w(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var Vv=Lv();Vv.code='require("ajv/dist/runtime/uri").default';op.default=Vv});var Yv=w(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.CodeGen=we.Name=we.nil=we.stringify=we.str=we._=we.KeywordCxt=void 0;var hz=Mo();Object.defineProperty(we,"KeywordCxt",{enumerable:!0,get:function(){return hz.KeywordCxt}});var sn=G();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return sn._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return sn.str}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return sn.stringify}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return sn.nil}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return sn.Name}});Object.defineProperty(we,"CodeGen",{enumerable:!0,get:function(){return sn.CodeGen}});var gz=Ua(),Hv=qo(),vz=Nd(),Vo=Ca(),_z=G(),Fo=Uo(),Fa=Ro(),ap=ne(),Jv=jv(),yz=Fv(),Wv=(e,t)=>new RegExp(e,t);Wv.code="new RegExp";var $z=["removeAdditional","useDefaults","coerceTypes"],bz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),xz={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."},kz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Kv=200;function wz(e){var t,r,n,o,i,a,s,c,u,l,d,m,f,h,g,y,b,P,I,A,O,it,at,fs,ms;let gn=e.strict,hs=(t=e.code)===null||t===void 0?void 0:t.optimize,lf=hs===!0||hs===void 0?1:hs||0,df=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Wv,Dy=(o=e.uriResolver)!==null&&o!==void 0?o:yz.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:gn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:gn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:gn)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:gn)!==null&&m!==void 0?m:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:gn)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:lf,regExp:df}:{optimize:lf,regExp:df},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Kv,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:Kv,meta:(b=e.meta)!==null&&b!==void 0?b:!0,messages:(P=e.messages)!==null&&P!==void 0?P:!0,inlineRefs:(I=e.inlineRefs)!==null&&I!==void 0?I:!0,schemaId:(A=e.schemaId)!==null&&A!==void 0?A:"$id",addUsedSchema:(O=e.addUsedSchema)!==null&&O!==void 0?O:!0,validateSchema:(it=e.validateSchema)!==null&&it!==void 0?it:!0,validateFormats:(at=e.validateFormats)!==null&&at!==void 0?at:!0,unicodeRegExp:(fs=e.unicodeRegExp)!==null&&fs!==void 0?fs:!0,int32range:(ms=e.int32range)!==null&&ms!==void 0?ms:!0,uriResolver:Dy}}var Jo=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...wz(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new _z.ValueScope({scope:{},prefixes:bz,es5:r,lines:n}),this.logger=jz(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,vz.getRules)(),Gv.call(this,xz,t,"NOT SUPPORTED"),Gv.call(this,kz,t,"DEPRECATED","warn"),this._metaOpts=Pz.call(this),t.formats&&zz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Iz.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Sz.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Jv;n==="id"&&(o={...Jv},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await i.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||a.call(this,m)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Hv.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Fo.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=Bv.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Vo.SchemaEnv({schema:{},schemaId:n});if(r=Vo.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Bv.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,Fo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Oz.call(this,n,r),!r)return(0,ap.eachItem)(n,i=>ip.call(this,i)),this;Dz.call(this,r);let o={...r,type:(0,Fa.getJSONTypes)(r.type),schemaType:(0,Fa.getJSONTypes)(r.schemaType)};return(0,ap.eachItem)(n,o.type.length===0?i=>ip.call(this,i,o):i=>o.type.forEach(a=>ip.call(this,i,o,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Xv(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,Fo.normalizeId)(a||n);let u=Fo.getSchemaRefs.call(this,t,n);return c=new Vo.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Vo.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Vo.compileSchema.call(this,t)}finally{this.opts=r}}};Jo.ValidationError=gz.default;Jo.MissingRefError=Hv.default;we.default=Jo;function Gv(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function Bv(e){return e=(0,Fo.normalizeId)(e),this.schemas[e]||this.refs[e]}function Sz(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function zz(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Iz(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function Pz(){let e={...this.opts};for(let t of $z)delete e[t];return e}var Tz={log(){},warn(){},error(){}};function jz(e){if(e===!1)return Tz;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Ez=/^[a-z_$][a-z0-9_$:-]*$/i;function Oz(e,t){let{RULES:r}=this;if((0,ap.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Ez.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function ip(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,Fa.getJSONTypes)(t.type),schemaType:(0,Fa.getJSONTypes)(t.schemaType)}};t.before?Nz.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Nz(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function Dz(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Xv(t)),e.validateSchema=this.compile(t,!0))}var Zz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Xv(e){return{anyOf:[e,Zz]}}});var Qv=w(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});var Rz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};sp.default=Rz});var n_=w(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.callRef=xr.getValidate=void 0;var Uz=qo(),e_=rt(),Ve=G(),cn=At(),t_=Ca(),Ja=ne(),Az={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=t_.resolveRef.call(c,u,o,r);if(l===void 0)throw new Uz.default(n.opts.uriResolver,o,r);if(l instanceof t_.SchemaEnv)return m(l);return f(l);function d(){if(i===u)return Ka(e,a,i,i.$async);let h=t.scopeValue("root",{ref:u});return Ka(e,(0,Ve._)`${h}.validate`,u,u.$async)}function m(h){let g=r_(e,h);Ka(e,g,h,h.$async)}function f(h){let g=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Ve.stringify)(h)}:{ref:h}),y=t.name("valid"),b=e.subschema({schema:h,dataTypes:[],schemaPath:Ve.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated(b),e.ok(y)}}};function r_(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ve._)`${r.scopeValue("wrapper",{ref:t})}.validate`}xr.getValidate=r_;function Ka(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?cn.default.this:Ve.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Ve._)`await ${(0,e_.callValidateCode)(e,t,u)}`),f(t),a||o.assign(h,!0)},g=>{o.if((0,Ve._)`!(${g} instanceof ${i.ValidationError})`,()=>o.throw(g)),m(g),a||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,e_.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(h){let g=(0,Ve._)`${h}.errors`;o.assign(cn.default.vErrors,(0,Ve._)`${cn.default.vErrors} === null ? ${g} : ${cn.default.vErrors}.concat(${g})`),o.assign(cn.default.errors,(0,Ve._)`${cn.default.vErrors}.length`)}function f(h){var g;if(!i.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=Ja.mergeEvaluated.props(o,y.props,i.props));else{let b=o.var("props",(0,Ve._)`${h}.evaluated.props`);i.props=Ja.mergeEvaluated.props(o,b,i.props,Ve.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=Ja.mergeEvaluated.items(o,y.items,i.items));else{let b=o.var("items",(0,Ve._)`${h}.evaluated.items`);i.items=Ja.mergeEvaluated.items(o,b,i.items,Ve.Name)}}}xr.callRef=Ka;xr.default=Az});var o_=w(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});var Cz=Qv(),Mz=n_(),qz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Cz.default,Mz.default];cp.default=qz});var i_=w(up=>{"use strict";Object.defineProperty(up,"__esModule",{value:!0});var Ga=G(),or=Ga.operators,Ba={maximum:{okStr:"<=",ok:or.LTE,fail:or.GT},minimum:{okStr:">=",ok:or.GTE,fail:or.LT},exclusiveMaximum:{okStr:"<",ok:or.LT,fail:or.GTE},exclusiveMinimum:{okStr:">",ok:or.GT,fail:or.LTE}},Lz={message:({keyword:e,schemaCode:t})=>(0,Ga.str)`must be ${Ba[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Ga._)`{comparison: ${Ba[e].okStr}, limit: ${t}}`},Vz={keyword:Object.keys(Ba),type:"number",schemaType:"number",$data:!0,error:Lz,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Ga._)`${r} ${Ba[t].fail} ${n} || isNaN(${r})`)}};up.default=Vz});var a_=w(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var Ko=G(),Fz={message:({schemaCode:e})=>(0,Ko.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Ko._)`{multipleOf: ${e}}`},Jz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Fz,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,Ko._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,Ko._)`${a} !== parseInt(${a})`;e.fail$data((0,Ko._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};lp.default=Jz});var c_=w(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});function s_(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}dp.default=s_;s_.code='require("ajv/dist/runtime/ucs2length").default'});var u_=w(pp=>{"use strict";Object.defineProperty(pp,"__esModule",{value:!0});var kr=G(),Kz=ne(),Gz=c_(),Bz={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,kr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,kr._)`{limit: ${e}}`},Hz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Bz,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?kr.operators.GT:kr.operators.LT,a=o.opts.unicode===!1?(0,kr._)`${r}.length`:(0,kr._)`${(0,Kz.useFunc)(e.gen,Gz.default)}(${r})`;e.fail$data((0,kr._)`${a} ${i} ${n}`)}};pp.default=Hz});var l_=w(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var Wz=rt(),Ha=G(),Xz={message:({schemaCode:e})=>(0,Ha.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,Ha._)`{pattern: ${e}}`},Yz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Xz,code(e){let{data:t,$data:r,schema:n,schemaCode:o,it:i}=e,a=i.opts.unicodeRegExp?"u":"",s=r?(0,Ha._)`(new RegExp(${o}, ${a}))`:(0,Wz.usePattern)(e,n);e.fail$data((0,Ha._)`!${s}.test(${t})`)}};fp.default=Yz});var d_=w(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var Go=G(),Qz={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Go.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Go._)`{limit: ${e}}`},eI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Qz,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Go.operators.GT:Go.operators.LT;e.fail$data((0,Go._)`Object.keys(${r}).length ${o} ${n}`)}};mp.default=eI});var p_=w(hp=>{"use strict";Object.defineProperty(hp,"__esModule",{value:!0});var Bo=rt(),Ho=G(),tI=ne(),rI={message:({params:{missingProperty:e}})=>(0,Ho.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Ho._)`{missingProperty: ${e}}`},nI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:rI,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if(f?.[g]===void 0&&!h.has(g)){let y=a.schemaEnv.baseId+a.errSchemaPath,b=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,tI.checkStrictMode)(a,b,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(Ho.nil,d);else for(let f of r)(0,Bo.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||i){let h=t.let("valid",!0);e.block$data(h,()=>m(f,h)),e.ok(h)}else t.if((0,Bo.checkMissingProp)(e,r,f)),(0,Bo.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,Bo.noPropertyInData)(t,o,f,s.ownProperties),()=>e.error())})}function m(f,h){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(h,(0,Bo.propertyInData)(t,o,f,s.ownProperties)),t.if((0,Ho.not)(h),()=>{e.error(),t.break()})},Ho.nil)}}};hp.default=nI});var f_=w(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var Wo=G(),oI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Wo.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Wo._)`{limit: ${e}}`},iI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:oI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?Wo.operators.GT:Wo.operators.LT;e.fail$data((0,Wo._)`${r}.length ${o} ${n}`)}};gp.default=iI});var Wa=w(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});var m_=qd();m_.code='require("ajv/dist/runtime/equal").default';vp.default=m_});var h_=w(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var _p=Ro(),Se=G(),aI=ne(),sI=Wa(),cI={message:({params:{i:e,j:t}})=>(0,Se.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Se._)`{i: ${e}, j: ${t}}`},uI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:cI,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,_p.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Se._)`${a} === false`),e.ok(c);function l(){let h=t.let("i",(0,Se._)`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if((0,Se._)`${h} > 1`,()=>(d()?m:f)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function m(h,g){let y=t.name("item"),b=(0,_p.checkDataTypes)(u,y,s.opts.strictNumbers,_p.DataType.Wrong),P=t.const("indices",(0,Se._)`{}`);t.for((0,Se._)`;${h}--;`,()=>{t.let(y,(0,Se._)`${r}[${h}]`),t.if(b,(0,Se._)`continue`),u.length>1&&t.if((0,Se._)`typeof ${y} == "string"`,(0,Se._)`${y} += "_"`),t.if((0,Se._)`typeof ${P}[${y}] == "number"`,()=>{t.assign(g,(0,Se._)`${P}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Se._)`${P}[${y}] = ${h}`)})}function f(h,g){let y=(0,aI.useFunc)(t,sI.default),b=t.name("outer");t.label(b).for((0,Se._)`;${h}--;`,()=>t.for((0,Se._)`${g} = ${h}; ${g}--;`,()=>t.if((0,Se._)`${y}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(b)})))}}};yp.default=uI});var g_=w(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var $p=G(),lI=ne(),dI=Wa(),pI={message:"must be equal to constant",params:({schemaCode:e})=>(0,$p._)`{allowedValue: ${e}}`},fI={keyword:"const",$data:!0,error:pI,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,$p._)`!${(0,lI.useFunc)(t,dI.default)}(${r}, ${o})`):e.fail((0,$p._)`${i} !== ${r}`)}};bp.default=fI});var v_=w(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var Xo=G(),mI=ne(),hI=Wa(),gI={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Xo._)`{allowedValues: ${e}}`},vI={keyword:"enum",schemaType:"array",$data:!0,error:gI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,mI.useFunc)(t,hI.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",i);l=(0,Xo.or)(...o.map((h,g)=>m(f,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,f=>t.if((0,Xo._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,h){let g=o[h];return typeof g=="object"&&g!==null?(0,Xo._)`${u()}(${r}, ${f}[${h}])`:(0,Xo._)`${r} === ${g}`}}};xp.default=vI});var __=w(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var _I=i_(),yI=a_(),$I=u_(),bI=l_(),xI=d_(),kI=p_(),wI=f_(),SI=h_(),zI=g_(),II=v_(),PI=[_I.default,yI.default,$I.default,bI.default,xI.default,kI.default,wI.default,SI.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},zI.default,II.default];kp.default=PI});var Sp=w(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.validateAdditionalItems=void 0;var wr=G(),wp=ne(),TI={message:({params:{len:e}})=>(0,wr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,wr._)`{limit: ${e}}`},jI={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:TI,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,wp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}y_(e,n)}};function y_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,wr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,wr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,wp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,wr._)`${s} <= ${t.length}`);r.if((0,wr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:wp.Type.Num},u),a.allErrors||r.if((0,wr.not)(u),()=>r.break())})}}Yo.validateAdditionalItems=y_;Yo.default=jI});var zp=w(Qo=>{"use strict";Object.defineProperty(Qo,"__esModule",{value:!0});Qo.validateTuple=void 0;var $_=G(),Xa=ne(),EI=rt(),OI={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return b_(e,"additionalItems",t);r.items=!0,!(0,Xa.alwaysValidSchema)(r,t)&&e.ok((0,EI.validateArray)(e))}};function b_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Xa.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,$_._)`${i}.length`);r.forEach((d,m)=>{(0,Xa.alwaysValidSchema)(s,d)||(n.if((0,$_._)`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:f}=s,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(m.strictTuples&&!g){let y=`"${a}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Xa.checkStrictMode)(s,y,m.strictTuples)}}}Qo.validateTuple=b_;Qo.default=OI});var x_=w(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var NI=zp(),DI={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,NI.validateTuple)(e,"items")};Ip.default=DI});var w_=w(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});var k_=G(),ZI=ne(),RI=rt(),UI=Sp(),AI={message:({params:{len:e}})=>(0,k_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,k_._)`{limit: ${e}}`},CI={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:AI,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,ZI.alwaysValidSchema)(n,t)&&(o?(0,UI.validateAdditionalItems)(e,o):e.ok((0,RI.validateArray)(e)))}};Pp.default=CI});var S_=w(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var ot=G(),Ya=ne(),MI={message:({params:{min:e,max:t}})=>t===void 0?(0,ot.str)`must contain at least ${e} valid item(s)`:(0,ot.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ot._)`{minContains: ${e}}`:(0,ot._)`{minContains: ${e}, maxContains: ${t}}`},qI={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:MI,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ot._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,Ya.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Ya.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Ya.alwaysValidSchema)(i,r)){let g=(0,ot._)`${l} >= ${a}`;s!==void 0&&(g=(0,ot._)`${g} && ${l} <= ${s}`),e.pass(g);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?f(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ot._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let g=t.name("_valid"),y=t.let("count",0);f(g,()=>t.if(g,()=>h(y)))}function f(g,y){t.forRange("i",0,l,b=>{e.subschema({keyword:"contains",dataProp:b,dataPropType:Ya.Type.Num,compositeRule:!0},g),y()})}function h(g){t.code((0,ot._)`${g}++`),s===void 0?t.if((0,ot._)`${g} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ot._)`${g} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ot._)`${g} >= ${a}`,()=>t.assign(d,!0)))}}};Tp.default=qI});var P_=w(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.validateSchemaDeps=kt.validatePropertyDeps=kt.error=void 0;var jp=G(),LI=ne(),ei=rt();kt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,jp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,jp._)`{property: ${e},
7
7
  missingProperty: ${n},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var VI={keyword:"dependencies",type:"object",schemaType:"object",error:kt.error,code(e){let[t,r]=FI(e);z_(e,t),I_(e,r)}};function FI({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function z_(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,ei.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,ei.checkReportMissingProp)(e,u)}):(r.if((0,jp._)`${c} && (${(0,ei.checkMissingProp)(e,s,i)})`),(0,ei.reportMissingProp)(e,i),r.else())}}kt.validatePropertyDeps=z_;function I_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,LI.alwaysValidSchema)(i,t[s])||(r.if((0,ei.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}kt.validateSchemaDeps=I_;kt.default=VI});var j_=w(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});var T_=G(),JI=ne(),KI={message:"property name must be valid",params:({params:e})=>(0,T_._)`{propertyName: ${e.propertyName}}`},GI={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:KI,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,JI.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,T_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Ep.default=GI});var Np=w(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var Qa=rt(),ft=G(),BI=At(),es=ne(),HI={message:"must NOT have additional properties",params:({params:e})=>(0,ft._)`{additionalProperty: ${e.additionalProperty}}`},WI={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:HI,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,es.alwaysValidSchema)(a,r))return;let u=(0,Qa.allSchemaProperties)(n.properties),l=(0,Qa.allSchemaProperties)(n.patternProperties);d(),e.ok((0,ft._)`${i} === ${BI.default.errors}`);function d(){t.forIn("key",o,$=>{!u.length&&!l.length?h($):t.if(m($),()=>h($))})}function m($){let b;if(u.length>8){let P=(0,es.schemaRefOrVal)(a,n.properties,"properties");b=(0,Qa.isOwnProperty)(t,P,$)}else u.length?b=(0,ft.or)(...u.map(P=>(0,ft._)`${$} === ${P}`)):b=ft.nil;return l.length&&(b=(0,ft.or)(b,...l.map(P=>(0,ft._)`${(0,Qa.usePattern)(e,P)}.test(${$})`))),(0,ft.not)(b)}function f($){t.code((0,ft._)`delete ${o}[${$}]`)}function h($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,es.alwaysValidSchema)(a,r)){let b=t.name("valid");c.removeAdditional==="failing"?(g($,b,!1),t.if((0,ft.not)(b),()=>{e.reset(),f($)})):(g($,b),s||t.if((0,ft.not)(b),()=>t.break()))}}function g($,b,P){let I={keyword:"additionalProperties",dataProp:$,dataPropType:es.Type.Str};P===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(I,b)}}};Op.default=WI});var N_=w(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var XI=Mo(),E_=rt(),Dp=ne(),O_=Np(),YI={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&O_.default.code(new XI.KeywordCxt(i,O_.default,"additionalProperties"));let a=(0,E_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Dp.mergeEvaluated.props(t,(0,Dp.toHash)(a),i.props));let s=a.filter(d=>!(0,Dp.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,E_.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Zp.default=YI});var U_=w(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var D_=rt(),ts=G(),Z_=ne(),R_=ne(),QI={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,D_.allSchemaProperties)(r),c=s.filter(g=>(0,Z_.alwaysValidSchema)(i,r[g]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof ts.Name)&&(i.props=(0,R_.evaluatedPropsToName)(t,i.props));let{props:d}=i;m();function m(){for(let g of s)u&&f(g),i.allErrors?h(g):(t.var(l,!0),h(g),t.if(l))}function f(g){for(let $ in u)new RegExp(g).test($)&&(0,Z_.checkStrictMode)(i,`property ${$} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",n,$=>{t.if((0,ts._)`${(0,D_.usePattern)(e,g)}.test(${$})`,()=>{let b=c.includes(g);b||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:$,dataPropType:R_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,ts._)`${d}[${$}]`,!0):!b&&!i.allErrors&&t.if((0,ts.not)(l),()=>t.break())})})}}};Rp.default=QI});var A_=w(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var eP=ne(),tP={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,eP.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Up.default=tP});var C_=w(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var rP=rt(),nP={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:rP.validateUnion,error:{message:"must match a schema in anyOf"}};Ap.default=nP});var M_=w(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var rs=G(),oP=ne(),iP={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,rs._)`{passingSchemas: ${e.passing}}`},aP={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:iP,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let m;(0,oP.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,rs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,rs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),m&&e.mergeEvaluated(m,rs.Name)})})}}};Cp.default=aP});var q_=w(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var sP=ne(),cP={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,sP.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};Mp.default=cP});var F_=w(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var ns=G(),V_=ne(),uP={message:({params:e})=>(0,ns.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ns._)`{failingKeyword: ${e.ifClause}}`},lP={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:uP,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,V_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=L_(n,"then"),i=L_(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,ns.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(m,a),d?t.assign(d,(0,ns._)`${l}`):e.setParams({ifClause:l})}}}};function L_(e,t){let r=e.schema[t];return r!==void 0&&!(0,V_.alwaysValidSchema)(e,r)}qp.default=lP});var J_=w(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var dP=ne(),pP={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,dP.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Lp.default=pP});var K_=w(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var fP=Sp(),mP=x_(),hP=zp(),gP=w_(),vP=S_(),_P=P_(),yP=j_(),$P=Np(),bP=N_(),xP=U_(),kP=A_(),wP=C_(),SP=M_(),zP=q_(),IP=F_(),PP=J_();function TP(e=!1){let t=[kP.default,wP.default,SP.default,zP.default,IP.default,PP.default,yP.default,$P.default,_P.default,bP.default,xP.default];return e?t.push(mP.default,gP.default):t.push(fP.default,hP.default),t.push(vP.default),t}Vp.default=TP});var G_=w(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var ve=G(),jP={message:({schemaCode:e})=>(0,ve.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ve._)`{format: ${e}}`},EP={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:jP,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?m():f();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,ve._)`${h}[${a}]`),$=r.let("fType"),b=r.let("format");r.if((0,ve._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign($,(0,ve._)`${g}.type || "string"`).assign(b,(0,ve._)`${g}.validate`),()=>r.assign($,(0,ve._)`"string"`).assign(b,g)),e.fail$data((0,ve.or)(P(),I()));function P(){return c.strictSchema===!1?ve.nil:(0,ve._)`${a} && !${b}`}function I(){let A=l.$async?(0,ve._)`(${g}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,ve._)`${b}(${n})`,O=(0,ve._)`(typeof ${b} == "function" ? ${A} : ${b}.test(${n}))`;return(0,ve._)`${b} && ${b} !== true && ${$} === ${t} && !${O}`}}function f(){let h=d.formats[i];if(!h){P();return}if(h===!0)return;let[g,$,b]=I(h);g===t&&e.pass(A());function P(){if(c.strictSchema===!1){d.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function I(O){let it=O instanceof RegExp?(0,ve.regexpCode)(O):c.code.formats?(0,ve._)`${c.code.formats}${(0,ve.getProperty)(i)}`:void 0,at=r.scopeValue("formats",{key:i,ref:O,code:it});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,ve._)`${at}.validate`]:["string",O,at]}function A(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ve._)`await ${b}(${n})`}return typeof $=="function"?(0,ve._)`${b}(${n})`:(0,ve._)`${b}.test(${n})`}}}};Fp.default=EP});var B_=w(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var OP=G_(),NP=[OP.default];Jp.default=NP});var H_=w(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.contentVocabulary=un.metadataVocabulary=void 0;un.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];un.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var X_=w(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var DP=o_(),ZP=__(),RP=K_(),UP=B_(),W_=H_(),AP=[DP.default,ZP.default,(0,RP.default)(),UP.default,W_.metadataVocabulary,W_.contentVocabulary];Kp.default=AP});var Q_=w(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.DiscrError=void 0;var Y_;(function(e){e.Tag="tag",e.Mapping="mapping"})(Y_||(os.DiscrError=Y_={}))});var ty=w(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var ln=G(),Gp=Q_(),ey=Ca(),CP=qo(),MP=ne(),qP={message:({params:{discrError:e,tagName:t}})=>e===Gp.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,ln._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},LP={keyword:"discriminator",type:"object",schemaType:"object",error:qP,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,ln._)`${r}${(0,ln.getProperty)(s)}`);t.if((0,ln._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Gp.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let f=m();t.if(!1);for(let h in f)t.elseIf((0,ln._)`${u} === ${h}`),t.assign(c,d(f[h]));t.else(),e.error(!1,{discrError:Gp.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(f){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(g,ln.Name),h}function m(){var f;let h={},g=b(o),$=!0;for(let A=0;A<a.length;A++){let O=a[A];if(O?.$ref&&!(0,MP.schemaHasRulesButRef)(O,i.self.RULES)){let at=O.$ref;if(O=ey.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,at),O instanceof ey.SchemaEnv&&(O=O.schema),O===void 0)throw new CP.default(i.opts.uriResolver,i.baseId,at)}let it=(f=O?.properties)===null||f===void 0?void 0:f[s];if(typeof it!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);$=$&&(g||b(O)),P(it,A)}if(!$)throw new Error(`discriminator: "${s}" must be required`);return h;function b({required:A}){return Array.isArray(A)&&A.includes(s)}function P(A,O){if(A.const)I(A.const,O);else if(A.enum)for(let it of A.enum)I(it,O);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function I(A,O){if(typeof A!="string"||A in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[A]=O}}}};Bp.default=LP});var ry=w((l6,VP)=>{VP.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 Wp=w((ge,Hp)=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.MissingRefError=ge.ValidationError=ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=ge.Ajv=void 0;var FP=Yv(),JP=X_(),KP=ty(),ny=ry(),GP=["/properties"],is="http://json-schema.org/draft-07/schema",dn=class extends FP.default{_addVocabularies(){super._addVocabularies(),JP.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(KP.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(ny,GP):ny;this.addMetaSchema(t,is,!1),this.refs["http://json-schema.org/schema"]=is}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(is)?is:void 0)}};ge.Ajv=dn;Hp.exports=ge=dn;Hp.exports.Ajv=dn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=dn;var BP=Mo();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return BP.KeywordCxt}});var pn=G();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return pn._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return pn.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return pn.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return pn.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return pn.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return pn.CodeGen}});var HP=Ua();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return HP.default}});var WP=qo();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return WP.default}})});var dy=w(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.formatNames=St.fastFormats=St.fullFormats=void 0;function wt(e,t){return{validate:e,compare:t}}St.fullFormats={date:wt(sy,ef),time:wt(Yp(!0),tf),"date-time":wt(oy(!0),uy),"iso-time":wt(Yp(),cy),"iso-date-time":wt(oy(),ly),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:rT,"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:uT,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:nT,int32:{type:"number",validate:aT},int64:{type:"number",validate:sT},float:{type:"number",validate:ay},double:{type:"number",validate:ay},password:!0,binary:!0};St.fastFormats={...St.fullFormats,date:wt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ef),time:wt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,tf),"date-time":wt(/^\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,uy),"iso-time":wt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,cy),"iso-date-time":wt(/^\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,ly),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};St.formatNames=Object.keys(St.fullFormats);function XP(e){return e%4===0&&(e%100!==0||e%400===0)}var YP=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,QP=[0,31,28,31,30,31,30,31,31,30,31,30,31];function sy(e){let t=YP.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&XP(r)?29:QP[n])}function ef(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Xp=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Yp(e){return function(r){let n=Xp.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&a<61}}function tf(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function cy(e,t){if(!(e&&t))return;let r=Xp.exec(e),n=Xp.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var Qp=/t|\s/i;function oy(e){let t=Yp(e);return function(n){let o=n.split(Qp);return o.length===2&&sy(o[0])&&t(o[1])}}function uy(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function ly(e,t){if(!(e&&t))return;let[r,n]=e.split(Qp),[o,i]=t.split(Qp),a=ef(r,o);if(a!==void 0)return a||tf(n,i)}var eT=/\/|:/,tT=/^(?:[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 rT(e){return eT.test(e)&&tT.test(e)}var iy=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function nT(e){return iy.lastIndex=0,iy.test(e)}var oT=-(2**31),iT=2**31-1;function aT(e){return Number.isInteger(e)&&e<=iT&&e>=oT}function sT(e){return Number.isInteger(e)}function ay(){return!0}var cT=/[^\\]\\Z/;function uT(e){if(cT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var py=w(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.formatLimitDefinition=void 0;var lT=Wp(),mt=G(),ir=mt.operators,as={formatMaximum:{okStr:"<=",ok:ir.LTE,fail:ir.GT},formatMinimum:{okStr:">=",ok:ir.GTE,fail:ir.LT},formatExclusiveMaximum:{okStr:"<",ok:ir.LT,fail:ir.GTE},formatExclusiveMinimum:{okStr:">",ok:ir.GT,fail:ir.LTE}},dT={message:({keyword:e,schemaCode:t})=>(0,mt.str)`should be ${as[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,mt._)`{comparison: ${as[e].okStr}, limit: ${t}}`};fn.formatLimitDefinition={keyword:Object.keys(as),type:"string",schemaType:"string",$data:!0,error:dT,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new lT.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=t.const("fmt",(0,mt._)`${m}[${c.schemaCode}]`);e.fail$data((0,mt.or)((0,mt._)`typeof ${f} != "object"`,(0,mt._)`${f} instanceof RegExp`,(0,mt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=c.schema,f=s.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let h=t.scopeValue("formats",{key:m,ref:f,code:a.code.formats?(0,mt._)`${a.code.formats}${(0,mt.getProperty)(m)}`:void 0});e.fail$data(d(h))}function d(m){return(0,mt._)`${m}.compare(${r}, ${n}) ${as[o].fail} 0`}},dependencies:["format"]};var pT=e=>(e.addKeyword(fn.formatLimitDefinition),e);fn.default=pT});var gy=w((ti,hy)=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});var mn=dy(),fT=py(),rf=G(),fy=new rf.Name("fullFormats"),mT=new rf.Name("fastFormats"),nf=(e,t={keywords:!0})=>{if(Array.isArray(t))return my(e,t,mn.fullFormats,fy),e;let[r,n]=t.mode==="fast"?[mn.fastFormats,mT]:[mn.fullFormats,fy],o=t.formats||mn.formatNames;return my(e,o,r,n),t.keywords&&(0,fT.default)(e),e};nf.get=(e,t="full")=>{let n=(t==="fast"?mn.fastFormats:mn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function my(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,rf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}hy.exports=ti=nf;Object.defineProperty(ti,"__esModule",{value:!0});ti.default=nf});var Y;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Y||(Y={}));var pf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(pf||(pf={}));var S=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zt=e=>{switch(typeof e){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(e)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(e)?S.array:e===null?S.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?S.promise:typeof Map<"u"&&e instanceof Map?S.map:typeof Set<"u"&&e instanceof Set?S.set:typeof Date<"u"&&e instanceof Date?S.date:S.object;default:return S.unknown}};var _=Y.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 Fe=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Fe.create=e=>new Fe(e);var qy=(e,t)=>{let r;switch(e.code){case _.invalid_type:e.received===S.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Y.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${Y.joinValues(e.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Y.joinValues(e.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${Y.joinValues(e.options)}, received '${e.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Y.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case _.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case _.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;default:r=t.defaultError,Y.assertNever(e)}return{message:r}},qt=qy;var Ly=qt;function _n(){return Ly}var ri=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function x(e,t){let r=_n(),n=ri({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===qt?void 0:qt].filter(o=>!!o)});e.common.issues.push(n)}var ze=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return R;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return R;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},R=Object.freeze({status:"aborted"}),Sr=e=>({status:"dirty",value:e}),Oe=e=>({status:"valid",value:e}),_s=e=>e.status==="aborted",ys=e=>e.status==="dirty",ar=e=>e.status==="valid",yn=e=>typeof Promise<"u"&&e instanceof Promise;var T;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(T||(T={}));var We=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ff=(e,t)=>{if(ar(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Fe(e.common.issues);return this._error=r,this._error}}};function q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var B=class{get description(){return this._def.description}_getType(t){return zt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ze,ctx:{common:t.parent.common,data:t.data,parsedType:zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(yn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return ff(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return ar(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>ar(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(yn(o)?o:Promise.resolve(o));return ff(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:_.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new ct({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return st.create(this,this._def)}nullable(){return Tt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vt.create(this)}promise(){return sr.create(this,this._def)}or(t){return jr.create([this,t],this._def)}and(t){return Er.create(this,t,this._def)}transform(t){return new ct({...q(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Rr({...q(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new ni({typeName:N.ZodBranded,type:this,...q(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ur({...q(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return oi.create(this,t)}readonly(){return Ar.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Vy=/^c[^\s-]{8,}$/i,Fy=/^[0-9a-z]+$/,Jy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ky=/^[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,Gy=/^[a-z0-9_-]{21}$/i,By=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hy=/^[-+]?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)?)??$/,Wy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$s,Yy=/^(?:(?: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])$/,Qy=/^(?:(?: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])$/,e$=/^(([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]))$/,t$=/^(([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])$/,r$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,n$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",o$=new RegExp(`^${mf}$`);function hf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function i$(e){return new RegExp(`^${hf(e)}$`)}function a$(e){let t=`${mf}T${hf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function s$(e,t){return!!((t==="v4"||!t)&&Yy.test(e)||(t==="v6"||!t)&&e$.test(e))}function c$(e,t){if(!By.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function u$(e,t){return!!((t==="v4"||!t)&&Qy.test(e)||(t==="v6"||!t)&&t$.test(e))}var Ir=class e extends B{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==S.string){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_type,expected:S.string,received:i.parsedType}),R}let n=new ze,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?x(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&x(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Wy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"email",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")$s||($s=new RegExp(Xy,"u")),$s.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"emoji",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ky.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"uuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Gy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"nanoid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Vy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"cuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Fy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"cuid2",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Jy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"ulid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),x(o,{validation:"url",code:_.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"regex",code:_.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?a$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?o$.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?i$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Hy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"duration",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?s$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"ip",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?c$(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"jwt",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?u$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"cidr",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?r$.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"base64",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?n$.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"base64url",code:_.invalid_string,message:i.message}),n.dirty()):Y.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:_.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...T.errToObj(t)})}url(t){return this._addCheck({kind:"url",...T.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...T.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...T.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...T.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...T.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...T.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...T.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...T.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...T.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...T.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...T.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...T.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...T.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...T.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...T.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...T.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...T.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...T.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...T.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...T.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...T.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...T.errToObj(r)})}nonempty(t){return this.min(1,T.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ir.create=e=>new Ir({checks:[],typeName:N.ZodString,coerce:e?.coerce??!1,...q(e)});function l$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var $n=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==S.number){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_type,expected:S.number,received:i.parsedType}),R}let n,o=new ze;for(let i of this._def.checks)i.kind==="int"?Y.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:_.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?l$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:_.not_finite,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:T.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:T.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Y.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};$n.create=e=>new $n({checks:[],typeName:N.ZodNumber,coerce:e?.coerce||!1,...q(e)});var bn=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==S.bigint)return this._getInvalidInput(t);let n,o=new ze;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return x(r,{code:_.invalid_type,expected:S.bigint,received:r.parsedType}),R}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};bn.create=e=>new bn({checks:[],typeName:N.ZodBigInt,coerce:e?.coerce??!1,...q(e)});var xn=class extends B{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==S.boolean){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.boolean,received:n.parsedType}),R}return Oe(t.data)}};xn.create=e=>new xn({typeName:N.ZodBoolean,coerce:e?.coerce||!1,...q(e)});var kn=class e extends B{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==S.date){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_type,expected:S.date,received:i.parsedType}),R}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_date}),R}let n=new ze,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Y.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:T.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:T.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};kn.create=e=>new kn({checks:[],coerce:e?.coerce||!1,typeName:N.ZodDate,...q(e)});var wn=class extends B{_parse(t){if(this._getType(t)!==S.symbol){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.symbol,received:n.parsedType}),R}return Oe(t.data)}};wn.create=e=>new wn({typeName:N.ZodSymbol,...q(e)});var Pr=class extends B{_parse(t){if(this._getType(t)!==S.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.undefined,received:n.parsedType}),R}return Oe(t.data)}};Pr.create=e=>new Pr({typeName:N.ZodUndefined,...q(e)});var Tr=class extends B{_parse(t){if(this._getType(t)!==S.null){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.null,received:n.parsedType}),R}return Oe(t.data)}};Tr.create=e=>new Tr({typeName:N.ZodNull,...q(e)});var Sn=class extends B{constructor(){super(...arguments),this._any=!0}_parse(t){return Oe(t.data)}};Sn.create=e=>new Sn({typeName:N.ZodAny,...q(e)});var Lt=class extends B{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Oe(t.data)}};Lt.create=e=>new Lt({typeName:N.ZodUnknown,...q(e)});var vt=class extends B{_parse(t){let r=this._getOrReturnCtx(t);return x(r,{code:_.invalid_type,expected:S.never,received:r.parsedType}),R}};vt.create=e=>new vt({typeName:N.ZodNever,...q(e)});var zn=class extends B{_parse(t){if(this._getType(t)!==S.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.void,received:n.parsedType}),R}return Oe(t.data)}};zn.create=e=>new zn({typeName:N.ZodVoid,...q(e)});var Vt=class e extends B{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==S.array)return x(r,{code:_.invalid_type,expected:S.array,received:r.parsedType}),R;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(x(r,{code:a?_.too_big:_.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(x(r,{code:_.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(x(r,{code:_.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new We(r,a,r.path,s)))).then(a=>ze.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new We(r,a,r.path,s)));return ze.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:T.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:T.toString(r)}})}nonempty(t){return this.min(1,t)}};Vt.create=(e,t)=>new Vt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...q(t)});function zr(e){if(e instanceof Je){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=st.create(zr(n))}return new Je({...e._def,shape:()=>t})}else return e instanceof Vt?new Vt({...e._def,type:zr(e.element)}):e instanceof st?st.create(zr(e.unwrap())):e instanceof Tt?Tt.create(zr(e.unwrap())):e instanceof Pt?Pt.create(e.items.map(t=>zr(t))):e}var Je=class e extends B{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Y.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==S.object){let u=this._getOrReturnCtx(t);return x(u,{code:_.invalid_type,expected:S.object,received:u.parsedType}),R}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof vt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new We(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof vt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(x(o,{code:_.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new We(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,m=await l.value;u.push({key:d,value:m,alwaysSet:l.alwaysSet})}return u}).then(u=>ze.mergeObjectSync(n,u)):ze.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return T.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:N.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Y.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Y.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return zr(this)}partial(t){let r={};for(let n of Y.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Y.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof st;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return gf(Y.objectKeys(this.shape))}};Je.create=(e,t)=>new Je({shape:()=>e,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...q(t)});Je.strictCreate=(e,t)=>new Je({shape:()=>e,unknownKeys:"strict",catchall:vt.create(),typeName:N.ZodObject,...q(t)});Je.lazycreate=(e,t)=>new Je({shape:e,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...q(t)});var jr=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Fe(s.ctx.common.issues));return x(r,{code:_.invalid_union,unionErrors:a}),R}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Fe(c));return x(r,{code:_.invalid_union,unionErrors:s}),R}}get options(){return this._def.options}};jr.create=(e,t)=>new jr({options:e,typeName:N.ZodUnion,...q(t)});var It=e=>e instanceof Or?It(e.schema):e instanceof ct?It(e.innerType()):e instanceof Nr?[e.value]:e instanceof Dr?e.options:e instanceof Zr?Y.objectValues(e.enum):e instanceof Rr?It(e._def.innerType):e instanceof Pr?[void 0]:e instanceof Tr?[null]:e instanceof st?[void 0,...It(e.unwrap())]:e instanceof Tt?[null,...It(e.unwrap())]:e instanceof ni||e instanceof Ar?It(e.unwrap()):e instanceof Ur?It(e._def.innerType):[],bs=class e extends B{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.object)return x(r,{code:_.invalid_type,expected:S.object,received:r.parsedType}),R;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(x(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=It(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:N.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...q(n)})}};function xs(e,t){let r=zt(e),n=zt(t);if(e===t)return{valid:!0,data:e};if(r===S.object&&n===S.object){let o=Y.objectKeys(t),i=Y.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=xs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===S.array&&n===S.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=xs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===S.date&&n===S.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Er=class extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(_s(i)||_s(a))return R;let s=xs(i.value,a.value);return s.valid?((ys(i)||ys(a))&&r.dirty(),{status:r.value,value:s.data}):(x(n,{code:_.invalid_intersection_types}),R)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Er.create=(e,t,r)=>new Er({left:e,right:t,typeName:N.ZodIntersection,...q(r)});var Pt=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.array)return x(n,{code:_.invalid_type,expected:S.array,received:n.parsedType}),R;if(n.data.length<this._def.items.length)return x(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new We(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ze.mergeArray(r,a)):ze.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Pt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pt({items:e,typeName:N.ZodTuple,rest:null,...q(t)})};var ks=class e extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.object)return x(n,{code:_.invalid_type,expected:S.object,received:n.parsedType}),R;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new We(n,s,n.path,s)),value:a._parse(new We(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ze.mergeObjectAsync(r,o):ze.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof B?new e({keyType:t,valueType:r,typeName:N.ZodRecord,...q(n)}):new e({keyType:Ir.create(),valueType:t,typeName:N.ZodRecord,...q(r)})}},In=class extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.map)return x(n,{code:_.invalid_type,expected:S.map,received:n.parsedType}),R;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new We(n,s,n.path,[u,"key"])),value:i._parse(new We(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return R;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return R;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};In.create=(e,t,r)=>new In({valueType:t,keyType:e,typeName:N.ZodMap,...q(r)});var Pn=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.set)return x(n,{code:_.invalid_type,expected:S.set,received:n.parsedType}),R;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(x(n,{code:_.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(x(n,{code:_.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return R;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new We(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:T.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Pn.create=(e,t)=>new Pn({valueType:e,minSize:null,maxSize:null,typeName:N.ZodSet,...q(t)});var ws=class e extends B{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.function)return x(r,{code:_.invalid_type,expected:S.function,received:r.parsedType}),R;function n(s,c){return ri({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_n(),qt].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:c}})}function o(s,c){return ri({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_n(),qt].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof sr){let s=this;return Oe(async function(...c){let u=new Fe([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Oe(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Fe([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Fe([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Pt.create(t).rest(Lt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Pt.create([]).rest(Lt.create()),returns:r||Lt.create(),typeName:N.ZodFunction,...q(n)})}},Or=class extends B{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Or.create=(e,t)=>new Or({getter:e,typeName:N.ZodLazy,...q(t)});var Nr=class extends B{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return x(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:t.data}}get value(){return this._def.value}};Nr.create=(e,t)=>new Nr({value:e,typeName:N.ZodLiteral,...q(t)});function gf(e,t){return new Dr({values:e,typeName:N.ZodEnum,...q(t)})}var Dr=class e extends B{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{expected:Y.joinValues(n),received:r.parsedType,code:_.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{received:r.data,code:_.invalid_enum_value,options:n}),R}return Oe(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Dr.create=gf;var Zr=class extends B{_parse(t){let r=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==S.string&&n.parsedType!==S.number){let o=Y.objectValues(r);return x(n,{expected:Y.joinValues(o),received:n.parsedType,code:_.invalid_type}),R}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Y.objectValues(r);return x(n,{received:n.data,code:_.invalid_enum_value,options:o}),R}return Oe(t.data)}get enum(){return this._def.values}};Zr.create=(e,t)=>new Zr({values:e,typeName:N.ZodNativeEnum,...q(t)});var sr=class extends B{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.promise&&r.common.async===!1)return x(r,{code:_.invalid_type,expected:S.promise,received:r.parsedType}),R;let n=r.parsedType===S.promise?r.data:Promise.resolve(r.data);return Oe(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};sr.create=(e,t)=>new sr({type:e,typeName:N.ZodPromise,...q(t)});var ct=class extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{x(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return R;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?R:c.status==="dirty"?Sr(c.value):r.value==="dirty"?Sr(c.value):c});{if(r.value==="aborted")return R;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?R:s.status==="dirty"?Sr(s.value):r.value==="dirty"?Sr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?R:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?R:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ar(a))return R;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>ar(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):R);Y.assertNever(o)}};ct.create=(e,t,r)=>new ct({schema:e,typeName:N.ZodEffects,effect:t,...q(r)});ct.createWithPreprocess=(e,t,r)=>new ct({schema:t,effect:{type:"preprocess",transform:e},typeName:N.ZodEffects,...q(r)});var st=class extends B{_parse(t){return this._getType(t)===S.undefined?Oe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};st.create=(e,t)=>new st({innerType:e,typeName:N.ZodOptional,...q(t)});var Tt=class extends B{_parse(t){return this._getType(t)===S.null?Oe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tt.create=(e,t)=>new Tt({innerType:e,typeName:N.ZodNullable,...q(t)});var Rr=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===S.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Rr.create=(e,t)=>new Rr({innerType:e,typeName:N.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...q(t)});var Ur=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return yn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Fe(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Fe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ur.create=(e,t)=>new Ur({innerType:e,typeName:N.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...q(t)});var Tn=class extends B{_parse(t){if(this._getType(t)!==S.nan){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.nan,received:n.parsedType}),R}return{status:"valid",value:t.data}}};Tn.create=e=>new Tn({typeName:N.ZodNaN,...q(e)});var XT=Symbol("zod_brand"),ni=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},oi=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?R:i.status==="dirty"?(r.dirty(),Sr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?R:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:N.ZodPipeline})}},Ar=class extends B{_parse(t){let r=this._def.innerType._parse(t),n=o=>(ar(o)&&(o.value=Object.freeze(o.value)),o);return yn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:N.ZodReadonly,...q(t)});var YT={object:Je.lazycreate},N;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(N||(N={}));var QT=Ir.create,ej=$n.create,tj=Tn.create,rj=bn.create,nj=xn.create,oj=kn.create,ij=wn.create,aj=Pr.create,sj=Tr.create,cj=Sn.create,uj=Lt.create,lj=vt.create,dj=zn.create,pj=Vt.create,d$=Je.create,fj=Je.strictCreate,mj=jr.create,hj=bs.create,gj=Er.create,vj=Pt.create,_j=ks.create,yj=In.create,$j=Pn.create,bj=ws.create,xj=Or.create,kj=Nr.create,wj=Dr.create,Sj=Zr.create,zj=sr.create,Ij=ct.create,Pj=st.create,Tj=Tt.create,jj=ct.createWithPreprocess,Ej=oi.create;var vf=Object.freeze({status:"aborted"});function p(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let m=l[d];m in s||(s[m]=u[m].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var Ss=Symbol("zod_brand"),_t=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},cr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ii={};function ye(e){return e&&Object.assign(ii,e),ii}var y={};vn(y,{BIGINT_FORMAT_RANGES:()=>Zs,Class:()=>Is,NUMBER_FORMAT_RANGES:()=>Ds,aborted:()=>Gt,allowsEval:()=>js,assert:()=>_$,assertEqual:()=>m$,assertIs:()=>g$,assertNever:()=>v$,assertNotEqual:()=>h$,assignProp:()=>Jt,base64ToUint8Array:()=>Sf,base64urlToUint8Array:()=>T$,cached:()=>Mr,captureStackTrace:()=>si,cleanEnum:()=>P$,cleanRegex:()=>On,clone:()=>Ne,cloneDef:()=>$$,createTransparentProxy:()=>z$,defineLazy:()=>V,esc:()=>ai,escapeRegex:()=>Xe,extend:()=>bf,finalizeIssue:()=>Ce,floatSafeRemainder:()=>Ps,getElementAtPath:()=>b$,getEnumValues:()=>En,getLengthableOrigin:()=>Zn,getParsedType:()=>S$,getSizableOrigin:()=>Dn,hexToUint8Array:()=>E$,isObject:()=>ur,isPlainObject:()=>Kt,issue:()=>qr,joinValues:()=>D,jsonStringifyReplacer:()=>Cr,merge:()=>I$,mergeDefs:()=>jt,normalizeParams:()=>k,nullish:()=>Ft,numKeys:()=>w$,objectClone:()=>y$,omit:()=>$f,optionalKeys:()=>Ns,parsedType:()=>U,partial:()=>kf,pick:()=>yf,prefixIssues:()=>Ke,primitiveTypes:()=>Os,promiseAllObject:()=>x$,propertyKeyTypes:()=>Nn,randomString:()=>k$,required:()=>wf,safeExtend:()=>xf,shallowClone:()=>Es,slugify:()=>Ts,stringifyPrimitive:()=>Z,uint8ArrayToBase64:()=>zf,uint8ArrayToBase64url:()=>j$,uint8ArrayToHex:()=>O$,unwrapMessage:()=>jn});function m$(e){return e}function h$(e){return e}function g$(e){}function v$(e){throw new Error("Unexpected value in exhaustive check")}function _$(e){}function En(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function D(e,t="|"){return e.map(r=>Z(r)).join(t)}function Cr(e,t){return typeof t=="bigint"?t.toString():t}function Mr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ft(e){return e==null}function On(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ps(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var _f=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==_f)return n===void 0&&(n=_f,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function y$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Jt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function $$(e){return jt(e._zod.def)}function b$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function x$(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function k$(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function ai(e){return JSON.stringify(e)}function Ts(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var si="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var js=Mr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Kt(e){if(ur(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ur(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Es(e){return Kt(e)?{...e}:Array.isArray(e)?[...e]:e}function w$(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var S$=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Nn=new Set(["string","number","symbol"]),Os=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ne(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function k(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function z$(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Z(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ns(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ds={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]},Zs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function yf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=jt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Jt(this,"shape",a),a},checks:[]});return Ne(e,i)}function $f(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=jt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Jt(this,"shape",a),a},checks:[]});return Ne(e,i)}function bf(e,t){if(!Kt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=jt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Jt(this,"shape",i),i}});return Ne(e,o)}function xf(e,t){if(!Kt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=jt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Jt(this,"shape",n),n}});return Ne(e,r)}function I$(e,t){let r=jt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Jt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ne(e,r)}function kf(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=jt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Jt(this,"shape",c),c},checks:[]});return Ne(t,a)}function wf(e,t,r){let n=jt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Jt(this,"shape",i),i}});return Ne(t,n)}function Gt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ke(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function jn(e){return typeof e=="string"?e:e?.message}function Ce(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=jn(e.inst?._zod.def?.error?.(e))??jn(t?.error?.(e))??jn(r.customError?.(e))??jn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Dn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Zn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function U(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function qr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function P$(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Sf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function zf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function T$(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Sf(t+r)}function j$(e){return zf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function E$(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function O$(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Is=class{constructor(...t){}};var If=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Cr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ci=p("$ZodError",If),Rn=p("$ZodError",If,{Parent:Error});function ui(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function li(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Un=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new _t;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ce(c,i,ye())));throw si(s,o?.callee),s}return a.value},An=Un(Rn),Cn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ce(c,i,ye())));throw si(s,o?.callee),s}return a.value},Mn=Cn(Rn),qn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new _t;return i.issues.length?{success:!1,error:new(e??ci)(i.issues.map(a=>Ce(a,o,ye())))}:{success:!0,data:i.value}},Lr=qn(Rn),Ln=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>Ce(a,o,ye())))}:{success:!0,data:i.value}},Vn=Ln(Rn),Pf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Un(e)(t,r,o)};var Tf=e=>(t,r,n)=>Un(e)(t,r,n);var jf=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Cn(e)(t,r,o)};var Ef=e=>async(t,r,n)=>Cn(e)(t,r,n);var Of=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qn(e)(t,r,o)};var Nf=e=>(t,r,n)=>qn(e)(t,r,n);var Df=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ln(e)(t,r,o)};var Zf=e=>async(t,r,n)=>Ln(e)(t,r,n);var Ye={};vn(Ye,{base64:()=>Xs,base64url:()=>di,bigint:()=>nc,boolean:()=>ic,browserEmail:()=>q$,cidrv4:()=>Hs,cidrv6:()=>Ws,cuid:()=>Rs,cuid2:()=>Us,date:()=>Qs,datetime:()=>tc,domain:()=>F$,duration:()=>Ls,e164:()=>Ys,email:()=>Fs,emoji:()=>Js,extendedDuration:()=>D$,guid:()=>Vs,hex:()=>J$,hostname:()=>V$,html5Email:()=>A$,idnEmail:()=>M$,integer:()=>oc,ipv4:()=>Ks,ipv6:()=>Gs,ksuid:()=>Ms,lowercase:()=>cc,mac:()=>Bs,md5_base64:()=>G$,md5_base64url:()=>B$,md5_hex:()=>K$,nanoid:()=>qs,null:()=>ac,number:()=>pi,rfc5322Email:()=>C$,sha1_base64:()=>W$,sha1_base64url:()=>X$,sha1_hex:()=>H$,sha256_base64:()=>Q$,sha256_base64url:()=>eb,sha256_hex:()=>Y$,sha384_base64:()=>rb,sha384_base64url:()=>nb,sha384_hex:()=>tb,sha512_base64:()=>ib,sha512_base64url:()=>ab,sha512_hex:()=>ob,string:()=>rc,time:()=>ec,ulid:()=>As,undefined:()=>sc,unicodeEmail:()=>Rf,uppercase:()=>uc,uuid:()=>lr,uuid4:()=>Z$,uuid6:()=>R$,uuid7:()=>U$,xid:()=>Cs});var Rs=/^[cC][^\s-]{8,}$/,Us=/^[0-9a-z]+$/,As=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cs=/^[0-9a-vA-V]{20}$/,Ms=/^[A-Za-z0-9]{27}$/,qs=/^[a-zA-Z0-9_-]{21}$/,Ls=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,D$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Z$=lr(4),R$=lr(6),U$=lr(7),Fs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,A$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,C$=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Rf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,M$=Rf,q$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,L$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Js(){return new RegExp(L$,"u")}var Ks=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Bs=e=>{let t=Xe(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Hs=/^((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])$/,Ws=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,di=/^[A-Za-z0-9_-]*$/,V$=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,F$=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ys=/^\+[1-9]\d{6,14}$/,Uf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Qs=new RegExp(`^${Uf}$`);function Af(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ec(e){return new RegExp(`^${Af(e)}$`)}function tc(e){let t=Af({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Uf}T(?:${n})$`)}var rc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},nc=/^-?\d+n?$/,oc=/^-?\d+$/,pi=/^-?\d+(?:\.\d+)?$/,ic=/^(?:true|false)$/i,ac=/^null$/i;var sc=/^undefined$/i;var cc=/^[^A-Z]*$/,uc=/^[^a-z]*$/,J$=/^[0-9a-fA-F]*$/;function Fn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Jn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var K$=/^[0-9a-fA-F]{32}$/,G$=Fn(22,"=="),B$=Jn(22),H$=/^[0-9a-fA-F]{40}$/,W$=Fn(27,"="),X$=Jn(27),Y$=/^[0-9a-fA-F]{64}$/,Q$=Fn(43,"="),eb=Jn(43),tb=/^[0-9a-fA-F]{96}$/,rb=Fn(64,""),nb=Jn(64),ob=/^[0-9a-fA-F]{128}$/,ib=Fn(86,"=="),ab=Jn(86);var ce=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Mf={number:"number",bigint:"bigint",object:"date"},lc=p("$ZodCheckLessThan",(e,t)=>{ce.init(e,t);let r=Mf[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dc=p("$ZodCheckGreaterThan",(e,t)=>{ce.init(e,t);let r=Mf[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qf=p("$ZodCheckMultipleOf",(e,t)=>{ce.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ps(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Lf=p("$ZodCheckNumberFormat",(e,t)=>{ce.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ds[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=oc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Vf=p("$ZodCheckBigIntFormat",(e,t)=>{ce.init(e,t);let[r,n]=Zs[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Ff=p("$ZodCheckMaxSize",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Dn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Jf=p("$ZodCheckMinSize",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Dn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Kf=p("$ZodCheckSizeEquals",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Dn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Gf=p("$ZodCheckMaxLength",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=Zn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Bf=p("$ZodCheckMinLength",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Zn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hf=p("$ZodCheckLengthEquals",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Zn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Kn=p("$ZodCheckStringFormat",(e,t)=>{var r,n;ce.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Wf=p("$ZodCheckRegex",(e,t)=>{Kn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xf=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=cc),Kn.init(e,t)}),Yf=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=uc),Kn.init(e,t)}),Qf=p("$ZodCheckIncludes",(e,t)=>{ce.init(e,t);let r=Xe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),em=p("$ZodCheckStartsWith",(e,t)=>{ce.init(e,t);let r=new RegExp(`^${Xe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tm=p("$ZodCheckEndsWith",(e,t)=>{ce.init(e,t);let r=new RegExp(`.*${Xe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Cf(e,t,r){e.issues.length&&t.issues.push(...Ke(r,e.issues))}var rm=p("$ZodCheckProperty",(e,t)=>{ce.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Cf(o,r,t.property));Cf(n,r,t.property)}}),nm=p("$ZodCheckMimeType",(e,t)=>{ce.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),om=p("$ZodCheckOverwrite",(e,t)=>{ce.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var fi=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
9
+ deps: ${r}}`};var VI={keyword:"dependencies",type:"object",schemaType:"object",error:kt.error,code(e){let[t,r]=FI(e);z_(e,t),I_(e,r)}};function FI({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function z_(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,ei.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,ei.checkReportMissingProp)(e,u)}):(r.if((0,jp._)`${c} && (${(0,ei.checkMissingProp)(e,s,i)})`),(0,ei.reportMissingProp)(e,i),r.else())}}kt.validatePropertyDeps=z_;function I_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,LI.alwaysValidSchema)(i,t[s])||(r.if((0,ei.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}kt.validateSchemaDeps=I_;kt.default=VI});var j_=w(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});var T_=G(),JI=ne(),KI={message:"property name must be valid",params:({params:e})=>(0,T_._)`{propertyName: ${e.propertyName}}`},GI={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:KI,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,JI.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,T_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};Ep.default=GI});var Np=w(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var Qa=rt(),ft=G(),BI=At(),es=ne(),HI={message:"must NOT have additional properties",params:({params:e})=>(0,ft._)`{additionalProperty: ${e.additionalProperty}}`},WI={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:HI,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,es.alwaysValidSchema)(a,r))return;let u=(0,Qa.allSchemaProperties)(n.properties),l=(0,Qa.allSchemaProperties)(n.patternProperties);d(),e.ok((0,ft._)`${i} === ${BI.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?h(y):t.if(m(y),()=>h(y))})}function m(y){let b;if(u.length>8){let P=(0,es.schemaRefOrVal)(a,n.properties,"properties");b=(0,Qa.isOwnProperty)(t,P,y)}else u.length?b=(0,ft.or)(...u.map(P=>(0,ft._)`${y} === ${P}`)):b=ft.nil;return l.length&&(b=(0,ft.or)(b,...l.map(P=>(0,ft._)`${(0,Qa.usePattern)(e,P)}.test(${y})`))),(0,ft.not)(b)}function f(y){t.code((0,ft._)`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,es.alwaysValidSchema)(a,r)){let b=t.name("valid");c.removeAdditional==="failing"?(g(y,b,!1),t.if((0,ft.not)(b),()=>{e.reset(),f(y)})):(g(y,b),s||t.if((0,ft.not)(b),()=>t.break()))}}function g(y,b,P){let I={keyword:"additionalProperties",dataProp:y,dataPropType:es.Type.Str};P===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(I,b)}}};Op.default=WI});var N_=w(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var XI=Mo(),E_=rt(),Dp=ne(),O_=Np(),YI={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&O_.default.code(new XI.KeywordCxt(i,O_.default,"additionalProperties"));let a=(0,E_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Dp.mergeEvaluated.props(t,(0,Dp.toHash)(a),i.props));let s=a.filter(d=>!(0,Dp.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,E_.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Zp.default=YI});var U_=w(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var D_=rt(),ts=G(),Z_=ne(),R_=ne(),QI={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,D_.allSchemaProperties)(r),c=s.filter(g=>(0,Z_.alwaysValidSchema)(i,r[g]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof ts.Name)&&(i.props=(0,R_.evaluatedPropsToName)(t,i.props));let{props:d}=i;m();function m(){for(let g of s)u&&f(g),i.allErrors?h(g):(t.var(l,!0),h(g),t.if(l))}function f(g){for(let y in u)new RegExp(g).test(y)&&(0,Z_.checkStrictMode)(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",n,y=>{t.if((0,ts._)`${(0,D_.usePattern)(e,g)}.test(${y})`,()=>{let b=c.includes(g);b||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:R_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,ts._)`${d}[${y}]`,!0):!b&&!i.allErrors&&t.if((0,ts.not)(l),()=>t.break())})})}}};Rp.default=QI});var A_=w(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var eP=ne(),tP={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,eP.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Up.default=tP});var C_=w(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var rP=rt(),nP={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:rP.validateUnion,error:{message:"must match a schema in anyOf"}};Ap.default=nP});var M_=w(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var rs=G(),oP=ne(),iP={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,rs._)`{passingSchemas: ${e.passing}}`},aP={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:iP,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let m;(0,oP.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,rs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,rs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),m&&e.mergeEvaluated(m,rs.Name)})})}}};Cp.default=aP});var q_=w(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var sP=ne(),cP={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,sP.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};Mp.default=cP});var F_=w(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var ns=G(),V_=ne(),uP={message:({params:e})=>(0,ns.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ns._)`{failingKeyword: ${e.ifClause}}`},lP={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:uP,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,V_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=L_(n,"then"),i=L_(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,ns.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(m,a),d?t.assign(d,(0,ns._)`${l}`):e.setParams({ifClause:l})}}}};function L_(e,t){let r=e.schema[t];return r!==void 0&&!(0,V_.alwaysValidSchema)(e,r)}qp.default=lP});var J_=w(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var dP=ne(),pP={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,dP.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Lp.default=pP});var K_=w(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var fP=Sp(),mP=x_(),hP=zp(),gP=w_(),vP=S_(),_P=P_(),yP=j_(),$P=Np(),bP=N_(),xP=U_(),kP=A_(),wP=C_(),SP=M_(),zP=q_(),IP=F_(),PP=J_();function TP(e=!1){let t=[kP.default,wP.default,SP.default,zP.default,IP.default,PP.default,yP.default,$P.default,_P.default,bP.default,xP.default];return e?t.push(mP.default,gP.default):t.push(fP.default,hP.default),t.push(vP.default),t}Vp.default=TP});var G_=w(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var ve=G(),jP={message:({schemaCode:e})=>(0,ve.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ve._)`{format: ${e}}`},EP={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:jP,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?m():f();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,ve._)`${h}[${a}]`),y=r.let("fType"),b=r.let("format");r.if((0,ve._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,ve._)`${g}.type || "string"`).assign(b,(0,ve._)`${g}.validate`),()=>r.assign(y,(0,ve._)`"string"`).assign(b,g)),e.fail$data((0,ve.or)(P(),I()));function P(){return c.strictSchema===!1?ve.nil:(0,ve._)`${a} && !${b}`}function I(){let A=l.$async?(0,ve._)`(${g}.async ? await ${b}(${n}) : ${b}(${n}))`:(0,ve._)`${b}(${n})`,O=(0,ve._)`(typeof ${b} == "function" ? ${A} : ${b}.test(${n}))`;return(0,ve._)`${b} && ${b} !== true && ${y} === ${t} && !${O}`}}function f(){let h=d.formats[i];if(!h){P();return}if(h===!0)return;let[g,y,b]=I(h);g===t&&e.pass(A());function P(){if(c.strictSchema===!1){d.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function I(O){let it=O instanceof RegExp?(0,ve.regexpCode)(O):c.code.formats?(0,ve._)`${c.code.formats}${(0,ve.getProperty)(i)}`:void 0,at=r.scopeValue("formats",{key:i,ref:O,code:it});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,ve._)`${at}.validate`]:["string",O,at]}function A(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ve._)`await ${b}(${n})`}return typeof y=="function"?(0,ve._)`${b}(${n})`:(0,ve._)`${b}.test(${n})`}}}};Fp.default=EP});var B_=w(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var OP=G_(),NP=[OP.default];Jp.default=NP});var H_=w(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.contentVocabulary=un.metadataVocabulary=void 0;un.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];un.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var X_=w(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var DP=o_(),ZP=__(),RP=K_(),UP=B_(),W_=H_(),AP=[DP.default,ZP.default,(0,RP.default)(),UP.default,W_.metadataVocabulary,W_.contentVocabulary];Kp.default=AP});var Q_=w(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.DiscrError=void 0;var Y_;(function(e){e.Tag="tag",e.Mapping="mapping"})(Y_||(os.DiscrError=Y_={}))});var ty=w(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var ln=G(),Gp=Q_(),ey=Ca(),CP=qo(),MP=ne(),qP={message:({params:{discrError:e,tagName:t}})=>e===Gp.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,ln._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},LP={keyword:"discriminator",type:"object",schemaType:"object",error:qP,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,ln._)`${r}${(0,ln.getProperty)(s)}`);t.if((0,ln._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:Gp.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let f=m();t.if(!1);for(let h in f)t.elseIf((0,ln._)`${u} === ${h}`),t.assign(c,d(f[h]));t.else(),e.error(!1,{discrError:Gp.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(f){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(g,ln.Name),h}function m(){var f;let h={},g=b(o),y=!0;for(let A=0;A<a.length;A++){let O=a[A];if(O?.$ref&&!(0,MP.schemaHasRulesButRef)(O,i.self.RULES)){let at=O.$ref;if(O=ey.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,at),O instanceof ey.SchemaEnv&&(O=O.schema),O===void 0)throw new CP.default(i.opts.uriResolver,i.baseId,at)}let it=(f=O?.properties)===null||f===void 0?void 0:f[s];if(typeof it!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(g||b(O)),P(it,A)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function b({required:A}){return Array.isArray(A)&&A.includes(s)}function P(A,O){if(A.const)I(A.const,O);else if(A.enum)for(let it of A.enum)I(it,O);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function I(A,O){if(typeof A!="string"||A in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[A]=O}}}};Bp.default=LP});var ry=w((l6,VP)=>{VP.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 Wp=w((ge,Hp)=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.MissingRefError=ge.ValidationError=ge.CodeGen=ge.Name=ge.nil=ge.stringify=ge.str=ge._=ge.KeywordCxt=ge.Ajv=void 0;var FP=Yv(),JP=X_(),KP=ty(),ny=ry(),GP=["/properties"],is="http://json-schema.org/draft-07/schema",dn=class extends FP.default{_addVocabularies(){super._addVocabularies(),JP.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(KP.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(ny,GP):ny;this.addMetaSchema(t,is,!1),this.refs["http://json-schema.org/schema"]=is}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(is)?is:void 0)}};ge.Ajv=dn;Hp.exports=ge=dn;Hp.exports.Ajv=dn;Object.defineProperty(ge,"__esModule",{value:!0});ge.default=dn;var BP=Mo();Object.defineProperty(ge,"KeywordCxt",{enumerable:!0,get:function(){return BP.KeywordCxt}});var pn=G();Object.defineProperty(ge,"_",{enumerable:!0,get:function(){return pn._}});Object.defineProperty(ge,"str",{enumerable:!0,get:function(){return pn.str}});Object.defineProperty(ge,"stringify",{enumerable:!0,get:function(){return pn.stringify}});Object.defineProperty(ge,"nil",{enumerable:!0,get:function(){return pn.nil}});Object.defineProperty(ge,"Name",{enumerable:!0,get:function(){return pn.Name}});Object.defineProperty(ge,"CodeGen",{enumerable:!0,get:function(){return pn.CodeGen}});var HP=Ua();Object.defineProperty(ge,"ValidationError",{enumerable:!0,get:function(){return HP.default}});var WP=qo();Object.defineProperty(ge,"MissingRefError",{enumerable:!0,get:function(){return WP.default}})});var dy=w(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.formatNames=St.fastFormats=St.fullFormats=void 0;function wt(e,t){return{validate:e,compare:t}}St.fullFormats={date:wt(sy,ef),time:wt(Yp(!0),tf),"date-time":wt(oy(!0),uy),"iso-time":wt(Yp(),cy),"iso-date-time":wt(oy(),ly),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:rT,"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:uT,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:nT,int32:{type:"number",validate:aT},int64:{type:"number",validate:sT},float:{type:"number",validate:ay},double:{type:"number",validate:ay},password:!0,binary:!0};St.fastFormats={...St.fullFormats,date:wt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ef),time:wt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,tf),"date-time":wt(/^\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,uy),"iso-time":wt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,cy),"iso-date-time":wt(/^\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,ly),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};St.formatNames=Object.keys(St.fullFormats);function XP(e){return e%4===0&&(e%100!==0||e%400===0)}var YP=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,QP=[0,31,28,31,30,31,30,31,31,30,31,30,31];function sy(e){let t=YP.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&XP(r)?29:QP[n])}function ef(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Xp=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Yp(e){return function(r){let n=Xp.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&a<61}}function tf(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function cy(e,t){if(!(e&&t))return;let r=Xp.exec(e),n=Xp.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var Qp=/t|\s/i;function oy(e){let t=Yp(e);return function(n){let o=n.split(Qp);return o.length===2&&sy(o[0])&&t(o[1])}}function uy(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function ly(e,t){if(!(e&&t))return;let[r,n]=e.split(Qp),[o,i]=t.split(Qp),a=ef(r,o);if(a!==void 0)return a||tf(n,i)}var eT=/\/|:/,tT=/^(?:[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 rT(e){return eT.test(e)&&tT.test(e)}var iy=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function nT(e){return iy.lastIndex=0,iy.test(e)}var oT=-(2**31),iT=2**31-1;function aT(e){return Number.isInteger(e)&&e<=iT&&e>=oT}function sT(e){return Number.isInteger(e)}function ay(){return!0}var cT=/[^\\]\\Z/;function uT(e){if(cT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var py=w(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.formatLimitDefinition=void 0;var lT=Wp(),mt=G(),ir=mt.operators,as={formatMaximum:{okStr:"<=",ok:ir.LTE,fail:ir.GT},formatMinimum:{okStr:">=",ok:ir.GTE,fail:ir.LT},formatExclusiveMaximum:{okStr:"<",ok:ir.LT,fail:ir.GTE},formatExclusiveMinimum:{okStr:">",ok:ir.GT,fail:ir.LTE}},dT={message:({keyword:e,schemaCode:t})=>(0,mt.str)`should be ${as[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,mt._)`{comparison: ${as[e].okStr}, limit: ${t}}`};fn.formatLimitDefinition={keyword:Object.keys(as),type:"string",schemaType:"string",$data:!0,error:dT,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new lT.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=t.const("fmt",(0,mt._)`${m}[${c.schemaCode}]`);e.fail$data((0,mt.or)((0,mt._)`typeof ${f} != "object"`,(0,mt._)`${f} instanceof RegExp`,(0,mt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=c.schema,f=s.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let h=t.scopeValue("formats",{key:m,ref:f,code:a.code.formats?(0,mt._)`${a.code.formats}${(0,mt.getProperty)(m)}`:void 0});e.fail$data(d(h))}function d(m){return(0,mt._)`${m}.compare(${r}, ${n}) ${as[o].fail} 0`}},dependencies:["format"]};var pT=e=>(e.addKeyword(fn.formatLimitDefinition),e);fn.default=pT});var gy=w((ti,hy)=>{"use strict";Object.defineProperty(ti,"__esModule",{value:!0});var mn=dy(),fT=py(),rf=G(),fy=new rf.Name("fullFormats"),mT=new rf.Name("fastFormats"),nf=(e,t={keywords:!0})=>{if(Array.isArray(t))return my(e,t,mn.fullFormats,fy),e;let[r,n]=t.mode==="fast"?[mn.fastFormats,mT]:[mn.fullFormats,fy],o=t.formats||mn.formatNames;return my(e,o,r,n),t.keywords&&(0,fT.default)(e),e};nf.get=(e,t="full")=>{let n=(t==="fast"?mn.fastFormats:mn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function my(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,rf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}hy.exports=ti=nf;Object.defineProperty(ti,"__esModule",{value:!0});ti.default=nf});var Y;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Y||(Y={}));var pf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(pf||(pf={}));var S=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zt=e=>{switch(typeof e){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(e)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(e)?S.array:e===null?S.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?S.promise:typeof Map<"u"&&e instanceof Map?S.map:typeof Set<"u"&&e instanceof Set?S.set:typeof Date<"u"&&e instanceof Date?S.date:S.object;default:return S.unknown}};var _=Y.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 Fe=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Fe.create=e=>new Fe(e);var qy=(e,t)=>{let r;switch(e.code){case _.invalid_type:e.received===S.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Y.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${Y.joinValues(e.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Y.joinValues(e.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${Y.joinValues(e.options)}, received '${e.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Y.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case _.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case _.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;default:r=t.defaultError,Y.assertNever(e)}return{message:r}},qt=qy;var Ly=qt;function _n(){return Ly}var ri=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function x(e,t){let r=_n(),n=ri({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===qt?void 0:qt].filter(o=>!!o)});e.common.issues.push(n)}var ze=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return R;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return R;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},R=Object.freeze({status:"aborted"}),Sr=e=>({status:"dirty",value:e}),Oe=e=>({status:"valid",value:e}),_s=e=>e.status==="aborted",ys=e=>e.status==="dirty",ar=e=>e.status==="valid",yn=e=>typeof Promise<"u"&&e instanceof Promise;var T;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(T||(T={}));var We=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ff=(e,t)=>{if(ar(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Fe(e.common.issues);return this._error=r,this._error}}};function L(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var B=class{get description(){return this._def.description}_getType(t){return zt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new ze,ctx:{common:t.parent.common,data:t.data,parsedType:zt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(yn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return ff(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return ar(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>ar(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:zt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(yn(o)?o:Promise.resolve(o));return ff(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:_.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new ct({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return st.create(this,this._def)}nullable(){return Tt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vt.create(this)}promise(){return sr.create(this,this._def)}or(t){return jr.create([this,t],this._def)}and(t){return Er.create(this,t,this._def)}transform(t){return new ct({...L(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Rr({...L(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new ni({typeName:N.ZodBranded,type:this,...L(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Ur({...L(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return oi.create(this,t)}readonly(){return Ar.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Vy=/^c[^\s-]{8,}$/i,Fy=/^[0-9a-z]+$/,Jy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ky=/^[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,Gy=/^[a-z0-9_-]{21}$/i,By=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hy=/^[-+]?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)?)??$/,Wy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$s,Yy=/^(?:(?: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])$/,Qy=/^(?:(?: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])$/,e$=/^(([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]))$/,t$=/^(([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])$/,r$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,n$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mf="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",o$=new RegExp(`^${mf}$`);function hf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function i$(e){return new RegExp(`^${hf(e)}$`)}function a$(e){let t=`${mf}T${hf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function s$(e,t){return!!((t==="v4"||!t)&&Yy.test(e)||(t==="v6"||!t)&&e$.test(e))}function c$(e,t){if(!By.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function u$(e,t){return!!((t==="v4"||!t)&&Qy.test(e)||(t==="v6"||!t)&&t$.test(e))}var Ir=class e extends B{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==S.string){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_type,expected:S.string,received:i.parsedType}),R}let n=new ze,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?x(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&x(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Wy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"email",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")$s||($s=new RegExp(Xy,"u")),$s.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"emoji",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ky.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"uuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Gy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"nanoid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Vy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"cuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Fy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"cuid2",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Jy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"ulid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),x(o,{validation:"url",code:_.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"regex",code:_.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?a$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?o$.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?i$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{code:_.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Hy.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"duration",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?s$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"ip",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?c$(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"jwt",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?u$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"cidr",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?r$.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"base64",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?n$.test(t.data)||(o=this._getOrReturnCtx(t,o),x(o,{validation:"base64url",code:_.invalid_string,message:i.message}),n.dirty()):Y.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:_.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...T.errToObj(t)})}url(t){return this._addCheck({kind:"url",...T.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...T.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...T.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...T.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...T.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...T.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...T.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...T.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...T.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...T.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...T.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...T.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...T.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...T.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...T.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...T.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...T.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...T.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...T.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...T.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...T.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...T.errToObj(r)})}nonempty(t){return this.min(1,T.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ir.create=e=>new Ir({checks:[],typeName:N.ZodString,coerce:e?.coerce??!1,...L(e)});function l$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var $n=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==S.number){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_type,expected:S.number,received:i.parsedType}),R}let n,o=new ze;for(let i of this._def.checks)i.kind==="int"?Y.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:_.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?l$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),x(n,{code:_.not_finite,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:T.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:T.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Y.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};$n.create=e=>new $n({checks:[],typeName:N.ZodNumber,coerce:e?.coerce||!1,...L(e)});var bn=class e extends B{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==S.bigint)return this._getInvalidInput(t);let n,o=new ze;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),x(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return x(r,{code:_.invalid_type,expected:S.bigint,received:r.parsedType}),R}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};bn.create=e=>new bn({checks:[],typeName:N.ZodBigInt,coerce:e?.coerce??!1,...L(e)});var xn=class extends B{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==S.boolean){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.boolean,received:n.parsedType}),R}return Oe(t.data)}};xn.create=e=>new xn({typeName:N.ZodBoolean,coerce:e?.coerce||!1,...L(e)});var kn=class e extends B{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==S.date){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_type,expected:S.date,received:i.parsedType}),R}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return x(i,{code:_.invalid_date}),R}let n=new ze,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),x(o,{code:_.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Y.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:T.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:T.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};kn.create=e=>new kn({checks:[],coerce:e?.coerce||!1,typeName:N.ZodDate,...L(e)});var wn=class extends B{_parse(t){if(this._getType(t)!==S.symbol){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.symbol,received:n.parsedType}),R}return Oe(t.data)}};wn.create=e=>new wn({typeName:N.ZodSymbol,...L(e)});var Pr=class extends B{_parse(t){if(this._getType(t)!==S.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.undefined,received:n.parsedType}),R}return Oe(t.data)}};Pr.create=e=>new Pr({typeName:N.ZodUndefined,...L(e)});var Tr=class extends B{_parse(t){if(this._getType(t)!==S.null){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.null,received:n.parsedType}),R}return Oe(t.data)}};Tr.create=e=>new Tr({typeName:N.ZodNull,...L(e)});var Sn=class extends B{constructor(){super(...arguments),this._any=!0}_parse(t){return Oe(t.data)}};Sn.create=e=>new Sn({typeName:N.ZodAny,...L(e)});var Lt=class extends B{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Oe(t.data)}};Lt.create=e=>new Lt({typeName:N.ZodUnknown,...L(e)});var vt=class extends B{_parse(t){let r=this._getOrReturnCtx(t);return x(r,{code:_.invalid_type,expected:S.never,received:r.parsedType}),R}};vt.create=e=>new vt({typeName:N.ZodNever,...L(e)});var zn=class extends B{_parse(t){if(this._getType(t)!==S.undefined){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.void,received:n.parsedType}),R}return Oe(t.data)}};zn.create=e=>new zn({typeName:N.ZodVoid,...L(e)});var Vt=class e extends B{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==S.array)return x(r,{code:_.invalid_type,expected:S.array,received:r.parsedType}),R;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(x(r,{code:a?_.too_big:_.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(x(r,{code:_.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(x(r,{code:_.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new We(r,a,r.path,s)))).then(a=>ze.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new We(r,a,r.path,s)));return ze.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:T.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:T.toString(r)}})}nonempty(t){return this.min(1,t)}};Vt.create=(e,t)=>new Vt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...L(t)});function zr(e){if(e instanceof Je){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=st.create(zr(n))}return new Je({...e._def,shape:()=>t})}else return e instanceof Vt?new Vt({...e._def,type:zr(e.element)}):e instanceof st?st.create(zr(e.unwrap())):e instanceof Tt?Tt.create(zr(e.unwrap())):e instanceof Pt?Pt.create(e.items.map(t=>zr(t))):e}var Je=class e extends B{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Y.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==S.object){let u=this._getOrReturnCtx(t);return x(u,{code:_.invalid_type,expected:S.object,received:u.parsedType}),R}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof vt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new We(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof vt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(x(o,{code:_.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new We(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,m=await l.value;u.push({key:d,value:m,alwaysSet:l.alwaysSet})}return u}).then(u=>ze.mergeObjectSync(n,u)):ze.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return T.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:N.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Y.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Y.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return zr(this)}partial(t){let r={};for(let n of Y.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Y.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof st;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return gf(Y.objectKeys(this.shape))}};Je.create=(e,t)=>new Je({shape:()=>e,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...L(t)});Je.strictCreate=(e,t)=>new Je({shape:()=>e,unknownKeys:"strict",catchall:vt.create(),typeName:N.ZodObject,...L(t)});Je.lazycreate=(e,t)=>new Je({shape:e,unknownKeys:"strip",catchall:vt.create(),typeName:N.ZodObject,...L(t)});var jr=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Fe(s.ctx.common.issues));return x(r,{code:_.invalid_union,unionErrors:a}),R}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Fe(c));return x(r,{code:_.invalid_union,unionErrors:s}),R}}get options(){return this._def.options}};jr.create=(e,t)=>new jr({options:e,typeName:N.ZodUnion,...L(t)});var It=e=>e instanceof Or?It(e.schema):e instanceof ct?It(e.innerType()):e instanceof Nr?[e.value]:e instanceof Dr?e.options:e instanceof Zr?Y.objectValues(e.enum):e instanceof Rr?It(e._def.innerType):e instanceof Pr?[void 0]:e instanceof Tr?[null]:e instanceof st?[void 0,...It(e.unwrap())]:e instanceof Tt?[null,...It(e.unwrap())]:e instanceof ni||e instanceof Ar?It(e.unwrap()):e instanceof Ur?It(e._def.innerType):[],bs=class e extends B{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.object)return x(r,{code:_.invalid_type,expected:S.object,received:r.parsedType}),R;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(x(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let a=It(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:N.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...L(n)})}};function xs(e,t){let r=zt(e),n=zt(t);if(e===t)return{valid:!0,data:e};if(r===S.object&&n===S.object){let o=Y.objectKeys(t),i=Y.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=xs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===S.array&&n===S.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=xs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===S.date&&n===S.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Er=class extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(_s(i)||_s(a))return R;let s=xs(i.value,a.value);return s.valid?((ys(i)||ys(a))&&r.dirty(),{status:r.value,value:s.data}):(x(n,{code:_.invalid_intersection_types}),R)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Er.create=(e,t,r)=>new Er({left:e,right:t,typeName:N.ZodIntersection,...L(r)});var Pt=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.array)return x(n,{code:_.invalid_type,expected:S.array,received:n.parsedType}),R;if(n.data.length<this._def.items.length)return x(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new We(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>ze.mergeArray(r,a)):ze.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Pt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pt({items:e,typeName:N.ZodTuple,rest:null,...L(t)})};var ks=class e extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.object)return x(n,{code:_.invalid_type,expected:S.object,received:n.parsedType}),R;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new We(n,s,n.path,s)),value:a._parse(new We(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?ze.mergeObjectAsync(r,o):ze.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof B?new e({keyType:t,valueType:r,typeName:N.ZodRecord,...L(n)}):new e({keyType:Ir.create(),valueType:t,typeName:N.ZodRecord,...L(r)})}},In=class extends B{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.map)return x(n,{code:_.invalid_type,expected:S.map,received:n.parsedType}),R;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new We(n,s,n.path,[u,"key"])),value:i._parse(new We(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return R;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return R;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};In.create=(e,t,r)=>new In({valueType:t,keyType:e,typeName:N.ZodMap,...L(r)});var Pn=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.set)return x(n,{code:_.invalid_type,expected:S.set,received:n.parsedType}),R;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(x(n,{code:_.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(x(n,{code:_.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return R;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new We(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:T.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Pn.create=(e,t)=>new Pn({valueType:e,minSize:null,maxSize:null,typeName:N.ZodSet,...L(t)});var ws=class e extends B{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.function)return x(r,{code:_.invalid_type,expected:S.function,received:r.parsedType}),R;function n(s,c){return ri({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_n(),qt].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:c}})}function o(s,c){return ri({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,_n(),qt].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof sr){let s=this;return Oe(async function(...c){let u=new Fe([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Oe(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Fe([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Fe([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Pt.create(t).rest(Lt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Pt.create([]).rest(Lt.create()),returns:r||Lt.create(),typeName:N.ZodFunction,...L(n)})}},Or=class extends B{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Or.create=(e,t)=>new Or({getter:e,typeName:N.ZodLazy,...L(t)});var Nr=class extends B{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return x(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:t.data}}get value(){return this._def.value}};Nr.create=(e,t)=>new Nr({value:e,typeName:N.ZodLiteral,...L(t)});function gf(e,t){return new Dr({values:e,typeName:N.ZodEnum,...L(t)})}var Dr=class e extends B{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{expected:Y.joinValues(n),received:r.parsedType,code:_.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return x(r,{received:r.data,code:_.invalid_enum_value,options:n}),R}return Oe(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Dr.create=gf;var Zr=class extends B{_parse(t){let r=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==S.string&&n.parsedType!==S.number){let o=Y.objectValues(r);return x(n,{expected:Y.joinValues(o),received:n.parsedType,code:_.invalid_type}),R}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Y.objectValues(r);return x(n,{received:n.data,code:_.invalid_enum_value,options:o}),R}return Oe(t.data)}get enum(){return this._def.values}};Zr.create=(e,t)=>new Zr({values:e,typeName:N.ZodNativeEnum,...L(t)});var sr=class extends B{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.promise&&r.common.async===!1)return x(r,{code:_.invalid_type,expected:S.promise,received:r.parsedType}),R;let n=r.parsedType===S.promise?r.data:Promise.resolve(r.data);return Oe(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};sr.create=(e,t)=>new sr({type:e,typeName:N.ZodPromise,...L(t)});var ct=class extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{x(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return R;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?R:c.status==="dirty"?Sr(c.value):r.value==="dirty"?Sr(c.value):c});{if(r.value==="aborted")return R;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?R:s.status==="dirty"?Sr(s.value):r.value==="dirty"?Sr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?R:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?R:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ar(a))return R;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>ar(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):R);Y.assertNever(o)}};ct.create=(e,t,r)=>new ct({schema:e,typeName:N.ZodEffects,effect:t,...L(r)});ct.createWithPreprocess=(e,t,r)=>new ct({schema:t,effect:{type:"preprocess",transform:e},typeName:N.ZodEffects,...L(r)});var st=class extends B{_parse(t){return this._getType(t)===S.undefined?Oe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};st.create=(e,t)=>new st({innerType:e,typeName:N.ZodOptional,...L(t)});var Tt=class extends B{_parse(t){return this._getType(t)===S.null?Oe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Tt.create=(e,t)=>new Tt({innerType:e,typeName:N.ZodNullable,...L(t)});var Rr=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===S.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Rr.create=(e,t)=>new Rr({innerType:e,typeName:N.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...L(t)});var Ur=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return yn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Fe(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Fe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ur.create=(e,t)=>new Ur({innerType:e,typeName:N.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...L(t)});var Tn=class extends B{_parse(t){if(this._getType(t)!==S.nan){let n=this._getOrReturnCtx(t);return x(n,{code:_.invalid_type,expected:S.nan,received:n.parsedType}),R}return{status:"valid",value:t.data}}};Tn.create=e=>new Tn({typeName:N.ZodNaN,...L(e)});var XT=Symbol("zod_brand"),ni=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},oi=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?R:i.status==="dirty"?(r.dirty(),Sr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?R:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:N.ZodPipeline})}},Ar=class extends B{_parse(t){let r=this._def.innerType._parse(t),n=o=>(ar(o)&&(o.value=Object.freeze(o.value)),o);return yn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Ar.create=(e,t)=>new Ar({innerType:e,typeName:N.ZodReadonly,...L(t)});var YT={object:Je.lazycreate},N;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(N||(N={}));var QT=Ir.create,ej=$n.create,tj=Tn.create,rj=bn.create,nj=xn.create,oj=kn.create,ij=wn.create,aj=Pr.create,sj=Tr.create,cj=Sn.create,uj=Lt.create,lj=vt.create,dj=zn.create,pj=Vt.create,d$=Je.create,fj=Je.strictCreate,mj=jr.create,hj=bs.create,gj=Er.create,vj=Pt.create,_j=ks.create,yj=In.create,$j=Pn.create,bj=ws.create,xj=Or.create,kj=Nr.create,wj=Dr.create,Sj=Zr.create,zj=sr.create,Ij=ct.create,Pj=st.create,Tj=Tt.create,jj=ct.createWithPreprocess,Ej=oi.create;var vf=Object.freeze({status:"aborted"});function p(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let m=l[d];m in s||(s[m]=u[m].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var Ss=Symbol("zod_brand"),_t=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},cr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ii={};function ye(e){return e&&Object.assign(ii,e),ii}var $={};vn($,{BIGINT_FORMAT_RANGES:()=>Zs,Class:()=>Is,NUMBER_FORMAT_RANGES:()=>Ds,aborted:()=>Gt,allowsEval:()=>js,assert:()=>_$,assertEqual:()=>m$,assertIs:()=>g$,assertNever:()=>v$,assertNotEqual:()=>h$,assignProp:()=>Jt,base64ToUint8Array:()=>Sf,base64urlToUint8Array:()=>T$,cached:()=>Mr,captureStackTrace:()=>si,cleanEnum:()=>P$,cleanRegex:()=>On,clone:()=>Ne,cloneDef:()=>$$,createTransparentProxy:()=>z$,defineLazy:()=>V,esc:()=>ai,escapeRegex:()=>Xe,extend:()=>bf,finalizeIssue:()=>Ce,floatSafeRemainder:()=>Ps,getElementAtPath:()=>b$,getEnumValues:()=>En,getLengthableOrigin:()=>Zn,getParsedType:()=>S$,getSizableOrigin:()=>Dn,hexToUint8Array:()=>E$,isObject:()=>ur,isPlainObject:()=>Kt,issue:()=>qr,joinValues:()=>D,jsonStringifyReplacer:()=>Cr,merge:()=>I$,mergeDefs:()=>jt,normalizeParams:()=>k,nullish:()=>Ft,numKeys:()=>w$,objectClone:()=>y$,omit:()=>$f,optionalKeys:()=>Ns,parsedType:()=>U,partial:()=>kf,pick:()=>yf,prefixIssues:()=>Ke,primitiveTypes:()=>Os,promiseAllObject:()=>x$,propertyKeyTypes:()=>Nn,randomString:()=>k$,required:()=>wf,safeExtend:()=>xf,shallowClone:()=>Es,slugify:()=>Ts,stringifyPrimitive:()=>Z,uint8ArrayToBase64:()=>zf,uint8ArrayToBase64url:()=>j$,uint8ArrayToHex:()=>O$,unwrapMessage:()=>jn});function m$(e){return e}function h$(e){return e}function g$(e){}function v$(e){throw new Error("Unexpected value in exhaustive check")}function _$(e){}function En(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function D(e,t="|"){return e.map(r=>Z(r)).join(t)}function Cr(e,t){return typeof t=="bigint"?t.toString():t}function Mr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Ft(e){return e==null}function On(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ps(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var _f=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==_f)return n===void 0&&(n=_f,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function y$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Jt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function $$(e){return jt(e._zod.def)}function b$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function x$(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function k$(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function ai(e){return JSON.stringify(e)}function Ts(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var si="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var js=Mr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Kt(e){if(ur(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ur(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Es(e){return Kt(e)?{...e}:Array.isArray(e)?[...e]:e}function w$(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var S$=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Nn=new Set(["string","number","symbol"]),Os=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ne(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function k(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function z$(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Z(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ns(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ds={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]},Zs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function yf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=jt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Jt(this,"shape",a),a},checks:[]});return Ne(e,i)}function $f(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=jt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Jt(this,"shape",a),a},checks:[]});return Ne(e,i)}function bf(e,t){if(!Kt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=jt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Jt(this,"shape",i),i}});return Ne(e,o)}function xf(e,t){if(!Kt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=jt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Jt(this,"shape",n),n}});return Ne(e,r)}function I$(e,t){let r=jt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Jt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ne(e,r)}function kf(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=jt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Jt(this,"shape",c),c},checks:[]});return Ne(t,a)}function wf(e,t,r){let n=jt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Jt(this,"shape",i),i}});return Ne(t,n)}function Gt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ke(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function jn(e){return typeof e=="string"?e:e?.message}function Ce(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=jn(e.inst?._zod.def?.error?.(e))??jn(t?.error?.(e))??jn(r.customError?.(e))??jn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Dn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Zn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function U(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function qr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function P$(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Sf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function zf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function T$(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Sf(t+r)}function j$(e){return zf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function E$(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function O$(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Is=class{constructor(...t){}};var If=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Cr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ci=p("$ZodError",If),Rn=p("$ZodError",If,{Parent:Error});function ui(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function li(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Un=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new _t;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ce(c,i,ye())));throw si(s,o?.callee),s}return a.value},An=Un(Rn),Cn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ce(c,i,ye())));throw si(s,o?.callee),s}return a.value},Mn=Cn(Rn),qn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new _t;return i.issues.length?{success:!1,error:new(e??ci)(i.issues.map(a=>Ce(a,o,ye())))}:{success:!0,data:i.value}},Lr=qn(Rn),Ln=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>Ce(a,o,ye())))}:{success:!0,data:i.value}},Vn=Ln(Rn),Pf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Un(e)(t,r,o)};var Tf=e=>(t,r,n)=>Un(e)(t,r,n);var jf=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Cn(e)(t,r,o)};var Ef=e=>async(t,r,n)=>Cn(e)(t,r,n);var Of=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qn(e)(t,r,o)};var Nf=e=>(t,r,n)=>qn(e)(t,r,n);var Df=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ln(e)(t,r,o)};var Zf=e=>async(t,r,n)=>Ln(e)(t,r,n);var Ye={};vn(Ye,{base64:()=>Xs,base64url:()=>di,bigint:()=>nc,boolean:()=>ic,browserEmail:()=>q$,cidrv4:()=>Hs,cidrv6:()=>Ws,cuid:()=>Rs,cuid2:()=>Us,date:()=>Qs,datetime:()=>tc,domain:()=>F$,duration:()=>Ls,e164:()=>Ys,email:()=>Fs,emoji:()=>Js,extendedDuration:()=>D$,guid:()=>Vs,hex:()=>J$,hostname:()=>V$,html5Email:()=>A$,idnEmail:()=>M$,integer:()=>oc,ipv4:()=>Ks,ipv6:()=>Gs,ksuid:()=>Ms,lowercase:()=>cc,mac:()=>Bs,md5_base64:()=>G$,md5_base64url:()=>B$,md5_hex:()=>K$,nanoid:()=>qs,null:()=>ac,number:()=>pi,rfc5322Email:()=>C$,sha1_base64:()=>W$,sha1_base64url:()=>X$,sha1_hex:()=>H$,sha256_base64:()=>Q$,sha256_base64url:()=>eb,sha256_hex:()=>Y$,sha384_base64:()=>rb,sha384_base64url:()=>nb,sha384_hex:()=>tb,sha512_base64:()=>ib,sha512_base64url:()=>ab,sha512_hex:()=>ob,string:()=>rc,time:()=>ec,ulid:()=>As,undefined:()=>sc,unicodeEmail:()=>Rf,uppercase:()=>uc,uuid:()=>lr,uuid4:()=>Z$,uuid6:()=>R$,uuid7:()=>U$,xid:()=>Cs});var Rs=/^[cC][^\s-]{8,}$/,Us=/^[0-9a-z]+$/,As=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cs=/^[0-9a-vA-V]{20}$/,Ms=/^[A-Za-z0-9]{27}$/,qs=/^[a-zA-Z0-9_-]{21}$/,Ls=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,D$=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,lr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Z$=lr(4),R$=lr(6),U$=lr(7),Fs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,A$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,C$=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Rf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,M$=Rf,q$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,L$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Js(){return new RegExp(L$,"u")}var Ks=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Bs=e=>{let t=Xe(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Hs=/^((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])$/,Ws=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,di=/^[A-Za-z0-9_-]*$/,V$=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,F$=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ys=/^\+[1-9]\d{6,14}$/,Uf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Qs=new RegExp(`^${Uf}$`);function Af(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ec(e){return new RegExp(`^${Af(e)}$`)}function tc(e){let t=Af({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Uf}T(?:${n})$`)}var rc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},nc=/^-?\d+n?$/,oc=/^-?\d+$/,pi=/^-?\d+(?:\.\d+)?$/,ic=/^(?:true|false)$/i,ac=/^null$/i;var sc=/^undefined$/i;var cc=/^[^A-Z]*$/,uc=/^[^a-z]*$/,J$=/^[0-9a-fA-F]*$/;function Fn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Jn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var K$=/^[0-9a-fA-F]{32}$/,G$=Fn(22,"=="),B$=Jn(22),H$=/^[0-9a-fA-F]{40}$/,W$=Fn(27,"="),X$=Jn(27),Y$=/^[0-9a-fA-F]{64}$/,Q$=Fn(43,"="),eb=Jn(43),tb=/^[0-9a-fA-F]{96}$/,rb=Fn(64,""),nb=Jn(64),ob=/^[0-9a-fA-F]{128}$/,ib=Fn(86,"=="),ab=Jn(86);var ce=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Mf={number:"number",bigint:"bigint",object:"date"},lc=p("$ZodCheckLessThan",(e,t)=>{ce.init(e,t);let r=Mf[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dc=p("$ZodCheckGreaterThan",(e,t)=>{ce.init(e,t);let r=Mf[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qf=p("$ZodCheckMultipleOf",(e,t)=>{ce.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ps(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Lf=p("$ZodCheckNumberFormat",(e,t)=>{ce.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ds[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=oc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Vf=p("$ZodCheckBigIntFormat",(e,t)=>{ce.init(e,t);let[r,n]=Zs[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Ff=p("$ZodCheckMaxSize",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Dn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Jf=p("$ZodCheckMinSize",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Dn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Kf=p("$ZodCheckSizeEquals",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Dn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Gf=p("$ZodCheckMaxLength",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=Zn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Bf=p("$ZodCheckMinLength",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Zn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hf=p("$ZodCheckLengthEquals",(e,t)=>{var r;ce.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Ft(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Zn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Kn=p("$ZodCheckStringFormat",(e,t)=>{var r,n;ce.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Wf=p("$ZodCheckRegex",(e,t)=>{Kn.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xf=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=cc),Kn.init(e,t)}),Yf=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=uc),Kn.init(e,t)}),Qf=p("$ZodCheckIncludes",(e,t)=>{ce.init(e,t);let r=Xe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),em=p("$ZodCheckStartsWith",(e,t)=>{ce.init(e,t);let r=new RegExp(`^${Xe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),tm=p("$ZodCheckEndsWith",(e,t)=>{ce.init(e,t);let r=new RegExp(`.*${Xe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Cf(e,t,r){e.issues.length&&t.issues.push(...Ke(r,e.issues))}var rm=p("$ZodCheckProperty",(e,t)=>{ce.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Cf(o,r,t.property));Cf(n,r,t.property)}}),nm=p("$ZodCheckMimeType",(e,t)=>{ce.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),om=p("$ZodCheckOverwrite",(e,t)=>{ce.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var fi=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
10
10
  `).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
11
- `))}};var am={major:4,minor:3,patch:5};var M=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=am;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Gt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let m=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new _t;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==m&&(u||(u=Gt(a,m)))});else{if(a.issues.length===m)continue;u||(u=Gt(a,m))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Gt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new _t;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new _t;return c.then(u=>o(u,n,s))}return o(c,n,s)}}V(e,"~standard",()=>({validate:o=>{try{let i=Lr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Vn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),dr=p("$ZodString",(e,t)=>{M.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??rc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ie=p("$ZodStringFormat",(e,t)=>{Kn.init(e,t),dr.init(e,t)}),fc=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vs),ie.init(e,t)}),mc=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lr(n))}else t.pattern??(t.pattern=lr());ie.init(e,t)}),hc=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fs),ie.init(e,t)}),gc=p("$ZodURL",(e,t)=>{ie.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),vc=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Js()),ie.init(e,t)}),_c=p("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=qs),ie.init(e,t)}),yc=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rs),ie.init(e,t)}),$c=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Us),ie.init(e,t)}),bc=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=As),ie.init(e,t)}),xc=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cs),ie.init(e,t)}),kc=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ms),ie.init(e,t)}),wc=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=tc(t)),ie.init(e,t)}),Sc=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Qs),ie.init(e,t)}),zc=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ec(t)),ie.init(e,t)}),Ic=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ls),ie.init(e,t)}),Pc=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ks),ie.init(e,t),e._zod.bag.format="ipv4"}),Tc=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Gs),ie.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),jc=p("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Bs(t.delimiter)),ie.init(e,t),e._zod.bag.format="mac"}),Ec=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hs),ie.init(e,t)}),Oc=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ws),ie.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function _m(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Nc=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Xs),ie.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{_m(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function sb(e){if(!di.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _m(r)}var Dc=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=di),ie.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{sb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Zc=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ys),ie.init(e,t)});function cb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Rc=p("$ZodJWT",(e,t)=>{ie.init(e,t),e._zod.check=r=>{cb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Uc=p("$ZodCustomStringFormat",(e,t)=>{ie.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),yi=p("$ZodNumber",(e,t)=>{M.init(e,t),e._zod.pattern=e._zod.bag.pattern??pi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Ac=p("$ZodNumberFormat",(e,t)=>{Lf.init(e,t),yi.init(e,t)}),Gn=p("$ZodBoolean",(e,t)=>{M.init(e,t),e._zod.pattern=ic,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),$i=p("$ZodBigInt",(e,t)=>{M.init(e,t),e._zod.pattern=nc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Cc=p("$ZodBigIntFormat",(e,t)=>{Vf.init(e,t),$i.init(e,t)}),Mc=p("$ZodSymbol",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),qc=p("$ZodUndefined",(e,t)=>{M.init(e,t),e._zod.pattern=sc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Lc=p("$ZodNull",(e,t)=>{M.init(e,t),e._zod.pattern=ac,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Vc=p("$ZodAny",(e,t)=>{M.init(e,t),e._zod.parse=r=>r}),Fc=p("$ZodUnknown",(e,t)=>{M.init(e,t),e._zod.parse=r=>r}),Jc=p("$ZodNever",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Kc=p("$ZodVoid",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Gc=p("$ZodDate",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function sm(e,t,r){e.issues.length&&t.issues.push(...Ke(r,e.issues)),t.value[r]=e.value}var Bc=p("$ZodArray",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>sm(u,r,a))):sm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function _i(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Ke(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function ym(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ns(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function $m(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let m=c.run({value:t[d],issues:[]},n);m instanceof Promise?e.push(m.then(f=>_i(f,r,d,t,l))):_i(m,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var bm=p("$ZodObject",(e,t)=>{if(M.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Mr(()=>ym(t));V(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=ur,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let m of a.keys){let f=d[m],h=f._zod.optout==="optional",g=f._zod.run({value:u[m],issues:[]},c);g instanceof Promise?l.push(g.then($=>_i($,s,m,u,h))):_i(g,s,m,u,h)}return i?$m(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),xm=p("$ZodObjectJIT",(e,t)=>{bm.init(e,t);let r=e._zod.parse,n=Mr(()=>ym(t)),o=m=>{let f=new fi(["shape","payload","ctx"]),h=n.value,g=I=>{let A=ai(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};f.write("const input = payload.value;");let $=Object.create(null),b=0;for(let I of h.keys)$[I]=`key_${b++}`;f.write("const newResult = {};");for(let I of h.keys){let A=$[I],O=ai(I),at=m[I]?._zod?.optout==="optional";f.write(`const ${A} = ${g(I)};`),at?f.write(`
11
+ `))}};var am={major:4,minor:3,patch:5};var M=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=am;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Gt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let m=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new _t;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==m&&(u||(u=Gt(a,m)))});else{if(a.issues.length===m)continue;u||(u=Gt(a,m))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Gt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new _t;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new _t;return c.then(u=>o(u,n,s))}return o(c,n,s)}}V(e,"~standard",()=>({validate:o=>{try{let i=Lr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Vn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),dr=p("$ZodString",(e,t)=>{M.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??rc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ie=p("$ZodStringFormat",(e,t)=>{Kn.init(e,t),dr.init(e,t)}),fc=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Vs),ie.init(e,t)}),mc=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=lr(n))}else t.pattern??(t.pattern=lr());ie.init(e,t)}),hc=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fs),ie.init(e,t)}),gc=p("$ZodURL",(e,t)=>{ie.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),vc=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Js()),ie.init(e,t)}),_c=p("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=qs),ie.init(e,t)}),yc=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Rs),ie.init(e,t)}),$c=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Us),ie.init(e,t)}),bc=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=As),ie.init(e,t)}),xc=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cs),ie.init(e,t)}),kc=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ms),ie.init(e,t)}),wc=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=tc(t)),ie.init(e,t)}),Sc=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Qs),ie.init(e,t)}),zc=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ec(t)),ie.init(e,t)}),Ic=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ls),ie.init(e,t)}),Pc=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ks),ie.init(e,t),e._zod.bag.format="ipv4"}),Tc=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Gs),ie.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),jc=p("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Bs(t.delimiter)),ie.init(e,t),e._zod.bag.format="mac"}),Ec=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hs),ie.init(e,t)}),Oc=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ws),ie.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function _m(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Nc=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Xs),ie.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{_m(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function sb(e){if(!di.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _m(r)}var Dc=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=di),ie.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{sb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Zc=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ys),ie.init(e,t)});function cb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Rc=p("$ZodJWT",(e,t)=>{ie.init(e,t),e._zod.check=r=>{cb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Uc=p("$ZodCustomStringFormat",(e,t)=>{ie.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),yi=p("$ZodNumber",(e,t)=>{M.init(e,t),e._zod.pattern=e._zod.bag.pattern??pi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Ac=p("$ZodNumberFormat",(e,t)=>{Lf.init(e,t),yi.init(e,t)}),Gn=p("$ZodBoolean",(e,t)=>{M.init(e,t),e._zod.pattern=ic,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),$i=p("$ZodBigInt",(e,t)=>{M.init(e,t),e._zod.pattern=nc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Cc=p("$ZodBigIntFormat",(e,t)=>{Vf.init(e,t),$i.init(e,t)}),Mc=p("$ZodSymbol",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),qc=p("$ZodUndefined",(e,t)=>{M.init(e,t),e._zod.pattern=sc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Lc=p("$ZodNull",(e,t)=>{M.init(e,t),e._zod.pattern=ac,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Vc=p("$ZodAny",(e,t)=>{M.init(e,t),e._zod.parse=r=>r}),Fc=p("$ZodUnknown",(e,t)=>{M.init(e,t),e._zod.parse=r=>r}),Jc=p("$ZodNever",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Kc=p("$ZodVoid",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Gc=p("$ZodDate",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function sm(e,t,r){e.issues.length&&t.issues.push(...Ke(r,e.issues)),t.value[r]=e.value}var Bc=p("$ZodArray",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>sm(u,r,a))):sm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function _i(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Ke(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function ym(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ns(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function $m(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let m=c.run({value:t[d],issues:[]},n);m instanceof Promise?e.push(m.then(f=>_i(f,r,d,t,l))):_i(m,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var bm=p("$ZodObject",(e,t)=>{if(M.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Mr(()=>ym(t));V(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=ur,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let m of a.keys){let f=d[m],h=f._zod.optout==="optional",g=f._zod.run({value:u[m],issues:[]},c);g instanceof Promise?l.push(g.then(y=>_i(y,s,m,u,h))):_i(g,s,m,u,h)}return i?$m(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),xm=p("$ZodObjectJIT",(e,t)=>{bm.init(e,t);let r=e._zod.parse,n=Mr(()=>ym(t)),o=m=>{let f=new fi(["shape","payload","ctx"]),h=n.value,g=I=>{let A=ai(I);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),b=0;for(let I of h.keys)y[I]=`key_${b++}`;f.write("const newResult = {};");for(let I of h.keys){let A=y[I],O=ai(I),at=m[I]?._zod?.optout==="optional";f.write(`const ${A} = ${g(I)};`),at?f.write(`
12
12
  if (${A}.issues.length) {
13
13
  if (${O} in input) {
14
14
  payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
@@ -44,7 +44,7 @@
44
44
 
45
45
  `)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(I,A)=>P(m,I,A)},i,a=ur,s=!ii.jitless,u=s&&js.value,l=t.catchall,d;e._zod.parse=(m,f)=>{d??(d=n.value);let h=m.value;return a(h)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(t.shape)),m=i(m,f),l?$m([],h,m,f,d,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),m)}});function cm(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Gt(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Ce(a,n,ye())))}),t)}var Bn=p("$ZodUnion",(e,t)=>{M.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>On(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>cm(c,o,e,i)):cm(s,o,e,i)}});function um(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Ce(a,n,ye())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var Hc=p("$ZodXor",(e,t)=>{Bn.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>um(c,o,e,i)):um(s,o,e,i)}}),Wc=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Bn.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Mr(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!ur(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Xc=p("$ZodIntersection",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>lm(r,c,u)):lm(r,i,a)}});function pc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Kt(e)&&Kt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=pc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=pc(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function lm(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),Gt(e))return e;let a=pc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var bi=p("$ZodTuple",(e,t)=>{M.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(m=>mi(m,n,u))):mi(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let m=t.rest._zod.run({value:d,issues:[]},o);m instanceof Promise?a.push(m.then(f=>mi(f,n,u))):mi(m,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function mi(e,t,r){e.issues.length&&t.issues.push(...Ke(r,e.issues)),t.value[r]=e.value}var Yc=p("$ZodRecord",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Kt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ke(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Ke(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&pi.test(s)&&c.issues.length&&c.issues.some(d=>d.code==="invalid_type"&&d.expected==="number")){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Ce(d,n,ye())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ke(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Ke(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),Qc=p("$ZodMap",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{dm(l,d,r,a,o,e,n)})):dm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function dm(e,t,r,n,o,i,a){e.issues.length&&(Nn.has(typeof n)?r.issues.push(...Ke(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>Ce(s,a,ye()))})),t.issues.length&&(Nn.has(typeof n)?r.issues.push(...Ke(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>Ce(s,a,ye()))})),r.value.set(e.value,t.value)}var eu=p("$ZodSet",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>pm(c,r))):pm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function pm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var tu=p("$ZodEnum",(e,t)=>{M.init(e,t);let r=En(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Nn.has(typeof o)).map(o=>typeof o=="string"?Xe(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),ru=p("$ZodLiteral",(e,t)=>{if(M.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Xe(n):n?Xe(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),nu=p("$ZodFile",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),ou=p("$ZodTransform",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new cr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new _t;return r.value=o,r}});function fm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var xi=p("$ZodOptional",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>fm(i,r.value)):fm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),iu=p("$ZodExactOptional",(e,t)=>{xi.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),au=p("$ZodNullable",(e,t)=>{M.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),su=p("$ZodDefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>mm(i,t)):mm(o,t)}});function mm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var cu=p("$ZodPrefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),uu=p("$ZodNonOptional",(e,t)=>{M.init(e,t),V(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>hm(i,e)):hm(o,e)}});function hm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var lu=p("$ZodSuccess",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new cr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),du=p("$ZodCatch",(e,t)=>{M.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>Ce(a,n,ye()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Ce(i,n,ye()))},input:r.value}),r.issues=[]),r)}}),pu=p("$ZodNaN",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),fu=p("$ZodPipe",(e,t)=>{M.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>hi(a,t.in,n)):hi(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>hi(i,t.out,n)):hi(o,t.out,n)}});function hi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Hn=p("$ZodCodec",(e,t)=>{M.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>gi(a,t,n)):gi(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>gi(a,t,n)):gi(i,t,n)}}});function gi(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>vi(e,i,t.out,r)):vi(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>vi(e,i,t.in,r)):vi(e,o,t.in,r)}}function vi(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var mu=p("$ZodReadonly",(e,t)=>{M.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType?._zod?.optin),V(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(gm):gm(o)}});function gm(e){return e.value=Object.freeze(e.value),e}var hu=p("$ZodTemplateLiteral",(e,t)=>{M.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Os.has(typeof n))r.push(Xe(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),gu=p("$ZodFunction",(e,t)=>(M.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?An(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?An(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await Mn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Mn(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new bi({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),vu=p("$ZodPromise",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),_u=p("$ZodLazy",(e,t)=>{M.init(e,t),V(e._zod,"innerType",()=>t.getter()),V(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),V(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),V(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),V(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),yu=p("$ZodCustom",(e,t)=>{ce.init(e,t),M.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>vm(i,r,n,e));vm(o,r,n,e)}});function vm(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(qr(o))}}var lb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=U(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${Z(o.values[0])}`:`Invalid option: expected one of ${D(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${D(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function $u(){return{localeError:lb()}}var km,wm=Symbol("ZodOutput"),Sm=Symbol("ZodInput"),xu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function ku(){return new xu}(km=globalThis).__zod_globalRegistry??(km.__zod_globalRegistry=ku());var De=globalThis.__zod_globalRegistry;function wu(e,t){return new e({type:"string",...k(t)})}function ki(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...k(t)})}function Wn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...k(t)})}function wi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...k(t)})}function Si(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(t)})}function zi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(t)})}function Ii(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(t)})}function Xn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...k(t)})}function Pi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...k(t)})}function Ti(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(t)})}function ji(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...k(t)})}function Ei(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(t)})}function Oi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...k(t)})}function Ni(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...k(t)})}function Di(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(t)})}function Zi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(t)})}function Ri(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(t)})}function Su(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...k(t)})}function Ui(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(t)})}function Ai(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(t)})}function Ci(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...k(t)})}function Mi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...k(t)})}function qi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...k(t)})}function Li(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...k(t)})}function zu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(t)})}function Iu(e,t){return new e({type:"string",format:"date",check:"string_format",...k(t)})}function Pu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...k(t)})}function Tu(e,t){return new e({type:"string",format:"duration",check:"string_format",...k(t)})}function ju(e,t){return new e({type:"number",checks:[],...k(t)})}function Eu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...k(t)})}function Ou(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...k(t)})}function Nu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...k(t)})}function Du(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...k(t)})}function Zu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...k(t)})}function Ru(e,t){return new e({type:"boolean",...k(t)})}function Uu(e,t){return new e({type:"bigint",...k(t)})}function Au(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...k(t)})}function Cu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...k(t)})}function Mu(e,t){return new e({type:"symbol",...k(t)})}function qu(e,t){return new e({type:"undefined",...k(t)})}function Lu(e,t){return new e({type:"null",...k(t)})}function Vu(e){return new e({type:"any"})}function Fu(e){return new e({type:"unknown"})}function Ju(e,t){return new e({type:"never",...k(t)})}function Ku(e,t){return new e({type:"void",...k(t)})}function Gu(e,t){return new e({type:"date",...k(t)})}function Bu(e,t){return new e({type:"nan",...k(t)})}function Et(e,t){return new lc({check:"less_than",...k(t),value:e,inclusive:!1})}function Ge(e,t){return new lc({check:"less_than",...k(t),value:e,inclusive:!0})}function Ot(e,t){return new dc({check:"greater_than",...k(t),value:e,inclusive:!1})}function Ze(e,t){return new dc({check:"greater_than",...k(t),value:e,inclusive:!0})}function Hu(e){return Ot(0,e)}function Wu(e){return Et(0,e)}function Xu(e){return Ge(0,e)}function Yu(e){return Ze(0,e)}function pr(e,t){return new qf({check:"multiple_of",...k(t),value:e})}function fr(e,t){return new Ff({check:"max_size",...k(t),maximum:e})}function Nt(e,t){return new Jf({check:"min_size",...k(t),minimum:e})}function Vr(e,t){return new Kf({check:"size_equals",...k(t),size:e})}function Fr(e,t){return new Gf({check:"max_length",...k(t),maximum:e})}function Bt(e,t){return new Bf({check:"min_length",...k(t),minimum:e})}function Jr(e,t){return new Hf({check:"length_equals",...k(t),length:e})}function Yn(e,t){return new Wf({check:"string_format",format:"regex",...k(t),pattern:e})}function Qn(e){return new Xf({check:"string_format",format:"lowercase",...k(e)})}function eo(e){return new Yf({check:"string_format",format:"uppercase",...k(e)})}function to(e,t){return new Qf({check:"string_format",format:"includes",...k(t),includes:e})}function ro(e,t){return new em({check:"string_format",format:"starts_with",...k(t),prefix:e})}function no(e,t){return new tm({check:"string_format",format:"ends_with",...k(t),suffix:e})}function Qu(e,t,r){return new rm({check:"property",property:e,schema:t,...k(r)})}function oo(e,t){return new nm({check:"mime_type",mime:e,...k(t)})}function yt(e){return new om({check:"overwrite",tx:e})}function io(e){return yt(t=>t.normalize(e))}function ao(){return yt(e=>e.trim())}function so(){return yt(e=>e.toLowerCase())}function co(){return yt(e=>e.toUpperCase())}function Vi(){return yt(e=>Ts(e))}function zm(e,t,r){return new e({type:"array",element:t,...k(r)})}function el(e,t){return new e({type:"file",...k(t)})}function tl(e,t,r){let n=k(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function rl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...k(r)})}function nl(e){let t=mb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(qr(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(qr(o))}},e(r.value,r)));return t}function mb(e,t){let r=new ce({check:"custom",...k(t)});return r._zod.check=e,r}function ol(e){let t=new ce({check:"describe"});return t._zod.onattach=[r=>{let n=De.get(r)??{};De.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function il(e){let t=new ce({check:"meta"});return t._zod.onattach=[r=>{let n=De.get(r)??{};De.add(r,{...n,...e})}],t._zod.check=()=>{},t}function al(e,t){let r=k(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=e.Codec??Hn,c=e.Boolean??Gn,u=e.String??dr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),m=new s({type:"pipe",in:l,out:d,transform:(f,h)=>{let g=f;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:m,continue:!1}),{})},reverseTransform:(f,h)=>f===!0?n[0]||"true":o[0]||"false",error:r.error});return m}function Kr(e,t,r,n={}){let o=k(n),i={...k(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Fi(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??De,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function pe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.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};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let m=a.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),pe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Re(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Ji(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,m=e.external.uri??(h=>h);if(d)return{ref:m(d)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${m("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
46
46
 
47
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function Ki(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let m=e.seen.get(l),f=m.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(f.$ref)for(let g in c)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(c[g])===JSON.stringify(m.def[g])&&delete c[g]}let d=a._zod.parent;if(d&&d!==l){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let f in c)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(c[f])===JSON.stringify(m.def[f])&&delete c[f]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:uo(t,"input",e.processors),output:uo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Re(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Re(n.element,r);if(n.type==="set")return Re(n.valueType,r);if(n.type==="lazy")return Re(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Re(n.innerType,r);if(n.type==="intersection")return Re(n.left,r)||Re(n.right,r);if(n.type==="record"||n.type==="map")return Re(n.keyType,r)||Re(n.valueType,r);if(n.type==="pipe")return Re(n.in,r)||Re(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Re(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Re(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Re(o,r))return!0;return!!(n.rest&&Re(n.rest,r))}return!1}var Im=(e,t={})=>r=>{let n=Fi({...r,processors:t});return pe(e,n),Ji(n,e),Ki(n,e)},uo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Fi({...o??{},target:i,io:t,processors:r});return pe(e,a),Ji(a,e),Ki(a,e)};var hb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Pm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=hb[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Tm=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},jm=(e,t,r,n)=>{r.type="boolean"},Em=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Om=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Nm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Dm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Zm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Rm=(e,t,r,n)=>{r.not={}},Um=(e,t,r,n)=>{},Am=(e,t,r,n)=>{},Cm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Mm=(e,t,r,n)=>{let o=e._zod.def,i=En(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},qm=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Lm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Vm=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Fm=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},Jm=(e,t,r,n)=>{r.type="boolean"},Km=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Gm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Bm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Hm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Wm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Xm=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=pe(i.element,t,{...n,path:[...n.path,"items"]})},Ym=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=pe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=pe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},sl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>pe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Qm=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=pe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},eh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,f)=>pe(m,t,{...n,path:[...n.path,a,f]})),u=i.rest?pe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},th=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=pe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=pe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=pe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},rh=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},nh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},oh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},ih=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},ah=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},sh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;pe(i,t,n);let a=t.seen.get(e);a.ref=i},ch=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},uh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},cl=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},lh=(e,t,r,n)=>{let o=e._zod.innerType;pe(o,t,n);let i=t.seen.get(e);i.ref=o};function Gr(e){return!!e._zod}function Ht(e,t){return Gr(e)?Lr(e,t):e.safeParse(t)}function Gi(e){if(!e)return;let t;if(Gr(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function fh(e){if(Gr(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var lo={};vn(lo,{ZodAny:()=>Eh,ZodArray:()=>Zh,ZodBase64:()=>Ol,ZodBase64URL:()=>Nl,ZodBigInt:()=>ra,ZodBigIntFormat:()=>Rl,ZodBoolean:()=>ta,ZodCIDRv4:()=>jl,ZodCIDRv6:()=>El,ZodCUID:()=>kl,ZodCUID2:()=>wl,ZodCatch:()=>tg,ZodCodec:()=>Vl,ZodCustom:()=>sa,ZodCustomStringFormat:()=>fo,ZodDate:()=>Al,ZodDefault:()=>Hh,ZodDiscriminatedUnion:()=>Uh,ZodE164:()=>Dl,ZodEmail:()=>$l,ZodEmoji:()=>bl,ZodEnum:()=>po,ZodExactOptional:()=>Kh,ZodFile:()=>Fh,ZodFunction:()=>lg,ZodGUID:()=>Hi,ZodIPv4:()=>Pl,ZodIPv6:()=>Tl,ZodIntersection:()=>Ah,ZodJWT:()=>Zl,ZodKSUID:()=>Il,ZodLazy:()=>sg,ZodLiteral:()=>Vh,ZodMAC:()=>Ih,ZodMap:()=>qh,ZodNaN:()=>ng,ZodNanoID:()=>xl,ZodNever:()=>Nh,ZodNonOptional:()=>ql,ZodNull:()=>jh,ZodNullable:()=>Bh,ZodNumber:()=>ea,ZodNumberFormat:()=>Br,ZodObject:()=>na,ZodOptional:()=>Ml,ZodPipe:()=>Ll,ZodPrefault:()=>Xh,ZodPromise:()=>ug,ZodReadonly:()=>og,ZodRecord:()=>aa,ZodSet:()=>Lh,ZodString:()=>Yi,ZodStringFormat:()=>ue,ZodSuccess:()=>eg,ZodSymbol:()=>Ph,ZodTemplateLiteral:()=>ag,ZodTransform:()=>Jh,ZodTuple:()=>Ch,ZodType:()=>F,ZodULID:()=>Sl,ZodURL:()=>Qi,ZodUUID:()=>Dt,ZodUndefined:()=>Th,ZodUnion:()=>oa,ZodUnknown:()=>Oh,ZodVoid:()=>Dh,ZodXID:()=>zl,ZodXor:()=>Rh,_ZodString:()=>yl,_default:()=>Wh,_function:()=>Ex,any:()=>fx,array:()=>W,base64:()=>Wb,base64url:()=>Xb,bigint:()=>cx,boolean:()=>_e,catch:()=>rg,check:()=>Ox,cidrv4:()=>Bb,cidrv6:()=>Hb,codec:()=>Px,cuid:()=>Mb,cuid2:()=>qb,custom:()=>Fl,date:()=>hx,describe:()=>Nx,discriminatedUnion:()=>ia,e164:()=>Yb,email:()=>jb,emoji:()=>Ab,enum:()=>Pe,exactOptional:()=>Gh,file:()=>wx,float32:()=>ox,float64:()=>ix,function:()=>Ex,guid:()=>Eb,hash:()=>nx,hex:()=>rx,hostname:()=>tx,httpUrl:()=>Ub,instanceof:()=>Zx,int:()=>_l,int32:()=>ax,int64:()=>ux,intersection:()=>ho,ipv4:()=>Jb,ipv6:()=>Gb,json:()=>Ux,jwt:()=>Qb,keyof:()=>gx,ksuid:()=>Fb,lazy:()=>cg,literal:()=>j,looseObject:()=>Ie,looseRecord:()=>$x,mac:()=>Kb,map:()=>bx,meta:()=>Dx,nan:()=>Ix,nanoid:()=>Cb,nativeEnum:()=>kx,never:()=>Ul,nonoptional:()=>Qh,null:()=>mo,nullable:()=>Wi,nullish:()=>Sx,number:()=>oe,object:()=>z,optional:()=>me,partialRecord:()=>yx,pipe:()=>Xi,prefault:()=>Yh,preprocess:()=>ca,promise:()=>jx,readonly:()=>ig,record:()=>fe,refine:()=>dg,set:()=>xx,strictObject:()=>vx,string:()=>v,stringFormat:()=>ex,stringbool:()=>Rx,success:()=>zx,superRefine:()=>pg,symbol:()=>dx,templateLiteral:()=>Tx,transform:()=>Cl,tuple:()=>Mh,uint32:()=>sx,uint64:()=>lx,ulid:()=>Lb,undefined:()=>px,union:()=>ae,unknown:()=>le,url:()=>Rb,uuid:()=>Ob,uuidv4:()=>Nb,uuidv6:()=>Db,uuidv7:()=>Zb,void:()=>mx,xid:()=>Vb,xor:()=>_x});var Bi={};vn(Bi,{endsWith:()=>no,gt:()=>Ot,gte:()=>Ze,includes:()=>to,length:()=>Jr,lowercase:()=>Qn,lt:()=>Et,lte:()=>Ge,maxLength:()=>Fr,maxSize:()=>fr,mime:()=>oo,minLength:()=>Bt,minSize:()=>Nt,multipleOf:()=>pr,negative:()=>Wu,nonnegative:()=>Yu,nonpositive:()=>Xu,normalize:()=>io,overwrite:()=>yt,positive:()=>Hu,property:()=>Qu,regex:()=>Yn,size:()=>Vr,slugify:()=>Vi,startsWith:()=>ro,toLowerCase:()=>so,toUpperCase:()=>co,trim:()=>ao,uppercase:()=>eo});var mr={};vn(mr,{ZodISODate:()=>pl,ZodISODateTime:()=>ll,ZodISODuration:()=>gl,ZodISOTime:()=>ml,date:()=>fl,datetime:()=>dl,duration:()=>vl,time:()=>hl});var ll=p("ZodISODateTime",(e,t)=>{wc.init(e,t),ue.init(e,t)});function dl(e){return zu(ll,e)}var pl=p("ZodISODate",(e,t)=>{Sc.init(e,t),ue.init(e,t)});function fl(e){return Iu(pl,e)}var ml=p("ZodISOTime",(e,t)=>{zc.init(e,t),ue.init(e,t)});function hl(e){return Pu(ml,e)}var gl=p("ZodISODuration",(e,t)=>{Ic.init(e,t),ue.init(e,t)});function vl(e){return Tu(gl,e)}var mh=(e,t)=>{ci.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>li(e,r)},flatten:{value:r=>ui(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Cr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Cr,2)}},isEmpty:{get(){return e.issues.length===0}}})},Z1=p("ZodError",mh),Be=p("ZodError",mh,{Parent:Error});var hh=Un(Be),gh=Cn(Be),vh=qn(Be),_h=Ln(Be),yh=Pf(Be),$h=Tf(Be),bh=jf(Be),xh=Ef(Be),kh=Of(Be),wh=Nf(Be),Sh=Df(Be),zh=Zf(Be);var F=p("ZodType",(e,t)=>(M.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:uo(e,"input"),output:uo(e,"output")}}),e.toJSONSchema=Im(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(y.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Ne(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>hh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>vh(e,r,n),e.parseAsync=async(r,n)=>gh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>_h(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>yh(e,r,n),e.decode=(r,n)=>$h(e,r,n),e.encodeAsync=async(r,n)=>bh(e,r,n),e.decodeAsync=async(r,n)=>xh(e,r,n),e.safeEncode=(r,n)=>kh(e,r,n),e.safeDecode=(r,n)=>wh(e,r,n),e.safeEncodeAsync=async(r,n)=>Sh(e,r,n),e.safeDecodeAsync=async(r,n)=>zh(e,r,n),e.refine=(r,n)=>e.check(dg(r,n)),e.superRefine=r=>e.check(pg(r)),e.overwrite=r=>e.check(yt(r)),e.optional=()=>me(e),e.exactOptional=()=>Gh(e),e.nullable=()=>Wi(e),e.nullish=()=>me(Wi(e)),e.nonoptional=r=>Qh(e,r),e.array=()=>W(e),e.or=r=>ae([e,r]),e.and=r=>ho(e,r),e.transform=r=>Xi(e,Cl(r)),e.default=r=>Wh(e,r),e.prefault=r=>Yh(e,r),e.catch=r=>rg(e,r),e.pipe=r=>Xi(e,r),e.readonly=()=>ig(e),e.describe=r=>{let n=e.clone();return De.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return De.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return De.get(e);let n=e.clone();return De.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),yl=p("_ZodString",(e,t)=>{dr.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Pm(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Yn(...n)),e.includes=(...n)=>e.check(to(...n)),e.startsWith=(...n)=>e.check(ro(...n)),e.endsWith=(...n)=>e.check(no(...n)),e.min=(...n)=>e.check(Bt(...n)),e.max=(...n)=>e.check(Fr(...n)),e.length=(...n)=>e.check(Jr(...n)),e.nonempty=(...n)=>e.check(Bt(1,...n)),e.lowercase=n=>e.check(Qn(n)),e.uppercase=n=>e.check(eo(n)),e.trim=()=>e.check(ao()),e.normalize=(...n)=>e.check(io(...n)),e.toLowerCase=()=>e.check(so()),e.toUpperCase=()=>e.check(co()),e.slugify=()=>e.check(Vi())}),Yi=p("ZodString",(e,t)=>{dr.init(e,t),yl.init(e,t),e.email=r=>e.check(ki($l,r)),e.url=r=>e.check(Xn(Qi,r)),e.jwt=r=>e.check(Li(Zl,r)),e.emoji=r=>e.check(Pi(bl,r)),e.guid=r=>e.check(Wn(Hi,r)),e.uuid=r=>e.check(wi(Dt,r)),e.uuidv4=r=>e.check(Si(Dt,r)),e.uuidv6=r=>e.check(zi(Dt,r)),e.uuidv7=r=>e.check(Ii(Dt,r)),e.nanoid=r=>e.check(Ti(xl,r)),e.guid=r=>e.check(Wn(Hi,r)),e.cuid=r=>e.check(ji(kl,r)),e.cuid2=r=>e.check(Ei(wl,r)),e.ulid=r=>e.check(Oi(Sl,r)),e.base64=r=>e.check(Ci(Ol,r)),e.base64url=r=>e.check(Mi(Nl,r)),e.xid=r=>e.check(Ni(zl,r)),e.ksuid=r=>e.check(Di(Il,r)),e.ipv4=r=>e.check(Zi(Pl,r)),e.ipv6=r=>e.check(Ri(Tl,r)),e.cidrv4=r=>e.check(Ui(jl,r)),e.cidrv6=r=>e.check(Ai(El,r)),e.e164=r=>e.check(qi(Dl,r)),e.datetime=r=>e.check(dl(r)),e.date=r=>e.check(fl(r)),e.time=r=>e.check(hl(r)),e.duration=r=>e.check(vl(r))});function v(e){return wu(Yi,e)}var ue=p("ZodStringFormat",(e,t)=>{ie.init(e,t),yl.init(e,t)}),$l=p("ZodEmail",(e,t)=>{hc.init(e,t),ue.init(e,t)});function jb(e){return ki($l,e)}var Hi=p("ZodGUID",(e,t)=>{fc.init(e,t),ue.init(e,t)});function Eb(e){return Wn(Hi,e)}var Dt=p("ZodUUID",(e,t)=>{mc.init(e,t),ue.init(e,t)});function Ob(e){return wi(Dt,e)}function Nb(e){return Si(Dt,e)}function Db(e){return zi(Dt,e)}function Zb(e){return Ii(Dt,e)}var Qi=p("ZodURL",(e,t)=>{gc.init(e,t),ue.init(e,t)});function Rb(e){return Xn(Qi,e)}function Ub(e){return Xn(Qi,{protocol:/^https?$/,hostname:Ye.domain,...y.normalizeParams(e)})}var bl=p("ZodEmoji",(e,t)=>{vc.init(e,t),ue.init(e,t)});function Ab(e){return Pi(bl,e)}var xl=p("ZodNanoID",(e,t)=>{_c.init(e,t),ue.init(e,t)});function Cb(e){return Ti(xl,e)}var kl=p("ZodCUID",(e,t)=>{yc.init(e,t),ue.init(e,t)});function Mb(e){return ji(kl,e)}var wl=p("ZodCUID2",(e,t)=>{$c.init(e,t),ue.init(e,t)});function qb(e){return Ei(wl,e)}var Sl=p("ZodULID",(e,t)=>{bc.init(e,t),ue.init(e,t)});function Lb(e){return Oi(Sl,e)}var zl=p("ZodXID",(e,t)=>{xc.init(e,t),ue.init(e,t)});function Vb(e){return Ni(zl,e)}var Il=p("ZodKSUID",(e,t)=>{kc.init(e,t),ue.init(e,t)});function Fb(e){return Di(Il,e)}var Pl=p("ZodIPv4",(e,t)=>{Pc.init(e,t),ue.init(e,t)});function Jb(e){return Zi(Pl,e)}var Ih=p("ZodMAC",(e,t)=>{jc.init(e,t),ue.init(e,t)});function Kb(e){return Su(Ih,e)}var Tl=p("ZodIPv6",(e,t)=>{Tc.init(e,t),ue.init(e,t)});function Gb(e){return Ri(Tl,e)}var jl=p("ZodCIDRv4",(e,t)=>{Ec.init(e,t),ue.init(e,t)});function Bb(e){return Ui(jl,e)}var El=p("ZodCIDRv6",(e,t)=>{Oc.init(e,t),ue.init(e,t)});function Hb(e){return Ai(El,e)}var Ol=p("ZodBase64",(e,t)=>{Nc.init(e,t),ue.init(e,t)});function Wb(e){return Ci(Ol,e)}var Nl=p("ZodBase64URL",(e,t)=>{Dc.init(e,t),ue.init(e,t)});function Xb(e){return Mi(Nl,e)}var Dl=p("ZodE164",(e,t)=>{Zc.init(e,t),ue.init(e,t)});function Yb(e){return qi(Dl,e)}var Zl=p("ZodJWT",(e,t)=>{Rc.init(e,t),ue.init(e,t)});function Qb(e){return Li(Zl,e)}var fo=p("ZodCustomStringFormat",(e,t)=>{Uc.init(e,t),ue.init(e,t)});function ex(e,t,r={}){return Kr(fo,e,t,r)}function tx(e){return Kr(fo,"hostname",Ye.hostname,e)}function rx(e){return Kr(fo,"hex",Ye.hex,e)}function nx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Ye[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Kr(fo,n,o,t)}var ea=p("ZodNumber",(e,t)=>{yi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Tm(e,n,o,i),e.gt=(n,o)=>e.check(Ot(n,o)),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.lt=(n,o)=>e.check(Et(n,o)),e.lte=(n,o)=>e.check(Ge(n,o)),e.max=(n,o)=>e.check(Ge(n,o)),e.int=n=>e.check(_l(n)),e.safe=n=>e.check(_l(n)),e.positive=n=>e.check(Ot(0,n)),e.nonnegative=n=>e.check(Ze(0,n)),e.negative=n=>e.check(Et(0,n)),e.nonpositive=n=>e.check(Ge(0,n)),e.multipleOf=(n,o)=>e.check(pr(n,o)),e.step=(n,o)=>e.check(pr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function oe(e){return ju(ea,e)}var Br=p("ZodNumberFormat",(e,t)=>{Ac.init(e,t),ea.init(e,t)});function _l(e){return Eu(Br,e)}function ox(e){return Ou(Br,e)}function ix(e){return Nu(Br,e)}function ax(e){return Du(Br,e)}function sx(e){return Zu(Br,e)}var ta=p("ZodBoolean",(e,t)=>{Gn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jm(e,r,n,o)});function _e(e){return Ru(ta,e)}var ra=p("ZodBigInt",(e,t)=>{$i.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Em(e,n,o,i),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.gt=(n,o)=>e.check(Ot(n,o)),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.lt=(n,o)=>e.check(Et(n,o)),e.lte=(n,o)=>e.check(Ge(n,o)),e.max=(n,o)=>e.check(Ge(n,o)),e.positive=n=>e.check(Ot(BigInt(0),n)),e.negative=n=>e.check(Et(BigInt(0),n)),e.nonpositive=n=>e.check(Ge(BigInt(0),n)),e.nonnegative=n=>e.check(Ze(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(pr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function cx(e){return Uu(ra,e)}var Rl=p("ZodBigIntFormat",(e,t)=>{Cc.init(e,t),ra.init(e,t)});function ux(e){return Au(Rl,e)}function lx(e){return Cu(Rl,e)}var Ph=p("ZodSymbol",(e,t)=>{Mc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Om(e,r,n,o)});function dx(e){return Mu(Ph,e)}var Th=p("ZodUndefined",(e,t)=>{qc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dm(e,r,n,o)});function px(e){return qu(Th,e)}var jh=p("ZodNull",(e,t)=>{Lc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nm(e,r,n,o)});function mo(e){return Lu(jh,e)}var Eh=p("ZodAny",(e,t)=>{Vc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Um(e,r,n,o)});function fx(){return Vu(Eh)}var Oh=p("ZodUnknown",(e,t)=>{Fc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Am(e,r,n,o)});function le(){return Fu(Oh)}var Nh=p("ZodNever",(e,t)=>{Jc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rm(e,r,n,o)});function Ul(e){return Ju(Nh,e)}var Dh=p("ZodVoid",(e,t)=>{Kc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zm(e,r,n,o)});function mx(e){return Ku(Dh,e)}var Al=p("ZodDate",(e,t)=>{Gc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Cm(e,n,o,i),e.min=(n,o)=>e.check(Ze(n,o)),e.max=(n,o)=>e.check(Ge(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function hx(e){return Gu(Al,e)}var Zh=p("ZodArray",(e,t)=>{Bc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Bt(r,n)),e.nonempty=r=>e.check(Bt(1,r)),e.max=(r,n)=>e.check(Fr(r,n)),e.length=(r,n)=>e.check(Jr(r,n)),e.unwrap=()=>e.element});function W(e,t){return zm(Zh,e,t)}function gx(e){let t=e._zod.def.shape;return Pe(Object.keys(t))}var na=p("ZodObject",(e,t)=>{xm.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o),y.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:le()}),e.loose=()=>e.clone({...e._zod.def,catchall:le()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ul()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>y.extend(e,r),e.safeExtend=r=>y.safeExtend(e,r),e.merge=r=>y.merge(e,r),e.pick=r=>y.pick(e,r),e.omit=r=>y.omit(e,r),e.partial=(...r)=>y.partial(Ml,e,r[0]),e.required=(...r)=>y.required(ql,e,r[0])});function z(e,t){let r={type:"object",shape:e??{},...y.normalizeParams(t)};return new na(r)}function vx(e,t){return new na({type:"object",shape:e,catchall:Ul(),...y.normalizeParams(t)})}function Ie(e,t){return new na({type:"object",shape:e,catchall:le(),...y.normalizeParams(t)})}var oa=p("ZodUnion",(e,t)=>{Bn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sl(e,r,n,o),e.options=t.options});function ae(e,t){return new oa({type:"union",options:e,...y.normalizeParams(t)})}var Rh=p("ZodXor",(e,t)=>{oa.init(e,t),Hc.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sl(e,r,n,o),e.options=t.options});function _x(e,t){return new Rh({type:"union",options:e,inclusive:!1,...y.normalizeParams(t)})}var Uh=p("ZodDiscriminatedUnion",(e,t)=>{oa.init(e,t),Wc.init(e,t)});function ia(e,t,r){return new Uh({type:"union",options:t,discriminator:e,...y.normalizeParams(r)})}var Ah=p("ZodIntersection",(e,t)=>{Xc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o)});function ho(e,t){return new Ah({type:"intersection",left:e,right:t})}var Ch=p("ZodTuple",(e,t)=>{bi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Mh(e,t,r){let n=t instanceof M,o=n?r:t,i=n?t:null;return new Ch({type:"tuple",items:e,rest:i,...y.normalizeParams(o)})}var aa=p("ZodRecord",(e,t)=>{Yc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function fe(e,t,r){return new aa({type:"record",keyType:e,valueType:t,...y.normalizeParams(r)})}function yx(e,t,r){let n=Ne(e);return n._zod.values=void 0,new aa({type:"record",keyType:n,valueType:t,...y.normalizeParams(r)})}function $x(e,t,r){return new aa({type:"record",keyType:e,valueType:t,mode:"loose",...y.normalizeParams(r)})}var qh=p("ZodMap",(e,t)=>{Qc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hm(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Nt(...r)),e.nonempty=r=>e.check(Nt(1,r)),e.max=(...r)=>e.check(fr(...r)),e.size=(...r)=>e.check(Vr(...r))});function bx(e,t,r){return new qh({type:"map",keyType:e,valueType:t,...y.normalizeParams(r)})}var Lh=p("ZodSet",(e,t)=>{eu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wm(e,r,n,o),e.min=(...r)=>e.check(Nt(...r)),e.nonempty=r=>e.check(Nt(1,r)),e.max=(...r)=>e.check(fr(...r)),e.size=(...r)=>e.check(Vr(...r))});function xx(e,t){return new Lh({type:"set",valueType:e,...y.normalizeParams(t)})}var po=p("ZodEnum",(e,t)=>{tu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Mm(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new po({...t,checks:[],...y.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new po({...t,checks:[],...y.normalizeParams(o),entries:i})}});function Pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new po({type:"enum",entries:r,...y.normalizeParams(t)})}function kx(e,t){return new po({type:"enum",entries:e,...y.normalizeParams(t)})}var Vh=p("ZodLiteral",(e,t)=>{ru.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qm(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function j(e,t){return new Vh({type:"literal",values:Array.isArray(e)?e:[e],...y.normalizeParams(t)})}var Fh=p("ZodFile",(e,t)=>{nu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fm(e,r,n,o),e.min=(r,n)=>e.check(Nt(r,n)),e.max=(r,n)=>e.check(fr(r,n)),e.mime=(r,n)=>e.check(oo(Array.isArray(r)?r:[r],n))});function wx(e){return el(Fh,e)}var Jh=p("ZodTransform",(e,t)=>{ou.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new cr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(y.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(y.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Cl(e){return new Jh({type:"transform",transform:e})}var Ml=p("ZodOptional",(e,t)=>{xi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function me(e){return new Ml({type:"optional",innerType:e})}var Kh=p("ZodExactOptional",(e,t)=>{iu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gh(e){return new Kh({type:"optional",innerType:e})}var Bh=p("ZodNullable",(e,t)=>{au.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wi(e){return new Bh({type:"nullable",innerType:e})}function Sx(e){return me(Wi(e))}var Hh=p("ZodDefault",(e,t)=>{su.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wh(e,t){return new Hh({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():y.shallowClone(t)}})}var Xh=p("ZodPrefault",(e,t)=>{cu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yh(e,t){return new Xh({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():y.shallowClone(t)}})}var ql=p("ZodNonOptional",(e,t)=>{uu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Qh(e,t){return new ql({type:"nonoptional",innerType:e,...y.normalizeParams(t)})}var eg=p("ZodSuccess",(e,t)=>{lu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jm(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zx(e){return new eg({type:"success",innerType:e})}var tg=p("ZodCatch",(e,t)=>{du.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rg(e,t){return new tg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var ng=p("ZodNaN",(e,t)=>{pu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lm(e,r,n,o)});function Ix(e){return Bu(ng,e)}var Ll=p("ZodPipe",(e,t)=>{fu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o),e.in=t.in,e.out=t.out});function Xi(e,t){return new Ll({type:"pipe",in:e,out:t})}var Vl=p("ZodCodec",(e,t)=>{Ll.init(e,t),Hn.init(e,t)});function Px(e,t,r){return new Vl({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var og=p("ZodReadonly",(e,t)=>{mu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ig(e){return new og({type:"readonly",innerType:e})}var ag=p("ZodTemplateLiteral",(e,t)=>{hu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vm(e,r,n,o)});function Tx(e,t){return new ag({type:"template_literal",parts:e,...y.normalizeParams(t)})}var sg=p("ZodLazy",(e,t)=>{_u.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function cg(e){return new sg({type:"lazy",getter:e})}var ug=p("ZodPromise",(e,t)=>{vu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jx(e){return new ug({type:"promise",innerType:e})}var lg=p("ZodFunction",(e,t)=>{gu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o)});function Ex(e){return new lg({type:"function",input:Array.isArray(e?.input)?Mh(e?.input):e?.input??W(le()),output:e?.output??le()})}var sa=p("ZodCustom",(e,t)=>{yu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(e,r,n,o)});function Ox(e){let t=new ce({check:"custom"});return t._zod.check=e,t}function Fl(e,t){return tl(sa,e??(()=>!0),t)}function dg(e,t={}){return rl(sa,e,t)}function pg(e){return nl(e)}var Nx=ol,Dx=il;function Zx(e,t={}){let r=new sa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...y.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Rx=(...e)=>al({Codec:Vl,Boolean:ta,String:Yi},...e);function Ux(e){let t=cg(()=>ae([v(e),oe(),_e(),mo(),W(t),fe(v(),t)]));return t}function ca(e,t){return Xi(Cl(e),t)}var fg;fg||(fg={});var V1={...lo,...Bi,iso:mr};ye($u());var Kl="2025-11-25";var mg=[Kl,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Wt="io.modelcontextprotocol/related-task",la="2.0",$e=Fl(e=>e!==null&&(typeof e=="object"||typeof e=="function")),hg=ae([v(),oe().int()]),gg=v(),cN=Ie({ttl:ae([oe(),mo()]).optional(),pollInterval:oe().optional()}),qx=z({ttl:oe().optional()}),Lx=z({taskId:v()}),Gl=Ie({progressToken:hg.optional(),[Wt]:Lx.optional()}),He=z({_meta:Gl.optional()}),go=He.extend({task:qx.optional()}),vg=e=>go.safeParse(e).success,be=z({method:v(),params:He.loose().optional()}),Qe=z({_meta:Gl.optional()}),et=z({method:v(),params:Qe.loose().optional()}),xe=Ie({_meta:Gl.optional()}),da=ae([v(),oe().int()]),_g=z({jsonrpc:j(la),id:da,...be.shape}).strict(),Bl=e=>_g.safeParse(e).success,yg=z({jsonrpc:j(la),...et.shape}).strict(),$g=e=>yg.safeParse(e).success,Hl=z({jsonrpc:j(la),id:da,result:xe}).strict(),vo=e=>Hl.safeParse(e).success;var Q;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Q||(Q={}));var Wl=z({jsonrpc:j(la),id:da.optional(),error:z({code:oe().int(),message:v(),data:le().optional()})}).strict();var bg=e=>Wl.safeParse(e).success;var xg=ae([_g,yg,Hl,Wl]),uN=ae([Hl,Wl]),pa=xe.strict(),Vx=Qe.extend({requestId:da.optional(),reason:v().optional()}),fa=et.extend({method:j("notifications/cancelled"),params:Vx}),Fx=z({src:v(),mimeType:v().optional(),sizes:W(v()).optional(),theme:Pe(["light","dark"]).optional()}),_o=z({icons:W(Fx).optional()}),Hr=z({name:v(),title:v().optional()}),kg=Hr.extend({...Hr.shape,..._o.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Jx=ho(z({applyDefaults:_e().optional()}),fe(v(),le())),Kx=ca(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ho(z({form:Jx.optional(),url:$e.optional()}),fe(v(),le()).optional())),Gx=Ie({list:$e.optional(),cancel:$e.optional(),requests:Ie({sampling:Ie({createMessage:$e.optional()}).optional(),elicitation:Ie({create:$e.optional()}).optional()}).optional()}),Bx=Ie({list:$e.optional(),cancel:$e.optional(),requests:Ie({tools:Ie({call:$e.optional()}).optional()}).optional()}),Hx=z({experimental:fe(v(),$e).optional(),sampling:z({context:$e.optional(),tools:$e.optional()}).optional(),elicitation:Kx.optional(),roots:z({listChanged:_e().optional()}).optional(),tasks:Gx.optional()}),Wx=He.extend({protocolVersion:v(),capabilities:Hx,clientInfo:kg}),Xl=be.extend({method:j("initialize"),params:Wx});var Xx=z({experimental:fe(v(),$e).optional(),logging:$e.optional(),completions:$e.optional(),prompts:z({listChanged:_e().optional()}).optional(),resources:z({subscribe:_e().optional(),listChanged:_e().optional()}).optional(),tools:z({listChanged:_e().optional()}).optional(),tasks:Bx.optional()}),Yx=xe.extend({protocolVersion:v(),capabilities:Xx,serverInfo:kg,instructions:v().optional()}),Yl=et.extend({method:j("notifications/initialized"),params:Qe.optional()});var ma=be.extend({method:j("ping"),params:He.optional()}),Qx=z({progress:oe(),total:me(oe()),message:me(v())}),ek=z({...Qe.shape,...Qx.shape,progressToken:hg}),ha=et.extend({method:j("notifications/progress"),params:ek}),tk=He.extend({cursor:gg.optional()}),yo=be.extend({params:tk.optional()}),$o=xe.extend({nextCursor:gg.optional()}),rk=Pe(["working","input_required","completed","failed","cancelled"]),bo=z({taskId:v(),status:rk,ttl:ae([oe(),mo()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:me(oe()),statusMessage:me(v())}),Wr=xe.extend({task:bo}),nk=Qe.merge(bo),xo=et.extend({method:j("notifications/tasks/status"),params:nk}),ga=be.extend({method:j("tasks/get"),params:He.extend({taskId:v()})}),va=xe.merge(bo),_a=be.extend({method:j("tasks/result"),params:He.extend({taskId:v()})}),lN=xe.loose(),ya=yo.extend({method:j("tasks/list")}),$a=$o.extend({tasks:W(bo)}),ba=be.extend({method:j("tasks/cancel"),params:He.extend({taskId:v()})}),wg=xe.merge(bo),Sg=z({uri:v(),mimeType:me(v()),_meta:fe(v(),le()).optional()}),zg=Sg.extend({text:v()}),Ql=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ig=Sg.extend({blob:Ql}),ko=Pe(["user","assistant"]),Xr=z({audience:W(ko).optional(),priority:oe().min(0).max(1).optional(),lastModified:mr.datetime({offset:!0}).optional()}),Pg=z({...Hr.shape,..._o.shape,uri:v(),description:me(v()),mimeType:me(v()),annotations:Xr.optional(),_meta:me(Ie({}))}),ok=z({...Hr.shape,..._o.shape,uriTemplate:v(),description:me(v()),mimeType:me(v()),annotations:Xr.optional(),_meta:me(Ie({}))}),ik=yo.extend({method:j("resources/list")}),ak=$o.extend({resources:W(Pg)}),sk=yo.extend({method:j("resources/templates/list")}),ck=$o.extend({resourceTemplates:W(ok)}),ed=He.extend({uri:v()}),uk=ed,lk=be.extend({method:j("resources/read"),params:uk}),dk=xe.extend({contents:W(ae([zg,Ig]))}),pk=et.extend({method:j("notifications/resources/list_changed"),params:Qe.optional()}),fk=ed,mk=be.extend({method:j("resources/subscribe"),params:fk}),hk=ed,gk=be.extend({method:j("resources/unsubscribe"),params:hk}),vk=Qe.extend({uri:v()}),_k=et.extend({method:j("notifications/resources/updated"),params:vk}),yk=z({name:v(),description:me(v()),required:me(_e())}),$k=z({...Hr.shape,..._o.shape,description:me(v()),arguments:me(W(yk)),_meta:me(Ie({}))}),bk=yo.extend({method:j("prompts/list")}),xk=$o.extend({prompts:W($k)}),kk=He.extend({name:v(),arguments:fe(v(),v()).optional()}),wk=be.extend({method:j("prompts/get"),params:kk}),td=z({type:j("text"),text:v(),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),rd=z({type:j("image"),data:Ql,mimeType:v(),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),nd=z({type:j("audio"),data:Ql,mimeType:v(),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),Sk=z({type:j("tool_use"),name:v(),id:v(),input:fe(v(),le()),_meta:fe(v(),le()).optional()}),zk=z({type:j("resource"),resource:ae([zg,Ig]),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),Ik=Pg.extend({type:j("resource_link")}),od=ae([td,rd,nd,Ik,zk]),Pk=z({role:ko,content:od}),Tk=xe.extend({description:v().optional(),messages:W(Pk)}),jk=et.extend({method:j("notifications/prompts/list_changed"),params:Qe.optional()}),Ek=z({title:v().optional(),readOnlyHint:_e().optional(),destructiveHint:_e().optional(),idempotentHint:_e().optional(),openWorldHint:_e().optional()}),Ok=z({taskSupport:Pe(["required","optional","forbidden"]).optional()}),Tg=z({...Hr.shape,..._o.shape,description:v().optional(),inputSchema:z({type:j("object"),properties:fe(v(),$e).optional(),required:W(v()).optional()}).catchall(le()),outputSchema:z({type:j("object"),properties:fe(v(),$e).optional(),required:W(v()).optional()}).catchall(le()).optional(),annotations:Ek.optional(),execution:Ok.optional(),_meta:fe(v(),le()).optional()}),id=yo.extend({method:j("tools/list")}),Nk=$o.extend({tools:W(Tg)}),xa=xe.extend({content:W(od).default([]),structuredContent:fe(v(),le()).optional(),isError:_e().optional()}),dN=xa.or(xe.extend({toolResult:le()})),Dk=go.extend({name:v(),arguments:fe(v(),le()).optional()}),wo=be.extend({method:j("tools/call"),params:Dk}),Zk=et.extend({method:j("notifications/tools/list_changed"),params:Qe.optional()}),pN=z({autoRefresh:_e().default(!0),debounceMs:oe().int().nonnegative().default(300)}),So=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),Rk=He.extend({level:So}),ad=be.extend({method:j("logging/setLevel"),params:Rk}),Uk=Qe.extend({level:So,logger:v().optional(),data:le()}),Ak=et.extend({method:j("notifications/message"),params:Uk}),Ck=z({name:v().optional()}),Mk=z({hints:W(Ck).optional(),costPriority:oe().min(0).max(1).optional(),speedPriority:oe().min(0).max(1).optional(),intelligencePriority:oe().min(0).max(1).optional()}),qk=z({mode:Pe(["auto","required","none"]).optional()}),Lk=z({type:j("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:W(od).default([]),structuredContent:z({}).loose().optional(),isError:_e().optional(),_meta:fe(v(),le()).optional()}),Vk=ia("type",[td,rd,nd]),ua=ia("type",[td,rd,nd,Sk,Lk]),Fk=z({role:ko,content:ae([ua,W(ua)]),_meta:fe(v(),le()).optional()}),Jk=go.extend({messages:W(Fk),modelPreferences:Mk.optional(),systemPrompt:v().optional(),includeContext:Pe(["none","thisServer","allServers"]).optional(),temperature:oe().optional(),maxTokens:oe().int(),stopSequences:W(v()).optional(),metadata:$e.optional(),tools:W(Tg).optional(),toolChoice:qk.optional()}),Kk=be.extend({method:j("sampling/createMessage"),params:Jk}),sd=xe.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens"]).or(v())),role:ko,content:Vk}),cd=xe.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:ko,content:ae([ua,W(ua)])}),Gk=z({type:j("boolean"),title:v().optional(),description:v().optional(),default:_e().optional()}),Bk=z({type:j("string"),title:v().optional(),description:v().optional(),minLength:oe().optional(),maxLength:oe().optional(),format:Pe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Hk=z({type:Pe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:oe().optional(),maximum:oe().optional(),default:oe().optional()}),Wk=z({type:j("string"),title:v().optional(),description:v().optional(),enum:W(v()),default:v().optional()}),Xk=z({type:j("string"),title:v().optional(),description:v().optional(),oneOf:W(z({const:v(),title:v()})),default:v().optional()}),Yk=z({type:j("string"),title:v().optional(),description:v().optional(),enum:W(v()),enumNames:W(v()).optional(),default:v().optional()}),Qk=ae([Wk,Xk]),ew=z({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:z({type:j("string"),enum:W(v())}),default:W(v()).optional()}),tw=z({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:z({anyOf:W(z({const:v(),title:v()}))}),default:W(v()).optional()}),rw=ae([ew,tw]),nw=ae([Yk,Qk,rw]),ow=ae([nw,Gk,Bk,Hk]),iw=go.extend({mode:j("form").optional(),message:v(),requestedSchema:z({type:j("object"),properties:fe(v(),ow),required:W(v()).optional()})}),aw=go.extend({mode:j("url"),message:v(),elicitationId:v(),url:v().url()}),sw=ae([iw,aw]),cw=be.extend({method:j("elicitation/create"),params:sw}),uw=Qe.extend({elicitationId:v()}),lw=et.extend({method:j("notifications/elicitation/complete"),params:uw}),ka=xe.extend({action:Pe(["accept","decline","cancel"]),content:ca(e=>e===null?void 0:e,fe(v(),ae([v(),oe(),_e(),W(v())])).optional())}),dw=z({type:j("ref/resource"),uri:v()});var pw=z({type:j("ref/prompt"),name:v()}),fw=He.extend({ref:ae([pw,dw]),argument:z({name:v(),value:v()}),context:z({arguments:fe(v(),v()).optional()}).optional()}),mw=be.extend({method:j("completion/complete"),params:fw});var hw=xe.extend({completion:Ie({values:W(v()).max(100),total:me(oe().int()),hasMore:me(_e())})}),gw=z({uri:v().startsWith("file://"),name:v().optional(),_meta:fe(v(),le()).optional()}),vw=be.extend({method:j("roots/list"),params:He.optional()}),ud=xe.extend({roots:W(gw)}),_w=et.extend({method:j("notifications/roots/list_changed"),params:Qe.optional()}),fN=ae([ma,Xl,mw,ad,wk,bk,ik,sk,lk,mk,gk,wo,id,ga,_a,ya,ba]),mN=ae([fa,ha,Yl,_w,xo]),hN=ae([pa,sd,cd,ka,ud,va,$a,Wr]),gN=ae([ma,Kk,cw,vw,ga,_a,ya,ba]),vN=ae([fa,ha,Ak,_k,pk,Zk,jk,xo,lw]),_N=ae([pa,Yx,hw,Tk,xk,ak,ck,dk,xa,Nk,va,$a,Wr]),K=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===Q.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Jl(o.elicitations,r)}return new e(t,r,n)}},Jl=class extends K{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Q.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Xt(e){return e==="completed"||e==="failed"||e==="cancelled"}var yw=Symbol("Let zodToJsonSchema decide on which parser to use");var YN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ld(e){let r=Gi(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=fh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function dd(e,t){let r=Ht(e,t);if(!r.success)throw r.error;return r.data}var Sw=6e4,wa=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(fa,r=>{this._oncancel(r)}),this.setNotificationHandler(ha,r=>{this._onprogress(r)}),this.setRequestHandler(ma,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ga,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new K(Q.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(_a,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,m=new K(d.error.code,d.error.message,d.error.data);l(m)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new K(Q.InvalidParams,`Task not found: ${i}`);if(!Xt(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Xt(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[Wt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(ya,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new K(Q.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ba,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new K(Q.InvalidParams,`Task not found: ${r.params.taskId}`);if(Xt(o.status))throw new K(Q.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new K(Q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof K?o:new K(Q.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),K.fromError(Q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),vo(i)||bg(i)?this._onresponse(i):Bl(i)?this._onrequest(i,a):$g(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=K.fromError(Q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[Wt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:Q.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=vg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,m)=>{let f={...m,relatedRequestId:t.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let h=f.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:Q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),vo(t))n(t);else{let a=new K(t.error.code,t.error.message,t.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(vo(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),vo(t))o(t);else{let a=K.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof K?a:new K(Q.InternalError,String(a))}}return}let i;try{let a=await this.request(t,Wr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new K(Q.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},Xt(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new K(Q.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new K(Q.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof K?a:new K(Q.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(P){d(P);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Wt]:c}});let h=P=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(P)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let I=P instanceof K?P:new K(Q.RequestTimeout,String(P));l(I)};this._responseHandlers.set(m,P=>{if(!n?.signal?.aborted){if(P instanceof Error)return l(P);try{let I=Ht(r,P.result);I.success?u(I.data):l(I.error)}catch(I){l(I)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??Sw,$=()=>h(K.fromError(Q.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(m,g,n?.maxTotalTimeout,$,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let P=I=>{let A=this._responseHandlers.get(m);A?A(I):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,P),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(m),l(I)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(P=>{this._cleanupTimeout(m),l(P)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},va,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},$a,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},wg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Wt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Wt]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Wt]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=ld(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=dd(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=ld(t);this._notificationHandlers.set(n,o=>{let i=dd(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Bl(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new K(Q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new K(Q.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new K(Q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new K(Q.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=xo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Xt(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new K(Q.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Xt(s.status))throw new K(Q.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=xo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Xt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function jg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Eg(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];jg(a)&&jg(i)?r[o]={...a,...i}:r[o]=i}return r}var vy=vs(Wp(),1),_y=vs(gy(),1);function hT(){let e=new vy.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,_y.default)(e),e}var ss=class{constructor(t){this._ajv=t??hT()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var cs=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function yy(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function $y(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var us=class extends wa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(So.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new ss,this.setRequestHandler(Xl,n=>this._oninitialize(n)),this.setNotificationHandler(Yl,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(ad,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=So.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new cs(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Eg(this._capabilities,t)}setRequestHandler(t,r){let o=Gi(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Gr(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Ht(wo,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new K(Q.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let h=Ht(Wr,m);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new K(Q.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let f=Ht(xa,m);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new K(Q.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){$y(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&yy(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:mg.includes(r)?r:Kl,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},pa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},cd,r):this.request({method:"sampling/createMessage",params:t},sd,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},ka,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},ka,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new K(Q.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof K?a:new K(Q.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},ud,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var of=vs(require("node:process"),1);var ls=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
47
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function Ki(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let m=e.seen.get(l),f=m.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(f.$ref)for(let g in c)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(c[g])===JSON.stringify(m.def[g])&&delete c[g]}let d=a._zod.parent;if(d&&d!==l){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let f in c)f==="$ref"||f==="allOf"||f in m.def&&JSON.stringify(c[f])===JSON.stringify(m.def[f])&&delete c[f]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:uo(t,"input",e.processors),output:uo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Re(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Re(n.element,r);if(n.type==="set")return Re(n.valueType,r);if(n.type==="lazy")return Re(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Re(n.innerType,r);if(n.type==="intersection")return Re(n.left,r)||Re(n.right,r);if(n.type==="record"||n.type==="map")return Re(n.keyType,r)||Re(n.valueType,r);if(n.type==="pipe")return Re(n.in,r)||Re(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Re(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Re(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Re(o,r))return!0;return!!(n.rest&&Re(n.rest,r))}return!1}var Im=(e,t={})=>r=>{let n=Fi({...r,processors:t});return pe(e,n),Ji(n,e),Ki(n,e)},uo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Fi({...o??{},target:i,io:t,processors:r});return pe(e,a),Ji(a,e),Ki(a,e)};var hb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Pm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=hb[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Tm=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},jm=(e,t,r,n)=>{r.type="boolean"},Em=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Om=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Nm=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Dm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Zm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Rm=(e,t,r,n)=>{r.not={}},Um=(e,t,r,n)=>{},Am=(e,t,r,n)=>{},Cm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Mm=(e,t,r,n)=>{let o=e._zod.def,i=En(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},qm=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Lm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Vm=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Fm=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},Jm=(e,t,r,n)=>{r.type="boolean"},Km=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Gm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Bm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Hm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Wm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Xm=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=pe(i.element,t,{...n,path:[...n.path,"items"]})},Ym=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=pe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=pe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},sl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>pe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Qm=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=pe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},eh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,f)=>pe(m,t,{...n,path:[...n.path,a,f]})),u=i.rest?pe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},th=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=pe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=pe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=pe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},rh=(e,t,r,n)=>{let o=e._zod.def,i=pe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},nh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},oh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},ih=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},ah=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},sh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;pe(i,t,n);let a=t.seen.get(e);a.ref=i},ch=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},uh=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},cl=(e,t,r,n)=>{let o=e._zod.def;pe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},lh=(e,t,r,n)=>{let o=e._zod.innerType;pe(o,t,n);let i=t.seen.get(e);i.ref=o};function Gr(e){return!!e._zod}function Ht(e,t){return Gr(e)?Lr(e,t):e.safeParse(t)}function Gi(e){if(!e)return;let t;if(Gr(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function fh(e){if(Gr(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var lo={};vn(lo,{ZodAny:()=>Eh,ZodArray:()=>Zh,ZodBase64:()=>Ol,ZodBase64URL:()=>Nl,ZodBigInt:()=>ra,ZodBigIntFormat:()=>Rl,ZodBoolean:()=>ta,ZodCIDRv4:()=>jl,ZodCIDRv6:()=>El,ZodCUID:()=>kl,ZodCUID2:()=>wl,ZodCatch:()=>tg,ZodCodec:()=>Vl,ZodCustom:()=>sa,ZodCustomStringFormat:()=>fo,ZodDate:()=>Al,ZodDefault:()=>Hh,ZodDiscriminatedUnion:()=>Uh,ZodE164:()=>Dl,ZodEmail:()=>$l,ZodEmoji:()=>bl,ZodEnum:()=>po,ZodExactOptional:()=>Kh,ZodFile:()=>Fh,ZodFunction:()=>lg,ZodGUID:()=>Hi,ZodIPv4:()=>Pl,ZodIPv6:()=>Tl,ZodIntersection:()=>Ah,ZodJWT:()=>Zl,ZodKSUID:()=>Il,ZodLazy:()=>sg,ZodLiteral:()=>Vh,ZodMAC:()=>Ih,ZodMap:()=>qh,ZodNaN:()=>ng,ZodNanoID:()=>xl,ZodNever:()=>Nh,ZodNonOptional:()=>ql,ZodNull:()=>jh,ZodNullable:()=>Bh,ZodNumber:()=>ea,ZodNumberFormat:()=>Br,ZodObject:()=>na,ZodOptional:()=>Ml,ZodPipe:()=>Ll,ZodPrefault:()=>Xh,ZodPromise:()=>ug,ZodReadonly:()=>og,ZodRecord:()=>aa,ZodSet:()=>Lh,ZodString:()=>Yi,ZodStringFormat:()=>ue,ZodSuccess:()=>eg,ZodSymbol:()=>Ph,ZodTemplateLiteral:()=>ag,ZodTransform:()=>Jh,ZodTuple:()=>Ch,ZodType:()=>F,ZodULID:()=>Sl,ZodURL:()=>Qi,ZodUUID:()=>Dt,ZodUndefined:()=>Th,ZodUnion:()=>oa,ZodUnknown:()=>Oh,ZodVoid:()=>Dh,ZodXID:()=>zl,ZodXor:()=>Rh,_ZodString:()=>yl,_default:()=>Wh,_function:()=>Ex,any:()=>fx,array:()=>W,base64:()=>Wb,base64url:()=>Xb,bigint:()=>cx,boolean:()=>_e,catch:()=>rg,check:()=>Ox,cidrv4:()=>Bb,cidrv6:()=>Hb,codec:()=>Px,cuid:()=>Mb,cuid2:()=>qb,custom:()=>Fl,date:()=>hx,describe:()=>Nx,discriminatedUnion:()=>ia,e164:()=>Yb,email:()=>jb,emoji:()=>Ab,enum:()=>Pe,exactOptional:()=>Gh,file:()=>wx,float32:()=>ox,float64:()=>ix,function:()=>Ex,guid:()=>Eb,hash:()=>nx,hex:()=>rx,hostname:()=>tx,httpUrl:()=>Ub,instanceof:()=>Zx,int:()=>_l,int32:()=>ax,int64:()=>ux,intersection:()=>ho,ipv4:()=>Jb,ipv6:()=>Gb,json:()=>Ux,jwt:()=>Qb,keyof:()=>gx,ksuid:()=>Fb,lazy:()=>cg,literal:()=>j,looseObject:()=>Ie,looseRecord:()=>$x,mac:()=>Kb,map:()=>bx,meta:()=>Dx,nan:()=>Ix,nanoid:()=>Cb,nativeEnum:()=>kx,never:()=>Ul,nonoptional:()=>Qh,null:()=>mo,nullable:()=>Wi,nullish:()=>Sx,number:()=>oe,object:()=>z,optional:()=>me,partialRecord:()=>yx,pipe:()=>Xi,prefault:()=>Yh,preprocess:()=>ca,promise:()=>jx,readonly:()=>ig,record:()=>fe,refine:()=>dg,set:()=>xx,strictObject:()=>vx,string:()=>v,stringFormat:()=>ex,stringbool:()=>Rx,success:()=>zx,superRefine:()=>pg,symbol:()=>dx,templateLiteral:()=>Tx,transform:()=>Cl,tuple:()=>Mh,uint32:()=>sx,uint64:()=>lx,ulid:()=>Lb,undefined:()=>px,union:()=>ae,unknown:()=>le,url:()=>Rb,uuid:()=>Ob,uuidv4:()=>Nb,uuidv6:()=>Db,uuidv7:()=>Zb,void:()=>mx,xid:()=>Vb,xor:()=>_x});var Bi={};vn(Bi,{endsWith:()=>no,gt:()=>Ot,gte:()=>Ze,includes:()=>to,length:()=>Jr,lowercase:()=>Qn,lt:()=>Et,lte:()=>Ge,maxLength:()=>Fr,maxSize:()=>fr,mime:()=>oo,minLength:()=>Bt,minSize:()=>Nt,multipleOf:()=>pr,negative:()=>Wu,nonnegative:()=>Yu,nonpositive:()=>Xu,normalize:()=>io,overwrite:()=>yt,positive:()=>Hu,property:()=>Qu,regex:()=>Yn,size:()=>Vr,slugify:()=>Vi,startsWith:()=>ro,toLowerCase:()=>so,toUpperCase:()=>co,trim:()=>ao,uppercase:()=>eo});var mr={};vn(mr,{ZodISODate:()=>pl,ZodISODateTime:()=>ll,ZodISODuration:()=>gl,ZodISOTime:()=>ml,date:()=>fl,datetime:()=>dl,duration:()=>vl,time:()=>hl});var ll=p("ZodISODateTime",(e,t)=>{wc.init(e,t),ue.init(e,t)});function dl(e){return zu(ll,e)}var pl=p("ZodISODate",(e,t)=>{Sc.init(e,t),ue.init(e,t)});function fl(e){return Iu(pl,e)}var ml=p("ZodISOTime",(e,t)=>{zc.init(e,t),ue.init(e,t)});function hl(e){return Pu(ml,e)}var gl=p("ZodISODuration",(e,t)=>{Ic.init(e,t),ue.init(e,t)});function vl(e){return Tu(gl,e)}var mh=(e,t)=>{ci.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>li(e,r)},flatten:{value:r=>ui(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Cr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Cr,2)}},isEmpty:{get(){return e.issues.length===0}}})},Z1=p("ZodError",mh),Be=p("ZodError",mh,{Parent:Error});var hh=Un(Be),gh=Cn(Be),vh=qn(Be),_h=Ln(Be),yh=Pf(Be),$h=Tf(Be),bh=jf(Be),xh=Ef(Be),kh=Of(Be),wh=Nf(Be),Sh=Df(Be),zh=Zf(Be);var F=p("ZodType",(e,t)=>(M.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:uo(e,"input"),output:uo(e,"output")}}),e.toJSONSchema=Im(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone($.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Ne(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>hh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>vh(e,r,n),e.parseAsync=async(r,n)=>gh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>_h(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>yh(e,r,n),e.decode=(r,n)=>$h(e,r,n),e.encodeAsync=async(r,n)=>bh(e,r,n),e.decodeAsync=async(r,n)=>xh(e,r,n),e.safeEncode=(r,n)=>kh(e,r,n),e.safeDecode=(r,n)=>wh(e,r,n),e.safeEncodeAsync=async(r,n)=>Sh(e,r,n),e.safeDecodeAsync=async(r,n)=>zh(e,r,n),e.refine=(r,n)=>e.check(dg(r,n)),e.superRefine=r=>e.check(pg(r)),e.overwrite=r=>e.check(yt(r)),e.optional=()=>me(e),e.exactOptional=()=>Gh(e),e.nullable=()=>Wi(e),e.nullish=()=>me(Wi(e)),e.nonoptional=r=>Qh(e,r),e.array=()=>W(e),e.or=r=>ae([e,r]),e.and=r=>ho(e,r),e.transform=r=>Xi(e,Cl(r)),e.default=r=>Wh(e,r),e.prefault=r=>Yh(e,r),e.catch=r=>rg(e,r),e.pipe=r=>Xi(e,r),e.readonly=()=>ig(e),e.describe=r=>{let n=e.clone();return De.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return De.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return De.get(e);let n=e.clone();return De.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),yl=p("_ZodString",(e,t)=>{dr.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Pm(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Yn(...n)),e.includes=(...n)=>e.check(to(...n)),e.startsWith=(...n)=>e.check(ro(...n)),e.endsWith=(...n)=>e.check(no(...n)),e.min=(...n)=>e.check(Bt(...n)),e.max=(...n)=>e.check(Fr(...n)),e.length=(...n)=>e.check(Jr(...n)),e.nonempty=(...n)=>e.check(Bt(1,...n)),e.lowercase=n=>e.check(Qn(n)),e.uppercase=n=>e.check(eo(n)),e.trim=()=>e.check(ao()),e.normalize=(...n)=>e.check(io(...n)),e.toLowerCase=()=>e.check(so()),e.toUpperCase=()=>e.check(co()),e.slugify=()=>e.check(Vi())}),Yi=p("ZodString",(e,t)=>{dr.init(e,t),yl.init(e,t),e.email=r=>e.check(ki($l,r)),e.url=r=>e.check(Xn(Qi,r)),e.jwt=r=>e.check(Li(Zl,r)),e.emoji=r=>e.check(Pi(bl,r)),e.guid=r=>e.check(Wn(Hi,r)),e.uuid=r=>e.check(wi(Dt,r)),e.uuidv4=r=>e.check(Si(Dt,r)),e.uuidv6=r=>e.check(zi(Dt,r)),e.uuidv7=r=>e.check(Ii(Dt,r)),e.nanoid=r=>e.check(Ti(xl,r)),e.guid=r=>e.check(Wn(Hi,r)),e.cuid=r=>e.check(ji(kl,r)),e.cuid2=r=>e.check(Ei(wl,r)),e.ulid=r=>e.check(Oi(Sl,r)),e.base64=r=>e.check(Ci(Ol,r)),e.base64url=r=>e.check(Mi(Nl,r)),e.xid=r=>e.check(Ni(zl,r)),e.ksuid=r=>e.check(Di(Il,r)),e.ipv4=r=>e.check(Zi(Pl,r)),e.ipv6=r=>e.check(Ri(Tl,r)),e.cidrv4=r=>e.check(Ui(jl,r)),e.cidrv6=r=>e.check(Ai(El,r)),e.e164=r=>e.check(qi(Dl,r)),e.datetime=r=>e.check(dl(r)),e.date=r=>e.check(fl(r)),e.time=r=>e.check(hl(r)),e.duration=r=>e.check(vl(r))});function v(e){return wu(Yi,e)}var ue=p("ZodStringFormat",(e,t)=>{ie.init(e,t),yl.init(e,t)}),$l=p("ZodEmail",(e,t)=>{hc.init(e,t),ue.init(e,t)});function jb(e){return ki($l,e)}var Hi=p("ZodGUID",(e,t)=>{fc.init(e,t),ue.init(e,t)});function Eb(e){return Wn(Hi,e)}var Dt=p("ZodUUID",(e,t)=>{mc.init(e,t),ue.init(e,t)});function Ob(e){return wi(Dt,e)}function Nb(e){return Si(Dt,e)}function Db(e){return zi(Dt,e)}function Zb(e){return Ii(Dt,e)}var Qi=p("ZodURL",(e,t)=>{gc.init(e,t),ue.init(e,t)});function Rb(e){return Xn(Qi,e)}function Ub(e){return Xn(Qi,{protocol:/^https?$/,hostname:Ye.domain,...$.normalizeParams(e)})}var bl=p("ZodEmoji",(e,t)=>{vc.init(e,t),ue.init(e,t)});function Ab(e){return Pi(bl,e)}var xl=p("ZodNanoID",(e,t)=>{_c.init(e,t),ue.init(e,t)});function Cb(e){return Ti(xl,e)}var kl=p("ZodCUID",(e,t)=>{yc.init(e,t),ue.init(e,t)});function Mb(e){return ji(kl,e)}var wl=p("ZodCUID2",(e,t)=>{$c.init(e,t),ue.init(e,t)});function qb(e){return Ei(wl,e)}var Sl=p("ZodULID",(e,t)=>{bc.init(e,t),ue.init(e,t)});function Lb(e){return Oi(Sl,e)}var zl=p("ZodXID",(e,t)=>{xc.init(e,t),ue.init(e,t)});function Vb(e){return Ni(zl,e)}var Il=p("ZodKSUID",(e,t)=>{kc.init(e,t),ue.init(e,t)});function Fb(e){return Di(Il,e)}var Pl=p("ZodIPv4",(e,t)=>{Pc.init(e,t),ue.init(e,t)});function Jb(e){return Zi(Pl,e)}var Ih=p("ZodMAC",(e,t)=>{jc.init(e,t),ue.init(e,t)});function Kb(e){return Su(Ih,e)}var Tl=p("ZodIPv6",(e,t)=>{Tc.init(e,t),ue.init(e,t)});function Gb(e){return Ri(Tl,e)}var jl=p("ZodCIDRv4",(e,t)=>{Ec.init(e,t),ue.init(e,t)});function Bb(e){return Ui(jl,e)}var El=p("ZodCIDRv6",(e,t)=>{Oc.init(e,t),ue.init(e,t)});function Hb(e){return Ai(El,e)}var Ol=p("ZodBase64",(e,t)=>{Nc.init(e,t),ue.init(e,t)});function Wb(e){return Ci(Ol,e)}var Nl=p("ZodBase64URL",(e,t)=>{Dc.init(e,t),ue.init(e,t)});function Xb(e){return Mi(Nl,e)}var Dl=p("ZodE164",(e,t)=>{Zc.init(e,t),ue.init(e,t)});function Yb(e){return qi(Dl,e)}var Zl=p("ZodJWT",(e,t)=>{Rc.init(e,t),ue.init(e,t)});function Qb(e){return Li(Zl,e)}var fo=p("ZodCustomStringFormat",(e,t)=>{Uc.init(e,t),ue.init(e,t)});function ex(e,t,r={}){return Kr(fo,e,t,r)}function tx(e){return Kr(fo,"hostname",Ye.hostname,e)}function rx(e){return Kr(fo,"hex",Ye.hex,e)}function nx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Ye[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Kr(fo,n,o,t)}var ea=p("ZodNumber",(e,t)=>{yi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Tm(e,n,o,i),e.gt=(n,o)=>e.check(Ot(n,o)),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.lt=(n,o)=>e.check(Et(n,o)),e.lte=(n,o)=>e.check(Ge(n,o)),e.max=(n,o)=>e.check(Ge(n,o)),e.int=n=>e.check(_l(n)),e.safe=n=>e.check(_l(n)),e.positive=n=>e.check(Ot(0,n)),e.nonnegative=n=>e.check(Ze(0,n)),e.negative=n=>e.check(Et(0,n)),e.nonpositive=n=>e.check(Ge(0,n)),e.multipleOf=(n,o)=>e.check(pr(n,o)),e.step=(n,o)=>e.check(pr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function oe(e){return ju(ea,e)}var Br=p("ZodNumberFormat",(e,t)=>{Ac.init(e,t),ea.init(e,t)});function _l(e){return Eu(Br,e)}function ox(e){return Ou(Br,e)}function ix(e){return Nu(Br,e)}function ax(e){return Du(Br,e)}function sx(e){return Zu(Br,e)}var ta=p("ZodBoolean",(e,t)=>{Gn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jm(e,r,n,o)});function _e(e){return Ru(ta,e)}var ra=p("ZodBigInt",(e,t)=>{$i.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Em(e,n,o,i),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.gt=(n,o)=>e.check(Ot(n,o)),e.gte=(n,o)=>e.check(Ze(n,o)),e.min=(n,o)=>e.check(Ze(n,o)),e.lt=(n,o)=>e.check(Et(n,o)),e.lte=(n,o)=>e.check(Ge(n,o)),e.max=(n,o)=>e.check(Ge(n,o)),e.positive=n=>e.check(Ot(BigInt(0),n)),e.negative=n=>e.check(Et(BigInt(0),n)),e.nonpositive=n=>e.check(Ge(BigInt(0),n)),e.nonnegative=n=>e.check(Ze(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(pr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function cx(e){return Uu(ra,e)}var Rl=p("ZodBigIntFormat",(e,t)=>{Cc.init(e,t),ra.init(e,t)});function ux(e){return Au(Rl,e)}function lx(e){return Cu(Rl,e)}var Ph=p("ZodSymbol",(e,t)=>{Mc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Om(e,r,n,o)});function dx(e){return Mu(Ph,e)}var Th=p("ZodUndefined",(e,t)=>{qc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dm(e,r,n,o)});function px(e){return qu(Th,e)}var jh=p("ZodNull",(e,t)=>{Lc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nm(e,r,n,o)});function mo(e){return Lu(jh,e)}var Eh=p("ZodAny",(e,t)=>{Vc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Um(e,r,n,o)});function fx(){return Vu(Eh)}var Oh=p("ZodUnknown",(e,t)=>{Fc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Am(e,r,n,o)});function le(){return Fu(Oh)}var Nh=p("ZodNever",(e,t)=>{Jc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rm(e,r,n,o)});function Ul(e){return Ju(Nh,e)}var Dh=p("ZodVoid",(e,t)=>{Kc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zm(e,r,n,o)});function mx(e){return Ku(Dh,e)}var Al=p("ZodDate",(e,t)=>{Gc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Cm(e,n,o,i),e.min=(n,o)=>e.check(Ze(n,o)),e.max=(n,o)=>e.check(Ge(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function hx(e){return Gu(Al,e)}var Zh=p("ZodArray",(e,t)=>{Bc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Bt(r,n)),e.nonempty=r=>e.check(Bt(1,r)),e.max=(r,n)=>e.check(Fr(r,n)),e.length=(r,n)=>e.check(Jr(r,n)),e.unwrap=()=>e.element});function W(e,t){return zm(Zh,e,t)}function gx(e){let t=e._zod.def.shape;return Pe(Object.keys(t))}var na=p("ZodObject",(e,t)=>{xm.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o),$.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:le()}),e.loose=()=>e.clone({...e._zod.def,catchall:le()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ul()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>$.extend(e,r),e.safeExtend=r=>$.safeExtend(e,r),e.merge=r=>$.merge(e,r),e.pick=r=>$.pick(e,r),e.omit=r=>$.omit(e,r),e.partial=(...r)=>$.partial(Ml,e,r[0]),e.required=(...r)=>$.required(ql,e,r[0])});function z(e,t){let r={type:"object",shape:e??{},...$.normalizeParams(t)};return new na(r)}function vx(e,t){return new na({type:"object",shape:e,catchall:Ul(),...$.normalizeParams(t)})}function Ie(e,t){return new na({type:"object",shape:e,catchall:le(),...$.normalizeParams(t)})}var oa=p("ZodUnion",(e,t)=>{Bn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sl(e,r,n,o),e.options=t.options});function ae(e,t){return new oa({type:"union",options:e,...$.normalizeParams(t)})}var Rh=p("ZodXor",(e,t)=>{oa.init(e,t),Hc.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sl(e,r,n,o),e.options=t.options});function _x(e,t){return new Rh({type:"union",options:e,inclusive:!1,...$.normalizeParams(t)})}var Uh=p("ZodDiscriminatedUnion",(e,t)=>{oa.init(e,t),Wc.init(e,t)});function ia(e,t,r){return new Uh({type:"union",options:t,discriminator:e,...$.normalizeParams(r)})}var Ah=p("ZodIntersection",(e,t)=>{Xc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o)});function ho(e,t){return new Ah({type:"intersection",left:e,right:t})}var Ch=p("ZodTuple",(e,t)=>{bi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Mh(e,t,r){let n=t instanceof M,o=n?r:t,i=n?t:null;return new Ch({type:"tuple",items:e,rest:i,...$.normalizeParams(o)})}var aa=p("ZodRecord",(e,t)=>{Yc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function fe(e,t,r){return new aa({type:"record",keyType:e,valueType:t,...$.normalizeParams(r)})}function yx(e,t,r){let n=Ne(e);return n._zod.values=void 0,new aa({type:"record",keyType:n,valueType:t,...$.normalizeParams(r)})}function $x(e,t,r){return new aa({type:"record",keyType:e,valueType:t,mode:"loose",...$.normalizeParams(r)})}var qh=p("ZodMap",(e,t)=>{Qc.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hm(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Nt(...r)),e.nonempty=r=>e.check(Nt(1,r)),e.max=(...r)=>e.check(fr(...r)),e.size=(...r)=>e.check(Vr(...r))});function bx(e,t,r){return new qh({type:"map",keyType:e,valueType:t,...$.normalizeParams(r)})}var Lh=p("ZodSet",(e,t)=>{eu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wm(e,r,n,o),e.min=(...r)=>e.check(Nt(...r)),e.nonempty=r=>e.check(Nt(1,r)),e.max=(...r)=>e.check(fr(...r)),e.size=(...r)=>e.check(Vr(...r))});function xx(e,t){return new Lh({type:"set",valueType:e,...$.normalizeParams(t)})}var po=p("ZodEnum",(e,t)=>{tu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Mm(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new po({...t,checks:[],...$.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new po({...t,checks:[],...$.normalizeParams(o),entries:i})}});function Pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new po({type:"enum",entries:r,...$.normalizeParams(t)})}function kx(e,t){return new po({type:"enum",entries:e,...$.normalizeParams(t)})}var Vh=p("ZodLiteral",(e,t)=>{ru.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qm(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function j(e,t){return new Vh({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(t)})}var Fh=p("ZodFile",(e,t)=>{nu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fm(e,r,n,o),e.min=(r,n)=>e.check(Nt(r,n)),e.max=(r,n)=>e.check(fr(r,n)),e.mime=(r,n)=>e.check(oo(Array.isArray(r)?r:[r],n))});function wx(e){return el(Fh,e)}var Jh=p("ZodTransform",(e,t)=>{ou.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new cr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push($.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push($.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Cl(e){return new Jh({type:"transform",transform:e})}var Ml=p("ZodOptional",(e,t)=>{xi.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function me(e){return new Ml({type:"optional",innerType:e})}var Kh=p("ZodExactOptional",(e,t)=>{iu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Gh(e){return new Kh({type:"optional",innerType:e})}var Bh=p("ZodNullable",(e,t)=>{au.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wi(e){return new Bh({type:"nullable",innerType:e})}function Sx(e){return me(Wi(e))}var Hh=p("ZodDefault",(e,t)=>{su.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wh(e,t){return new Hh({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var Xh=p("ZodPrefault",(e,t)=>{cu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yh(e,t){return new Xh({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():$.shallowClone(t)}})}var ql=p("ZodNonOptional",(e,t)=>{uu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Qh(e,t){return new ql({type:"nonoptional",innerType:e,...$.normalizeParams(t)})}var eg=p("ZodSuccess",(e,t)=>{lu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jm(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zx(e){return new eg({type:"success",innerType:e})}var tg=p("ZodCatch",(e,t)=>{du.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rg(e,t){return new tg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var ng=p("ZodNaN",(e,t)=>{pu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lm(e,r,n,o)});function Ix(e){return Bu(ng,e)}var Ll=p("ZodPipe",(e,t)=>{fu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o),e.in=t.in,e.out=t.out});function Xi(e,t){return new Ll({type:"pipe",in:e,out:t})}var Vl=p("ZodCodec",(e,t)=>{Ll.init(e,t),Hn.init(e,t)});function Px(e,t,r){return new Vl({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var og=p("ZodReadonly",(e,t)=>{mu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ig(e){return new og({type:"readonly",innerType:e})}var ag=p("ZodTemplateLiteral",(e,t)=>{hu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vm(e,r,n,o)});function Tx(e,t){return new ag({type:"template_literal",parts:e,...$.normalizeParams(t)})}var sg=p("ZodLazy",(e,t)=>{_u.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function cg(e){return new sg({type:"lazy",getter:e})}var ug=p("ZodPromise",(e,t)=>{vu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jx(e){return new ug({type:"promise",innerType:e})}var lg=p("ZodFunction",(e,t)=>{gu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o)});function Ex(e){return new lg({type:"function",input:Array.isArray(e?.input)?Mh(e?.input):e?.input??W(le()),output:e?.output??le()})}var sa=p("ZodCustom",(e,t)=>{yu.init(e,t),F.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(e,r,n,o)});function Ox(e){let t=new ce({check:"custom"});return t._zod.check=e,t}function Fl(e,t){return tl(sa,e??(()=>!0),t)}function dg(e,t={}){return rl(sa,e,t)}function pg(e){return nl(e)}var Nx=ol,Dx=il;function Zx(e,t={}){let r=new sa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...$.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Rx=(...e)=>al({Codec:Vl,Boolean:ta,String:Yi},...e);function Ux(e){let t=cg(()=>ae([v(e),oe(),_e(),mo(),W(t),fe(v(),t)]));return t}function ca(e,t){return Xi(Cl(e),t)}var fg;fg||(fg={});var V1={...lo,...Bi,iso:mr};ye($u());var Kl="2025-11-25";var mg=[Kl,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Wt="io.modelcontextprotocol/related-task",la="2.0",$e=Fl(e=>e!==null&&(typeof e=="object"||typeof e=="function")),hg=ae([v(),oe().int()]),gg=v(),cN=Ie({ttl:ae([oe(),mo()]).optional(),pollInterval:oe().optional()}),qx=z({ttl:oe().optional()}),Lx=z({taskId:v()}),Gl=Ie({progressToken:hg.optional(),[Wt]:Lx.optional()}),He=z({_meta:Gl.optional()}),go=He.extend({task:qx.optional()}),vg=e=>go.safeParse(e).success,be=z({method:v(),params:He.loose().optional()}),Qe=z({_meta:Gl.optional()}),et=z({method:v(),params:Qe.loose().optional()}),xe=Ie({_meta:Gl.optional()}),da=ae([v(),oe().int()]),_g=z({jsonrpc:j(la),id:da,...be.shape}).strict(),Bl=e=>_g.safeParse(e).success,yg=z({jsonrpc:j(la),...et.shape}).strict(),$g=e=>yg.safeParse(e).success,Hl=z({jsonrpc:j(la),id:da,result:xe}).strict(),vo=e=>Hl.safeParse(e).success;var Q;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Q||(Q={}));var Wl=z({jsonrpc:j(la),id:da.optional(),error:z({code:oe().int(),message:v(),data:le().optional()})}).strict();var bg=e=>Wl.safeParse(e).success;var xg=ae([_g,yg,Hl,Wl]),uN=ae([Hl,Wl]),pa=xe.strict(),Vx=Qe.extend({requestId:da.optional(),reason:v().optional()}),fa=et.extend({method:j("notifications/cancelled"),params:Vx}),Fx=z({src:v(),mimeType:v().optional(),sizes:W(v()).optional(),theme:Pe(["light","dark"]).optional()}),_o=z({icons:W(Fx).optional()}),Hr=z({name:v(),title:v().optional()}),kg=Hr.extend({...Hr.shape,..._o.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Jx=ho(z({applyDefaults:_e().optional()}),fe(v(),le())),Kx=ca(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ho(z({form:Jx.optional(),url:$e.optional()}),fe(v(),le()).optional())),Gx=Ie({list:$e.optional(),cancel:$e.optional(),requests:Ie({sampling:Ie({createMessage:$e.optional()}).optional(),elicitation:Ie({create:$e.optional()}).optional()}).optional()}),Bx=Ie({list:$e.optional(),cancel:$e.optional(),requests:Ie({tools:Ie({call:$e.optional()}).optional()}).optional()}),Hx=z({experimental:fe(v(),$e).optional(),sampling:z({context:$e.optional(),tools:$e.optional()}).optional(),elicitation:Kx.optional(),roots:z({listChanged:_e().optional()}).optional(),tasks:Gx.optional()}),Wx=He.extend({protocolVersion:v(),capabilities:Hx,clientInfo:kg}),Xl=be.extend({method:j("initialize"),params:Wx});var Xx=z({experimental:fe(v(),$e).optional(),logging:$e.optional(),completions:$e.optional(),prompts:z({listChanged:_e().optional()}).optional(),resources:z({subscribe:_e().optional(),listChanged:_e().optional()}).optional(),tools:z({listChanged:_e().optional()}).optional(),tasks:Bx.optional()}),Yx=xe.extend({protocolVersion:v(),capabilities:Xx,serverInfo:kg,instructions:v().optional()}),Yl=et.extend({method:j("notifications/initialized"),params:Qe.optional()});var ma=be.extend({method:j("ping"),params:He.optional()}),Qx=z({progress:oe(),total:me(oe()),message:me(v())}),ek=z({...Qe.shape,...Qx.shape,progressToken:hg}),ha=et.extend({method:j("notifications/progress"),params:ek}),tk=He.extend({cursor:gg.optional()}),yo=be.extend({params:tk.optional()}),$o=xe.extend({nextCursor:gg.optional()}),rk=Pe(["working","input_required","completed","failed","cancelled"]),bo=z({taskId:v(),status:rk,ttl:ae([oe(),mo()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:me(oe()),statusMessage:me(v())}),Wr=xe.extend({task:bo}),nk=Qe.merge(bo),xo=et.extend({method:j("notifications/tasks/status"),params:nk}),ga=be.extend({method:j("tasks/get"),params:He.extend({taskId:v()})}),va=xe.merge(bo),_a=be.extend({method:j("tasks/result"),params:He.extend({taskId:v()})}),lN=xe.loose(),ya=yo.extend({method:j("tasks/list")}),$a=$o.extend({tasks:W(bo)}),ba=be.extend({method:j("tasks/cancel"),params:He.extend({taskId:v()})}),wg=xe.merge(bo),Sg=z({uri:v(),mimeType:me(v()),_meta:fe(v(),le()).optional()}),zg=Sg.extend({text:v()}),Ql=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ig=Sg.extend({blob:Ql}),ko=Pe(["user","assistant"]),Xr=z({audience:W(ko).optional(),priority:oe().min(0).max(1).optional(),lastModified:mr.datetime({offset:!0}).optional()}),Pg=z({...Hr.shape,..._o.shape,uri:v(),description:me(v()),mimeType:me(v()),annotations:Xr.optional(),_meta:me(Ie({}))}),ok=z({...Hr.shape,..._o.shape,uriTemplate:v(),description:me(v()),mimeType:me(v()),annotations:Xr.optional(),_meta:me(Ie({}))}),ik=yo.extend({method:j("resources/list")}),ak=$o.extend({resources:W(Pg)}),sk=yo.extend({method:j("resources/templates/list")}),ck=$o.extend({resourceTemplates:W(ok)}),ed=He.extend({uri:v()}),uk=ed,lk=be.extend({method:j("resources/read"),params:uk}),dk=xe.extend({contents:W(ae([zg,Ig]))}),pk=et.extend({method:j("notifications/resources/list_changed"),params:Qe.optional()}),fk=ed,mk=be.extend({method:j("resources/subscribe"),params:fk}),hk=ed,gk=be.extend({method:j("resources/unsubscribe"),params:hk}),vk=Qe.extend({uri:v()}),_k=et.extend({method:j("notifications/resources/updated"),params:vk}),yk=z({name:v(),description:me(v()),required:me(_e())}),$k=z({...Hr.shape,..._o.shape,description:me(v()),arguments:me(W(yk)),_meta:me(Ie({}))}),bk=yo.extend({method:j("prompts/list")}),xk=$o.extend({prompts:W($k)}),kk=He.extend({name:v(),arguments:fe(v(),v()).optional()}),wk=be.extend({method:j("prompts/get"),params:kk}),td=z({type:j("text"),text:v(),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),rd=z({type:j("image"),data:Ql,mimeType:v(),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),nd=z({type:j("audio"),data:Ql,mimeType:v(),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),Sk=z({type:j("tool_use"),name:v(),id:v(),input:fe(v(),le()),_meta:fe(v(),le()).optional()}),zk=z({type:j("resource"),resource:ae([zg,Ig]),annotations:Xr.optional(),_meta:fe(v(),le()).optional()}),Ik=Pg.extend({type:j("resource_link")}),od=ae([td,rd,nd,Ik,zk]),Pk=z({role:ko,content:od}),Tk=xe.extend({description:v().optional(),messages:W(Pk)}),jk=et.extend({method:j("notifications/prompts/list_changed"),params:Qe.optional()}),Ek=z({title:v().optional(),readOnlyHint:_e().optional(),destructiveHint:_e().optional(),idempotentHint:_e().optional(),openWorldHint:_e().optional()}),Ok=z({taskSupport:Pe(["required","optional","forbidden"]).optional()}),Tg=z({...Hr.shape,..._o.shape,description:v().optional(),inputSchema:z({type:j("object"),properties:fe(v(),$e).optional(),required:W(v()).optional()}).catchall(le()),outputSchema:z({type:j("object"),properties:fe(v(),$e).optional(),required:W(v()).optional()}).catchall(le()).optional(),annotations:Ek.optional(),execution:Ok.optional(),_meta:fe(v(),le()).optional()}),id=yo.extend({method:j("tools/list")}),Nk=$o.extend({tools:W(Tg)}),xa=xe.extend({content:W(od).default([]),structuredContent:fe(v(),le()).optional(),isError:_e().optional()}),dN=xa.or(xe.extend({toolResult:le()})),Dk=go.extend({name:v(),arguments:fe(v(),le()).optional()}),wo=be.extend({method:j("tools/call"),params:Dk}),Zk=et.extend({method:j("notifications/tools/list_changed"),params:Qe.optional()}),pN=z({autoRefresh:_e().default(!0),debounceMs:oe().int().nonnegative().default(300)}),So=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),Rk=He.extend({level:So}),ad=be.extend({method:j("logging/setLevel"),params:Rk}),Uk=Qe.extend({level:So,logger:v().optional(),data:le()}),Ak=et.extend({method:j("notifications/message"),params:Uk}),Ck=z({name:v().optional()}),Mk=z({hints:W(Ck).optional(),costPriority:oe().min(0).max(1).optional(),speedPriority:oe().min(0).max(1).optional(),intelligencePriority:oe().min(0).max(1).optional()}),qk=z({mode:Pe(["auto","required","none"]).optional()}),Lk=z({type:j("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:W(od).default([]),structuredContent:z({}).loose().optional(),isError:_e().optional(),_meta:fe(v(),le()).optional()}),Vk=ia("type",[td,rd,nd]),ua=ia("type",[td,rd,nd,Sk,Lk]),Fk=z({role:ko,content:ae([ua,W(ua)]),_meta:fe(v(),le()).optional()}),Jk=go.extend({messages:W(Fk),modelPreferences:Mk.optional(),systemPrompt:v().optional(),includeContext:Pe(["none","thisServer","allServers"]).optional(),temperature:oe().optional(),maxTokens:oe().int(),stopSequences:W(v()).optional(),metadata:$e.optional(),tools:W(Tg).optional(),toolChoice:qk.optional()}),Kk=be.extend({method:j("sampling/createMessage"),params:Jk}),sd=xe.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens"]).or(v())),role:ko,content:Vk}),cd=xe.extend({model:v(),stopReason:me(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:ko,content:ae([ua,W(ua)])}),Gk=z({type:j("boolean"),title:v().optional(),description:v().optional(),default:_e().optional()}),Bk=z({type:j("string"),title:v().optional(),description:v().optional(),minLength:oe().optional(),maxLength:oe().optional(),format:Pe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Hk=z({type:Pe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:oe().optional(),maximum:oe().optional(),default:oe().optional()}),Wk=z({type:j("string"),title:v().optional(),description:v().optional(),enum:W(v()),default:v().optional()}),Xk=z({type:j("string"),title:v().optional(),description:v().optional(),oneOf:W(z({const:v(),title:v()})),default:v().optional()}),Yk=z({type:j("string"),title:v().optional(),description:v().optional(),enum:W(v()),enumNames:W(v()).optional(),default:v().optional()}),Qk=ae([Wk,Xk]),ew=z({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:z({type:j("string"),enum:W(v())}),default:W(v()).optional()}),tw=z({type:j("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:z({anyOf:W(z({const:v(),title:v()}))}),default:W(v()).optional()}),rw=ae([ew,tw]),nw=ae([Yk,Qk,rw]),ow=ae([nw,Gk,Bk,Hk]),iw=go.extend({mode:j("form").optional(),message:v(),requestedSchema:z({type:j("object"),properties:fe(v(),ow),required:W(v()).optional()})}),aw=go.extend({mode:j("url"),message:v(),elicitationId:v(),url:v().url()}),sw=ae([iw,aw]),cw=be.extend({method:j("elicitation/create"),params:sw}),uw=Qe.extend({elicitationId:v()}),lw=et.extend({method:j("notifications/elicitation/complete"),params:uw}),ka=xe.extend({action:Pe(["accept","decline","cancel"]),content:ca(e=>e===null?void 0:e,fe(v(),ae([v(),oe(),_e(),W(v())])).optional())}),dw=z({type:j("ref/resource"),uri:v()});var pw=z({type:j("ref/prompt"),name:v()}),fw=He.extend({ref:ae([pw,dw]),argument:z({name:v(),value:v()}),context:z({arguments:fe(v(),v()).optional()}).optional()}),mw=be.extend({method:j("completion/complete"),params:fw});var hw=xe.extend({completion:Ie({values:W(v()).max(100),total:me(oe().int()),hasMore:me(_e())})}),gw=z({uri:v().startsWith("file://"),name:v().optional(),_meta:fe(v(),le()).optional()}),vw=be.extend({method:j("roots/list"),params:He.optional()}),ud=xe.extend({roots:W(gw)}),_w=et.extend({method:j("notifications/roots/list_changed"),params:Qe.optional()}),fN=ae([ma,Xl,mw,ad,wk,bk,ik,sk,lk,mk,gk,wo,id,ga,_a,ya,ba]),mN=ae([fa,ha,Yl,_w,xo]),hN=ae([pa,sd,cd,ka,ud,va,$a,Wr]),gN=ae([ma,Kk,cw,vw,ga,_a,ya,ba]),vN=ae([fa,ha,Ak,_k,pk,Zk,jk,xo,lw]),_N=ae([pa,Yx,hw,Tk,xk,ak,ck,dk,xa,Nk,va,$a,Wr]),K=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===Q.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Jl(o.elicitations,r)}return new e(t,r,n)}},Jl=class extends K{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Q.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Xt(e){return e==="completed"||e==="failed"||e==="cancelled"}var yw=Symbol("Let zodToJsonSchema decide on which parser to use");var YN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ld(e){let r=Gi(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=fh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function dd(e,t){let r=Ht(e,t);if(!r.success)throw r.error;return r.data}var Sw=6e4,wa=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(fa,r=>{this._oncancel(r)}),this.setNotificationHandler(ha,r=>{this._onprogress(r)}),this.setRequestHandler(ma,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ga,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new K(Q.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(_a,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,m=new K(d.error.code,d.error.message,d.error.data);l(m)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new K(Q.InvalidParams,`Task not found: ${i}`);if(!Xt(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Xt(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[Wt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(ya,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new K(Q.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ba,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new K(Q.InvalidParams,`Task not found: ${r.params.taskId}`);if(Xt(o.status))throw new K(Q.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new K(Q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof K?o:new K(Q.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),K.fromError(Q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),vo(i)||bg(i)?this._onresponse(i):Bl(i)?this._onrequest(i,a):$g(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=K.fromError(Q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[Wt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:Q.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=vg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,m)=>{let f={...m,relatedRequestId:t.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let h=f.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:Q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),vo(t))n(t);else{let a=new K(t.error.code,t.error.message,t.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(vo(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),vo(t))o(t);else{let a=K.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof K?a:new K(Q.InternalError,String(a))}}return}let i;try{let a=await this.request(t,Wr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new K(Q.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},Xt(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new K(Q.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new K(Q.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof K?a:new K(Q.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(P){d(P);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Wt]:c}});let h=P=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(P)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(A=>this._onerror(new Error(`Failed to send cancellation: ${A}`)));let I=P instanceof K?P:new K(Q.RequestTimeout,String(P));l(I)};this._responseHandlers.set(m,P=>{if(!n?.signal?.aborted){if(P instanceof Error)return l(P);try{let I=Ht(r,P.result);I.success?u(I.data):l(I.error)}catch(I){l(I)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??Sw,y=()=>h(K.fromError(Q.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(m,g,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let P=I=>{let A=this._responseHandlers.get(m);A?A(I):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,P),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(I=>{this._cleanupTimeout(m),l(I)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(P=>{this._cleanupTimeout(m),l(P)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},va,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},$a,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},wg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Wt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Wt]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Wt]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=ld(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=dd(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=ld(t);this._notificationHandlers.set(n,o=>{let i=dd(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&Bl(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new K(Q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new K(Q.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new K(Q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new K(Q.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=xo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Xt(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new K(Q.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Xt(s.status))throw new K(Q.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=xo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Xt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function jg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Eg(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];jg(a)&&jg(i)?r[o]={...a,...i}:r[o]=i}return r}var vy=vs(Wp(),1),_y=vs(gy(),1);function hT(){let e=new vy.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,_y.default)(e),e}var ss=class{constructor(t){this._ajv=t??hT()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var cs=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function yy(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function $y(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var us=class extends wa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(So.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new ss,this.setRequestHandler(Xl,n=>this._oninitialize(n)),this.setNotificationHandler(Yl,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(ad,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=So.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new cs(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Eg(this._capabilities,t)}setRequestHandler(t,r){let o=Gi(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Gr(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Ht(wo,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new K(Q.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let h=Ht(Wr,m);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new K(Q.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let f=Ht(xa,m);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new K(Q.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){$y(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&yy(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:mg.includes(r)?r:Kl,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},pa)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},cd,r):this.request({method:"sampling/createMessage",params:t},sd,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},ka,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},ka,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new K(Q.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof K?a:new K(Q.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},ud,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var of=vs(require("node:process"),1);var ls=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
48
48
  `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),gT(r)}clear(){this._buffer=void 0}};function gT(e){return xg.parse(JSON.parse(e))}function by(e){return JSON.stringify(e)+`
49
- `}var ds=class{constructor(t=of.default.stdin,r=of.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new ls,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=by(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var vT="https://api.lexic.io/api";function xy(){let e=process.env.LEXIC_API_URL||vT,t=process.env.LEXIC_PAT;if(!t)throw new Error("LEXIC_PAT is required");if(!t.startsWith("pat_"))throw new Error("LEXIC_PAT must start with pat_");return{apiUrl:e,pat:t,logLevel:process.env.LOG_LEVEL||"info"}}var af={debug:0,info:1,warn:2,error:3},sf=class{level="info";setLevel(t){af[t]!==void 0&&(this.level=t)}getLevel(){return this.level}shouldLog(t){return af[t]>=af[this.level]}format(t,r,n){let i=`[${new Date().toISOString()}] [${t.toUpperCase()}] ${r}`;if(n){let a={...n};return"pat"in a&&(a.pat="[REDACTED]"),"token"in a&&(a.token="[REDACTED]"),"authorization"in a&&(a.authorization="[REDACTED]"),`${i} ${JSON.stringify(a)}`}return i}debug(t,r){this.shouldLog("debug")&&console.error(this.format("debug",t,r))}info(t,r){this.shouldLog("info")&&console.error(this.format("info",t,r))}warn(t,r){this.shouldLog("warn")&&console.error(this.format("warn",t,r))}error(t,r){this.shouldLog("error")&&console.error(this.format("error",t,r))}},L=new sf;var hn=class extends Error{statusCode;correlationId;constructor(t,r,n){super(t),this.statusCode=r,this.correlationId=n,this.name="LexicApiError"}};var _T=3e4,ky=1,yT=1e3;function wy(e){let{apiUrl:t,pat:r}=e,n=null;function o(){return{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}}async function i(a,s,c=ky){let u=new AbortController,l=setTimeout(()=>u.abort(),_T);try{let d=await fetch(a,{...s,signal:u.signal,headers:{...o(),...s.headers}});if(clearTimeout(l),d.status>=500&&c>0){let m=yT*Math.pow(2,ky-c);return L.debug("Retrying request after server error",{url:a,status:d.status,delay:m,retriesLeft:c-1}),await $T(m),i(a,s,c-1)}return d}catch(d){throw clearTimeout(l),d instanceof Error&&d.name==="AbortError"?new hn("Request timeout",408):d}}return{async executeTool(a,s){try{L.debug("Executing tool via API",{toolName:a,args:s});let c=await i(`${t}/mcp/execute`,{method:"POST",body:JSON.stringify({tool:a,arguments:s})}),u=await c.json();return c.ok?{success:u.success??!0,data:u.data,error:u.error}:{success:!1,error:u.error||`Tool execution failed with status ${c.status}`}}catch(c){return L.error("Tool execution failed",{toolName:a,error:c instanceof Error?c.message:String(c)}),{success:!1,error:c instanceof Error?c.message:"Unknown error"}}},async validateConnection(){try{let a=await fetch(`${t}/auth/validate`,{method:"GET",headers:o()}),s=await a.json();return a.ok?(n={valid:s.valid??!0,lexiconId:s.lexiconId,userId:s.userId,isUserScoped:s.isUserScoped??!s.lexiconId},n):(n={valid:!1,isUserScoped:!1,error:s.error||"Authentication failed"},n)}catch(a){return n={valid:!1,isUserScoped:!1,error:`Network error: ${a instanceof Error?a.message:String(a)}`},n}},async fetchTriggers(a){let s=new URL(`${t}/mcp/triggers`);a!==void 0&&s.searchParams.set("since",a.toString());try{let c=await i(s.toString(),{method:"GET",headers:{Accept:"application/json","Accept-Encoding":"gzip"}});if(!c.ok)throw L.warn("Failed to fetch triggers",{status:c.status,statusText:c.statusText}),new hn(`HTTP ${c.status}`,c.status);return await c.json()}catch(c){throw L.error("Trigger fetch error",{error:c instanceof Error?c.message:String(c)}),c}},async fetchDomains(a){let s=new URL(`${t}/mcp/domains`);a!==void 0&&s.searchParams.set("since",a.toString());try{let c=await i(s.toString(),{method:"GET",headers:{Accept:"application/json","Accept-Encoding":"gzip"}});if(!c.ok)throw L.warn("Failed to fetch domains",{status:c.status,statusText:c.statusText}),new hn(`HTTP ${c.status}`,c.status);return await c.json()}catch(c){throw L.error("Domain fetch error",{error:c instanceof Error?c.message:String(c)}),c}},isUserScoped(){return n?.isUserScoped??!1},getCurrentLexiconId(){return n?.lexiconId}}}function $T(e){return new Promise(t=>setTimeout(t,e))}var bT="Search the project knowledge base for relevant information. Use this to find decisions, context, or documentation about a topic.";function Sy(e,t={}){return{name:"knowledge_query",description:t.description||bT,inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query - can be natural language or keywords"},limit:{type:"number",description:"Maximum results to return (default: 5, max: 20)"},filter:{type:"object",description:"Optional filters",properties:{tags:{type:"array",items:{type:"string"}},dateFrom:{type:"string",format:"date"},dateTo:{type:"string",format:"date"}}}},required:["query"]},handler:async r=>e.executeTool("knowledge_query",r)}}var xT="Store new knowledge in the project knowledge base. Use this to save decisions, findings, or important context.";function zy(e,t={}){return{name:"knowledge_store",description:t.description||xT,inputSchema:{type:"object",properties:{content:{type:"string",description:"The content to store (markdown supported)"},title:{type:"string",description:"Optional title for the note"},template:{type:"string",description:"Optional template to use (e.g., 'decision', 'finding')"},variables:{type:"object",description:"Variables to fill in template"}},required:["content"]},handler:async r=>e.executeTool("knowledge_store",r)}}var kT="Get comprehensive context about a feature or topic. Returns relevant decisions, status, and related information aggregated into a summary.";function Iy(e,t={}){return{name:"knowledge_get_context",description:t.description||kT,inputSchema:{type:"object",properties:{topic:{type:"string",description:"The feature, component, or topic to get context for"},depth:{type:"string",enum:["brief","standard","comprehensive"],description:"How much context to retrieve (default: standard)"}},required:["topic"]},handler:async r=>e.executeTool("knowledge_get_context",r)}}var wT="Create a new project (lexicon) for knowledge management. Optionally seed with domain-specific initial structure.",ST="List all accessible projects (lexicons)",zT="Get information about the current project (lexicon)";function Py(e,t={}){return{name:"lexic_create_project",description:t.description||wT,inputSchema:{type:"object",properties:{name:{type:"string",description:'Project name (e.g., "lexic-mcp", "Q1 Planning")'},description:{type:"string",description:"Optional project description"},domain:{type:"string",description:'Optional domain to seed initial notes (e.g., "development")'}},required:["name"]},handler:async r=>e.executeTool("lexic_create_project",r)}}function Ty(e,t={}){return{name:"lexic_list_projects",description:t.description||ST,inputSchema:{type:"object",properties:{},required:[]},handler:async r=>e.executeTool("lexic_list_projects",r)}}function jy(e,t={}){return{name:"lexic_get_project_info",description:t.description||zT,inputSchema:{type:"object",properties:{},required:[]},handler:async r=>e.executeTool("lexic_get_project_info",r)}}function ps(e,t){let r=[e.base_description];if(t?.inputSchema?.properties){r.push(""),r.push("**Parameters:**");let n=t.inputSchema.properties,o=t.inputSchema.required||[];for(let[i,a]of Object.entries(n)){let s=a,c=o.includes(i),u=IT(s),l=s.description||"",d=s.default!==void 0?` (default: ${JSON.stringify(s.default)})`:"";r.push(`- \`${i}\` ${c?"(required)":"(optional)"}: ${u}${d}${l?" - "+l:""}`)}}if(e.triggers?.length>0&&(r.push(""),r.push("TRIGGERS: "+e.triggers.map(n=>`"${n}"`).join(", "))),e.proactive_triggers?.length>0&&(r.push(""),r.push("PROACTIVE: Use when "+e.proactive_triggers.join("; "))),e.do_not_use?.length>0&&(r.push(""),r.push("AVOID: "+e.do_not_use.join("; "))),e.differentiators&&Object.keys(e.differentiators).length>0){r.push("");for(let[n,o]of Object.entries(e.differentiators))r.push(`VS ${n}: ${o}`)}if(e.examples?.length){r.push(""),r.push("**Examples:**");for(let n of e.examples.slice(0,3))r.push(`- User: "${n.user_message}"`),n.explanation&&r.push(` \u2192 ${n.explanation}`)}return r.join(`
50
- `).trim()}function IT(e){let t=e.type;if(t==="array")return`${e.items?.type||"any"}[]`;if(t==="string"&&e.enum)return e.enum.map(n=>`"${n}"`).join(" | ");if(t==="number"||t==="integer"){let r=[];return e.minimum!==void 0&&r.push(`min: ${e.minimum}`),e.maximum!==void 0&&r.push(`max: ${e.maximum}`),r.length?`${t} (${r.join(", ")})`:t}return t||"any"}function cf(e,t,r){let n=[];for(let[o,i]of Object.entries(e)){L.debug("Creating tools for domain",{domain:o,toolCount:i.tools.length});for(let a of i.tools){let s=t[a.name],c=s?ps(s,a):a.description;n.push({name:a.name,description:c,inputSchema:a.inputSchema,handler:async u=>{let l=await r.executeTool(a.name,u);if(!l.success)throw new Error(l.error||"Tool execution failed");return l.data}}),L.debug("Created dynamic tool",{name:a.name,domain:o,hasEnhancedDescription:!!s})}}return L.info("Domain tools created",{total:n.length,domains:Object.keys(e)}),n}function Ey(){return{knowledge_query:{tool_name:"knowledge_query",domain:null,base_description:"Search the knowledge base for relevant information.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},knowledge_store:{tool_name:"knowledge_store",domain:null,base_description:"Save information to the knowledge base.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},knowledge_get_context:{tool_name:"knowledge_get_context",domain:null,base_description:"Get synthesized context about a topic.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},lexic_create_project:{tool_name:"lexic_create_project",domain:null,base_description:"Create a new project.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},lexic_list_projects:{tool_name:"lexic_list_projects",domain:null,base_description:"List available projects.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},lexic_get_project_info:{tool_name:"lexic_get_project_info",domain:null,base_description:"Get current project information.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},dev_log_decision:{tool_name:"dev_log_decision",domain:"development",base_description:"Record a technical decision.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},dev_get_feature_context:{tool_name:"dev_get_feature_context",domain:"development",base_description:"Get development context for a feature.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0}}}var PT=5*60*1e3,TT=1e4,ht=null;async function Oy(e){let t=Date.now();if(ht&&t-ht.fetchedAt<PT)return ht.data;try{let r=new Promise((o,i)=>{setTimeout(()=>i(new Error("Trigger fetch timeout")),TT)}),n=await Promise.race([e.fetchTriggers(ht?.version),r]);return n.unchanged&&ht?(L.debug("Triggers unchanged, refreshing TTL"),ht.fetchedAt=t,ht.data):(L.info("Triggers loaded",{count:Object.keys(n.triggers).length,version:n.version}),ht={data:n.triggers,fetchedAt:t,version:n.version},ht.data)}catch(r){return ht?(L.warn("API error, using cached triggers",{error:r instanceof Error?r.message:String(r)}),ht.data):(L.warn("API error, using default triggers",{error:r instanceof Error?r.message:String(r)}),Ey())}}function Ny(){return{development:{name:"development",description:"Tools for software development knowledge management",version:"1.0.0",tools:[{name:"dev_log_decision",description:"Record an architectural or technical decision with full context.",inputSchema:{type:"object",properties:{feature:{type:"string",description:"The feature or component this decision relates to"},decision:{type:"string",description:"What was decided"},rationale:{type:"string",description:"Why this choice was made"},alternatives:{type:"array",items:{type:"object",properties:{option:{type:"string"},whyRejected:{type:"string"}}},description:"Other options considered and why they were rejected"},revisitIf:{type:"string",description:"Conditions that would trigger reconsidering this decision"}},required:["feature","decision","rationale"]}},{name:"dev_get_feature_context",description:"Get comprehensive development context for a specific feature or component.",inputSchema:{type:"object",properties:{feature:{type:"string",description:'The feature name (e.g., "entity-system", "billing", "auth")'}},required:["feature"]}}]}}}var jT=5*60*1e3,ET=1e4,gt=null;async function uf(e){let t=Date.now();if(gt&&t-gt.fetchedAt<jT)return gt.data;try{let r=new Promise((o,i)=>{setTimeout(()=>i(new Error("Domain fetch timeout")),ET)}),n=await Promise.race([e.fetchDomains(gt?.version),r]);return n.unchanged&&gt?(L.debug("Domains unchanged, refreshing TTL"),gt.fetchedAt=t,gt.data):(L.info("Domains loaded",{count:Object.keys(n.domains).length,version:n.version}),gt={data:n.domains,fetchedAt:t,version:n.version},gt.data)}catch(r){return gt?(L.warn("API error, using cached domains",{error:r instanceof Error?r.message:String(r)}),gt.data):(L.warn("API error, using default domains",{error:r instanceof Error?r.message:String(r)}),Ny())}}async function OT(){let e=xy();L.setLevel(e.logLevel),L.info("Starting Lexic MCP Server");let t=wy(e),r=await t.validateConnection();r.valid||(L.error("Failed to connect to Lexic",{error:r.error}),process.exit(1)),L.info("Connected to Lexic",{lexiconId:r.lexiconId,isUserScoped:r.isUserScoped}),L.info("Loading domains and triggers...");let n={},o={},i=!1;try{[n,o]=await Promise.all([uf(t),Oy(t)]),L.info("Loaded configuration",{domains:Object.keys(n).length,triggers:Object.keys(o).length})}catch(h){i=!0,L.warn("Failed to load dynamic configuration, starting in degraded mode",{error:h instanceof Error?h.message:String(h)});try{n=await uf(t),L.info("Loaded domains only (triggers unavailable)",{domains:Object.keys(n).length})}catch(g){L.error("Failed to load domains - cannot start server",{error:g instanceof Error?g.message:String(g)}),process.exit(1)}}i&&L.warn("Running in DEGRADED MODE - tool descriptions may be less helpful");let a=h=>{let g=o[h];return g?ps(g):void 0},s=new us({name:"lexic-mcp",version:"0.1.0"},{capabilities:{tools:{}}}),c=new Map,u=Sy(t,{description:a("knowledge_query")}),l=zy(t,{description:a("knowledge_store")}),d=Iy(t,{description:a("knowledge_get_context")});if(c.set(u.name,u),c.set(l.name,l),c.set(d.name,d),L.debug("Registered core tools",{tools:[u.name,l.name,d.name]}),t.isUserScoped()){let h=Py(t,{description:a("lexic_create_project")}),g=Ty(t,{description:a("lexic_list_projects")}),$=jy(t,{description:a("lexic_get_project_info")});c.set(h.name,h),c.set(g.name,g),c.set($.name,$),L.debug("Registered admin tools",{tools:[h.name,g.name,$.name]})}else L.debug("Skipping admin tools (PAT is lexicon-scoped)");let m=cf(n,o,t);for(let h of m)c.set(h.name,h);L.debug("Registered domain tools",{count:m.length,tools:m.map(h=>h.name)}),s.setRequestHandler(id,async()=>({tools:Array.from(c.values()).map(h=>({name:h.name,description:h.description,inputSchema:h.inputSchema}))})),s.setRequestHandler(wo,async h=>{let{name:g,arguments:$}=h.params,b=c.get(g);if(!b)return{content:[{type:"text",text:`Unknown tool: ${g}`}],isError:!0};try{L.debug("Executing tool",{name:g,args:$});let P=await b.handler($||{});return L.debug("Tool executed successfully",{name:g}),{content:[{type:"text",text:typeof P=="string"?P:JSON.stringify(P,null,2)}]}}catch(P){let I=P instanceof Error?P.message:String(P);return L.error("Tool execution failed",{name:g,error:I}),{content:[{type:"text",text:`Error: ${I}`}],isError:!0}}});let f=new ds;await s.connect(f),L.info("Lexic MCP Server running",{toolCount:c.size,tools:Array.from(c.keys())})}OT().catch(e=>{L.error("Fatal error",{error:e instanceof Error?e.message:String(e)}),process.exit(1)});
49
+ `}var ds=class{constructor(t=of.default.stdin,r=of.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new ls,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=by(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var vT="https://app.lexic.io/api";function xy(){let e=process.env.LEXIC_API_URL||vT,t=process.env.LEXIC_PAT;if(!t)throw new Error("LEXIC_PAT is required");if(!t.startsWith("pat_"))throw new Error("LEXIC_PAT must start with pat_");return{apiUrl:e,pat:t,logLevel:process.env.LOG_LEVEL||"info"}}var af={debug:0,info:1,warn:2,error:3},sf=class{level="info";setLevel(t){af[t]!==void 0&&(this.level=t)}getLevel(){return this.level}shouldLog(t){return af[t]>=af[this.level]}format(t,r,n){let i=`[${new Date().toISOString()}] [${t.toUpperCase()}] ${r}`;if(n){let a={...n};return"pat"in a&&(a.pat="[REDACTED]"),"token"in a&&(a.token="[REDACTED]"),"authorization"in a&&(a.authorization="[REDACTED]"),`${i} ${JSON.stringify(a)}`}return i}debug(t,r){this.shouldLog("debug")&&console.error(this.format("debug",t,r))}info(t,r){this.shouldLog("info")&&console.error(this.format("info",t,r))}warn(t,r){this.shouldLog("warn")&&console.error(this.format("warn",t,r))}error(t,r){this.shouldLog("error")&&console.error(this.format("error",t,r))}},q=new sf;var hn=class extends Error{statusCode;correlationId;constructor(t,r,n){super(t),this.statusCode=r,this.correlationId=n,this.name="LexicApiError"}};var _T=3e4,ky=1,yT=1e3;function wy(e){let{apiUrl:t,pat:r}=e,n=null;function o(){return{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}}async function i(a,s,c=ky){let u=new AbortController,l=setTimeout(()=>u.abort(),_T);try{let d=await fetch(a,{...s,signal:u.signal,headers:{...o(),...s.headers}});if(clearTimeout(l),d.status>=500&&c>0){let m=yT*Math.pow(2,ky-c);return q.debug("Retrying request after server error",{url:a,status:d.status,delay:m,retriesLeft:c-1}),await $T(m),i(a,s,c-1)}return d}catch(d){throw clearTimeout(l),d instanceof Error&&d.name==="AbortError"?new hn("Request timeout",408):d}}return{async executeTool(a,s){try{q.debug("Executing tool via API",{toolName:a,args:s});let c=await i(`${t}/mcp/execute`,{method:"POST",body:JSON.stringify({tool:a,arguments:s})}),u=await c.json();return c.ok?{success:u.success??!0,data:u.data,error:u.error}:{success:!1,error:u.error||`Tool execution failed with status ${c.status}`}}catch(c){return q.error("Tool execution failed",{toolName:a,error:c instanceof Error?c.message:String(c)}),{success:!1,error:c instanceof Error?c.message:"Unknown error"}}},async validateConnection(){try{let a=await fetch(`${t}/auth/validate`,{method:"GET",headers:o()}),s=await a.json();return a.ok?(n={valid:s.valid??!0,lexiconId:s.lexiconId,userId:s.userId,isUserScoped:s.isUserScoped??!s.lexiconId,expiresAt:s.expiresAt?new Date(s.expiresAt):null},n):(n={valid:!1,isUserScoped:!1,error:s.error||"Authentication failed"},n)}catch(a){return n={valid:!1,isUserScoped:!1,error:`Network error: ${a instanceof Error?a.message:String(a)}`},n}},async fetchTriggers(a){let s=new URL(`${t}/mcp/triggers`);a!==void 0&&s.searchParams.set("since",a.toString());try{let c=await i(s.toString(),{method:"GET",headers:{Accept:"application/json","Accept-Encoding":"gzip"}});if(!c.ok)throw q.warn("Failed to fetch triggers",{status:c.status,statusText:c.statusText}),new hn(`HTTP ${c.status}`,c.status);return await c.json()}catch(c){throw q.error("Trigger fetch error",{error:c instanceof Error?c.message:String(c)}),c}},async fetchDomains(a){let s=new URL(`${t}/mcp/domains`);a!==void 0&&s.searchParams.set("since",a.toString());try{let c=await i(s.toString(),{method:"GET",headers:{Accept:"application/json","Accept-Encoding":"gzip"}});if(!c.ok)throw q.warn("Failed to fetch domains",{status:c.status,statusText:c.statusText}),new hn(`HTTP ${c.status}`,c.status);return await c.json()}catch(c){throw q.error("Domain fetch error",{error:c instanceof Error?c.message:String(c)}),c}},isUserScoped(){return n?.isUserScoped??!1},getCurrentLexiconId(){return n?.lexiconId},getExpiresAt(){return n?.expiresAt}}}function $T(e){return new Promise(t=>setTimeout(t,e))}var bT="Search the project knowledge base for relevant information. Use this to find decisions, context, or documentation about a topic.";function Sy(e,t={}){return{name:"knowledge_query",description:t.description||bT,inputSchema:{type:"object",properties:{query:{type:"string",description:"Search query - can be natural language or keywords"},limit:{type:"number",description:"Maximum results to return (default: 5, max: 20)"},filter:{type:"object",description:"Optional filters for narrowing results",properties:{tags:{type:"array",items:{type:"string"},description:"Filter by AI-assigned tags"},entities:{type:"array",items:{type:"string"},description:"Filter by extracted entities (people, systems, concepts)"},classification:{type:"string",description:"Filter by classification category"},dateFrom:{type:"string",format:"date"},dateTo:{type:"string",format:"date"}}}},required:["query"]},handler:async r=>e.executeTool("knowledge_query",r)}}var xT="Store new knowledge in the project knowledge base. Use this to save decisions, findings, or important context.";function zy(e,t={}){return{name:"knowledge_store",description:t.description||xT,inputSchema:{type:"object",properties:{content:{type:"string",description:"The content to store (markdown supported)"},title:{type:"string",description:"Optional title for the note"},template:{type:"string",description:"Optional template to use (e.g., 'decision', 'finding')"},variables:{type:"object",description:"Variables to fill in template"}},required:["content"]},handler:async r=>{let n=await e.executeTool("knowledge_store",r);if(!n.success)throw new Error(n.error||"Failed to store knowledge");return`\u2713 Stored: "${n.data?.title||r.title||"Untitled"}"`}}}var kT="Get comprehensive context about a feature or topic. Returns relevant decisions, status, and related information aggregated into a summary.";function Iy(e,t={}){return{name:"knowledge_get_context",description:t.description||kT,inputSchema:{type:"object",properties:{topic:{type:"string",description:"The feature, component, or topic to get context for"},depth:{type:"string",enum:["brief","standard","comprehensive"],description:"How much context to retrieve (default: standard)"}},required:["topic"]},handler:async r=>e.executeTool("knowledge_get_context",r)}}var wT="Create a new project (lexicon) for knowledge management. Optionally seed with domain-specific initial structure.",ST="List all accessible projects (lexicons)",zT="Get information about the current project (lexicon)";function Py(e,t={}){return{name:"lexic_create_project",description:t.description||wT,inputSchema:{type:"object",properties:{name:{type:"string",description:'Project name (e.g., "lexic-mcp", "Q1 Planning")'},description:{type:"string",description:"Optional project description"},domain:{type:"string",description:'Optional domain to seed initial notes (e.g., "development")'}},required:["name"]},handler:async r=>{let n=await e.executeTool("lexic_create_project",r);if(!n.success)throw new Error(n.error||"Failed to create project");let o=n.data,i=o?.name||r.name,a=o?.seededNotes?` (seeded with ${o.seededNotes} notes)`:"";return`\u2713 Created project: "${i}"${a}`}}}function Ty(e,t={}){return{name:"lexic_list_projects",description:t.description||ST,inputSchema:{type:"object",properties:{},required:[]},handler:async r=>e.executeTool("lexic_list_projects",r)}}function jy(e,t={}){return{name:"lexic_get_project_info",description:t.description||zT,inputSchema:{type:"object",properties:{},required:[]},handler:async r=>e.executeTool("lexic_get_project_info",r)}}function ps(e,t){let r=[e.base_description];if(t?.inputSchema?.properties){r.push(""),r.push("**Parameters:**");let n=t.inputSchema.properties,o=t.inputSchema.required||[];for(let[i,a]of Object.entries(n)){let s=a,c=o.includes(i),u=IT(s),l=s.description||"",d=s.default!==void 0?` (default: ${JSON.stringify(s.default)})`:"";r.push(`- \`${i}\` ${c?"(required)":"(optional)"}: ${u}${d}${l?" - "+l:""}`)}}if(e.triggers?.length>0&&(r.push(""),r.push("TRIGGERS: "+e.triggers.map(n=>`"${n}"`).join(", "))),e.proactive_triggers?.length>0&&(r.push(""),r.push("PROACTIVE: Use when "+e.proactive_triggers.join("; "))),e.do_not_use?.length>0&&(r.push(""),r.push("AVOID: "+e.do_not_use.join("; "))),e.differentiators&&Object.keys(e.differentiators).length>0){r.push("");for(let[n,o]of Object.entries(e.differentiators))r.push(`VS ${n}: ${o}`)}if(e.examples?.length){r.push(""),r.push("**Examples:**");for(let n of e.examples.slice(0,3))r.push(`- User: "${n.user_message}"`),n.explanation&&r.push(` \u2192 ${n.explanation}`)}return r.join(`
50
+ `).trim()}function IT(e){let t=e.type;if(t==="array")return`${e.items?.type||"any"}[]`;if(t==="string"&&e.enum)return e.enum.map(n=>`"${n}"`).join(" | ");if(t==="number"||t==="integer"){let r=[];return e.minimum!==void 0&&r.push(`min: ${e.minimum}`),e.maximum!==void 0&&r.push(`max: ${e.maximum}`),r.length?`${t} (${r.join(", ")})`:t}return t||"any"}function cf(e,t,r){let n=[];for(let[o,i]of Object.entries(e)){q.debug("Creating tools for domain",{domain:o,toolCount:i.tools.length});for(let a of i.tools){let s=t[a.name],c=s?ps(s,a):a.description;n.push({name:a.name,description:c,inputSchema:a.inputSchema,handler:async u=>{let l=await r.executeTool(a.name,u);if(!l.success)throw new Error(l.error||"Tool execution failed");let d=l.data;return d?.message&&typeof d.message=="string"?`\u2713 ${d.message}`:l.data}}),q.debug("Created dynamic tool",{name:a.name,domain:o,hasEnhancedDescription:!!s})}}return q.info("Domain tools created",{total:n.length,domains:Object.keys(e)}),n}function Ey(){return{knowledge_query:{tool_name:"knowledge_query",domain:null,base_description:"Search the knowledge base for relevant information.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},knowledge_store:{tool_name:"knowledge_store",domain:null,base_description:"Save information to the knowledge base.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},knowledge_get_context:{tool_name:"knowledge_get_context",domain:null,base_description:"Get synthesized context about a topic.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},lexic_create_project:{tool_name:"lexic_create_project",domain:null,base_description:"Create a new project.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},lexic_list_projects:{tool_name:"lexic_list_projects",domain:null,base_description:"List available projects.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},lexic_get_project_info:{tool_name:"lexic_get_project_info",domain:null,base_description:"Get current project information.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},dev_log_decision:{tool_name:"dev_log_decision",domain:"development",base_description:"Record a technical decision.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0},dev_get_feature_context:{tool_name:"dev_get_feature_context",domain:"development",base_description:"Get development context for a feature.",triggers:[],proactive_triggers:[],do_not_use:[],differentiators:{},version:0}}}var PT=5*60*1e3,TT=1e4,ht=null;async function Oy(e){let t=Date.now();if(ht&&t-ht.fetchedAt<PT)return ht.data;try{let r=new Promise((o,i)=>{setTimeout(()=>i(new Error("Trigger fetch timeout")),TT)}),n=await Promise.race([e.fetchTriggers(ht?.version),r]);return n.unchanged&&ht?(q.debug("Triggers unchanged, refreshing TTL"),ht.fetchedAt=t,ht.data):(q.info("Triggers loaded",{count:Object.keys(n.triggers).length,version:n.version}),ht={data:n.triggers,fetchedAt:t,version:n.version},ht.data)}catch(r){return ht?(q.warn("API error, using cached triggers",{error:r instanceof Error?r.message:String(r)}),ht.data):(q.warn("API error, using default triggers",{error:r instanceof Error?r.message:String(r)}),Ey())}}function Ny(){return{development:{name:"development",description:"Tools for software development knowledge management",version:"1.0.0",tools:[{name:"dev_log_decision",description:"Record an architectural or technical decision with full context.",inputSchema:{type:"object",properties:{feature:{type:"string",description:"The feature or component this decision relates to"},decision:{type:"string",description:"What was decided"},rationale:{type:"string",description:"Why this choice was made"},alternatives:{type:"array",items:{type:"object",properties:{option:{type:"string"},whyRejected:{type:"string"}}},description:"Other options considered and why they were rejected"},revisitIf:{type:"string",description:"Conditions that would trigger reconsidering this decision"}},required:["feature","decision","rationale"]}},{name:"dev_get_feature_context",description:"Get comprehensive development context for a specific feature or component.",inputSchema:{type:"object",properties:{feature:{type:"string",description:'The feature name (e.g., "entity-system", "billing", "auth")'}},required:["feature"]}}]}}}var jT=5*60*1e3,ET=1e4,gt=null;async function uf(e){let t=Date.now();if(gt&&t-gt.fetchedAt<jT)return gt.data;try{let r=new Promise((o,i)=>{setTimeout(()=>i(new Error("Domain fetch timeout")),ET)}),n=await Promise.race([e.fetchDomains(gt?.version),r]);return n.unchanged&&gt?(q.debug("Domains unchanged, refreshing TTL"),gt.fetchedAt=t,gt.data):(q.info("Domains loaded",{count:Object.keys(n.domains).length,version:n.version}),gt={data:n.domains,fetchedAt:t,version:n.version},gt.data)}catch(r){return gt?(q.warn("API error, using cached domains",{error:r instanceof Error?r.message:String(r)}),gt.data):(q.warn("API error, using default domains",{error:r instanceof Error?r.message:String(r)}),Ny())}}async function OT(){let e=xy();q.setLevel(e.logLevel),q.info("Starting Lexic MCP Server");let t=wy(e),r=await t.validateConnection();if(r.valid||(q.error("Failed to connect to Lexic",{error:r.error}),process.exit(1)),q.info("Connected to Lexic",{lexiconId:r.lexiconId,isUserScoped:r.isUserScoped}),r.expiresAt){let h=new Date,g=Math.ceil((r.expiresAt.getTime()-h.getTime())/(1e3*60*60*24)),y=r.expiresAt.toISOString(),b=g===1?"day":"days";switch(!0){case g<=0:q.error("PAT has expired",{expiresAt:y});break;case g<=3:q.warn(`PAT expires in ${g} ${b}`,{expiresAt:y});break;case g<=7:q.info(`PAT expires in ${g} ${b}`,{expiresAt:y});break}}q.info("Loading domains and triggers...");let n={},o={},i=!1;try{[n,o]=await Promise.all([uf(t),Oy(t)]),q.info("Loaded configuration",{domains:Object.keys(n).length,triggers:Object.keys(o).length})}catch(h){i=!0,q.warn("Failed to load dynamic configuration, starting in degraded mode",{error:h instanceof Error?h.message:String(h)});try{n=await uf(t),q.info("Loaded domains only (triggers unavailable)",{domains:Object.keys(n).length})}catch(g){q.error("Failed to load domains - cannot start server",{error:g instanceof Error?g.message:String(g)}),process.exit(1)}}i&&q.warn("Running in DEGRADED MODE - tool descriptions may be less helpful");let a=h=>{let g=o[h];return g?ps(g):void 0},s=new us({name:"lexic-mcp",version:"0.1.0"},{capabilities:{tools:{}}}),c=new Map,u=Sy(t,{description:a("knowledge_query")}),l=zy(t,{description:a("knowledge_store")}),d=Iy(t,{description:a("knowledge_get_context")});if(c.set(u.name,u),c.set(l.name,l),c.set(d.name,d),q.debug("Registered core tools",{tools:[u.name,l.name,d.name]}),t.isUserScoped()){let h=Py(t,{description:a("lexic_create_project")}),g=Ty(t,{description:a("lexic_list_projects")}),y=jy(t,{description:a("lexic_get_project_info")});c.set(h.name,h),c.set(g.name,g),c.set(y.name,y),q.debug("Registered admin tools",{tools:[h.name,g.name,y.name]})}else q.debug("Skipping admin tools (PAT is lexicon-scoped)");let m=cf(n,o,t);for(let h of m)c.set(h.name,h);q.debug("Registered domain tools",{count:m.length,tools:m.map(h=>h.name)}),s.setRequestHandler(id,async()=>({tools:Array.from(c.values()).map(h=>({name:h.name,description:h.description,inputSchema:h.inputSchema}))})),s.setRequestHandler(wo,async h=>{let{name:g,arguments:y}=h.params,b=c.get(g);if(!b)return{content:[{type:"text",text:`Unknown tool: ${g}`}],isError:!0};try{q.debug("Executing tool",{name:g,args:y});let P=await b.handler(y||{});return q.debug("Tool executed successfully",{name:g}),{content:[{type:"text",text:typeof P=="string"?P:JSON.stringify(P,null,2)}]}}catch(P){let I=P instanceof Error?P.message:String(P);return q.error("Tool execution failed",{name:g,error:I}),{content:[{type:"text",text:`Error: ${I}`}],isError:!0}}});let f=new ds;await s.connect(f),q.info("Lexic MCP Server running",{toolCount:c.size,tools:Array.from(c.keys())})}OT().catch(e=>{q.error("Fatal error",{error:e instanceof Error?e.message:String(e)}),process.exit(1)});