@kunal_dutt/token-lens 0.2.46 → 0.2.48
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-helper/core.js +1 -1
- package/package.json +1 -1
- package/server.mjs +12 -12
- package/token-lens.mcpb +0 -0
package/server.mjs
CHANGED
|
@@ -3,10 +3,10 @@ var a1=Object.create;var eg=Object.defineProperty;var i1=Object.getOwnPropertyDe
|
|
|
3
3
|
`:""},this._extScope=t,this._scope=new en.Scope({parent:t}),this._nodes=[new Iy]}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 a=this._extScope.value(t,r);return(this._values[a.prefix]||(this._values[a.prefix]=new Set)).add(a),a}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,a,n){let i=this._scope.toName(r);return a!==void 0&&n&&(this._constants[i.str]=a),this._leafNode(new Ey(t,i,a)),i}const(t,r,a){return this._def(en.varKinds.const,t,r,a)}let(t,r,a){return this._def(en.varKinds.let,t,r,a)}var(t,r,a){return this._def(en.varKinds.var,t,r,a)}assign(t,r,a){return this._leafNode(new hm(t,r,a))}add(t,r){return this._leafNode(new xy(t,oe.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==de.nil&&this._leafNode(new zy(t)),this}object(...t){let r=["{"];for(let[a,n]of t)r.length>1&&r.push(","),r.push(a),(a!==n||this.opts.es5)&&(r.push(":"),(0,de.addCodeArg)(r,n));return r.push("}"),new de._Code(r)}if(t,r,a){if(this._blockNode(new sa(t)),r&&a)this.code(r).else().code(a).endIf();else if(r)this.code(r).endIf();else if(a)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new sa(t))}else(){return this._elseNode(new Wi)}endIf(){return this._endBlockNode(sa,Wi)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Py(t),r)}forRange(t,r,a,n,i=this.opts.es5?en.varKinds.var:en.varKinds.let){let o=this._scope.toName(t);return this._for(new Ry(i,o,r,a),()=>n(o))}forOf(t,r,a,n=en.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let o=r instanceof de.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,de._)`${o}.length`,s=>{this.var(i,(0,de._)`${o}[${s}]`),a(i)})}return this._for(new fm("of",n,i,r),()=>a(i))}forIn(t,r,a,n=this.opts.es5?en.varKinds.var:en.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,de._)`Object.keys(${r})`,a);let i=this._scope.toName(t);return this._for(new fm("in",n,i,r),()=>a(i))}endFor(){return this._endBlockNode(la)}label(t){return this._leafNode(new Ty(t))}break(t){return this._leafNode(new Ay(t))}return(t){let r=new vl;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(vl)}try(t,r,a){if(!r&&!a)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new $y;if(this._blockNode(n),this.code(t),r){let i=this.name("e");this._currNode=n.catch=new yl(i),r(i)}return a&&(this._currNode=n.finally=new kl,this.code(a)),this._endBlockNode(yl,kl)}throw(t){return this._leafNode(new Cy(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 a=this._nodes.length-r;if(a<0||t!==void 0&&a!==t)throw new Error(`CodeGen: wrong number of nodes: ${a} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=de.nil,a,n){return this._blockNode(new bl(t,r,a)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(bl)}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 a=this._currNode;if(a instanceof t||r&&a 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 sa))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}};oe.CodeGen=jy;function ca(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function bm(e,t){return t instanceof de._CodeOrName?ca(e,t.names):e}function Ki(e,t,r){if(e instanceof de.Name)return a(e);if(!n(e))return e;return new de._Code(e._items.reduce((i,o)=>(o instanceof de.Name&&(o=a(o)),o instanceof de._Code?i.push(...o._items):i.push(o),i),[]));function a(i){let o=r[i.str];return o===void 0||t[i.str]!==1?i:(delete t[i.str],o)}function n(i){return i instanceof de._Code&&i._items.some(o=>o instanceof de.Name&&t[o.str]===1&&r[o.str]!==void 0)}}function JM(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function UC(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,de._)`!${Oy(e)}`}oe.not=UC;var YM=FC(oe.operators.AND);function XM(...e){return e.reduce(YM)}oe.and=XM;var QM=FC(oe.operators.OR);function eL(...e){return e.reduce(QM)}oe.or=eL;function FC(e){return(t,r)=>t===de.nil?r:r===de.nil?t:(0,de._)`${Oy(t)} ${e} ${Oy(r)}`}function Oy(e){return e instanceof de.Name?e:(0,de._)`(${e})`}});var pe=j(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.checkStrictMode=le.getErrorPath=le.Type=le.useFunc=le.setEvaluated=le.evaluatedPropsToName=le.mergeEvaluated=le.eachItem=le.unescapeJsonPointer=le.escapeJsonPointer=le.escapeFragment=le.unescapeFragment=le.schemaRefOrVal=le.schemaHasRulesButRef=le.schemaHasRules=le.checkUnknownRules=le.alwaysValidSchema=le.toHash=void 0;var ze=ne(),tL=hl();function nL(e){let t={};for(let r of e)t[r]=!0;return t}le.toHash=nL;function rL(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(GC(e,t),!VC(t,e.self.RULES.all))}le.alwaysValidSchema=rL;function GC(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||typeof t=="boolean")return;let n=a.RULES.keywords;for(let i in t)n[i]||ZC(e,`unknown keyword: "${i}"`)}le.checkUnknownRules=GC;function VC(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}le.schemaHasRules=VC;function aL(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}le.schemaHasRulesButRef=aL;function iL({topSchemaRef:e,schemaPath:t},r,a,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ze._)`${r}`}return(0,ze._)`${e}${t}${(0,ze.getProperty)(a)}`}le.schemaRefOrVal=iL;function oL(e){return WC(decodeURIComponent(e))}le.unescapeFragment=oL;function sL(e){return encodeURIComponent(Dy(e))}le.escapeFragment=sL;function Dy(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}le.escapeJsonPointer=Dy;function WC(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}le.unescapeJsonPointer=WC;function lL(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}le.eachItem=lL;function qC({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(n,i,o,s)=>{let l=o===void 0?i:o instanceof ze.Name?(i instanceof ze.Name?e(n,i,o):t(n,i,o),o):i instanceof ze.Name?(t(n,o,i),i):r(i,o);return s===ze.Name&&!(l instanceof ze.Name)?a(n,l):l}}le.mergeEvaluated={props:qC({mergeNames:(e,t,r)=>e.if((0,ze._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,ze._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,ze._)`${r} || {}`).code((0,ze._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,ze._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,ze._)`${r} || {}`),My(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:KC}),items:qC({mergeNames:(e,t,r)=>e.if((0,ze._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,ze._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,ze._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,ze._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function KC(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,ze._)`{}`);return t!==void 0&&My(e,r,t),r}le.evaluatedPropsToName=KC;function My(e,t,r){Object.keys(r).forEach(a=>e.assign((0,ze._)`${t}${(0,ze.getProperty)(a)}`,!0))}le.setEvaluated=My;var HC={};function cL(e,t){return e.scopeValue("func",{ref:t,code:HC[t.code]||(HC[t.code]=new tL._Code(t.code))})}le.useFunc=cL;var Ny;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ny||(le.Type=Ny={}));function uL(e,t,r){if(e instanceof ze.Name){let a=t===Ny.Num;return r?a?(0,ze._)`"[" + ${e} + "]"`:(0,ze._)`"['" + ${e} + "']"`:a?(0,ze._)`"/" + ${e}`:(0,ze._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ze.getProperty)(e).toString():"/"+Dy(e)}le.getErrorPath=uL;function ZC(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}le.checkStrictMode=ZC});var Kn=j(Ly=>{"use strict";Object.defineProperty(Ly,"__esModule",{value:!0});var at=ne(),dL={data:new at.Name("data"),valCxt:new at.Name("valCxt"),instancePath:new at.Name("instancePath"),parentData:new at.Name("parentData"),parentDataProperty:new at.Name("parentDataProperty"),rootData:new at.Name("rootData"),dynamicAnchors:new at.Name("dynamicAnchors"),vErrors:new at.Name("vErrors"),errors:new at.Name("errors"),this:new at.Name("this"),self:new at.Name("self"),scope:new at.Name("scope"),json:new at.Name("json"),jsonPos:new at.Name("jsonPos"),jsonLen:new at.Name("jsonLen"),jsonPart:new at.Name("jsonPart")};Ly.default=dL});var _l=j(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.extendErrors=it.resetErrorsCount=it.reportExtraError=it.reportError=it.keyword$DataError=it.keywordError=void 0;var me=ne(),ym=pe(),ft=Kn();it.keywordError={message:({keyword:e})=>(0,me.str)`must pass "${e}" keyword validation`};it.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,me.str)`"${e}" keyword must be ${t} ($data)`:(0,me.str)`"${e}" keyword is invalid ($data)`};function pL(e,t=it.keywordError,r,a){let{it:n}=e,{gen:i,compositeRule:o,allErrors:s}=n,l=XC(e,t,r);a??(o||s)?JC(i,l):YC(n,(0,me._)`[${l}]`)}it.reportError=pL;function mL(e,t=it.keywordError,r){let{it:a}=e,{gen:n,compositeRule:i,allErrors:o}=a,s=XC(e,t,r);JC(n,s),i||o||YC(a,ft.default.vErrors)}it.reportExtraError=mL;function gL(e,t){e.assign(ft.default.errors,t),e.if((0,me._)`${ft.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,me._)`${ft.default.vErrors}.length`,t),()=>e.assign(ft.default.vErrors,null)))}it.resetErrorsCount=gL;function hL({gen:e,keyword:t,schemaValue:r,data:a,errsCount:n,it:i}){if(n===void 0)throw new Error("ajv implementation error");let o=e.name("err");e.forRange("i",n,ft.default.errors,s=>{e.const(o,(0,me._)`${ft.default.vErrors}[${s}]`),e.if((0,me._)`${o}.instancePath === undefined`,()=>e.assign((0,me._)`${o}.instancePath`,(0,me.strConcat)(ft.default.instancePath,i.errorPath))),e.assign((0,me._)`${o}.schemaPath`,(0,me.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,me._)`${o}.schema`,r),e.assign((0,me._)`${o}.data`,a))})}it.extendErrors=hL;function JC(e,t){let r=e.const("err",t);e.if((0,me._)`${ft.default.vErrors} === null`,()=>e.assign(ft.default.vErrors,(0,me._)`[${r}]`),(0,me._)`${ft.default.vErrors}.push(${r})`),e.code((0,me._)`${ft.default.errors}++`)}function YC(e,t){let{gen:r,validateName:a,schemaEnv:n}=e;n.$async?r.throw((0,me._)`new ${e.ValidationError}(${t})`):(r.assign((0,me._)`${a}.errors`,t),r.return(!1))}var ua={keyword:new me.Name("keyword"),schemaPath:new me.Name("schemaPath"),params:new me.Name("params"),propertyName:new me.Name("propertyName"),message:new me.Name("message"),schema:new me.Name("schema"),parentSchema:new me.Name("parentSchema")};function XC(e,t,r){let{createErrors:a}=e.it;return a===!1?(0,me._)`{}`:fL(e,t,r)}function fL(e,t,r={}){let{gen:a,it:n}=e,i=[bL(n,r),vL(e,r)];return yL(e,t,i),a.object(...i)}function bL({errorPath:e},{instancePath:t}){let r=t?(0,me.str)`${e}${(0,ym.getErrorPath)(t,ym.Type.Str)}`:e;return[ft.default.instancePath,(0,me.strConcat)(ft.default.instancePath,r)]}function vL({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:a}){let n=a?t:(0,me.str)`${t}/${e}`;return r&&(n=(0,me.str)`${n}${(0,ym.getErrorPath)(r,ym.Type.Str)}`),[ua.schemaPath,n]}function yL(e,{params:t,message:r},a){let{keyword:n,data:i,schemaValue:o,it:s}=e,{opts:l,propertyName:c,topSchemaRef:u,schemaPath:d}=s;a.push([ua.keyword,n],[ua.params,typeof t=="function"?t(e):t||(0,me._)`{}`]),l.messages&&a.push([ua.message,typeof r=="function"?r(e):r]),l.verbose&&a.push([ua.schema,o],[ua.parentSchema,(0,me._)`${u}${d}`],[ft.default.data,i]),c&&a.push([ua.propertyName,c])}});var ez=j(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.boolOrEmptySchema=Zi.topBoolOrEmptySchema=void 0;var kL=_l(),_L=ne(),wL=Kn(),SL={message:"boolean schema is false"};function EL(e){let{gen:t,schema:r,validateName:a}=e;r===!1?QC(e,!1):typeof r=="object"&&r.$async===!0?t.return(wL.default.data):(t.assign((0,_L._)`${a}.errors`,null),t.return(!0))}Zi.topBoolOrEmptySchema=EL;function xL(e,t){let{gen:r,schema:a}=e;a===!1?(r.var(t,!1),QC(e)):r.var(t,!0)}Zi.boolOrEmptySchema=xL;function QC(e,t){let{gen:r,data:a}=e,n={gen:r,keyword:"false schema",data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,kL.reportError)(n,SL,void 0,t)}});var By=j(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});Ji.getRules=Ji.isJSONType=void 0;var TL=["string","number","integer","boolean","null","object","array"],AL=new Set(TL);function CL(e){return typeof e=="string"&&AL.has(e)}Ji.isJSONType=CL;function zL(){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:{}}}Ji.getRules=zL});var Uy=j(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.shouldUseRule=Er.shouldUseGroup=Er.schemaHasRulesForType=void 0;function IL({schema:e,self:t},r){let a=t.RULES.types[r];return a&&a!==!0&&tz(e,a)}Er.schemaHasRulesForType=IL;function tz(e,t){return t.rules.some(r=>nz(e,r))}Er.shouldUseGroup=tz;function nz(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(a=>e[a]!==void 0))}Er.shouldUseRule=nz});var wl=j(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.reportTypeError=ot.checkDataTypes=ot.checkDataType=ot.coerceAndCheckDataType=ot.getJSONTypes=ot.getSchemaTypes=ot.DataType=void 0;var PL=By(),RL=Uy(),$L=_l(),te=ne(),rz=pe(),Yi;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Yi||(ot.DataType=Yi={}));function jL(e){let t=az(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}ot.getSchemaTypes=jL;function az(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(PL.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}ot.getJSONTypes=az;function OL(e,t){let{gen:r,data:a,opts:n}=e,i=NL(t,n.coerceTypes),o=t.length>0&&!(i.length===0&&t.length===1&&(0,RL.schemaHasRulesForType)(e,t[0]));if(o){let s=qy(t,a,n.strictNumbers,Yi.Wrong);r.if(s,()=>{i.length?DL(e,t,i):Hy(e)})}return o}ot.coerceAndCheckDataType=OL;var iz=new Set(["string","number","integer","boolean","null"]);function NL(e,t){return t?e.filter(r=>iz.has(r)||t==="array"&&r==="array"):[]}function DL(e,t,r){let{gen:a,data:n,opts:i}=e,o=a.let("dataType",(0,te._)`typeof ${n}`),s=a.let("coerced",(0,te._)`undefined`);i.coerceTypes==="array"&&a.if((0,te._)`${o} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>a.assign(n,(0,te._)`${n}[0]`).assign(o,(0,te._)`typeof ${n}`).if(qy(t,n,i.strictNumbers),()=>a.assign(s,n))),a.if((0,te._)`${s} !== undefined`);for(let c of r)(iz.has(c)||c==="array"&&i.coerceTypes==="array")&&l(c);a.else(),Hy(e),a.endIf(),a.if((0,te._)`${s} !== undefined`,()=>{a.assign(n,s),ML(e,s)});function l(c){switch(c){case"string":a.elseIf((0,te._)`${o} == "number" || ${o} == "boolean"`).assign(s,(0,te._)`"" + ${n}`).elseIf((0,te._)`${n} === null`).assign(s,(0,te._)`""`);return;case"number":a.elseIf((0,te._)`${o} == "boolean" || ${n} === null
|
|
4
4
|
|| (${o} == "string" && ${n} && ${n} == +${n})`).assign(s,(0,te._)`+${n}`);return;case"integer":a.elseIf((0,te._)`${o} === "boolean" || ${n} === null
|
|
5
5
|
|| (${o} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(s,(0,te._)`+${n}`);return;case"boolean":a.elseIf((0,te._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(s,!1).elseIf((0,te._)`${n} === "true" || ${n} === 1`).assign(s,!0);return;case"null":a.elseIf((0,te._)`${n} === "" || ${n} === 0 || ${n} === false`),a.assign(s,null);return;case"array":a.elseIf((0,te._)`${o} === "string" || ${o} === "number"
|
|
6
|
-
|| ${o} === "boolean" || ${n} === null`).assign(s,(0,te._)`[${n}]`)}}}function ML({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,te._)`${t} !== undefined`,()=>e.assign((0,te._)`${t}[${r}]`,a))}function Fy(e,t,r,a=Yi.Correct){let n=a===Yi.Correct?te.operators.EQ:te.operators.NEQ,i;switch(e){case"null":return(0,te._)`${t} ${n} null`;case"array":i=(0,te._)`Array.isArray(${t})`;break;case"object":i=(0,te._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o((0,te._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return(0,te._)`typeof ${t} ${n} ${e}`}return a===Yi.Correct?i:(0,te.not)(i);function o(s=te.nil){return(0,te.and)((0,te._)`typeof ${t} == "number"`,s,r?(0,te._)`isFinite(${t})`:te.nil)}}ot.checkDataType=Fy;function qy(e,t,r,a){if(e.length===1)return Fy(e[0],t,r,a);let n,i=(0,rz.toHash)(e);if(i.array&&i.object){let o=(0,te._)`typeof ${t} != "object"`;n=i.null?o:(0,te._)`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else n=te.nil;i.number&&delete i.integer;for(let o in i)n=(0,te.and)(n,Fy(o,t,r,a));return n}ot.checkDataTypes=qy;var LL={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,te._)`{type: ${e}}`:(0,te._)`{type: ${t}}`};function Hy(e){let t=BL(e);(0,$L.reportError)(t,LL)}ot.reportTypeError=Hy;function BL(e){let{gen:t,data:r,schema:a}=e,n=(0,rz.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:n,schemaValue:n,parentSchema:a,params:{},it:e}}});var sz=j(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.assignDefaults=void 0;var Xi=ne(),UL=pe();function FL(e,t){let{properties:r,items:a}=e.schema;if(t==="object"&&r)for(let n in r)oz(e,n,r[n].default);else t==="array"&&Array.isArray(a)&&a.forEach((n,i)=>oz(e,i,n.default))}km.assignDefaults=FL;function oz(e,t,r){let{gen:a,compositeRule:n,data:i,opts:o}=e;if(r===void 0)return;let s=(0,Xi._)`${i}${(0,Xi.getProperty)(t)}`;if(n){(0,UL.checkStrictMode)(e,`default is ignored for: ${s}`);return}let l=(0,Xi._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,Xi._)`${l} || ${s} === null || ${s} === ""`),a.if(l,(0,Xi._)`${s} = ${(0,Xi.stringify)(r)}`)}});var qt=j(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.validateUnion=Ae.validateArray=Ae.usePattern=Ae.callValidateCode=Ae.schemaProperties=Ae.allSchemaProperties=Ae.noPropertyInData=Ae.propertyInData=Ae.isOwnProperty=Ae.hasPropFunc=Ae.reportMissingProp=Ae.checkMissingProp=Ae.checkReportMissingProp=void 0;var Pe=ne(),Gy=pe(),xr=Kn(),qL=pe();function HL(e,t){let{gen:r,data:a,it:n}=e;r.if(Wy(r,a,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Pe._)`${t}`},!0),e.error()})}Ae.checkReportMissingProp=HL;function GL({gen:e,data:t,it:{opts:r}},a,n){return(0,Pe.or)(...a.map(i=>(0,Pe.and)(Wy(e,t,i,r.ownProperties),(0,Pe._)`${n} = ${i}`)))}Ae.checkMissingProp=GL;function VL(e,t){e.setParams({missingProperty:t},!0),e.error()}Ae.reportMissingProp=VL;function lz(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Pe._)`Object.prototype.hasOwnProperty`})}Ae.hasPropFunc=lz;function Vy(e,t,r){return(0,Pe._)`${lz(e)}.call(${t}, ${r})`}Ae.isOwnProperty=Vy;function WL(e,t,r,a){let n=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} !== undefined`;return a?(0,Pe._)`${n} && ${Vy(e,t,r)}`:n}Ae.propertyInData=WL;function Wy(e,t,r,a){let n=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} === undefined`;return a?(0,Pe.or)(n,(0,Pe.not)(Vy(e,t,r))):n}Ae.noPropertyInData=Wy;function cz(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Ae.allSchemaProperties=cz;function KL(e,t){return cz(t).filter(r=>!(0,Gy.alwaysValidSchema)(e,t[r]))}Ae.schemaProperties=KL;function ZL({schemaCode:e,data:t,it:{gen:r,topSchemaRef:a,schemaPath:n,errorPath:i},it:o},s,l,c){let u=c?(0,Pe._)`${e}, ${t}, ${a}${n}`:t,d=[[xr.default.instancePath,(0,Pe.strConcat)(xr.default.instancePath,i)],[xr.default.parentData,o.parentData],[xr.default.parentDataProperty,o.parentDataProperty],[xr.default.rootData,xr.default.rootData]];o.opts.dynamicRef&&d.push([xr.default.dynamicAnchors,xr.default.dynamicAnchors]);let m=(0,Pe._)`${u}, ${r.object(...d)}`;return l!==Pe.nil?(0,Pe._)`${s}.call(${l}, ${m})`:(0,Pe._)`${s}(${m})`}Ae.callValidateCode=ZL;var JL=(0,Pe._)`new RegExp`;function YL({gen:e,it:{opts:t}},r){let a=t.unicodeRegExp?"u":"",{regExp:n}=t.code,i=n(r,a);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,Pe._)`${n.code==="new RegExp"?JL:(0,qL.useFunc)(e,n)}(${r}, ${a})`})}Ae.usePattern=YL;function XL(e){let{gen:t,data:r,keyword:a,it:n}=e,i=t.name("valid");if(n.allErrors){let s=t.let("valid",!0);return o(()=>t.assign(s,!1)),s}return t.var(i,!0),o(()=>t.break()),i;function o(s){let l=t.const("len",(0,Pe._)`${r}.length`);t.forRange("i",0,l,c=>{e.subschema({keyword:a,dataProp:c,dataPropType:Gy.Type.Num},i),t.if((0,Pe.not)(i),s)})}}Ae.validateArray=XL;function QL(e){let{gen:t,schema:r,keyword:a,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,Gy.alwaysValidSchema)(n,l))&&!n.opts.unevaluated)return;let o=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let u=e.subschema({keyword:a,schemaProp:c,compositeRule:!0},s);t.assign(o,(0,Pe._)`${o} || ${s}`),e.mergeValidEvaluated(u,s)||t.if((0,Pe.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}Ae.validateUnion=QL});var pz=j(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.validateKeywordUsage=vn.validSchemaType=vn.funcKeywordCode=vn.macroKeywordCode=void 0;var bt=ne(),da=Kn(),e4=qt(),t4=_l();function n4(e,t){let{gen:r,keyword:a,schema:n,parentSchema:i,it:o}=e,s=t.macro.call(o.self,n,i,o),l=dz(r,a,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");e.subschema({schema:s,schemaPath:bt.nil,errSchemaPath:`${o.errSchemaPath}/${a}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}vn.macroKeywordCode=n4;function r4(e,t){var r;let{gen:a,keyword:n,schema:i,parentSchema:o,$data:s,it:l}=e;i4(l,t);let c=!s&&t.compile?t.compile.call(l.self,i,o,l):t.validate,u=dz(a,n,c),d=a.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&uz(e),f(()=>e.error());else{let k=t.async?p():g();t.modifying&&uz(e),f(()=>a4(e,k))}}function p(){let k=a.let("ruleErrs",null);return a.try(()=>h((0,bt._)`await `),b=>a.assign(d,!1).if((0,bt._)`${b} instanceof ${l.ValidationError}`,()=>a.assign(k,(0,bt._)`${b}.errors`),()=>a.throw(b))),k}function g(){let k=(0,bt._)`${u}.errors`;return a.assign(k,null),h(bt.nil),k}function h(k=t.async?(0,bt._)`await `:bt.nil){let b=l.opts.passContext?da.default.this:da.default.self,v=!("compile"in t&&!s||t.schema===!1);a.assign(d,(0,bt._)`${k}${(0,e4.callValidateCode)(e,u,b,v)}`,t.modifying)}function f(k){var b;a.if((0,bt.not)((b=t.valid)!==null&&b!==void 0?b:d),k)}}vn.funcKeywordCode=r4;function uz(e){let{gen:t,data:r,it:a}=e;t.if(a.parentData,()=>t.assign(r,(0,bt._)`${a.parentData}[${a.parentDataProperty}]`))}function a4(e,t){let{gen:r}=e;r.if((0,bt._)`Array.isArray(${t})`,()=>{r.assign(da.default.vErrors,(0,bt._)`${da.default.vErrors} === null ? ${t} : ${da.default.vErrors}.concat(${t})`).assign(da.default.errors,(0,bt._)`${da.default.vErrors}.length`),(0,t4.extendErrors)(e)},()=>e.error())}function i4({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function dz(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,bt.stringify)(r)})}function o4(e,t,r=!1){return!t.length||t.some(a=>a==="array"?Array.isArray(e):a==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==a||r&&typeof e>"u")}vn.validSchemaType=o4;function s4({schema:e,opts:t,self:r,errSchemaPath:a},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw new Error("ajv implementation error");let o=n.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${a}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}vn.validateKeywordUsage=s4});var gz=j(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.extendSubschemaMode=Tr.extendSubschemaData=Tr.getSubschema=void 0;var yn=ne(),mz=pe();function l4(e,{keyword:t,schemaProp:r,schema:a,schemaPath:n,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&a!==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,yn._)`${e.schemaPath}${(0,yn.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,yn._)`${e.schemaPath}${(0,yn.getProperty)(t)}${(0,yn.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,mz.escapeFragment)(r)}`}}if(a!==void 0){if(n===void 0||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:n,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Tr.getSubschema=l4;function c4(e,t,{dataProp:r,dataPropType:a,data:n,dataTypes:i,propertyName:o}){if(n!==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:c,dataPathArr:u,opts:d}=t,m=s.let("data",(0,yn._)`${t.data}${(0,yn.getProperty)(r)}`,!0);l(m),e.errorPath=(0,yn.str)`${c}${(0,mz.getErrorPath)(r,a,d.jsPropertySyntax)}`,e.parentDataProperty=(0,yn._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(n!==void 0){let c=n instanceof yn.Name?n:s.let("data",n,!0);l(c),o!==void 0&&(e.propertyName=o)}i&&(e.dataTypes=i);function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}Tr.extendSubschemaData=c4;function u4(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:n,allErrors:i}){a!==void 0&&(e.compositeRule=a),n!==void 0&&(e.createErrors=n),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}Tr.extendSubschemaMode=u4});var Ky=j((nY,hz)=>{"use strict";hz.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 a,n,i;if(Array.isArray(t)){if(a=t.length,a!=r.length)return!1;for(n=a;n--!==0;)if(!e(t[n],r[n]))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),a=i.length,a!==Object.keys(r).length)return!1;for(n=a;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=a;n--!==0;){var o=i[n];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var bz=j((rY,fz)=>{"use strict";var Ar=fz.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var a=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};_m(t,a,n,e,"",e)};Ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ar.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 _m(e,t,r,a,n,i,o,s,l,c){if(a&&typeof a=="object"&&!Array.isArray(a)){t(a,n,i,o,s,l,c);for(var u in a){var d=a[u];if(Array.isArray(d)){if(u in Ar.arrayKeywords)for(var m=0;m<d.length;m++)_m(e,t,r,d[m],n+"/"+u+"/"+m,i,n,u,a,m)}else if(u in Ar.propsKeywords){if(d&&typeof d=="object")for(var p in d)_m(e,t,r,d[p],n+"/"+u+"/"+d4(p),i,n,u,a,p)}else(u in Ar.keywords||e.allKeys&&!(u in Ar.skipKeywords))&&_m(e,t,r,d,n+"/"+u,i,n,u,a)}r(a,n,i,o,s,l,c)}}function d4(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Sl=j(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.getSchemaRefs=xt.resolveUrl=xt.normalizeId=xt._getFullPath=xt.getFullPath=xt.inlineRef=void 0;var p4=pe(),m4=Ky(),g4=bz(),h4=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function f4(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Zy(e):t?vz(e)<=t:!1}xt.inlineRef=f4;var b4=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zy(e){for(let t in e){if(b4.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Zy)||typeof r=="object"&&Zy(r))return!0}return!1}function vz(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!h4.has(r)&&(typeof e[r]=="object"&&(0,p4.eachItem)(e[r],a=>t+=vz(a)),t===1/0))return 1/0}return t}function yz(e,t="",r){r!==!1&&(t=Qi(t));let a=e.parse(t);return kz(e,a)}xt.getFullPath=yz;function kz(e,t){return e.serialize(t).split("#")[0]+"#"}xt._getFullPath=kz;var v4=/#\/?$/;function Qi(e){return e?e.replace(v4,""):""}xt.normalizeId=Qi;function y4(e,t,r){return r=Qi(r),e.resolve(t,r)}xt.resolveUrl=y4;var k4=/^[a-z_][-a-z0-9._]*$/i;function _4(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:a}=this.opts,n=Qi(e[r]||t),i={"":n},o=yz(a,n,!1),s={},l=new Set;return g4(e,{allKeys:!0},(d,m,p,g)=>{if(g===void 0)return;let h=o+m,f=i[g];typeof d[r]=="string"&&(f=k.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[m]=f;function k(v){let C=this.opts.uriResolver.resolve;if(v=Qi(f?C(f,v):v),l.has(v))throw u(v);l.add(v);let S=this.refs[v];return typeof S=="string"&&(S=this.refs[S]),typeof S=="object"?c(d,S.schema,v):v!==Qi(h)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!k4.test(v))throw new Error(`invalid anchor "${v}"`);k.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!m4(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}xt.getSchemaRefs=_4});var Tl=j(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.getData=Cr.KeywordCxt=Cr.validateFunctionCode=void 0;var xz=ez(),_z=wl(),Yy=Uy(),wm=wl(),w4=sz(),xl=pz(),Jy=gz(),q=ne(),J=Kn(),S4=Sl(),Zn=pe(),El=_l();function E4(e){if(Cz(e)&&(zz(e),Az(e))){A4(e);return}Tz(e,()=>(0,xz.topBoolOrEmptySchema)(e))}Cr.validateFunctionCode=E4;function Tz({gen:e,validateName:t,schema:r,schemaEnv:a,opts:n},i){n.code.es5?e.func(t,(0,q._)`${J.default.data}, ${J.default.valCxt}`,a.$async,()=>{e.code((0,q._)`"use strict"; ${wz(r,n)}`),T4(e,n),e.code(i)}):e.func(t,(0,q._)`${J.default.data}, ${x4(n)}`,a.$async,()=>e.code(wz(r,n)).code(i))}function x4(e){return(0,q._)`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${e.dynamicRef?(0,q._)`, ${J.default.dynamicAnchors}={}`:q.nil}}={}`}function T4(e,t){e.if(J.default.valCxt,()=>{e.var(J.default.instancePath,(0,q._)`${J.default.valCxt}.${J.default.instancePath}`),e.var(J.default.parentData,(0,q._)`${J.default.valCxt}.${J.default.parentData}`),e.var(J.default.parentDataProperty,(0,q._)`${J.default.valCxt}.${J.default.parentDataProperty}`),e.var(J.default.rootData,(0,q._)`${J.default.valCxt}.${J.default.rootData}`),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,q._)`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{e.var(J.default.instancePath,(0,q._)`""`),e.var(J.default.parentData,(0,q._)`undefined`),e.var(J.default.parentDataProperty,(0,q._)`undefined`),e.var(J.default.rootData,J.default.data),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,q._)`{}`)})}function A4(e){let{schema:t,opts:r,gen:a}=e;Tz(e,()=>{r.$comment&&t.$comment&&Pz(e),R4(e),a.let(J.default.vErrors,null),a.let(J.default.errors,0),r.unevaluated&&C4(e),Iz(e),O4(e)})}function C4(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,q._)`${r}.evaluated`),t.if((0,q._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,q._)`${e.evaluated}.props`,(0,q._)`undefined`)),t.if((0,q._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,q._)`${e.evaluated}.items`,(0,q._)`undefined`))}function wz(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,q._)`/*# sourceURL=${r} */`:q.nil}function z4(e,t){if(Cz(e)&&(zz(e),Az(e))){I4(e,t);return}(0,xz.boolOrEmptySchema)(e,t)}function Az({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 Cz(e){return typeof e.schema!="boolean"}function I4(e,t){let{schema:r,gen:a,opts:n}=e;n.$comment&&r.$comment&&Pz(e),$4(e),j4(e);let i=a.const("_errs",J.default.errors);Iz(e,i),a.var(t,(0,q._)`${i} === ${J.default.errors}`)}function zz(e){(0,Zn.checkUnknownRules)(e),P4(e)}function Iz(e,t){if(e.opts.jtd)return Sz(e,[],!1,t);let r=(0,_z.getSchemaTypes)(e.schema),a=(0,_z.coerceAndCheckDataType)(e,r);Sz(e,r,!a,t)}function P4(e){let{schema:t,errSchemaPath:r,opts:a,self:n}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,Zn.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function R4(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Zn.checkStrictMode)(e,"default is ignored in the schema root")}function $4(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,S4.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function j4(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Pz({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:n}){let i=r.$comment;if(n.$comment===!0)e.code((0,q._)`${J.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let o=(0,q.str)`${a}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,q._)`${J.default.self}.opts.$comment(${i}, ${o}, ${s}.schema)`)}}function O4(e){let{gen:t,schemaEnv:r,validateName:a,ValidationError:n,opts:i}=e;r.$async?t.if((0,q._)`${J.default.errors} === 0`,()=>t.return(J.default.data),()=>t.throw((0,q._)`new ${n}(${J.default.vErrors})`)):(t.assign((0,q._)`${a}.errors`,J.default.vErrors),i.unevaluated&&N4(e),t.return((0,q._)`${J.default.errors} === 0`))}function N4({gen:e,evaluated:t,props:r,items:a}){r instanceof q.Name&&e.assign((0,q._)`${t}.props`,r),a instanceof q.Name&&e.assign((0,q._)`${t}.items`,a)}function Sz(e,t,r,a){let{gen:n,schema:i,data:o,allErrors:s,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!(0,Zn.schemaHasRulesButRef)(i,u))){n.block(()=>$z(e,"$ref",u.all.$ref.definition));return}l.jtd||D4(e,t),n.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,Yy.shouldUseGroup)(i,m)&&(m.type?(n.if((0,wm.checkDataType)(m.type,o,l.strictNumbers)),Ez(e,m),t.length===1&&t[0]===m.type&&r&&(n.else(),(0,wm.reportTypeError)(e)),n.endIf()):Ez(e,m),s||n.if((0,q._)`${J.default.errors} === ${a||0}`))}}function Ez(e,t){let{gen:r,schema:a,opts:{useDefaults:n}}=e;n&&(0,w4.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,Yy.shouldUseRule)(a,i)&&$z(e,i.keyword,i.definition,t.type)})}function D4(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(M4(e,t),e.opts.allowUnionTypes||L4(e,t),B4(e,e.dataTypes))}function M4(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Rz(e.dataTypes,r)||Xy(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),F4(e,t)}}function L4(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Xy(e,"use allowUnionTypes to allow union type keyword")}function B4(e,t){let r=e.self.RULES.all;for(let a in r){let n=r[a];if(typeof n=="object"&&(0,Yy.shouldUseRule)(e.schema,n)){let{type:i}=n.definition;i.length&&!i.some(o=>U4(t,o))&&Xy(e,`missing type "${i.join(",")}" for keyword "${a}"`)}}}function U4(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Rz(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function F4(e,t){let r=[];for(let a of e.dataTypes)Rz(t,a)?r.push(a):t.includes("integer")&&a==="number"&&r.push("integer");e.dataTypes=r}function Xy(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Zn.checkStrictMode)(e,t,e.opts.strictTypes)}var Sm=class{constructor(t,r,a){if((0,xl.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Zn.schemaRefOrVal)(t,this.schema,a,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",jz(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,xl.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",J.default.errors))}result(t,r,a){this.failResult((0,q.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():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,q.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,q._)`${r} !== undefined && (${(0,q.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?El.reportExtraError:El.reportError)(this,this.def.error,r)}$dataError(){(0,El.reportError)(this,this.def.$dataError||El.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,El.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,a=q.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=q.nil,r=q.nil){if(!this.$data)return;let{gen:a,schemaCode:n,schemaType:i,def:o}=this;a.if((0,q.or)((0,q._)`${n} === undefined`,r)),t!==q.nil&&a.assign(t,!0),(i.length||o.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==q.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:n,it:i}=this;return(0,q.or)(o(),s());function o(){if(a.length){if(!(r instanceof q.Name))throw new Error("ajv implementation error");let l=Array.isArray(a)?a:[a];return(0,q._)`${(0,wm.checkDataTypes)(l,r,i.opts.strictNumbers,wm.DataType.Wrong)}`}return q.nil}function s(){if(n.validateSchema){let l=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,q._)`!${l}(${r})`}return q.nil}}subschema(t,r){let a=(0,Jy.getSubschema)(this.it,t);(0,Jy.extendSubschemaData)(a,this.it,t),(0,Jy.extendSubschemaMode)(a,t);let n={...this.it,...a,items:void 0,props:void 0};return z4(n,r),n}mergeEvaluated(t,r){let{it:a,gen:n}=this;a.opts.unevaluated&&(a.props!==!0&&t.props!==void 0&&(a.props=Zn.mergeEvaluated.props(n,t.props,a.props,r)),a.items!==!0&&t.items!==void 0&&(a.items=Zn.mergeEvaluated.items(n,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:n}=this;if(a.opts.unevaluated&&(a.props!==!0||a.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,q.Name)),!0}};Cr.KeywordCxt=Sm;function $z(e,t,r,a){let n=new Sm(e,r,t);"code"in r?r.code(n,a):n.$data&&r.validate?(0,xl.funcKeywordCode)(n,r):"macro"in r?(0,xl.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,xl.funcKeywordCode)(n,r)}var q4=/^\/(?:[^~]|~0|~1)*$/,H4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function jz(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let n,i;if(e==="")return J.default.rootData;if(e[0]==="/"){if(!q4.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,i=J.default.rootData}else{let c=H4.exec(e);if(!c)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(n=c[2],n==="#"){if(u>=t)throw new Error(l("property/index",u));return a[t-u]}if(u>t)throw new Error(l("data",u));if(i=r[t-u],!n)return i}let o=i,s=n.split("/");for(let c of s)c&&(i=(0,q._)`${i}${(0,q.getProperty)((0,Zn.unescapeJsonPointer)(c))}`,o=(0,q._)`${o} && ${i}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}Cr.getData=jz});var Em=j(ek=>{"use strict";Object.defineProperty(ek,"__esModule",{value:!0});var Qy=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};ek.default=Qy});var Al=j(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var tk=Sl(),nk=class extends Error{constructor(t,r,a,n){super(n||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,tk.resolveUrl)(t,r,a),this.missingSchema=(0,tk.normalizeId)((0,tk.getFullPath)(t,this.missingRef))}};rk.default=nk});var Tm=j(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.resolveSchema=Ht.getCompilingSchema=Ht.resolveRef=Ht.compileSchema=Ht.SchemaEnv=void 0;var tn=ne(),G4=Em(),pa=Kn(),nn=Sl(),Oz=pe(),V4=Tl(),eo=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let a;typeof t.schema=="object"&&(a=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,nn.normalizeId)(a?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=a?.$async,this.refs={}}};Ht.SchemaEnv=eo;function ik(e){let t=Nz.call(this,e);if(t)return t;let r=(0,nn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:n}=this.opts.code,{ownProperties:i}=this.opts,o=new tn.CodeGen(this.scope,{es5:a,lines:n,ownProperties:i}),s;e.$async&&(s=o.scopeValue("Error",{ref:G4.default,code:(0,tn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:pa.default.data,parentData:pa.default.parentData,parentDataProperty:pa.default.parentDataProperty,dataNames:[pa.default.data],dataPathArr:[tn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,tn.stringify)(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:tn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,tn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,V4.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(pa.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let p=new Function(`${pa.default.self}`,`${pa.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:g,items:h}=c;p.evaluated={props:g instanceof tn.Name?void 0:g,items:h instanceof tn.Name?void 0:h,dynamicProps:g instanceof tn.Name,dynamicItems:h instanceof tn.Name},p.source&&(p.source.evaluated=(0,tn.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}Ht.compileSchema=ik;function W4(e,t,r){var a;r=(0,nn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let i=J4.call(this,e,r);if(i===void 0){let o=(a=e.localRefs)===null||a===void 0?void 0:a[r],{schemaId:s}=this.opts;o&&(i=new eo({schema:o,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=K4.call(this,i)}Ht.resolveRef=W4;function K4(e){return(0,nn.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ik.call(this,e)}function Nz(e){for(let t of this._compilations)if(Z4(t,e))return t}Ht.getCompilingSchema=Nz;function Z4(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function J4(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||xm.call(this,e,t)}function xm(e,t){let r=this.opts.uriResolver.parse(t),a=(0,nn._getFullPath)(this.opts.uriResolver,r),n=(0,nn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===n)return ak.call(this,r,e);let i=(0,nn.normalizeId)(a),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let s=xm.call(this,e,o);return typeof s?.schema!="object"?void 0:ak.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||ik.call(this,o),i===(0,nn.normalizeId)(t)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(n=(0,nn.resolveUrl)(this.opts.uriResolver,n,c)),new eo({schema:s,schemaId:l,root:e,baseId:n})}return ak.call(this,r,o)}}Ht.resolveSchema=xm;var Y4=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ak(e,{baseId:t,schema:r,root:a}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,Oz.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!Y4.has(s)&&c&&(t=(0,nn.resolveUrl)(this.opts.uriResolver,t,c))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Oz.schemaHasRulesButRef)(r,this.RULES)){let s=(0,nn.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=xm.call(this,a,s)}let{schemaId:o}=this.opts;if(i=i||new eo({schema:r,schemaId:o,root:a,baseId:t}),i.schema!==i.root.schema)return i}});var Dz=j((cY,X4)=>{X4.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 dk=j((uY,Hz)=>{"use strict";var Q4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),sk=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),eB=RegExp.prototype.test.bind(/^\d*$/u),ma=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),lk=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Lz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ck=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),tB=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Tt=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Tt[t]="%"+e[t>>4]+e[t&15]}function st(e){return e<2048?Tt[192|e>>6]+Tt[128|e&63]:e<65536?Tt[224|e>>12]+Tt[128|e>>6&63]+Tt[128|e&63]:Tt[240|e>>18]+Tt[128|e>>12&63]+Tt[128|e>>6&63]+Tt[128|e&63]}function nB(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(r=e[a].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(r=e[a].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}var rB=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),aB=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),iB=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),oB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function sB(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!iB(e[t])){if(e[t]==="%"&&t+2<e.length&&ma(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function Mz(e){let t=-1,r=0,a=-1,n=0;for(let s=0;s<e.length;s++)e[s]==="0"?(a===-1&&(a=s),n++,n>r&&(r=n,t=a)):(a=-1,n=0);if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function lB(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),a=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),a.length===1&&a[0]===""&&(a.length=0));let n=r.concat(a),i=0;for(let s=0;s<n.length;s++){let l=n[s];if(l==="")return;if(l.indexOf(".")!==-1){if(s!==n.length-1||t!==-1&&a.length===0||!sk(l))return;i+=2;continue}if(!rB(l))return;n[s]=parseInt(l,16).toString(16),i++}if(t===-1)return i!==8?void 0:Mz(n);if(i>=8)return;let o=n.slice(0,r.length);for(let s=i;s<8;s++)o.push("0");for(let s=r.length;s<n.length;s++)o.push(n[s]);return Mz(o)}function ok(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let a=t?e.slice(1,-1):e;if(t&&aB(a))return a=a.toLowerCase(),{host:`[${a}]`,escapedHost:a,isIPV6:!1,isIPVFuture:!0};if(cB(a,":")<2)return{host:e,isIPV6:!1,error:t};let n="",i=a.indexOf("%");if(i!==-1){let s=a.slice(i,i+3).toLowerCase()==="%25"?3:1;if(n=a.slice(i+s),!sB(n))return{host:e,isIPV6:!1,error:!0};a=a.slice(0,i)}let o=lB(a);return o===void 0?{host:e,isIPV6:!1,error:!0}:{host:o+(n?"%"+n:""),escapedHost:o+(n?"%25"+n:""),isIPV6:!0}}function cB(e,t){let r=0;for(let a=0;a<e.length;a++)e[a]===t&&r++;return r}function uB(e){let t=e,r=[],a=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===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(n===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((a=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")}var dB={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},pB=/[@/?#:]/g,mB=/[@/?#]/g;function Bz(e,t){let r=t?mB:pB;return r.lastIndex=0,e.replace(r,a=>dB[a])}function Uz(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let a=0;a<e.length;a++){if(e[a]==="%"&&a+2<e.length){let n=e.slice(a+1,a+3);if(ma(n)){let i=n.toUpperCase(),o=String.fromCharCode(parseInt(i,16));t&&lk(o)?r+=o:r+="%"+i,a+=2;continue}}r+=e[a]}return r}function gB(e){let t="";for(let r=0;r<e.length;r++){let a=e[r];if(a==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(ma(n)){let i=n.toUpperCase(),o=String.fromCharCode(parseInt(i,16));o!=="."&&lk(o)?t+=o:t+="%"+i,r+=2;continue}}if(Lz(a))t+=a;else{let n=e.charCodeAt(r);if(n<128)t+=qz(n)?a:Tt[n];else if(n<55296||n>57343)t+=st(n);else if(n<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=st(65536+(n-55296<<10)+(i-56320)),r++):t+=st(65533)}else t+=st(65533)}}return t}function hB(e,t=!1){let r="",a=t&&e[0]!=="/";for(let n=0;n<e.length;n++){let i=e[n];if(i==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(ma(o)){r+="%"+o.toUpperCase(),n+=2;continue}}if(i==="/"&&(a=!1),Lz(i)&&(i!==":"||!a))r+=i;else{let o=e.charCodeAt(n);if(o<128)r+=Tt[o];else if(o<55296||o>57343)r+=st(o);else if(o<=56319&&n+1<e.length){let s=e.charCodeAt(n+1);s>=56320&&s<=57343?(r+=st(65536+(o-55296<<10)+(s-56320)),n++):r+=st(65533)}else r+=st(65533)}}return r}function uk(e,t){let r="";for(let a=0;a<e.length;a++){let n=e[a];if(n==="%"&&a+2<e.length){let i=e.slice(a+1,a+3);if(ma(i)){r+="%"+i.toUpperCase(),a+=2;continue}}if(t(n))r+=n;else{let i=e.charCodeAt(a);if(i<128)r+=Tt[i];else if(i<55296||i>57343)r+=st(i);else if(i<=56319&&a+1<e.length){let o=e.charCodeAt(a+1);o>=56320&&o<=57343?(r+=st(65536+(i-55296<<10)+(o-56320)),a++):r+=st(65533)}else r+=st(65533)}}return r}function Fz(e){return uk(e,tB)}function fB(e){return uk(e,ck)}function bB(e){return uk(e,ck)}function qz(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function vB(e){let t="";for(let r=0;r<e.length;r++){let a=e[r];if(a==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(ma(n)){let i=n.toUpperCase(),o=String.fromCharCode(parseInt(i,16));lk(o)?t+=o:t+="%"+i,r+=2;continue}}if(ck(a))t+=a;else{let n=e.charCodeAt(r);if(n<128)t+=qz(n)?a:Tt[n];else if(n<55296||n>57343)t+=st(n);else if(n<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=st(65536+(n-55296<<10)+(i-56320)),r++):t+=st(65533)}else t+=st(65533)}}return t}function yB(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let a=e.slice(r+1,r+3);if(ma(a)){t+="%"+a.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function kB(e){let t=[];if(e.userinfo!==void 0&&(t.push(Fz(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!sk(r)){let a=ok(r);a.isIPV6!==!0&&a.isIPVFuture!==!0&&(r=Uz(r,!0),a=ok(r)),a.isIPV6===!0||a.isIPVFuture===!0?r=`[${a.escapedHost}]`:r=Bz(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!eB(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Hz.exports={nonSimpleDomain:oB,recomposeAuthority:kB,reescapeHostDelimiters:Bz,normalizePercentEncoding:Uz,normalizePathEncoding:gB,serializePathEncoding:hB,normalizeQueryFragmentEncoding:vB,encodeUserinfo:Fz,encodeQuery:fB,encodeFragment:bB,escapePreservingEscapes:yB,removeDotSegments:uB,isIPv4:sk,isUUID:Q4,normalizeIPv6:ok,stringArrayToHexStripped:nB}});var Zz=j((dY,Kz)=>{"use strict";var{isUUID:_B}=dk(),wB=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,SB=["http","https","ws","wss","urn","urn:uuid"];function EB(e){return SB.indexOf(e)!==-1}function pk(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 Gz(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Vz(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 xB(e){return e.secure=pk(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function TB(e){if((e.port===(pk(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=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function AB(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(wB);if(r&&r[0]===e.path){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${a}:${t.nid||e.nid}`,i=mk(n);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function CB(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",a=e.nid.toLowerCase(),n=`${r}:${t.nid||a}`,i=mk(n);i&&(e=i.serialize(e,t));let o=e,s=e.nss;return o.path=`${a||t.nid}:${s}`,t.skipEscape=!0,o}function zB(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!_B(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function IB(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Wz={scheme:"http",domainHost:!0,parse:Gz,serialize:Vz},PB={scheme:"https",domainHost:Wz.domainHost,parse:Gz,serialize:Vz},Am={scheme:"ws",domainHost:!0,parse:xB,serialize:TB},RB={scheme:"wss",domainHost:Am.domainHost,parse:Am.parse,serialize:Am.serialize},$B={scheme:"urn",parse:AB,serialize:CB,skipNormalize:!0},jB={scheme:"urn:uuid",parse:zB,serialize:IB,skipNormalize:!0},Cm={http:Wz,https:PB,ws:Am,wss:RB,urn:$B,"urn:uuid":jB};Object.setPrototypeOf(Cm,null);function mk(e){return e&&(Cm[e]||Cm[e.toLowerCase()])||void 0}Kz.exports={wsIsSecure:pk,SCHEMES:Cm,isValidSchemeName:EB,getSchemeHandler:mk}});var lI=j((pY,Pm)=>{"use strict";var{normalizeIPv6:eI,removeDotSegments:zl,recomposeAuthority:OB,normalizePercentEncoding:gk,normalizePathEncoding:NB,serializePathEncoding:Jz,normalizeQueryFragmentEncoding:Yz,encodeQuery:DB,encodeFragment:MB,reescapeHostDelimiters:LB,isIPv4:tI,nonSimpleDomain:BB}=dk(),{SCHEMES:nI,getSchemeHandler:hk}=Zz(),rI=/^[A-Za-z][A-Za-z0-9+.-]*$/u,aI="URI scheme is malformed.";function Xz(e){let t=unescape(String(e));if(!rI.test(t))throw new TypeError(aI);return t}function UB(e,t){return typeof e=="string"?e=ZB(e,t):typeof e=="object"&&(e=Im(ga(e,t),t)),e}function FB(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:l,malformedScheme:c}=zm(e,a),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:p,malformedHost:g,malformedScheme:h}=zm(t,a);if(i||d||o||m||s||p||l||g||c||h)throw new Error(n.error||u.error||"URI is malformed.");let f=iI(n,u,a,!0),k=hk(r&&r.scheme||f.scheme),b=f.host,v=b!==void 0&&b!==""&&(tI(b)||eI(b).isIPV6);oI(f,r||{},k,v);let C=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(f.error&&!C)throw new Error(f.error);return a.skipEscape=!0,ga(f,a)}function iI(e,t,r,a){let n={};return a||(e=Im(ga(e,r),r),t=Im(ga(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=zl(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=zl(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=zl(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=zl(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function qB(e,t,r){let a=Qz(e,r),n=Qz(t,r);return a!==void 0&&n!==void 0&&a===n}function ga(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:""},a=Object.assign({},t),n=[];r.scheme&&(r.scheme=Xz(r.scheme));let i=hk(a.scheme||r.scheme);i&&i.serialize&&i.serialize(r,a);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,s=!a.skipEscape&&r.scheme===void 0&&!o;r.path!==void 0&&(a.skipEscape?r.path=gk(r.path):r.path=Jz(r.path,s)),a.reference!=="suffix"&&r.scheme&&(r.scheme=Xz(r.scheme),n.push(r.scheme,":"));let l=OB(r);if(l!==void 0&&(a.reference!=="suffix"&&n.push("//"),n.push(l),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let c=r.path;!a.absolutePath&&(!i||!i.absolutePath)&&(c=zl(c)),s&&(c=Jz(c,!0)),l===void 0&&c[0]==="/"&&c[1]==="/"&&(c="/%2F"+c.slice(2)),n.push(c)}return r.query!==void 0&&n.push("?",DB(r.query)),r.fragment!==void 0&&n.push("#",MB(r.fragment)),n.join("")}var HB=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,GB=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,VB=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function WB(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function Cl(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function fk(e){return e[0]==="["&&e[e.length-1]==="]"}function KB(e){let t=e[4];return Cl(e[3])||t!==void 0&&!fk(t)&&Cl(t)||Cl(e[6])||Cl(e[7])||Cl(e[8])}function oI(e,t,r,a){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!fk(e.host)&&(t.domainHost||r&&r.domainHost)&&a===!1&&BB(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(n){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function zm(e,t){let r=Object.assign({},t),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1,o=!1,s=!1,l=!1,c=!1,u=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(GB);d!==null&&d[1].indexOf("\\")!==-1&&(a.error="URI authority must not contain a literal backslash.",n=!0);let m=e.match(VB);if(m!==null){let g=m[1],h=g.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(a.error=a.error||"URI authority must not contain a literal backslash.",n=!0):g.length!==h.length&&(a.error=a.error||"URI authority introducer must not contain whitespace.",n=!0))}let p=e.match(HB);if(p){if(a.scheme=p[1],a.userinfo=p[3],a.host=p[4],a.port=parseInt(p[5],10),a.path=p[6]||"",a.query=p[7],a.fragment=p[8],a.scheme!==void 0){let f=unescape(a.scheme);rI.test(f)?a.scheme=f.toLowerCase():(a.error=a.error||aI,c=!0)}i=KB(p),i&&(a.error=a.error||"URI contains malformed percent-encoding."),isNaN(a.port)&&(a.port=p[5]);let g=WB(a,p);if(g!==void 0&&(a.error=a.error||g,n=!0),a.host)if(tI(a.host)===!1){let k=fk(a.host),b=a.host.indexOf("[")!==-1||a.host.indexOf("]")!==-1,v=eI(a.host);u=v.isIPV6||v.isIPVFuture===!0,l=b&&(!k||v.error===!0),a.host=u?v.host:v.host.toLowerCase(),l&&(a.error=a.error||"URI host is malformed.",n=!0)}else u=!0;a.scheme===void 0&&a.userinfo===void 0&&a.host===void 0&&a.port===void 0&&a.query===void 0&&!a.path?a.reference="same-document":a.scheme===void 0?a.reference="relative":a.fragment===void 0?a.reference="absolute":a.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==a.reference&&(a.error=a.error||"URI is not a "+r.reference+" reference.");let h=hk(r.scheme||a.scheme);if(l||(s=oI(a,r,h,u)),e.indexOf("%")!==-1&&a.host!==void 0&&!l){let f=u?a.host:gk(a.host,!0);u||(f=gk(f.toLowerCase())),a.host=LB(f,u)}(!h||h&&!h.skipNormalize)&&(a.path&&(a.path=NB(a.path)),a.query&&(a.query=Yz(a.query)),a.fragment&&(a.fragment=Yz(a.fragment))),h&&h.parse&&(h.parse(a,r),h===nI.urn&&a.nid===void 0&&(o=!0))}else a.error=a.error||"URI can not be parsed.";return{parsed:a,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}}function Im(e,t){return zm(e,t).parsed}function ZB(e,t){return sI(e,t).normalized}function sI(e,t){let{parsed:r,malformedAuthorityOrPort:a,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:s}=zm(e,t);return{normalized:a||n||i||o||s?e:ga(r,t),malformedAuthorityOrPort:a,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:s}}function Qz(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:ga(e,t)}catch{return}let{normalized:a,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:l}=sI(r,t);return n||i||o||s||l?void 0:a}var bk={SCHEMES:nI,normalize:UB,resolve:FB,resolveComponent:iI,equal:qB,serialize:ga,parse:Im};Pm.exports=bk;Pm.exports.default=bk;Pm.exports.fastUri=bk});var uI=j(vk=>{"use strict";Object.defineProperty(vk,"__esModule",{value:!0});var cI=lI();cI.code='require("ajv/dist/runtime/uri").default';vk.default=cI});var vI=j(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.CodeGen=Xe.Name=Xe.nil=Xe.stringify=Xe.str=Xe._=Xe.KeywordCxt=void 0;var JB=Tl();Object.defineProperty(Xe,"KeywordCxt",{enumerable:!0,get:function(){return JB.KeywordCxt}});var to=ne();Object.defineProperty(Xe,"_",{enumerable:!0,get:function(){return to._}});Object.defineProperty(Xe,"str",{enumerable:!0,get:function(){return to.str}});Object.defineProperty(Xe,"stringify",{enumerable:!0,get:function(){return to.stringify}});Object.defineProperty(Xe,"nil",{enumerable:!0,get:function(){return to.nil}});Object.defineProperty(Xe,"Name",{enumerable:!0,get:function(){return to.Name}});Object.defineProperty(Xe,"CodeGen",{enumerable:!0,get:function(){return to.CodeGen}});var YB=Em(),hI=Al(),XB=By(),Il=Tm(),QB=ne(),Pl=Sl(),Rm=wl(),kk=pe(),dI=Dz(),e3=uI(),fI=(e,t)=>new RegExp(e,t);fI.code="new RegExp";var t3=["removeAdditional","useDefaults","coerceTypes"],n3=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),r3={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."},a3={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},pI=200;function i3(e){var t,r,a,n,i,o,s,l,c,u,d,m,p,g,h,f,k,b,v,C,S,P,U,qe,D;let re=e.strict,Ie=(t=e.code)===null||t===void 0?void 0:t.optimize,et=Ie===!0||Ie===void 0?1:Ie||0,Le=(a=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&a!==void 0?a:fI,on=(n=e.uriResolver)!==null&&n!==void 0?n:e3.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:re)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=e.strictNumbers)!==null&&s!==void 0?s:re)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:re)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:re)!==null&&m!==void 0?m:"log",strictRequired:(g=(p=e.strictRequired)!==null&&p!==void 0?p:re)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:et,regExp:Le}:{optimize:et,regExp:Le},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:pI,loopEnum:(f=e.loopEnum)!==null&&f!==void 0?f:pI,meta:(k=e.meta)!==null&&k!==void 0?k:!0,messages:(b=e.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(P=e.validateSchema)!==null&&P!==void 0?P:!0,validateFormats:(U=e.validateFormats)!==null&&U!==void 0?U:!0,unicodeRegExp:(qe=e.unicodeRegExp)!==null&&qe!==void 0?qe:!0,int32range:(D=e.int32range)!==null&&D!==void 0?D:!0,uriResolver:on}}var Rl=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...i3(t)};let{es5:r,lines:a}=this.opts.code;this.scope=new QB.ValueScope({scope:{},prefixes:n3,es5:r,lines:a}),this.logger=d3(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,XB.getRules)(),mI.call(this,r3,t,"NOT SUPPORTED"),mI.call(this,a3,t,"DEPRECATED","warn"),this._metaOpts=c3.call(this),t.formats&&s3.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&l3.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),o3.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,n=dI;a==="id"&&(n={...dI},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[a],!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 a;if(typeof t=="string"){if(a=this.getSchema(t),!a)throw new Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let n=a(r);return"$async"in a||(this.errors=a.errors),n}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return n.call(this,t,r);async function n(u,d){await i.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function i(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof hI.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await i.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=a(u))}finally{delete this._loading[u]}}}addSchema(t,r,a,n=this.opts.validateSchema){if(Array.isArray(t)){for(let o of t)this.addSchema(o,void 0,a,n);return this}let i;if(typeof t=="object"){let{schemaId:o}=this.opts;if(i=t[o],i!==void 0&&typeof i!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Pl.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,n,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let a;if(a=t.$schema,a!==void 0&&typeof a!="string")throw new Error("$schema must be a string");if(a=a||this.opts.defaultMeta||this.defaultMeta(),!a)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(a,t);if(!n&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return n}getSchema(t){let r;for(;typeof(r=gI.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:a}=this.opts,n=new Il.SchemaEnv({schema:{},schemaId:a});if(r=Il.resolveSchema.call(this,n,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=gI.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 a=t[this.opts.schemaId];return a&&(a=(0,Pl.normalizeId)(a),delete this.schemas[a],delete this.refs[a]),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 a;if(typeof t=="string")a=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if(typeof t=="object"&&r===void 0){if(r=t,a=r.keyword,Array.isArray(a)&&!a.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(m3.call(this,a,r),!r)return(0,kk.eachItem)(a,i=>yk.call(this,i)),this;h3.call(this,r);let n={...r,type:(0,Rm.getJSONTypes)(r.type),schemaType:(0,Rm.getJSONTypes)(r.schemaType)};return(0,kk.eachItem)(a,n.type.length===0?i=>yk.call(this,i,n):i=>n.type.forEach(o=>yk.call(this,i,n,o))),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 a of r.rules){let n=a.rules.findIndex(i=>i.keyword===t);n>=0&&a.rules.splice(n,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:a="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${a}${n.instancePath} ${n.message}`).reduce((n,i)=>n+r+i)}$dataMetaSchema(t,r){let a=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let i=n.split("/").slice(1),o=t;for(let s of i)o=o[s];for(let s in a){let l=a[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=bI(u))}}return t}_removeAllSchemas(t,r){for(let a in t){let n=t[a];(!r||r.test(a))&&(typeof n=="string"?delete t[a]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[a]))}}_addSchema(t,r,a,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof t=="object")o=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 l=this._cache.get(t);if(l!==void 0)return l;a=(0,Pl.normalizeId)(o||a);let c=Pl.getSchemaRefs.call(this,t,a);return l=new Il.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:a,localRefs:c}),this._cache.set(l.schema,l),i&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=l),n&&this.validateSchema(t,!0),l}_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):Il.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{Il.compileSchema.call(this,t)}finally{this.opts=r}}};Rl.ValidationError=YB.default;Rl.MissingRefError=hI.default;Xe.default=Rl;function mI(e,t,r,a="error"){for(let n in e){let i=n;i in t&&this.logger[a](`${r}: option ${n}. ${e[i]}`)}}function gI(e){return e=(0,Pl.normalizeId)(e),this.schemas[e]||this.refs[e]}function o3(){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 s3(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function l3(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 c3(){let e={...this.opts};for(let t of t3)delete e[t];return e}var u3={log(){},warn(){},error(){}};function d3(e){if(e===!1)return u3;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 p3=/^[a-z_$][a-z0-9_$:-]*$/i;function m3(e,t){let{RULES:r}=this;if((0,kk.eachItem)(e,a=>{if(r.keywords[a])throw new Error(`Keyword ${a} is already defined`);if(!p3.test(a))throw new Error(`Keyword ${a} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function yk(e,t,r){var a;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=n?i.post:i.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},i.rules.push(o)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,Rm.getJSONTypes)(t.type),schemaType:(0,Rm.getJSONTypes)(t.schemaType)}};t.before?g3.call(this,o,s,t.before):o.rules.push(s),i.all[e]=s,(a=t.implements)===null||a===void 0||a.forEach(l=>this.addKeyword(l))}function g3(e,t,r){let a=e.rules.findIndex(n=>n.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function h3(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=bI(t)),e.validateSchema=this.compile(t,!0))}var f3={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function bI(e){return{anyOf:[e,f3]}}});var yI=j(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var b3={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};_k.default=b3});var SI=j(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.callRef=ha.getValidate=void 0;var v3=Al(),kI=qt(),At=ne(),no=Kn(),_I=Tm(),$m=pe(),y3={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:a}=e,{baseId:n,schemaEnv:i,validateName:o,opts:s,self:l}=a,{root:c}=i;if((r==="#"||r==="#/")&&n===c.baseId)return d();let u=_I.resolveRef.call(l,c,n,r);if(u===void 0)throw new v3.default(a.opts.uriResolver,n,r);if(u instanceof _I.SchemaEnv)return m(u);return p(u);function d(){if(i===c)return jm(e,o,i,i.$async);let g=t.scopeValue("root",{ref:c});return jm(e,(0,At._)`${g}.validate`,c,c.$async)}function m(g){let h=wI(e,g);jm(e,h,g,g.$async)}function p(g){let h=t.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,At.stringify)(g)}:{ref:g}),f=t.name("valid"),k=e.subschema({schema:g,dataTypes:[],schemaPath:At.nil,topSchemaRef:h,errSchemaPath:r},f);e.mergeEvaluated(k),e.ok(f)}}};function wI(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,At._)`${r.scopeValue("wrapper",{ref:t})}.validate`}ha.getValidate=wI;function jm(e,t,r,a){let{gen:n,it:i}=e,{allErrors:o,schemaEnv:s,opts:l}=i,c=l.passContext?no.default.this:At.nil;a?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{n.code((0,At._)`await ${(0,kI.callValidateCode)(e,t,c)}`),p(t),o||n.assign(g,!0)},h=>{n.if((0,At._)`!(${h} instanceof ${i.ValidationError})`,()=>n.throw(h)),m(h),o||n.assign(g,!1)}),e.ok(g)}function d(){e.result((0,kI.callValidateCode)(e,t,c),()=>p(t),()=>m(t))}function m(g){let h=(0,At._)`${g}.errors`;n.assign(no.default.vErrors,(0,At._)`${no.default.vErrors} === null ? ${h} : ${no.default.vErrors}.concat(${h})`),n.assign(no.default.errors,(0,At._)`${no.default.vErrors}.length`)}function p(g){var h;if(!i.opts.unevaluated)return;let f=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(f&&!f.dynamicProps)f.props!==void 0&&(i.props=$m.mergeEvaluated.props(n,f.props,i.props));else{let k=n.var("props",(0,At._)`${g}.evaluated.props`);i.props=$m.mergeEvaluated.props(n,k,i.props,At.Name)}if(i.items!==!0)if(f&&!f.dynamicItems)f.items!==void 0&&(i.items=$m.mergeEvaluated.items(n,f.items,i.items));else{let k=n.var("items",(0,At._)`${g}.evaluated.items`);i.items=$m.mergeEvaluated.items(n,k,i.items,At.Name)}}}ha.callRef=jm;ha.default=y3});var EI=j(wk=>{"use strict";Object.defineProperty(wk,"__esModule",{value:!0});var k3=yI(),_3=SI(),w3=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",k3.default,_3.default];wk.default=w3});var xI=j(Sk=>{"use strict";Object.defineProperty(Sk,"__esModule",{value:!0});var Om=ne(),zr=Om.operators,Nm={maximum:{okStr:"<=",ok:zr.LTE,fail:zr.GT},minimum:{okStr:">=",ok:zr.GTE,fail:zr.LT},exclusiveMaximum:{okStr:"<",ok:zr.LT,fail:zr.GTE},exclusiveMinimum:{okStr:">",ok:zr.GT,fail:zr.LTE}},S3={message:({keyword:e,schemaCode:t})=>(0,Om.str)`must be ${Nm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Om._)`{comparison: ${Nm[e].okStr}, limit: ${t}}`},E3={keyword:Object.keys(Nm),type:"number",schemaType:"number",$data:!0,error:S3,code(e){let{keyword:t,data:r,schemaCode:a}=e;e.fail$data((0,Om._)`${r} ${Nm[t].fail} ${a} || isNaN(${r})`)}};Sk.default=E3});var TI=j(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var $l=ne(),x3={message:({schemaCode:e})=>(0,$l.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,$l._)`{multipleOf: ${e}}`},T3={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:x3,code(e){let{gen:t,data:r,schemaCode:a,it:n}=e,i=n.opts.multipleOfPrecision,o=t.let("res"),s=i?(0,$l._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,$l._)`${o} !== parseInt(${o})`;e.fail$data((0,$l._)`(${a} === 0 || (${o} = ${r}/${a}, ${s}))`)}};Ek.default=T3});var CI=j(xk=>{"use strict";Object.defineProperty(xk,"__esModule",{value:!0});function AI(e){let t=e.length,r=0,a=0,n;for(;a<t;)r++,n=e.charCodeAt(a++),n>=55296&&n<=56319&&a<t&&(n=e.charCodeAt(a),(n&64512)===56320&&a++);return r}xk.default=AI;AI.code='require("ajv/dist/runtime/ucs2length").default'});var zI=j(Tk=>{"use strict";Object.defineProperty(Tk,"__esModule",{value:!0});var fa=ne(),A3=pe(),C3=CI(),z3={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,fa.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,fa._)`{limit: ${e}}`},I3={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:z3,code(e){let{keyword:t,data:r,schemaCode:a,it:n}=e,i=t==="maxLength"?fa.operators.GT:fa.operators.LT,o=n.opts.unicode===!1?(0,fa._)`${r}.length`:(0,fa._)`${(0,A3.useFunc)(e.gen,C3.default)}(${r})`;e.fail$data((0,fa._)`${o} ${i} ${a}`)}};Tk.default=I3});var II=j(Ak=>{"use strict";Object.defineProperty(Ak,"__esModule",{value:!0});var P3=qt(),R3=pe(),ro=ne(),$3={message:({schemaCode:e})=>(0,ro.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,ro._)`{pattern: ${e}}`},j3={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:$3,code(e){let{gen:t,data:r,$data:a,schema:n,schemaCode:i,it:o}=e,s=o.opts.unicodeRegExp?"u":"";if(a){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?(0,ro._)`new RegExp`:(0,R3.useFunc)(t,l),u=t.let("valid");t.try(()=>t.assign(u,(0,ro._)`${c}(${i}, ${s}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,ro._)`!${u}`)}else{let l=(0,P3.usePattern)(e,n);e.fail$data((0,ro._)`!${l}.test(${r})`)}}};Ak.default=j3});var PI=j(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var jl=ne(),O3={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,jl.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,jl._)`{limit: ${e}}`},N3={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:O3,code(e){let{keyword:t,data:r,schemaCode:a}=e,n=t==="maxProperties"?jl.operators.GT:jl.operators.LT;e.fail$data((0,jl._)`Object.keys(${r}).length ${n} ${a}`)}};Ck.default=N3});var RI=j(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});var Ol=qt(),Nl=ne(),D3=pe(),M3={message:({params:{missingProperty:e}})=>(0,Nl.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Nl._)`{missingProperty: ${e}}`},L3={keyword:"required",type:"object",schemaType:"array",$data:!0,error:M3,code(e){let{gen:t,schema:r,schemaCode:a,data:n,$data:i,it:o}=e,{opts:s}=o;if(!i&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(p?.[h]===void 0&&!g.has(h)){let f=o.schemaEnv.baseId+o.errSchemaPath,k=`required property "${h}" is not defined at "${f}" (strictRequired)`;(0,D3.checkStrictMode)(o,k,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Nl.nil,d);else for(let p of r)(0,Ol.checkReportMissingProp)(e,p)}function u(){let p=t.let("missing");if(l||i){let g=t.let("valid",!0);e.block$data(g,()=>m(p,g)),e.ok(g)}else t.if((0,Ol.checkMissingProp)(e,r,p)),(0,Ol.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",a,p=>{e.setParams({missingProperty:p}),t.if((0,Ol.noPropertyInData)(t,n,p,s.ownProperties),()=>e.error())})}function m(p,g){e.setParams({missingProperty:p}),t.forOf(p,a,()=>{t.assign(g,(0,Ol.propertyInData)(t,n,p,s.ownProperties)),t.if((0,Nl.not)(g),()=>{e.error(),t.break()})},Nl.nil)}}};zk.default=L3});var $I=j(Ik=>{"use strict";Object.defineProperty(Ik,"__esModule",{value:!0});var Dl=ne(),B3={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Dl.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Dl._)`{limit: ${e}}`},U3={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:B3,code(e){let{keyword:t,data:r,schemaCode:a}=e,n=t==="maxItems"?Dl.operators.GT:Dl.operators.LT;e.fail$data((0,Dl._)`${r}.length ${n} ${a}`)}};Ik.default=U3});var Dm=j(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jI=Ky();jI.code='require("ajv/dist/runtime/equal").default';Pk.default=jI});var OI=j($k=>{"use strict";Object.defineProperty($k,"__esModule",{value:!0});var Rk=wl(),Qe=ne(),F3=pe(),q3=Dm(),H3={message:({params:{i:e,j:t}})=>(0,Qe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Qe._)`{i: ${e}, j: ${t}}`},G3={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:H3,code(e){let{gen:t,data:r,$data:a,schema:n,parentSchema:i,schemaCode:o,it:s}=e;if(!a&&!n)return;let l=t.let("valid"),c=i.items?(0,Rk.getSchemaTypes)(i.items):[];e.block$data(l,u,(0,Qe._)`${o} === false`),e.ok(l);function u(){let g=t.let("i",(0,Qe._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(l,!0),t.if((0,Qe._)`${g} > 1`,()=>(d()?m:p)(g,h))}function d(){return c.length>0&&!c.some(g=>g==="object"||g==="array")}function m(g,h){let f=t.name("item"),k=(0,Rk.checkDataTypes)(c,f,s.opts.strictNumbers,Rk.DataType.Wrong),b=t.const("indices",(0,Qe._)`{}`);t.for((0,Qe._)`;${g}--;`,()=>{t.let(f,(0,Qe._)`${r}[${g}]`),t.if(k,(0,Qe._)`continue`),c.length>1&&t.if((0,Qe._)`typeof ${f} == "string"`,(0,Qe._)`${f} += "_"`),t.if((0,Qe._)`typeof ${b}[${f}] == "number"`,()=>{t.assign(h,(0,Qe._)`${b}[${f}]`),e.error(),t.assign(l,!1).break()}).code((0,Qe._)`${b}[${f}] = ${g}`)})}function p(g,h){let f=(0,F3.useFunc)(t,q3.default),k=t.name("outer");t.label(k).for((0,Qe._)`;${g}--;`,()=>t.for((0,Qe._)`${h} = ${g}; ${h}--;`,()=>t.if((0,Qe._)`${f}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(l,!1).break(k)})))}}};$k.default=G3});var NI=j(Ok=>{"use strict";Object.defineProperty(Ok,"__esModule",{value:!0});var jk=ne(),V3=pe(),W3=Dm(),K3={message:"must be equal to constant",params:({schemaCode:e})=>(0,jk._)`{allowedValue: ${e}}`},Z3={keyword:"const",$data:!0,error:K3,code(e){let{gen:t,data:r,$data:a,schemaCode:n,schema:i}=e;a||i&&typeof i=="object"?e.fail$data((0,jk._)`!${(0,V3.useFunc)(t,W3.default)}(${r}, ${n})`):e.fail((0,jk._)`${i} !== ${r}`)}};Ok.default=Z3});var DI=j(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Ml=ne(),J3=pe(),Y3=Dm(),X3={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ml._)`{allowedValues: ${e}}`},Q3={keyword:"enum",schemaType:"array",$data:!0,error:X3,code(e){let{gen:t,data:r,$data:a,schema:n,schemaCode:i,it:o}=e;if(!a&&n.length===0)throw new Error("enum must have non-empty array");let s=n.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,J3.useFunc)(t,Y3.default)),u;if(s||a)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let p=t.const("vSchema",i);u=(0,Ml.or)(...n.map((g,h)=>m(p,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",i,p=>t.if((0,Ml._)`${c()}(${r}, ${p})`,()=>t.assign(u,!0).break()))}function m(p,g){let h=n[g];return typeof h=="object"&&h!==null?(0,Ml._)`${c()}(${r}, ${p}[${g}])`:(0,Ml._)`${r} === ${h}`}}};Nk.default=Q3});var MI=j(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var eU=xI(),tU=TI(),nU=zI(),rU=II(),aU=PI(),iU=RI(),oU=$I(),sU=OI(),lU=NI(),cU=DI(),uU=[eU.default,tU.default,nU.default,rU.default,aU.default,iU.default,oU.default,sU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},lU.default,cU.default];Dk.default=uU});var Lk=j(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.validateAdditionalItems=void 0;var ba=ne(),Mk=pe(),dU={message:({params:{len:e}})=>(0,ba.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ba._)`{limit: ${e}}`},pU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dU,code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,Mk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}LI(e,a)}};function LI(e,t){let{gen:r,schema:a,data:n,keyword:i,it:o}=e;o.items=!0;let s=r.const("len",(0,ba._)`${n}.length`);if(a===!1)e.setParams({len:t.length}),e.pass((0,ba._)`${s} <= ${t.length}`);else if(typeof a=="object"&&!(0,Mk.alwaysValidSchema)(o,a)){let c=r.var("valid",(0,ba._)`${s} <= ${t.length}`);r.if((0,ba.not)(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,s,u=>{e.subschema({keyword:i,dataProp:u,dataPropType:Mk.Type.Num},c),o.allErrors||r.if((0,ba.not)(c),()=>r.break())})}}Ll.validateAdditionalItems=LI;Ll.default=pU});var Bk=j(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.validateTuple=void 0;var BI=ne(),Mm=pe(),mU=qt(),gU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return UI(e,"additionalItems",t);r.items=!0,!(0,Mm.alwaysValidSchema)(r,t)&&e.ok((0,mU.validateArray)(e))}};function UI(e,t,r=e.schema){let{gen:a,parentSchema:n,data:i,keyword:o,it:s}=e;u(n),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Mm.mergeEvaluated.items(a,r.length,s.items));let l=a.name("valid"),c=a.const("len",(0,BI._)`${i}.length`);r.forEach((d,m)=>{(0,Mm.alwaysValidSchema)(s,d)||(a.if((0,BI._)`${c} > ${m}`,()=>e.subschema({keyword:o,schemaProp:m,dataProp:m},l)),e.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let f=`"${o}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,Mm.checkStrictMode)(s,f,m.strictTuples)}}}Bl.validateTuple=UI;Bl.default=gU});var FI=j(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var hU=Bk(),fU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,hU.validateTuple)(e,"items")};Uk.default=fU});var HI=j(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var qI=ne(),bU=pe(),vU=qt(),yU=Lk(),kU={message:({params:{len:e}})=>(0,qI.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,qI._)`{limit: ${e}}`},_U={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:kU,code(e){let{schema:t,parentSchema:r,it:a}=e,{prefixItems:n}=r;a.items=!0,!(0,bU.alwaysValidSchema)(a,t)&&(n?(0,yU.validateAdditionalItems)(e,n):e.ok((0,vU.validateArray)(e)))}};Fk.default=_U});var GI=j(qk=>{"use strict";Object.defineProperty(qk,"__esModule",{value:!0});var Gt=ne(),Lm=pe(),wU={message:({params:{min:e,max:t}})=>t===void 0?(0,Gt.str)`must contain at least ${e} valid item(s)`:(0,Gt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Gt._)`{minContains: ${e}}`:(0,Gt._)`{minContains: ${e}, maxContains: ${t}}`},SU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:wU,code(e){let{gen:t,schema:r,parentSchema:a,data:n,it:i}=e,o,s,{minContains:l,maxContains:c}=a;i.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=t.const("len",(0,Gt._)`${n}.length`);if(e.setParams({min:o,max:s}),s===void 0&&o===0){(0,Lm.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,Lm.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Lm.alwaysValidSchema)(i,r)){let h=(0,Gt._)`${u} >= ${o}`;s!==void 0&&(h=(0,Gt._)`${h} && ${u} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&o===1?p(d,()=>t.if(d,()=>t.break())):o===0?(t.let(d,!0),s!==void 0&&t.if((0,Gt._)`${n}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),f=t.let("count",0);p(h,()=>t.if(h,()=>g(f)))}function p(h,f){t.forRange("i",0,u,k=>{e.subschema({keyword:"contains",dataProp:k,dataPropType:Lm.Type.Num,compositeRule:!0},h),f()})}function g(h){t.code((0,Gt._)`${h}++`),s===void 0?t.if((0,Gt._)`${h} >= ${o}`,()=>t.assign(d,!0).break()):(t.if((0,Gt._)`${h} > ${s}`,()=>t.assign(d,!1).break()),o===1?t.assign(d,!0):t.if((0,Gt._)`${h} >= ${o}`,()=>t.assign(d,!0)))}}};qk.default=SU});var KI=j(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.validateSchemaDeps=kn.validatePropertyDeps=kn.error=void 0;var Hk=ne(),EU=pe(),Ul=qt();kn.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let a=t===1?"property":"properties";return(0,Hk.str)`must have ${a} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:a}})=>(0,Hk._)`{property: ${e},
|
|
6
|
+
|| ${o} === "boolean" || ${n} === null`).assign(s,(0,te._)`[${n}]`)}}}function ML({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,te._)`${t} !== undefined`,()=>e.assign((0,te._)`${t}[${r}]`,a))}function Fy(e,t,r,a=Yi.Correct){let n=a===Yi.Correct?te.operators.EQ:te.operators.NEQ,i;switch(e){case"null":return(0,te._)`${t} ${n} null`;case"array":i=(0,te._)`Array.isArray(${t})`;break;case"object":i=(0,te._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o((0,te._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return(0,te._)`typeof ${t} ${n} ${e}`}return a===Yi.Correct?i:(0,te.not)(i);function o(s=te.nil){return(0,te.and)((0,te._)`typeof ${t} == "number"`,s,r?(0,te._)`isFinite(${t})`:te.nil)}}ot.checkDataType=Fy;function qy(e,t,r,a){if(e.length===1)return Fy(e[0],t,r,a);let n,i=(0,rz.toHash)(e);if(i.array&&i.object){let o=(0,te._)`typeof ${t} != "object"`;n=i.null?o:(0,te._)`!${t} || ${o}`,delete i.null,delete i.array,delete i.object}else n=te.nil;i.number&&delete i.integer;for(let o in i)n=(0,te.and)(n,Fy(o,t,r,a));return n}ot.checkDataTypes=qy;var LL={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,te._)`{type: ${e}}`:(0,te._)`{type: ${t}}`};function Hy(e){let t=BL(e);(0,$L.reportError)(t,LL)}ot.reportTypeError=Hy;function BL(e){let{gen:t,data:r,schema:a}=e,n=(0,rz.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:n,schemaValue:n,parentSchema:a,params:{},it:e}}});var sz=j(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.assignDefaults=void 0;var Xi=ne(),UL=pe();function FL(e,t){let{properties:r,items:a}=e.schema;if(t==="object"&&r)for(let n in r)oz(e,n,r[n].default);else t==="array"&&Array.isArray(a)&&a.forEach((n,i)=>oz(e,i,n.default))}km.assignDefaults=FL;function oz(e,t,r){let{gen:a,compositeRule:n,data:i,opts:o}=e;if(r===void 0)return;let s=(0,Xi._)`${i}${(0,Xi.getProperty)(t)}`;if(n){(0,UL.checkStrictMode)(e,`default is ignored for: ${s}`);return}let l=(0,Xi._)`${s} === undefined`;o.useDefaults==="empty"&&(l=(0,Xi._)`${l} || ${s} === null || ${s} === ""`),a.if(l,(0,Xi._)`${s} = ${(0,Xi.stringify)(r)}`)}});var qt=j(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.validateUnion=Ae.validateArray=Ae.usePattern=Ae.callValidateCode=Ae.schemaProperties=Ae.allSchemaProperties=Ae.noPropertyInData=Ae.propertyInData=Ae.isOwnProperty=Ae.hasPropFunc=Ae.reportMissingProp=Ae.checkMissingProp=Ae.checkReportMissingProp=void 0;var Pe=ne(),Gy=pe(),xr=Kn(),qL=pe();function HL(e,t){let{gen:r,data:a,it:n}=e;r.if(Wy(r,a,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:(0,Pe._)`${t}`},!0),e.error()})}Ae.checkReportMissingProp=HL;function GL({gen:e,data:t,it:{opts:r}},a,n){return(0,Pe.or)(...a.map(i=>(0,Pe.and)(Wy(e,t,i,r.ownProperties),(0,Pe._)`${n} = ${i}`)))}Ae.checkMissingProp=GL;function VL(e,t){e.setParams({missingProperty:t},!0),e.error()}Ae.reportMissingProp=VL;function lz(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,Pe._)`Object.prototype.hasOwnProperty`})}Ae.hasPropFunc=lz;function Vy(e,t,r){return(0,Pe._)`${lz(e)}.call(${t}, ${r})`}Ae.isOwnProperty=Vy;function WL(e,t,r,a){let n=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} !== undefined`;return a?(0,Pe._)`${n} && ${Vy(e,t,r)}`:n}Ae.propertyInData=WL;function Wy(e,t,r,a){let n=(0,Pe._)`${t}${(0,Pe.getProperty)(r)} === undefined`;return a?(0,Pe.or)(n,(0,Pe.not)(Vy(e,t,r))):n}Ae.noPropertyInData=Wy;function cz(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}Ae.allSchemaProperties=cz;function KL(e,t){return cz(t).filter(r=>!(0,Gy.alwaysValidSchema)(e,t[r]))}Ae.schemaProperties=KL;function ZL({schemaCode:e,data:t,it:{gen:r,topSchemaRef:a,schemaPath:n,errorPath:i},it:o},s,l,c){let u=c?(0,Pe._)`${e}, ${t}, ${a}${n}`:t,d=[[xr.default.instancePath,(0,Pe.strConcat)(xr.default.instancePath,i)],[xr.default.parentData,o.parentData],[xr.default.parentDataProperty,o.parentDataProperty],[xr.default.rootData,xr.default.rootData]];o.opts.dynamicRef&&d.push([xr.default.dynamicAnchors,xr.default.dynamicAnchors]);let m=(0,Pe._)`${u}, ${r.object(...d)}`;return l!==Pe.nil?(0,Pe._)`${s}.call(${l}, ${m})`:(0,Pe._)`${s}(${m})`}Ae.callValidateCode=ZL;var JL=(0,Pe._)`new RegExp`;function YL({gen:e,it:{opts:t}},r){let a=t.unicodeRegExp?"u":"",{regExp:n}=t.code,i=n(r,a);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,Pe._)`${n.code==="new RegExp"?JL:(0,qL.useFunc)(e,n)}(${r}, ${a})`})}Ae.usePattern=YL;function XL(e){let{gen:t,data:r,keyword:a,it:n}=e,i=t.name("valid");if(n.allErrors){let s=t.let("valid",!0);return o(()=>t.assign(s,!1)),s}return t.var(i,!0),o(()=>t.break()),i;function o(s){let l=t.const("len",(0,Pe._)`${r}.length`);t.forRange("i",0,l,c=>{e.subschema({keyword:a,dataProp:c,dataPropType:Gy.Type.Num},i),t.if((0,Pe.not)(i),s)})}}Ae.validateArray=XL;function QL(e){let{gen:t,schema:r,keyword:a,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(l=>(0,Gy.alwaysValidSchema)(n,l))&&!n.opts.unevaluated)return;let o=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((l,c)=>{let u=e.subschema({keyword:a,schemaProp:c,compositeRule:!0},s);t.assign(o,(0,Pe._)`${o} || ${s}`),e.mergeValidEvaluated(u,s)||t.if((0,Pe.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}Ae.validateUnion=QL});var pz=j(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.validateKeywordUsage=vn.validSchemaType=vn.funcKeywordCode=vn.macroKeywordCode=void 0;var bt=ne(),da=Kn(),e4=qt(),t4=_l();function n4(e,t){let{gen:r,keyword:a,schema:n,parentSchema:i,it:o}=e,s=t.macro.call(o.self,n,i,o),l=dz(r,a,s);o.opts.validateSchema!==!1&&o.self.validateSchema(s,!0);let c=r.name("valid");e.subschema({schema:s,schemaPath:bt.nil,errSchemaPath:`${o.errSchemaPath}/${a}`,topSchemaRef:l,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}vn.macroKeywordCode=n4;function r4(e,t){var r;let{gen:a,keyword:n,schema:i,parentSchema:o,$data:s,it:l}=e;i4(l,t);let c=!s&&t.compile?t.compile.call(l.self,i,o,l):t.validate,u=dz(a,n,c),d=a.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&uz(e),f(()=>e.error());else{let k=t.async?p():g();t.modifying&&uz(e),f(()=>a4(e,k))}}function p(){let k=a.let("ruleErrs",null);return a.try(()=>h((0,bt._)`await `),b=>a.assign(d,!1).if((0,bt._)`${b} instanceof ${l.ValidationError}`,()=>a.assign(k,(0,bt._)`${b}.errors`),()=>a.throw(b))),k}function g(){let k=(0,bt._)`${u}.errors`;return a.assign(k,null),h(bt.nil),k}function h(k=t.async?(0,bt._)`await `:bt.nil){let b=l.opts.passContext?da.default.this:da.default.self,v=!("compile"in t&&!s||t.schema===!1);a.assign(d,(0,bt._)`${k}${(0,e4.callValidateCode)(e,u,b,v)}`,t.modifying)}function f(k){var b;a.if((0,bt.not)((b=t.valid)!==null&&b!==void 0?b:d),k)}}vn.funcKeywordCode=r4;function uz(e){let{gen:t,data:r,it:a}=e;t.if(a.parentData,()=>t.assign(r,(0,bt._)`${a.parentData}[${a.parentDataProperty}]`))}function a4(e,t){let{gen:r}=e;r.if((0,bt._)`Array.isArray(${t})`,()=>{r.assign(da.default.vErrors,(0,bt._)`${da.default.vErrors} === null ? ${t} : ${da.default.vErrors}.concat(${t})`).assign(da.default.errors,(0,bt._)`${da.default.vErrors}.length`),(0,t4.extendErrors)(e)},()=>e.error())}function i4({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function dz(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,bt.stringify)(r)})}function o4(e,t,r=!1){return!t.length||t.some(a=>a==="array"?Array.isArray(e):a==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==a||r&&typeof e>"u")}vn.validSchemaType=o4;function s4({schema:e,opts:t,self:r,errSchemaPath:a},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw new Error("ajv implementation error");let o=n.dependencies;if(o?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${o.join(",")}`);if(n.validateSchema&&!n.validateSchema(e[i])){let l=`keyword "${i}" value is invalid at path "${a}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(l);else throw new Error(l)}}vn.validateKeywordUsage=s4});var gz=j(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.extendSubschemaMode=Tr.extendSubschemaData=Tr.getSubschema=void 0;var yn=ne(),mz=pe();function l4(e,{keyword:t,schemaProp:r,schema:a,schemaPath:n,errSchemaPath:i,topSchemaRef:o}){if(t!==void 0&&a!==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,yn._)`${e.schemaPath}${(0,yn.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,yn._)`${e.schemaPath}${(0,yn.getProperty)(t)}${(0,yn.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,mz.escapeFragment)(r)}`}}if(a!==void 0){if(n===void 0||i===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:n,topSchemaRef:o,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Tr.getSubschema=l4;function c4(e,t,{dataProp:r,dataPropType:a,data:n,dataTypes:i,propertyName:o}){if(n!==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:c,dataPathArr:u,opts:d}=t,m=s.let("data",(0,yn._)`${t.data}${(0,yn.getProperty)(r)}`,!0);l(m),e.errorPath=(0,yn.str)`${c}${(0,mz.getErrorPath)(r,a,d.jsPropertySyntax)}`,e.parentDataProperty=(0,yn._)`${r}`,e.dataPathArr=[...u,e.parentDataProperty]}if(n!==void 0){let c=n instanceof yn.Name?n:s.let("data",n,!0);l(c),o!==void 0&&(e.propertyName=o)}i&&(e.dataTypes=i);function l(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}Tr.extendSubschemaData=c4;function u4(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:n,allErrors:i}){a!==void 0&&(e.compositeRule=a),n!==void 0&&(e.createErrors=n),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}Tr.extendSubschemaMode=u4});var Ky=j((aY,hz)=>{"use strict";hz.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 a,n,i;if(Array.isArray(t)){if(a=t.length,a!=r.length)return!1;for(n=a;n--!==0;)if(!e(t[n],r[n]))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),a=i.length,a!==Object.keys(r).length)return!1;for(n=a;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=a;n--!==0;){var o=i[n];if(!e(t[o],r[o]))return!1}return!0}return t!==t&&r!==r}});var bz=j((iY,fz)=>{"use strict";var Ar=fz.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var a=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};_m(t,a,n,e,"",e)};Ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Ar.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 _m(e,t,r,a,n,i,o,s,l,c){if(a&&typeof a=="object"&&!Array.isArray(a)){t(a,n,i,o,s,l,c);for(var u in a){var d=a[u];if(Array.isArray(d)){if(u in Ar.arrayKeywords)for(var m=0;m<d.length;m++)_m(e,t,r,d[m],n+"/"+u+"/"+m,i,n,u,a,m)}else if(u in Ar.propsKeywords){if(d&&typeof d=="object")for(var p in d)_m(e,t,r,d[p],n+"/"+u+"/"+d4(p),i,n,u,a,p)}else(u in Ar.keywords||e.allKeys&&!(u in Ar.skipKeywords))&&_m(e,t,r,d,n+"/"+u,i,n,u,a)}r(a,n,i,o,s,l,c)}}function d4(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Sl=j(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.getSchemaRefs=xt.resolveUrl=xt.normalizeId=xt._getFullPath=xt.getFullPath=xt.inlineRef=void 0;var p4=pe(),m4=Ky(),g4=bz(),h4=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function f4(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Zy(e):t?vz(e)<=t:!1}xt.inlineRef=f4;var b4=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zy(e){for(let t in e){if(b4.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Zy)||typeof r=="object"&&Zy(r))return!0}return!1}function vz(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!h4.has(r)&&(typeof e[r]=="object"&&(0,p4.eachItem)(e[r],a=>t+=vz(a)),t===1/0))return 1/0}return t}function yz(e,t="",r){r!==!1&&(t=Qi(t));let a=e.parse(t);return kz(e,a)}xt.getFullPath=yz;function kz(e,t){return e.serialize(t).split("#")[0]+"#"}xt._getFullPath=kz;var v4=/#\/?$/;function Qi(e){return e?e.replace(v4,""):""}xt.normalizeId=Qi;function y4(e,t,r){return r=Qi(r),e.resolve(t,r)}xt.resolveUrl=y4;var k4=/^[a-z_][-a-z0-9._]*$/i;function _4(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:a}=this.opts,n=Qi(e[r]||t),i={"":n},o=yz(a,n,!1),s={},l=new Set;return g4(e,{allKeys:!0},(d,m,p,g)=>{if(g===void 0)return;let h=o+m,f=i[g];typeof d[r]=="string"&&(f=k.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),i[m]=f;function k(v){let C=this.opts.uriResolver.resolve;if(v=Qi(f?C(f,v):v),l.has(v))throw u(v);l.add(v);let S=this.refs[v];return typeof S=="string"&&(S=this.refs[S]),typeof S=="object"?c(d,S.schema,v):v!==Qi(h)&&(v[0]==="#"?(c(d,s[v],v),s[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!k4.test(v))throw new Error(`invalid anchor "${v}"`);k.call(this,`#${v}`)}}}),s;function c(d,m,p){if(m!==void 0&&!m4(d,m))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}xt.getSchemaRefs=_4});var Tl=j(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.getData=Cr.KeywordCxt=Cr.validateFunctionCode=void 0;var xz=ez(),_z=wl(),Yy=Uy(),wm=wl(),w4=sz(),xl=pz(),Jy=gz(),q=ne(),J=Kn(),S4=Sl(),Zn=pe(),El=_l();function E4(e){if(Cz(e)&&(zz(e),Az(e))){A4(e);return}Tz(e,()=>(0,xz.topBoolOrEmptySchema)(e))}Cr.validateFunctionCode=E4;function Tz({gen:e,validateName:t,schema:r,schemaEnv:a,opts:n},i){n.code.es5?e.func(t,(0,q._)`${J.default.data}, ${J.default.valCxt}`,a.$async,()=>{e.code((0,q._)`"use strict"; ${wz(r,n)}`),T4(e,n),e.code(i)}):e.func(t,(0,q._)`${J.default.data}, ${x4(n)}`,a.$async,()=>e.code(wz(r,n)).code(i))}function x4(e){return(0,q._)`{${J.default.instancePath}="", ${J.default.parentData}, ${J.default.parentDataProperty}, ${J.default.rootData}=${J.default.data}${e.dynamicRef?(0,q._)`, ${J.default.dynamicAnchors}={}`:q.nil}}={}`}function T4(e,t){e.if(J.default.valCxt,()=>{e.var(J.default.instancePath,(0,q._)`${J.default.valCxt}.${J.default.instancePath}`),e.var(J.default.parentData,(0,q._)`${J.default.valCxt}.${J.default.parentData}`),e.var(J.default.parentDataProperty,(0,q._)`${J.default.valCxt}.${J.default.parentDataProperty}`),e.var(J.default.rootData,(0,q._)`${J.default.valCxt}.${J.default.rootData}`),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,q._)`${J.default.valCxt}.${J.default.dynamicAnchors}`)},()=>{e.var(J.default.instancePath,(0,q._)`""`),e.var(J.default.parentData,(0,q._)`undefined`),e.var(J.default.parentDataProperty,(0,q._)`undefined`),e.var(J.default.rootData,J.default.data),t.dynamicRef&&e.var(J.default.dynamicAnchors,(0,q._)`{}`)})}function A4(e){let{schema:t,opts:r,gen:a}=e;Tz(e,()=>{r.$comment&&t.$comment&&Pz(e),R4(e),a.let(J.default.vErrors,null),a.let(J.default.errors,0),r.unevaluated&&C4(e),Iz(e),O4(e)})}function C4(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,q._)`${r}.evaluated`),t.if((0,q._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,q._)`${e.evaluated}.props`,(0,q._)`undefined`)),t.if((0,q._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,q._)`${e.evaluated}.items`,(0,q._)`undefined`))}function wz(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,q._)`/*# sourceURL=${r} */`:q.nil}function z4(e,t){if(Cz(e)&&(zz(e),Az(e))){I4(e,t);return}(0,xz.boolOrEmptySchema)(e,t)}function Az({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 Cz(e){return typeof e.schema!="boolean"}function I4(e,t){let{schema:r,gen:a,opts:n}=e;n.$comment&&r.$comment&&Pz(e),$4(e),j4(e);let i=a.const("_errs",J.default.errors);Iz(e,i),a.var(t,(0,q._)`${i} === ${J.default.errors}`)}function zz(e){(0,Zn.checkUnknownRules)(e),P4(e)}function Iz(e,t){if(e.opts.jtd)return Sz(e,[],!1,t);let r=(0,_z.getSchemaTypes)(e.schema),a=(0,_z.coerceAndCheckDataType)(e,r);Sz(e,r,!a,t)}function P4(e){let{schema:t,errSchemaPath:r,opts:a,self:n}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,Zn.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function R4(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Zn.checkStrictMode)(e,"default is ignored in the schema root")}function $4(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,S4.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function j4(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Pz({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:n}){let i=r.$comment;if(n.$comment===!0)e.code((0,q._)`${J.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let o=(0,q.str)`${a}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,q._)`${J.default.self}.opts.$comment(${i}, ${o}, ${s}.schema)`)}}function O4(e){let{gen:t,schemaEnv:r,validateName:a,ValidationError:n,opts:i}=e;r.$async?t.if((0,q._)`${J.default.errors} === 0`,()=>t.return(J.default.data),()=>t.throw((0,q._)`new ${n}(${J.default.vErrors})`)):(t.assign((0,q._)`${a}.errors`,J.default.vErrors),i.unevaluated&&N4(e),t.return((0,q._)`${J.default.errors} === 0`))}function N4({gen:e,evaluated:t,props:r,items:a}){r instanceof q.Name&&e.assign((0,q._)`${t}.props`,r),a instanceof q.Name&&e.assign((0,q._)`${t}.items`,a)}function Sz(e,t,r,a){let{gen:n,schema:i,data:o,allErrors:s,opts:l,self:c}=e,{RULES:u}=c;if(i.$ref&&(l.ignoreKeywordsWithRef||!(0,Zn.schemaHasRulesButRef)(i,u))){n.block(()=>$z(e,"$ref",u.all.$ref.definition));return}l.jtd||D4(e,t),n.block(()=>{for(let m of u.rules)d(m);d(u.post)});function d(m){(0,Yy.shouldUseGroup)(i,m)&&(m.type?(n.if((0,wm.checkDataType)(m.type,o,l.strictNumbers)),Ez(e,m),t.length===1&&t[0]===m.type&&r&&(n.else(),(0,wm.reportTypeError)(e)),n.endIf()):Ez(e,m),s||n.if((0,q._)`${J.default.errors} === ${a||0}`))}}function Ez(e,t){let{gen:r,schema:a,opts:{useDefaults:n}}=e;n&&(0,w4.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,Yy.shouldUseRule)(a,i)&&$z(e,i.keyword,i.definition,t.type)})}function D4(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(M4(e,t),e.opts.allowUnionTypes||L4(e,t),B4(e,e.dataTypes))}function M4(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Rz(e.dataTypes,r)||Xy(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),F4(e,t)}}function L4(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Xy(e,"use allowUnionTypes to allow union type keyword")}function B4(e,t){let r=e.self.RULES.all;for(let a in r){let n=r[a];if(typeof n=="object"&&(0,Yy.shouldUseRule)(e.schema,n)){let{type:i}=n.definition;i.length&&!i.some(o=>U4(t,o))&&Xy(e,`missing type "${i.join(",")}" for keyword "${a}"`)}}}function U4(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Rz(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function F4(e,t){let r=[];for(let a of e.dataTypes)Rz(t,a)?r.push(a):t.includes("integer")&&a==="number"&&r.push("integer");e.dataTypes=r}function Xy(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Zn.checkStrictMode)(e,t,e.opts.strictTypes)}var Sm=class{constructor(t,r,a){if((0,xl.validateKeywordUsage)(t,r,a),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=a,this.data=t.data,this.schema=t.schema[a],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Zn.schemaRefOrVal)(t,this.schema,a,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",jz(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,xl.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${a} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",J.default.errors))}result(t,r,a){this.failResult((0,q.not)(t),r,a)}failResult(t,r,a){this.gen.if(t),a?a():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,q.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,q._)`${r} !== undefined && (${(0,q.or)(this.invalid$data(),t)})`)}error(t,r,a){if(r){this.setParams(r),this._error(t,a),this.setParams({});return}this._error(t,a)}_error(t,r){(t?El.reportExtraError:El.reportError)(this,this.def.error,r)}$dataError(){(0,El.reportError)(this,this.def.$dataError||El.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,El.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,a=q.nil){this.gen.block(()=>{this.check$data(t,a),r()})}check$data(t=q.nil,r=q.nil){if(!this.$data)return;let{gen:a,schemaCode:n,schemaType:i,def:o}=this;a.if((0,q.or)((0,q._)`${n} === undefined`,r)),t!==q.nil&&a.assign(t,!0),(i.length||o.validateSchema)&&(a.elseIf(this.invalid$data()),this.$dataError(),t!==q.nil&&a.assign(t,!1)),a.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:a,def:n,it:i}=this;return(0,q.or)(o(),s());function o(){if(a.length){if(!(r instanceof q.Name))throw new Error("ajv implementation error");let l=Array.isArray(a)?a:[a];return(0,q._)`${(0,wm.checkDataTypes)(l,r,i.opts.strictNumbers,wm.DataType.Wrong)}`}return q.nil}function s(){if(n.validateSchema){let l=t.scopeValue("validate$data",{ref:n.validateSchema});return(0,q._)`!${l}(${r})`}return q.nil}}subschema(t,r){let a=(0,Jy.getSubschema)(this.it,t);(0,Jy.extendSubschemaData)(a,this.it,t),(0,Jy.extendSubschemaMode)(a,t);let n={...this.it,...a,items:void 0,props:void 0};return z4(n,r),n}mergeEvaluated(t,r){let{it:a,gen:n}=this;a.opts.unevaluated&&(a.props!==!0&&t.props!==void 0&&(a.props=Zn.mergeEvaluated.props(n,t.props,a.props,r)),a.items!==!0&&t.items!==void 0&&(a.items=Zn.mergeEvaluated.items(n,t.items,a.items,r)))}mergeValidEvaluated(t,r){let{it:a,gen:n}=this;if(a.opts.unevaluated&&(a.props!==!0||a.items!==!0))return n.if(r,()=>this.mergeEvaluated(t,q.Name)),!0}};Cr.KeywordCxt=Sm;function $z(e,t,r,a){let n=new Sm(e,r,t);"code"in r?r.code(n,a):n.$data&&r.validate?(0,xl.funcKeywordCode)(n,r):"macro"in r?(0,xl.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,xl.funcKeywordCode)(n,r)}var q4=/^\/(?:[^~]|~0|~1)*$/,H4=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function jz(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let n,i;if(e==="")return J.default.rootData;if(e[0]==="/"){if(!q4.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,i=J.default.rootData}else{let c=H4.exec(e);if(!c)throw new Error(`Invalid JSON-pointer: ${e}`);let u=+c[1];if(n=c[2],n==="#"){if(u>=t)throw new Error(l("property/index",u));return a[t-u]}if(u>t)throw new Error(l("data",u));if(i=r[t-u],!n)return i}let o=i,s=n.split("/");for(let c of s)c&&(i=(0,q._)`${i}${(0,q.getProperty)((0,Zn.unescapeJsonPointer)(c))}`,o=(0,q._)`${o} && ${i}`);return o;function l(c,u){return`Cannot access ${c} ${u} levels up, current level is ${t}`}}Cr.getData=jz});var Em=j(ek=>{"use strict";Object.defineProperty(ek,"__esModule",{value:!0});var Qy=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};ek.default=Qy});var Al=j(rk=>{"use strict";Object.defineProperty(rk,"__esModule",{value:!0});var tk=Sl(),nk=class extends Error{constructor(t,r,a,n){super(n||`can't resolve reference ${a} from id ${r}`),this.missingRef=(0,tk.resolveUrl)(t,r,a),this.missingSchema=(0,tk.normalizeId)((0,tk.getFullPath)(t,this.missingRef))}};rk.default=nk});var Tm=j(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.resolveSchema=Ht.getCompilingSchema=Ht.resolveRef=Ht.compileSchema=Ht.SchemaEnv=void 0;var tn=ne(),G4=Em(),pa=Kn(),nn=Sl(),Oz=pe(),V4=Tl(),eo=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let a;typeof t.schema=="object"&&(a=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,nn.normalizeId)(a?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=a?.$async,this.refs={}}};Ht.SchemaEnv=eo;function ik(e){let t=Nz.call(this,e);if(t)return t;let r=(0,nn.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:a,lines:n}=this.opts.code,{ownProperties:i}=this.opts,o=new tn.CodeGen(this.scope,{es5:a,lines:n,ownProperties:i}),s;e.$async&&(s=o.scopeValue("Error",{ref:G4.default,code:(0,tn._)`require("ajv/dist/runtime/validation_error").default`}));let l=o.scopeName("validate");e.validateName=l;let c={gen:o,allErrors:this.opts.allErrors,data:pa.default.data,parentData:pa.default.parentData,parentDataProperty:pa.default.parentDataProperty,dataNames:[pa.default.data],dataPathArr:[tn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,tn.stringify)(e.schema)}:{ref:e.schema}),validateName:l,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:tn.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,tn._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(e),(0,V4.validateFunctionCode)(c),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(pa.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,e));let p=new Function(`${pa.default.self}`,`${pa.default.scope}`,u)(this,this.scope.get());if(this.scope.value(l,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:l,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:g,items:h}=c;p.evaluated={props:g instanceof tn.Name?void 0:g,items:h instanceof tn.Name?void 0:h,dynamicProps:g instanceof tn.Name,dynamicItems:h instanceof tn.Name},p.source&&(p.source.evaluated=(0,tn.stringify)(p.evaluated))}return e.validate=p,e}catch(d){throw delete e.validate,delete e.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(e)}}Ht.compileSchema=ik;function W4(e,t,r){var a;r=(0,nn.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let i=J4.call(this,e,r);if(i===void 0){let o=(a=e.localRefs)===null||a===void 0?void 0:a[r],{schemaId:s}=this.opts;o&&(i=new eo({schema:o,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=K4.call(this,i)}Ht.resolveRef=W4;function K4(e){return(0,nn.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ik.call(this,e)}function Nz(e){for(let t of this._compilations)if(Z4(t,e))return t}Ht.getCompilingSchema=Nz;function Z4(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function J4(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||xm.call(this,e,t)}function xm(e,t){let r=this.opts.uriResolver.parse(t),a=(0,nn._getFullPath)(this.opts.uriResolver,r),n=(0,nn.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===n)return ak.call(this,r,e);let i=(0,nn.normalizeId)(a),o=this.refs[i]||this.schemas[i];if(typeof o=="string"){let s=xm.call(this,e,o);return typeof s?.schema!="object"?void 0:ak.call(this,r,s)}if(typeof o?.schema=="object"){if(o.validate||ik.call(this,o),i===(0,nn.normalizeId)(t)){let{schema:s}=o,{schemaId:l}=this.opts,c=s[l];return c&&(n=(0,nn.resolveUrl)(this.opts.uriResolver,n,c)),new eo({schema:s,schemaId:l,root:e,baseId:n})}return ak.call(this,r,o)}}Ht.resolveSchema=xm;var Y4=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ak(e,{baseId:t,schema:r,root:a}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let l=r[(0,Oz.unescapeFragment)(s)];if(l===void 0)return;r=l;let c=typeof r=="object"&&r[this.opts.schemaId];!Y4.has(s)&&c&&(t=(0,nn.resolveUrl)(this.opts.uriResolver,t,c))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Oz.schemaHasRulesButRef)(r,this.RULES)){let s=(0,nn.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=xm.call(this,a,s)}let{schemaId:o}=this.opts;if(i=i||new eo({schema:r,schemaId:o,root:a,baseId:t}),i.schema!==i.root.schema)return i}});var Dz=j((dY,X4)=>{X4.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 dk=j((pY,Hz)=>{"use strict";var Q4=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),sk=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),eB=RegExp.prototype.test.bind(/^\d*$/u),ma=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),lk=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Lz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),ck=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),tB=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Tt=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Tt[t]="%"+e[t>>4]+e[t&15]}function st(e){return e<2048?Tt[192|e>>6]+Tt[128|e&63]:e<65536?Tt[224|e>>12]+Tt[128|e>>6&63]+Tt[128|e&63]:Tt[240|e>>18]+Tt[128|e>>12&63]+Tt[128|e>>6&63]+Tt[128|e&63]}function nB(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(r=e[a].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(r=e[a].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}var rB=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),aB=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),iB=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),oB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function sB(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!iB(e[t])){if(e[t]==="%"&&t+2<e.length&&ma(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function Mz(e){let t=-1,r=0,a=-1,n=0;for(let s=0;s<e.length;s++)e[s]==="0"?(a===-1&&(a=s),n++,n>r&&(r=n,t=a)):(a=-1,n=0);if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),o=e.slice(t+r).join(":");return i+"::"+o}function lB(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),a=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),a.length===1&&a[0]===""&&(a.length=0));let n=r.concat(a),i=0;for(let s=0;s<n.length;s++){let l=n[s];if(l==="")return;if(l.indexOf(".")!==-1){if(s!==n.length-1||t!==-1&&a.length===0||!sk(l))return;i+=2;continue}if(!rB(l))return;n[s]=parseInt(l,16).toString(16),i++}if(t===-1)return i!==8?void 0:Mz(n);if(i>=8)return;let o=n.slice(0,r.length);for(let s=i;s<8;s++)o.push("0");for(let s=r.length;s<n.length;s++)o.push(n[s]);return Mz(o)}function ok(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let a=t?e.slice(1,-1):e;if(t&&aB(a))return a=a.toLowerCase(),{host:`[${a}]`,escapedHost:a,isIPV6:!1,isIPVFuture:!0};if(cB(a,":")<2)return{host:e,isIPV6:!1,error:t};let n="",i=a.indexOf("%");if(i!==-1){let s=a.slice(i,i+3).toLowerCase()==="%25"?3:1;if(n=a.slice(i+s),!sB(n))return{host:e,isIPV6:!1,error:!0};a=a.slice(0,i)}let o=lB(a);return o===void 0?{host:e,isIPV6:!1,error:!0}:{host:o+(n?"%"+n:""),escapedHost:o+(n?"%25"+n:""),isIPV6:!0}}function cB(e,t){let r=0;for(let a=0;a<e.length;a++)e[a]===t&&r++;return r}function uB(e){let t=e,r=[],a=-1,n=0;for(;n=t.length;){if(n===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(n===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(n===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((a=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")}var dB={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},pB=/[@/?#:]/g,mB=/[@/?#]/g;function Bz(e,t){let r=t?mB:pB;return r.lastIndex=0,e.replace(r,a=>dB[a])}function Uz(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let a=0;a<e.length;a++){if(e[a]==="%"&&a+2<e.length){let n=e.slice(a+1,a+3);if(ma(n)){let i=n.toUpperCase(),o=String.fromCharCode(parseInt(i,16));t&&lk(o)?r+=o:r+="%"+i,a+=2;continue}}r+=e[a]}return r}function gB(e){let t="";for(let r=0;r<e.length;r++){let a=e[r];if(a==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(ma(n)){let i=n.toUpperCase(),o=String.fromCharCode(parseInt(i,16));o!=="."&&lk(o)?t+=o:t+="%"+i,r+=2;continue}}if(Lz(a))t+=a;else{let n=e.charCodeAt(r);if(n<128)t+=qz(n)?a:Tt[n];else if(n<55296||n>57343)t+=st(n);else if(n<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=st(65536+(n-55296<<10)+(i-56320)),r++):t+=st(65533)}else t+=st(65533)}}return t}function hB(e,t=!1){let r="",a=t&&e[0]!=="/";for(let n=0;n<e.length;n++){let i=e[n];if(i==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(ma(o)){r+="%"+o.toUpperCase(),n+=2;continue}}if(i==="/"&&(a=!1),Lz(i)&&(i!==":"||!a))r+=i;else{let o=e.charCodeAt(n);if(o<128)r+=Tt[o];else if(o<55296||o>57343)r+=st(o);else if(o<=56319&&n+1<e.length){let s=e.charCodeAt(n+1);s>=56320&&s<=57343?(r+=st(65536+(o-55296<<10)+(s-56320)),n++):r+=st(65533)}else r+=st(65533)}}return r}function uk(e,t){let r="";for(let a=0;a<e.length;a++){let n=e[a];if(n==="%"&&a+2<e.length){let i=e.slice(a+1,a+3);if(ma(i)){r+="%"+i.toUpperCase(),a+=2;continue}}if(t(n))r+=n;else{let i=e.charCodeAt(a);if(i<128)r+=Tt[i];else if(i<55296||i>57343)r+=st(i);else if(i<=56319&&a+1<e.length){let o=e.charCodeAt(a+1);o>=56320&&o<=57343?(r+=st(65536+(i-55296<<10)+(o-56320)),a++):r+=st(65533)}else r+=st(65533)}}return r}function Fz(e){return uk(e,tB)}function fB(e){return uk(e,ck)}function bB(e){return uk(e,ck)}function qz(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function vB(e){let t="";for(let r=0;r<e.length;r++){let a=e[r];if(a==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(ma(n)){let i=n.toUpperCase(),o=String.fromCharCode(parseInt(i,16));lk(o)?t+=o:t+="%"+i,r+=2;continue}}if(ck(a))t+=a;else{let n=e.charCodeAt(r);if(n<128)t+=qz(n)?a:Tt[n];else if(n<55296||n>57343)t+=st(n);else if(n<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=st(65536+(n-55296<<10)+(i-56320)),r++):t+=st(65533)}else t+=st(65533)}}return t}function yB(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let a=e.slice(r+1,r+3);if(ma(a)){t+="%"+a.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function kB(e){let t=[];if(e.userinfo!==void 0&&(t.push(Fz(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!sk(r)){let a=ok(r);a.isIPV6!==!0&&a.isIPVFuture!==!0&&(r=Uz(r,!0),a=ok(r)),a.isIPV6===!0||a.isIPVFuture===!0?r=`[${a.escapedHost}]`:r=Bz(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!eB(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}Hz.exports={nonSimpleDomain:oB,recomposeAuthority:kB,reescapeHostDelimiters:Bz,normalizePercentEncoding:Uz,normalizePathEncoding:gB,serializePathEncoding:hB,normalizeQueryFragmentEncoding:vB,encodeUserinfo:Fz,encodeQuery:fB,encodeFragment:bB,escapePreservingEscapes:yB,removeDotSegments:uB,isIPv4:sk,isUUID:Q4,normalizeIPv6:ok,stringArrayToHexStripped:nB}});var Zz=j((mY,Kz)=>{"use strict";var{isUUID:_B}=dk(),wB=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,SB=["http","https","ws","wss","urn","urn:uuid"];function EB(e){return SB.indexOf(e)!==-1}function pk(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 Gz(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Vz(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 xB(e){return e.secure=pk(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function TB(e){if((e.port===(pk(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=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function AB(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(wB);if(r&&r[0]===e.path){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${a}:${t.nid||e.nid}`,i=mk(n);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function CB(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",a=e.nid.toLowerCase(),n=`${r}:${t.nid||a}`,i=mk(n);i&&(e=i.serialize(e,t));let o=e,s=e.nss;return o.path=`${a||t.nid}:${s}`,t.skipEscape=!0,o}function zB(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!_B(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function IB(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Wz={scheme:"http",domainHost:!0,parse:Gz,serialize:Vz},PB={scheme:"https",domainHost:Wz.domainHost,parse:Gz,serialize:Vz},Am={scheme:"ws",domainHost:!0,parse:xB,serialize:TB},RB={scheme:"wss",domainHost:Am.domainHost,parse:Am.parse,serialize:Am.serialize},$B={scheme:"urn",parse:AB,serialize:CB,skipNormalize:!0},jB={scheme:"urn:uuid",parse:zB,serialize:IB,skipNormalize:!0},Cm={http:Wz,https:PB,ws:Am,wss:RB,urn:$B,"urn:uuid":jB};Object.setPrototypeOf(Cm,null);function mk(e){return e&&(Cm[e]||Cm[e.toLowerCase()])||void 0}Kz.exports={wsIsSecure:pk,SCHEMES:Cm,isValidSchemeName:EB,getSchemeHandler:mk}});var lI=j((gY,Pm)=>{"use strict";var{normalizeIPv6:eI,removeDotSegments:zl,recomposeAuthority:OB,normalizePercentEncoding:gk,normalizePathEncoding:NB,serializePathEncoding:Jz,normalizeQueryFragmentEncoding:Yz,encodeQuery:DB,encodeFragment:MB,reescapeHostDelimiters:LB,isIPv4:tI,nonSimpleDomain:BB}=dk(),{SCHEMES:nI,getSchemeHandler:hk}=Zz(),rI=/^[A-Za-z][A-Za-z0-9+.-]*$/u,aI="URI scheme is malformed.";function Xz(e){let t=unescape(String(e));if(!rI.test(t))throw new TypeError(aI);return t}function UB(e,t){return typeof e=="string"?e=ZB(e,t):typeof e=="object"&&(e=Im(ga(e,t),t)),e}function FB(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:l,malformedScheme:c}=zm(e,a),{parsed:u,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:p,malformedHost:g,malformedScheme:h}=zm(t,a);if(i||d||o||m||s||p||l||g||c||h)throw new Error(n.error||u.error||"URI is malformed.");let f=iI(n,u,a,!0),k=hk(r&&r.scheme||f.scheme),b=f.host,v=b!==void 0&&b!==""&&(tI(b)||eI(b).isIPV6);oI(f,r||{},k,v);let C=b&&b.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(b);if(f.error&&!C)throw new Error(f.error);return a.skipEscape=!0,ga(f,a)}function iI(e,t,r,a){let n={};return a||(e=Im(ga(e,r),r),t=Im(ga(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=zl(t.path||""),n.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=zl(t.path||""),n.query=t.query):(t.path?(t.path[0]==="/"?n.path=zl(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?n.path="/"+t.path:e.path?n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:n.path=t.path,n.path=zl(n.path)),n.query=t.query):(n.path=e.path,t.query!==void 0?n.query=t.query:n.query=e.query),n.userinfo=e.userinfo,n.host=e.host,n.port=e.port),n.scheme=e.scheme),n.fragment=t.fragment,n}function qB(e,t,r){let a=Qz(e,r),n=Qz(t,r);return a!==void 0&&n!==void 0&&a===n}function ga(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:""},a=Object.assign({},t),n=[];r.scheme&&(r.scheme=Xz(r.scheme));let i=hk(a.scheme||r.scheme);i&&i.serialize&&i.serialize(r,a);let o=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,s=!a.skipEscape&&r.scheme===void 0&&!o;r.path!==void 0&&(a.skipEscape?r.path=gk(r.path):r.path=Jz(r.path,s)),a.reference!=="suffix"&&r.scheme&&(r.scheme=Xz(r.scheme),n.push(r.scheme,":"));let l=OB(r);if(l!==void 0&&(a.reference!=="suffix"&&n.push("//"),n.push(l),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let c=r.path;!a.absolutePath&&(!i||!i.absolutePath)&&(c=zl(c)),s&&(c=Jz(c,!0)),l===void 0&&c[0]==="/"&&c[1]==="/"&&(c="/%2F"+c.slice(2)),n.push(c)}return r.query!==void 0&&n.push("?",DB(r.query)),r.fragment!==void 0&&n.push("#",MB(r.fragment)),n.join("")}var HB=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,GB=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,VB=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function WB(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function Cl(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function fk(e){return e[0]==="["&&e[e.length-1]==="]"}function KB(e){let t=e[4];return Cl(e[3])||t!==void 0&&!fk(t)&&Cl(t)||Cl(e[6])||Cl(e[7])||Cl(e[8])}function oI(e,t,r,a){if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!fk(e.host)&&(t.domainHost||r&&r.domainHost)&&a===!1&&BB(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(n){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+n,!0}return!1}function zm(e,t){let r=Object.assign({},t),a={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1,o=!1,s=!1,l=!1,c=!1,u=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(GB);d!==null&&d[1].indexOf("\\")!==-1&&(a.error="URI authority must not contain a literal backslash.",n=!0);let m=e.match(VB);if(m!==null){let g=m[1],h=g.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(a.error=a.error||"URI authority must not contain a literal backslash.",n=!0):g.length!==h.length&&(a.error=a.error||"URI authority introducer must not contain whitespace.",n=!0))}let p=e.match(HB);if(p){if(a.scheme=p[1],a.userinfo=p[3],a.host=p[4],a.port=parseInt(p[5],10),a.path=p[6]||"",a.query=p[7],a.fragment=p[8],a.scheme!==void 0){let f=unescape(a.scheme);rI.test(f)?a.scheme=f.toLowerCase():(a.error=a.error||aI,c=!0)}i=KB(p),i&&(a.error=a.error||"URI contains malformed percent-encoding."),isNaN(a.port)&&(a.port=p[5]);let g=WB(a,p);if(g!==void 0&&(a.error=a.error||g,n=!0),a.host)if(tI(a.host)===!1){let k=fk(a.host),b=a.host.indexOf("[")!==-1||a.host.indexOf("]")!==-1,v=eI(a.host);u=v.isIPV6||v.isIPVFuture===!0,l=b&&(!k||v.error===!0),a.host=u?v.host:v.host.toLowerCase(),l&&(a.error=a.error||"URI host is malformed.",n=!0)}else u=!0;a.scheme===void 0&&a.userinfo===void 0&&a.host===void 0&&a.port===void 0&&a.query===void 0&&!a.path?a.reference="same-document":a.scheme===void 0?a.reference="relative":a.fragment===void 0?a.reference="absolute":a.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==a.reference&&(a.error=a.error||"URI is not a "+r.reference+" reference.");let h=hk(r.scheme||a.scheme);if(l||(s=oI(a,r,h,u)),e.indexOf("%")!==-1&&a.host!==void 0&&!l){let f=u?a.host:gk(a.host,!0);u||(f=gk(f.toLowerCase())),a.host=LB(f,u)}(!h||h&&!h.skipNormalize)&&(a.path&&(a.path=NB(a.path)),a.query&&(a.query=Yz(a.query)),a.fragment&&(a.fragment=Yz(a.fragment))),h&&h.parse&&(h.parse(a,r),h===nI.urn&&a.nid===void 0&&(o=!0))}else a.error=a.error||"URI can not be parsed.";return{parsed:a,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:c}}function Im(e,t){return zm(e,t).parsed}function ZB(e,t){return sI(e,t).normalized}function sI(e,t){let{parsed:r,malformedAuthorityOrPort:a,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:s}=zm(e,t);return{normalized:a||n||i||o||s?e:ga(r,t),malformedAuthorityOrPort:a,malformedPercentEncoding:n,malformedSchemeSpecific:i,malformedHost:o,malformedScheme:s}}function Qz(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:ga(e,t)}catch{return}let{normalized:a,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:s,malformedScheme:l}=sI(r,t);return n||i||o||s||l?void 0:a}var bk={SCHEMES:nI,normalize:UB,resolve:FB,resolveComponent:iI,equal:qB,serialize:ga,parse:Im};Pm.exports=bk;Pm.exports.default=bk;Pm.exports.fastUri=bk});var uI=j(vk=>{"use strict";Object.defineProperty(vk,"__esModule",{value:!0});var cI=lI();cI.code='require("ajv/dist/runtime/uri").default';vk.default=cI});var vI=j(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.CodeGen=Xe.Name=Xe.nil=Xe.stringify=Xe.str=Xe._=Xe.KeywordCxt=void 0;var JB=Tl();Object.defineProperty(Xe,"KeywordCxt",{enumerable:!0,get:function(){return JB.KeywordCxt}});var to=ne();Object.defineProperty(Xe,"_",{enumerable:!0,get:function(){return to._}});Object.defineProperty(Xe,"str",{enumerable:!0,get:function(){return to.str}});Object.defineProperty(Xe,"stringify",{enumerable:!0,get:function(){return to.stringify}});Object.defineProperty(Xe,"nil",{enumerable:!0,get:function(){return to.nil}});Object.defineProperty(Xe,"Name",{enumerable:!0,get:function(){return to.Name}});Object.defineProperty(Xe,"CodeGen",{enumerable:!0,get:function(){return to.CodeGen}});var YB=Em(),hI=Al(),XB=By(),Il=Tm(),QB=ne(),Pl=Sl(),Rm=wl(),kk=pe(),dI=Dz(),e3=uI(),fI=(e,t)=>new RegExp(e,t);fI.code="new RegExp";var t3=["removeAdditional","useDefaults","coerceTypes"],n3=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),r3={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."},a3={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},pI=200;function i3(e){var t,r,a,n,i,o,s,l,c,u,d,m,p,g,h,f,k,b,v,C,S,P,U,qe,D;let re=e.strict,Ie=(t=e.code)===null||t===void 0?void 0:t.optimize,et=Ie===!0||Ie===void 0?1:Ie||0,Le=(a=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&a!==void 0?a:fI,on=(n=e.uriResolver)!==null&&n!==void 0?n:e3.default;return{strictSchema:(o=(i=e.strictSchema)!==null&&i!==void 0?i:re)!==null&&o!==void 0?o:!0,strictNumbers:(l=(s=e.strictNumbers)!==null&&s!==void 0?s:re)!==null&&l!==void 0?l:!0,strictTypes:(u=(c=e.strictTypes)!==null&&c!==void 0?c:re)!==null&&u!==void 0?u:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:re)!==null&&m!==void 0?m:"log",strictRequired:(g=(p=e.strictRequired)!==null&&p!==void 0?p:re)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:et,regExp:Le}:{optimize:et,regExp:Le},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:pI,loopEnum:(f=e.loopEnum)!==null&&f!==void 0?f:pI,meta:(k=e.meta)!==null&&k!==void 0?k:!0,messages:(b=e.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=e.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(S=e.addUsedSchema)!==null&&S!==void 0?S:!0,validateSchema:(P=e.validateSchema)!==null&&P!==void 0?P:!0,validateFormats:(U=e.validateFormats)!==null&&U!==void 0?U:!0,unicodeRegExp:(qe=e.unicodeRegExp)!==null&&qe!==void 0?qe:!0,int32range:(D=e.int32range)!==null&&D!==void 0?D:!0,uriResolver:on}}var Rl=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...i3(t)};let{es5:r,lines:a}=this.opts.code;this.scope=new QB.ValueScope({scope:{},prefixes:n3,es5:r,lines:a}),this.logger=d3(t.logger);let n=t.validateFormats;t.validateFormats=!1,this.RULES=(0,XB.getRules)(),mI.call(this,r3,t,"NOT SUPPORTED"),mI.call(this,a3,t,"DEPRECATED","warn"),this._metaOpts=c3.call(this),t.formats&&s3.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&l3.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),o3.call(this),t.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:a}=this.opts,n=dI;a==="id"&&(n={...dI},n.id=n.$id,delete n.$id),r&&t&&this.addMetaSchema(n,n[a],!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 a;if(typeof t=="string"){if(a=this.getSchema(t),!a)throw new Error(`no schema with key or ref "${t}"`)}else a=this.compile(t);let n=a(r);return"$async"in a||(this.errors=a.errors),n}compile(t,r){let a=this._addSchema(t,r);return a.validate||this._compileSchemaEnv(a)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:a}=this.opts;return n.call(this,t,r);async function n(u,d){await i.call(this,u.$schema);let m=this._addSchema(u,d);return m.validate||o.call(this,m)}async function i(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof hI.default))throw d;return s.call(this,d),await l.call(this,d.missingSchema),o.call(this,u)}}function s({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function l(u){let d=await c.call(this,u);this.refs[u]||await i.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=a(u))}finally{delete this._loading[u]}}}addSchema(t,r,a,n=this.opts.validateSchema){if(Array.isArray(t)){for(let o of t)this.addSchema(o,void 0,a,n);return this}let i;if(typeof t=="object"){let{schemaId:o}=this.opts;if(i=t[o],i!==void 0&&typeof i!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Pl.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,a,r,n,!0),this}addMetaSchema(t,r,a=this.opts.validateSchema){return this.addSchema(t,r,!0,a),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let a;if(a=t.$schema,a!==void 0&&typeof a!="string")throw new Error("$schema must be a string");if(a=a||this.opts.defaultMeta||this.defaultMeta(),!a)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(a,t);if(!n&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return n}getSchema(t){let r;for(;typeof(r=gI.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:a}=this.opts,n=new Il.SchemaEnv({schema:{},schemaId:a});if(r=Il.resolveSchema.call(this,n,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=gI.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 a=t[this.opts.schemaId];return a&&(a=(0,Pl.normalizeId)(a),delete this.schemas[a],delete this.refs[a]),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 a;if(typeof t=="string")a=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=a);else if(typeof t=="object"&&r===void 0){if(r=t,a=r.keyword,Array.isArray(a)&&!a.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(m3.call(this,a,r),!r)return(0,kk.eachItem)(a,i=>yk.call(this,i)),this;h3.call(this,r);let n={...r,type:(0,Rm.getJSONTypes)(r.type),schemaType:(0,Rm.getJSONTypes)(r.schemaType)};return(0,kk.eachItem)(a,n.type.length===0?i=>yk.call(this,i,n):i=>n.type.forEach(o=>yk.call(this,i,n,o))),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 a of r.rules){let n=a.rules.findIndex(i=>i.keyword===t);n>=0&&a.rules.splice(n,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:a="data"}={}){return!t||t.length===0?"No errors":t.map(n=>`${a}${n.instancePath} ${n.message}`).reduce((n,i)=>n+r+i)}$dataMetaSchema(t,r){let a=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let n of r){let i=n.split("/").slice(1),o=t;for(let s of i)o=o[s];for(let s in a){let l=a[s];if(typeof l!="object")continue;let{$data:c}=l.definition,u=o[s];c&&u&&(o[s]=bI(u))}}return t}_removeAllSchemas(t,r){for(let a in t){let n=t[a];(!r||r.test(a))&&(typeof n=="string"?delete t[a]:n&&!n.meta&&(this._cache.delete(n.schema),delete t[a]))}}_addSchema(t,r,a,n=this.opts.validateSchema,i=this.opts.addUsedSchema){let o,{schemaId:s}=this.opts;if(typeof t=="object")o=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 l=this._cache.get(t);if(l!==void 0)return l;a=(0,Pl.normalizeId)(o||a);let c=Pl.getSchemaRefs.call(this,t,a);return l=new Il.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:a,localRefs:c}),this._cache.set(l.schema,l),i&&!a.startsWith("#")&&(a&&this._checkUnique(a),this.refs[a]=l),n&&this.validateSchema(t,!0),l}_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):Il.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{Il.compileSchema.call(this,t)}finally{this.opts=r}}};Rl.ValidationError=YB.default;Rl.MissingRefError=hI.default;Xe.default=Rl;function mI(e,t,r,a="error"){for(let n in e){let i=n;i in t&&this.logger[a](`${r}: option ${n}. ${e[i]}`)}}function gI(e){return e=(0,Pl.normalizeId)(e),this.schemas[e]||this.refs[e]}function o3(){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 s3(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function l3(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 c3(){let e={...this.opts};for(let t of t3)delete e[t];return e}var u3={log(){},warn(){},error(){}};function d3(e){if(e===!1)return u3;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 p3=/^[a-z_$][a-z0-9_$:-]*$/i;function m3(e,t){let{RULES:r}=this;if((0,kk.eachItem)(e,a=>{if(r.keywords[a])throw new Error(`Keyword ${a} is already defined`);if(!p3.test(a))throw new Error(`Keyword ${a} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function yk(e,t,r){var a;let n=t?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,o=n?i.post:i.rules.find(({type:l})=>l===r);if(o||(o={type:r,rules:[]},i.rules.push(o)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,Rm.getJSONTypes)(t.type),schemaType:(0,Rm.getJSONTypes)(t.schemaType)}};t.before?g3.call(this,o,s,t.before):o.rules.push(s),i.all[e]=s,(a=t.implements)===null||a===void 0||a.forEach(l=>this.addKeyword(l))}function g3(e,t,r){let a=e.rules.findIndex(n=>n.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function h3(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=bI(t)),e.validateSchema=this.compile(t,!0))}var f3={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function bI(e){return{anyOf:[e,f3]}}});var yI=j(_k=>{"use strict";Object.defineProperty(_k,"__esModule",{value:!0});var b3={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};_k.default=b3});var SI=j(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});ha.callRef=ha.getValidate=void 0;var v3=Al(),kI=qt(),At=ne(),no=Kn(),_I=Tm(),$m=pe(),y3={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:a}=e,{baseId:n,schemaEnv:i,validateName:o,opts:s,self:l}=a,{root:c}=i;if((r==="#"||r==="#/")&&n===c.baseId)return d();let u=_I.resolveRef.call(l,c,n,r);if(u===void 0)throw new v3.default(a.opts.uriResolver,n,r);if(u instanceof _I.SchemaEnv)return m(u);return p(u);function d(){if(i===c)return jm(e,o,i,i.$async);let g=t.scopeValue("root",{ref:c});return jm(e,(0,At._)`${g}.validate`,c,c.$async)}function m(g){let h=wI(e,g);jm(e,h,g,g.$async)}function p(g){let h=t.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,At.stringify)(g)}:{ref:g}),f=t.name("valid"),k=e.subschema({schema:g,dataTypes:[],schemaPath:At.nil,topSchemaRef:h,errSchemaPath:r},f);e.mergeEvaluated(k),e.ok(f)}}};function wI(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,At._)`${r.scopeValue("wrapper",{ref:t})}.validate`}ha.getValidate=wI;function jm(e,t,r,a){let{gen:n,it:i}=e,{allErrors:o,schemaEnv:s,opts:l}=i,c=l.passContext?no.default.this:At.nil;a?u():d();function u(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=n.let("valid");n.try(()=>{n.code((0,At._)`await ${(0,kI.callValidateCode)(e,t,c)}`),p(t),o||n.assign(g,!0)},h=>{n.if((0,At._)`!(${h} instanceof ${i.ValidationError})`,()=>n.throw(h)),m(h),o||n.assign(g,!1)}),e.ok(g)}function d(){e.result((0,kI.callValidateCode)(e,t,c),()=>p(t),()=>m(t))}function m(g){let h=(0,At._)`${g}.errors`;n.assign(no.default.vErrors,(0,At._)`${no.default.vErrors} === null ? ${h} : ${no.default.vErrors}.concat(${h})`),n.assign(no.default.errors,(0,At._)`${no.default.vErrors}.length`)}function p(g){var h;if(!i.opts.unevaluated)return;let f=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(f&&!f.dynamicProps)f.props!==void 0&&(i.props=$m.mergeEvaluated.props(n,f.props,i.props));else{let k=n.var("props",(0,At._)`${g}.evaluated.props`);i.props=$m.mergeEvaluated.props(n,k,i.props,At.Name)}if(i.items!==!0)if(f&&!f.dynamicItems)f.items!==void 0&&(i.items=$m.mergeEvaluated.items(n,f.items,i.items));else{let k=n.var("items",(0,At._)`${g}.evaluated.items`);i.items=$m.mergeEvaluated.items(n,k,i.items,At.Name)}}}ha.callRef=jm;ha.default=y3});var EI=j(wk=>{"use strict";Object.defineProperty(wk,"__esModule",{value:!0});var k3=yI(),_3=SI(),w3=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",k3.default,_3.default];wk.default=w3});var xI=j(Sk=>{"use strict";Object.defineProperty(Sk,"__esModule",{value:!0});var Om=ne(),zr=Om.operators,Nm={maximum:{okStr:"<=",ok:zr.LTE,fail:zr.GT},minimum:{okStr:">=",ok:zr.GTE,fail:zr.LT},exclusiveMaximum:{okStr:"<",ok:zr.LT,fail:zr.GTE},exclusiveMinimum:{okStr:">",ok:zr.GT,fail:zr.LTE}},S3={message:({keyword:e,schemaCode:t})=>(0,Om.str)`must be ${Nm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Om._)`{comparison: ${Nm[e].okStr}, limit: ${t}}`},E3={keyword:Object.keys(Nm),type:"number",schemaType:"number",$data:!0,error:S3,code(e){let{keyword:t,data:r,schemaCode:a}=e;e.fail$data((0,Om._)`${r} ${Nm[t].fail} ${a} || isNaN(${r})`)}};Sk.default=E3});var TI=j(Ek=>{"use strict";Object.defineProperty(Ek,"__esModule",{value:!0});var $l=ne(),x3={message:({schemaCode:e})=>(0,$l.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,$l._)`{multipleOf: ${e}}`},T3={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:x3,code(e){let{gen:t,data:r,schemaCode:a,it:n}=e,i=n.opts.multipleOfPrecision,o=t.let("res"),s=i?(0,$l._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${i}`:(0,$l._)`${o} !== parseInt(${o})`;e.fail$data((0,$l._)`(${a} === 0 || (${o} = ${r}/${a}, ${s}))`)}};Ek.default=T3});var CI=j(xk=>{"use strict";Object.defineProperty(xk,"__esModule",{value:!0});function AI(e){let t=e.length,r=0,a=0,n;for(;a<t;)r++,n=e.charCodeAt(a++),n>=55296&&n<=56319&&a<t&&(n=e.charCodeAt(a),(n&64512)===56320&&a++);return r}xk.default=AI;AI.code='require("ajv/dist/runtime/ucs2length").default'});var zI=j(Tk=>{"use strict";Object.defineProperty(Tk,"__esModule",{value:!0});var fa=ne(),A3=pe(),C3=CI(),z3={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,fa.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,fa._)`{limit: ${e}}`},I3={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:z3,code(e){let{keyword:t,data:r,schemaCode:a,it:n}=e,i=t==="maxLength"?fa.operators.GT:fa.operators.LT,o=n.opts.unicode===!1?(0,fa._)`${r}.length`:(0,fa._)`${(0,A3.useFunc)(e.gen,C3.default)}(${r})`;e.fail$data((0,fa._)`${o} ${i} ${a}`)}};Tk.default=I3});var II=j(Ak=>{"use strict";Object.defineProperty(Ak,"__esModule",{value:!0});var P3=qt(),R3=pe(),ro=ne(),$3={message:({schemaCode:e})=>(0,ro.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,ro._)`{pattern: ${e}}`},j3={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:$3,code(e){let{gen:t,data:r,$data:a,schema:n,schemaCode:i,it:o}=e,s=o.opts.unicodeRegExp?"u":"";if(a){let{regExp:l}=o.opts.code,c=l.code==="new RegExp"?(0,ro._)`new RegExp`:(0,R3.useFunc)(t,l),u=t.let("valid");t.try(()=>t.assign(u,(0,ro._)`${c}(${i}, ${s}).test(${r})`),()=>t.assign(u,!1)),e.fail$data((0,ro._)`!${u}`)}else{let l=(0,P3.usePattern)(e,n);e.fail$data((0,ro._)`!${l}.test(${r})`)}}};Ak.default=j3});var PI=j(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});var jl=ne(),O3={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,jl.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,jl._)`{limit: ${e}}`},N3={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:O3,code(e){let{keyword:t,data:r,schemaCode:a}=e,n=t==="maxProperties"?jl.operators.GT:jl.operators.LT;e.fail$data((0,jl._)`Object.keys(${r}).length ${n} ${a}`)}};Ck.default=N3});var RI=j(zk=>{"use strict";Object.defineProperty(zk,"__esModule",{value:!0});var Ol=qt(),Nl=ne(),D3=pe(),M3={message:({params:{missingProperty:e}})=>(0,Nl.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Nl._)`{missingProperty: ${e}}`},L3={keyword:"required",type:"object",schemaType:"array",$data:!0,error:M3,code(e){let{gen:t,schema:r,schemaCode:a,data:n,$data:i,it:o}=e,{opts:s}=o;if(!i&&r.length===0)return;let l=r.length>=s.loopRequired;if(o.allErrors?c():u(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(p?.[h]===void 0&&!g.has(h)){let f=o.schemaEnv.baseId+o.errSchemaPath,k=`required property "${h}" is not defined at "${f}" (strictRequired)`;(0,D3.checkStrictMode)(o,k,o.opts.strictRequired)}}function c(){if(l||i)e.block$data(Nl.nil,d);else for(let p of r)(0,Ol.checkReportMissingProp)(e,p)}function u(){let p=t.let("missing");if(l||i){let g=t.let("valid",!0);e.block$data(g,()=>m(p,g)),e.ok(g)}else t.if((0,Ol.checkMissingProp)(e,r,p)),(0,Ol.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",a,p=>{e.setParams({missingProperty:p}),t.if((0,Ol.noPropertyInData)(t,n,p,s.ownProperties),()=>e.error())})}function m(p,g){e.setParams({missingProperty:p}),t.forOf(p,a,()=>{t.assign(g,(0,Ol.propertyInData)(t,n,p,s.ownProperties)),t.if((0,Nl.not)(g),()=>{e.error(),t.break()})},Nl.nil)}}};zk.default=L3});var $I=j(Ik=>{"use strict";Object.defineProperty(Ik,"__esModule",{value:!0});var Dl=ne(),B3={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,Dl.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,Dl._)`{limit: ${e}}`},U3={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:B3,code(e){let{keyword:t,data:r,schemaCode:a}=e,n=t==="maxItems"?Dl.operators.GT:Dl.operators.LT;e.fail$data((0,Dl._)`${r}.length ${n} ${a}`)}};Ik.default=U3});var Dm=j(Pk=>{"use strict";Object.defineProperty(Pk,"__esModule",{value:!0});var jI=Ky();jI.code='require("ajv/dist/runtime/equal").default';Pk.default=jI});var OI=j($k=>{"use strict";Object.defineProperty($k,"__esModule",{value:!0});var Rk=wl(),Qe=ne(),F3=pe(),q3=Dm(),H3={message:({params:{i:e,j:t}})=>(0,Qe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Qe._)`{i: ${e}, j: ${t}}`},G3={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:H3,code(e){let{gen:t,data:r,$data:a,schema:n,parentSchema:i,schemaCode:o,it:s}=e;if(!a&&!n)return;let l=t.let("valid"),c=i.items?(0,Rk.getSchemaTypes)(i.items):[];e.block$data(l,u,(0,Qe._)`${o} === false`),e.ok(l);function u(){let g=t.let("i",(0,Qe._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(l,!0),t.if((0,Qe._)`${g} > 1`,()=>(d()?m:p)(g,h))}function d(){return c.length>0&&!c.some(g=>g==="object"||g==="array")}function m(g,h){let f=t.name("item"),k=(0,Rk.checkDataTypes)(c,f,s.opts.strictNumbers,Rk.DataType.Wrong),b=t.const("indices",(0,Qe._)`{}`);t.for((0,Qe._)`;${g}--;`,()=>{t.let(f,(0,Qe._)`${r}[${g}]`),t.if(k,(0,Qe._)`continue`),c.length>1&&t.if((0,Qe._)`typeof ${f} == "string"`,(0,Qe._)`${f} += "_"`),t.if((0,Qe._)`typeof ${b}[${f}] == "number"`,()=>{t.assign(h,(0,Qe._)`${b}[${f}]`),e.error(),t.assign(l,!1).break()}).code((0,Qe._)`${b}[${f}] = ${g}`)})}function p(g,h){let f=(0,F3.useFunc)(t,q3.default),k=t.name("outer");t.label(k).for((0,Qe._)`;${g}--;`,()=>t.for((0,Qe._)`${h} = ${g}; ${h}--;`,()=>t.if((0,Qe._)`${f}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(l,!1).break(k)})))}}};$k.default=G3});var NI=j(Ok=>{"use strict";Object.defineProperty(Ok,"__esModule",{value:!0});var jk=ne(),V3=pe(),W3=Dm(),K3={message:"must be equal to constant",params:({schemaCode:e})=>(0,jk._)`{allowedValue: ${e}}`},Z3={keyword:"const",$data:!0,error:K3,code(e){let{gen:t,data:r,$data:a,schemaCode:n,schema:i}=e;a||i&&typeof i=="object"?e.fail$data((0,jk._)`!${(0,V3.useFunc)(t,W3.default)}(${r}, ${n})`):e.fail((0,jk._)`${i} !== ${r}`)}};Ok.default=Z3});var DI=j(Nk=>{"use strict";Object.defineProperty(Nk,"__esModule",{value:!0});var Ml=ne(),J3=pe(),Y3=Dm(),X3={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ml._)`{allowedValues: ${e}}`},Q3={keyword:"enum",schemaType:"array",$data:!0,error:X3,code(e){let{gen:t,data:r,$data:a,schema:n,schemaCode:i,it:o}=e;if(!a&&n.length===0)throw new Error("enum must have non-empty array");let s=n.length>=o.opts.loopEnum,l,c=()=>l??(l=(0,J3.useFunc)(t,Y3.default)),u;if(s||a)u=t.let("valid"),e.block$data(u,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let p=t.const("vSchema",i);u=(0,Ml.or)(...n.map((g,h)=>m(p,h)))}e.pass(u);function d(){t.assign(u,!1),t.forOf("v",i,p=>t.if((0,Ml._)`${c()}(${r}, ${p})`,()=>t.assign(u,!0).break()))}function m(p,g){let h=n[g];return typeof h=="object"&&h!==null?(0,Ml._)`${c()}(${r}, ${p}[${g}])`:(0,Ml._)`${r} === ${h}`}}};Nk.default=Q3});var MI=j(Dk=>{"use strict";Object.defineProperty(Dk,"__esModule",{value:!0});var eU=xI(),tU=TI(),nU=zI(),rU=II(),aU=PI(),iU=RI(),oU=$I(),sU=OI(),lU=NI(),cU=DI(),uU=[eU.default,tU.default,nU.default,rU.default,aU.default,iU.default,oU.default,sU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},lU.default,cU.default];Dk.default=uU});var Lk=j(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.validateAdditionalItems=void 0;var ba=ne(),Mk=pe(),dU={message:({params:{len:e}})=>(0,ba.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,ba._)`{limit: ${e}}`},pU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dU,code(e){let{parentSchema:t,it:r}=e,{items:a}=t;if(!Array.isArray(a)){(0,Mk.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}LI(e,a)}};function LI(e,t){let{gen:r,schema:a,data:n,keyword:i,it:o}=e;o.items=!0;let s=r.const("len",(0,ba._)`${n}.length`);if(a===!1)e.setParams({len:t.length}),e.pass((0,ba._)`${s} <= ${t.length}`);else if(typeof a=="object"&&!(0,Mk.alwaysValidSchema)(o,a)){let c=r.var("valid",(0,ba._)`${s} <= ${t.length}`);r.if((0,ba.not)(c),()=>l(c)),e.ok(c)}function l(c){r.forRange("i",t.length,s,u=>{e.subschema({keyword:i,dataProp:u,dataPropType:Mk.Type.Num},c),o.allErrors||r.if((0,ba.not)(c),()=>r.break())})}}Ll.validateAdditionalItems=LI;Ll.default=pU});var Bk=j(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});Bl.validateTuple=void 0;var BI=ne(),Mm=pe(),mU=qt(),gU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return UI(e,"additionalItems",t);r.items=!0,!(0,Mm.alwaysValidSchema)(r,t)&&e.ok((0,mU.validateArray)(e))}};function UI(e,t,r=e.schema){let{gen:a,parentSchema:n,data:i,keyword:o,it:s}=e;u(n),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Mm.mergeEvaluated.items(a,r.length,s.items));let l=a.name("valid"),c=a.const("len",(0,BI._)`${i}.length`);r.forEach((d,m)=>{(0,Mm.alwaysValidSchema)(s,d)||(a.if((0,BI._)`${c} > ${m}`,()=>e.subschema({keyword:o,schemaProp:m,dataProp:m},l)),e.ok(l))});function u(d){let{opts:m,errSchemaPath:p}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let f=`"${o}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,Mm.checkStrictMode)(s,f,m.strictTuples)}}}Bl.validateTuple=UI;Bl.default=gU});var FI=j(Uk=>{"use strict";Object.defineProperty(Uk,"__esModule",{value:!0});var hU=Bk(),fU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,hU.validateTuple)(e,"items")};Uk.default=fU});var HI=j(Fk=>{"use strict";Object.defineProperty(Fk,"__esModule",{value:!0});var qI=ne(),bU=pe(),vU=qt(),yU=Lk(),kU={message:({params:{len:e}})=>(0,qI.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,qI._)`{limit: ${e}}`},_U={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:kU,code(e){let{schema:t,parentSchema:r,it:a}=e,{prefixItems:n}=r;a.items=!0,!(0,bU.alwaysValidSchema)(a,t)&&(n?(0,yU.validateAdditionalItems)(e,n):e.ok((0,vU.validateArray)(e)))}};Fk.default=_U});var GI=j(qk=>{"use strict";Object.defineProperty(qk,"__esModule",{value:!0});var Gt=ne(),Lm=pe(),wU={message:({params:{min:e,max:t}})=>t===void 0?(0,Gt.str)`must contain at least ${e} valid item(s)`:(0,Gt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,Gt._)`{minContains: ${e}}`:(0,Gt._)`{minContains: ${e}, maxContains: ${t}}`},SU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:wU,code(e){let{gen:t,schema:r,parentSchema:a,data:n,it:i}=e,o,s,{minContains:l,maxContains:c}=a;i.opts.next?(o=l===void 0?1:l,s=c):o=1;let u=t.const("len",(0,Gt._)`${n}.length`);if(e.setParams({min:o,max:s}),s===void 0&&o===0){(0,Lm.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&o>s){(0,Lm.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Lm.alwaysValidSchema)(i,r)){let h=(0,Gt._)`${u} >= ${o}`;s!==void 0&&(h=(0,Gt._)`${h} && ${u} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&o===1?p(d,()=>t.if(d,()=>t.break())):o===0?(t.let(d,!0),s!==void 0&&t.if((0,Gt._)`${n}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),f=t.let("count",0);p(h,()=>t.if(h,()=>g(f)))}function p(h,f){t.forRange("i",0,u,k=>{e.subschema({keyword:"contains",dataProp:k,dataPropType:Lm.Type.Num,compositeRule:!0},h),f()})}function g(h){t.code((0,Gt._)`${h}++`),s===void 0?t.if((0,Gt._)`${h} >= ${o}`,()=>t.assign(d,!0).break()):(t.if((0,Gt._)`${h} > ${s}`,()=>t.assign(d,!1).break()),o===1?t.assign(d,!0):t.if((0,Gt._)`${h} >= ${o}`,()=>t.assign(d,!0)))}}};qk.default=SU});var KI=j(kn=>{"use strict";Object.defineProperty(kn,"__esModule",{value:!0});kn.validateSchemaDeps=kn.validatePropertyDeps=kn.error=void 0;var Hk=ne(),EU=pe(),Ul=qt();kn.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let a=t===1?"property":"properties";return(0,Hk.str)`must have ${a} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:a}})=>(0,Hk._)`{property: ${e},
|
|
7
7
|
missingProperty: ${a},
|
|
8
8
|
depsCount: ${t},
|
|
9
|
-
deps: ${r}}`};var xU={keyword:"dependencies",type:"object",schemaType:"object",error:kn.error,code(e){let[t,r]=TU(e);VI(e,t),WI(e,r)}};function TU({schema:e}){let t={},r={};for(let a in e){if(a==="__proto__")continue;let n=Array.isArray(e[a])?t:r;n[a]=e[a]}return[t,r]}function VI(e,t=e.schema){let{gen:r,data:a,it:n}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let l=(0,Ul.propertyInData)(r,a,o,n.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),n.allErrors?r.if(l,()=>{for(let c of s)(0,Ul.checkReportMissingProp)(e,c)}):(r.if((0,Hk._)`${l} && (${(0,Ul.checkMissingProp)(e,s,i)})`),(0,Ul.reportMissingProp)(e,i),r.else())}}kn.validatePropertyDeps=VI;function WI(e,t=e.schema){let{gen:r,data:a,keyword:n,it:i}=e,o=r.name("valid");for(let s in t)(0,EU.alwaysValidSchema)(i,t[s])||(r.if((0,Ul.propertyInData)(r,a,s,i.opts.ownProperties),()=>{let l=e.subschema({keyword:n,schemaProp:s},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o))}kn.validateSchemaDeps=WI;kn.default=xU});var JI=j(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var ZI=ne(),AU=pe(),CU={message:"property name must be valid",params:({params:e})=>(0,ZI._)`{propertyName: ${e.propertyName}}`},zU={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:CU,code(e){let{gen:t,schema:r,data:a,it:n}=e;if((0,AU.alwaysValidSchema)(n,r))return;let i=t.name("valid");t.forIn("key",a,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,ZI.not)(i),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(i)}};Gk.default=zU});var Wk=j(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var Bm=qt(),rn=ne(),IU=Kn(),Um=pe(),PU={message:"must NOT have additional properties",params:({params:e})=>(0,rn._)`{additionalProperty: ${e.additionalProperty}}`},RU={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:PU,code(e){let{gen:t,schema:r,parentSchema:a,data:n,errsCount:i,it:o}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,Um.alwaysValidSchema)(o,r))return;let c=(0,Bm.allSchemaProperties)(a.properties),u=(0,Bm.allSchemaProperties)(a.patternProperties);d(),e.ok((0,rn._)`${i} === ${IU.default.errors}`);function d(){t.forIn("key",n,f=>{!c.length&&!u.length?g(f):t.if(m(f),()=>g(f))})}function m(f){let k;if(c.length>8){let b=(0,Um.schemaRefOrVal)(o,a.properties,"properties");k=(0,Bm.isOwnProperty)(t,b,f)}else c.length?k=(0,rn.or)(...c.map(b=>(0,rn._)`${f} === ${b}`)):k=rn.nil;return u.length&&(k=(0,rn.or)(k,...u.map(b=>(0,rn._)`${(0,Bm.usePattern)(e,b)}.test(${f})`))),(0,rn.not)(k)}function p(f){t.code((0,rn._)`delete ${n}[${f}]`)}function g(f){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(f);return}if(r===!1){e.setParams({additionalProperty:f}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,Um.alwaysValidSchema)(o,r)){let k=t.name("valid");l.removeAdditional==="failing"?(h(f,k,!1),t.if((0,rn.not)(k),()=>{e.reset(),p(f)})):(h(f,k),s||t.if((0,rn.not)(k),()=>t.break()))}}function h(f,k,b){let v={keyword:"additionalProperties",dataProp:f,dataPropType:Um.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(v,k)}}};Vk.default=RU});var QI=j(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var $U=Tl(),YI=qt(),Kk=pe(),XI=Wk(),jU={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:a,data:n,it:i}=e;i.opts.removeAdditional==="all"&&a.additionalProperties===void 0&&XI.default.code(new $U.KeywordCxt(i,XI.default,"additionalProperties"));let o=(0,YI.allSchemaProperties)(r);for(let d of o)i.definedProperties.add(d);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=Kk.mergeEvaluated.props(t,(0,Kk.toHash)(o),i.props));let s=o.filter(d=>!(0,Kk.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let l=t.name("valid");for(let d of s)c(d)?u(d):(t.if((0,YI.propertyInData)(t,n,d,i.opts.ownProperties)),u(d),i.allErrors||t.else().var(l,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(l);function c(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};Zk.default=jU});var rP=j(Jk=>{"use strict";Object.defineProperty(Jk,"__esModule",{value:!0});var eP=qt(),Fm=ne(),tP=pe(),nP=pe(),OU={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:a,parentSchema:n,it:i}=e,{opts:o}=i,s=(0,eP.allSchemaProperties)(r),l=s.filter(h=>(0,tP.alwaysValidSchema)(i,r[h]));if(s.length===0||l.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&n.properties,u=t.name("valid");i.props!==!0&&!(i.props instanceof Fm.Name)&&(i.props=(0,nP.evaluatedPropsToName)(t,i.props));let{props:d}=i;m();function m(){for(let h of s)c&&p(h),i.allErrors?g(h):(t.var(u,!0),g(h),t.if(u))}function p(h){for(let f in c)new RegExp(h).test(f)&&(0,tP.checkStrictMode)(i,`property ${f} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",a,f=>{t.if((0,Fm._)`${(0,eP.usePattern)(e,h)}.test(${f})`,()=>{let k=l.includes(h);k||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:f,dataPropType:nP.Type.Str},u),i.opts.unevaluated&&d!==!0?t.assign((0,Fm._)`${d}[${f}]`,!0):!k&&!i.allErrors&&t.if((0,Fm.not)(u),()=>t.break())})})}}};Jk.default=OU});var aP=j(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var NU=pe(),DU={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:a}=e;if((0,NU.alwaysValidSchema)(a,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Yk.default=DU});var iP=j(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var MU=qt(),LU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:MU.validateUnion,error:{message:"must match a schema in anyOf"}};Xk.default=LU});var oP=j(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var qm=ne(),BU=pe(),UU={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,qm._)`{passingSchemas: ${e.passing}}`},FU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:UU,code(e){let{gen:t,schema:r,parentSchema:a,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&a.discriminator)return;let i=r,o=t.let("valid",!1),s=t.let("passing",null),l=t.name("_valid");e.setParams({passing:s}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((u,d)=>{let m;(0,BU.alwaysValidSchema)(n,u)?t.var(l,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&t.if((0,qm._)`${l} && ${o}`).assign(o,!1).assign(s,(0,qm._)`[${s}, ${d}]`).else(),t.if(l,()=>{t.assign(o,!0),t.assign(s,d),m&&e.mergeEvaluated(m,qm.Name)})})}}};Qk.default=FU});var sP=j(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var qU=pe(),HU={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((i,o)=>{if((0,qU.alwaysValidSchema)(a,i))return;let s=e.subschema({keyword:"allOf",schemaProp:o},n);e.ok(n),e.mergeEvaluated(s)})}};e_.default=HU});var uP=j(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var Hm=ne(),cP=pe(),GU={message:({params:e})=>(0,Hm.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Hm._)`{failingKeyword: ${e.ifClause}}`},VU={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:GU,code(e){let{gen:t,parentSchema:r,it:a}=e;r.then===void 0&&r.else===void 0&&(0,cP.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let n=lP(a,"then"),i=lP(a,"else");if(!n&&!i)return;let o=t.let("valid",!0),s=t.name("_valid");if(l(),e.reset(),n&&i){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(s,c("then",u),c("else",u))}else n?t.if(s,c("then")):t.if((0,Hm.not)(s),c("else"));e.pass(o,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(u)}function c(u,d){return()=>{let m=e.subschema({keyword:u},s);t.assign(o,s),e.mergeValidEvaluated(m,o),d?t.assign(d,(0,Hm._)`${u}`):e.setParams({ifClause:u})}}}};function lP(e,t){let r=e.schema[t];return r!==void 0&&!(0,cP.alwaysValidSchema)(e,r)}t_.default=VU});var dP=j(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var WU=pe(),KU={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,WU.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};n_.default=KU});var pP=j(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var ZU=Lk(),JU=FI(),YU=Bk(),XU=HI(),QU=GI(),eF=KI(),tF=JI(),nF=Wk(),rF=QI(),aF=rP(),iF=aP(),oF=iP(),sF=oP(),lF=sP(),cF=uP(),uF=dP();function dF(e=!1){let t=[iF.default,oF.default,sF.default,lF.default,cF.default,uF.default,tF.default,nF.default,eF.default,rF.default,aF.default];return e?t.push(JU.default,XU.default):t.push(ZU.default,YU.default),t.push(QU.default),t}r_.default=dF});var mP=j(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var Me=ne(),pF={message:({schemaCode:e})=>(0,Me.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Me._)`{format: ${e}}`},mF={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:pF,code(e,t){let{gen:r,data:a,$data:n,schema:i,schemaCode:o,it:s}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;n?m():p();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),h=r.const("fDef",(0,Me._)`${g}[${o}]`),f=r.let("fType"),k=r.let("format");r.if((0,Me._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(f,(0,Me._)`${h}.type || "string"`).assign(k,(0,Me._)`${h}.validate`),()=>r.assign(f,(0,Me._)`"string"`).assign(k,h)),e.fail$data((0,Me.or)(b(),v()));function b(){return l.strictSchema===!1?Me.nil:(0,Me._)`${o} && !${k}`}function v(){let C=u.$async?(0,Me._)`(${h}.async ? await ${k}(${a}) : ${k}(${a}))`:(0,Me._)`${k}(${a})`,S=(0,Me._)`(typeof ${k} == "function" ? ${C} : ${k}.test(${a}))`;return(0,Me._)`${k} && ${k} !== true && ${f} === ${t} && !${S}`}}function p(){let g=d.formats[i];if(!g){b();return}if(g===!0)return;let[h,f,k]=v(g);h===t&&e.pass(C());function b(){if(l.strictSchema===!1){d.logger.warn(S());return}throw new Error(S());function S(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function v(S){let P=S instanceof RegExp?(0,Me.regexpCode)(S):l.code.formats?(0,Me._)`${l.code.formats}${(0,Me.getProperty)(i)}`:void 0,U=r.scopeValue("formats",{key:i,ref:S,code:P});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0,Me._)`${U}.validate`]:["string",S,U]}function C(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Me._)`await ${k}(${a})`}return typeof f=="function"?(0,Me._)`${k}(${a})`:(0,Me._)`${k}.test(${a})`}}}};a_.default=mF});var gP=j(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var gF=mP(),hF=[gF.default];i_.default=hF});var hP=j(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.contentVocabulary=ao.metadataVocabulary=void 0;ao.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ao.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var bP=j(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var fF=EI(),bF=MI(),vF=pP(),yF=gP(),fP=hP(),kF=[fF.default,bF.default,(0,vF.default)(),yF.default,fP.metadataVocabulary,fP.contentVocabulary];o_.default=kF});var yP=j(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.DiscrError=void 0;var vP;(function(e){e.Tag="tag",e.Mapping="mapping"})(vP||(Gm.DiscrError=vP={}))});var _P=j(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var io=ne(),s_=yP(),kP=Tm(),_F=Al(),wF=pe(),SF={message:({params:{discrError:e,tagName:t}})=>e===s_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,io._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},EF={keyword:"discriminator",type:"object",schemaType:"object",error:SF,code(e){let{gen:t,data:r,schema:a,parentSchema:n,it:i}=e,{oneOf:o}=n;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=a.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",(0,io._)`${r}${(0,io.getProperty)(s)}`);t.if((0,io._)`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:s_.DiscrError.Tag,tag:c,tagName:s})),e.ok(l);function u(){let p=m();t.if(!1);for(let g in p)t.elseIf((0,io._)`${c} === ${g}`),t.assign(l,d(p[g]));t.else(),e.error(!1,{discrError:s_.DiscrError.Mapping,tag:c,tagName:s}),t.endIf()}function d(p){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},g);return e.mergeEvaluated(h,io.Name),g}function m(){var p;let g={},h=k(n),f=!0;for(let C=0;C<o.length;C++){let S=o[C];if(S?.$ref&&!(0,wF.schemaHasRulesButRef)(S,i.self.RULES)){let U=S.$ref;if(S=kP.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,U),S instanceof kP.SchemaEnv&&(S=S.schema),S===void 0)throw new _F.default(i.opts.uriResolver,i.baseId,U)}let P=(p=S?.properties)===null||p===void 0?void 0:p[s];if(typeof P!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);f=f&&(h||k(S)),b(P,C)}if(!f)throw new Error(`discriminator: "${s}" must be required`);return g;function k({required:C}){return Array.isArray(C)&&C.includes(s)}function b(C,S){if(C.const)v(C.const,S);else if(C.enum)for(let P of C.enum)v(P,S);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(C,S){if(typeof C!="string"||C in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[C]=S}}}};l_.default=EF});var wP=j((eX,xF)=>{xF.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 u_=j((Re,c_)=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.MissingRefError=Re.ValidationError=Re.CodeGen=Re.Name=Re.nil=Re.stringify=Re.str=Re._=Re.KeywordCxt=Re.Ajv=void 0;var TF=vI(),AF=bP(),CF=_P(),SP=wP(),zF=["/properties"],Vm="http://json-schema.org/draft-07/schema",oo=class extends TF.default{_addVocabularies(){super._addVocabularies(),AF.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(CF.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(SP,zF):SP;this.addMetaSchema(t,Vm,!1),this.refs["http://json-schema.org/schema"]=Vm}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Vm)?Vm:void 0)}};Re.Ajv=oo;c_.exports=Re=oo;c_.exports.Ajv=oo;Object.defineProperty(Re,"__esModule",{value:!0});Re.default=oo;var IF=Tl();Object.defineProperty(Re,"KeywordCxt",{enumerable:!0,get:function(){return IF.KeywordCxt}});var so=ne();Object.defineProperty(Re,"_",{enumerable:!0,get:function(){return so._}});Object.defineProperty(Re,"str",{enumerable:!0,get:function(){return so.str}});Object.defineProperty(Re,"stringify",{enumerable:!0,get:function(){return so.stringify}});Object.defineProperty(Re,"nil",{enumerable:!0,get:function(){return so.nil}});Object.defineProperty(Re,"Name",{enumerable:!0,get:function(){return so.Name}});Object.defineProperty(Re,"CodeGen",{enumerable:!0,get:function(){return so.CodeGen}});var PF=Em();Object.defineProperty(Re,"ValidationError",{enumerable:!0,get:function(){return PF.default}});var RF=Al();Object.defineProperty(Re,"MissingRefError",{enumerable:!0,get:function(){return RF.default}})});var PP=j(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.formatNames=wn.fastFormats=wn.fullFormats=void 0;function _n(e,t){return{validate:e,compare:t}}wn.fullFormats={date:_n(AP,g_),time:_n(p_(!0),h_),"date-time":_n(EP(!0),zP),"iso-time":_n(p_(),CP),"iso-date-time":_n(EP(),IP),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:MF,"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:GF,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:LF,int32:{type:"number",validate:FF},int64:{type:"number",validate:qF},float:{type:"number",validate:TP},double:{type:"number",validate:TP},password:!0,binary:!0};wn.fastFormats={...wn.fullFormats,date:_n(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,g_),time:_n(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h_),"date-time":_n(/^\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,zP),"iso-time":_n(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,CP),"iso-date-time":_n(/^\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,IP),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};wn.formatNames=Object.keys(wn.fullFormats);function $F(e){return e%4===0&&(e%100!==0||e%400===0)}var jF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,OF=[0,31,28,31,30,31,30,31,31,30,31,30,31];function AP(e){let t=jF.exec(e);if(!t)return!1;let r=+t[1],a=+t[2],n=+t[3];return a>=1&&a<=12&&n>=1&&n<=(a===2&&$F(r)?29:OF[a])}function g_(e,t){if(e&&t)return e>t?1:e<t?-1:0}var d_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function p_(e){return function(r){let a=d_.exec(r);if(!a)return!1;let n=+a[1],i=+a[2],o=+a[3],s=a[4],l=a[5]==="-"?-1:1,c=+(a[6]||0),u=+(a[7]||0);if(c>23||u>59||e&&!s)return!1;if(n<=23&&i<=59&&o<60)return!0;let d=i-u*l,m=n-c*l-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&o<61}}function h_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),a=new Date("2020-01-01T"+t).valueOf();if(r&&a)return r-a}function CP(e,t){if(!(e&&t))return;let r=d_.exec(e),a=d_.exec(t);if(r&&a)return e=r[1]+r[2]+r[3],t=a[1]+a[2]+a[3],e>t?1:e<t?-1:0}var m_=/t|\s/i;function EP(e){let t=p_(e);return function(a){let n=a.split(m_);return n.length===2&&AP(n[0])&&t(n[1])}}function zP(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function IP(e,t){if(!(e&&t))return;let[r,a]=e.split(m_),[n,i]=t.split(m_),o=g_(r,n);if(o!==void 0)return o||h_(a,i)}var NF=/\/|:/,DF=/^(?:[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 MF(e){return NF.test(e)&&DF.test(e)}var xP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function LF(e){return xP.lastIndex=0,xP.test(e)}var BF=-(2**31),UF=2**31-1;function FF(e){return Number.isInteger(e)&&e<=UF&&e>=BF}function qF(e){return Number.isInteger(e)}function TP(){return!0}var HF=/[^\\]\\Z/;function GF(e){if(HF.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var RP=j(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.formatLimitDefinition=void 0;var VF=u_(),an=ne(),Ir=an.operators,Wm={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}},WF={message:({keyword:e,schemaCode:t})=>(0,an.str)`should be ${Wm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,an._)`{comparison: ${Wm[e].okStr}, limit: ${t}}`};lo.formatLimitDefinition={keyword:Object.keys(Wm),type:"string",schemaType:"string",$data:!0,error:WF,code(e){let{gen:t,data:r,schemaCode:a,keyword:n,it:i}=e,{opts:o,self:s}=i;if(!o.validateFormats)return;let l=new VF.KeywordCxt(i,s.RULES.all.format.definition,"format");l.$data?c():u();function c(){let m=t.scopeValue("formats",{ref:s.formats,code:o.code.formats}),p=t.const("fmt",(0,an._)`${m}[${l.schemaCode}]`);e.fail$data((0,an.or)((0,an._)`typeof ${p} != "object"`,(0,an._)`${p} instanceof RegExp`,(0,an._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let m=l.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${n}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:p,code:o.code.formats?(0,an._)`${o.code.formats}${(0,an.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,an._)`${m}.compare(${r}, ${a}) ${Wm[n].fail} 0`}},dependencies:["format"]};var KF=e=>(e.addKeyword(lo.formatLimitDefinition),e);lo.default=KF});var NP=j((Fl,OP)=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});var co=PP(),ZF=RP(),f_=ne(),$P=new f_.Name("fullFormats"),JF=new f_.Name("fastFormats"),b_=(e,t={keywords:!0})=>{if(Array.isArray(t))return jP(e,t,co.fullFormats,$P),e;let[r,a]=t.mode==="fast"?[co.fastFormats,JF]:[co.fullFormats,$P],n=t.formats||co.formatNames;return jP(e,n,r,a),t.keywords&&(0,ZF.default)(e),e};b_.get=(e,t="full")=>{let a=(t==="fast"?co.fastFormats:co.fullFormats)[e];if(!a)throw new Error(`Unknown format "${e}"`);return a};function jP(e,t,r,a){var n,i;(n=(i=e.opts.code).formats)!==null&&n!==void 0||(i.formats=(0,f_._)`require("ajv-formats/dist/formats").${a}`);for(let o of t)e.addFormat(o,r[o])}OP.exports=Fl=b_;Object.defineProperty(Fl,"__esModule",{value:!0});Fl.default=b_});import{createServer as zq}from"node:http";import Yx from"node:process";var G={};En(G,{$brand:()=>fg,$input:()=>Lh,$output:()=>Mh,INVALID:()=>ut,NEVER:()=>hg,TimePrecision:()=>Wh,ZodAny:()=>ob,ZodArray:()=>ub,ZodBase64:()=>Hd,ZodBase64URL:()=>Gd,ZodBigInt:()=>mi,ZodBigIntFormat:()=>Kd,ZodBoolean:()=>pi,ZodCIDRv4:()=>Fd,ZodCIDRv6:()=>qd,ZodCUID:()=>Od,ZodCUID2:()=>Nd,ZodCatch:()=>zb,ZodCodec:()=>Ss,ZodCompileAsyncError:()=>Vt,ZodCompileUnsupportedError:()=>se,ZodCreditCard:()=>tb,ZodCustom:()=>Es,ZodCustomStringFormat:()=>Wr,ZodDate:()=>vs,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>pb,ZodE164:()=>Vd,ZodEmail:()=>Pd,ZodEmoji:()=>$d,ZodEnum:()=>ci,ZodError:()=>u0,ZodExactOptional:()=>Yd,ZodFile:()=>yb,ZodFirstPartyTypeKind:()=>qb,ZodFunction:()=>Lb,ZodGUID:()=>Rd,ZodIBAN:()=>nb,ZodIPv4:()=>Bd,ZodIPv6:()=>Ud,ZodISODate:()=>lr,ZodISODateTime:()=>sr,ZodISODuration:()=>ur,ZodISOTime:()=>cr,ZodInstanceOf:()=>Fb,ZodIntersection:()=>mb,ZodIssueCode:()=>m0,ZodJWT:()=>Wd,ZodKSUID:()=>Ld,ZodLazy:()=>Nb,ZodLiteral:()=>vb,ZodMAC:()=>eb,ZodMap:()=>fb,ZodNaN:()=>Pb,ZodNanoID:()=>jd,ZodNever:()=>lb,ZodNonOptional:()=>Xd,ZodNull:()=>ib,ZodNullable:()=>wb,ZodNumber:()=>di,ZodNumberFormat:()=>Kr,ZodObject:()=>ys,ZodOptional:()=>Zr,ZodPipe:()=>ws,ZodPrefault:()=>xb,ZodPreprocess:()=>Rb,ZodPromise:()=>Mb,ZodReadonly:()=>$b,ZodRealError:()=>wt,ZodRecord:()=>li,ZodSet:()=>bb,ZodString:()=>ui,ZodStringFormat:()=>Se,ZodSuccess:()=>Cb,ZodSymbol:()=>rb,ZodTemplateLiteral:()=>Ob,ZodTransform:()=>kb,ZodTuple:()=>gb,ZodType:()=>Y,ZodULID:()=>Dd,ZodURL:()=>fs,ZodUUID:()=>dn,ZodUndefined:()=>ab,ZodUnion:()=>ks,ZodUnknown:()=>sb,ZodVoid:()=>cb,ZodXID:()=>Md,ZodXor:()=>db,_ZodString:()=>Id,_default:()=>Eb,_function:()=>bx,any:()=>XE,array:()=>ae,base64:()=>RE,base64url:()=>$E,bigint:()=>WE,boolean:()=>De,catch:()=>Ib,check:()=>vx,cidrv4:()=>IE,cidrv6:()=>PE,clone:()=>ge,codec:()=>mx,coerce:()=>Gb,compile:()=>qh,config:()=>Oe,core:()=>Kt,creditCard:()=>OE,cuid:()=>wE,cuid2:()=>SE,currencyCode:()=>UE,custom:()=>Qd,date:()=>ex,decode:()=>Wf,decodeAsync:()=>Zf,deepPartial:()=>Ix,describe:()=>yx,discriminatedUnion:()=>_s,e164:()=>jE,email:()=>pE,emoji:()=>kE,encode:()=>Vf,encodeAsync:()=>Kf,endsWith:()=>Ya,enum:()=>Ke,exactOptional:()=>_b,file:()=>cx,flattenError:()=>wo,float32:()=>qE,float64:()=>HE,formatError:()=>So,fromJSONSchema:()=>Cx,function:()=>bx,getDiscriminatedOption:()=>jh,getErrorMap:()=>h0,globalRegistry:()=>Ve,gt:()=>cn,gte:()=>It,guid:()=>mE,hash:()=>FE,hex:()=>BE,hostname:()=>LE,httpUrl:()=>yE,iban:()=>NE,includes:()=>Za,input:()=>Rx,instanceof:()=>_x,int:()=>Cd,int32:()=>GE,int64:()=>KE,intersection:()=>gi,invertCodec:()=>gx,ipv4:()=>AE,ipv6:()=>zE,iso:()=>Jr,json:()=>Sx,jwt:()=>DE,keyof:()=>tx,ksuid:()=>TE,lazy:()=>Db,length:()=>Hr,literal:()=>B,locales:()=>qa,looseObject:()=>We,looseRecord:()=>ix,lowercase:()=>Wa,lt:()=>ln,lte:()=>zt,mac:()=>CE,map:()=>ox,maxLength:()=>qr,maxSize:()=>nr,memoizer:()=>Bo,meta:()=>kx,mime:()=>Qa,minLength:()=>Cn,minSize:()=>un,multipleOf:()=>tr,nan:()=>px,nanoid:()=>_E,nativeEnum:()=>lx,negative:()=>dd,never:()=>Zd,nonnegative:()=>md,nonoptional:()=>Ab,nonpositive:()=>pd,normalize:()=>ei,null:()=>bs,nullable:()=>hs,nullish:()=>ux,number:()=>he,object:()=>O,optional:()=>we,output:()=>$x,overwrite:()=>Wt,parse:()=>Ff,parseAsync:()=>qf,partialRecord:()=>ax,pipe:()=>zd,positive:()=>ud,prefault:()=>Tb,preprocess:()=>xs,prettifyError:()=>_g,promise:()=>fx,properties:()=>Xa,property:()=>gd,readonly:()=>jb,record:()=>Ee,refine:()=>Bb,regex:()=>Va,regexes:()=>Ct,registry:()=>Du,safeDecode:()=>Yf,safeDecodeAsync:()=>Qf,safeEncode:()=>Jf,safeEncodeAsync:()=>Xf,safeParse:()=>Hf,safeParseAsync:()=>Gf,set:()=>sx,setErrorMap:()=>g0,size:()=>Fr,slugify:()=>ai,startsWith:()=>Ja,strictObject:()=>nx,string:()=>w,stringFormat:()=>ME,stringbool:()=>wx,success:()=>dx,superRefine:()=>Ub,symbol:()=>JE,templateLiteral:()=>hx,toJSONSchema:()=>Gr,toLowerCase:()=>ni,toUpperCase:()=>ri,toZod:()=>mo,transform:()=>Jd,treeifyError:()=>kg,trim:()=>ti,tuple:()=>hb,uint32:()=>VE,uint64:()=>ZE,ulid:()=>EE,undefined:()=>YE,union:()=>ye,unknown:()=>xe,uppercase:()=>Ka,url:()=>vE,util:()=>E,uuid:()=>gE,uuidv4:()=>hE,uuidv6:()=>fE,uuidv7:()=>bE,validate:()=>$a,validateAsync:()=>ja,void:()=>QE,withParser:()=>Mu,xid:()=>xE,xor:()=>rx});var Kt={};En(Kt,{$ZodAny:()=>Yc,$ZodArray:()=>nu,$ZodAsyncError:()=>kt,$ZodBase64:()=>Oc,$ZodBase64URL:()=>Dc,$ZodBigInt:()=>jo,$ZodBigIntFormat:()=>Wc,$ZodBoolean:()=>Da,$ZodCIDRv4:()=>Pc,$ZodCIDRv6:()=>$c,$ZodCUID:()=>Sc,$ZodCUID2:()=>Ec,$ZodCatch:()=>ku,$ZodCheck:()=>_e,$ZodCheckBigIntFormat:()=>sh,$ZodCheckEndsWith:()=>yh,$ZodCheckGreaterThan:()=>lc,$ZodCheckIncludes:()=>bh,$ZodCheckLengthEquals:()=>mh,$ZodCheckLessThan:()=>sc,$ZodCheckLowerCase:()=>hh,$ZodCheckMaxLength:()=>dh,$ZodCheckMaxSize:()=>lh,$ZodCheckMimeType:()=>wh,$ZodCheckMinLength:()=>ph,$ZodCheckMinSize:()=>ch,$ZodCheckMultipleOf:()=>ih,$ZodCheckNumberFormat:()=>oh,$ZodCheckOverwrite:()=>Sh,$ZodCheckProperties:()=>_h,$ZodCheckProperty:()=>kh,$ZodCheckRegex:()=>gh,$ZodCheckSizeEquals:()=>uh,$ZodCheckStartsWith:()=>vh,$ZodCheckStringFormat:()=>Oa,$ZodCheckUpperCase:()=>fh,$ZodCodec:()=>La,$ZodCreditCard:()=>Bc,$ZodCustom:()=>Tu,$ZodCustomStringFormat:()=>Gc,$ZodCyclicError:()=>Iu,$ZodDate:()=>tu,$ZodDefault:()=>fu,$ZodDiscriminatedUnion:()=>iu,$ZodE164:()=>Mc,$ZodEmail:()=>fc,$ZodEmoji:()=>_c,$ZodEncodeError:()=>Xn,$ZodEnum:()=>uu,$ZodError:()=>yg,$ZodExactOptional:()=>gu,$ZodFile:()=>pu,$ZodFunction:()=>Eu,$ZodGUID:()=>gc,$ZodIBAN:()=>Fc,$ZodIPv4:()=>Cc,$ZodIPv6:()=>zc,$ZodISODate:()=>zh,$ZodISODateTime:()=>Ch,$ZodISODuration:()=>Ph,$ZodISOTime:()=>Ih,$ZodIntersection:()=>ou,$ZodJWT:()=>Hc,$ZodKSUID:()=>Ac,$ZodLazy:()=>Ba,$ZodLiteral:()=>du,$ZodMAC:()=>Ic,$ZodMap:()=>lu,$ZodNaN:()=>_u,$ZodNanoID:()=>wc,$ZodNever:()=>Qc,$ZodNonOptional:()=>vu,$ZodNull:()=>Jc,$ZodNullable:()=>hu,$ZodNumber:()=>$o,$ZodNumberFormat:()=>Vc,$ZodObject:()=>ru,$ZodObjectJIT:()=>$h,$ZodOptional:()=>No,$ZodPipe:()=>Do,$ZodPrefault:()=>bu,$ZodPreprocess:()=>Oh,$ZodPromise:()=>xu,$ZodReadonly:()=>wu,$ZodRealError:()=>_t,$ZodRecord:()=>su,$ZodRegistry:()=>Nu,$ZodSet:()=>cu,$ZodString:()=>Qn,$ZodStringFormat:()=>be,$ZodSuccess:()=>yu,$ZodSymbol:()=>Kc,$ZodTemplateLiteral:()=>Su,$ZodTransform:()=>mu,$ZodTuple:()=>Oo,$ZodType:()=>Z,$ZodULID:()=>xc,$ZodURL:()=>kc,$ZodUUID:()=>hc,$ZodUndefined:()=>Zc,$ZodUnion:()=>Ma,$ZodUnknown:()=>Xc,$ZodVoid:()=>eu,$ZodXID:()=>Tc,$ZodXor:()=>au,$brand:()=>fg,$constructor:()=>y,$input:()=>Lh,$output:()=>Mh,Doc:()=>Mr,INVALID:()=>ut,JSONSchema:()=>cE,JSONSchemaGenerator:()=>xd,NEVER:()=>hg,TimePrecision:()=>Wh,URL_BAD_FORMAT:()=>Th,URL_UNPARSEABLE:()=>Co,ZodCompileAsyncError:()=>Vt,ZodCompileUnsupportedError:()=>se,_any:()=>ad,_array:()=>Xh,_base64:()=>is,_base64url:()=>os,_bigint:()=>Xu,_boolean:()=>Yu,_catch:()=>X2,_check:()=>WS,_cidrv4:()=>rs,_cidrv6:()=>as,_coercedBigint:()=>Jh,_coercedBoolean:()=>Zh,_coercedDate:()=>Yh,_coercedNumber:()=>Kh,_coercedString:()=>Vh,_creditCard:()=>qu,_cuid:()=>Jo,_cuid2:()=>Yo,_custom:()=>fd,_date:()=>ld,_decode:()=>Jl,_decodeAsync:()=>Xl,_default:()=>Z2,_discriminatedUnion:()=>D2,_e164:()=>ss,_email:()=>Fo,_emoji:()=>Ko,_encode:()=>Zl,_encodeAsync:()=>Yl,_endsWith:()=>Ya,_enum:()=>q2,_file:()=>hd,_float32:()=>Wu,_float64:()=>Ku,_gt:()=>cn,_gte:()=>It,_guid:()=>qo,_iban:()=>Hu,_includes:()=>Za,_int:()=>Vu,_int32:()=>Zu,_int64:()=>Qu,_intersection:()=>M2,_ipv4:()=>ts,_ipv6:()=>ns,_isoDate:()=>us,_isoDateTime:()=>cs,_isoDuration:()=>ps,_isoTime:()=>ds,_jwt:()=>ls,_ksuid:()=>es,_lazy:()=>n0,_length:()=>Hr,_literal:()=>G2,_lowercase:()=>Wa,_lt:()=>ln,_lte:()=>zt,_mac:()=>Fu,_map:()=>U2,_max:()=>zt,_maxLength:()=>qr,_maxSize:()=>nr,_mime:()=>Qa,_min:()=>It,_minLength:()=>Cn,_minSize:()=>un,_multipleOf:()=>tr,_nan:()=>cd,_nanoid:()=>Zo,_nativeEnum:()=>H2,_negative:()=>dd,_never:()=>od,_nonnegative:()=>md,_nonoptional:()=>J2,_nonpositive:()=>pd,_normalize:()=>ei,_null:()=>rd,_nullable:()=>K2,_number:()=>Gu,_optional:()=>W2,_overwrite:()=>Wt,_parse:()=>Aa,_parseAsync:()=>Ca,_pipe:()=>Q2,_positive:()=>ud,_promise:()=>r0,_properties:()=>Xa,_property:()=>gd,_readonly:()=>e0,_record:()=>B2,_refine:()=>bd,_regex:()=>Va,_safeDecode:()=>ec,_safeDecodeAsync:()=>nc,_safeEncode:()=>Ql,_safeEncodeAsync:()=>tc,_safeParse:()=>za,_safeParseAsync:()=>Pa,_set:()=>F2,_size:()=>Fr,_slugify:()=>ai,_startsWith:()=>Ja,_string:()=>Uu,_stringFormat:()=>rr,_stringbool:()=>_d,_success:()=>Y2,_superRefine:()=>vd,_symbol:()=>td,_templateLiteral:()=>t0,_toLowerCase:()=>ni,_toUpperCase:()=>ri,_transform:()=>V2,_trim:()=>ti,_tuple:()=>L2,_uint32:()=>Ju,_uint64:()=>ed,_ulid:()=>Xo,_undefined:()=>nd,_union:()=>O2,_unknown:()=>id,_uppercase:()=>Ka,_url:()=>Ga,_uuid:()=>Ho,_uuidv4:()=>Go,_uuidv6:()=>Vo,_uuidv7:()=>Wo,_void:()=>sd,_xid:()=>Qo,_xor:()=>N2,base64Charset:()=>jc,base64urlCharset:()=>Ro,canParseURL:()=>Ah,clone:()=>ge,compile:()=>qh,compileFn:()=>Lu,config:()=>Oe,createStandardJSONSchemaMethod:()=>ii,createToJSONSchemaMethod:()=>ef,decode:()=>K_,decodeAsync:()=>J_,describe:()=>yd,encode:()=>W_,encodeAsync:()=>Z_,extractDefs:()=>ir,finalize:()=>or,flattenError:()=>wo,formatError:()=>So,getDiscriminatedOption:()=>jh,globalConfig:()=>He,globalRegistry:()=>Ve,handleUnrepresentable:()=>Be,initializeContext:()=>ar,isBackEdge:()=>Ru,isRecursiveSchema:()=>Pu,isValidBase64:()=>Po,isValidBase64URL:()=>Nc,isValidCIDRv6:()=>Rc,isValidCreditCard:()=>Lc,isValidIBAN:()=>Uc,isValidIPv6:()=>Io,isValidJWT:()=>qc,locales:()=>qa,memoizer:()=>Bo,mergeValues:()=>Na,meta:()=>kd,parse:()=>Or,parseAsync:()=>Nr,parseURLObject:()=>kw,prettifyError:()=>_g,process:()=>ve,processSchema:()=>ve,regexes:()=>Ct,registry:()=>Du,safeDecode:()=>X_,safeDecodeAsync:()=>ew,safeEncode:()=>Y_,safeEncodeAsync:()=>Q_,safeParse:()=>Ia,safeParseAsync:()=>Ra,standardProps:()=>mc,stripTabAndNewline:()=>zo,toDotPath:()=>G_,toJSONSchema:()=>Gr,toZod:()=>mo,treeifyError:()=>kg,urlHostnameOk:()=>vc,urlProtocolOk:()=>yc,util:()=>E,validate:()=>$a,validateAsync:()=>ja,validateURL:()=>bc,version:()=>Eh,withParser:()=>Mu});var E={};En(E,{BIGINT_FORMAT_RANGES:()=>bo,CONSTANT_CATCH:()=>Wl,Class:()=>ag,NUMBER_FORMAT_RANGES:()=>fo,aborted:()=>ct,allowsEval:()=>sg,assert:()=>g1,assertEqual:()=>u1,assertIs:()=>p1,assertNever:()=>m1,assertNotEqual:()=>d1,assignProp:()=>Ge,attachSchema:()=>vo,base64ToUint8Array:()=>L_,base64urlToUint8Array:()=>T1,cached:()=>wa,captureStackTrace:()=>Gl,cleanEnum:()=>x1,cleanRegex:()=>Tn,clone:()=>ge,cloneDef:()=>b1,codePointLength:()=>jr,constantCatch:()=>mg,createTransparentProxy:()=>S1,defineLazy:()=>ig,defineLazyInternal:()=>ee,derived:()=>I1,esc:()=>lt,escapeRegex:()=>Mt,explicitlyAborted:()=>ug,extend:()=>$_,finalizeIssue:()=>yt,floatSafeRemainder:()=>go,getElementAtPath:()=>v1,getEnumValues:()=>ka,getLengthableOrigin:()=>ko,getParsedType:()=>w1,getSizableOrigin:()=>yo,hexToUint8Array:()=>C1,hide:()=>_o,installLazyProp:()=>pg,isObject:()=>$r,isPlainObject:()=>Dt,issue:()=>Ta,joinValues:()=>_,jsonStringifyReplacer:()=>_a,members:()=>dg,merge:()=>N_,mergeDefs:()=>Nt,normalizeParams:()=>z,nullish:()=>Hl,numKeys:()=>_1,objectClone:()=>h1,omit:()=>R_,optionalKeys:()=>cg,own:()=>sn,parsedType:()=>T,partial:()=>D_,pick:()=>P_,prefixIssues:()=>vt,primitiveTypes:()=>lg,promiseAllObject:()=>y1,propertyKeyTypes:()=>ho,randomString:()=>k1,rawShape:()=>Sa,required:()=>M_,safeExtend:()=>O_,shallowClone:()=>Ea,sizeCaps:()=>xa,slugify:()=>og,stringifyPrimitive:()=>x,toZod:()=>mo,uint8ArrayToBase64:()=>B_,uint8ArrayToBase64url:()=>A1,uint8ArrayToHex:()=>z1,unwrapMessage:()=>ya});function u1(e){return e}function d1(e){return e}function mo(){return e=>e}function p1(e){}function m1(e){throw new Error("Unexpected value in exhaustive check")}function g1(e){}function ka(e){let t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,n])=>t.indexOf(+a)===-1).map(([a,n])=>n)}function _(e,t="|"){return e.map(r=>x(r)).join(t)}function _a(e,t){return typeof t=="bigint"?t.toString():t}var rg=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function wa(e){return new rg(e)}function Hl(e){return e==null}function Tn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function go(e,t){let r=e/t,a=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-a)<n?0:r-a}var C_=Symbol("evaluating");function ig(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==C_)return a===void 0&&(a=C_,a=r()),a},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h1(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Sa(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function xn(e){return Sa(e._zod.def)??e._zod.def.shape}function z_(e,t,r){Object.defineProperty(e,t,{get(){let a=r();return Ge(this,t,a),a},enumerable:!0,configurable:!0})}function I_(e,t,r){t in e?Ge(e,t,r):e[t]=r}function Rr(e,t,r,a){let n=xn(t);for(let i of r){let o=Object.getOwnPropertyDescriptor(n,i);o.enumerable&&(o.get?z_(e,i,()=>{let s=t._zod.def.shape[i];return a?a(s,i):s}):I_(e,i,a?a(o.value,i):o.value))}}function f1(e,t){for(let r of Reflect.ownKeys(t)){let a=Object.getOwnPropertyDescriptor(t,r);a.enumerable&&(a.get?z_(e,r,()=>t[r]):I_(e,r,a.value))}}function Nt(...e){let t={};for(let r of e){let a=Object.getOwnPropertyDescriptors(r);Object.assign(t,a)}return Object.defineProperties({},t)}function b1(e){return Nt(e._zod.def)}function v1(e,t){return t?t.reduce((r,a)=>r?.[a],e):e}function y1(e){let t=Object.keys(e),r=t.map(a=>e[a]);return Promise.all(r).then(a=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=a[i];return n})}function k1(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let a=0;a<e;a++)r+=t[Math.floor(Math.random()*t.length)];return r}function lt(e){return JSON.stringify(e)}function og(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Gl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function $r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var sg=wa(()=>{if(He.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Dt(e){if($r(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!($r(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ea(e){return Dt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function _1(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var w1=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}`)}},ho=new Set(["string","number","symbol"]),lg=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ge(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function z(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 S1(e){let t;return new Proxy({},{get(r,a,n){return t??(t=e()),Reflect.get(t,a,n)},set(r,a,n,i){return t??(t=e()),Reflect.set(t,a,n,i)},has(r,a){return t??(t=e()),Reflect.has(t,a)},deleteProperty(r,a){return t??(t=e()),Reflect.deleteProperty(t,a)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,a){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(r,a,n){return t??(t=e()),Reflect.defineProperty(t,a,n)}})}function x(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function cg(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var fo={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]},bo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function P_(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return Rr(i,e,Vl(e,t)),ge(e,Nt(r,{shape:i,checks:[]}))}function Vl(e,t){let r=xn(e),a=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&a.push(n)}return a}function R_(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Vl(e,t)),o={};return Rr(o,e,Reflect.ownKeys(xn(e)).filter(s=>!i.has(s))),ge(e,Nt(r,{shape:o,checks:[]}))}function $_(e,t){if(!Dt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=xn(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ge(e,Nt(e._zod.def,{shape:j_(e,t)}))}function j_(e,t){let r={};return Rr(r,e,Reflect.ownKeys(xn(e))),f1(r,t),r}function O_(e,t){if(!Dt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ge(e,Nt(e._zod.def,{shape:j_(e,t)}))}function N_(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Rr(r,e,Reflect.ownKeys(xn(e))),Rr(r,t,Reflect.ownKeys(xn(t)));let a=Nt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ge(e,a)}function D_(e,t,r,a="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${a}() cannot be used on object schemas containing refinements`);let s=r?new Set(Vl(t,r)):void 0,l={};return Rr(l,t,Reflect.ownKeys(xn(t)),e&&((c,u)=>s&&!s.has(u)?c:new e({type:"optional",innerType:c}))),ge(t,Nt(t._zod.def,{shape:l,checks:[]}))}function M_(e,t,r){let a=r?new Set(Vl(t,r)):void 0,n={};return Rr(n,t,Reflect.ownKeys(xn(t)),(i,o)=>a&&!a.has(o)?i:new e({type:"nonoptional",innerType:i})),ge(t,Nt(t._zod.def,{shape:n}))}function ct(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 ug(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function vt(e,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(e),r})}function ya(e){return typeof e=="string"?e:e?.message}function xa(e){let t=[];for(let r of e??[]){let a=r._zod.def;if(!/_(length|size)$|_equals$/.test(a.check))break;let n=a.maximum??a.length??a.size;n>=0&&t.push([n,r])}return t}function vo(e,t,r){var a;for(let n=t;n<e.length;n++)(a=e[n]).schema??(a.schema=r)}function yt(e,t,r){var a;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(a=e).schema??(a.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:ya(e.inst?._zod.def?.error?.(e))??ya(i?.(e))??ya(t?.error?.(e))??ya(r.customError?.(e))??ya(r.localeError?.(e))??"Invalid input",s={};for(let l of Object.keys(e))l==="inst"||l==="schema"||l==="continue"||l==="input"||l==="__proto__"||(s[l]=e[l]);return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=e.input),s}function yo(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var E1=/[\uD800-\uDBFF]/;function jr(e){let t=e.length;if(!E1.test(e))return t;let r=t;for(let a=0;a<t-1;a++)(e.charCodeAt(a)&64512)===55296&&(e.charCodeAt(a+1)&64512)===56320&&(r--,a++);return r}function ko(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function T(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 Ta(...e){let[t,r,a]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}function x1(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function L_(e){let t=atob(e),r=new Uint8Array(t.length);for(let a=0;a<t.length;a++)r[a]=t.charCodeAt(a);return r}function B_(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function T1(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return L_(t+r)}function A1(e){return B_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function C1(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 a=0;a<t.length;a+=2)r[a/2]=Number.parseInt(t.slice(a,a+2),16);return r}function z1(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ag=class{constructor(...t){}};function dg(e,t){for(let r in t){let a=Object.getOwnPropertyDescriptor(t,r);a.get?Object.defineProperty(e,r,{...a,enumerable:!1}):P1(e,r,a.value)}}function sn(e,t,r,a=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:a,value:r}),r}function _o(e,t,r){return sn(e,t,r,!1)}function I1(e,t){for(let r in e){let a=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return sn(this,r,a(this))},set(n){sn(this,r,n)}})}return t}function P1(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:sn(this,t,r.bind(this))},set(a){sn(this,t,a)}})}function R1(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ng,Yn=!1,$1={configurable:!0,get(){Yn=!0}};function ee(e,t,r){let a=Object.getPrototypeOf(e._zod);if(t in a&&ng!==e._zod){ng=void 0;return}ng=e._zod,Object.defineProperty(a,t,{configurable:!0,get(){Object.defineProperty(this,t,$1);let n=Yn;Yn=!1;try{let i=r(this);return Yn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Yn=Yn||n,i}catch(i){throw delete this[t],Yn=Yn||n,i}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function pg(e,t,r,a){let n=R1(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:a,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:a,value:i})}})}var Wl="~constantCatch";function mg(e){let t=()=>e;return t[Wl]=!0,t}var U_,hg=Object.freeze({status:"aborted"}),gg={value:void 0,enumerable:!1},F_="captureStackTrace"in Error?Error:null;function j1(e){let t=F_;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return F_=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function y(e,t,r,a){let n={};function i(m){this.def=m,this.constr=d,this.traits=new Set}i.prototype=n;let o=r,s=o&&new WeakSet;function l(m,p){if(m._zod){if(m._zod.traits.has(e))return}else{gg.value=new i(p);try{Object.defineProperty(m,"_zod",gg)}finally{gg.value=void 0}}if(m._zod.traits.add(e),t(m,p),s){let h=Object.getPrototypeOf(m),f=m._zod.constr.prototype,k=h;for(;k&&k!==f;)k=Object.getPrototypeOf(k);let b=k??h;s.has(b)||(s.add(b),dg(b,o))}let g=d.prototype;for(let h in g)Object.prototype.hasOwnProperty.call(g,h)&&(h in m||(m[h]=g[h].bind(m)))}let c=a?.Parent??Object;class u extends c{}Object.defineProperty(u,"name",{value:e});function d(m){let p=a?.Parent?j1(u):this;l(p,m);let g=p._zod.deferred;if(g){for(let f of g)f();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(p),p}return Object.defineProperty(d,"init",{value:l}),Object.defineProperty(d,Symbol.hasInstance,{value:m=>a?.Parent&&m instanceof a.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var fg=Symbol("zod_brand"),kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Xn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(U_=globalThis).__zod_globalConfig??(U_.__zod_globalConfig={});var He=globalThis.__zod_globalConfig;function Oe(e){return e&&Object.assign(He,e),He}function O1(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,_a,2)),e.message}function N1(e){this._zod.message=e}var D1={get:O1,set:N1,enumerable:!0,configurable:!0},vg={value:void 0,enumerable:!1},q_=new WeakSet([Object.prototype,Error.prototype]),H_=(e,t)=>{e.name="$ZodError",vg.value=t,Object.defineProperty(e,"issues",vg),vg.value=void 0,Object.defineProperty(e,"message",D1);let r=Object.getPrototypeOf(e);q_.has(r)||(q_.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let a=()=>this.message;return Object.defineProperty(this,"toString",{value:a,configurable:!0,writable:!0}),a},set(a){Object.defineProperty(this,"toString",{value:a,configurable:!0,writable:!0})}}))},yg=y("$ZodError",H_),_t=y("$ZodError",H_,void 0,{Parent:Error});function M1(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function wo(e,t=r=>r.message){let r={},a=[];for(let n of e.issues)n.path.length>0?M1(r,n.path[0],()=>[]).push(t(n)):a.push(t(n));return{formErrors:a,fieldErrors:r}}function So(e,t=r=>r.message){let r={_errors:[]},a=(n,i=[])=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>a({issues:s},[...i,...o.path]));else if(o.code==="invalid_key")a({issues:o.issues},[...i,...o.path]);else if(o.code==="invalid_element")a({issues:o.issues},[...i,...o.path]);else{let s=[...i,...o.path];if(s.length===0)r._errors.push(t(o));else{let l=r,c=0;for(;c<s.length;){let u=s[c],d=c===s.length-1;if(u==="_errors"){d&&l._errors.push(t(o)),c++;continue}Object.prototype.hasOwnProperty.call(l,u)||Object.defineProperty(l,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=l[u];d&&m._errors.push(t(o)),l=m,c++}}}};return a(e),r}function kg(e,t=r=>r.message){let r={errors:[]},a=(n,i=[])=>{var o;for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>a({issues:l},[...i,...s.path]));else if(s.code==="invalid_key")a({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")a({issues:s.issues},[...i,...s.path]);else{let l=[...i,...s.path];if(l.length===0){r.errors.push(t(s));continue}let c=r,u=0;for(;u<l.length;){let d=l[u],m=u===l.length-1;typeof d=="string"?(c.properties??(c.properties={}),Object.prototype.hasOwnProperty.call(c.properties,d)||Object.defineProperty(c.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),c=c.properties[d]):(c.items??(c.items=[]),(o=c.items)[d]??(o[d]={errors:[]}),c=c.items[d]),m&&c.errors.push(t(s)),u++}}};return a(e),r}function G_(e){let t=[],r=e.map(a=>typeof a=="object"?a.key:a);for(let a of r)typeof a=="number"?t.push(`[${a}]`):typeof a=="symbol"?t.push(`[${JSON.stringify(String(a))}]`):/[^\w$]/.test(a)?t.push(`[${JSON.stringify(a)}]`):(t.length&&t.push("."),t.push(a));return t.join("")}function _g(e){let t=[],r=[...e.issues].sort((a,n)=>(a.path??[]).length-(n.path??[]).length);for(let a of r)t.push(`\u2716 ${a.message}`),a.path?.length&&t.push(` \u2192 at ${G_(a.path)}`);return t.join(`
|
|
9
|
+
deps: ${r}}`};var xU={keyword:"dependencies",type:"object",schemaType:"object",error:kn.error,code(e){let[t,r]=TU(e);VI(e,t),WI(e,r)}};function TU({schema:e}){let t={},r={};for(let a in e){if(a==="__proto__")continue;let n=Array.isArray(e[a])?t:r;n[a]=e[a]}return[t,r]}function VI(e,t=e.schema){let{gen:r,data:a,it:n}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let o in t){let s=t[o];if(s.length===0)continue;let l=(0,Ul.propertyInData)(r,a,o,n.opts.ownProperties);e.setParams({property:o,depsCount:s.length,deps:s.join(", ")}),n.allErrors?r.if(l,()=>{for(let c of s)(0,Ul.checkReportMissingProp)(e,c)}):(r.if((0,Hk._)`${l} && (${(0,Ul.checkMissingProp)(e,s,i)})`),(0,Ul.reportMissingProp)(e,i),r.else())}}kn.validatePropertyDeps=VI;function WI(e,t=e.schema){let{gen:r,data:a,keyword:n,it:i}=e,o=r.name("valid");for(let s in t)(0,EU.alwaysValidSchema)(i,t[s])||(r.if((0,Ul.propertyInData)(r,a,s,i.opts.ownProperties),()=>{let l=e.subschema({keyword:n,schemaProp:s},o);e.mergeValidEvaluated(l,o)},()=>r.var(o,!0)),e.ok(o))}kn.validateSchemaDeps=WI;kn.default=xU});var JI=j(Gk=>{"use strict";Object.defineProperty(Gk,"__esModule",{value:!0});var ZI=ne(),AU=pe(),CU={message:"property name must be valid",params:({params:e})=>(0,ZI._)`{propertyName: ${e.propertyName}}`},zU={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:CU,code(e){let{gen:t,schema:r,data:a,it:n}=e;if((0,AU.alwaysValidSchema)(n,r))return;let i=t.name("valid");t.forIn("key",a,o=>{e.setParams({propertyName:o}),e.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},i),t.if((0,ZI.not)(i),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(i)}};Gk.default=zU});var Wk=j(Vk=>{"use strict";Object.defineProperty(Vk,"__esModule",{value:!0});var Bm=qt(),rn=ne(),IU=Kn(),Um=pe(),PU={message:"must NOT have additional properties",params:({params:e})=>(0,rn._)`{additionalProperty: ${e.additionalProperty}}`},RU={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:PU,code(e){let{gen:t,schema:r,parentSchema:a,data:n,errsCount:i,it:o}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:l}=o;if(o.props=!0,l.removeAdditional!=="all"&&(0,Um.alwaysValidSchema)(o,r))return;let c=(0,Bm.allSchemaProperties)(a.properties),u=(0,Bm.allSchemaProperties)(a.patternProperties);d(),e.ok((0,rn._)`${i} === ${IU.default.errors}`);function d(){t.forIn("key",n,f=>{!c.length&&!u.length?g(f):t.if(m(f),()=>g(f))})}function m(f){let k;if(c.length>8){let b=(0,Um.schemaRefOrVal)(o,a.properties,"properties");k=(0,Bm.isOwnProperty)(t,b,f)}else c.length?k=(0,rn.or)(...c.map(b=>(0,rn._)`${f} === ${b}`)):k=rn.nil;return u.length&&(k=(0,rn.or)(k,...u.map(b=>(0,rn._)`${(0,Bm.usePattern)(e,b)}.test(${f})`))),(0,rn.not)(k)}function p(f){t.code((0,rn._)`delete ${n}[${f}]`)}function g(f){if(l.removeAdditional==="all"||l.removeAdditional&&r===!1){p(f);return}if(r===!1){e.setParams({additionalProperty:f}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,Um.alwaysValidSchema)(o,r)){let k=t.name("valid");l.removeAdditional==="failing"?(h(f,k,!1),t.if((0,rn.not)(k),()=>{e.reset(),p(f)})):(h(f,k),s||t.if((0,rn.not)(k),()=>t.break()))}}function h(f,k,b){let v={keyword:"additionalProperties",dataProp:f,dataPropType:Um.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(v,k)}}};Vk.default=RU});var QI=j(Zk=>{"use strict";Object.defineProperty(Zk,"__esModule",{value:!0});var $U=Tl(),YI=qt(),Kk=pe(),XI=Wk(),jU={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:a,data:n,it:i}=e;i.opts.removeAdditional==="all"&&a.additionalProperties===void 0&&XI.default.code(new $U.KeywordCxt(i,XI.default,"additionalProperties"));let o=(0,YI.allSchemaProperties)(r);for(let d of o)i.definedProperties.add(d);i.opts.unevaluated&&o.length&&i.props!==!0&&(i.props=Kk.mergeEvaluated.props(t,(0,Kk.toHash)(o),i.props));let s=o.filter(d=>!(0,Kk.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let l=t.name("valid");for(let d of s)c(d)?u(d):(t.if((0,YI.propertyInData)(t,n,d,i.opts.ownProperties)),u(d),i.allErrors||t.else().var(l,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(l);function c(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function u(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},l)}}};Zk.default=jU});var rP=j(Jk=>{"use strict";Object.defineProperty(Jk,"__esModule",{value:!0});var eP=qt(),Fm=ne(),tP=pe(),nP=pe(),OU={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:a,parentSchema:n,it:i}=e,{opts:o}=i,s=(0,eP.allSchemaProperties)(r),l=s.filter(h=>(0,tP.alwaysValidSchema)(i,r[h]));if(s.length===0||l.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let c=o.strictSchema&&!o.allowMatchingProperties&&n.properties,u=t.name("valid");i.props!==!0&&!(i.props instanceof Fm.Name)&&(i.props=(0,nP.evaluatedPropsToName)(t,i.props));let{props:d}=i;m();function m(){for(let h of s)c&&p(h),i.allErrors?g(h):(t.var(u,!0),g(h),t.if(u))}function p(h){for(let f in c)new RegExp(h).test(f)&&(0,tP.checkStrictMode)(i,`property ${f} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",a,f=>{t.if((0,Fm._)`${(0,eP.usePattern)(e,h)}.test(${f})`,()=>{let k=l.includes(h);k||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:f,dataPropType:nP.Type.Str},u),i.opts.unevaluated&&d!==!0?t.assign((0,Fm._)`${d}[${f}]`,!0):!k&&!i.allErrors&&t.if((0,Fm.not)(u),()=>t.break())})})}}};Jk.default=OU});var aP=j(Yk=>{"use strict";Object.defineProperty(Yk,"__esModule",{value:!0});var NU=pe(),DU={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:a}=e;if((0,NU.alwaysValidSchema)(a,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Yk.default=DU});var iP=j(Xk=>{"use strict";Object.defineProperty(Xk,"__esModule",{value:!0});var MU=qt(),LU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:MU.validateUnion,error:{message:"must match a schema in anyOf"}};Xk.default=LU});var oP=j(Qk=>{"use strict";Object.defineProperty(Qk,"__esModule",{value:!0});var qm=ne(),BU=pe(),UU={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,qm._)`{passingSchemas: ${e.passing}}`},FU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:UU,code(e){let{gen:t,schema:r,parentSchema:a,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&a.discriminator)return;let i=r,o=t.let("valid",!1),s=t.let("passing",null),l=t.name("_valid");e.setParams({passing:s}),t.block(c),e.result(o,()=>e.reset(),()=>e.error(!0));function c(){i.forEach((u,d)=>{let m;(0,BU.alwaysValidSchema)(n,u)?t.var(l,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},l),d>0&&t.if((0,qm._)`${l} && ${o}`).assign(o,!1).assign(s,(0,qm._)`[${s}, ${d}]`).else(),t.if(l,()=>{t.assign(o,!0),t.assign(s,d),m&&e.mergeEvaluated(m,qm.Name)})})}}};Qk.default=FU});var sP=j(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var qU=pe(),HU={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:a}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=t.name("valid");r.forEach((i,o)=>{if((0,qU.alwaysValidSchema)(a,i))return;let s=e.subschema({keyword:"allOf",schemaProp:o},n);e.ok(n),e.mergeEvaluated(s)})}};e_.default=HU});var uP=j(t_=>{"use strict";Object.defineProperty(t_,"__esModule",{value:!0});var Hm=ne(),cP=pe(),GU={message:({params:e})=>(0,Hm.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Hm._)`{failingKeyword: ${e.ifClause}}`},VU={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:GU,code(e){let{gen:t,parentSchema:r,it:a}=e;r.then===void 0&&r.else===void 0&&(0,cP.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let n=lP(a,"then"),i=lP(a,"else");if(!n&&!i)return;let o=t.let("valid",!0),s=t.name("_valid");if(l(),e.reset(),n&&i){let u=t.let("ifClause");e.setParams({ifClause:u}),t.if(s,c("then",u),c("else",u))}else n?t.if(s,c("then")):t.if((0,Hm.not)(s),c("else"));e.pass(o,()=>e.error(!0));function l(){let u=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(u)}function c(u,d){return()=>{let m=e.subschema({keyword:u},s);t.assign(o,s),e.mergeValidEvaluated(m,o),d?t.assign(d,(0,Hm._)`${u}`):e.setParams({ifClause:u})}}}};function lP(e,t){let r=e.schema[t];return r!==void 0&&!(0,cP.alwaysValidSchema)(e,r)}t_.default=VU});var dP=j(n_=>{"use strict";Object.defineProperty(n_,"__esModule",{value:!0});var WU=pe(),KU={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,WU.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};n_.default=KU});var pP=j(r_=>{"use strict";Object.defineProperty(r_,"__esModule",{value:!0});var ZU=Lk(),JU=FI(),YU=Bk(),XU=HI(),QU=GI(),eF=KI(),tF=JI(),nF=Wk(),rF=QI(),aF=rP(),iF=aP(),oF=iP(),sF=oP(),lF=sP(),cF=uP(),uF=dP();function dF(e=!1){let t=[iF.default,oF.default,sF.default,lF.default,cF.default,uF.default,tF.default,nF.default,eF.default,rF.default,aF.default];return e?t.push(JU.default,XU.default):t.push(ZU.default,YU.default),t.push(QU.default),t}r_.default=dF});var mP=j(a_=>{"use strict";Object.defineProperty(a_,"__esModule",{value:!0});var Me=ne(),pF={message:({schemaCode:e})=>(0,Me.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Me._)`{format: ${e}}`},mF={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:pF,code(e,t){let{gen:r,data:a,$data:n,schema:i,schemaCode:o,it:s}=e,{opts:l,errSchemaPath:c,schemaEnv:u,self:d}=s;if(!l.validateFormats)return;n?m():p();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:l.code.formats}),h=r.const("fDef",(0,Me._)`${g}[${o}]`),f=r.let("fType"),k=r.let("format");r.if((0,Me._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(f,(0,Me._)`${h}.type || "string"`).assign(k,(0,Me._)`${h}.validate`),()=>r.assign(f,(0,Me._)`"string"`).assign(k,h)),e.fail$data((0,Me.or)(b(),v()));function b(){return l.strictSchema===!1?Me.nil:(0,Me._)`${o} && !${k}`}function v(){let C=u.$async?(0,Me._)`(${h}.async ? await ${k}(${a}) : ${k}(${a}))`:(0,Me._)`${k}(${a})`,S=(0,Me._)`(typeof ${k} == "function" ? ${C} : ${k}.test(${a}))`;return(0,Me._)`${k} && ${k} !== true && ${f} === ${t} && !${S}`}}function p(){let g=d.formats[i];if(!g){b();return}if(g===!0)return;let[h,f,k]=v(g);h===t&&e.pass(C());function b(){if(l.strictSchema===!1){d.logger.warn(S());return}throw new Error(S());function S(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function v(S){let P=S instanceof RegExp?(0,Me.regexpCode)(S):l.code.formats?(0,Me._)`${l.code.formats}${(0,Me.getProperty)(i)}`:void 0,U=r.scopeValue("formats",{key:i,ref:S,code:P});return typeof S=="object"&&!(S instanceof RegExp)?[S.type||"string",S.validate,(0,Me._)`${U}.validate`]:["string",S,U]}function C(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Me._)`await ${k}(${a})`}return typeof f=="function"?(0,Me._)`${k}(${a})`:(0,Me._)`${k}.test(${a})`}}}};a_.default=mF});var gP=j(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var gF=mP(),hF=[gF.default];i_.default=hF});var hP=j(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.contentVocabulary=ao.metadataVocabulary=void 0;ao.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ao.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var bP=j(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var fF=EI(),bF=MI(),vF=pP(),yF=gP(),fP=hP(),kF=[fF.default,bF.default,(0,vF.default)(),yF.default,fP.metadataVocabulary,fP.contentVocabulary];o_.default=kF});var yP=j(Gm=>{"use strict";Object.defineProperty(Gm,"__esModule",{value:!0});Gm.DiscrError=void 0;var vP;(function(e){e.Tag="tag",e.Mapping="mapping"})(vP||(Gm.DiscrError=vP={}))});var _P=j(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var io=ne(),s_=yP(),kP=Tm(),_F=Al(),wF=pe(),SF={message:({params:{discrError:e,tagName:t}})=>e===s_.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,io._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},EF={keyword:"discriminator",type:"object",schemaType:"object",error:SF,code(e){let{gen:t,data:r,schema:a,parentSchema:n,it:i}=e,{oneOf:o}=n;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=a.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(a.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let l=t.let("valid",!1),c=t.const("tag",(0,io._)`${r}${(0,io.getProperty)(s)}`);t.if((0,io._)`typeof ${c} == "string"`,()=>u(),()=>e.error(!1,{discrError:s_.DiscrError.Tag,tag:c,tagName:s})),e.ok(l);function u(){let p=m();t.if(!1);for(let g in p)t.elseIf((0,io._)`${c} === ${g}`),t.assign(l,d(p[g]));t.else(),e.error(!1,{discrError:s_.DiscrError.Mapping,tag:c,tagName:s}),t.endIf()}function d(p){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},g);return e.mergeEvaluated(h,io.Name),g}function m(){var p;let g={},h=k(n),f=!0;for(let C=0;C<o.length;C++){let S=o[C];if(S?.$ref&&!(0,wF.schemaHasRulesButRef)(S,i.self.RULES)){let U=S.$ref;if(S=kP.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,U),S instanceof kP.SchemaEnv&&(S=S.schema),S===void 0)throw new _F.default(i.opts.uriResolver,i.baseId,U)}let P=(p=S?.properties)===null||p===void 0?void 0:p[s];if(typeof P!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);f=f&&(h||k(S)),b(P,C)}if(!f)throw new Error(`discriminator: "${s}" must be required`);return g;function k({required:C}){return Array.isArray(C)&&C.includes(s)}function b(C,S){if(C.const)v(C.const,S);else if(C.enum)for(let P of C.enum)v(P,S);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function v(C,S){if(typeof C!="string"||C in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[C]=S}}}};l_.default=EF});var wP=j((nX,xF)=>{xF.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 u_=j((Re,c_)=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.MissingRefError=Re.ValidationError=Re.CodeGen=Re.Name=Re.nil=Re.stringify=Re.str=Re._=Re.KeywordCxt=Re.Ajv=void 0;var TF=vI(),AF=bP(),CF=_P(),SP=wP(),zF=["/properties"],Vm="http://json-schema.org/draft-07/schema",oo=class extends TF.default{_addVocabularies(){super._addVocabularies(),AF.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(CF.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(SP,zF):SP;this.addMetaSchema(t,Vm,!1),this.refs["http://json-schema.org/schema"]=Vm}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Vm)?Vm:void 0)}};Re.Ajv=oo;c_.exports=Re=oo;c_.exports.Ajv=oo;Object.defineProperty(Re,"__esModule",{value:!0});Re.default=oo;var IF=Tl();Object.defineProperty(Re,"KeywordCxt",{enumerable:!0,get:function(){return IF.KeywordCxt}});var so=ne();Object.defineProperty(Re,"_",{enumerable:!0,get:function(){return so._}});Object.defineProperty(Re,"str",{enumerable:!0,get:function(){return so.str}});Object.defineProperty(Re,"stringify",{enumerable:!0,get:function(){return so.stringify}});Object.defineProperty(Re,"nil",{enumerable:!0,get:function(){return so.nil}});Object.defineProperty(Re,"Name",{enumerable:!0,get:function(){return so.Name}});Object.defineProperty(Re,"CodeGen",{enumerable:!0,get:function(){return so.CodeGen}});var PF=Em();Object.defineProperty(Re,"ValidationError",{enumerable:!0,get:function(){return PF.default}});var RF=Al();Object.defineProperty(Re,"MissingRefError",{enumerable:!0,get:function(){return RF.default}})});var PP=j(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.formatNames=wn.fastFormats=wn.fullFormats=void 0;function _n(e,t){return{validate:e,compare:t}}wn.fullFormats={date:_n(AP,g_),time:_n(p_(!0),h_),"date-time":_n(EP(!0),zP),"iso-time":_n(p_(),CP),"iso-date-time":_n(EP(),IP),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:MF,"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:GF,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:LF,int32:{type:"number",validate:FF},int64:{type:"number",validate:qF},float:{type:"number",validate:TP},double:{type:"number",validate:TP},password:!0,binary:!0};wn.fastFormats={...wn.fullFormats,date:_n(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,g_),time:_n(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,h_),"date-time":_n(/^\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,zP),"iso-time":_n(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,CP),"iso-date-time":_n(/^\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,IP),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};wn.formatNames=Object.keys(wn.fullFormats);function $F(e){return e%4===0&&(e%100!==0||e%400===0)}var jF=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,OF=[0,31,28,31,30,31,30,31,31,30,31,30,31];function AP(e){let t=jF.exec(e);if(!t)return!1;let r=+t[1],a=+t[2],n=+t[3];return a>=1&&a<=12&&n>=1&&n<=(a===2&&$F(r)?29:OF[a])}function g_(e,t){if(e&&t)return e>t?1:e<t?-1:0}var d_=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function p_(e){return function(r){let a=d_.exec(r);if(!a)return!1;let n=+a[1],i=+a[2],o=+a[3],s=a[4],l=a[5]==="-"?-1:1,c=+(a[6]||0),u=+(a[7]||0);if(c>23||u>59||e&&!s)return!1;if(n<=23&&i<=59&&o<60)return!0;let d=i-u*l,m=n-c*l-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&o<61}}function h_(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),a=new Date("2020-01-01T"+t).valueOf();if(r&&a)return r-a}function CP(e,t){if(!(e&&t))return;let r=d_.exec(e),a=d_.exec(t);if(r&&a)return e=r[1]+r[2]+r[3],t=a[1]+a[2]+a[3],e>t?1:e<t?-1:0}var m_=/t|\s/i;function EP(e){let t=p_(e);return function(a){let n=a.split(m_);return n.length===2&&AP(n[0])&&t(n[1])}}function zP(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function IP(e,t){if(!(e&&t))return;let[r,a]=e.split(m_),[n,i]=t.split(m_),o=g_(r,n);if(o!==void 0)return o||h_(a,i)}var NF=/\/|:/,DF=/^(?:[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 MF(e){return NF.test(e)&&DF.test(e)}var xP=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function LF(e){return xP.lastIndex=0,xP.test(e)}var BF=-(2**31),UF=2**31-1;function FF(e){return Number.isInteger(e)&&e<=UF&&e>=BF}function qF(e){return Number.isInteger(e)}function TP(){return!0}var HF=/[^\\]\\Z/;function GF(e){if(HF.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var RP=j(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.formatLimitDefinition=void 0;var VF=u_(),an=ne(),Ir=an.operators,Wm={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}},WF={message:({keyword:e,schemaCode:t})=>(0,an.str)`should be ${Wm[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,an._)`{comparison: ${Wm[e].okStr}, limit: ${t}}`};lo.formatLimitDefinition={keyword:Object.keys(Wm),type:"string",schemaType:"string",$data:!0,error:WF,code(e){let{gen:t,data:r,schemaCode:a,keyword:n,it:i}=e,{opts:o,self:s}=i;if(!o.validateFormats)return;let l=new VF.KeywordCxt(i,s.RULES.all.format.definition,"format");l.$data?c():u();function c(){let m=t.scopeValue("formats",{ref:s.formats,code:o.code.formats}),p=t.const("fmt",(0,an._)`${m}[${l.schemaCode}]`);e.fail$data((0,an.or)((0,an._)`typeof ${p} != "object"`,(0,an._)`${p} instanceof RegExp`,(0,an._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let m=l.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${n}": format "${m}" does not define "compare" function`);let g=t.scopeValue("formats",{key:m,ref:p,code:o.code.formats?(0,an._)`${o.code.formats}${(0,an.getProperty)(m)}`:void 0});e.fail$data(d(g))}function d(m){return(0,an._)`${m}.compare(${r}, ${a}) ${Wm[n].fail} 0`}},dependencies:["format"]};var KF=e=>(e.addKeyword(lo.formatLimitDefinition),e);lo.default=KF});var NP=j((Fl,OP)=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});var co=PP(),ZF=RP(),f_=ne(),$P=new f_.Name("fullFormats"),JF=new f_.Name("fastFormats"),b_=(e,t={keywords:!0})=>{if(Array.isArray(t))return jP(e,t,co.fullFormats,$P),e;let[r,a]=t.mode==="fast"?[co.fastFormats,JF]:[co.fullFormats,$P],n=t.formats||co.formatNames;return jP(e,n,r,a),t.keywords&&(0,ZF.default)(e),e};b_.get=(e,t="full")=>{let a=(t==="fast"?co.fastFormats:co.fullFormats)[e];if(!a)throw new Error(`Unknown format "${e}"`);return a};function jP(e,t,r,a){var n,i;(n=(i=e.opts.code).formats)!==null&&n!==void 0||(i.formats=(0,f_._)`require("ajv-formats/dist/formats").${a}`);for(let o of t)e.addFormat(o,r[o])}OP.exports=Fl=b_;Object.defineProperty(Fl,"__esModule",{value:!0});Fl.default=b_});import{createServer as Pq}from"node:http";import Yx from"node:process";var G={};En(G,{$brand:()=>fg,$input:()=>Lh,$output:()=>Mh,INVALID:()=>ut,NEVER:()=>hg,TimePrecision:()=>Wh,ZodAny:()=>ob,ZodArray:()=>ub,ZodBase64:()=>Hd,ZodBase64URL:()=>Gd,ZodBigInt:()=>mi,ZodBigIntFormat:()=>Kd,ZodBoolean:()=>pi,ZodCIDRv4:()=>Fd,ZodCIDRv6:()=>qd,ZodCUID:()=>Od,ZodCUID2:()=>Nd,ZodCatch:()=>zb,ZodCodec:()=>Ss,ZodCompileAsyncError:()=>Vt,ZodCompileUnsupportedError:()=>se,ZodCreditCard:()=>tb,ZodCustom:()=>Es,ZodCustomStringFormat:()=>Wr,ZodDate:()=>vs,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>pb,ZodE164:()=>Vd,ZodEmail:()=>Pd,ZodEmoji:()=>$d,ZodEnum:()=>ci,ZodError:()=>u0,ZodExactOptional:()=>Yd,ZodFile:()=>yb,ZodFirstPartyTypeKind:()=>qb,ZodFunction:()=>Lb,ZodGUID:()=>Rd,ZodIBAN:()=>nb,ZodIPv4:()=>Bd,ZodIPv6:()=>Ud,ZodISODate:()=>lr,ZodISODateTime:()=>sr,ZodISODuration:()=>ur,ZodISOTime:()=>cr,ZodInstanceOf:()=>Fb,ZodIntersection:()=>mb,ZodIssueCode:()=>m0,ZodJWT:()=>Wd,ZodKSUID:()=>Ld,ZodLazy:()=>Nb,ZodLiteral:()=>vb,ZodMAC:()=>eb,ZodMap:()=>fb,ZodNaN:()=>Pb,ZodNanoID:()=>jd,ZodNever:()=>lb,ZodNonOptional:()=>Xd,ZodNull:()=>ib,ZodNullable:()=>wb,ZodNumber:()=>di,ZodNumberFormat:()=>Kr,ZodObject:()=>ys,ZodOptional:()=>Zr,ZodPipe:()=>ws,ZodPrefault:()=>xb,ZodPreprocess:()=>Rb,ZodPromise:()=>Mb,ZodReadonly:()=>$b,ZodRealError:()=>wt,ZodRecord:()=>li,ZodSet:()=>bb,ZodString:()=>ui,ZodStringFormat:()=>Se,ZodSuccess:()=>Cb,ZodSymbol:()=>rb,ZodTemplateLiteral:()=>Ob,ZodTransform:()=>kb,ZodTuple:()=>gb,ZodType:()=>Y,ZodULID:()=>Dd,ZodURL:()=>fs,ZodUUID:()=>dn,ZodUndefined:()=>ab,ZodUnion:()=>ks,ZodUnknown:()=>sb,ZodVoid:()=>cb,ZodXID:()=>Md,ZodXor:()=>db,_ZodString:()=>Id,_default:()=>Eb,_function:()=>bx,any:()=>XE,array:()=>ae,base64:()=>RE,base64url:()=>$E,bigint:()=>WE,boolean:()=>De,catch:()=>Ib,check:()=>vx,cidrv4:()=>IE,cidrv6:()=>PE,clone:()=>ge,codec:()=>mx,coerce:()=>Gb,compile:()=>qh,config:()=>Oe,core:()=>Kt,creditCard:()=>OE,cuid:()=>wE,cuid2:()=>SE,currencyCode:()=>UE,custom:()=>Qd,date:()=>ex,decode:()=>Wf,decodeAsync:()=>Zf,deepPartial:()=>Ix,describe:()=>yx,discriminatedUnion:()=>_s,e164:()=>jE,email:()=>pE,emoji:()=>kE,encode:()=>Vf,encodeAsync:()=>Kf,endsWith:()=>Ya,enum:()=>Ke,exactOptional:()=>_b,file:()=>cx,flattenError:()=>wo,float32:()=>qE,float64:()=>HE,formatError:()=>So,fromJSONSchema:()=>Cx,function:()=>bx,getDiscriminatedOption:()=>jh,getErrorMap:()=>h0,globalRegistry:()=>Ve,gt:()=>cn,gte:()=>It,guid:()=>mE,hash:()=>FE,hex:()=>BE,hostname:()=>LE,httpUrl:()=>yE,iban:()=>NE,includes:()=>Za,input:()=>Rx,instanceof:()=>_x,int:()=>Cd,int32:()=>GE,int64:()=>KE,intersection:()=>gi,invertCodec:()=>gx,ipv4:()=>AE,ipv6:()=>zE,iso:()=>Jr,json:()=>Sx,jwt:()=>DE,keyof:()=>tx,ksuid:()=>TE,lazy:()=>Db,length:()=>Hr,literal:()=>B,locales:()=>qa,looseObject:()=>We,looseRecord:()=>ix,lowercase:()=>Wa,lt:()=>ln,lte:()=>zt,mac:()=>CE,map:()=>ox,maxLength:()=>qr,maxSize:()=>nr,memoizer:()=>Bo,meta:()=>kx,mime:()=>Qa,minLength:()=>Cn,minSize:()=>un,multipleOf:()=>tr,nan:()=>px,nanoid:()=>_E,nativeEnum:()=>lx,negative:()=>dd,never:()=>Zd,nonnegative:()=>md,nonoptional:()=>Ab,nonpositive:()=>pd,normalize:()=>ei,null:()=>bs,nullable:()=>hs,nullish:()=>ux,number:()=>he,object:()=>O,optional:()=>we,output:()=>$x,overwrite:()=>Wt,parse:()=>Ff,parseAsync:()=>qf,partialRecord:()=>ax,pipe:()=>zd,positive:()=>ud,prefault:()=>Tb,preprocess:()=>xs,prettifyError:()=>_g,promise:()=>fx,properties:()=>Xa,property:()=>gd,readonly:()=>jb,record:()=>Ee,refine:()=>Bb,regex:()=>Va,regexes:()=>Ct,registry:()=>Du,safeDecode:()=>Yf,safeDecodeAsync:()=>Qf,safeEncode:()=>Jf,safeEncodeAsync:()=>Xf,safeParse:()=>Hf,safeParseAsync:()=>Gf,set:()=>sx,setErrorMap:()=>g0,size:()=>Fr,slugify:()=>ai,startsWith:()=>Ja,strictObject:()=>nx,string:()=>w,stringFormat:()=>ME,stringbool:()=>wx,success:()=>dx,superRefine:()=>Ub,symbol:()=>JE,templateLiteral:()=>hx,toJSONSchema:()=>Gr,toLowerCase:()=>ni,toUpperCase:()=>ri,toZod:()=>mo,transform:()=>Jd,treeifyError:()=>kg,trim:()=>ti,tuple:()=>hb,uint32:()=>VE,uint64:()=>ZE,ulid:()=>EE,undefined:()=>YE,union:()=>ye,unknown:()=>xe,uppercase:()=>Ka,url:()=>vE,util:()=>E,uuid:()=>gE,uuidv4:()=>hE,uuidv6:()=>fE,uuidv7:()=>bE,validate:()=>$a,validateAsync:()=>ja,void:()=>QE,withParser:()=>Mu,xid:()=>xE,xor:()=>rx});var Kt={};En(Kt,{$ZodAny:()=>Yc,$ZodArray:()=>nu,$ZodAsyncError:()=>kt,$ZodBase64:()=>Oc,$ZodBase64URL:()=>Dc,$ZodBigInt:()=>jo,$ZodBigIntFormat:()=>Wc,$ZodBoolean:()=>Da,$ZodCIDRv4:()=>Pc,$ZodCIDRv6:()=>$c,$ZodCUID:()=>Sc,$ZodCUID2:()=>Ec,$ZodCatch:()=>ku,$ZodCheck:()=>_e,$ZodCheckBigIntFormat:()=>sh,$ZodCheckEndsWith:()=>yh,$ZodCheckGreaterThan:()=>lc,$ZodCheckIncludes:()=>bh,$ZodCheckLengthEquals:()=>mh,$ZodCheckLessThan:()=>sc,$ZodCheckLowerCase:()=>hh,$ZodCheckMaxLength:()=>dh,$ZodCheckMaxSize:()=>lh,$ZodCheckMimeType:()=>wh,$ZodCheckMinLength:()=>ph,$ZodCheckMinSize:()=>ch,$ZodCheckMultipleOf:()=>ih,$ZodCheckNumberFormat:()=>oh,$ZodCheckOverwrite:()=>Sh,$ZodCheckProperties:()=>_h,$ZodCheckProperty:()=>kh,$ZodCheckRegex:()=>gh,$ZodCheckSizeEquals:()=>uh,$ZodCheckStartsWith:()=>vh,$ZodCheckStringFormat:()=>Oa,$ZodCheckUpperCase:()=>fh,$ZodCodec:()=>La,$ZodCreditCard:()=>Bc,$ZodCustom:()=>Tu,$ZodCustomStringFormat:()=>Gc,$ZodCyclicError:()=>Iu,$ZodDate:()=>tu,$ZodDefault:()=>fu,$ZodDiscriminatedUnion:()=>iu,$ZodE164:()=>Mc,$ZodEmail:()=>fc,$ZodEmoji:()=>_c,$ZodEncodeError:()=>Xn,$ZodEnum:()=>uu,$ZodError:()=>yg,$ZodExactOptional:()=>gu,$ZodFile:()=>pu,$ZodFunction:()=>Eu,$ZodGUID:()=>gc,$ZodIBAN:()=>Fc,$ZodIPv4:()=>Cc,$ZodIPv6:()=>zc,$ZodISODate:()=>zh,$ZodISODateTime:()=>Ch,$ZodISODuration:()=>Ph,$ZodISOTime:()=>Ih,$ZodIntersection:()=>ou,$ZodJWT:()=>Hc,$ZodKSUID:()=>Ac,$ZodLazy:()=>Ba,$ZodLiteral:()=>du,$ZodMAC:()=>Ic,$ZodMap:()=>lu,$ZodNaN:()=>_u,$ZodNanoID:()=>wc,$ZodNever:()=>Qc,$ZodNonOptional:()=>vu,$ZodNull:()=>Jc,$ZodNullable:()=>hu,$ZodNumber:()=>$o,$ZodNumberFormat:()=>Vc,$ZodObject:()=>ru,$ZodObjectJIT:()=>$h,$ZodOptional:()=>No,$ZodPipe:()=>Do,$ZodPrefault:()=>bu,$ZodPreprocess:()=>Oh,$ZodPromise:()=>xu,$ZodReadonly:()=>wu,$ZodRealError:()=>_t,$ZodRecord:()=>su,$ZodRegistry:()=>Nu,$ZodSet:()=>cu,$ZodString:()=>Qn,$ZodStringFormat:()=>be,$ZodSuccess:()=>yu,$ZodSymbol:()=>Kc,$ZodTemplateLiteral:()=>Su,$ZodTransform:()=>mu,$ZodTuple:()=>Oo,$ZodType:()=>Z,$ZodULID:()=>xc,$ZodURL:()=>kc,$ZodUUID:()=>hc,$ZodUndefined:()=>Zc,$ZodUnion:()=>Ma,$ZodUnknown:()=>Xc,$ZodVoid:()=>eu,$ZodXID:()=>Tc,$ZodXor:()=>au,$brand:()=>fg,$constructor:()=>y,$input:()=>Lh,$output:()=>Mh,Doc:()=>Mr,INVALID:()=>ut,JSONSchema:()=>cE,JSONSchemaGenerator:()=>xd,NEVER:()=>hg,TimePrecision:()=>Wh,URL_BAD_FORMAT:()=>Th,URL_UNPARSEABLE:()=>Co,ZodCompileAsyncError:()=>Vt,ZodCompileUnsupportedError:()=>se,_any:()=>ad,_array:()=>Xh,_base64:()=>is,_base64url:()=>os,_bigint:()=>Xu,_boolean:()=>Yu,_catch:()=>X2,_check:()=>WS,_cidrv4:()=>rs,_cidrv6:()=>as,_coercedBigint:()=>Jh,_coercedBoolean:()=>Zh,_coercedDate:()=>Yh,_coercedNumber:()=>Kh,_coercedString:()=>Vh,_creditCard:()=>qu,_cuid:()=>Jo,_cuid2:()=>Yo,_custom:()=>fd,_date:()=>ld,_decode:()=>Jl,_decodeAsync:()=>Xl,_default:()=>Z2,_discriminatedUnion:()=>D2,_e164:()=>ss,_email:()=>Fo,_emoji:()=>Ko,_encode:()=>Zl,_encodeAsync:()=>Yl,_endsWith:()=>Ya,_enum:()=>q2,_file:()=>hd,_float32:()=>Wu,_float64:()=>Ku,_gt:()=>cn,_gte:()=>It,_guid:()=>qo,_iban:()=>Hu,_includes:()=>Za,_int:()=>Vu,_int32:()=>Zu,_int64:()=>Qu,_intersection:()=>M2,_ipv4:()=>ts,_ipv6:()=>ns,_isoDate:()=>us,_isoDateTime:()=>cs,_isoDuration:()=>ps,_isoTime:()=>ds,_jwt:()=>ls,_ksuid:()=>es,_lazy:()=>n0,_length:()=>Hr,_literal:()=>G2,_lowercase:()=>Wa,_lt:()=>ln,_lte:()=>zt,_mac:()=>Fu,_map:()=>U2,_max:()=>zt,_maxLength:()=>qr,_maxSize:()=>nr,_mime:()=>Qa,_min:()=>It,_minLength:()=>Cn,_minSize:()=>un,_multipleOf:()=>tr,_nan:()=>cd,_nanoid:()=>Zo,_nativeEnum:()=>H2,_negative:()=>dd,_never:()=>od,_nonnegative:()=>md,_nonoptional:()=>J2,_nonpositive:()=>pd,_normalize:()=>ei,_null:()=>rd,_nullable:()=>K2,_number:()=>Gu,_optional:()=>W2,_overwrite:()=>Wt,_parse:()=>Aa,_parseAsync:()=>Ca,_pipe:()=>Q2,_positive:()=>ud,_promise:()=>r0,_properties:()=>Xa,_property:()=>gd,_readonly:()=>e0,_record:()=>B2,_refine:()=>bd,_regex:()=>Va,_safeDecode:()=>ec,_safeDecodeAsync:()=>nc,_safeEncode:()=>Ql,_safeEncodeAsync:()=>tc,_safeParse:()=>za,_safeParseAsync:()=>Pa,_set:()=>F2,_size:()=>Fr,_slugify:()=>ai,_startsWith:()=>Ja,_string:()=>Uu,_stringFormat:()=>rr,_stringbool:()=>_d,_success:()=>Y2,_superRefine:()=>vd,_symbol:()=>td,_templateLiteral:()=>t0,_toLowerCase:()=>ni,_toUpperCase:()=>ri,_transform:()=>V2,_trim:()=>ti,_tuple:()=>L2,_uint32:()=>Ju,_uint64:()=>ed,_ulid:()=>Xo,_undefined:()=>nd,_union:()=>O2,_unknown:()=>id,_uppercase:()=>Ka,_url:()=>Ga,_uuid:()=>Ho,_uuidv4:()=>Go,_uuidv6:()=>Vo,_uuidv7:()=>Wo,_void:()=>sd,_xid:()=>Qo,_xor:()=>N2,base64Charset:()=>jc,base64urlCharset:()=>Ro,canParseURL:()=>Ah,clone:()=>ge,compile:()=>qh,compileFn:()=>Lu,config:()=>Oe,createStandardJSONSchemaMethod:()=>ii,createToJSONSchemaMethod:()=>ef,decode:()=>K_,decodeAsync:()=>J_,describe:()=>yd,encode:()=>W_,encodeAsync:()=>Z_,extractDefs:()=>ir,finalize:()=>or,flattenError:()=>wo,formatError:()=>So,getDiscriminatedOption:()=>jh,globalConfig:()=>He,globalRegistry:()=>Ve,handleUnrepresentable:()=>Be,initializeContext:()=>ar,isBackEdge:()=>Ru,isRecursiveSchema:()=>Pu,isValidBase64:()=>Po,isValidBase64URL:()=>Nc,isValidCIDRv6:()=>Rc,isValidCreditCard:()=>Lc,isValidIBAN:()=>Uc,isValidIPv6:()=>Io,isValidJWT:()=>qc,locales:()=>qa,memoizer:()=>Bo,mergeValues:()=>Na,meta:()=>kd,parse:()=>Or,parseAsync:()=>Nr,parseURLObject:()=>kw,prettifyError:()=>_g,process:()=>ve,processSchema:()=>ve,regexes:()=>Ct,registry:()=>Du,safeDecode:()=>X_,safeDecodeAsync:()=>ew,safeEncode:()=>Y_,safeEncodeAsync:()=>Q_,safeParse:()=>Ia,safeParseAsync:()=>Ra,standardProps:()=>mc,stripTabAndNewline:()=>zo,toDotPath:()=>G_,toJSONSchema:()=>Gr,toZod:()=>mo,treeifyError:()=>kg,urlHostnameOk:()=>vc,urlProtocolOk:()=>yc,util:()=>E,validate:()=>$a,validateAsync:()=>ja,validateURL:()=>bc,version:()=>Eh,withParser:()=>Mu});var E={};En(E,{BIGINT_FORMAT_RANGES:()=>bo,CONSTANT_CATCH:()=>Wl,Class:()=>ag,NUMBER_FORMAT_RANGES:()=>fo,aborted:()=>ct,allowsEval:()=>sg,assert:()=>g1,assertEqual:()=>u1,assertIs:()=>p1,assertNever:()=>m1,assertNotEqual:()=>d1,assignProp:()=>Ge,attachSchema:()=>vo,base64ToUint8Array:()=>L_,base64urlToUint8Array:()=>T1,cached:()=>wa,captureStackTrace:()=>Gl,cleanEnum:()=>x1,cleanRegex:()=>Tn,clone:()=>ge,cloneDef:()=>b1,codePointLength:()=>jr,constantCatch:()=>mg,createTransparentProxy:()=>S1,defineLazy:()=>ig,defineLazyInternal:()=>ee,derived:()=>I1,esc:()=>lt,escapeRegex:()=>Mt,explicitlyAborted:()=>ug,extend:()=>$_,finalizeIssue:()=>yt,floatSafeRemainder:()=>go,getElementAtPath:()=>v1,getEnumValues:()=>ka,getLengthableOrigin:()=>ko,getParsedType:()=>w1,getSizableOrigin:()=>yo,hexToUint8Array:()=>C1,hide:()=>_o,installLazyProp:()=>pg,isObject:()=>$r,isPlainObject:()=>Dt,issue:()=>Ta,joinValues:()=>_,jsonStringifyReplacer:()=>_a,members:()=>dg,merge:()=>N_,mergeDefs:()=>Nt,normalizeParams:()=>z,nullish:()=>Hl,numKeys:()=>_1,objectClone:()=>h1,omit:()=>R_,optionalKeys:()=>cg,own:()=>sn,parsedType:()=>T,partial:()=>D_,pick:()=>P_,prefixIssues:()=>vt,primitiveTypes:()=>lg,promiseAllObject:()=>y1,propertyKeyTypes:()=>ho,randomString:()=>k1,rawShape:()=>Sa,required:()=>M_,safeExtend:()=>O_,shallowClone:()=>Ea,sizeCaps:()=>xa,slugify:()=>og,stringifyPrimitive:()=>x,toZod:()=>mo,uint8ArrayToBase64:()=>B_,uint8ArrayToBase64url:()=>A1,uint8ArrayToHex:()=>z1,unwrapMessage:()=>ya});function u1(e){return e}function d1(e){return e}function mo(){return e=>e}function p1(e){}function m1(e){throw new Error("Unexpected value in exhaustive check")}function g1(e){}function ka(e){let t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,n])=>t.indexOf(+a)===-1).map(([a,n])=>n)}function _(e,t="|"){return e.map(r=>x(r)).join(t)}function _a(e,t){return typeof t=="bigint"?t.toString():t}var rg=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function wa(e){return new rg(e)}function Hl(e){return e==null}function Tn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function go(e,t){let r=e/t,a=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-a)<n?0:r-a}var C_=Symbol("evaluating");function ig(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==C_)return a===void 0&&(a=C_,a=r()),a},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h1(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ge(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Sa(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function xn(e){return Sa(e._zod.def)??e._zod.def.shape}function z_(e,t,r){Object.defineProperty(e,t,{get(){let a=r();return Ge(this,t,a),a},enumerable:!0,configurable:!0})}function I_(e,t,r){t in e?Ge(e,t,r):e[t]=r}function Rr(e,t,r,a){let n=xn(t);for(let i of r){let o=Object.getOwnPropertyDescriptor(n,i);o.enumerable&&(o.get?z_(e,i,()=>{let s=t._zod.def.shape[i];return a?a(s,i):s}):I_(e,i,a?a(o.value,i):o.value))}}function f1(e,t){for(let r of Reflect.ownKeys(t)){let a=Object.getOwnPropertyDescriptor(t,r);a.enumerable&&(a.get?z_(e,r,()=>t[r]):I_(e,r,a.value))}}function Nt(...e){let t={};for(let r of e){let a=Object.getOwnPropertyDescriptors(r);Object.assign(t,a)}return Object.defineProperties({},t)}function b1(e){return Nt(e._zod.def)}function v1(e,t){return t?t.reduce((r,a)=>r?.[a],e):e}function y1(e){let t=Object.keys(e),r=t.map(a=>e[a]);return Promise.all(r).then(a=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=a[i];return n})}function k1(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let a=0;a<e;a++)r+=t[Math.floor(Math.random()*t.length)];return r}function lt(e){return JSON.stringify(e)}function og(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Gl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function $r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var sg=wa(()=>{if(He.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Dt(e){if($r(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!($r(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ea(e){return Dt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function _1(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var w1=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}`)}},ho=new Set(["string","number","symbol"]),lg=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ge(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function z(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 S1(e){let t;return new Proxy({},{get(r,a,n){return t??(t=e()),Reflect.get(t,a,n)},set(r,a,n,i){return t??(t=e()),Reflect.set(t,a,n,i)},has(r,a){return t??(t=e()),Reflect.has(t,a)},deleteProperty(r,a){return t??(t=e()),Reflect.deleteProperty(t,a)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,a){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,a)},defineProperty(r,a,n){return t??(t=e()),Reflect.defineProperty(t,a,n)}})}function x(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function cg(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var fo={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]},bo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function P_(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return Rr(i,e,Vl(e,t)),ge(e,Nt(r,{shape:i,checks:[]}))}function Vl(e,t){let r=xn(e),a=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&a.push(n)}return a}function R_(e,t){let r=e._zod.def,a=r.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Vl(e,t)),o={};return Rr(o,e,Reflect.ownKeys(xn(e)).filter(s=>!i.has(s))),ge(e,Nt(r,{shape:o,checks:[]}))}function $_(e,t){if(!Dt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=xn(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ge(e,Nt(e._zod.def,{shape:j_(e,t)}))}function j_(e,t){let r={};return Rr(r,e,Reflect.ownKeys(xn(e))),f1(r,t),r}function O_(e,t){if(!Dt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ge(e,Nt(e._zod.def,{shape:j_(e,t)}))}function N_(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Rr(r,e,Reflect.ownKeys(xn(e))),Rr(r,t,Reflect.ownKeys(xn(t)));let a=Nt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ge(e,a)}function D_(e,t,r,a="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${a}() cannot be used on object schemas containing refinements`);let s=r?new Set(Vl(t,r)):void 0,l={};return Rr(l,t,Reflect.ownKeys(xn(t)),e&&((c,u)=>s&&!s.has(u)?c:new e({type:"optional",innerType:c}))),ge(t,Nt(t._zod.def,{shape:l,checks:[]}))}function M_(e,t,r){let a=r?new Set(Vl(t,r)):void 0,n={};return Rr(n,t,Reflect.ownKeys(xn(t)),(i,o)=>a&&!a.has(o)?i:new e({type:"nonoptional",innerType:i})),ge(t,Nt(t._zod.def,{shape:n}))}function ct(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 ug(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function vt(e,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(e),r})}function ya(e){return typeof e=="string"?e:e?.message}function xa(e){let t=[];for(let r of e??[]){let a=r._zod.def;if(!/_(length|size)$|_equals$/.test(a.check))break;let n=a.maximum??a.length??a.size;n>=0&&t.push([n,r])}return t}function vo(e,t,r){var a;for(let n=t;n<e.length;n++)(a=e[n]).schema??(a.schema=r)}function yt(e,t,r){var a;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(a=e).schema??(a.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,o=e.message?e.message:ya(e.inst?._zod.def?.error?.(e))??ya(i?.(e))??ya(t?.error?.(e))??ya(r.customError?.(e))??ya(r.localeError?.(e))??"Invalid input",s={};for(let l of Object.keys(e))l==="inst"||l==="schema"||l==="continue"||l==="input"||l==="__proto__"||(s[l]=e[l]);return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=e.input),s}function yo(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var E1=/[\uD800-\uDBFF]/;function jr(e){let t=e.length;if(!E1.test(e))return t;let r=t;for(let a=0;a<t-1;a++)(e.charCodeAt(a)&64512)===55296&&(e.charCodeAt(a+1)&64512)===56320&&(r--,a++);return r}function ko(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function T(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 Ta(...e){let[t,r,a]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}function x1(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function L_(e){let t=atob(e),r=new Uint8Array(t.length);for(let a=0;a<t.length;a++)r[a]=t.charCodeAt(a);return r}function B_(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function T1(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return L_(t+r)}function A1(e){return B_(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function C1(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 a=0;a<t.length;a+=2)r[a/2]=Number.parseInt(t.slice(a,a+2),16);return r}function z1(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ag=class{constructor(...t){}};function dg(e,t){for(let r in t){let a=Object.getOwnPropertyDescriptor(t,r);a.get?Object.defineProperty(e,r,{...a,enumerable:!1}):P1(e,r,a.value)}}function sn(e,t,r,a=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:a,value:r}),r}function _o(e,t,r){return sn(e,t,r,!1)}function I1(e,t){for(let r in e){let a=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return sn(this,r,a(this))},set(n){sn(this,r,n)}})}return t}function P1(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:sn(this,t,r.bind(this))},set(a){sn(this,t,a)}})}function R1(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ng,Yn=!1,$1={configurable:!0,get(){Yn=!0}};function ee(e,t,r){let a=Object.getPrototypeOf(e._zod);if(t in a&&ng!==e._zod){ng=void 0;return}ng=e._zod,Object.defineProperty(a,t,{configurable:!0,get(){Object.defineProperty(this,t,$1);let n=Yn;Yn=!1;try{let i=r(this);return Yn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Yn=Yn||n,i}catch(i){throw delete this[t],Yn=Yn||n,i}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function pg(e,t,r,a){let n=R1(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:a,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:a,value:i})}})}var Wl="~constantCatch";function mg(e){let t=()=>e;return t[Wl]=!0,t}var U_,hg=Object.freeze({status:"aborted"}),gg={value:void 0,enumerable:!1},F_="captureStackTrace"in Error?Error:null;function j1(e){let t=F_;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return F_=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function y(e,t,r,a){let n={};function i(m){this.def=m,this.constr=d,this.traits=new Set}i.prototype=n;let o=r,s=o&&new WeakSet;function l(m,p){if(m._zod){if(m._zod.traits.has(e))return}else{gg.value=new i(p);try{Object.defineProperty(m,"_zod",gg)}finally{gg.value=void 0}}if(m._zod.traits.add(e),t(m,p),s){let h=Object.getPrototypeOf(m),f=m._zod.constr.prototype,k=h;for(;k&&k!==f;)k=Object.getPrototypeOf(k);let b=k??h;s.has(b)||(s.add(b),dg(b,o))}let g=d.prototype;for(let h in g)Object.prototype.hasOwnProperty.call(g,h)&&(h in m||(m[h]=g[h].bind(m)))}let c=a?.Parent??Object;class u extends c{}Object.defineProperty(u,"name",{value:e});function d(m){let p=a?.Parent?j1(u):this;l(p,m);let g=p._zod.deferred;if(g){for(let f of g)f();p._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;return h&&h(p),p}return Object.defineProperty(d,"init",{value:l}),Object.defineProperty(d,Symbol.hasInstance,{value:m=>a?.Parent&&m instanceof a.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var fg=Symbol("zod_brand"),kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Xn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(U_=globalThis).__zod_globalConfig??(U_.__zod_globalConfig={});var He=globalThis.__zod_globalConfig;function Oe(e){return e&&Object.assign(He,e),He}function O1(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,_a,2)),e.message}function N1(e){this._zod.message=e}var D1={get:O1,set:N1,enumerable:!0,configurable:!0},vg={value:void 0,enumerable:!1},q_=new WeakSet([Object.prototype,Error.prototype]),H_=(e,t)=>{e.name="$ZodError",vg.value=t,Object.defineProperty(e,"issues",vg),vg.value=void 0,Object.defineProperty(e,"message",D1);let r=Object.getPrototypeOf(e);q_.has(r)||(q_.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let a=()=>this.message;return Object.defineProperty(this,"toString",{value:a,configurable:!0,writable:!0}),a},set(a){Object.defineProperty(this,"toString",{value:a,configurable:!0,writable:!0})}}))},yg=y("$ZodError",H_),_t=y("$ZodError",H_,void 0,{Parent:Error});function M1(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function wo(e,t=r=>r.message){let r={},a=[];for(let n of e.issues)n.path.length>0?M1(r,n.path[0],()=>[]).push(t(n)):a.push(t(n));return{formErrors:a,fieldErrors:r}}function So(e,t=r=>r.message){let r={_errors:[]},a=(n,i=[])=>{for(let o of n.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(s=>a({issues:s},[...i,...o.path]));else if(o.code==="invalid_key")a({issues:o.issues},[...i,...o.path]);else if(o.code==="invalid_element")a({issues:o.issues},[...i,...o.path]);else{let s=[...i,...o.path];if(s.length===0)r._errors.push(t(o));else{let l=r,c=0;for(;c<s.length;){let u=s[c],d=c===s.length-1;if(u==="_errors"){d&&l._errors.push(t(o)),c++;continue}Object.prototype.hasOwnProperty.call(l,u)||Object.defineProperty(l,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=l[u];d&&m._errors.push(t(o)),l=m,c++}}}};return a(e),r}function kg(e,t=r=>r.message){let r={errors:[]},a=(n,i=[])=>{var o;for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>a({issues:l},[...i,...s.path]));else if(s.code==="invalid_key")a({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")a({issues:s.issues},[...i,...s.path]);else{let l=[...i,...s.path];if(l.length===0){r.errors.push(t(s));continue}let c=r,u=0;for(;u<l.length;){let d=l[u],m=u===l.length-1;typeof d=="string"?(c.properties??(c.properties={}),Object.prototype.hasOwnProperty.call(c.properties,d)||Object.defineProperty(c.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),c=c.properties[d]):(c.items??(c.items=[]),(o=c.items)[d]??(o[d]={errors:[]}),c=c.items[d]),m&&c.errors.push(t(s)),u++}}};return a(e),r}function G_(e){let t=[],r=e.map(a=>typeof a=="object"?a.key:a);for(let a of r)typeof a=="number"?t.push(`[${a}]`):typeof a=="symbol"?t.push(`[${JSON.stringify(String(a))}]`):/[^\w$]/.test(a)?t.push(`[${JSON.stringify(a)}]`):(t.length&&t.push("."),t.push(a));return t.join("")}function _g(e){let t=[],r=[...e.issues].sort((a,n)=>(a.path??[]).length-(n.path??[]).length);for(let a of r)t.push(`\u2716 ${a.message}`),a.path?.length&&t.push(` \u2192 at ${G_(a.path)}`);return t.join(`
|
|
10
10
|
`)}function Kl(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Aa=e=>{let t=(r,a,n,i)=>{let o=n?{...n,async:!1}:{async:!1},s=r._zod.run({value:a,issues:[]},o);if(s instanceof Promise)throw new kt;if(s.issues.length){let l=new(i?.Err??e)(s.issues.map(c=>yt(c,o,Oe())));throw Gl(l,i?.callee??t),l}return s.value};return t},Or=Aa(_t),Ca=e=>{let t=async(r,a,n,i)=>{let o=n?{...n,async:!0}:{async:!0},s=r._zod.run({value:a,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let l=new(i?.Err??e)(s.issues.map(c=>yt(c,o,Oe())));throw Gl(l,i?.callee??t),l}return s.value};return t},Nr=Ca(_t),za=e=>(t,r,a)=>{let n=a?{...a,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new kt;return i.issues.length?V_(e,i.issues,n):{success:!0,data:i.value}},Ia=za(_t);function V_(e,t,r){let a;return{success:!1,get error(){return a||(a=new e(t.map(n=>yt(n,r,Oe()))),t=void 0,r=void 0),a},set error(n){a=n,t=void 0,r=void 0}}}var Pa=e=>async(t,r,a)=>{let n=a?{...a,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?V_(e,i.issues,n):{success:!0,data:i.value}},Ra=Pa(_t),B1=Symbol.for("zod.compile.invalid"),U1=Symbol.for("zod.compile.fallback"),$a=((e,t,r)=>{let a=e._zod.bag.validator;if(a!==void 0){if(a(t)!==B1)return!0;if(a.definite===!0&&r===void 0)return!1}return F1(e,t,r)});function F1(e,t,r){let a=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,i;if(n?(a[U1]=!0,i=n({value:t,issues:[]},a)):i=e._zod.run({value:t,issues:[]},a),i instanceof Promise)throw new kt;return i.issues.length===0}var ja=async(e,t,r)=>{let a=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},a);return n instanceof Promise&&(n=await n),n.issues.length===0},Zl=e=>{let t=Aa(e),r=(a,n,i,o)=>{let s=i?{...i,direction:"backward"}:{direction:"backward"};return t(a,n,s,Kl(r,o))};return r},W_=Zl(_t),Jl=e=>{let t=Aa(e),r=(a,n,i,o)=>t(a,n,i,Kl(r,o));return r},K_=Jl(_t),Yl=e=>{let t=Ca(e),r=async(a,n,i,o)=>{let s=i?{...i,direction:"backward"}:{direction:"backward"};return await t(a,n,s,Kl(r,o))};return r},Z_=Yl(_t),Xl=e=>{let t=Ca(e),r=async(a,n,i,o)=>await t(a,n,i,Kl(r,o));return r},J_=Xl(_t),Ql=e=>(t,r,a)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return za(e)(t,r,n)},Y_=Ql(_t),ec=e=>(t,r,a)=>za(e)(t,r,a),X_=ec(_t),tc=e=>async(t,r,a)=>{let n=a?{...a,direction:"backward"}:{direction:"backward"};return Pa(e)(t,r,n)},Q_=tc(_t),nc=e=>async(t,r,a)=>Pa(e)(t,r,a),ew=nc(_t);var Ct={};En(Ct,{anyString:()=>Kg,base64:()=>Lg,base64url:()=>Bg,bigint:()=>Jg,boolean:()=>Yg,browserEmail:()=>J1,cidrv4:()=>Dg,cidrv6:()=>Mg,creditCard:()=>rc,cuid:()=>Sg,cuid2:()=>Eg,currencyCode:()=>Hg,date:()=>Gg,datetime:()=>Wg,domain:()=>Fg,duration:()=>Ig,e164:()=>qg,email:()=>Rg,emoji:()=>$g,extendedDuration:()=>q1,guid:()=>Pg,hex:()=>nh,hostname:()=>Ug,html5Email:()=>W1,httpProtocol:()=>Eo,iban:()=>ac,idnEmail:()=>Z1,integer:()=>xo,ipv4:()=>jg,ipv6:()=>Og,ksuid:()=>Ag,lowercase:()=>eh,mac:()=>Ng,md5_base64:()=>eR,md5_base64url:()=>tR,md5_hex:()=>Q1,nanoid:()=>Cg,nanoidOfLength:()=>zg,null:()=>Xg,number:()=>An,rfc5322Email:()=>K1,sha1_base64:()=>rR,sha1_base64url:()=>aR,sha1_hex:()=>nR,sha256_base64:()=>oR,sha256_base64url:()=>sR,sha256_hex:()=>iR,sha384_base64:()=>cR,sha384_base64url:()=>uR,sha384_hex:()=>lR,sha512_base64:()=>pR,sha512_base64url:()=>mR,sha512_hex:()=>dR,string:()=>Zg,time:()=>Vg,ulid:()=>xg,undefined:()=>Qg,unicodeEmail:()=>tw,uppercase:()=>th,uuid:()=>Dr,uuid4:()=>H1,uuid6:()=>G1,uuid7:()=>V1,xid:()=>Tg});var Sg=/^[cC][0-9a-z]{6,}$/,Eg=/^[0-9a-z]+$/,xg=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Tg=/^[0-9a-vA-V]{20}$/,Ag=/^[A-Za-z0-9]{27}$/,Cg=/^[a-zA-Z0-9_-]{21}$/;function zg(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ig=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,q1=/^[-+]?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)?)??$/,Pg=/^([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})$/,Dr=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)$/,H1=Dr(4),G1=Dr(6),V1=Dr(7),Rg=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,W1=/^[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])?)*$/,K1=/^(([^<>()\[\]\\.,;:\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,}))$/,tw=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Z1=tw,J1=/^[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])?)*$/,Y1="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function $g(){return new RegExp(Y1,"u")}var jg=/^(?:(?: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])$/,Og=/^(([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}|:))$/,Ng=e=>{let t=Mt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Dg=/^((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])$/,Mg=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bg=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ug=/^(?=.{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])?)*\.?$/,Fg=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Eo=/^https?$/,qg=/^\+[1-9]\d{6,14}$/,rc=/^\d(?:[ -]?\d){11,18}$/,Hg=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,ac=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,nw="(?:(?:\\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])))";function X1(e){return new RegExp(`^${e}$`)}var Gg=X1(nw);function wg(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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Vg(e){return new RegExp(`^${wg(e)}$`)}function Wg(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${wg({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,a=e.local?`${r}|${wg({precision:e.precision})}`:r;return new RegExp(`^${nw}T(?:${a})$`)}var Kg=/^[\s\S]{0,}$/,Zg=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Jg=/^-?\d+n?$/,xo=/^-?\d+$/,An=/^-?\d+(?:\.\d+)?$/,Yg=/^(?:true|false)$/i,Xg=/^null$/i;var Qg=/^undefined$/i;var eh=/^[^A-Z]*$/,th=/^[^a-z]*$/,nh=/^[0-9a-fA-F]*$/;function To(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ao(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Q1=/^[0-9a-fA-F]{32}$/,eR=To(22,"=="),tR=Ao(22),nR=/^[0-9a-fA-F]{40}$/,rR=To(27,"="),aR=Ao(27),iR=/^[0-9a-fA-F]{64}$/,oR=To(43,"="),sR=Ao(43),lR=/^[0-9a-fA-F]{96}$/,cR=To(64,""),uR=Ao(64),dR=/^[0-9a-fA-F]{128}$/,pR=To(86,"=="),mR=Ao(86);var _e=y("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),rh=e=>{let t=e.value;return!Hl(t)&&t.size!==void 0},ah=e=>{let t=e.value;return!Hl(t)&&t.length!==void 0},ic={number:"number",bigint:"bigint",object:"date"},sc=y("$ZodCheckLessThan",(e,t)=>{_e.init(e,t);let r=ic[typeof t.value];e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:ic[typeof a.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),lc=y("$ZodCheckGreaterThan",(e,t)=>{_e.init(e,t);let r=ic[typeof t.value];e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:ic[typeof a.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ih=y("$ZodCheckMultipleOf",(e,t)=>{_e.init(e,t),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"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):go(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})}}),oh=y("$ZodCheckNumberFormat",(e,t)=>{_e.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[n,i]=fo[t.format];e._zod.check=o=>{let s=o.value;if(r){if(!Number.isInteger(s)){o.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}s<n&&o.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>i&&o.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),sh=y("$ZodCheckBigIntFormat",(e,t)=>{_e.init(e,t);let[r,a]=bo[t.format];e._zod.check=n=>{let i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>a&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),lh=y("$ZodCheckMaxSize",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=rh),e._zod.check=a=>{let n=a.value;n.size<=t.maximum||a.issues.push({origin:yo(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ch=y("$ZodCheckMinSize",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=rh),e._zod.check=a=>{let n=a.value;n.size>=t.minimum||a.issues.push({origin:yo(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),uh=y("$ZodCheckSizeEquals",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=rh),e._zod.check=a=>{let n=a.value,i=n.size;if(i===t.size)return;let o=i>t.size;a.issues.push({origin:yo(n),...o?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),dh=y("$ZodCheckMaxLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=ah),e._zod.check=a=>{let n=a.value,i=n.length;if((typeof n=="string"&&i>t.maximum?jr(n):i)<=t.maximum)return;let s=ko(n);a.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ph=y("$ZodCheckMinLength",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=ah),e._zod.check=a=>{let n=a.value,i=n.length;if((typeof n=="string"&&i>=t.minimum&&i<t.minimum*2?jr(n):i)>=t.minimum)return;let s=ko(n);a.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),mh=y("$ZodCheckLengthEquals",(e,t)=>{var r;_e.init(e,t),(r=e._zod.def).when??(r.when=ah),e._zod.check=a=>{let n=a.value,i=n.length,o=typeof n=="string"&&i>=t.length&&i<=t.length*2?jr(n):i;if(o===t.length)return;let s=ko(n),l=o>t.length;a.issues.push({origin:s,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Oa=y("$ZodCheckStringFormat",(e,t)=>{var r,a;_e.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),gh=y("$ZodCheckRegex",(e,t)=>{Oa.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})}}),hh=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=eh),Oa.init(e,t)}),fh=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=th),Oa.init(e,t)}),bh=y("$ZodCheckIncludes",(e,t)=>{_e.init(e,t);let r=Mt(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=a,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vh=y("$ZodCheckStartsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`^${Mt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),yh=y("$ZodCheckEndsWith",(e,t)=>{_e.init(e,t);let r=new RegExp(`.*${Mt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}});function oc(e,t,r){e.issues.length&&t.issues.push(...vt(r,e.issues))}var kh=y("$ZodCheckProperty",(e,t)=>{_e.init(e,t),e._zod.check=r=>{let a=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(a instanceof Promise)return a.then(n=>oc(n,r,t.property));oc(a,r,t.property)}}),_h=y("$ZodCheckProperties",(e,t)=>{_e.init(e,t),_o(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=a=>{if(a.value==null){a.issues.push({expected:"object",code:"invalid_type",input:a.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(o=>[o,t.shape[o]]));let n=a.value,i;for(let[o,s]of r){let l=s._zod.run({value:n[o],issues:[]},{});l instanceof Promise?(i??(i=[]),i.push(l.then(c=>oc(c,a,o)))):oc(l,a,o)}if(i)return Promise.all(i).then(()=>{})}}),wh=y("$ZodCheckMimeType",(e,t)=>{_e.init(e,t);let r=new Set(t.mime);e._zod.check=a=>{r.has(a.value.type)||a.issues.push({code:"invalid_value",values:t.mime,input:a.value.type,inst:e,continue:!t.abort})}}),Sh=y("$ZodCheckOverwrite",(e,t)=>{_e.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Mr=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let a=t.split(`
|
|
11
11
|
`).filter(o=>o),n=Math.min(...a.map(o=>o.length-o.trimStart().length)),i=a.map(o=>o.slice(n)).map(o=>" ".repeat(this.indent*2)+o);for(let o of i)this.content.push(o)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
12
12
|
${r.join(`
|
|
@@ -67,9 +67,9 @@ ${l}`:l:"",u=Function,d=`return (input) => {
|
|
|
67
67
|
${l}
|
|
68
68
|
}`,m;try{m=new u(...o,d)(...s)}catch(p){throw new se(`this schema (generated code failed to evaluate: ${p.message})`)}return t?.debug&&(m.code=c),m.definite=a.definite,m}function V(e,t){for(let[a,n]of e.constants)if(n===t)return a;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function Br(e,t){return e.definite=!1,V(e,t)}function H(e){return`v${e.varCounter++}`}function M$(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return ut;let a=r;return a.issues.length===0?a.value:ut}function tt(e,t,r,a,n=!0){let i=e.content.length,o=t.constants.size,s=t.constantCounter,l=t.varCounter;try{return $e(e,t,r,a,n)}catch(c){if(!(c instanceof se)||!c.islandable)throw c;if(e.content.length=i,t.constants.size>o){let u=Array.from(t.constants.keys()).slice(o);for(let d of u)t.constants.delete(d)}return t.constantCounter=s,t.varCounter=l,L$(e,t,r,a)}}function L$(e,t,r,a){t.definite=!1;let n=V(t,r),i=V(t,M$),o=H(t);return e.write(`const ${o} = ${i}(${n}, ${a});`),e.write(`if (${o} === INVALID) return INVALID;`),o}var B$=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function U$(e,t,r,a){let n=r._zod.def.checks;if(!n||n.length===0)return a;let i=a;for(let o of n){let s=o._zod.def;if(s.when&&!B$.has(s.check))throw new se('check with a custom "when" condition');switch(s.check){case"greater_than":F$(e,t,s,i);break;case"less_than":q$(e,t,s,i);break;case"multiple_of":H$(e,t,s,i);break;case"number_format":GS(e,s,i);break;case"min_length":{let l=er(s.minimum,"min_length"),c=Bh(e,t,i,`${i}.length >= ${l} && ${i}.length < ${s.minimum*2}`);e.write(`if (${c} < ${l}) return INVALID;`);break}case"max_length":{let l=er(s.maximum,"max_length"),c=Bh(e,t,i,`${i}.length > ${l}`);e.write(`if (${c} > ${l}) return INVALID;`);break}case"length_equals":{let l=er(s.length,"length_equals"),c=Bh(e,t,i,`${i}.length >= ${l} && ${i}.length <= ${s.length*2}`);e.write(`if (${c} !== ${l}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${er(s.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${er(s.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${er(s.size,"size_equals")}) return INVALID;`);break;case"string_format":i=VS(e,t,s,i);break;case"custom":i=J$(e,t,o,i);break;case"bigint_format":G$(e,s,i);break;case"mime_type":V$(e,t,s,i);break;case"property":K$(e,t,s,i);break;case"properties":W$(e,t,s,i);break;case"overwrite":{let l=H(t);Z$(e,t,o,i,l),i=l;break}default:throw new se(`check type ${s.check}`)}}return i}function Bh(e,t,r,a){let n=V(t,jr),i=H(t);return e.write(`const ${i} = typeof ${r} === "string" && ${a} ? ${n}(${r}) : ${r}.length;`),i}function er(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new se(`${t} bound of type ${typeof e}`);return`${e}`}function HS(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new se("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new se("comparison check with Invalid Date bound");return V(e,t)}throw new se(`comparison check bound of type ${typeof t}`)}function F$(e,t,r,a){let n=r.inclusive?"<":"<=";e.write(`if (${a} ${n} ${HS(t,r.value)}) return INVALID;`)}function q$(e,t,r,a){let n=r.inclusive?">":">=";e.write(`if (${a} ${n} ${HS(t,r.value)}) return INVALID;`)}function H$(e,t,r,a){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new se("multiple_of check with a zero divisor");e.write(`if (${a} % ${r.value}n !== 0n) return INVALID;`)}else{let n=V(t,go);e.write(`if (${n}(${a}, ${er(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function GS(e,t,r){let a=t.format;switch(a){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new se(`number format ${a}`)}}function G$(e,t,r){let a=t.format;if(a)switch(a){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new se(`bigint format ${a}`)}}function V$(e,t,r,a){let n=r.mime;if(n&&n.length>0){let i=V(t,new Set(n));e.write(`if (!${i}.has(${a}.type)) return INVALID;`)}}function W$(e,t,r,a){if(r.when)throw new se('check with a custom "when" condition');e.write(`if (${a} == null) return INVALID;`);let n=r.shape;for(let i of Reflect.ownKeys(n)){let o=typeof i=="symbol"?V(t,i):lt(i),s=H(t);e.write(`const ${s} = ${a}[${o}];`),tt(e,t,n[i],s,!1)}}function K$(e,t,r,a){let n=`${a}[${JSON.stringify(r.property)}]`;$e(e,t,r.schema,n)}function Z$(e,t,r,a,n){let i=r._zod.def.tx;if(!i)throw new se("overwrite check without a transform function");if(Ur(i))throw new Vt("z.compile: async overwrite transforms are not supported");let o=V(t,i);e.write(`const ${n} = ${o}(${a});`)}function Uh(){throw new kt}function Hh(e){this.issues.push(e)}function J$(e,t,r,a){let n=r._zod.def;if(n.fn){if(Ur(n.fn))throw new Vt("z.compile: async .refine() predicates are not supported");let i=Br(t,n.fn),o=V(t,Uh),s=H(t);return e.write(`const ${s} = ${i}(${a});`),e.write(`if (${s} instanceof Promise) ${o}();`),e.write(`if (!${s}) return INVALID;`),a}if(r._zod.check){if(Ur(r._zod.check))throw new Vt("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,s=Br(t,c=>{let u={value:c,issues:[],addIssue:Hh};return i(u)instanceof Promise&&Uh(),u.issues.length===0?u.value:ut}),l=H(t);return e.write(`const ${l} = ${s}(${a});`),e.write(`if (${l} === INVALID) return INVALID;`),l}throw new se("custom check without a predicate or check function")}var Y$=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function VS(e,t,r,a,n=!0){let i=r.format;if(i==="base64"){let c=V(t,Po);return e.write(`if (!${c}(${a})) return INVALID;`),a}if(i==="base64url"){let c=V(t,Nc);return e.write(`if (!${c}(${a})) return INVALID;`),a}if(i==="jwt"){let c=V(t,qc),u=V(t,r.alg??null);return e.write(`if (!${c}(${a}, ${u})) return INVALID;`),a}if(i==="ipv6"){let c=V(t,Io);return e.write(`if (!${c}(${a})) return INVALID;`),a}if(i==="cidrv6"){let c=V(t,Rc);return e.write(`if (!${c}(${a})) return INVALID;`),a}if(i==="credit_card"){let c=V(t,Lc);return e.write(`if (!${c}(${a})) return INVALID;`),a}if(i==="iban"){let c=V(t,Uc);return e.write(`if (!${c}(${a})) return INVALID;`),a}let o=r;if(i==="url"||i==="httpurl"||o.normalize||o.hostname!==void 0||o.protocol!==void 0){let c=V(t,bc),u=V(t,r),d=H(t),m=H(t);if(e.write(`const ${d} = ${a}.trim();`),e.write(`const ${m} = ${c}(${d}, ${u});`),e.write(`if (typeof ${m} === "number") return INVALID;`),o.hostname!==void 0){let h=V(t,vc);e.write(`if (!${h}(${m}, ${u}.hostname)) return INVALID;`)}if(o.protocol!==void 0){let h=V(t,yc);e.write(`if (!${h}(${m}, ${u}.protocol)) return INVALID;`)}if(!n)return null;let p=H(t),g=o.normalize?`${m}.href`:`${V(t,zo)}(${d})`;return e.write(`const ${p} = ${g};`),p}let s=r.fn;if(s){if(Ur(s))throw new se(`async string format ${i}`);let c=V(t,s);return e.write(`if (!${c}(${a})) return INVALID;`),a}if(Y$.has(i)&&r.pattern){let c=V(t,r.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${a})) return INVALID;`),a}let l=r.format;switch(l){case"regex":throw new se("regex format without a pattern");case"lowercase":e.write(`if (${a} !== ${a}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${a} !== ${a}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${a}.includes(${lt(r.includes)})) return INVALID;`);break;case"starts_with":{let c=r.prefix;e.write(`if (${a}.slice(0, ${c.length}) !== ${lt(c)}) return INVALID;`);break}case"ends_with":{let c=r.suffix;e.write(`if (${a}.slice(-${c.length}) !== ${lt(c)}) return INVALID;`);break}default:throw new se(`string format ${l}`)}return a}function $e(e,t,r,a,n=!0){let i=r._zod.def,o=i.type;if(i.coerce)throw new se(`coercion (z.coerce.${o}())`);let s=n||!!i.checks?.length,l;switch(o){case"string":l=X$(e,t,r,a,s);break;case"number":l=Q$(e,r,a);break;case"boolean":l=e2(e,a);break;case"bigint":l=t2(e,r,a);break;case"symbol":l=n2(e,a);break;case"undefined":l=r2(e,a);break;case"null":l=a2(e,a);break;case"any":case"unknown":l=a;break;case"never":e.write("return INVALID;"),l=a;break;case"void":l=i2(e,a);break;case"nan":l=o2(e,a);break;case"date":l=s2(e,a);break;case"object":l=l2(e,t,r,a,s);break;case"optional":l=c2(e,t,r,a,s);break;case"nullable":l=p2(e,t,r,a,s);break;case"array":l=m2(e,t,r,a,s);break;case"literal":l=g2(e,t,r,a);break;case"enum":l=h2(e,t,r,a);break;case"readonly":{let c=US(e,t,r,a),u=H(t);e.write(`const ${u} = Object.freeze(${c});`),l=u;break}case"success":US(e,t,r,a),l="true";break;case"default":case"prefault":l=f2(e,t,r,a);break;case"nonoptional":l=b2(e,t,r,a);break;case"tuple":l=v2(e,t,r,a);break;case"union":l=y2(e,t,r,a);break;case"intersection":l=w2(e,t,r,a);break;case"record":l=S2(e,t,r,a);break;case"map":l=x2(e,t,r,a);break;case"set":l=T2(e,t,r,a);break;case"file":l=A2(e,a);break;case"template_literal":l=C2(e,t,r,a);break;case"lazy":l=z2(e,t,r,a);break;case"pipe":l=I2(e,t,r,a);break;case"custom":l=P2(e,t,r,a);break;case"transform":l=j2(e,t,r,a);break;case"catch":l=$2(e,t,r,a);break;default:throw new se(`schema type ${o}`)}return l===null?null:U$(e,t,r,l)}function X$(e,t,r,a,n=!0){e.write(`if (typeof ${a} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?a:VS(e,t,i,a,n)}function Q$(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let a=t._zod.def;return a.check==="number_format"&&a.format&&GS(e,{format:a.format},r),r}function e2(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function t2(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let a=t._zod.def;if(a.format)switch(a.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function n2(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function r2(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function a2(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function i2(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function o2(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function s2(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function l2(e,t,r,a,n=!0){let i=r._zod.def;e.write(`if (typeof ${a} !== "object" || ${a} === null || Array.isArray(${a})) return INVALID;`);let o=i.shape,s=Object.keys(o),l=Object.getOwnPropertySymbols(o),c=l.length?[...s,...l]:s,u=b=>typeof b=="symbol"?V(t,b):lt(b),d=b=>typeof b=="symbol"?`[${u(b)}]`:lt(b),m=o;if(s.includes("__proto__"))throw new se('object shape key "__proto__"');let p=new Map;for(let b of c){let v=m[b],C=u(b),S=H(t);if(e.write(`const ${S} = ${a}[${C}];`),v._zod.optin!==void 0){let P=H(t);e.write(`let ${P} = (() => {`),e.indented(U=>{let qe=tt(U,t,v,S);U.write(`return ${qe};`)}),e.write("})();"),v._zod.optout==="optional"?(e.write(`if (${P} === INVALID) {`),e.indented(U=>{U.write(`if (${C} in ${a}) return INVALID;`),U.write(`${P} = undefined;`)}),e.write("}")):e.write(`if (${P} === INVALID) return INVALID;`),p.set(b,P)}else{d2(v)&&e.write(`if (!(${C} in ${a})) return INVALID;`);let P=tt(e,t,v,S,n);P!==null&&p.set(b,P)}}let g=i.catchall,h="none";if(g){let b=g._zod.def.type;if(b==="never"){let v=s.map(C=>`k !== ${lt(C)}`).join(" && ")||"true";e.write(`for (const k in ${a}) {`),e.indented(C=>{C.write(`if (${v}) return INVALID;`)}),e.write("}")}else(b==="unknown"||b==="any")&&!g._zod.def.checks?.length?h="passthrough":h="schema"}let f=H(t),k=c.some(b=>BS(m[b])||Fh(m[b]));if(!n){if(h==="schema"){let b=s.length>0?V(t,new Set(s)):null;e.write(`for (const k in ${a}) {`),e.indented(v=>{v.write('if (k === "__proto__") continue;'),b&&v.write(`if (${b}.has(k)) continue;`);let C=H(t);v.write(`const ${C} = ${a}[k];`),tt(v,t,g,C,!1)}),e.write("}")}return null}if(k){e.write(`const ${f} = {};`);for(let b of c){let v=u(b),C=p.get(b);Fh(m[b])?e.write(`if (${v} in ${a}) ${f}[${v}] = ${C};`):BS(m[b])?e.write(`if (${C} !== undefined || ${v} in ${a}) ${f}[${v}] = ${C};`):e.write(`${f}[${v}] = ${C};`)}}else{let b=c.map(v=>`${d(v)}: ${p.get(v)}`).join(", ");e.write(`const ${f} = { ${b} };`)}if(h!=="none"){let b=s.length>0?V(t,new Set(s)):null;e.write(`for (const k in ${a}) {`),e.indented(v=>{if(v.write('if (k === "__proto__") continue;'),b&&v.write(`if (${b}.has(k)) continue;`),h==="passthrough")v.write(`${f}[k] = ${a}[k];`);else{let C=H(t);v.write(`const ${C} = ${a}[k];`);let S=tt(v,t,g,C);v.write(`${f}[k] = ${S};`)}}),e.write("}")}return f}function c2(e,t,r,a,n=!0){let i=r._zod.def;if(u2(r))return $e(e,t,i.innerType,a,n);if(i.innerType._zod.optin==="defaulted"){let s=H(t),l=H(t);return e.write(`let ${s};`),e.write(`if (${a} === undefined) {`),e.indented(c=>{c.write(`const ${l} = (() => {`),c.indented(u=>{let d=$e(u,t,i.innerType,a);u.write(`return ${d};`)}),c.write("})();"),c.write(`if (${l} !== INVALID) ${s} = ${l};`)}),e.write("} else {"),e.indented(c=>{let u=$e(c,t,i.innerType,a);c.write(`${s} = ${u};`)}),e.write("}"),s}let o=n?H(t):null;return o&&e.write(`let ${o};`),e.write(`if (${a} !== undefined) {`),e.indented(s=>{let l=$e(s,t,i.innerType,a,n);o&&l!==null&&s.write(`${o} = ${l};`)}),e.write("}"),o}function u2(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function d2(e){return e._zod.optin===void 0&&Lr(e)}function Lr(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Lr(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Lr(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Lr):!0;case"intersection":return!t.left||!t.right?!0:Lr(t.left)&&Lr(t.right);case"pipe":return t.in?Lr(t.in):!0;default:return!0}}function Fh(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function BS(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Ha(e)}function Ha(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?Ha(t.innerType):!0;case"union":return t.options?t.options.some(Ha):!0;case"intersection":return!t.left||!t.right||Ha(t.left)||Ha(t.right);case"pipe":return t.out?Ha(t.out):!0;default:return!0}}function p2(e,t,r,a,n=!0){let i=r._zod.def,o=n?H(t):null;return o&&e.write(`let ${o} = null;`),e.write(`if (${a} !== null) {`),e.indented(s=>{let l=$e(s,t,i.innerType,a,n);o&&l!==null&&s.write(`${o} = ${l};`)}),e.write("}"),o}function Gh(e,t,r){for(let[a,n]of xa(t._zod.def.checks))e.write(`if (${r} > ${er(a,n._zod.def.check)}) return INVALID;`)}function m2(e,t,r,a,n=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${a})) return INVALID;`),Gh(e,r,`${a}.length`);let o=n?H(t):null,s=H(t),l=H(t);return o&&e.write(`const ${o} = new Array(${a}.length);`),e.write(`for (let ${s} = 0; ${s} < ${a}.length; ${s}++) {`),e.indented(c=>{c.write(`const ${l} = ${a}[${s}];`);let u=tt(c,t,i.element,l,n);o&&u!==null&&c.write(`${o}[${s}] = ${u};`)}),e.write("}"),o}function g2(e,t,r,a){let i=r._zod.def.values;if(i.length!==1){let s=V(t,new Set(i));return e.write(`if (!${s}.has(${a})) return INVALID;`),a}let o=i[0];if(typeof o=="number"&&Number.isNaN(o)){let s=V(t,new Set(i));return e.write(`if (!${s}.has(${a})) return INVALID;`),a}if(typeof o=="string")e.write(`if (${a} !== ${lt(o)}) return INVALID;`);else if(typeof o=="number"||typeof o=="boolean")e.write(`if (${a} !== ${o}) return INVALID;`);else if(o===null)e.write(`if (${a} !== null) return INVALID;`);else if(o===void 0)e.write(`if (${a} !== undefined) return INVALID;`);else if(typeof o=="bigint")e.write(`if (${a} !== ${o}n) return INVALID;`);else throw new se(`literal type ${typeof o}`);return a}function h2(e,t,r,a){let n=r._zod.values;if(!n)throw new se("enum schema without enumerated values");let i=V(t,n);return e.write(`if (!${i}.has(${a})) return INVALID;`),a}function US(e,t,r,a){let n=r._zod.def;return $e(e,t,n.innerType,a)}function f2(e,t,r,a){let n=r._zod.def,o=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!o)return $e(e,t,n.innerType,a);let l=V(t,o),c=H(t);return e.write(`let ${c} = ${a};`),e.write(`if (${a} === undefined) ${c} = ${l}();`),$e(e,t,n.innerType,c)}let s=H(t);if(o){let l=V(t,o),c=V(t,Ea);e.write(`let ${s};`),e.write(`if (${a} === undefined) {`),e.indented(u=>{u.write(`${s} = ${c}(${l}());`)}),e.write("} else {"),e.indented(u=>{let d=$e(u,t,n.innerType,a);u.write(`${s} = ${d} === undefined ? ${c}(${l}()) : ${d};`)}),e.write("}")}else e.write(`let ${s};`),e.write(`if (${a} !== undefined) {`),e.indented(l=>{let c=$e(l,t,n.innerType,a);l.write(`${s} = ${c};`)}),e.write("}");return s}function b2(e,t,r,a){let n=r._zod.def,i=$e(e,t,n.innerType,a),o=H(t);return e.write(`const ${o} = ${i};`),e.write(`if (${o} === undefined) return INVALID;`),o}function v2(e,t,r,a){let n=r._zod.def,i=n.items,o=n.rest;e.write(`if (!Array.isArray(${a})) return INVALID;`);let s=FS(i,"optin"),l=FS(i,"optout");o?e.write(`if (${a}.length < ${s}) return INVALID;`):e.write(`if (${a}.length < ${s} || ${a}.length > ${i.length}) return INVALID;`);let c=H(t);e.write(`const ${c} = [];`);for(let u=0;u<i.length;u++){let d=i[u];if(u>=l)e.write(`if (${c}.length === ${u}) {`),e.indented(m=>{m.write(`if (${u} < ${a}.length) {`),m.indented(p=>{let g=H(t);p.write(`const ${g} = ${a}[${u}];`);let h=tt(p,t,d,g);p.write(`${c}[${u}] = ${h};`)}),m.write("} else {"),m.indented(p=>{if(Fh(d)){p.write(`${c}.length = ${u};`);return}let g=H(t),h=H(t);p.write(`const ${g} = undefined;`),p.write(`const ${h} = (() => {`),p.indented(f=>{let k=tt(f,t,d,g);f.write(`return ${k};`)}),p.write("})();"),p.write(`if (${h} === INVALID || ${h} === undefined) ${c}.length = ${u};`),p.write(`else ${c}[${u}] = ${h};`)}),m.write("}")}),e.write("}");else{let m=H(t);e.write(`const ${m} = ${a}[${u}];`);let p=tt(e,t,d,m);e.write(`${c}[${u}] = ${p};`)}}if(o){let u=H(t),d=H(t);e.write(`for (let ${u} = ${i.length}; ${u} < ${a}.length; ${u}++) {`),e.indented(m=>{m.write(`const ${d} = ${a}[${u}];`);let p=tt(m,t,o,d);m.write(`${c}[${u}] = ${p};`)}),e.write("}")}return c}function FS(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function y2(e,t,r,a){let n=r._zod.def,i=n.options;if(n.discriminator)return k2(e,t,n,a);if(n.inclusive===!1)throw new se("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),a;if(i.length===1)return $e(e,t,i[0],a);if(i.every(l=>l._zod.def.type==="literal"&&!l._zod.def.checks?.length)){let l=new Set(i.flatMap(u=>u._zod.def.values)),c=V(t,l);return e.write(`if (!${c}.has(${a})) return INVALID;`),a}let s=H(t);e.write(`let ${s};`);for(let l=0;l<i.length;l++){let c=i[l];l===0?e.write(`${s} = (() => {`):e.write(`if (${s} === INVALID) ${s} = (() => {`),e.indented(u=>{let d=$e(u,t,c,a);u.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${s} === INVALID) return INVALID;`),s}function k2(e,t,r,a){if(r.unionFallback)throw new se("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),a;let n=H(t),i=H(t);e.write(`const ${n} = ${a}?.[${lt(r.discriminator)}];`),e.write(`let ${i};`);let o=!0,s=new Set;for(let l of r.options){let c=l._zod.propValues?.[r.discriminator];if(!c||c.size===0)throw new se("discriminated union option without static discriminator values");for(let m of c){if(s.has(m))throw new se(`duplicate discriminator value ${String(m)}`);s.add(m)}let u=Array.from(c,m=>_2(t,n,m)),d=o?"if":"else if";e.write(`${d} (${u.join(" || ")}) {`),e.indented(m=>{let p=$e(m,t,l,a);m.write(`${i} = ${p};`)}),e.write("}"),o=!1}return e.write("else { return INVALID; }"),i}function _2(e,t,r){if(typeof r=="string")return`${t} === ${lt(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let a=V(e,r);return`${t} === ${a}`}throw new se(`literal discriminator value ${String(r)}`)}function w2(e,t,r,a){let n=r._zod.def;t.definite=!1;let i=tt(e,t,n.left,a),o=tt(e,t,n.right,a),s=V(t,Na),l=H(t);return e.write(`const ${l} = ${s}(${i}, ${o});`),e.write(`if (!${l}.valid) return INVALID;`),`${l}.data`}function S2(e,t,r,a){let n=r._zod.def,i=V(t,Dt);e.write(`if (!${i}(${a})) return INVALID;`);let o=H(t),s=H(t),l=H(t);e.write(`const ${o} = {};`);let c=n,u=c.partial?void 0:n.keyType._zod.values;if(u){let p=[];for(let h of u){if(!(typeof h=="string"||typeof h=="number"||typeof h=="symbol"))throw new se(`record key value ${String(h)}`);let f=typeof h=="number"?h.toString():h;if(f==="__proto__")throw new se('record key "__proto__"');p.push(f);let k=V(t,h),b=$e(e,t,n.keyType,k),v=H(t);e.write(`const ${v} = ${a}[${E2(t,f)}];`);let C=tt(e,t,n.valueType,v);e.write(`${o}[${b}] = ${C};`)}let g=V(t,new Set(p));return e.write(`for (const ${s} in ${a}) {`),e.indented(h=>{h.write(`if (${g}.has(${s})) continue;`),c.mode==="loose"?h.write(`if (${s} !== "__proto__") ${o}[${s}] = ${a}[${s}];`):h.write("return INVALID;")}),e.write("}"),o}let d=n.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let p=n.mode==="loose",g=Lu(n.keyType);g.definite===!1&&(t.definite=!1);let h=V(t,g),f=V(t,An),k=H(t);return qS(e,t,a,s,b=>{b.write(`let ${k} = ${h}(${s});`),b.write(`if (${k} === INVALID && typeof ${s} === "string" && ${f}.test(${s})) ${k} = ${h}(Number(${s}));`),p?b.write(`if (${k} === INVALID) { ${o}[${s}] = ${a}[${s}]; continue; }`):b.write(`if (${k} === INVALID) return INVALID;`),b.write(`if (${k} === "__proto__") continue;`);let v=H(t);b.write(`const ${v} = ${a}[${s}];`);let C=tt(b,t,n.valueType,v);b.write(`${o}[${k}] = ${C};`)}),o}return qS(e,t,a,s,p=>{p.write(`const ${l} = ${a}[${s}];`);let g=tt(p,t,n.valueType,l);p.write(`${o}[${s}] = ${g};`)},"return INVALID;"),o}function qS(e,t,r,a,n,i){let o=V(t,Object.prototype.propertyIsEnumerable),s=H(t),l=H(t),c=H(t);e.write(`const ${s} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${l} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${c} = 0; ${c} < ${l}.length; ${c}++) {`),e.indented(u=>{u.write(`const ${a} = ${l}[${c}];`),u.write(`if (${a} === "__proto__" || !${o}.call(${r}, ${a})) continue;`),n(u)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${s}.length; ${c}++) {`),e.indented(u=>{u.write(`const ${a} = ${s}[${c}];`),u.write(`if (!${o}.call(${r}, ${a})) continue;`),i?u.write(i):n(u)}),e.write("}")}function E2(e,t){return typeof t=="string"?lt(t):V(e,t)}function x2(e,t,r,a){let n=r._zod.def;e.write(`if (!(${a} instanceof Map)) return INVALID;`),Gh(e,r,`${a}.size`);let i=H(t),o=H(t),s=H(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${o}, ${s}] of ${a}) {`),e.indented(l=>{let c=$e(l,t,n.keyType,o),u=$e(l,t,n.valueType,s);l.write(`${i}.set(${c}, ${u});`)}),e.write("}"),i}function T2(e,t,r,a){let n=r._zod.def;e.write(`if (!(${a} instanceof Set)) return INVALID;`),Gh(e,r,`${a}.size`);let i=H(t),o=H(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${o} of ${a}) {`),e.indented(s=>{let l=$e(s,t,n.valueType,o);s.write(`${i}.add(${l});`)}),e.write("}"),i}function A2(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function C2(e,t,r,a){e.write(`if (typeof ${a} !== "string") return INVALID;`);let n=r._zod.pattern;if(n){let i=V(t,n);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${a})) return INVALID;`)}return a}function z2(e,t,r,a){let n=r._zod.def,i=Br(t,n.getter),o=V(t,{parser:null});e.write(`if (!${o}.parser) {`),e.indented(l=>{l.write(`const inner = ${i}();`),l.write(`${o}.parser = function(input) {`),l.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),l.write("};")}),e.write("}");let s=H(t);return e.write(`const ${s} = ${o}.parser(${a});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function I2(e,t,r,a){let n=r._zod.def,i=$e(e,t,n.in,a);if(n.transform){if(Ur(n.transform))throw new Vt("z.compile: async transforms in pipes are not supported");let o=n.transform,l=Br(t,u=>{let d={value:u,issues:[],addIssue:Hh},m=o(u,d);return m instanceof Promise?ut:d.issues.length===0?m:ut}),c=H(t);return e.write(`const ${c} = ${l}(${i});`),e.write(`if (${c} === INVALID) return INVALID;`),$e(e,t,n.out,c)}else return $e(e,t,n.out,i)}function Ur(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function P2(e,t,r,a){let n=r._zod.def;if(n.fn){if(Ur(n.fn))throw new Vt("z.compile: async custom predicates are not supported");let i=Br(t,n.fn),o=V(t,Uh),s=H(t);e.write(`const ${s} = ${i}(${a});`),e.write(`if (${s} instanceof Promise) ${o}();`),e.write(`if (!${s}) return INVALID;`)}else throw new se("custom schema without a predicate function");return a}function R2(e,t,r){let a=e._zod.run({value:r,issues:[]},{});if(a&&typeof a.then=="function")return ut;let n=a;return n.issues.length===0?n.value:t()}function $2(e,t,r,a){let n=r._zod.def;if(!n.catchValue[Wl])throw new se("catch with a callback (only a constant catch value compiles)",!1);let i=H(t);e.write(`let ${i} = (() => {`),e.indented(c=>{let u=tt(c,t,n.innerType,a);c.write(`return ${u};`)}),e.write("})();");let o=V(t,n.innerType),s=Br(t,n.catchValue),l=V(t,R2);return e.write(`if (${i} === INVALID) {`),e.indented(c=>{c.write(`${i} = ${l}(${o}, ${s}, ${a});`),c.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function j2(e,t,r,a){let n=r._zod.def;if(n.transform){if(Ur(n.transform))throw new Vt("z.compile: async transforms are not supported");let i=n.transform,s=Br(t,c=>{let u={value:c,issues:[],addIssue:Hh},d=i(c,u);return d instanceof Promise?ut:u.issues.length===0?d:ut}),l=H(t);return e.write(`const ${l} = ${s}(${a});`),e.write(`if (${l} === INVALID) return INVALID;`),l}return a}function Bu(e){return e.checks&&(e.checks=[...e.checks]),e}function Uu(e,t){return new e(Bu({type:"string",...z(t)}))}function Vh(e,t){return new e(Bu({type:"string",coerce:!0,...z(t)}))}function Fo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function qo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function Ho(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function Go(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function Vo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function Wo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function Ga(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Ko(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function Zo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function Jo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function Yo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function Xo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function Qo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function es(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function ts(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function ns(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Fu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...z(t)})}function rs(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function as(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function is(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function os(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function ss(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function qu(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...z(t)})}function Hu(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...z(t)})}function ls(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}var Wh={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function cs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function us(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}function ds(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function ps(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}function Gu(e,t){return new e(Bu({type:"number",checks:[],...z(t)}))}function Kh(e,t){return new e(Bu({type:"number",coerce:!0,checks:[],...z(t)}))}function Vu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function Wu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...z(t)})}function Ku(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...z(t)})}function Zu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...z(t)})}function Ju(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...z(t)})}function Yu(e,t){return new e({type:"boolean",...z(t)})}function Zh(e,t){return new e({type:"boolean",coerce:!0,...z(t)})}function Xu(e,t){return new e({type:"bigint",...z(t)})}function Jh(e,t){return new e({type:"bigint",coerce:!0,...z(t)})}function Qu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...z(t)})}function ed(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...z(t)})}function td(e,t){return new e({type:"symbol",...z(t)})}function nd(e,t){return new e({type:"undefined",...z(t)})}function rd(e,t){return new e({type:"null",...z(t)})}function ad(e){return new e({type:"any"})}function id(e){return new e({type:"unknown"})}function od(e,t){return new e({type:"never",...z(t)})}function sd(e,t){return new e({type:"void",...z(t)})}function ld(e,t){return new e({type:"date",...z(t)})}function Yh(e,t){return new e({type:"date",coerce:!0,...z(t)})}function cd(e,t){return new e({type:"nan",...z(t)})}function ln(e,t){return new sc({check:"less_than",...z(t),value:e,inclusive:!1})}function zt(e,t){return new sc({check:"less_than",...z(t),value:e,inclusive:!0})}function cn(e,t){return new lc({check:"greater_than",...z(t),value:e,inclusive:!1})}function It(e,t){return new lc({check:"greater_than",...z(t),value:e,inclusive:!0})}function ud(e){return cn(0,e)}function dd(e){return ln(0,e)}function pd(e){return zt(0,e)}function md(e){return It(0,e)}function tr(e,t){return new ih({check:"multiple_of",...z(t),value:e})}function nr(e,t){return new lh({check:"max_size",...z(t),maximum:e})}function un(e,t){return new ch({check:"min_size",...z(t),minimum:e})}function Fr(e,t){return new uh({check:"size_equals",...z(t),size:e})}function qr(e,t){return new dh({check:"max_length",...z(t),maximum:e})}function Cn(e,t){return new ph({check:"min_length",...z(t),minimum:e})}function Hr(e,t){return new mh({check:"length_equals",...z(t),length:e})}function Va(e,t){return new gh({check:"string_format",format:"regex",...z(t),pattern:e})}function Wa(e){return new hh({check:"string_format",format:"lowercase",...z(e)})}function Ka(e){return new fh({check:"string_format",format:"uppercase",...z(e)})}function Za(e,t){return new bh({check:"string_format",format:"includes",...z(t),includes:e})}function Ja(e,t){return new vh({check:"string_format",format:"starts_with",...z(t),prefix:e})}function Ya(e,t){return new yh({check:"string_format",format:"ends_with",...z(t),suffix:e})}function gd(e,t,r){return new kh({check:"property",property:e,schema:t,...z(r)})}function Xa(e,t){return new _h({check:"properties",shape:e,...z(t)})}function Qa(e,t){return new wh({check:"mime_type",mime:e,...z(t)})}function Wt(e){return new Sh({check:"overwrite",tx:e})}function ei(e){return Wt(t=>t.normalize(e))}function ti(){return Wt(e=>e.trim())}function ni(){return Wt(e=>e.toLowerCase())}function ri(){return Wt(e=>e.toUpperCase())}function ai(){return Wt(e=>og(e))}function Xh(e,t,r){return new e({type:"array",element:t,...z(r)})}function O2(e,t,r){return new e({type:"union",options:t,...z(r)})}function N2(e,t,r){return new e({type:"union",options:t,inclusive:!1,...z(r)})}function D2(e,t,r,a){return new e({type:"union",options:r,discriminator:t,...z(a)})}function M2(e,t,r){return new e({type:"intersection",left:t,right:r})}function L2(e,t,r,a){let n=r instanceof Z,i=n?a:r,o=n?r:null;return new e({type:"tuple",items:t,rest:o,...z(i)})}function B2(e,t,r,a){return new e({type:"record",keyType:t,valueType:r,...z(a)})}function U2(e,t,r,a){return new e({type:"map",keyType:t,valueType:r,...z(a)})}function F2(e,t,r){return new e({type:"set",valueType:t,...z(r)})}function q2(e,t,r){let a=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:a,...z(r)})}function H2(e,t,r){return new e({type:"enum",entries:t,...z(r)})}function G2(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...z(r)})}function hd(e,t){return new e({type:"file",...z(t)})}function V2(e,t){return new e({type:"transform",transform:t})}function W2(e,t){return new e({type:"optional",innerType:t})}function K2(e,t){return new e({type:"nullable",innerType:t})}function Z2(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Ea(r)}})}function J2(e,t,r){return new e({type:"nonoptional",innerType:t,...z(r)})}function Y2(e,t){return new e({type:"success",innerType:t})}function X2(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:mg(r)})}function Q2(e,t,r){return new e({type:"pipe",in:t,out:r})}function e0(e,t){return new e({type:"readonly",innerType:t})}function t0(e,t,r){return new e({type:"template_literal",parts:t,...z(r)})}function n0(e,t){return new e({type:"lazy",getter:t})}function r0(e,t){return new e({type:"promise",innerType:t})}function fd(e,t,r){let a=z(r);return a.abort??(a.abort=!0),new e({type:"custom",check:"custom",fn:t,...a})}function bd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...z(r)})}function vd(e,t){let r=WS(a=>(a.addIssue=n=>{if(typeof n=="string")a.issues.push(Ta(n,a.value,r._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=a.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),a.issues.push(Ta(i))}},e(a.value,a)),t);return r}function WS(e,t){let r=new _e({check:"custom",...z(t)});return r._zod.check=e,r}function yd(e){let t=new _e({check:"describe"});return t._zod.onattach=[r=>{let a=Ve.get(r)??{};Ve.add(r,{...a,description:e})}],t._zod.check=()=>{},t}function kd(e){let t=new _e({check:"meta"});return t._zod.onattach=[r=>{let a=Ve.get(r)??{};Ve.add(r,{...a,...e})}],t._zod.check=()=>{},t}function _d(e,t){let r=z(t),a=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(a=a.map(p=>typeof p=="string"?p.toLowerCase():p),n=n.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(a),o=new Set(n),s=e.Codec??La,l=e.Boolean??Da,c=e.String??Qn,u=new c({type:"string",error:r.error}),d=new l({type:"boolean",error:r.error}),m=new s({type:"pipe",in:u,out:d,transform:((p,g)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:o.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...o],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((p,g)=>p===!0?a[0]||"true":n[0]||"false"),error:r.error});return m._zod.bag.truthy=a,m._zod.bag.falsy=n,m._zod.bag.case=r.case??"insensitive",m}function rr(e,t,r,a={}){let n=z(a),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}function ms(e,...t){for(let r of t)for(let a of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,a)&&Ge(e,a,r[a]);return e}function ar(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??Ve,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Be(e,t,r,a,n){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:a.path,message:n}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(n);return Object.assign(r,i),!0}function ve(e,t,r={path:[],schemaPath:[]}){var a;let n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let o={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,u);else{let m=o.schema,p=t.processors[n.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);p(e,t,m,u)}let d=e._zod.parent;d&&(o.ref||(o.ref=d),ve(d,t,u),t.seen.get(d).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&ms(o.schema,l),t.io==="input"&&dt(e)&&(delete o.schema.examples,delete o.schema.default),t.io==="input"&&"_prefault"in o.schema&&((a=o.schema).default??(a.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function KS(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ir(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let a=new Map;for(let o of e.seen.entries()){let s=e.metadataRegistry.get(o[0])?.id;if(s){let l=a.get(s);if(l&&l!==o[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(s,o[0])}}let n=o=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(o[0])?.id,m=e.external.uri??(g=>g);if(d)return{ref:m(d)};let p=o[1].defId??o[1].schema.id??`schema${e.counter++}`;return o[1].defId=p,{defId:p,ref:`${m("__shared")}#/${s}/${KS(p)}`}}let l="#",c=`${l}/${s}/`;if(o[1]===r&&!o[1].schema.id)return{ref:l};let u=o[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:c+KS(u)}},i=o=>{if(o[1].schema.$ref)return;let s=o[1],{ref:l,defId:c}=n(o);s.def={...s.schema},c&&(s.defId=c);let u=s.schema;for(let d in u)delete u[d];u.$ref=l};if(e.cycles==="throw")for(let o of e.seen.entries()){let s=o[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
69
69
|
|
|
70
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let s=o[1];if(t===o[0]){i(o);continue}if(e.external){let c=e.external.registry.get(o[0])?.id;if(t!==o[0]&&c){i(o);continue}}if(e.metadataRegistry.get(o[0])?.id){i(o);continue}if(s.cycle){i(o);continue}s.count>1&&e.reused==="ref"&&i(o)}e.external&&(e.sharedDefsExtractedFor=e.external)}function YS(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let a of t){if(!a||typeof a!="object")return;YS(a);let n=Object.keys(a);if(n.length!==1||n[0]!=="type")return;let i=a.type;for(let o of Array.isArray(i)?i:[i]){if(typeof o!="string")return;r.includes(o)||r.push(o)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var XS=new Set(["type","properties","required","additionalProperties"]),ZS=["oneOf","anyOf"];function JS(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Qh(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let o in i)if(!XS.has(o))return null;t.push(i)}let r={},a=new Set;for(let i of t){for(let o in i.properties){if(Object.prototype.hasOwnProperty.call(r,o))continue;let s=[];for(let c of t){let u=c.properties?.[o]??JS(c);u!=null&&(s.some(d=>JSON.stringify(d)===JSON.stringify(u))||s.push(u))}let l=s.length===1?s[0]:Qh(s)??{allOf:s};Ge(r,o,l)}for(let o of i.required??[])a.add(o)}let n={type:"object",properties:r};if(a.size&&(n.required=[...a]),t.every(i=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let o of t){let s=JS(o);s&&!i.some(l=>JSON.stringify(l)===JSON.stringify(s))&&i.push(s)}i.length===1?n.additionalProperties=i[0]:i.length>1&&(n.additionalProperties={allOf:i})}return n}function a0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of XS)if(n in e)return;let r=t.filter(n=>ZS.some(i=>Array.isArray(n[i]))),a=null;if(!r.length)a=Qh(t);else{let n=r[0],i=ZS.find(l=>Array.isArray(n[l]));if(Object.keys(n).length!==1)return;let o=t.filter(l=>l!==n),s=n[i].map(l=>Qh([...o,l]));if(s.some(l=>!l))return;a={[i]:s}}a&&(delete e.allOf,ms(e,a))}function or(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let a=s=>{let l=e.seen.get(s);if(l.ref===null)return;let c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){a(d);let p=e.seen.get(d),g=p.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(g)):ms(c,g),ms(c,u),s._zod.parent===d)for(let f in c)f==="$ref"||f==="allOf"||f in u||delete c[f];if(g.$ref&&p.def)for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}let m=s._zod.parent;if(m&&m!==d){a(m);let p=e.seen.get(m);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let g in c)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(c[g])===JSON.stringify(p.def[g])&&delete c[g]}e.override({zodSchema:s,jsonSchema:c,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())a(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())YS(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let c of[l.schema,l.def]){let u=c?.allOf;if(!Array.isArray(u))continue;let d=s.get(u);d?d.push(c):s.set(u,[c])}for(let l of e.intersections)for(let c of s.get(l)??[])a0(c)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}ms(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,Ge(o,l.defId,l.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?n.$defs=o:n.definitions=o);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:ii(t,"input",e.processors),output:ii(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function dt(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return dt(a.element,r);if(a.type==="set")return dt(a.valueType,r);if(a.type==="lazy")return dt(a.getter(),r);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault"||a.type==="catch")return dt(a.innerType,r);if(a.type==="intersection")return dt(a.left,r)||dt(a.right,r);if(a.type==="record"||a.type==="map")return dt(a.keyType,r)||dt(a.valueType,r);if(a.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:dt(a.in,r)||dt(a.out,r);if(a.type==="object"){for(let n in a.shape)if(dt(a.shape[n],r))return!0;return!1}if(a.type==="union"){for(let n of a.options)if(dt(n,r))return!0;return!1}if(a.type==="tuple"){for(let n of a.items)if(dt(n,r))return!0;return!!(a.rest&&dt(a.rest,r))}return!1}var ef=(e,t={})=>r=>{let a=ar({...r,processors:t});return ve(e,a),ir(a,e),or(a,e)},ii=(e,t,r={})=>a=>{let{libraryOptions:n,target:i}=a??{},o=ar({...n??{},target:i,io:t,processors:r});return ve(e,o),ir(o,e),or(o,e)};var oi=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},si=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},QS=(e,t)=>{oi(e,"minimum",t),si(e,"maximum",t)},rE=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},aE=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},iE=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},oE=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},eE=(e,t)=>oi(e,"minimum",t.minimum),tE=(e,t)=>si(e,"maximum",t.maximum),nE=e=>(t,r)=>{oE(t,r.format);let[a,n]=e[r.format];oi(t,"minimum",a),si(t,"maximum",n)},i0={greater_than:(e,t)=>oi(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>si(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>rE(e,t.value),number_format:nE(fo),bigint_format:nE(bo),min_length:eE,max_length:tE,length_equals:(e,t)=>QS(e,t.length),min_size:eE,max_size:tE,size_equals:(e,t)=>QS(e,t.size),string_format:(e,t)=>{oE(e,t.format),t.pattern&&aE(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>iE(e,t.mime)};function Ue(e){let t={},r=e._zod.def,a=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of a)i0[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;n.minimum!==void 0&&oi(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&oi(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&si(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&si(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&rE(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&iE(t,n.mime);for(let i of n.patterns??[])aE(t,i);return t}var o0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s0=new Map([[jc,Lg],[Ro,Bg]]),sE=e=>s0.get(e)??e,rf=(e,t,r,a)=>{let n=r;n.type="string";let{minimum:i,maximum:o,format:s,patterns:l,contentEncoding:c,laxFormat:u}=Ue(e);if(typeof i=="number"&&(n.minLength=i),typeof o=="number"&&(n.maxLength=o),s&&(n.format=o0[s]??s,n.format===""&&delete n.format,(s==="time"||u)&&delete n.format),c&&(n.contentEncoding=c),l&&l.size>0){let d=[...l].map(sE);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},af=(e,t,r,a)=>{let n=r,{minimum:i,maximum:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=Ue(e);n.type=u?"integer":"number";let d=typeof c=="number"&&c>=(i??Number.NEGATIVE_INFINITY),m=typeof l=="number"&&l<=(o??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d?p?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:typeof i=="number"&&(n.minimum=i),m?p?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l:typeof o=="number"&&(n.maximum=o),s){let g=new Set;for(let k of s)Number.isFinite(k)&&k!==0?g.add(Math.abs(k)):Be(e,t,n,a,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);let[h,...f]=g;h!==void 0&&(n.multipleOf=h),f.length&&(n.allOf=[...n.allOf??[],...f.map(k=>({multipleOf:k}))])}},of=(e,t,r,a)=>{r.type="boolean"},sf=(e,t,r,a)=>{Be(e,t,r,a,"BigInt cannot be represented in JSON Schema")},lf=(e,t,r,a)=>{Be(e,t,r,a,"Symbols cannot be represented in JSON Schema")},cf=(e,t,r,a)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},uf=(e,t,r,a)=>{Be(e,t,r,a,"Undefined cannot be represented in JSON Schema")},df=(e,t,r,a)=>{Be(e,t,r,a,"Void cannot be represented in JSON Schema")},pf=(e,t,r,a)=>{r.not={}},mf=(e,t,r,a)=>{},gf=(e,t,r,a)=>{},hf=(e,t,r,a)=>{Be(e,t,r,a,"Date cannot be represented in JSON Schema")},ff=(e,t,r,a)=>{let n=e._zod.def,i=ka(n.entries);if(i.length===0){r.not={};return}i.every(o=>typeof o=="number")&&(r.type="number"),i.every(o=>typeof o=="string")&&(r.type="string"),r.enum=i},bf=(e,t,r,a)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let o of n.values)if(o===void 0){if(Be(e,t,r,a,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(Be(e,t,r,a,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){let o=i[0];r.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[o]:r.const=o}else i.every(o=>typeof o=="number")&&(r.type="number"),i.every(o=>typeof o=="string")&&(r.type="string"),i.every(o=>typeof o=="boolean")&&(r.type="boolean"),i.every(o=>o===null)&&(r.type="null"),r.enum=i},vf=(e,t,r,a)=>{Be(e,t,r,a,"NaN cannot be represented in JSON Schema")},yf=(e,t,r,a)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},kf=(e,t,r,a)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:o,mime:s}=Ue(e);i!==void 0&&(n.minLength=i),o!==void 0&&(n.maxLength=o),s&&(s.length===0?n.not={}:s.length===1?n.contentMediaType=s[0]:n.anyOf=s.map(l=>({contentMediaType:l})))},_f=(e,t,r,a)=>{r.type="boolean"},wf=(e,t,r,a)=>{Be(e,t,r,a,"Custom types cannot be represented in JSON Schema")},Sf=(e,t,r,a)=>{Be(e,t,r,a,"Function types cannot be represented in JSON Schema")},Ef=(e,t,r,a)=>{Be(e,t,r,a,"Transforms cannot be represented in JSON Schema")},xf=(e,t,r,a)=>{Be(e,t,r,a,"Map cannot be represented in JSON Schema")},Tf=(e,t,r,a)=>{Be(e,t,r,a,"Set cannot be represented in JSON Schema")},Af=(e,t,r,a)=>{let n=r,i=e._zod.def,{minimum:o,maximum:s}=Ue(e);typeof o=="number"&&(n.minItems=o),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=ve(i.element,t,{...a,path:[...a.path,"items"]})};function gs(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?gs(t.out):t.type==="catch"?gs(t.innerType):e._zod.optin}var Cf=(e,t,r,a)=>{let n=r,i=e._zod.def,o=i.shape;if(Object.getOwnPropertySymbols(o).length&&Be(e,t,n,a,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let c in o)Ge(n.properties,c,ve(o[c],t,{...a,path:[...a.path,"properties",c]}));let l=[];for(let c of Object.keys(o)){let u=i.shape[c];(t.io==="input"?gs(u)===void 0:u._zod.optout===void 0)&&l.push(c)}l.length>0&&(n.required=l),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=ve(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Sd=(e,t,r,a)=>{let n=e._zod.def,i=n.inclusive===!1,o=n.options.map((s,l)=>ve(s,t,{...a,path:[...a.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=o:r.anyOf=o},zf=(e,t,r,a)=>{let n=e._zod.def,i=ve(n.left,t,{...a,path:[...a.path,"allOf",0]}),o=ve(n.right,t,{...a,path:[...a.path,"allOf",1]}),s=c=>"allOf"in c&&Object.keys(c).length===1,l=[...s(i)?i.allOf:[i],...s(o)?o.allOf:[o]];r.allOf=l,t.intersections.push(l)},If=(e,t,r,a)=>{let n=r,i=e._zod.def;n.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((h,f)=>ve(h,t,{...a,path:[...a.path,o,f]})),c=i.rest?ve(i.rest,t,{...a,path:[...a.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let h=i.items[u-1];if(!(t.io==="input"?gs(h)!==void 0:h._zod.optout==="optional"))break;u--}let d=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(n.prefixItems=l,m?n.items=!1:c&&(n.items=c),u>0&&(n.minItems=u),m&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:l},c&&n.items.anyOf.push(c),u>0&&(n.minItems=u),m&&(n.maxItems=d)):(n.items=l,m?n.additionalItems=!1:c&&(n.additionalItems=c),u>0&&(n.minItems=u),m&&(n.maxItems=d));let{minimum:p,maximum:g}=Ue(e);typeof p=="number"&&(n.minItems=p),typeof g=="number"&&(n.maxItems=g)};function tf(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let h=tf(e,g,r);return h===g?t:h}for(let g of["anyOf","oneOf"]){let h=t[g];if(!Array.isArray(h))continue;let f=h.map(k=>tf(e,k,r));f.some((k,b)=>k!==h[b])&&(t={...t,[g]:f})}let a=Array.isArray(t.type)?t.type:[t.type],n=!a.includes("string")&&a.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!i?.some(g=>typeof g=="number"))return t;let{minimum:o,maximum:s,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:u,format:d,id:m,...p}=t;return p.enum?p.enum=p.enum.map(g=>typeof g=="number"?String(g):g):typeof p.const=="number"&&(p.const=String(p.const)),n&&(p.type="string",i||(p.pattern=(a.includes("number")?An:xo).source)),p}var nf=new WeakMap;function l0(e){let t=new Map;for(let a of e.seen.values())a.def&&!t.has(a.schema)&&t.set(a.schema,a);let r=new Map;for(let a of nf.get(e)??[]){let n=e.seen.get(a),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let o=tf(t,i,new Set);o!==i&&r.set(i,o)}if(r.size)for(let a of e.seen.values())for(let n of[a.schema,a.def]){let i=n&&r.get(n.propertyNames);i&&(n.propertyNames=i)}}var Pf=(e,t,r,a)=>{let n=r,i=e._zod.def;n.type="object";let o=i.keyType,s=Ue(o).patterns;if(i.mode==="loose"&&s&&s.size>0){let u=ve(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});n.patternProperties={};for(let d of s)Ge(n.patternProperties,sE(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=ve(i.keyType,t,{...a,path:[...a.path,"propertyNames"]});let u=nf.get(t);u||(u=[],nf.set(t,u),t.deferred.push(()=>l0(t))),u.push(e)}n.additionalProperties=ve(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]})}let l=o._zod.values,c=t.io==="input"&&gs(i.valueType)!==void 0;if(l&&!i.partial&&!c){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(n.required=u.map(String))}},Rf=(e,t,r,a)=>{let n=e._zod.def,i=ve(n.innerType,t,a),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},$f=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType},jf=Symbol();function lE(e,t,r,a,n){let i=!1,o=JSON.stringify(e,(s,l)=>typeof l!="bigint"?l:(i=!0,null));return i?(Be(t,r,a,n,"BigInt defaults cannot be represented in JSON Schema"),jf):JSON.parse(o)}var Of=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType;let o=lE(n.defaultValue,e,t,r,a);o!==jf&&(r.default=o)},Nf=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let o=lE(n.defaultValue,e,t,r,a);o!==jf&&(r._prefault=o)},Df=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType;let o;try{o=n.catchValue(void 0)}catch{Be(e,t,r,a,"Dynamic catch values are not supported in JSON Schema");return}r.default=o},Mf=(e,t,r,a)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?i?n.out:n.in:n.out;ve(o,t,a);let s=t.seen.get(e);s.ref=o},Lf=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},Bf=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType},Ed=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType},Uf=(e,t,r,a)=>{let n=e._zod.innerType;ve(n,t,a);let i=t.seen.get(e);i.ref=n},wd={string:rf,number:af,boolean:of,bigint:sf,symbol:lf,null:cf,undefined:uf,void:df,never:pf,any:mf,unknown:gf,date:hf,enum:ff,literal:bf,nan:vf,template_literal:yf,file:kf,success:_f,custom:wf,function:Sf,transform:Ef,map:xf,set:Tf,array:Af,object:Cf,union:Sd,intersection:zf,tuple:If,record:Pf,nullable:Rf,nonoptional:$f,default:Of,prefault:Nf,catch:Df,pipe:Mf,readonly:Lf,promise:Bf,optional:Ed,lazy:Uf};function Gr(e,t){if("_idmap"in e){let a=e,n=ar({...t,processors:wd}),i={};for(let l of a._idmap.entries()){let[c,u]=l;ve(u,n)}let o={},s={registry:a,uri:t?.uri,defs:i};n.external=s;for(let l of a._idmap.entries()){let[c,u]=l;ir(n,u),Ge(o,c,or(n,u))}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[l]:i}}return{schemas:o}}let r=ar({...t,processors:wd});return ve(e,r),ir(r,e),or(r,e)}var xd=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=ar({processors:wd,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return ve(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,ir(this.ctx,t);let a=or(this.ctx,t),{"~standard":n,...i}=a;return i}};var cE={};var hi={};En(hi,{ZodAny:()=>ob,ZodArray:()=>ub,ZodBase64:()=>Hd,ZodBase64URL:()=>Gd,ZodBigInt:()=>mi,ZodBigIntFormat:()=>Kd,ZodBoolean:()=>pi,ZodCIDRv4:()=>Fd,ZodCIDRv6:()=>qd,ZodCUID:()=>Od,ZodCUID2:()=>Nd,ZodCatch:()=>zb,ZodCodec:()=>Ss,ZodCreditCard:()=>tb,ZodCustom:()=>Es,ZodCustomStringFormat:()=>Wr,ZodDate:()=>vs,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>pb,ZodE164:()=>Vd,ZodEmail:()=>Pd,ZodEmoji:()=>$d,ZodEnum:()=>ci,ZodExactOptional:()=>Yd,ZodFile:()=>yb,ZodFunction:()=>Lb,ZodGUID:()=>Rd,ZodIBAN:()=>nb,ZodIPv4:()=>Bd,ZodIPv6:()=>Ud,ZodISODate:()=>lr,ZodISODateTime:()=>sr,ZodISODuration:()=>ur,ZodISOTime:()=>cr,ZodInstanceOf:()=>Fb,ZodIntersection:()=>mb,ZodJWT:()=>Wd,ZodKSUID:()=>Ld,ZodLazy:()=>Nb,ZodLiteral:()=>vb,ZodMAC:()=>eb,ZodMap:()=>fb,ZodNaN:()=>Pb,ZodNanoID:()=>jd,ZodNever:()=>lb,ZodNonOptional:()=>Xd,ZodNull:()=>ib,ZodNullable:()=>wb,ZodNumber:()=>di,ZodNumberFormat:()=>Kr,ZodObject:()=>ys,ZodOptional:()=>Zr,ZodPipe:()=>ws,ZodPrefault:()=>xb,ZodPreprocess:()=>Rb,ZodPromise:()=>Mb,ZodReadonly:()=>$b,ZodRecord:()=>li,ZodSet:()=>bb,ZodString:()=>ui,ZodStringFormat:()=>Se,ZodSuccess:()=>Cb,ZodSymbol:()=>rb,ZodTemplateLiteral:()=>Ob,ZodTransform:()=>kb,ZodTuple:()=>gb,ZodType:()=>Y,ZodULID:()=>Dd,ZodURL:()=>fs,ZodUUID:()=>dn,ZodUndefined:()=>ab,ZodUnion:()=>ks,ZodUnknown:()=>sb,ZodVoid:()=>cb,ZodXID:()=>Md,ZodXor:()=>db,_ZodString:()=>Id,_default:()=>Eb,_function:()=>bx,any:()=>XE,array:()=>ae,base64:()=>RE,base64url:()=>$E,bigint:()=>WE,boolean:()=>De,catch:()=>Ib,check:()=>vx,cidrv4:()=>IE,cidrv6:()=>PE,codec:()=>mx,creditCard:()=>OE,cuid:()=>wE,cuid2:()=>SE,currencyCode:()=>UE,custom:()=>Qd,date:()=>ex,describe:()=>yx,discriminatedUnion:()=>_s,e164:()=>jE,email:()=>pE,emoji:()=>kE,enum:()=>Ke,exactOptional:()=>_b,file:()=>cx,float32:()=>qE,float64:()=>HE,function:()=>bx,guid:()=>mE,hash:()=>FE,hex:()=>BE,hostname:()=>LE,httpUrl:()=>yE,iban:()=>NE,instanceof:()=>_x,int:()=>Cd,int32:()=>GE,int64:()=>KE,intersection:()=>gi,invertCodec:()=>gx,ipv4:()=>AE,ipv6:()=>zE,json:()=>Sx,jwt:()=>DE,keyof:()=>tx,ksuid:()=>TE,lazy:()=>Db,literal:()=>B,looseObject:()=>We,looseRecord:()=>ix,mac:()=>CE,map:()=>ox,meta:()=>kx,nan:()=>px,nanoid:()=>_E,nativeEnum:()=>lx,never:()=>Zd,nonoptional:()=>Ab,null:()=>bs,nullable:()=>hs,nullish:()=>ux,number:()=>he,object:()=>O,optional:()=>we,partialRecord:()=>ax,pipe:()=>zd,prefault:()=>Tb,preprocess:()=>xs,promise:()=>fx,readonly:()=>jb,record:()=>Ee,refine:()=>Bb,set:()=>sx,strictObject:()=>nx,string:()=>w,stringFormat:()=>ME,stringbool:()=>wx,success:()=>dx,superRefine:()=>Ub,symbol:()=>JE,templateLiteral:()=>hx,transform:()=>Jd,tuple:()=>hb,uint32:()=>VE,uint64:()=>ZE,ulid:()=>EE,undefined:()=>YE,union:()=>ye,unknown:()=>xe,url:()=>vE,uuid:()=>gE,uuidv4:()=>hE,uuidv6:()=>fE,uuidv7:()=>bE,void:()=>QE,xid:()=>xE,xor:()=>rx});var Td={};En(Td,{endsWith:()=>Ya,gt:()=>cn,gte:()=>It,includes:()=>Za,length:()=>Hr,lowercase:()=>Wa,lt:()=>ln,lte:()=>zt,maxLength:()=>qr,maxSize:()=>nr,mime:()=>Qa,minLength:()=>Cn,minSize:()=>un,multipleOf:()=>tr,negative:()=>dd,nonnegative:()=>md,nonpositive:()=>pd,normalize:()=>ei,overwrite:()=>Wt,positive:()=>ud,properties:()=>Xa,property:()=>gd,regex:()=>Va,size:()=>Fr,slugify:()=>ai,startsWith:()=>Ja,toLowerCase:()=>ni,toUpperCase:()=>ri,trim:()=>ti,uppercase:()=>Ka});var uE=new WeakSet([Object.prototype,Error.prototype]);function Ad(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let a=r(this);return Object.defineProperty(this,t,{value:a,configurable:!0,writable:!0}),a},set(a){Object.defineProperty(this,t,{value:a,configurable:!0,writable:!0})}})}var dE=(e,t)=>{yg.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);uE.has(r)||(uE.add(r),Ad(r,"format",a=>n=>So(a,n)),Ad(r,"flatten",a=>n=>wo(a,n)),Ad(r,"addIssue",a=>n=>{a.issues.push(n),a.message=JSON.stringify(a.issues,_a,2)}),Ad(r,"addIssues",a=>n=>{a.issues.push(...n),a.message=JSON.stringify(a.issues,_a,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},u0=y("ZodError",dE),wt=y("ZodError",dE,void 0,{Parent:Error});var Ff=Aa(wt),qf=Ca(wt),Hf=za(wt),Gf=Pa(wt),Vf=Zl(wt),Wf=Jl(wt),Kf=Yl(wt),Zf=Xl(wt),Jf=Ql(wt),Yf=ec(wt),Xf=tc(wt),Qf=nc(wt);function p0(){He.localeError||Oe($u())}function Vr(){He.memoizer||Oe({memoizer:Bo()})}var Y=y("ZodType",(e,t)=>(p0(),Z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(E.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bb(e,t))},superRefine(e,t){return this.check(Ub(e,t))},overwrite(e){return this.check(Wt(e))},optional(){return we(this)},exactOptional(){return _b(this)},nullable(){return hs(this)},nullish(){return we(hs(this))},nonoptional(e){return Ab(this,e)},array(){return ae(this)},or(e){return ye([this,e])},and(e){return gi(this,e)},transform(e){return zd(this,Jd(e))},default(e){return Eb(this,e)},prefault(e){return Tb(this,e)},catch(e){return Ib(this,e)},pipe(e){return zd(this,e)},readonly(){return jb(this)},describe(e){let t=this.clone();return Ve.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ve.get(this);let t=this.clone();return Ve.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return E.hide(this,"~standard",{...mc(this),jsonSchema:{input:ii(this,"input"),output:ii(this,"output")}})},set"~standard"(e){E.own(this,"~standard",e)},parse:function e(t,r){return Ff(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await qf(this,t,r,{callee:e})},safeParse(e,t){return Hf(this,e,t)},async safeParseAsync(e,t){return Gf(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){E.own(this,"spa",e)},validate(e,t){return $a(this,e,t)},validateAsync(e,t){return ja(this,e,t)},encode:function e(t,r){return Vf(this,t,r,{callee:e})},decode:function e(t,r){return Wf(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Kf(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Zf(this,t,r,{callee:e})},safeEncode(e,t){return Jf(this,e,t)},safeDecode(e,t){return Yf(this,e,t)},async safeEncodeAsync(e,t){return Xf(this,e,t)},async safeDecodeAsync(e,t){return Qf(this,e,t)},toJSONSchema(e){return ef(this,{})(e)},get description(){return Ve.get(this)?.description},get _def(){return this._zod.def}}),Id=y("_ZodString",(e,t)=>{Qn.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>rf(e,r,a,n)},E.derived({format:e=>Ue(e).format??null,minLength:e=>Ue(e).minimum??null,maxLength:e=>Ue(e).maximum??null},{regex(...e){return this.check(Va(...e))},includes(...e){return this.check(Za(...e))},startsWith(...e){return this.check(Ja(...e))},endsWith(...e){return this.check(Ya(...e))},min(...e){return this.check(Cn(...e))},max(...e){return this.check(qr(...e))},length(...e){return this.check(Hr(...e))},nonempty(...e){return this.check(Cn(1,...e))},lowercase(e){return this.check(Wa(e))},uppercase(e){return this.check(Ka(e))},trim(){return this.check(ti())},normalize(...e){return this.check(ei(...e))},toLowerCase(){return this.check(ni())},toUpperCase(){return this.check(ri())},slugify(){return this.check(ai())}})),ui=y("ZodString",(e,t)=>{Qn.init(e,t),Id.init(e,t)},{email(e){return this.check(Fo(Pd,e))},url(e){return this.check(Ga(fs,e))},jwt(e){return this.check(ls(Wd,e))},emoji(e){return this.check(Ko($d,e))},guid(e){return this.check(qo(Rd,e))},uuid(e){return this.check(Ho(dn,e))},uuidv4(e){return this.check(Go(dn,e))},uuidv6(e){return this.check(Vo(dn,e))},uuidv7(e){return this.check(Wo(dn,e))},nanoid(e){return this.check(Zo(jd,e))},cuid(e){return this.check(Jo(Od,e))},cuid2(e){return this.check(Yo(Nd,e))},ulid(e){return this.check(Xo(Dd,e))},base64(e){return this.check(is(Hd,e))},base64url(e){return this.check(os(Gd,e))},xid(e){return this.check(Qo(Md,e))},ksuid(e){return this.check(es(Ld,e))},ipv4(e){return this.check(ts(Bd,e))},ipv6(e){return this.check(ns(Ud,e))},cidrv4(e){return this.check(rs(Fd,e))},cidrv6(e){return this.check(as(qd,e))},e164(e){return this.check(ss(Vd,e))},datetime(e){return this.check(cs(sr,e))},date(e){return this.check(us(lr,e))},time(e){return this.check(ds(cr,e))},duration(e){return this.check(ps(ur,e))}});function w(e){return Uu(ui,e)}var Se=y("ZodStringFormat",(e,t)=>{be.init(e,t),Id.init(e,t)}),sr=y("ZodISODateTime",(e,t)=>{Ch.init(e,t),Se.init(e,t)}),lr=y("ZodISODate",(e,t)=>{zh.init(e,t),Se.init(e,t)}),cr=y("ZodISOTime",(e,t)=>{Ih.init(e,t),Se.init(e,t)}),ur=y("ZodISODuration",(e,t)=>{Ph.init(e,t),Se.init(e,t)}),Pd=y("ZodEmail",(e,t)=>{fc.init(e,t),Se.init(e,t)});function pE(e){return Fo(Pd,e)}var Rd=y("ZodGUID",(e,t)=>{gc.init(e,t),Se.init(e,t)});function mE(e){return qo(Rd,e)}var dn=y("ZodUUID",(e,t)=>{hc.init(e,t),Se.init(e,t)});function gE(e){return Ho(dn,e)}function hE(e){return Go(dn,e)}function fE(e){return Vo(dn,e)}function bE(e){return Wo(dn,e)}var fs=y("ZodURL",(e,t)=>{kc.init(e,t),Se.init(e,t)});function vE(e){return Ga(fs,e)}function yE(e){return Ga(fs,{protocol:Eo,hostname:Fg,...E.normalizeParams(e)})}var $d=y("ZodEmoji",(e,t)=>{_c.init(e,t),Se.init(e,t)});function kE(e){return Ko($d,e)}var jd=y("ZodNanoID",(e,t)=>{wc.init(e,t),Se.init(e,t)});function _E(e){return Zo(jd,e)}var Od=y("ZodCUID",(e,t)=>{Sc.init(e,t),Se.init(e,t)});function wE(e){return Jo(Od,e)}var Nd=y("ZodCUID2",(e,t)=>{Ec.init(e,t),Se.init(e,t)});function SE(e){return Yo(Nd,e)}var Dd=y("ZodULID",(e,t)=>{xc.init(e,t),Se.init(e,t)});function EE(e){return Xo(Dd,e)}var Md=y("ZodXID",(e,t)=>{Tc.init(e,t),Se.init(e,t)});function xE(e){return Qo(Md,e)}var Ld=y("ZodKSUID",(e,t)=>{Ac.init(e,t),Se.init(e,t)});function TE(e){return es(Ld,e)}var Bd=y("ZodIPv4",(e,t)=>{Cc.init(e,t),Se.init(e,t)});function AE(e){return ts(Bd,e)}var eb=y("ZodMAC",(e,t)=>{Ic.init(e,t),Se.init(e,t)});function CE(e){return Fu(eb,e)}var Ud=y("ZodIPv6",(e,t)=>{zc.init(e,t),Se.init(e,t)});function zE(e){return ns(Ud,e)}var Fd=y("ZodCIDRv4",(e,t)=>{Pc.init(e,t),Se.init(e,t)});function IE(e){return rs(Fd,e)}var qd=y("ZodCIDRv6",(e,t)=>{$c.init(e,t),Se.init(e,t)});function PE(e){return as(qd,e)}var Hd=y("ZodBase64",(e,t)=>{Oc.init(e,t),Se.init(e,t)});function RE(e){return is(Hd,e)}var Gd=y("ZodBase64URL",(e,t)=>{Dc.init(e,t),Se.init(e,t)});function $E(e){return os(Gd,e)}var Vd=y("ZodE164",(e,t)=>{Mc.init(e,t),Se.init(e,t)});function jE(e){return ss(Vd,e)}var tb=y("ZodCreditCard",(e,t)=>{Bc.init(e,t),Se.init(e,t)});function OE(e){return qu(tb,e)}var nb=y("ZodIBAN",(e,t)=>{Fc.init(e,t),Se.init(e,t)});function NE(e){return Hu(nb,e)}var Wd=y("ZodJWT",(e,t)=>{Hc.init(e,t),Se.init(e,t)});function DE(e){return ls(Wd,e)}var Wr=y("ZodCustomStringFormat",(e,t)=>{Gc.init(e,t),Se.init(e,t)});function ME(e,t,r={}){return rr(Wr,e,t,r)}function LE(e){return rr(Wr,"hostname",Ug,e)}function BE(e){return rr(Wr,"hex",nh,e)}function UE(e){return rr(Wr,"currency_code",Hg,e)}function FE(e,t){let r=t?.enc??"hex",a=`${e}_${r}`,n=Ct[a];if(!n)throw new Error(`Unrecognized hash format: ${a}`);return rr(Wr,a,n,t)}var di=y("ZodNumber",(e,t)=>{$o.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>af(e,r,a,n),e.isFinite=!0},E.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Ue(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Ue(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Ue(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Ue(e).format??null},{gt(e,t){return this.check(cn(e,t))},gte(e,t){return this.check(It(e,t))},min(e,t){return this.check(It(e,t))},lt(e,t){return this.check(ln(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},int(e){return this.check(Cd(e))},safe(e){return this.check(Cd(e))},positive(e){return this.check(cn(0,e))},nonnegative(e){return this.check(It(0,e))},negative(e){return this.check(ln(0,e))},nonpositive(e){return this.check(zt(0,e))},multipleOf(e,t){return this.check(tr(e,t))},step(e,t){return this.check(tr(e,t))},finite(){return this}}));function he(e){return Gu(di,e)}var Kr=y("ZodNumberFormat",(e,t)=>{Vc.init(e,t),di.init(e,t)});function Cd(e){return Vu(Kr,e)}function qE(e){return Wu(Kr,e)}function HE(e){return Ku(Kr,e)}function GE(e){return Zu(Kr,e)}function VE(e){return Ju(Kr,e)}var pi=y("ZodBoolean",(e,t)=>{Da.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>of(e,r,a,n)});function De(e){return Yu(pi,e)}var mi=y("ZodBigInt",(e,t)=>{jo.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>sf(e,r,a,n)},E.derived({minValue:e=>Ue(e).minimum??null,maxValue:e=>Ue(e).maximum??null,format:e=>Ue(e).format??null},{gte(e,t){return this.check(It(e,t))},min(e,t){return this.check(It(e,t))},gt(e,t){return this.check(cn(e,t))},lt(e,t){return this.check(ln(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},positive(e){return this.check(cn(BigInt(0),e))},negative(e){return this.check(ln(BigInt(0),e))},nonpositive(e){return this.check(zt(BigInt(0),e))},nonnegative(e){return this.check(It(BigInt(0),e))},multipleOf(e,t){return this.check(tr(e,t))}}));function WE(e){return Xu(mi,e)}var Kd=y("ZodBigIntFormat",(e,t)=>{Wc.init(e,t),mi.init(e,t)});function KE(e){return Qu(Kd,e)}function ZE(e){return ed(Kd,e)}var rb=y("ZodSymbol",(e,t)=>{Kc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>lf(e,r,a,n)});function JE(e){return td(rb,e)}var ab=y("ZodUndefined",(e,t)=>{Zc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>uf(e,r,a,n)});function YE(e){return nd(ab,e)}var ib=y("ZodNull",(e,t)=>{Jc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>cf(e,r,a,n)});function bs(e){return rd(ib,e)}var ob=y("ZodAny",(e,t)=>{Yc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>mf(e,r,a,n)});function XE(){return ad(ob)}var sb=y("ZodUnknown",(e,t)=>{Xc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>gf(e,r,a,n)});function xe(){return id(sb)}var lb=y("ZodNever",(e,t)=>{Qc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>pf(e,r,a,n)});function Zd(e){return od(lb,e)}var cb=y("ZodVoid",(e,t)=>{eu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>df(e,r,a,n)});function QE(e){return sd(cb,e)}var vs=y("ZodDate",(e,t)=>{tu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>hf(e,r,a,n),e.min=(r,a)=>e.check(It(r,a)),e.max=(r,a)=>e.check(zt(r,a))},E.derived({minDate:e=>{let{minimum:t}=Ue(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Ue(e);return t?new Date(t):null}},{}));function ex(e){return ld(vs,e)}var ub=y("ZodArray",(e,t)=>{Vr(),nu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Af(e,r,a,n),e.element=t.element},{min(e,t){return this.check(Cn(e,t))},nonempty(e){return this.check(Cn(1,e))},max(e,t){return this.check(qr(e,t))},length(e,t){return this.check(Hr(e,t))},unwrap(){return this.element}});function ae(e,t){return Xh(ub,e,t)}function tx(e){let t=e._zod.def.shape;return Ke(Object.keys(t))}var ys=y("ZodObject",(e,t)=>{Vr(),$h.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Cf(e,r,a,n),E.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ke(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(E.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(E.mergeDefs(this._zod.def,{catchall:xe()}))},loose(){return this.clone(E.mergeDefs(this._zod.def,{catchall:xe()}))},strict(){return this.clone(E.mergeDefs(this._zod.def,{catchall:Zd()}))},strip(){return this.clone(E.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return E.extend(this,e)},safeExtend(e){return E.safeExtend(this,e)},merge(e){return E.merge(this,e)},pick(e){return E.pick(this,e)},omit(e){return E.omit(this,e)},partial(...e){return E.partial(Zr,this,e[0])},exactPartial(...e){return E.partial(Yd,this,e[0],"exactPartial")},required(...e){return E.required(Xd,this,e[0])}});function O(e,t){let r={type:"object",shape:e??{},...E.normalizeParams(t)};return new ys(r)}function nx(e,t){return new ys({type:"object",shape:e,catchall:Zd(),...E.normalizeParams(t)})}function We(e,t){return new ys({type:"object",shape:e,catchall:xe(),...E.normalizeParams(t)})}var ks=y("ZodUnion",(e,t)=>{Ma.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sd(e,r,a,n),e.options=t.options});function ye(e,t){return new ks({type:"union",options:e,...E.normalizeParams(t)})}var db=y("ZodXor",(e,t)=>{ks.init(e,t),au.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sd(e,r,a,n),e.options=t.options});function rx(e,t){return new db({type:"union",options:e,inclusive:!1,...E.normalizeParams(t)})}var pb=y("ZodDiscriminatedUnion",(e,t)=>{ks.init(e,t),iu.init(e,t)});function _s(e,t,r){return new pb({type:"union",options:t,discriminator:e,...E.normalizeParams(r)})}var mb=y("ZodIntersection",(e,t)=>{ou.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>zf(e,r,a,n)});function gi(e,t){return new mb({type:"intersection",left:e,right:t})}var gb=y("ZodTuple",(e,t)=>{Vr(),Oo.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>If(e,r,a,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Zr({type:"optional",innerType:t}))})}});function hb(e,t,r){let a=t instanceof Z,n=a?r:t,i=a?t:null;return new gb({type:"tuple",items:e,rest:i,...E.normalizeParams(n)})}var li=y("ZodRecord",(e,t)=>{Vr(),su.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Pf(e,r,a,n),e.keyType=t.keyType,e.valueType=t.valueType});function Ee(e,t,r){return!t||!t._zod?new li({type:"record",keyType:w(),valueType:e,...E.normalizeParams(t)}):new li({type:"record",keyType:e,valueType:t,...E.normalizeParams(r)})}function ax(e,t,r){return new li({type:"record",keyType:e,valueType:t,...E.normalizeParams(r),partial:!0})}function ix(e,t,r){return new li({type:"record",keyType:e,valueType:t,mode:"loose",...E.normalizeParams(r)})}var fb=y("ZodMap",(e,t)=>{Vr(),lu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>xf(e,r,a,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(un(...r)),e.nonempty=r=>e.check(un(1,r)),e.max=(...r)=>e.check(nr(...r)),e.size=(...r)=>e.check(Fr(...r))});function ox(e,t,r){return new fb({type:"map",keyType:e,valueType:t,...E.normalizeParams(r)})}var bb=y("ZodSet",(e,t)=>{Vr(),cu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Tf(e,r,a,n),e.min=(...r)=>e.check(un(...r)),e.nonempty=r=>e.check(un(1,r)),e.max=(...r)=>e.check(nr(...r)),e.size=(...r)=>e.check(Fr(...r))});function sx(e,t){return new bb({type:"set",valueType:e,...E.normalizeParams(t)})}var ci=y("ZodEnum",(e,t)=>{uu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(a,n,i)=>ff(e,a,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(a,n)=>{let i={};for(let o of a)if(r.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new ci({...t,checks:[],...E.normalizeParams(n),entries:i})},e.exclude=(a,n)=>{let i={...t.entries};for(let o of a)if(r.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new ci({...t,checks:[],...E.normalizeParams(n),entries:i})}});function Ke(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new ci({type:"enum",entries:r,...E.normalizeParams(t)})}function lx(e,t){return new ci({type:"enum",entries:e,...E.normalizeParams(t)})}var vb=y("ZodLiteral",(e,t)=>{du.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>bf(e,r,a,n),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 B(e,t){return new vb({type:"literal",values:Array.isArray(e)?e:[e],...E.normalizeParams(t)})}var yb=y("ZodFile",(e,t)=>{pu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>kf(e,r,a,n),e.min=(r,a)=>e.check(un(r,a)),e.max=(r,a)=>e.check(nr(r,a)),e.mime=(r,a)=>e.check(Qa(Array.isArray(r)?r:[r],a))});function cx(e){return hd(yb,e)}var kb=y("ZodTransform",(e,t)=>{Vr(),mu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ef(e,r,a,n),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new Xn(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(E.issue(i,r.value,t));else{let o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=r.value),o.inst??(o.inst=e),r.issues.push(E.issue(o))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function Jd(e){return new kb({type:"transform",transform:e})}var Zr=y("ZodOptional",(e,t)=>{No.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ed(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function we(e){return new Zr({type:"optional",innerType:e})}var Yd=y("ZodExactOptional",(e,t)=>{gu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ed(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function _b(e){return new Yd({type:"optional",innerType:e})}var wb=y("ZodNullable",(e,t)=>{hu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Rf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function hs(e){return new wb({type:"nullable",innerType:e})}function ux(e){return we(hs(e))}var Sb=y("ZodDefault",(e,t)=>{fu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Of(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Eb(e,t){return new Sb({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():E.shallowClone(t)}})}var xb=y("ZodPrefault",(e,t)=>{bu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Nf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function Tb(e,t){return new xb({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():E.shallowClone(t)}})}var Xd=y("ZodNonOptional",(e,t)=>{vu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>$f(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function Ab(e,t){return new Xd({type:"nonoptional",innerType:e,...E.normalizeParams(t)})}var Cb=y("ZodSuccess",(e,t)=>{yu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>_f(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function dx(e){return new Cb({type:"success",innerType:e})}var zb=y("ZodCatch",(e,t)=>{ku.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Df(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ib(e,t){return new zb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:E.constantCatch(t)})}var Pb=y("ZodNaN",(e,t)=>{_u.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>vf(e,r,a,n)});function px(e){return cd(Pb,e)}var ws=y("ZodPipe",(e,t)=>{Do.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Mf(e,r,a,n),e.in=t.in,e.out=t.out});function zd(e,t){return new ws({type:"pipe",in:e,out:t})}var Ss=y("ZodCodec",(e,t)=>{ws.init(e,t),La.init(e,t)});function mx(e,t,r){return new Ss({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function gx(e){let t=e._zod.def;return new Ss({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Rb=y("ZodPreprocess",(e,t)=>{ws.init(e,t),Oh.init(e,t)}),$b=y("ZodReadonly",(e,t)=>{wu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Lf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function jb(e){return new $b({type:"readonly",innerType:e})}var Ob=y("ZodTemplateLiteral",(e,t)=>{Su.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>yf(e,r,a,n)});function hx(e,t){return new Ob({type:"template_literal",parts:e,...E.normalizeParams(t)})}var Nb=y("ZodLazy",(e,t)=>{Ba.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Uf(e,r,a,n),e.unwrap=()=>e._zod.def.getter()});function Db(e){return new Nb({type:"lazy",getter:e})}var Mb=y("ZodPromise",(e,t)=>{xu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Bf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function fx(e){return new Mb({type:"promise",innerType:e})}var Lb=y("ZodFunction",(e,t)=>{Eu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sf(e,r,a,n)});function bx(e){return new Lb({type:"function",input:Array.isArray(e?.input)?hb(e?.input):e?.input??ae(xe()),output:e?.output??xe()})}var Es=y("ZodCustom",(e,t)=>{Tu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>wf(e,r,a,n)});function vx(e){let t=new _e({check:"custom"});return t._zod.check=e,t}function Qd(e,t){return fd(Es,e??(()=>!0),t)}function Bb(e,t={}){return bd(Es,e,t)}function Ub(e,t){return vd(e,t)}var yx=yd,kx=kd,Fb=y("ZodInstanceOf",(e,t)=>{Es.init(e,t)},{properties(e,t){return this.check(Xa(e,t))}});function _x(e,t={}){let r=new Fb({type:"custom",check:"custom",fn:a=>a instanceof e,abort:!0,...E.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=a=>{a.value instanceof e||a.issues.push({code:"invalid_type",expected:e.name,input:a.value,inst:r,path:[...r._zod.def.path??[]]})},r}var wx=(...e)=>_d({Codec:Ss,Boolean:pi,String:ui},...e);function Sx(e){let t=Db(()=>ye([w(e),he(),De(),bs(),ae(t),Ee(w(),t)]));return t}function xs(e,t){return new Rb({type:"pipe",in:Jd(e),out:t})}var m0={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function g0(e){Oe({customError:e})}function h0(){return Oe().customError}var qb;qb||(qb={});var Jr={};En(Jr,{ZodISODate:()=>lr,ZodISODateTime:()=>sr,ZodISODuration:()=>ur,ZodISOTime:()=>cr,date:()=>b0,datetime:()=>f0,duration:()=>y0,time:()=>v0});function f0(e){return cs(sr,e)}function b0(e){return us(lr,e)}function v0(e){return ds(cr,e)}function y0(e){return ps(ur,e)}var $={...hi,...Td,iso:Jr},k0=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function _0(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Ex(e,t){return e.map((r,a)=>a<t?r:r.optional())}function w0(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function S0(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let a=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===a){let n=r[1]===void 0?void 0:w0(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function E0(e,t){return $.transform(a=>a).check(a=>{let n=a.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let i=Object.getOwnPropertyNames(n);if(t.minProperties!==void 0&&i.length<t.minProperties&&a.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:n,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&a.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:n,inst:e,continue:!0}),t.keySchema)for(let o of i){let s=t.keySchema.safeParse(o);s.success||a.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function Hb(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let a=String(e);return`${r[0]}${a.length}:${a}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let o of e){let s=Hb(o,t);if(s===null)return null;i.push(s)}return`a${i.length}:[${i.join(",")}]`}let a=Object.keys(e).sort(),n=[];for(let i of a){let o=Hb(e[i],t);if(o===null)return null;n.push(`${i.length}:${i}=${o}`)}return`o${n.length}:{${n.join(",")}}`}finally{t.delete(e)}}var x0=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),T0=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Ts(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Ts):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>x0.has(t)?Ts(r):!T0.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Ts))}function xx(e){return e===1?"element":"elements"}function A0(e,t){return $.transform(a=>a).check(a=>{let n=a.value;if(Array.isArray(n)){if(t.uniqueItems===!0){let i=new Map;for(let o=0;o<n.length;o++){let s=Hb(n[o],new Set);if(s===null)continue;let l=i.get(s);if(l===void 0){i.set(s,o);continue}a.issues.push({code:"custom",message:`Array items must be unique: element at index ${o} duplicates the one at index ${l}`,input:n,path:[o],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,o=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,s=0;for(let l of n)if(t.containsSchema.safeParse(l).success&&++s>=o)break;s<i&&a.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${xx(i)}; found ${s}`,input:n,continue:!0}),t.maxContains!==void 0&&s>t.maxContains&&a.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${xx(t.maxContains)}`,input:n,continue:!0})}}}).pipe(e)}function Tx(e,t){if(e!==!1)return e===void 0||e===!0?$.any():pt(e,t)}var C0=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ax(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return $.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return $.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=S0(n,t),o=pt(i,t);return t.refs.set(n,o),t.processing.delete(n),o}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return $.null();if(n.length===0)return $.never();if(n.length===1)return $.literal(n[0]);if(n.every(o=>typeof o=="string"))return $.enum(n);let i=n.map(o=>$.literal(o));return i.length<2?i[0]:$.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return $.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let o={...e,type:i};return Ax(o,t)});return n.length===0?$.never():n.length===1?n[0]:$.union(n)}if(!r)return $.any();let a;switch(r){case"string":{let n=$.string();if(e.format){let i=e.format;i==="email"?n=n.check($.email()):i==="uri"||i==="uri-reference"?n=n.check($.url()):i==="uuid"||i==="guid"?n=n.check($.uuid()):i==="date-time"?n=n.check($.iso.datetime({offset:!0})):i==="date"?n=n.check($.iso.date()):i==="time"?n=n.check($.regex(C0)):i==="duration"?n=n.check($.iso.duration()):i==="hostname"?n=n.check($.hostname()):i==="ipv4"?n=n.check($.ipv4()):i==="ipv6"?n=n.check($.ipv6()):i==="mac"?n=n.check($.mac()):i==="cidr"?n=n.check($.cidrv4()):i==="cidr-v6"?n=n.check($.cidrv6()):i==="base64"?n=n.check($.base64()):i==="base64url"?n=n.check($.base64url()):i==="e164"?n=n.check($.e164()):i==="credit_card"?n=n.check($.creditCard()):i==="iban"?n=n.check($.iban()):i==="jwt"?n=n.check($.jwt()):i==="emoji"?n=n.check($.emoji()):i==="nanoid"?n=n.check($.nanoid()):i==="cuid"?n=n.check($.cuid()):i==="cuid2"?n=n.check($.cuid2()):i==="ulid"?n=n.check($.ulid()):i==="xid"?n=n.check($.xid()):i==="ksuid"&&(n=n.check($.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),a=n;break}case"number":case"integer":{let n=r==="integer"?$.number().int():$.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),a=n;break}case"boolean":{a=$.boolean();break}case"null":{a=$.null();break}case"object":{let n={},i=e.properties||{},o=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?pt(e.additionalProperties,t):void 0;for(let[d,m]of Object.entries(i)){let p=pt(m,t);Ge(n,d,o.has(d)?p:p.optional())}if(e.patternProperties){let d=e.patternProperties,m=Object.keys(d),p=[];for(let h of m){let f=pt(d[h],t),k=$.string().regex(new RegExp(h));p.push($.looseRecord(k,f))}let g=[];if(Object.keys(n).length>0&&g.push($.object(n).passthrough()),g.push(...p),g.length===0)a=$.object({}).passthrough();else if(g.length===1)a=g[0];else{let h=$.intersection(g[0],g[1]);for(let f=2;f<g.length;f++)h=$.intersection(h,g[f]);a=h}if(e.additionalProperties===!1){let h=Object.keys(n),f=m.map(b=>new RegExp(b)),k=a;a=a.check(b=>{if(!Dt(b.value))return;let v=[];for(let C of Object.keys(b.value))h.includes(C)||f.some(S=>S.test(C))||v.push(C);v.length&&b.issues.push({code:"unrecognized_keys",keys:v,input:b.value,inst:k})})}}else{let d=$.object(n);e.additionalProperties===!1?a=d.strict():s?a=d.catchall(s):a=d.passthrough()}let l=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,u=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(l||c!==void 0||u!==void 0){let d;if(l){let m=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=pt(m,t)}a=E0(a,{keySchema:d,minProperties:c,maxProperties:u})}break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let o=typeof e.minItems=="number"?e.minItems:0,s=n.map(d=>pt(d,t)),l=Ex(s,o),c=Array.isArray(i)?void 0:Tx(i,t),u=$.tuple(l);a=c?u.rest(c):u,typeof e.minItems=="number"&&(a=a.check($.minLength(e.minItems))),typeof e.maxItems=="number"&&(a=a.check($.maxLength(e.maxItems)))}else if(Array.isArray(i)){let o=typeof e.minItems=="number"?e.minItems:0,s=i.map(d=>pt(d,t)),l=Ex(s,o),c=Tx(e.additionalItems,t),u=$.tuple(l);a=c?u.rest(c):u,typeof e.minItems=="number"&&(a=a.check($.minLength(e.minItems))),typeof e.maxItems=="number"&&(a=a.check($.maxLength(e.maxItems)))}else if(i!==void 0){let o=pt(i,t),s=$.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),a=s}else a=$.array($.any());(e.uniqueItems===!0||e.contains!==void 0)&&(a=A0(a,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?pt(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return a}function pt(e,t){if(typeof e=="boolean")return e?$.any():$.never();let r=Ax(e,t),a=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(c=>pt(c,t)),l=$.union(s);r=a?$.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(c=>pt(c,t)),l=$.xor(s);r=a?$.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=a?r:$.any();else{let s=a?r:pt(e.allOf[0],t),l=a?0:1;for(let c=l;c<e.allOf.length;c++)s=$.intersection(s,pt(e.allOf[c],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=$.nullable(r)),e.readOnly===!0&&(r=$.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)s in e&&(n[s]=e[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in e&&(n[s]=e[s]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Ts(e.propertyNames)&&(n.propertyNames=e.propertyNames);for(let s of["minProperties","maxProperties"])e[s]!==void 0&&(n[s]=e[s])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Ts(e.contains)&&(n.contains=e.contains);for(let s of["uniqueItems","minContains","maxContains"])e[s]!==void 0&&(n[s]=e[s])}for(let s of Object.keys(e))k0.has(s)||Ge(n,s,e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function Cx(e,t){if(typeof e=="boolean")return e?$.any():$.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let a=_0(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:a,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Ve};return pt(r,i)}var zx=Symbol("z.visit/resolving");function As(e,t){let r=typeof t=="function"?t:(o,s)=>{let l=t[o._zod.def.type];return l?l(o,s):o},a=new Map;function n(o){let s=a.get(o);if(s===zx)return new Ba({type:"lazy",getter:()=>a.get(o)});if(s!==void 0)return s;a.set(o,zx);let l=i(o),c=r(l,l!==o);return a.set(o,c),c}function i(o){let s=o._zod.def,l=s.type;switch(l){case"object":{let c=s.shape,u=Object.keys(c),d=!1,m={};for(let g of u){let h=n(c[g]);h!==c[g]&&(d=!0),m[g]=h}let p=s.catchall;return s.catchall&&(p=n(s.catchall),p!==s.catchall&&(d=!0)),d?ge(o,{...s,shape:m,catchall:p}):o}case"array":{let c=n(s.element);return c===s.element?o:ge(o,{...s,element:c})}case"tuple":{let c=s.items,u=!1,d=[];for(let p of c){let g=n(p);g!==p&&(u=!0),d.push(g)}let m=s.rest;return s.rest&&(m=n(s.rest),m!==s.rest&&(u=!0)),u?ge(o,{...s,items:d,rest:m}):o}case"record":case"map":{let c=n(s.keyType),u=n(s.valueType);return c===s.keyType&&u===s.valueType?o:ge(o,{...s,keyType:c,valueType:u})}case"set":{let c=n(s.valueType);return c===s.valueType?o:ge(o,{...s,valueType:c})}case"union":{let c=s.options,u=!1,d=[];for(let m of c){let p=n(m);p!==m&&(u=!0),d.push(p)}return u?ge(o,{...s,options:d}):o}case"intersection":{let c=n(s.left),u=n(s.right);return c===s.left&&u===s.right?o:ge(o,{...s,left:c,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=n(s.innerType);return c===s.innerType?o:ge(o,{...s,innerType:c})}case"pipe":{let c=n(s.in),u=n(s.out);return c===s.in&&u===s.out?o:ge(o,{...s,in:c,out:u})}case"function":{let c=n(s.input),u=n(s.output);return c===s.input&&u===s.output?o:ge(o,{...s,input:c,output:u})}case"lazy":{let c=s.getter,{_cachedInner:u,...d}=s;return ge(o,{...d,getter:()=>n(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return n(e)}function Ix(e){return As(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:ye(r.options)}})}function z0(e,t){if(!t?.length)return e;let r=e._zod.def;return ge(e,Nt(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function Px(e){return z0(e.out,e.checks)}function I0(e){return e.in._zod.traits.has("$ZodTransform")?Px(e):e.in}function Rx(e){return As(e,{pipe:t=>I0(t._zod.def),default:(t,r)=>r?we(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function $x(e){return As(e,{pipe:t=>Px(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var Gb={};En(Gb,{bigint:()=>j0,boolean:()=>$0,date:()=>O0,number:()=>R0,string:()=>P0});function P0(e){return Vh(ui,e)}function R0(e){return Kh(di,e)}function $0(e){return Zh(pi,e)}function j0(e){return Jh(mi,e)}function O0(e){return Yh(vs,e)}var Wb="2025-11-25",jx="2025-03-26",bi=[Wb,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],dr="io.modelcontextprotocol/related-task",tp="2.0",Fe=Qd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ox=ye([w(),he().int()]),Nx=w(),vV=We({ttl:he().optional(),pollInterval:he().optional()}),N0=O({ttl:he().optional()}),D0=O({taskId:w()}),Kb=We({progressToken:Ox.optional(),[dr]:D0.optional()}),Pt=O({_meta:Kb.optional()}),Cs=Pt.extend({task:N0.optional()}),Dx=e=>Cs.safeParse(e).success,Ze=O({method:w(),params:Pt.loose().optional()}),Lt=O({_meta:Kb.optional()}),Bt=O({method:w(),params:Lt.loose().optional()}),Je=We({_meta:Kb.optional()}),np=ye([w(),he().int()]),Mx=O({jsonrpc:B(tp),id:np,...Ze.shape}).strict(),zn=e=>Mx.safeParse(e).success,Lx=O({jsonrpc:B(tp),...Bt.shape}).strict(),Bx=e=>Lx.safeParse(e).success,Zb=O({jsonrpc:B(tp),id:np,result:Je}).strict(),In=e=>Zb.safeParse(e).success;var F;(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"})(F||(F={}));var Jb=O({jsonrpc:B(tp),id:np.optional(),error:O({code:he().int(),message:w(),data:xe().optional()})}).strict();var vi=e=>Jb.safeParse(e).success;var zs=ye([Mx,Lx,Zb,Jb]),yV=ye([Zb,Jb]),rp=Je.strict(),M0=Lt.extend({requestId:np.optional(),reason:w().optional()}),ap=Bt.extend({method:B("notifications/cancelled"),params:M0}),L0=O({src:w(),mimeType:w().optional(),sizes:ae(w()).optional(),theme:Ke(["light","dark"]).optional()}),Is=O({icons:ae(L0).optional()}),fi=O({name:w(),title:w().optional()}),Ux=fi.extend({...fi.shape,...Is.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),B0=gi(O({applyDefaults:De().optional()}),Ee(w(),xe())),U0=xs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,gi(O({form:B0.optional(),url:Fe.optional()}),Ee(w(),xe()).optional())),F0=We({list:Fe.optional(),cancel:Fe.optional(),requests:We({sampling:We({createMessage:Fe.optional()}).optional(),elicitation:We({create:Fe.optional()}).optional()}).optional()}),q0=We({list:Fe.optional(),cancel:Fe.optional(),requests:We({tools:We({call:Fe.optional()}).optional()}).optional()}),H0=O({experimental:Ee(w(),Fe).optional(),sampling:O({context:Fe.optional(),tools:Fe.optional()}).optional(),elicitation:U0.optional(),roots:O({listChanged:De().optional()}).optional(),tasks:F0.optional(),extensions:Ee(w(),Fe).optional()}),G0=Pt.extend({protocolVersion:w(),capabilities:H0,clientInfo:Ux}),ip=Ze.extend({method:B("initialize"),params:G0}),Yb=e=>ip.safeParse(e).success,V0=O({experimental:Ee(w(),Fe).optional(),logging:Fe.optional(),completions:Fe.optional(),prompts:O({listChanged:De().optional()}).optional(),resources:O({subscribe:De().optional(),listChanged:De().optional()}).optional(),tools:O({listChanged:De().optional()}).optional(),tasks:q0.optional(),extensions:Ee(w(),Fe).optional()}),W0=Je.extend({protocolVersion:w(),capabilities:V0,serverInfo:Ux,instructions:w().optional()}),Xb=Bt.extend({method:B("notifications/initialized"),params:Lt.optional()});var op=Ze.extend({method:B("ping"),params:Pt.optional()}),K0=O({progress:he(),total:we(he()),message:we(w())}),Z0=O({...Lt.shape,...K0.shape,progressToken:Ox}),sp=Bt.extend({method:B("notifications/progress"),params:Z0}),J0=Pt.extend({cursor:Nx.optional()}),Ps=Ze.extend({params:J0.optional()}),Rs=Je.extend({nextCursor:Nx.optional()}),Y0=Ke(["working","input_required","completed","failed","cancelled"]),$s=O({taskId:w(),status:Y0,ttl:ye([he(),bs()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:we(he()),statusMessage:we(w())}),yi=Je.extend({task:$s}),X0=Lt.merge($s),js=Bt.extend({method:B("notifications/tasks/status"),params:X0}),lp=Ze.extend({method:B("tasks/get"),params:Pt.extend({taskId:w()})}),cp=Je.merge($s),up=Ze.extend({method:B("tasks/result"),params:Pt.extend({taskId:w()})}),kV=Je.loose(),dp=Ps.extend({method:B("tasks/list")}),pp=Rs.extend({tasks:ae($s)}),mp=Ze.extend({method:B("tasks/cancel"),params:Pt.extend({taskId:w()})}),Fx=Je.merge($s),qx=O({uri:w(),mimeType:we(w()),_meta:Ee(w(),xe()).optional()}),Hx=qx.extend({text:w()}),Qb=w().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Gx=qx.extend({blob:Qb}),Os=Ke(["user","assistant"]),ki=O({audience:ae(Os).optional(),priority:he().min(0).max(1).optional(),lastModified:Jr.datetime({offset:!0}).optional()}),Vx=O({...fi.shape,...Is.shape,uri:w(),description:we(w()),mimeType:we(w()),size:we(he()),annotations:ki.optional(),_meta:we(We({}))}),Q0=O({...fi.shape,...Is.shape,uriTemplate:w(),description:we(w()),mimeType:we(w()),annotations:ki.optional(),_meta:we(We({}))}),gp=Ps.extend({method:B("resources/list")}),ej=Rs.extend({resources:ae(Vx)}),hp=Ps.extend({method:B("resources/templates/list")}),tj=Rs.extend({resourceTemplates:ae(Q0)}),ev=Pt.extend({uri:w()}),nj=ev,fp=Ze.extend({method:B("resources/read"),params:nj}),rj=Je.extend({contents:ae(ye([Hx,Gx]))}),aj=Bt.extend({method:B("notifications/resources/list_changed"),params:Lt.optional()}),ij=ev,oj=Ze.extend({method:B("resources/subscribe"),params:ij}),sj=ev,lj=Ze.extend({method:B("resources/unsubscribe"),params:sj}),cj=Lt.extend({uri:w()}),uj=Bt.extend({method:B("notifications/resources/updated"),params:cj}),dj=O({name:w(),description:we(w()),required:we(De())}),pj=O({...fi.shape,...Is.shape,description:we(w()),arguments:we(ae(dj)),_meta:we(We({}))}),bp=Ps.extend({method:B("prompts/list")}),mj=Rs.extend({prompts:ae(pj)}),gj=Pt.extend({name:w(),arguments:Ee(w(),w()).optional()}),vp=Ze.extend({method:B("prompts/get"),params:gj}),tv=O({type:B("text"),text:w(),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),nv=O({type:B("image"),data:Qb,mimeType:w(),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),rv=O({type:B("audio"),data:Qb,mimeType:w(),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),hj=O({type:B("tool_use"),name:w(),id:w(),input:Ee(w(),xe()),_meta:Ee(w(),xe()).optional()}),fj=O({type:B("resource"),resource:ye([Hx,Gx]),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),bj=Vx.extend({type:B("resource_link")}),av=ye([tv,nv,rv,bj,fj]),vj=O({role:Os,content:av}),yj=Je.extend({description:w().optional(),messages:ae(vj)}),kj=Bt.extend({method:B("notifications/prompts/list_changed"),params:Lt.optional()}),_j=O({title:w().optional(),readOnlyHint:De().optional(),destructiveHint:De().optional(),idempotentHint:De().optional(),openWorldHint:De().optional()}),wj=O({taskSupport:Ke(["required","optional","forbidden"]).optional()}),Wx=O({...fi.shape,...Is.shape,description:w().optional(),inputSchema:O({type:B("object"),properties:Ee(w(),Fe).optional(),required:ae(w()).optional()}).catchall(xe()),outputSchema:O({type:B("object"),properties:Ee(w(),Fe).optional(),required:ae(w()).optional()}).catchall(xe()).optional(),annotations:_j.optional(),execution:wj.optional(),_meta:Ee(w(),xe()).optional()}),yp=Ps.extend({method:B("tools/list")}),Sj=Rs.extend({tools:ae(Wx)}),kp=Je.extend({content:ae(av).default([]),structuredContent:Ee(w(),xe()).optional(),isError:De().optional()}),_V=kp.or(Je.extend({toolResult:xe()})),Ej=Cs.extend({name:w(),arguments:Ee(w(),xe()).optional()}),_i=Ze.extend({method:B("tools/call"),params:Ej}),xj=Bt.extend({method:B("notifications/tools/list_changed"),params:Lt.optional()}),wV=O({autoRefresh:De().default(!0),debounceMs:he().int().nonnegative().default(300)}),Ns=Ke(["debug","info","notice","warning","error","critical","alert","emergency"]),Tj=Pt.extend({level:Ns}),iv=Ze.extend({method:B("logging/setLevel"),params:Tj}),Aj=Lt.extend({level:Ns,logger:w().optional(),data:xe()}),Cj=Bt.extend({method:B("notifications/message"),params:Aj}),zj=O({name:w().optional()}),Ij=O({hints:ae(zj).optional(),costPriority:he().min(0).max(1).optional(),speedPriority:he().min(0).max(1).optional(),intelligencePriority:he().min(0).max(1).optional()}),Pj=O({mode:Ke(["auto","required","none"]).optional()}),Rj=O({type:B("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:ae(av).default([]),structuredContent:O({}).loose().optional(),isError:De().optional(),_meta:Ee(w(),xe()).optional()}),$j=_s("type",[tv,nv,rv]),ep=_s("type",[tv,nv,rv,hj,Rj]),jj=O({role:Os,content:ye([ep,ae(ep)]),_meta:Ee(w(),xe()).optional()}),Oj=Cs.extend({messages:ae(jj),modelPreferences:Ij.optional(),systemPrompt:w().optional(),includeContext:Ke(["none","thisServer","allServers"]).optional(),temperature:he().optional(),maxTokens:he().int(),stopSequences:ae(w()).optional(),metadata:Fe.optional(),tools:ae(Wx).optional(),toolChoice:Pj.optional()}),Nj=Ze.extend({method:B("sampling/createMessage"),params:Oj}),Ds=Je.extend({model:w(),stopReason:we(Ke(["endTurn","stopSequence","maxTokens"]).or(w())),role:Os,content:$j}),ov=Je.extend({model:w(),stopReason:we(Ke(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:Os,content:ye([ep,ae(ep)])}),Dj=O({type:B("boolean"),title:w().optional(),description:w().optional(),default:De().optional()}),Mj=O({type:B("string"),title:w().optional(),description:w().optional(),minLength:he().optional(),maxLength:he().optional(),format:Ke(["email","uri","date","date-time"]).optional(),default:w().optional()}),Lj=O({type:Ke(["number","integer"]),title:w().optional(),description:w().optional(),minimum:he().optional(),maximum:he().optional(),default:he().optional()}),Bj=O({type:B("string"),title:w().optional(),description:w().optional(),enum:ae(w()),default:w().optional()}),Uj=O({type:B("string"),title:w().optional(),description:w().optional(),oneOf:ae(O({const:w(),title:w()})),default:w().optional()}),Fj=O({type:B("string"),title:w().optional(),description:w().optional(),enum:ae(w()),enumNames:ae(w()).optional(),default:w().optional()}),qj=ye([Bj,Uj]),Hj=O({type:B("array"),title:w().optional(),description:w().optional(),minItems:he().optional(),maxItems:he().optional(),items:O({type:B("string"),enum:ae(w())}),default:ae(w()).optional()}),Gj=O({type:B("array"),title:w().optional(),description:w().optional(),minItems:he().optional(),maxItems:he().optional(),items:O({anyOf:ae(O({const:w(),title:w()}))}),default:ae(w()).optional()}),Vj=ye([Hj,Gj]),Wj=ye([Fj,qj,Vj]),Kj=ye([Wj,Dj,Mj,Lj]),Zj=Cs.extend({mode:B("form").optional(),message:w(),requestedSchema:O({type:B("object"),properties:Ee(w(),Kj),required:ae(w()).optional()})}),Jj=Cs.extend({mode:B("url"),message:w(),elicitationId:w(),url:w().url()}),Yj=ye([Zj,Jj]),Xj=Ze.extend({method:B("elicitation/create"),params:Yj}),Qj=Lt.extend({elicitationId:w()}),eO=Bt.extend({method:B("notifications/elicitation/complete"),params:Qj}),wi=Je.extend({action:Ke(["accept","decline","cancel"]),content:xs(e=>e===null?void 0:e,Ee(w(),ye([w(),he(),De(),ae(w())])).optional())}),tO=O({type:B("ref/resource"),uri:w()});var nO=O({type:B("ref/prompt"),name:w()}),rO=Pt.extend({ref:ye([nO,tO]),argument:O({name:w(),value:w()}),context:O({arguments:Ee(w(),w()).optional()}).optional()}),_p=Ze.extend({method:B("completion/complete"),params:rO});function Kx(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Zx(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var aO=Je.extend({completion:We({values:ae(w()).max(100),total:we(he().int()),hasMore:we(De())})}),iO=O({uri:w().startsWith("file://"),name:w().optional(),_meta:Ee(w(),xe()).optional()}),oO=Ze.extend({method:B("roots/list"),params:Pt.optional()}),sv=Je.extend({roots:ae(iO)}),sO=Bt.extend({method:B("notifications/roots/list_changed"),params:Lt.optional()}),SV=ye([op,ip,_p,iv,vp,bp,gp,hp,fp,oj,lj,_i,yp,lp,up,dp,mp]),EV=ye([ap,sp,Xb,sO,js]),xV=ye([rp,Ds,ov,wi,sv,cp,pp,yi]),TV=ye([op,Nj,Xj,oO,lp,up,dp,mp]),AV=ye([ap,sp,Cj,uj,aj,xj,kj,js,eO]),CV=ye([rp,W0,aO,yj,mj,ej,tj,rj,kp,Sj,cp,pp,yi]),M=class e extends Error{constructor(t,r,a){super(`MCP error ${t}: ${r}`),this.code=t,this.data=a,this.name="McpError"}static fromError(t,r,a){if(t===F.UrlElicitationRequired&&a){let n=a;if(n.elicitations)return new Vb(n.elicitations,r)}return new e(t,r,a)}},Vb=class extends M{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(F.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};var lO=10*1024*1024,wp=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??lO}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
70
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let o of e.seen.entries()){let s=o[1];if(t===o[0]){i(o);continue}if(e.external){let c=e.external.registry.get(o[0])?.id;if(t!==o[0]&&c){i(o);continue}}if(e.metadataRegistry.get(o[0])?.id){i(o);continue}if(s.cycle){i(o);continue}s.count>1&&e.reused==="ref"&&i(o)}e.external&&(e.sharedDefsExtractedFor=e.external)}function YS(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let a of t){if(!a||typeof a!="object")return;YS(a);let n=Object.keys(a);if(n.length!==1||n[0]!=="type")return;let i=a.type;for(let o of Array.isArray(i)?i:[i]){if(typeof o!="string")return;r.includes(o)||r.push(o)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var XS=new Set(["type","properties","required","additionalProperties"]),ZS=["oneOf","anyOf"];function JS(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function Qh(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let o in i)if(!XS.has(o))return null;t.push(i)}let r={},a=new Set;for(let i of t){for(let o in i.properties){if(Object.prototype.hasOwnProperty.call(r,o))continue;let s=[];for(let c of t){let u=c.properties?.[o]??JS(c);u!=null&&(s.some(d=>JSON.stringify(d)===JSON.stringify(u))||s.push(u))}let l=s.length===1?s[0]:Qh(s)??{allOf:s};Ge(r,o,l)}for(let o of i.required??[])a.add(o)}let n={type:"object",properties:r};if(a.size&&(n.required=[...a]),t.every(i=>i.additionalProperties===!1))n.additionalProperties=!1;else{let i=[];for(let o of t){let s=JS(o);s&&!i.some(l=>JSON.stringify(l)===JSON.stringify(s))&&i.push(s)}i.length===1?n.additionalProperties=i[0]:i.length>1&&(n.additionalProperties={allOf:i})}return n}function a0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of XS)if(n in e)return;let r=t.filter(n=>ZS.some(i=>Array.isArray(n[i]))),a=null;if(!r.length)a=Qh(t);else{let n=r[0],i=ZS.find(l=>Array.isArray(n[l]));if(Object.keys(n).length!==1)return;let o=t.filter(l=>l!==n),s=n[i].map(l=>Qh([...o,l]));if(s.some(l=>!l))return;a={[i]:s}}a&&(delete e.allOf,ms(e,a))}function or(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let a=s=>{let l=e.seen.get(s);if(l.ref===null)return;let c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){a(d);let p=e.seen.get(d),g=p.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(g)):ms(c,g),ms(c,u),s._zod.parent===d)for(let f in c)f==="$ref"||f==="allOf"||f in u||delete c[f];if(g.$ref&&p.def)for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}let m=s._zod.parent;if(m&&m!==d){a(m);let p=e.seen.get(m);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let g in c)g==="$ref"||g==="allOf"||g in p.def&&JSON.stringify(c[g])===JSON.stringify(p.def[g])&&delete c[g]}e.override({zodSchema:s,jsonSchema:c,path:l.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())a(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())YS(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let l of e.seen.values())for(let c of[l.schema,l.def]){let u=c?.allOf;if(!Array.isArray(u))continue;let d=s.get(u);d?d.push(c):s.set(u,[c])}for(let l of e.intersections)for(let c of s.get(l)??[])a0(c)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}ms(n,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&n.id===i&&delete n.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let l=s[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,Ge(o,l.defId,l.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?n.$defs=o:n.definitions=o);try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:ii(t,"input",e.processors),output:ii(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function dt(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return dt(a.element,r);if(a.type==="set")return dt(a.valueType,r);if(a.type==="lazy")return dt(a.getter(),r);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault"||a.type==="catch")return dt(a.innerType,r);if(a.type==="intersection")return dt(a.left,r)||dt(a.right,r);if(a.type==="record"||a.type==="map")return dt(a.keyType,r)||dt(a.valueType,r);if(a.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:dt(a.in,r)||dt(a.out,r);if(a.type==="object"){for(let n in a.shape)if(dt(a.shape[n],r))return!0;return!1}if(a.type==="union"){for(let n of a.options)if(dt(n,r))return!0;return!1}if(a.type==="tuple"){for(let n of a.items)if(dt(n,r))return!0;return!!(a.rest&&dt(a.rest,r))}return!1}var ef=(e,t={})=>r=>{let a=ar({...r,processors:t});return ve(e,a),ir(a,e),or(a,e)},ii=(e,t,r={})=>a=>{let{libraryOptions:n,target:i}=a??{},o=ar({...n??{},target:i,io:t,processors:r});return ve(e,o),ir(o,e),or(o,e)};var oi=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},si=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},QS=(e,t)=>{oi(e,"minimum",t),si(e,"maximum",t)},rE=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},aE=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},iE=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},oE=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},eE=(e,t)=>oi(e,"minimum",t.minimum),tE=(e,t)=>si(e,"maximum",t.maximum),nE=e=>(t,r)=>{oE(t,r.format);let[a,n]=e[r.format];oi(t,"minimum",a),si(t,"maximum",n)},i0={greater_than:(e,t)=>oi(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>si(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>rE(e,t.value),number_format:nE(fo),bigint_format:nE(bo),min_length:eE,max_length:tE,length_equals:(e,t)=>QS(e,t.length),min_size:eE,max_size:tE,size_equals:(e,t)=>QS(e,t.size),string_format:(e,t)=>{oE(e,t.format),t.pattern&&aE(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>iE(e,t.mime)};function Ue(e){let t={},r=e._zod.def,a=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of a)i0[i._zod.def.check]?.(t,i._zod.def);let n=e._zod.bag;n.minimum!==void 0&&oi(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&oi(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&si(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&si(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&rE(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&iE(t,n.mime);for(let i of n.patterns??[])aE(t,i);return t}var o0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s0=new Map([[jc,Lg],[Ro,Bg]]),sE=e=>s0.get(e)??e,rf=(e,t,r,a)=>{let n=r;n.type="string";let{minimum:i,maximum:o,format:s,patterns:l,contentEncoding:c,laxFormat:u}=Ue(e);if(typeof i=="number"&&(n.minLength=i),typeof o=="number"&&(n.maxLength=o),s&&(n.format=o0[s]??s,n.format===""&&delete n.format,(s==="time"||u)&&delete n.format),c&&(n.contentEncoding=c),l&&l.size>0){let d=[...l].map(sE);d.length===1?n.pattern=d[0].source:d.length>1&&(n.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},af=(e,t,r,a)=>{let n=r,{minimum:i,maximum:o,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:c,isInt:u}=Ue(e);n.type=u?"integer":"number";let d=typeof c=="number"&&c>=(i??Number.NEGATIVE_INFINITY),m=typeof l=="number"&&l<=(o??Number.POSITIVE_INFINITY),p=t.target==="draft-04"||t.target==="openapi-3.0";if(d?p?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c:typeof i=="number"&&(n.minimum=i),m?p?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l:typeof o=="number"&&(n.maximum=o),s){let g=new Set;for(let k of s)Number.isFinite(k)&&k!==0?g.add(Math.abs(k)):Be(e,t,n,a,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);let[h,...f]=g;h!==void 0&&(n.multipleOf=h),f.length&&(n.allOf=[...n.allOf??[],...f.map(k=>({multipleOf:k}))])}},of=(e,t,r,a)=>{r.type="boolean"},sf=(e,t,r,a)=>{Be(e,t,r,a,"BigInt cannot be represented in JSON Schema")},lf=(e,t,r,a)=>{Be(e,t,r,a,"Symbols cannot be represented in JSON Schema")},cf=(e,t,r,a)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},uf=(e,t,r,a)=>{Be(e,t,r,a,"Undefined cannot be represented in JSON Schema")},df=(e,t,r,a)=>{Be(e,t,r,a,"Void cannot be represented in JSON Schema")},pf=(e,t,r,a)=>{r.not={}},mf=(e,t,r,a)=>{},gf=(e,t,r,a)=>{},hf=(e,t,r,a)=>{Be(e,t,r,a,"Date cannot be represented in JSON Schema")},ff=(e,t,r,a)=>{let n=e._zod.def,i=ka(n.entries);if(i.length===0){r.not={};return}i.every(o=>typeof o=="number")&&(r.type="number"),i.every(o=>typeof o=="string")&&(r.type="string"),r.enum=i},bf=(e,t,r,a)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let i=[];for(let o of n.values)if(o===void 0){if(Be(e,t,r,a,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o=="bigint"){if(Be(e,t,r,a,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(o))}else i.push(o);if(i.length!==0)if(i.length===1){let o=i[0];r.type=o===null?"null":typeof o,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[o]:r.const=o}else i.every(o=>typeof o=="number")&&(r.type="number"),i.every(o=>typeof o=="string")&&(r.type="string"),i.every(o=>typeof o=="boolean")&&(r.type="boolean"),i.every(o=>o===null)&&(r.type="null"),r.enum=i},vf=(e,t,r,a)=>{Be(e,t,r,a,"NaN cannot be represented in JSON Schema")},yf=(e,t,r,a)=>{let n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},kf=(e,t,r,a)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:i,maximum:o,mime:s}=Ue(e);i!==void 0&&(n.minLength=i),o!==void 0&&(n.maxLength=o),s&&(s.length===0?n.not={}:s.length===1?n.contentMediaType=s[0]:n.anyOf=s.map(l=>({contentMediaType:l})))},_f=(e,t,r,a)=>{r.type="boolean"},wf=(e,t,r,a)=>{Be(e,t,r,a,"Custom types cannot be represented in JSON Schema")},Sf=(e,t,r,a)=>{Be(e,t,r,a,"Function types cannot be represented in JSON Schema")},Ef=(e,t,r,a)=>{Be(e,t,r,a,"Transforms cannot be represented in JSON Schema")},xf=(e,t,r,a)=>{Be(e,t,r,a,"Map cannot be represented in JSON Schema")},Tf=(e,t,r,a)=>{Be(e,t,r,a,"Set cannot be represented in JSON Schema")},Af=(e,t,r,a)=>{let n=r,i=e._zod.def,{minimum:o,maximum:s}=Ue(e);typeof o=="number"&&(n.minItems=o),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=ve(i.element,t,{...a,path:[...a.path,"items"]})};function gs(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?gs(t.out):t.type==="catch"?gs(t.innerType):e._zod.optin}var Cf=(e,t,r,a)=>{let n=r,i=e._zod.def,o=i.shape;if(Object.getOwnPropertySymbols(o).length&&Be(e,t,n,a,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let c in o)Ge(n.properties,c,ve(o[c],t,{...a,path:[...a.path,"properties",c]}));let l=[];for(let c of Object.keys(o)){let u=i.shape[c];(t.io==="input"?gs(u)===void 0:u._zod.optout===void 0)&&l.push(c)}l.length>0&&(n.required=l),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=ve(i.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Sd=(e,t,r,a)=>{let n=e._zod.def,i=n.inclusive===!1,o=n.options.map((s,l)=>ve(s,t,{...a,path:[...a.path,i?"oneOf":"anyOf",l]}));i?r.oneOf=o:r.anyOf=o},zf=(e,t,r,a)=>{let n=e._zod.def,i=ve(n.left,t,{...a,path:[...a.path,"allOf",0]}),o=ve(n.right,t,{...a,path:[...a.path,"allOf",1]}),s=c=>"allOf"in c&&Object.keys(c).length===1,l=[...s(i)?i.allOf:[i],...s(o)?o.allOf:[o]];r.allOf=l,t.intersections.push(l)},If=(e,t,r,a)=>{let n=r,i=e._zod.def;n.type="array";let o=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=i.items.map((h,f)=>ve(h,t,{...a,path:[...a.path,o,f]})),c=i.rest?ve(i.rest,t,{...a,path:[...a.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;for(;u>0;){let h=i.items[u-1];if(!(t.io==="input"?gs(h)!==void 0:h._zod.optout==="optional"))break;u--}let d=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(n.prefixItems=l,m?n.items=!1:c&&(n.items=c),u>0&&(n.minItems=u),m&&(n.maxItems=d)):t.target==="openapi-3.0"?(n.items={anyOf:l},c&&n.items.anyOf.push(c),u>0&&(n.minItems=u),m&&(n.maxItems=d)):(n.items=l,m?n.additionalItems=!1:c&&(n.additionalItems=c),u>0&&(n.minItems=u),m&&(n.maxItems=d));let{minimum:p,maximum:g}=Ue(e);typeof p=="number"&&(n.minItems=p),typeof g=="number"&&(n.maxItems=g)};function tf(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let h=tf(e,g,r);return h===g?t:h}for(let g of["anyOf","oneOf"]){let h=t[g];if(!Array.isArray(h))continue;let f=h.map(k=>tf(e,k,r));f.some((k,b)=>k!==h[b])&&(t={...t,[g]:f})}let a=Array.isArray(t.type)?t.type:[t.type],n=!a.includes("string")&&a.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!i?.some(g=>typeof g=="number"))return t;let{minimum:o,maximum:s,exclusiveMinimum:l,exclusiveMaximum:c,multipleOf:u,format:d,id:m,...p}=t;return p.enum?p.enum=p.enum.map(g=>typeof g=="number"?String(g):g):typeof p.const=="number"&&(p.const=String(p.const)),n&&(p.type="string",i||(p.pattern=(a.includes("number")?An:xo).source)),p}var nf=new WeakMap;function l0(e){let t=new Map;for(let a of e.seen.values())a.def&&!t.has(a.schema)&&t.set(a.schema,a);let r=new Map;for(let a of nf.get(e)??[]){let n=e.seen.get(a),i=(n?.def??n?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let o=tf(t,i,new Set);o!==i&&r.set(i,o)}if(r.size)for(let a of e.seen.values())for(let n of[a.schema,a.def]){let i=n&&r.get(n.propertyNames);i&&(n.propertyNames=i)}}var Pf=(e,t,r,a)=>{let n=r,i=e._zod.def;n.type="object";let o=i.keyType,s=Ue(o).patterns;if(i.mode==="loose"&&s&&s.size>0){let u=ve(i.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});n.patternProperties={};for(let d of s)Ge(n.patternProperties,sE(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=ve(i.keyType,t,{...a,path:[...a.path,"propertyNames"]});let u=nf.get(t);u||(u=[],nf.set(t,u),t.deferred.push(()=>l0(t))),u.push(e)}n.additionalProperties=ve(i.valueType,t,{...a,path:[...a.path,"additionalProperties"]})}let l=o._zod.values,c=t.io==="input"&&gs(i.valueType)!==void 0;if(l&&!i.partial&&!c){let u=[...l].filter(d=>typeof d=="string"||typeof d=="number");u.length>0&&(n.required=u.map(String))}},Rf=(e,t,r,a)=>{let n=e._zod.def,i=ve(n.innerType,t,a),o=t.seen.get(e);t.target==="openapi-3.0"?(o.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},$f=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType},jf=Symbol();function lE(e,t,r,a,n){let i=!1,o=JSON.stringify(e,(s,l)=>typeof l!="bigint"?l:(i=!0,null));return i?(Be(t,r,a,n,"BigInt defaults cannot be represented in JSON Schema"),jf):JSON.parse(o)}var Of=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType;let o=lE(n.defaultValue,e,t,r,a);o!==jf&&(r.default=o)},Nf=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);if(i.ref=n.innerType,t.io!=="input")return;let o=lE(n.defaultValue,e,t,r,a);o!==jf&&(r._prefault=o)},Df=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType;let o;try{o=n.catchValue(void 0)}catch{Be(e,t,r,a,"Dynamic catch values are not supported in JSON Schema");return}r.default=o},Mf=(e,t,r,a)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),o=t.io==="input"?i?n.out:n.in:n.out;ve(o,t,a);let s=t.seen.get(e);s.ref=o},Lf=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},Bf=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType},Ed=(e,t,r,a)=>{let n=e._zod.def;ve(n.innerType,t,a);let i=t.seen.get(e);i.ref=n.innerType},Uf=(e,t,r,a)=>{let n=e._zod.innerType;ve(n,t,a);let i=t.seen.get(e);i.ref=n},wd={string:rf,number:af,boolean:of,bigint:sf,symbol:lf,null:cf,undefined:uf,void:df,never:pf,any:mf,unknown:gf,date:hf,enum:ff,literal:bf,nan:vf,template_literal:yf,file:kf,success:_f,custom:wf,function:Sf,transform:Ef,map:xf,set:Tf,array:Af,object:Cf,union:Sd,intersection:zf,tuple:If,record:Pf,nullable:Rf,nonoptional:$f,default:Of,prefault:Nf,catch:Df,pipe:Mf,readonly:Lf,promise:Bf,optional:Ed,lazy:Uf};function Gr(e,t){if("_idmap"in e){let a=e,n=ar({...t,processors:wd}),i={};for(let l of a._idmap.entries()){let[c,u]=l;ve(u,n)}let o={},s={registry:a,uri:t?.uri,defs:i};n.external=s;for(let l of a._idmap.entries()){let[c,u]=l;ir(n,u),Ge(o,c,or(n,u))}if(Object.keys(i).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";o.__shared={[l]:i}}return{schemas:o}}let r=ar({...t,processors:wd});return ve(e,r),ir(r,e),or(r,e)}var xd=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=ar({processors:wd,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return ve(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,ir(this.ctx,t);let a=or(this.ctx,t),{"~standard":n,...i}=a;return i}};var cE={};var hi={};En(hi,{ZodAny:()=>ob,ZodArray:()=>ub,ZodBase64:()=>Hd,ZodBase64URL:()=>Gd,ZodBigInt:()=>mi,ZodBigIntFormat:()=>Kd,ZodBoolean:()=>pi,ZodCIDRv4:()=>Fd,ZodCIDRv6:()=>qd,ZodCUID:()=>Od,ZodCUID2:()=>Nd,ZodCatch:()=>zb,ZodCodec:()=>Ss,ZodCreditCard:()=>tb,ZodCustom:()=>Es,ZodCustomStringFormat:()=>Wr,ZodDate:()=>vs,ZodDefault:()=>Sb,ZodDiscriminatedUnion:()=>pb,ZodE164:()=>Vd,ZodEmail:()=>Pd,ZodEmoji:()=>$d,ZodEnum:()=>ci,ZodExactOptional:()=>Yd,ZodFile:()=>yb,ZodFunction:()=>Lb,ZodGUID:()=>Rd,ZodIBAN:()=>nb,ZodIPv4:()=>Bd,ZodIPv6:()=>Ud,ZodISODate:()=>lr,ZodISODateTime:()=>sr,ZodISODuration:()=>ur,ZodISOTime:()=>cr,ZodInstanceOf:()=>Fb,ZodIntersection:()=>mb,ZodJWT:()=>Wd,ZodKSUID:()=>Ld,ZodLazy:()=>Nb,ZodLiteral:()=>vb,ZodMAC:()=>eb,ZodMap:()=>fb,ZodNaN:()=>Pb,ZodNanoID:()=>jd,ZodNever:()=>lb,ZodNonOptional:()=>Xd,ZodNull:()=>ib,ZodNullable:()=>wb,ZodNumber:()=>di,ZodNumberFormat:()=>Kr,ZodObject:()=>ys,ZodOptional:()=>Zr,ZodPipe:()=>ws,ZodPrefault:()=>xb,ZodPreprocess:()=>Rb,ZodPromise:()=>Mb,ZodReadonly:()=>$b,ZodRecord:()=>li,ZodSet:()=>bb,ZodString:()=>ui,ZodStringFormat:()=>Se,ZodSuccess:()=>Cb,ZodSymbol:()=>rb,ZodTemplateLiteral:()=>Ob,ZodTransform:()=>kb,ZodTuple:()=>gb,ZodType:()=>Y,ZodULID:()=>Dd,ZodURL:()=>fs,ZodUUID:()=>dn,ZodUndefined:()=>ab,ZodUnion:()=>ks,ZodUnknown:()=>sb,ZodVoid:()=>cb,ZodXID:()=>Md,ZodXor:()=>db,_ZodString:()=>Id,_default:()=>Eb,_function:()=>bx,any:()=>XE,array:()=>ae,base64:()=>RE,base64url:()=>$E,bigint:()=>WE,boolean:()=>De,catch:()=>Ib,check:()=>vx,cidrv4:()=>IE,cidrv6:()=>PE,codec:()=>mx,creditCard:()=>OE,cuid:()=>wE,cuid2:()=>SE,currencyCode:()=>UE,custom:()=>Qd,date:()=>ex,describe:()=>yx,discriminatedUnion:()=>_s,e164:()=>jE,email:()=>pE,emoji:()=>kE,enum:()=>Ke,exactOptional:()=>_b,file:()=>cx,float32:()=>qE,float64:()=>HE,function:()=>bx,guid:()=>mE,hash:()=>FE,hex:()=>BE,hostname:()=>LE,httpUrl:()=>yE,iban:()=>NE,instanceof:()=>_x,int:()=>Cd,int32:()=>GE,int64:()=>KE,intersection:()=>gi,invertCodec:()=>gx,ipv4:()=>AE,ipv6:()=>zE,json:()=>Sx,jwt:()=>DE,keyof:()=>tx,ksuid:()=>TE,lazy:()=>Db,literal:()=>B,looseObject:()=>We,looseRecord:()=>ix,mac:()=>CE,map:()=>ox,meta:()=>kx,nan:()=>px,nanoid:()=>_E,nativeEnum:()=>lx,never:()=>Zd,nonoptional:()=>Ab,null:()=>bs,nullable:()=>hs,nullish:()=>ux,number:()=>he,object:()=>O,optional:()=>we,partialRecord:()=>ax,pipe:()=>zd,prefault:()=>Tb,preprocess:()=>xs,promise:()=>fx,readonly:()=>jb,record:()=>Ee,refine:()=>Bb,set:()=>sx,strictObject:()=>nx,string:()=>w,stringFormat:()=>ME,stringbool:()=>wx,success:()=>dx,superRefine:()=>Ub,symbol:()=>JE,templateLiteral:()=>hx,transform:()=>Jd,tuple:()=>hb,uint32:()=>VE,uint64:()=>ZE,ulid:()=>EE,undefined:()=>YE,union:()=>ye,unknown:()=>xe,url:()=>vE,uuid:()=>gE,uuidv4:()=>hE,uuidv6:()=>fE,uuidv7:()=>bE,void:()=>QE,xid:()=>xE,xor:()=>rx});var Td={};En(Td,{endsWith:()=>Ya,gt:()=>cn,gte:()=>It,includes:()=>Za,length:()=>Hr,lowercase:()=>Wa,lt:()=>ln,lte:()=>zt,maxLength:()=>qr,maxSize:()=>nr,mime:()=>Qa,minLength:()=>Cn,minSize:()=>un,multipleOf:()=>tr,negative:()=>dd,nonnegative:()=>md,nonpositive:()=>pd,normalize:()=>ei,overwrite:()=>Wt,positive:()=>ud,properties:()=>Xa,property:()=>gd,regex:()=>Va,size:()=>Fr,slugify:()=>ai,startsWith:()=>Ja,toLowerCase:()=>ni,toUpperCase:()=>ri,trim:()=>ti,uppercase:()=>Ka});var uE=new WeakSet([Object.prototype,Error.prototype]);function Ad(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let a=r(this);return Object.defineProperty(this,t,{value:a,configurable:!0,writable:!0}),a},set(a){Object.defineProperty(this,t,{value:a,configurable:!0,writable:!0})}})}var dE=(e,t)=>{yg.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);uE.has(r)||(uE.add(r),Ad(r,"format",a=>n=>So(a,n)),Ad(r,"flatten",a=>n=>wo(a,n)),Ad(r,"addIssue",a=>n=>{a.issues.push(n),a.message=JSON.stringify(a.issues,_a,2)}),Ad(r,"addIssues",a=>n=>{a.issues.push(...n),a.message=JSON.stringify(a.issues,_a,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},u0=y("ZodError",dE),wt=y("ZodError",dE,void 0,{Parent:Error});var Ff=Aa(wt),qf=Ca(wt),Hf=za(wt),Gf=Pa(wt),Vf=Zl(wt),Wf=Jl(wt),Kf=Yl(wt),Zf=Xl(wt),Jf=Ql(wt),Yf=ec(wt),Xf=tc(wt),Qf=nc(wt);function p0(){He.localeError||Oe($u())}function Vr(){He.memoizer||Oe({memoizer:Bo()})}var Y=y("ZodType",(e,t)=>(p0(),Z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(E.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bb(e,t))},superRefine(e,t){return this.check(Ub(e,t))},overwrite(e){return this.check(Wt(e))},optional(){return we(this)},exactOptional(){return _b(this)},nullable(){return hs(this)},nullish(){return we(hs(this))},nonoptional(e){return Ab(this,e)},array(){return ae(this)},or(e){return ye([this,e])},and(e){return gi(this,e)},transform(e){return zd(this,Jd(e))},default(e){return Eb(this,e)},prefault(e){return Tb(this,e)},catch(e){return Ib(this,e)},pipe(e){return zd(this,e)},readonly(){return jb(this)},describe(e){let t=this.clone();return Ve.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ve.get(this);let t=this.clone();return Ve.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return E.hide(this,"~standard",{...mc(this),jsonSchema:{input:ii(this,"input"),output:ii(this,"output")}})},set"~standard"(e){E.own(this,"~standard",e)},parse:function e(t,r){return Ff(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await qf(this,t,r,{callee:e})},safeParse(e,t){return Hf(this,e,t)},async safeParseAsync(e,t){return Gf(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){E.own(this,"spa",e)},validate(e,t){return $a(this,e,t)},validateAsync(e,t){return ja(this,e,t)},encode:function e(t,r){return Vf(this,t,r,{callee:e})},decode:function e(t,r){return Wf(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Kf(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Zf(this,t,r,{callee:e})},safeEncode(e,t){return Jf(this,e,t)},safeDecode(e,t){return Yf(this,e,t)},async safeEncodeAsync(e,t){return Xf(this,e,t)},async safeDecodeAsync(e,t){return Qf(this,e,t)},toJSONSchema(e){return ef(this,{})(e)},get description(){return Ve.get(this)?.description},get _def(){return this._zod.def}}),Id=y("_ZodString",(e,t)=>{Qn.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>rf(e,r,a,n)},E.derived({format:e=>Ue(e).format??null,minLength:e=>Ue(e).minimum??null,maxLength:e=>Ue(e).maximum??null},{regex(...e){return this.check(Va(...e))},includes(...e){return this.check(Za(...e))},startsWith(...e){return this.check(Ja(...e))},endsWith(...e){return this.check(Ya(...e))},min(...e){return this.check(Cn(...e))},max(...e){return this.check(qr(...e))},length(...e){return this.check(Hr(...e))},nonempty(...e){return this.check(Cn(1,...e))},lowercase(e){return this.check(Wa(e))},uppercase(e){return this.check(Ka(e))},trim(){return this.check(ti())},normalize(...e){return this.check(ei(...e))},toLowerCase(){return this.check(ni())},toUpperCase(){return this.check(ri())},slugify(){return this.check(ai())}})),ui=y("ZodString",(e,t)=>{Qn.init(e,t),Id.init(e,t)},{email(e){return this.check(Fo(Pd,e))},url(e){return this.check(Ga(fs,e))},jwt(e){return this.check(ls(Wd,e))},emoji(e){return this.check(Ko($d,e))},guid(e){return this.check(qo(Rd,e))},uuid(e){return this.check(Ho(dn,e))},uuidv4(e){return this.check(Go(dn,e))},uuidv6(e){return this.check(Vo(dn,e))},uuidv7(e){return this.check(Wo(dn,e))},nanoid(e){return this.check(Zo(jd,e))},cuid(e){return this.check(Jo(Od,e))},cuid2(e){return this.check(Yo(Nd,e))},ulid(e){return this.check(Xo(Dd,e))},base64(e){return this.check(is(Hd,e))},base64url(e){return this.check(os(Gd,e))},xid(e){return this.check(Qo(Md,e))},ksuid(e){return this.check(es(Ld,e))},ipv4(e){return this.check(ts(Bd,e))},ipv6(e){return this.check(ns(Ud,e))},cidrv4(e){return this.check(rs(Fd,e))},cidrv6(e){return this.check(as(qd,e))},e164(e){return this.check(ss(Vd,e))},datetime(e){return this.check(cs(sr,e))},date(e){return this.check(us(lr,e))},time(e){return this.check(ds(cr,e))},duration(e){return this.check(ps(ur,e))}});function w(e){return Uu(ui,e)}var Se=y("ZodStringFormat",(e,t)=>{be.init(e,t),Id.init(e,t)}),sr=y("ZodISODateTime",(e,t)=>{Ch.init(e,t),Se.init(e,t)}),lr=y("ZodISODate",(e,t)=>{zh.init(e,t),Se.init(e,t)}),cr=y("ZodISOTime",(e,t)=>{Ih.init(e,t),Se.init(e,t)}),ur=y("ZodISODuration",(e,t)=>{Ph.init(e,t),Se.init(e,t)}),Pd=y("ZodEmail",(e,t)=>{fc.init(e,t),Se.init(e,t)});function pE(e){return Fo(Pd,e)}var Rd=y("ZodGUID",(e,t)=>{gc.init(e,t),Se.init(e,t)});function mE(e){return qo(Rd,e)}var dn=y("ZodUUID",(e,t)=>{hc.init(e,t),Se.init(e,t)});function gE(e){return Ho(dn,e)}function hE(e){return Go(dn,e)}function fE(e){return Vo(dn,e)}function bE(e){return Wo(dn,e)}var fs=y("ZodURL",(e,t)=>{kc.init(e,t),Se.init(e,t)});function vE(e){return Ga(fs,e)}function yE(e){return Ga(fs,{protocol:Eo,hostname:Fg,...E.normalizeParams(e)})}var $d=y("ZodEmoji",(e,t)=>{_c.init(e,t),Se.init(e,t)});function kE(e){return Ko($d,e)}var jd=y("ZodNanoID",(e,t)=>{wc.init(e,t),Se.init(e,t)});function _E(e){return Zo(jd,e)}var Od=y("ZodCUID",(e,t)=>{Sc.init(e,t),Se.init(e,t)});function wE(e){return Jo(Od,e)}var Nd=y("ZodCUID2",(e,t)=>{Ec.init(e,t),Se.init(e,t)});function SE(e){return Yo(Nd,e)}var Dd=y("ZodULID",(e,t)=>{xc.init(e,t),Se.init(e,t)});function EE(e){return Xo(Dd,e)}var Md=y("ZodXID",(e,t)=>{Tc.init(e,t),Se.init(e,t)});function xE(e){return Qo(Md,e)}var Ld=y("ZodKSUID",(e,t)=>{Ac.init(e,t),Se.init(e,t)});function TE(e){return es(Ld,e)}var Bd=y("ZodIPv4",(e,t)=>{Cc.init(e,t),Se.init(e,t)});function AE(e){return ts(Bd,e)}var eb=y("ZodMAC",(e,t)=>{Ic.init(e,t),Se.init(e,t)});function CE(e){return Fu(eb,e)}var Ud=y("ZodIPv6",(e,t)=>{zc.init(e,t),Se.init(e,t)});function zE(e){return ns(Ud,e)}var Fd=y("ZodCIDRv4",(e,t)=>{Pc.init(e,t),Se.init(e,t)});function IE(e){return rs(Fd,e)}var qd=y("ZodCIDRv6",(e,t)=>{$c.init(e,t),Se.init(e,t)});function PE(e){return as(qd,e)}var Hd=y("ZodBase64",(e,t)=>{Oc.init(e,t),Se.init(e,t)});function RE(e){return is(Hd,e)}var Gd=y("ZodBase64URL",(e,t)=>{Dc.init(e,t),Se.init(e,t)});function $E(e){return os(Gd,e)}var Vd=y("ZodE164",(e,t)=>{Mc.init(e,t),Se.init(e,t)});function jE(e){return ss(Vd,e)}var tb=y("ZodCreditCard",(e,t)=>{Bc.init(e,t),Se.init(e,t)});function OE(e){return qu(tb,e)}var nb=y("ZodIBAN",(e,t)=>{Fc.init(e,t),Se.init(e,t)});function NE(e){return Hu(nb,e)}var Wd=y("ZodJWT",(e,t)=>{Hc.init(e,t),Se.init(e,t)});function DE(e){return ls(Wd,e)}var Wr=y("ZodCustomStringFormat",(e,t)=>{Gc.init(e,t),Se.init(e,t)});function ME(e,t,r={}){return rr(Wr,e,t,r)}function LE(e){return rr(Wr,"hostname",Ug,e)}function BE(e){return rr(Wr,"hex",nh,e)}function UE(e){return rr(Wr,"currency_code",Hg,e)}function FE(e,t){let r=t?.enc??"hex",a=`${e}_${r}`,n=Ct[a];if(!n)throw new Error(`Unrecognized hash format: ${a}`);return rr(Wr,a,n,t)}var di=y("ZodNumber",(e,t)=>{$o.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>af(e,r,a,n),e.isFinite=!0},E.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=Ue(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=Ue(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=Ue(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>Ue(e).format??null},{gt(e,t){return this.check(cn(e,t))},gte(e,t){return this.check(It(e,t))},min(e,t){return this.check(It(e,t))},lt(e,t){return this.check(ln(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},int(e){return this.check(Cd(e))},safe(e){return this.check(Cd(e))},positive(e){return this.check(cn(0,e))},nonnegative(e){return this.check(It(0,e))},negative(e){return this.check(ln(0,e))},nonpositive(e){return this.check(zt(0,e))},multipleOf(e,t){return this.check(tr(e,t))},step(e,t){return this.check(tr(e,t))},finite(){return this}}));function he(e){return Gu(di,e)}var Kr=y("ZodNumberFormat",(e,t)=>{Vc.init(e,t),di.init(e,t)});function Cd(e){return Vu(Kr,e)}function qE(e){return Wu(Kr,e)}function HE(e){return Ku(Kr,e)}function GE(e){return Zu(Kr,e)}function VE(e){return Ju(Kr,e)}var pi=y("ZodBoolean",(e,t)=>{Da.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>of(e,r,a,n)});function De(e){return Yu(pi,e)}var mi=y("ZodBigInt",(e,t)=>{jo.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>sf(e,r,a,n)},E.derived({minValue:e=>Ue(e).minimum??null,maxValue:e=>Ue(e).maximum??null,format:e=>Ue(e).format??null},{gte(e,t){return this.check(It(e,t))},min(e,t){return this.check(It(e,t))},gt(e,t){return this.check(cn(e,t))},lt(e,t){return this.check(ln(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},positive(e){return this.check(cn(BigInt(0),e))},negative(e){return this.check(ln(BigInt(0),e))},nonpositive(e){return this.check(zt(BigInt(0),e))},nonnegative(e){return this.check(It(BigInt(0),e))},multipleOf(e,t){return this.check(tr(e,t))}}));function WE(e){return Xu(mi,e)}var Kd=y("ZodBigIntFormat",(e,t)=>{Wc.init(e,t),mi.init(e,t)});function KE(e){return Qu(Kd,e)}function ZE(e){return ed(Kd,e)}var rb=y("ZodSymbol",(e,t)=>{Kc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>lf(e,r,a,n)});function JE(e){return td(rb,e)}var ab=y("ZodUndefined",(e,t)=>{Zc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>uf(e,r,a,n)});function YE(e){return nd(ab,e)}var ib=y("ZodNull",(e,t)=>{Jc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>cf(e,r,a,n)});function bs(e){return rd(ib,e)}var ob=y("ZodAny",(e,t)=>{Yc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>mf(e,r,a,n)});function XE(){return ad(ob)}var sb=y("ZodUnknown",(e,t)=>{Xc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>gf(e,r,a,n)});function xe(){return id(sb)}var lb=y("ZodNever",(e,t)=>{Qc.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>pf(e,r,a,n)});function Zd(e){return od(lb,e)}var cb=y("ZodVoid",(e,t)=>{eu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>df(e,r,a,n)});function QE(e){return sd(cb,e)}var vs=y("ZodDate",(e,t)=>{tu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>hf(e,r,a,n),e.min=(r,a)=>e.check(It(r,a)),e.max=(r,a)=>e.check(zt(r,a))},E.derived({minDate:e=>{let{minimum:t}=Ue(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=Ue(e);return t?new Date(t):null}},{}));function ex(e){return ld(vs,e)}var ub=y("ZodArray",(e,t)=>{Vr(),nu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Af(e,r,a,n),e.element=t.element},{min(e,t){return this.check(Cn(e,t))},nonempty(e){return this.check(Cn(1,e))},max(e,t){return this.check(qr(e,t))},length(e,t){return this.check(Hr(e,t))},unwrap(){return this.element}});function ae(e,t){return Xh(ub,e,t)}function tx(e){let t=e._zod.def.shape;return Ke(Object.keys(t))}var ys=y("ZodObject",(e,t)=>{Vr(),$h.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Cf(e,r,a,n),E.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ke(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(E.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(E.mergeDefs(this._zod.def,{catchall:xe()}))},loose(){return this.clone(E.mergeDefs(this._zod.def,{catchall:xe()}))},strict(){return this.clone(E.mergeDefs(this._zod.def,{catchall:Zd()}))},strip(){return this.clone(E.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return E.extend(this,e)},safeExtend(e){return E.safeExtend(this,e)},merge(e){return E.merge(this,e)},pick(e){return E.pick(this,e)},omit(e){return E.omit(this,e)},partial(...e){return E.partial(Zr,this,e[0])},exactPartial(...e){return E.partial(Yd,this,e[0],"exactPartial")},required(...e){return E.required(Xd,this,e[0])}});function O(e,t){let r={type:"object",shape:e??{},...E.normalizeParams(t)};return new ys(r)}function nx(e,t){return new ys({type:"object",shape:e,catchall:Zd(),...E.normalizeParams(t)})}function We(e,t){return new ys({type:"object",shape:e,catchall:xe(),...E.normalizeParams(t)})}var ks=y("ZodUnion",(e,t)=>{Ma.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sd(e,r,a,n),e.options=t.options});function ye(e,t){return new ks({type:"union",options:e,...E.normalizeParams(t)})}var db=y("ZodXor",(e,t)=>{ks.init(e,t),au.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sd(e,r,a,n),e.options=t.options});function rx(e,t){return new db({type:"union",options:e,inclusive:!1,...E.normalizeParams(t)})}var pb=y("ZodDiscriminatedUnion",(e,t)=>{ks.init(e,t),iu.init(e,t)});function _s(e,t,r){return new pb({type:"union",options:t,discriminator:e,...E.normalizeParams(r)})}var mb=y("ZodIntersection",(e,t)=>{ou.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>zf(e,r,a,n)});function gi(e,t){return new mb({type:"intersection",left:e,right:t})}var gb=y("ZodTuple",(e,t)=>{Vr(),Oo.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>If(e,r,a,n)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Zr({type:"optional",innerType:t}))})}});function hb(e,t,r){let a=t instanceof Z,n=a?r:t,i=a?t:null;return new gb({type:"tuple",items:e,rest:i,...E.normalizeParams(n)})}var li=y("ZodRecord",(e,t)=>{Vr(),su.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Pf(e,r,a,n),e.keyType=t.keyType,e.valueType=t.valueType});function Ee(e,t,r){return!t||!t._zod?new li({type:"record",keyType:w(),valueType:e,...E.normalizeParams(t)}):new li({type:"record",keyType:e,valueType:t,...E.normalizeParams(r)})}function ax(e,t,r){return new li({type:"record",keyType:e,valueType:t,...E.normalizeParams(r),partial:!0})}function ix(e,t,r){return new li({type:"record",keyType:e,valueType:t,mode:"loose",...E.normalizeParams(r)})}var fb=y("ZodMap",(e,t)=>{Vr(),lu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>xf(e,r,a,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(un(...r)),e.nonempty=r=>e.check(un(1,r)),e.max=(...r)=>e.check(nr(...r)),e.size=(...r)=>e.check(Fr(...r))});function ox(e,t,r){return new fb({type:"map",keyType:e,valueType:t,...E.normalizeParams(r)})}var bb=y("ZodSet",(e,t)=>{Vr(),cu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Tf(e,r,a,n),e.min=(...r)=>e.check(un(...r)),e.nonempty=r=>e.check(un(1,r)),e.max=(...r)=>e.check(nr(...r)),e.size=(...r)=>e.check(Fr(...r))});function sx(e,t){return new bb({type:"set",valueType:e,...E.normalizeParams(t)})}var ci=y("ZodEnum",(e,t)=>{uu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(a,n,i)=>ff(e,a,n,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(a,n)=>{let i={};for(let o of a)if(r.has(o))i[o]=t.entries[o];else throw new Error(`Key ${o} not found in enum`);return new ci({...t,checks:[],...E.normalizeParams(n),entries:i})},e.exclude=(a,n)=>{let i={...t.entries};for(let o of a)if(r.has(o))delete i[o];else throw new Error(`Key ${o} not found in enum`);return new ci({...t,checks:[],...E.normalizeParams(n),entries:i})}});function Ke(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new ci({type:"enum",entries:r,...E.normalizeParams(t)})}function lx(e,t){return new ci({type:"enum",entries:e,...E.normalizeParams(t)})}var vb=y("ZodLiteral",(e,t)=>{du.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>bf(e,r,a,n),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 B(e,t){return new vb({type:"literal",values:Array.isArray(e)?e:[e],...E.normalizeParams(t)})}var yb=y("ZodFile",(e,t)=>{pu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>kf(e,r,a,n),e.min=(r,a)=>e.check(un(r,a)),e.max=(r,a)=>e.check(nr(r,a)),e.mime=(r,a)=>e.check(Qa(Array.isArray(r)?r:[r],a))});function cx(e){return hd(yb,e)}var kb=y("ZodTransform",(e,t)=>{Vr(),mu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ef(e,r,a,n),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new Xn(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(E.issue(i,r.value,t));else{let o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),"input"in o||(o.input=r.value),o.inst??(o.inst=e),r.issues.push(E.issue(o))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function Jd(e){return new kb({type:"transform",transform:e})}var Zr=y("ZodOptional",(e,t)=>{No.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ed(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function we(e){return new Zr({type:"optional",innerType:e})}var Yd=y("ZodExactOptional",(e,t)=>{gu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ed(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function _b(e){return new Yd({type:"optional",innerType:e})}var wb=y("ZodNullable",(e,t)=>{hu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Rf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function hs(e){return new wb({type:"nullable",innerType:e})}function ux(e){return we(hs(e))}var Sb=y("ZodDefault",(e,t)=>{fu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Of(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Eb(e,t){return new Sb({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():E.shallowClone(t)}})}var xb=y("ZodPrefault",(e,t)=>{bu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Nf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function Tb(e,t){return new xb({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():E.shallowClone(t)}})}var Xd=y("ZodNonOptional",(e,t)=>{vu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>$f(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function Ab(e,t){return new Xd({type:"nonoptional",innerType:e,...E.normalizeParams(t)})}var Cb=y("ZodSuccess",(e,t)=>{yu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>_f(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function dx(e){return new Cb({type:"success",innerType:e})}var zb=y("ZodCatch",(e,t)=>{ku.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Df(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ib(e,t){return new zb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:E.constantCatch(t)})}var Pb=y("ZodNaN",(e,t)=>{_u.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>vf(e,r,a,n)});function px(e){return cd(Pb,e)}var ws=y("ZodPipe",(e,t)=>{Do.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Mf(e,r,a,n),e.in=t.in,e.out=t.out});function zd(e,t){return new ws({type:"pipe",in:e,out:t})}var Ss=y("ZodCodec",(e,t)=>{ws.init(e,t),La.init(e,t)});function mx(e,t,r){return new Ss({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function gx(e){let t=e._zod.def;return new Ss({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Rb=y("ZodPreprocess",(e,t)=>{ws.init(e,t),Oh.init(e,t)}),$b=y("ZodReadonly",(e,t)=>{wu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Lf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function jb(e){return new $b({type:"readonly",innerType:e})}var Ob=y("ZodTemplateLiteral",(e,t)=>{Su.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>yf(e,r,a,n)});function hx(e,t){return new Ob({type:"template_literal",parts:e,...E.normalizeParams(t)})}var Nb=y("ZodLazy",(e,t)=>{Ba.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Uf(e,r,a,n),e.unwrap=()=>e._zod.def.getter()});function Db(e){return new Nb({type:"lazy",getter:e})}var Mb=y("ZodPromise",(e,t)=>{xu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Bf(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function fx(e){return new Mb({type:"promise",innerType:e})}var Lb=y("ZodFunction",(e,t)=>{Eu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sf(e,r,a,n)});function bx(e){return new Lb({type:"function",input:Array.isArray(e?.input)?hb(e?.input):e?.input??ae(xe()),output:e?.output??xe()})}var Es=y("ZodCustom",(e,t)=>{Tu.init(e,t),Y.init(e,t),e._zod.processJSONSchema=(r,a,n)=>wf(e,r,a,n)});function vx(e){let t=new _e({check:"custom"});return t._zod.check=e,t}function Qd(e,t){return fd(Es,e??(()=>!0),t)}function Bb(e,t={}){return bd(Es,e,t)}function Ub(e,t){return vd(e,t)}var yx=yd,kx=kd,Fb=y("ZodInstanceOf",(e,t)=>{Es.init(e,t)},{properties(e,t){return this.check(Xa(e,t))}});function _x(e,t={}){let r=new Fb({type:"custom",check:"custom",fn:a=>a instanceof e,abort:!0,...E.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=a=>{a.value instanceof e||a.issues.push({code:"invalid_type",expected:e.name,input:a.value,inst:r,path:[...r._zod.def.path??[]]})},r}var wx=(...e)=>_d({Codec:Ss,Boolean:pi,String:ui},...e);function Sx(e){let t=Db(()=>ye([w(e),he(),De(),bs(),ae(t),Ee(w(),t)]));return t}function xs(e,t){return new Rb({type:"pipe",in:Jd(e),out:t})}var m0={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function g0(e){Oe({customError:e})}function h0(){return Oe().customError}var qb;qb||(qb={});var Jr={};En(Jr,{ZodISODate:()=>lr,ZodISODateTime:()=>sr,ZodISODuration:()=>ur,ZodISOTime:()=>cr,date:()=>b0,datetime:()=>f0,duration:()=>y0,time:()=>v0});function f0(e){return cs(sr,e)}function b0(e){return us(lr,e)}function v0(e){return ds(cr,e)}function y0(e){return ps(ur,e)}var $={...hi,...Td,iso:Jr},k0=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function _0(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Ex(e,t){return e.map((r,a)=>a<t?r:r.optional())}function w0(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function S0(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let a=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===a){let n=r[1]===void 0?void 0:w0(r[1]);if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function E0(e,t){return $.transform(a=>a).check(a=>{let n=a.value;if(typeof n!="object"||n===null||Array.isArray(n))return;let i=Object.getOwnPropertyNames(n);if(t.minProperties!==void 0&&i.length<t.minProperties&&a.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:n,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&a.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:n,inst:e,continue:!0}),t.keySchema)for(let o of i){let s=t.keySchema.safeParse(o);s.success||a.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:o,path:[o],continue:!0})}}).pipe(e)}function Hb(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let a=String(e);return`${r[0]}${a.length}:${a}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let o of e){let s=Hb(o,t);if(s===null)return null;i.push(s)}return`a${i.length}:[${i.join(",")}]`}let a=Object.keys(e).sort(),n=[];for(let i of a){let o=Hb(e[i],t);if(o===null)return null;n.push(`${i.length}:${i}=${o}`)}return`o${n.length}:{${n.join(",")}}`}finally{t.delete(e)}}var x0=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),T0=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Ts(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Ts):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>x0.has(t)?Ts(r):!T0.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Ts))}function xx(e){return e===1?"element":"elements"}function A0(e,t){return $.transform(a=>a).check(a=>{let n=a.value;if(Array.isArray(n)){if(t.uniqueItems===!0){let i=new Map;for(let o=0;o<n.length;o++){let s=Hb(n[o],new Set);if(s===null)continue;let l=i.get(s);if(l===void 0){i.set(s,o);continue}a.issues.push({code:"custom",message:`Array items must be unique: element at index ${o} duplicates the one at index ${l}`,input:n,path:[o],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,o=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,s=0;for(let l of n)if(t.containsSchema.safeParse(l).success&&++s>=o)break;s<i&&a.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${xx(i)}; found ${s}`,input:n,continue:!0}),t.maxContains!==void 0&&s>t.maxContains&&a.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${xx(t.maxContains)}`,input:n,continue:!0})}}}).pipe(e)}function Tx(e,t){if(e!==!1)return e===void 0||e===!0?$.any():pt(e,t)}var C0=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ax(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return $.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return $.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=S0(n,t),o=pt(i,t);return t.refs.set(n,o),t.processing.delete(n),o}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return $.null();if(n.length===0)return $.never();if(n.length===1)return $.literal(n[0]);if(n.every(o=>typeof o=="string"))return $.enum(n);let i=n.map(o=>$.literal(o));return i.length<2?i[0]:$.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return $.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map(i=>{let o={...e,type:i};return Ax(o,t)});return n.length===0?$.never():n.length===1?n[0]:$.union(n)}if(!r)return $.any();let a;switch(r){case"string":{let n=$.string();if(e.format){let i=e.format;i==="email"?n=n.check($.email()):i==="uri"||i==="uri-reference"?n=n.check($.url()):i==="uuid"||i==="guid"?n=n.check($.uuid()):i==="date-time"?n=n.check($.iso.datetime({offset:!0})):i==="date"?n=n.check($.iso.date()):i==="time"?n=n.check($.regex(C0)):i==="duration"?n=n.check($.iso.duration()):i==="hostname"?n=n.check($.hostname()):i==="ipv4"?n=n.check($.ipv4()):i==="ipv6"?n=n.check($.ipv6()):i==="mac"?n=n.check($.mac()):i==="cidr"?n=n.check($.cidrv4()):i==="cidr-v6"?n=n.check($.cidrv6()):i==="base64"?n=n.check($.base64()):i==="base64url"?n=n.check($.base64url()):i==="e164"?n=n.check($.e164()):i==="credit_card"?n=n.check($.creditCard()):i==="iban"?n=n.check($.iban()):i==="jwt"?n=n.check($.jwt()):i==="emoji"?n=n.check($.emoji()):i==="nanoid"?n=n.check($.nanoid()):i==="cuid"?n=n.check($.cuid()):i==="cuid2"?n=n.check($.cuid2()):i==="ulid"?n=n.check($.ulid()):i==="xid"?n=n.check($.xid()):i==="ksuid"&&(n=n.check($.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),a=n;break}case"number":case"integer":{let n=r==="integer"?$.number().int():$.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),a=n;break}case"boolean":{a=$.boolean();break}case"null":{a=$.null();break}case"object":{let n={},i=e.properties||{},o=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?pt(e.additionalProperties,t):void 0;for(let[d,m]of Object.entries(i)){let p=pt(m,t);Ge(n,d,o.has(d)?p:p.optional())}if(e.patternProperties){let d=e.patternProperties,m=Object.keys(d),p=[];for(let h of m){let f=pt(d[h],t),k=$.string().regex(new RegExp(h));p.push($.looseRecord(k,f))}let g=[];if(Object.keys(n).length>0&&g.push($.object(n).passthrough()),g.push(...p),g.length===0)a=$.object({}).passthrough();else if(g.length===1)a=g[0];else{let h=$.intersection(g[0],g[1]);for(let f=2;f<g.length;f++)h=$.intersection(h,g[f]);a=h}if(e.additionalProperties===!1){let h=Object.keys(n),f=m.map(b=>new RegExp(b)),k=a;a=a.check(b=>{if(!Dt(b.value))return;let v=[];for(let C of Object.keys(b.value))h.includes(C)||f.some(S=>S.test(C))||v.push(C);v.length&&b.issues.push({code:"unrecognized_keys",keys:v,input:b.value,inst:k})})}}else{let d=$.object(n);e.additionalProperties===!1?a=d.strict():s?a=d.catchall(s):a=d.passthrough()}let l=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,u=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(l||c!==void 0||u!==void 0){let d;if(l){let m=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=pt(m,t)}a=E0(a,{keySchema:d,minProperties:c,maxProperties:u})}break}case"array":{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let o=typeof e.minItems=="number"?e.minItems:0,s=n.map(d=>pt(d,t)),l=Ex(s,o),c=Array.isArray(i)?void 0:Tx(i,t),u=$.tuple(l);a=c?u.rest(c):u,typeof e.minItems=="number"&&(a=a.check($.minLength(e.minItems))),typeof e.maxItems=="number"&&(a=a.check($.maxLength(e.maxItems)))}else if(Array.isArray(i)){let o=typeof e.minItems=="number"?e.minItems:0,s=i.map(d=>pt(d,t)),l=Ex(s,o),c=Tx(e.additionalItems,t),u=$.tuple(l);a=c?u.rest(c):u,typeof e.minItems=="number"&&(a=a.check($.minLength(e.minItems))),typeof e.maxItems=="number"&&(a=a.check($.maxLength(e.maxItems)))}else if(i!==void 0){let o=pt(i,t),s=$.array(o);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),a=s}else a=$.array($.any());(e.uniqueItems===!0||e.contains!==void 0)&&(a=A0(a,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?pt(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return a}function pt(e,t){if(typeof e=="boolean")return e?$.any():$.never();let r=Ax(e,t),a=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(c=>pt(c,t)),l=$.union(s);r=a?$.intersection(r,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(c=>pt(c,t)),l=$.xor(s);r=a?$.intersection(r,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=a?r:$.any();else{let s=a?r:pt(e.allOf[0],t),l=a?0:1;for(let c=l;c<e.allOf.length;c++)s=$.intersection(s,pt(e.allOf[c],t));r=s}e.nullable===!0&&t.version==="openapi-3.0"&&(r=$.nullable(r)),e.readOnly===!0&&(r=$.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)s in e&&(n[s]=e[s]);let o=["contentEncoding","contentMediaType","contentSchema"];for(let s of o)s in e&&(n[s]=e[s]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Ts(e.propertyNames)&&(n.propertyNames=e.propertyNames);for(let s of["minProperties","maxProperties"])e[s]!==void 0&&(n[s]=e[s])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Ts(e.contains)&&(n.contains=e.contains);for(let s of["uniqueItems","minContains","maxContains"])e[s]!==void 0&&(n[s]=e[s])}for(let s of Object.keys(e))k0.has(s)||Ge(n,s,e[s]);return Object.keys(n).length>0&&t.registry.add(r,n),e.description&&(r=r.describe(e.description)),r}function Cx(e,t){if(typeof e=="boolean")return e?$.any():$.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let a=_0(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:a,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Ve};return pt(r,i)}var zx=Symbol("z.visit/resolving");function As(e,t){let r=typeof t=="function"?t:(o,s)=>{let l=t[o._zod.def.type];return l?l(o,s):o},a=new Map;function n(o){let s=a.get(o);if(s===zx)return new Ba({type:"lazy",getter:()=>a.get(o)});if(s!==void 0)return s;a.set(o,zx);let l=i(o),c=r(l,l!==o);return a.set(o,c),c}function i(o){let s=o._zod.def,l=s.type;switch(l){case"object":{let c=s.shape,u=Object.keys(c),d=!1,m={};for(let g of u){let h=n(c[g]);h!==c[g]&&(d=!0),m[g]=h}let p=s.catchall;return s.catchall&&(p=n(s.catchall),p!==s.catchall&&(d=!0)),d?ge(o,{...s,shape:m,catchall:p}):o}case"array":{let c=n(s.element);return c===s.element?o:ge(o,{...s,element:c})}case"tuple":{let c=s.items,u=!1,d=[];for(let p of c){let g=n(p);g!==p&&(u=!0),d.push(g)}let m=s.rest;return s.rest&&(m=n(s.rest),m!==s.rest&&(u=!0)),u?ge(o,{...s,items:d,rest:m}):o}case"record":case"map":{let c=n(s.keyType),u=n(s.valueType);return c===s.keyType&&u===s.valueType?o:ge(o,{...s,keyType:c,valueType:u})}case"set":{let c=n(s.valueType);return c===s.valueType?o:ge(o,{...s,valueType:c})}case"union":{let c=s.options,u=!1,d=[];for(let m of c){let p=n(m);p!==m&&(u=!0),d.push(p)}return u?ge(o,{...s,options:d}):o}case"intersection":{let c=n(s.left),u=n(s.right);return c===s.left&&u===s.right?o:ge(o,{...s,left:c,right:u})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=n(s.innerType);return c===s.innerType?o:ge(o,{...s,innerType:c})}case"pipe":{let c=n(s.in),u=n(s.out);return c===s.in&&u===s.out?o:ge(o,{...s,in:c,out:u})}case"function":{let c=n(s.input),u=n(s.output);return c===s.input&&u===s.output?o:ge(o,{...s,input:c,output:u})}case"lazy":{let c=s.getter,{_cachedInner:u,...d}=s;return ge(o,{...d,getter:()=>n(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return o;default:return o}}return n(e)}function Ix(e){return As(e,{object:t=>t.partial(),union:t=>{let r=t._zod.def;return r.discriminator===void 0?t:ye(r.options)}})}function z0(e,t){if(!t?.length)return e;let r=e._zod.def;return ge(e,Nt(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function Px(e){return z0(e.out,e.checks)}function I0(e){return e.in._zod.traits.has("$ZodTransform")?Px(e):e.in}function Rx(e){return As(e,{pipe:t=>I0(t._zod.def),default:(t,r)=>r?we(t._zod.def.innerType):t,catch:(t,r)=>r?t._zod.def.innerType:t})}function $x(e){return As(e,{pipe:t=>Px(t._zod.def),prefault:(t,r)=>r?t._zod.def.innerType:t})}var Gb={};En(Gb,{bigint:()=>j0,boolean:()=>$0,date:()=>O0,number:()=>R0,string:()=>P0});function P0(e){return Vh(ui,e)}function R0(e){return Kh(di,e)}function $0(e){return Zh(pi,e)}function j0(e){return Jh(mi,e)}function O0(e){return Yh(vs,e)}var Wb="2025-11-25",jx="2025-03-26",bi=[Wb,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],dr="io.modelcontextprotocol/related-task",tp="2.0",Fe=Qd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ox=ye([w(),he().int()]),Nx=w(),kV=We({ttl:he().optional(),pollInterval:he().optional()}),N0=O({ttl:he().optional()}),D0=O({taskId:w()}),Kb=We({progressToken:Ox.optional(),[dr]:D0.optional()}),Pt=O({_meta:Kb.optional()}),Cs=Pt.extend({task:N0.optional()}),Dx=e=>Cs.safeParse(e).success,Ze=O({method:w(),params:Pt.loose().optional()}),Lt=O({_meta:Kb.optional()}),Bt=O({method:w(),params:Lt.loose().optional()}),Je=We({_meta:Kb.optional()}),np=ye([w(),he().int()]),Mx=O({jsonrpc:B(tp),id:np,...Ze.shape}).strict(),zn=e=>Mx.safeParse(e).success,Lx=O({jsonrpc:B(tp),...Bt.shape}).strict(),Bx=e=>Lx.safeParse(e).success,Zb=O({jsonrpc:B(tp),id:np,result:Je}).strict(),In=e=>Zb.safeParse(e).success;var F;(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"})(F||(F={}));var Jb=O({jsonrpc:B(tp),id:np.optional(),error:O({code:he().int(),message:w(),data:xe().optional()})}).strict();var vi=e=>Jb.safeParse(e).success;var zs=ye([Mx,Lx,Zb,Jb]),_V=ye([Zb,Jb]),rp=Je.strict(),M0=Lt.extend({requestId:np.optional(),reason:w().optional()}),ap=Bt.extend({method:B("notifications/cancelled"),params:M0}),L0=O({src:w(),mimeType:w().optional(),sizes:ae(w()).optional(),theme:Ke(["light","dark"]).optional()}),Is=O({icons:ae(L0).optional()}),fi=O({name:w(),title:w().optional()}),Ux=fi.extend({...fi.shape,...Is.shape,version:w(),websiteUrl:w().optional(),description:w().optional()}),B0=gi(O({applyDefaults:De().optional()}),Ee(w(),xe())),U0=xs(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,gi(O({form:B0.optional(),url:Fe.optional()}),Ee(w(),xe()).optional())),F0=We({list:Fe.optional(),cancel:Fe.optional(),requests:We({sampling:We({createMessage:Fe.optional()}).optional(),elicitation:We({create:Fe.optional()}).optional()}).optional()}),q0=We({list:Fe.optional(),cancel:Fe.optional(),requests:We({tools:We({call:Fe.optional()}).optional()}).optional()}),H0=O({experimental:Ee(w(),Fe).optional(),sampling:O({context:Fe.optional(),tools:Fe.optional()}).optional(),elicitation:U0.optional(),roots:O({listChanged:De().optional()}).optional(),tasks:F0.optional(),extensions:Ee(w(),Fe).optional()}),G0=Pt.extend({protocolVersion:w(),capabilities:H0,clientInfo:Ux}),ip=Ze.extend({method:B("initialize"),params:G0}),Yb=e=>ip.safeParse(e).success,V0=O({experimental:Ee(w(),Fe).optional(),logging:Fe.optional(),completions:Fe.optional(),prompts:O({listChanged:De().optional()}).optional(),resources:O({subscribe:De().optional(),listChanged:De().optional()}).optional(),tools:O({listChanged:De().optional()}).optional(),tasks:q0.optional(),extensions:Ee(w(),Fe).optional()}),W0=Je.extend({protocolVersion:w(),capabilities:V0,serverInfo:Ux,instructions:w().optional()}),Xb=Bt.extend({method:B("notifications/initialized"),params:Lt.optional()});var op=Ze.extend({method:B("ping"),params:Pt.optional()}),K0=O({progress:he(),total:we(he()),message:we(w())}),Z0=O({...Lt.shape,...K0.shape,progressToken:Ox}),sp=Bt.extend({method:B("notifications/progress"),params:Z0}),J0=Pt.extend({cursor:Nx.optional()}),Ps=Ze.extend({params:J0.optional()}),Rs=Je.extend({nextCursor:Nx.optional()}),Y0=Ke(["working","input_required","completed","failed","cancelled"]),$s=O({taskId:w(),status:Y0,ttl:ye([he(),bs()]),createdAt:w(),lastUpdatedAt:w(),pollInterval:we(he()),statusMessage:we(w())}),yi=Je.extend({task:$s}),X0=Lt.merge($s),js=Bt.extend({method:B("notifications/tasks/status"),params:X0}),lp=Ze.extend({method:B("tasks/get"),params:Pt.extend({taskId:w()})}),cp=Je.merge($s),up=Ze.extend({method:B("tasks/result"),params:Pt.extend({taskId:w()})}),wV=Je.loose(),dp=Ps.extend({method:B("tasks/list")}),pp=Rs.extend({tasks:ae($s)}),mp=Ze.extend({method:B("tasks/cancel"),params:Pt.extend({taskId:w()})}),Fx=Je.merge($s),qx=O({uri:w(),mimeType:we(w()),_meta:Ee(w(),xe()).optional()}),Hx=qx.extend({text:w()}),Qb=w().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Gx=qx.extend({blob:Qb}),Os=Ke(["user","assistant"]),ki=O({audience:ae(Os).optional(),priority:he().min(0).max(1).optional(),lastModified:Jr.datetime({offset:!0}).optional()}),Vx=O({...fi.shape,...Is.shape,uri:w(),description:we(w()),mimeType:we(w()),size:we(he()),annotations:ki.optional(),_meta:we(We({}))}),Q0=O({...fi.shape,...Is.shape,uriTemplate:w(),description:we(w()),mimeType:we(w()),annotations:ki.optional(),_meta:we(We({}))}),gp=Ps.extend({method:B("resources/list")}),ej=Rs.extend({resources:ae(Vx)}),hp=Ps.extend({method:B("resources/templates/list")}),tj=Rs.extend({resourceTemplates:ae(Q0)}),ev=Pt.extend({uri:w()}),nj=ev,fp=Ze.extend({method:B("resources/read"),params:nj}),rj=Je.extend({contents:ae(ye([Hx,Gx]))}),aj=Bt.extend({method:B("notifications/resources/list_changed"),params:Lt.optional()}),ij=ev,oj=Ze.extend({method:B("resources/subscribe"),params:ij}),sj=ev,lj=Ze.extend({method:B("resources/unsubscribe"),params:sj}),cj=Lt.extend({uri:w()}),uj=Bt.extend({method:B("notifications/resources/updated"),params:cj}),dj=O({name:w(),description:we(w()),required:we(De())}),pj=O({...fi.shape,...Is.shape,description:we(w()),arguments:we(ae(dj)),_meta:we(We({}))}),bp=Ps.extend({method:B("prompts/list")}),mj=Rs.extend({prompts:ae(pj)}),gj=Pt.extend({name:w(),arguments:Ee(w(),w()).optional()}),vp=Ze.extend({method:B("prompts/get"),params:gj}),tv=O({type:B("text"),text:w(),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),nv=O({type:B("image"),data:Qb,mimeType:w(),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),rv=O({type:B("audio"),data:Qb,mimeType:w(),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),hj=O({type:B("tool_use"),name:w(),id:w(),input:Ee(w(),xe()),_meta:Ee(w(),xe()).optional()}),fj=O({type:B("resource"),resource:ye([Hx,Gx]),annotations:ki.optional(),_meta:Ee(w(),xe()).optional()}),bj=Vx.extend({type:B("resource_link")}),av=ye([tv,nv,rv,bj,fj]),vj=O({role:Os,content:av}),yj=Je.extend({description:w().optional(),messages:ae(vj)}),kj=Bt.extend({method:B("notifications/prompts/list_changed"),params:Lt.optional()}),_j=O({title:w().optional(),readOnlyHint:De().optional(),destructiveHint:De().optional(),idempotentHint:De().optional(),openWorldHint:De().optional()}),wj=O({taskSupport:Ke(["required","optional","forbidden"]).optional()}),Wx=O({...fi.shape,...Is.shape,description:w().optional(),inputSchema:O({type:B("object"),properties:Ee(w(),Fe).optional(),required:ae(w()).optional()}).catchall(xe()),outputSchema:O({type:B("object"),properties:Ee(w(),Fe).optional(),required:ae(w()).optional()}).catchall(xe()).optional(),annotations:_j.optional(),execution:wj.optional(),_meta:Ee(w(),xe()).optional()}),yp=Ps.extend({method:B("tools/list")}),Sj=Rs.extend({tools:ae(Wx)}),kp=Je.extend({content:ae(av).default([]),structuredContent:Ee(w(),xe()).optional(),isError:De().optional()}),SV=kp.or(Je.extend({toolResult:xe()})),Ej=Cs.extend({name:w(),arguments:Ee(w(),xe()).optional()}),_i=Ze.extend({method:B("tools/call"),params:Ej}),xj=Bt.extend({method:B("notifications/tools/list_changed"),params:Lt.optional()}),EV=O({autoRefresh:De().default(!0),debounceMs:he().int().nonnegative().default(300)}),Ns=Ke(["debug","info","notice","warning","error","critical","alert","emergency"]),Tj=Pt.extend({level:Ns}),iv=Ze.extend({method:B("logging/setLevel"),params:Tj}),Aj=Lt.extend({level:Ns,logger:w().optional(),data:xe()}),Cj=Bt.extend({method:B("notifications/message"),params:Aj}),zj=O({name:w().optional()}),Ij=O({hints:ae(zj).optional(),costPriority:he().min(0).max(1).optional(),speedPriority:he().min(0).max(1).optional(),intelligencePriority:he().min(0).max(1).optional()}),Pj=O({mode:Ke(["auto","required","none"]).optional()}),Rj=O({type:B("tool_result"),toolUseId:w().describe("The unique identifier for the corresponding tool call."),content:ae(av).default([]),structuredContent:O({}).loose().optional(),isError:De().optional(),_meta:Ee(w(),xe()).optional()}),$j=_s("type",[tv,nv,rv]),ep=_s("type",[tv,nv,rv,hj,Rj]),jj=O({role:Os,content:ye([ep,ae(ep)]),_meta:Ee(w(),xe()).optional()}),Oj=Cs.extend({messages:ae(jj),modelPreferences:Ij.optional(),systemPrompt:w().optional(),includeContext:Ke(["none","thisServer","allServers"]).optional(),temperature:he().optional(),maxTokens:he().int(),stopSequences:ae(w()).optional(),metadata:Fe.optional(),tools:ae(Wx).optional(),toolChoice:Pj.optional()}),Nj=Ze.extend({method:B("sampling/createMessage"),params:Oj}),Ds=Je.extend({model:w(),stopReason:we(Ke(["endTurn","stopSequence","maxTokens"]).or(w())),role:Os,content:$j}),ov=Je.extend({model:w(),stopReason:we(Ke(["endTurn","stopSequence","maxTokens","toolUse"]).or(w())),role:Os,content:ye([ep,ae(ep)])}),Dj=O({type:B("boolean"),title:w().optional(),description:w().optional(),default:De().optional()}),Mj=O({type:B("string"),title:w().optional(),description:w().optional(),minLength:he().optional(),maxLength:he().optional(),format:Ke(["email","uri","date","date-time"]).optional(),default:w().optional()}),Lj=O({type:Ke(["number","integer"]),title:w().optional(),description:w().optional(),minimum:he().optional(),maximum:he().optional(),default:he().optional()}),Bj=O({type:B("string"),title:w().optional(),description:w().optional(),enum:ae(w()),default:w().optional()}),Uj=O({type:B("string"),title:w().optional(),description:w().optional(),oneOf:ae(O({const:w(),title:w()})),default:w().optional()}),Fj=O({type:B("string"),title:w().optional(),description:w().optional(),enum:ae(w()),enumNames:ae(w()).optional(),default:w().optional()}),qj=ye([Bj,Uj]),Hj=O({type:B("array"),title:w().optional(),description:w().optional(),minItems:he().optional(),maxItems:he().optional(),items:O({type:B("string"),enum:ae(w())}),default:ae(w()).optional()}),Gj=O({type:B("array"),title:w().optional(),description:w().optional(),minItems:he().optional(),maxItems:he().optional(),items:O({anyOf:ae(O({const:w(),title:w()}))}),default:ae(w()).optional()}),Vj=ye([Hj,Gj]),Wj=ye([Fj,qj,Vj]),Kj=ye([Wj,Dj,Mj,Lj]),Zj=Cs.extend({mode:B("form").optional(),message:w(),requestedSchema:O({type:B("object"),properties:Ee(w(),Kj),required:ae(w()).optional()})}),Jj=Cs.extend({mode:B("url"),message:w(),elicitationId:w(),url:w().url()}),Yj=ye([Zj,Jj]),Xj=Ze.extend({method:B("elicitation/create"),params:Yj}),Qj=Lt.extend({elicitationId:w()}),eO=Bt.extend({method:B("notifications/elicitation/complete"),params:Qj}),wi=Je.extend({action:Ke(["accept","decline","cancel"]),content:xs(e=>e===null?void 0:e,Ee(w(),ye([w(),he(),De(),ae(w())])).optional())}),tO=O({type:B("ref/resource"),uri:w()});var nO=O({type:B("ref/prompt"),name:w()}),rO=Pt.extend({ref:ye([nO,tO]),argument:O({name:w(),value:w()}),context:O({arguments:Ee(w(),w()).optional()}).optional()}),_p=Ze.extend({method:B("completion/complete"),params:rO});function Kx(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Zx(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var aO=Je.extend({completion:We({values:ae(w()).max(100),total:we(he().int()),hasMore:we(De())})}),iO=O({uri:w().startsWith("file://"),name:w().optional(),_meta:Ee(w(),xe()).optional()}),oO=Ze.extend({method:B("roots/list"),params:Pt.optional()}),sv=Je.extend({roots:ae(iO)}),sO=Bt.extend({method:B("notifications/roots/list_changed"),params:Lt.optional()}),xV=ye([op,ip,_p,iv,vp,bp,gp,hp,fp,oj,lj,_i,yp,lp,up,dp,mp]),TV=ye([ap,sp,Xb,sO,js]),AV=ye([rp,Ds,ov,wi,sv,cp,pp,yi]),CV=ye([op,Nj,Xj,oO,lp,up,dp,mp]),zV=ye([ap,sp,Cj,uj,aj,xj,kj,js,eO]),IV=ye([rp,W0,aO,yj,mj,ej,tj,rj,kp,Sj,cp,pp,yi]),M=class e extends Error{constructor(t,r,a){super(`MCP error ${t}: ${r}`),this.code=t,this.data=a,this.name="McpError"}static fromError(t,r,a){if(t===F.UrlElicitationRequired&&a){let n=a;if(n.elicitations)return new Vb(n.elicitations,r)}return new e(t,r,a)}},Vb=class extends M{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(F.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};var lO=10*1024*1024,wp=class{constructor(t){this._maxBufferSize=t?.maxBufferSize??lO}append(t){if((this._buffer?.length??0)+t.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
71
71
|
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),cO(r)}clear(){this._buffer=void 0}};function cO(e){return zs.parse(JSON.parse(e))}function Jx(e){return JSON.stringify(e)+`
|
|
72
|
-
`}var Sp=class{constructor(t=Yx.stdin,r=Yx.stdout,a){this._stdin=t,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(i){this.onerror?.(i),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new wp({maxBufferSize:a?.maxBufferSize})}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 a=Jx(t);this._stdout.write(a)?r():this._stdout.once("drain",r)})}};var Xx="x-hono-already-sent";import{STATUS_CODES as LV,ServerResponse as uO,createServer as BV}from"node:http";import{Http2ServerRequest as $n,constants as dO}from"node:http2";import{Readable as eT}from"node:stream";var Qx=e=>((...t)=>{if(typeof t[0]=="function"){let[r,a]=t;return async function(i,o){let s=await e(i,await r(i),a);if(s)return s;await o()}}else{let[r,a,n]=t;return(async()=>{let i=await e(r,a,n);if(!i)throw new Error("Failed to upgrade WebSocket");return i})()}});var pn=class extends Error{constructor(e,t){super(e,t),this.name="RequestError"}},pO=new Set(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","server","user-agent"]),mO=/^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/,Ep=e=>e===9||e===10||e===13||e===32,tT=e=>{if(!Ep(e.charCodeAt(0))&&!Ep(e.charCodeAt(e.length-1)))return e;let t=0,r=e.length;for(;t<r&&Ep(e.charCodeAt(t));)t++;for(;r>t&&Ep(e.charCodeAt(r-1));)r--;return e.slice(t,r)},nT=/[\0\r\n]/,fv=globalThis.Headers,cT=(e,t=fv)=>{let r=new t;for(let a=0;a<e.length;a+=2){let n=e[a];n.startsWith(":")||r.append(n,e[a+1])}return r},bv=class{#e;#t;#r;#a;constructor(e){this.#e=e,e instanceof $n&&(this.#t=e.rawHeaders.slice())}get#i(){return this.#t??=this.#e.rawHeaders.slice()}get#n(){return this.#r||(this.#r=cT(this.#i),this.#t=void 0),this.#r}#o(e){if(typeof e=="string"){if(!mO.test(e))throw new TypeError(`Invalid header name: ${e}`);return e.toLowerCase()}}#s(e){let t=this.#e instanceof $n?void 0:this.#e.headers;if(!t||pO.has(e)||e==="set-cookie"||e==="__proto__")return;if(!Object.hasOwn(t,e))return null;let r=t[e];if(typeof r=="string"){let a=tT(r);return nT.test(a)?void 0:a}}#l(e,t){let r=t==="cookie"?"; ":", ",a=null;for(let n=0;n<e.length;n+=2){let i=e[n];if(i.length===t.length&&i.toLowerCase()===t){let o=tT(e[n+1]);if(nT.test(o)){this.#a=!0;return}a=a===null?o:a+r+o}}return a}append(e,t){this.#n.append(e,t)}delete(e){this.#n.delete(e)}get(e){let t=this.#o(e);if(t&&!this.#r&&!this.#a){let r=this.#s(t);if(r!==void 0)return r;let a=this.#l(this.#i,t);if(a!==void 0)return a}return this.#n.get(e)}has(e){let t=this.#o(e);if(t&&!this.#r&&!this.#a){let r=this.#s(t);if(r!==void 0)return r!==null;let a=this.#l(this.#i,t);if(a!==void 0)return a!==null}return this.#n.has(e)}set(e,t){this.#n.set(e,t)}getSetCookie(){return this.#n.getSetCookie()}keys(){return this.#n.keys()}values(){return this.#n.values()}entries(){return this.#n.entries()}forEach(e,t){this.#n.forEach((r,a)=>{e.call(t,r,a,this)})}[Symbol.iterator](){return this.entries()}};Object.defineProperty(bv.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){return`Headers (lightweight) ${r(Object.fromEntries(this),{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(bv.prototype,fv.prototype);var uT=e=>globalThis.Headers===fv?new bv(e):cT(e.rawHeaders,globalThis.Headers),gO=/^\/[!#$&-;=?-\[\]_a-z~]*$/,hO=/\/\.\.?(?:[/?#]|$)/,fO=/^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/,bO=(e,t,r)=>{let a=`${e}://${t}${r}`;if(fO.test(t)){if(r.length===0)return a+"/";if(r.charCodeAt(0)!==47)throw new pn("Invalid URL");return!gO.test(r)||hO.test(r)?new URL(a).href:a}else{let n=new URL(a);if(n.hostname.length!==t.length&&n.hostname!==(t.includes(":")?t.replace(/:\d+$/,""):t).toLowerCase())throw new pn("Invalid host header");return n.href}},vO=e=>e instanceof pn?e:new pn(e.message,{cause:e}),yO=global.Request,Ei=class extends yO{constructor(e,t){if(typeof e=="object"&&mr in e){let r=t!==void 0&&"body"in t&&t.body!=null;if(e[jn]&&!r)throw new TypeError("Cannot construct a Request with a Request object that has already been used.");e=e[mr]()}typeof t?.body?.getReader<"u"&&(t.duplex??="half"),super(e,t)}},dT=Symbol("wrapBodyStream"),kO=new Set(["latin1","binary","hex","base64","base64url"]),_O=e=>e===null||kO.has(e),lv=Symbol("bodyBufferedBeforeDisconnect"),uv=Symbol("bodyBufferedLengthBeforeDisconnect"),pT=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??"utf8"),vv=e=>!(e instanceof $n)&&!!e.complete&&!!e.readableAborted&&typeof e.read=="function"&&_O(e.readableEncoding),rT=e=>{if(e.readableDidRead||!vv(e))return;let t=e;t[uv]??=e.readableLength},Tp=(e,t)=>{if(e.readableDidRead&&!t||!vv(e))return;let r=e;if(r[lv]!==void 0)return r[lv];let a,n=e.errored;if(n&&n.code!=="ECONNRESET")a=n;else if(r[uv]!==void 0&&e.readableLength!==r[uv])a=Ap();else{let i=t??[],o=e.read();o!==null&&i.push(pT(o,e.readableEncoding));let s=i.length===1?i[0]:Buffer.concat(i);a=s;let l=e.headers["content-length"];if(typeof l=="string"&&/^\d+$/.test(l)){let c=Number(l);Number.isSafeInteger(c)&&s.length!==c&&(a=Ap())}}return r[lv]=a,a},aT=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},wO=(e,t,r,a,n)=>{let i={method:e,headers:r,signal:n.signal};if(e==="TRACE"){i.method="GET";let o=new Ei(t,i);return Object.defineProperty(o,"method",{get(){return"TRACE"}}),o}if(!(e==="GET"||e==="HEAD"))if("rawBody"in a&&a.rawBody instanceof Buffer)i.body=new ReadableStream({start(o){o.enqueue(a.rawBody),o.close()}});else if(a[dT]){let o;i.body=new ReadableStream({async pull(s){try{if(!o){let u=Tp(a);if(u!==void 0){aT(s,u);return}}o||=eT.toWeb(a).getReader();let{done:l,value:c}=await o.read();l?s.close():s.enqueue(c)}catch(l){s.error(l)}}})}else{let o=Tp(a);o!==void 0?i.body=new ReadableStream({start(s){aT(s,o)}}):i.body=eT.toWeb(a)}return new Ei(t,i)},mr=Symbol("getRequestCache"),Pn=Symbol("requestCache"),xi=Symbol("incomingKey"),Bs=Symbol("urlKey"),mT=Symbol("methodKey"),gT=Symbol("headersKey"),Ms=Symbol("abortControllerKey"),dv=Symbol("getAbortController"),pv=Symbol("abortRequest"),pr=Symbol("bodyBuffer"),xp=Symbol("bodyReadPromise"),jn=Symbol("bodyConsumedDirectly"),iT=Symbol("bodyLockReader"),Ls=Symbol("abortReason"),Ap=()=>new TypeError("Body is unusable"),Us=()=>Promise.reject(Ap()),SO=new TextDecoder,EO=e=>{if(e[jn])return Us();e[jn]=!0},xO=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),TO=e=>(e[gT]||=uT(e[xi])).get("content-type")||"",AO=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,CO=e=>{if(typeof e!="string"||e.length===0)return"GET";switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"PATCH":case"POST":case"PUT":case"QUERY":return e}let t=e.toUpperCase();switch(t){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return t;default:return e}},zO=e=>{if(!AO.test(e))return new TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t==="CONNECT"||t==="TRACK"||t==="TRACE"&&e!=="TRACE")return new TypeError(`'${e}' HTTP method is unsupported.`)},yv=(e,t,r)=>{if(e[jn])return Us();let a=e.method;if(a==="GET"||a==="HEAD")return e[mr]()[t]();let n=zO(a);if(n)return Promise.reject(n);if(e[Pn]&&a!=="TRACE")return e[Pn][t]();let i=EO(e);if(i)return i;let o=IO(e);if(o){let s=Promise.resolve(r(o,e));return e[pr]=void 0,s}return PO(e).then(s=>{let l=r(s,e);return e[pr]=void 0,l})},IO=e=>{let t=e[xi];if("rawBody"in t&&t.rawBody instanceof Buffer)return t.rawBody},oT=(e,t)=>{if(t.errored)return t.errored;let r=e[Ls];return r!==void 0?r instanceof Error?r:new Error(String(r)):new Error("Client connection prematurely closed.")},PO=e=>{if(e[pr])return Promise.resolve(e[pr]);if(e[xp])return e[xp];let t=e[xi];if(t.readableDidRead)return Us();let r=Tp(t);if(r!==void 0)return r instanceof Error?Promise.reject(r):(e[pr]=r,Promise.resolve(r));let a=new Promise((n,i)=>{let o=[],s=!1,l=h=>{s||(s=!0,g(),h())},c=h=>{let f=t.errored??h;return!vv(t)||f&&f.code!=="ECONNRESET"?!1:(l(()=>{let k=Tp(t,o);k instanceof Error?i(k):k===void 0?i(h??oT(e,t)):(e[pr]=k,n(k))}),!0)},u=h=>{o.push(pT(h,t.readableEncoding))},d=()=>{l(()=>{let h=o.length===1?o[0]:Buffer.concat(o);e[pr]=h,n(h)})},m=h=>{c(h)||l(()=>{i(h)})},p=()=>{if(t.readableEnded){d();return}c()||l(()=>{i(oT(e,t))})},g=()=>{t.off("data",u),t.off("end",d),t.off("error",m),t.off("close",p),e[xp]=void 0};t.on("data",u),t.on("end",d),t.on("error",m),t.on("close",p),queueMicrotask(()=>{s||(t.readableEnded?d():t.errored?m(t.errored):t.destroyed&&p())})});return e[xp]=a,a},gn={get method(){return this[mT]},get url(){return this[Bs]},get headers(){return this[gT]||=uT(this[xi])},[pv](e){this[Ls]===void 0&&(this[Ls]=e);let t=this[Ms];t&&!t.signal.aborted&&t.abort(e)},[dv](){return this[Ms]||=new AbortController,this[Ls]!==void 0&&!this[Ms].signal.aborted&&this[Ms].abort(this[Ls]),this[Ms]},[mr](){let e=this[dv]();if(this[Pn])return this[Pn];let t=this.method;if(this[jn]&&!(t==="GET"||t==="HEAD")){this[pr]=void 0;let r={method:t==="TRACE"?"GET":t,headers:this.headers,signal:e.signal};t!=="TRACE"&&(r.body=new ReadableStream({start(n){n.close()}}),r.duplex="half");let a=new Ei(this[Bs],r);return t==="TRACE"&&Object.defineProperty(a,"method",{get(){return"TRACE"}}),this[Pn]=a}return this[Pn]=wO(this.method,this[Bs],this.headers,this[xi],e)},get body(){if(!this[jn])return this[mr]().body;let e=this[mr]();return!this[iT]&&e.body&&(this[iT]=e.body.getReader()),e.body},get bodyUsed(){return this[jn]?!0:this[Pn]?this[Pn].bodyUsed:!1}};Object.defineProperty(gn,"signal",{get(){return this[dv]().signal}});["cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","keepalive"].forEach(e=>{Object.defineProperty(gn,e,{get(){return this[mr]()[e]}})});["clone","formData"].forEach(e=>{Object.defineProperty(gn,e,{value:function(){if(this[jn]){if(e==="clone")throw Ap();return Us()}return this[mr]()[e]()}})});Object.defineProperty(gn,"text",{value:function(){return yv(this,"text",e=>SO.decode(e))}});Object.defineProperty(gn,"arrayBuffer",{value:function(){return yv(this,"arrayBuffer",e=>xO(e))}});Object.defineProperty(gn,"blob",{value:function(){return yv(this,"blob",(e,t)=>{let r=TO(t),a=r?{headers:{"content-type":r}}:void 0;return new Response(e,a).blob()})}});Object.defineProperty(gn,"json",{value:function(){return this[jn]?Us():this.text().then(JSON.parse)}});Object.defineProperty(gn,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){return`Request (lightweight) ${r({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Pn]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(gn,Ei.prototype);var RO=(e,t)=>{let r=Object.create(gn);r[xi]=e,r[mT]=CO(e.method);let a=e.url||"";if(a[0]!=="/"&&(a.startsWith("http://")||a.startsWith("https://"))){if(e instanceof $n)throw new pn("Absolute URL for :path is not allowed in HTTP/2");try{r[Bs]=new URL(a).href}catch(o){throw new pn("Invalid absolute URL",{cause:o})}return r}let n=(e instanceof $n?e.authority:e.headers.host)||t;if(!n)throw new pn("Missing host header");let i;if(e instanceof $n){if(i=e.scheme,!(i==="http"||i==="https"))throw new pn("Unsupported scheme")}else i=e.socket&&e.socket.encrypted?"https":"http";try{r[Bs]=bO(i,n,a)}catch(o){throw o instanceof pn?o:new pn("Invalid URL",{cause:o})}return r},Yr="text/plain; charset=UTF-8",mv=Symbol("responseCache"),Si=Symbol("getResponseCache"),Rn=Symbol("cache"),Cp=global.Response,mn=class hT{#e;#t;[Si](){let t=this[Rn],r=t&&t[2]instanceof Headers?t[2]:void 0;return delete this[Rn],this[mv]||=new Cp(this.#e,r?{status:this.#t?.status,statusText:this.#t?.statusText,headers:r}:this.#t)}constructor(t,r){let a;if(this.#e=t,r instanceof Cp){let n=r[mv];if(n){this.#t=n,this[Si]();return}this.#t=r instanceof hT?r.#t:r,a=new Headers(r.headers)}else this.#t=r;(t==null||typeof t=="string"||typeof t?.getReader<"u"||t instanceof Blob||t instanceof Uint8Array)&&(this[Rn]=[r?.status||200,t??null,a||r?.headers])}get headers(){let t=this[Rn];return t?(t[2]instanceof Headers||(t[2]=new Headers(t[2]||(t[1]===null?void 0:{"content-type":Yr}))),t[2]):this[Si]().headers}get status(){return this[Rn]?.[0]??this[Si]().status}get ok(){let t=this.status;return t>=200&&t<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(mn.prototype,e,{get(){return this[Si]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(mn.prototype,e,{value:function(){return this[Si]()[e]()}})});Object.defineProperty(mn.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){return`Response (lightweight) ${r({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[mv]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(mn,Cp);Object.setPrototypeOf(mn.prototype,Cp.prototype);var $O=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,jO=e=>e instanceof URL?e.href:$O.test(e)?e:new URL(e).href,OO=new Set([301,302,303,307,308]);Object.defineProperty(mn,"redirect",{value:function(t,r=302){if(!OO.has(r))throw new RangeError("Invalid status code");return new mn(null,{status:r,headers:{location:jO(t)}})},writable:!0,configurable:!0});Object.defineProperty(mn,"json",{value:function(t,r){let a=JSON.stringify(t);if(a===void 0)throw new TypeError("The data is not JSON serializable");let n=r?.headers,i;return n?(i=new Headers(n),i.has("content-type")||i.set("content-type","application/json")):i={"content-type":"application/json"},new mn(a,{status:r?.status??200,statusText:r?.statusText,headers:i})},writable:!0,configurable:!0});async function NO(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function fT(e,t,r){let a=s=>{e.cancel(s).catch(()=>{})};return t.on("close",a),t.on("error",a),(r??e.read()).then(o,n),e.closed.finally(()=>{t.off("close",a),t.off("error",a)});function n(s){s&&t.destroy(s)}function i(){e.read().then(o,n)}function o({done:s,value:l}){try{if(s)t.end();else if(!t.write(l))t.once("drain",i);else return e.read().then(o,n)}catch(c){n(c)}}}function sT(e,t){if(e.locked)throw new TypeError("ReadableStream is locked.");return t.destroyed?void 0:fT(e.getReader(),t)}var gv=(e,t)=>{let r={};if(e instanceof Headers||(e=new Headers(e??void 0)),e.has("set-cookie")){let a=[];for(let[n,i]of e)n==="set-cookie"?a.push(i):r[n]=i;a.length>0&&(r["set-cookie"]=a)}else for(let[a,n]of e)r[a]=n;return t&&(r["content-type"]??=t),r},zp=Symbol("outgoingEnded"),lT=Symbol("incomingDraining"),DO=500,MO=64*1024*1024,bT=e=>{let t=e;if(e.destroyed||t[lT])return;if(t[lT]=!0,e instanceof $n){try{e.stream?.close?.(dO.NGHTTP2_NO_ERROR)}catch{}return}let r=0,a=()=>{clearTimeout(i),e.off("data",o),e.off("end",a),e.off("error",a)},n=()=>{a();let s=e.socket;s&&!s.destroyed&&(typeof s.destroySoon=="function"?s.destroySoon():typeof s.destroy=="function"&&s.destroy())},i=setTimeout(n,DO);i.unref?.();let o=s=>{r+=s.length,r>MO&&n()};e.on("data",o),e.on("end",a),e.on("error",a),e.resume()},LO=(e,t,r,a)=>()=>{t.errored?(rT(t),e[pv](t.errored.toString())):(!r.writableFinished||t instanceof $n&&t.aborted)&&(rT(t),e[pv]("Client connection prematurely closed.")),a&&!t.readableEnded&&setTimeout(()=>{t.readableEnded||setTimeout(()=>{bT(t)})})},BO=e=>{if(!(Rn in e))return!1;let t=e[Rn][1];return t===null||typeof t=="string"||t instanceof Uint8Array},UO=()=>new Response(null,{status:400}),vT=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),Ip=(e,t)=>{let r=e instanceof Error?e:new Error("unknown error",{cause:e});r.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),t.headersSent||(t instanceof uO&&(t._contentLength=null),t.writeHead(500,{"Content-Type":"text/plain"})),t.end(`Error: ${r.message}`),t.destroy(r))},hv=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},yT=(e,t,r)=>{let a=e;return a._contentLength===null&&a._hasBody&&a.useChunkedEncodingByDefault&&!a._removedContLen&&t>=200&&t!==204&&t!==304&&!e.hasHeader("content-length")&&!e.hasHeader("transfer-encoding")&&!e.hasHeader("trailer")?(a._contentLength=r,!0):!1},cv=(e,t,r)=>{yT(e,t,r)?e.writeHead(t,{"Content-Type":Yr}):e.writeHead(t,{"Content-Type":Yr,"Content-Length":r})},kT=async(e,t)=>{let[r,a,n]=e[Rn];if(!n){a===null?(t.writeHead(r),t.end()):typeof a=="string"?(cv(t,r,Buffer.byteLength(a)),t.end(a)):a instanceof Uint8Array?(cv(t,r,a.byteLength),t.end(a)):a instanceof Blob?(cv(t,r,a.size),t.end(new Uint8Array(await a.arrayBuffer()))):(t.writeHead(r,{"Content-Type":Yr}),hv(t),await sT(a,t)?.catch(l=>Ip(l,t))),t[zp]?.();return}let i=!1,o=!1,s=!0;if(n instanceof Headers)i=n.has("content-length"),n=gv(n,a===null?void 0:Yr);else if(Array.isArray(n)){let l=new Headers(n);i=l.has("content-length"),n=gv(l,a===null?void 0:Yr)}else{o=!0;for(let l in n){if(l.length===14&&l.toLowerCase()==="content-length"){i=!0;break}(l.length===17&&l.toLowerCase()==="transfer-encoding"||l.length===7&&l.toLowerCase()==="trailer")&&(s=!1)}}if(!i){let l;typeof a=="string"?l=Buffer.byteLength(a):a instanceof Uint8Array?l=a.byteLength:a instanceof Blob&&(l=a.size),l!==void 0&&(!o||!s||!yT(t,r,l))&&(o&&(n={...n}),n["Content-Length"]=l)}t.writeHead(r,n),a==null?t.end():typeof a=="string"||a instanceof Uint8Array?t.end(a):a instanceof Blob?t.end(new Uint8Array(await a.arrayBuffer())):(hv(t),await sT(a,t)?.catch(l=>Ip(l,t))),t[zp]?.()},_T=e=>typeof e.then=="function",FO=async(e,t,r={})=>{if(_T(e))if(r.errorHandler)try{e=await e}catch(n){let i=await r.errorHandler(n);if(!i)return;e=i}else e=await e.catch(vT);if(Rn in e)return kT(e,t);let a=gv(e.headers,e.body===null?void 0:Yr);if(e.body){let n=e.body.getReader(),i=[],o=!1,s;if(a["transfer-encoding"]!=="chunked"){let l=2;for(let c=0;c<l;c++){s||=n.read();let u=await NO(s).catch(d=>{console.error(d),o=!0});if(!u){if(c===1){await new Promise(d=>setTimeout(d)),l=3;continue}break}if(s=void 0,u.value&&i.push(u.value),u.done){o=!0;break}}o&&!("content-length"in a)&&(a["content-length"]=i.reduce((c,u)=>c+u.length,0))}t.writeHead(e.status,a),i.forEach(l=>{t.write(l)}),o?t.end():(i.length===0&&hv(t),await fT(n,t,s))}else a[Xx]||(t.writeHead(e.status,a),t.end());t[zp]?.()},kv=(e,t={})=>{let r=t.autoCleanupIncoming??!0;return t.overrideGlobalObjects!==!1&&global.Request!==Ei&&(Object.defineProperty(global,"Request",{value:Ei}),Object.defineProperty(global,"Response",{value:mn})),async(a,n)=>{let i,o,s=!1,l=!1,c=()=>{!o||l||(l=!0,n.on("close",LO(o,a,n,s)))};try{if(o=RO(a,t.hostname),s=r&&!(a.method==="GET"||a.method==="HEAD"),s&&(a[dT]=!0,a instanceof $n&&(n[zp]=()=>{a.readableEnded||setTimeout(()=>{a.readableEnded||setTimeout(()=>{a.destroy(),n.destroy()})})})),i=e(o,{incoming:a,outgoing:n}),!_T(i)&&BO(i))return s&&!a.readableEnded&&n.once("finish",()=>{a.readableEnded||bT(a)}),kT(i,n);c()}catch(u){if(i)return Ip(u,n);if(t.errorHandler){if(c(),i=await t.errorHandler(o?u:vO(u)),!i)return}else o?i=vT(u):i=UO()}try{return await FO(i,n,t)}catch(u){return Ip(u,n)}}},qO=globalThis.CloseEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get wasClean(){return this.#e.wasClean??!1}get code(){return this.#e.code??0}get reason(){return this.#e.reason??""}},HO=globalThis.ErrorEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get message(){return this.#e.message??""}get filename(){return this.#e.filename??""}get lineno(){return this.#e.lineno??0}get colno(){return this.#e.colno??0}get error(){return this.#e.error??null}},GO=()=>Symbol("connection"),VO=Symbol("CONNECTION_SYMBOL_KEY"),WO=Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");var HV=Qx(async(e,t,r)=>{if(e.req.header("upgrade")?.toLowerCase()!=="websocket")return;let a=e.env,n=a[WO];if(!n||!a.incoming)return new Response(null,{status:500});let i=GO();return a[VO]=i,(async()=>{let o;try{o=await n(a.incoming,i)}catch{return}let s=[],l=(d,m)=>{s.push([d,m])};o.on("message",l);let c={binaryType:"arraybuffer",close(d,m){o.close(d,m)},protocol:o.protocol,raw:o,get readyState(){return o.readyState},send(d,m){o.send(d,{compress:m?.compress})},url:new URL(e.req.url)};try{t?.onOpen?.(new Event("open"),c)}catch(d){(r?.onError??console.error)(d)}let u=(d,m)=>{let p=Array.isArray(d)?d:[d];for(let g of p)try{t?.onMessage?.(new MessageEvent("message",{data:m?g instanceof ArrayBuffer?g:g.buffer.slice(g.byteOffset,g.byteOffset+g.byteLength):typeof g=="string"?g:Buffer.from(g).toString("utf-8")}),c)}catch(h){(r?.onError??console.error)(h)}};o.off("message",l);for(let d of s)u(...d);o.on("message",(d,m)=>{u(d,m)}),o.on("close",(d,m)=>{try{t?.onClose?.(new qO("close",{code:d,reason:m.toString()}),c)}catch(p){(r?.onError??console.error)(p)}}),o.on("error",d=>{try{t?.onError?.(new HO("error",{error:d}),c)}catch(m){(r?.onError??console.error)(m)}})})(),new Response});var TT=tg(xT(),1);function nN(e){if(e)try{return TT.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function AT(e){return e==="application/json"?!0:nN(e)==="application/json"}function CT(e){return`Payload Too Large: Request body must not exceed ${e} bytes`}function zT(e){if(e===void 0)return 4194304;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(e)}`);return e}async function IT(e,t=4194304){if(Number(e.headers.get("content-length"))>t)return{tooLarge:!0};if(e.body===null)return{tooLarge:!1,text:""};let r=e.body.getReader(),a=new TextDecoder,n=0,i="";try{for(;;){let{done:o,value:s}=await r.read();if(o)break;if(n+=s.byteLength,n>t)return{tooLarge:!0};i+=a.decode(s,{stream:!0})}}finally{r.releaseLock()}return{tooLarge:!1,text:i+a.decode()}}function PT(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,2147483647));return r.unref?.(),r}var Pp=class{constructor(t={}){this._started=!1,this._hasHandledRequest=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._resumableStreams=new Set,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this._closed=!1,this.sessionIdGenerator=t.sessionIdGenerator,this._enableJsonResponse=t.enableJsonResponse??!1,this._eventStore=t.eventStore,this._onsessioninitialized=t.onsessioninitialized,this._onsessionclosed=t.onsessionclosed,this._allowedHosts=t.allowedHosts,this._allowedOrigins=t.allowedOrigins,this._enableDnsRebindingProtection=t.enableDnsRebindingProtection??!1,this._retryInterval=t.retryInterval,this._keepAliveMs=t.keepAliveMs??15e3,this._maxRequestBodySize=zT(t.maxRequestBodySize)}startKeepAlive(t,r){if(this._closed)return;let a=PT(this._keepAliveMs,()=>{try{t.enqueue(r.encode(`: keepalive
|
|
72
|
+
`}var Sp=class{constructor(t=Yx.stdin,r=Yx.stdout,a){this._stdin=t,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(i){this.onerror?.(i),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new wp({maxBufferSize:a?.maxBufferSize})}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 a=Jx(t);this._stdout.write(a)?r():this._stdout.once("drain",r)})}};var Xx="x-hono-already-sent";import{STATUS_CODES as UV,ServerResponse as uO,createServer as FV}from"node:http";import{Http2ServerRequest as $n,constants as dO}from"node:http2";import{Readable as eT}from"node:stream";var Qx=e=>((...t)=>{if(typeof t[0]=="function"){let[r,a]=t;return async function(i,o){let s=await e(i,await r(i),a);if(s)return s;await o()}}else{let[r,a,n]=t;return(async()=>{let i=await e(r,a,n);if(!i)throw new Error("Failed to upgrade WebSocket");return i})()}});var pn=class extends Error{constructor(e,t){super(e,t),this.name="RequestError"}},pO=new Set(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","server","user-agent"]),mO=/^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/,Ep=e=>e===9||e===10||e===13||e===32,tT=e=>{if(!Ep(e.charCodeAt(0))&&!Ep(e.charCodeAt(e.length-1)))return e;let t=0,r=e.length;for(;t<r&&Ep(e.charCodeAt(t));)t++;for(;r>t&&Ep(e.charCodeAt(r-1));)r--;return e.slice(t,r)},nT=/[\0\r\n]/,fv=globalThis.Headers,cT=(e,t=fv)=>{let r=new t;for(let a=0;a<e.length;a+=2){let n=e[a];n.startsWith(":")||r.append(n,e[a+1])}return r},bv=class{#e;#t;#r;#a;constructor(e){this.#e=e,e instanceof $n&&(this.#t=e.rawHeaders.slice())}get#i(){return this.#t??=this.#e.rawHeaders.slice()}get#n(){return this.#r||(this.#r=cT(this.#i),this.#t=void 0),this.#r}#o(e){if(typeof e=="string"){if(!mO.test(e))throw new TypeError(`Invalid header name: ${e}`);return e.toLowerCase()}}#s(e){let t=this.#e instanceof $n?void 0:this.#e.headers;if(!t||pO.has(e)||e==="set-cookie"||e==="__proto__")return;if(!Object.hasOwn(t,e))return null;let r=t[e];if(typeof r=="string"){let a=tT(r);return nT.test(a)?void 0:a}}#l(e,t){let r=t==="cookie"?"; ":", ",a=null;for(let n=0;n<e.length;n+=2){let i=e[n];if(i.length===t.length&&i.toLowerCase()===t){let o=tT(e[n+1]);if(nT.test(o)){this.#a=!0;return}a=a===null?o:a+r+o}}return a}append(e,t){this.#n.append(e,t)}delete(e){this.#n.delete(e)}get(e){let t=this.#o(e);if(t&&!this.#r&&!this.#a){let r=this.#s(t);if(r!==void 0)return r;let a=this.#l(this.#i,t);if(a!==void 0)return a}return this.#n.get(e)}has(e){let t=this.#o(e);if(t&&!this.#r&&!this.#a){let r=this.#s(t);if(r!==void 0)return r!==null;let a=this.#l(this.#i,t);if(a!==void 0)return a!==null}return this.#n.has(e)}set(e,t){this.#n.set(e,t)}getSetCookie(){return this.#n.getSetCookie()}keys(){return this.#n.keys()}values(){return this.#n.values()}entries(){return this.#n.entries()}forEach(e,t){this.#n.forEach((r,a)=>{e.call(t,r,a,this)})}[Symbol.iterator](){return this.entries()}};Object.defineProperty(bv.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){return`Headers (lightweight) ${r(Object.fromEntries(this),{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(bv.prototype,fv.prototype);var uT=e=>globalThis.Headers===fv?new bv(e):cT(e.rawHeaders,globalThis.Headers),gO=/^\/[!#$&-;=?-\[\]_a-z~]*$/,hO=/\/\.\.?(?:[/?#]|$)/,fO=/^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/,bO=(e,t,r)=>{let a=`${e}://${t}${r}`;if(fO.test(t)){if(r.length===0)return a+"/";if(r.charCodeAt(0)!==47)throw new pn("Invalid URL");return!gO.test(r)||hO.test(r)?new URL(a).href:a}else{let n=new URL(a);if(n.hostname.length!==t.length&&n.hostname!==(t.includes(":")?t.replace(/:\d+$/,""):t).toLowerCase())throw new pn("Invalid host header");return n.href}},vO=e=>e instanceof pn?e:new pn(e.message,{cause:e}),yO=global.Request,Ei=class extends yO{constructor(e,t){if(typeof e=="object"&&mr in e){let r=t!==void 0&&"body"in t&&t.body!=null;if(e[jn]&&!r)throw new TypeError("Cannot construct a Request with a Request object that has already been used.");e=e[mr]()}typeof t?.body?.getReader<"u"&&(t.duplex??="half"),super(e,t)}},dT=Symbol("wrapBodyStream"),kO=new Set(["latin1","binary","hex","base64","base64url"]),_O=e=>e===null||kO.has(e),lv=Symbol("bodyBufferedBeforeDisconnect"),uv=Symbol("bodyBufferedLengthBeforeDisconnect"),pT=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??"utf8"),vv=e=>!(e instanceof $n)&&!!e.complete&&!!e.readableAborted&&typeof e.read=="function"&&_O(e.readableEncoding),rT=e=>{if(e.readableDidRead||!vv(e))return;let t=e;t[uv]??=e.readableLength},Tp=(e,t)=>{if(e.readableDidRead&&!t||!vv(e))return;let r=e;if(r[lv]!==void 0)return r[lv];let a,n=e.errored;if(n&&n.code!=="ECONNRESET")a=n;else if(r[uv]!==void 0&&e.readableLength!==r[uv])a=Ap();else{let i=t??[],o=e.read();o!==null&&i.push(pT(o,e.readableEncoding));let s=i.length===1?i[0]:Buffer.concat(i);a=s;let l=e.headers["content-length"];if(typeof l=="string"&&/^\d+$/.test(l)){let c=Number(l);Number.isSafeInteger(c)&&s.length!==c&&(a=Ap())}}return r[lv]=a,a},aT=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},wO=(e,t,r,a,n)=>{let i={method:e,headers:r,signal:n.signal};if(e==="TRACE"){i.method="GET";let o=new Ei(t,i);return Object.defineProperty(o,"method",{get(){return"TRACE"}}),o}if(!(e==="GET"||e==="HEAD"))if("rawBody"in a&&a.rawBody instanceof Buffer)i.body=new ReadableStream({start(o){o.enqueue(a.rawBody),o.close()}});else if(a[dT]){let o;i.body=new ReadableStream({async pull(s){try{if(!o){let u=Tp(a);if(u!==void 0){aT(s,u);return}}o||=eT.toWeb(a).getReader();let{done:l,value:c}=await o.read();l?s.close():s.enqueue(c)}catch(l){s.error(l)}}})}else{let o=Tp(a);o!==void 0?i.body=new ReadableStream({start(s){aT(s,o)}}):i.body=eT.toWeb(a)}return new Ei(t,i)},mr=Symbol("getRequestCache"),Pn=Symbol("requestCache"),xi=Symbol("incomingKey"),Bs=Symbol("urlKey"),mT=Symbol("methodKey"),gT=Symbol("headersKey"),Ms=Symbol("abortControllerKey"),dv=Symbol("getAbortController"),pv=Symbol("abortRequest"),pr=Symbol("bodyBuffer"),xp=Symbol("bodyReadPromise"),jn=Symbol("bodyConsumedDirectly"),iT=Symbol("bodyLockReader"),Ls=Symbol("abortReason"),Ap=()=>new TypeError("Body is unusable"),Us=()=>Promise.reject(Ap()),SO=new TextDecoder,EO=e=>{if(e[jn])return Us();e[jn]=!0},xO=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),TO=e=>(e[gT]||=uT(e[xi])).get("content-type")||"",AO=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,CO=e=>{if(typeof e!="string"||e.length===0)return"GET";switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"PATCH":case"POST":case"PUT":case"QUERY":return e}let t=e.toUpperCase();switch(t){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"POST":case"PUT":return t;default:return e}},zO=e=>{if(!AO.test(e))return new TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t==="CONNECT"||t==="TRACK"||t==="TRACE"&&e!=="TRACE")return new TypeError(`'${e}' HTTP method is unsupported.`)},yv=(e,t,r)=>{if(e[jn])return Us();let a=e.method;if(a==="GET"||a==="HEAD")return e[mr]()[t]();let n=zO(a);if(n)return Promise.reject(n);if(e[Pn]&&a!=="TRACE")return e[Pn][t]();let i=EO(e);if(i)return i;let o=IO(e);if(o){let s=Promise.resolve(r(o,e));return e[pr]=void 0,s}return PO(e).then(s=>{let l=r(s,e);return e[pr]=void 0,l})},IO=e=>{let t=e[xi];if("rawBody"in t&&t.rawBody instanceof Buffer)return t.rawBody},oT=(e,t)=>{if(t.errored)return t.errored;let r=e[Ls];return r!==void 0?r instanceof Error?r:new Error(String(r)):new Error("Client connection prematurely closed.")},PO=e=>{if(e[pr])return Promise.resolve(e[pr]);if(e[xp])return e[xp];let t=e[xi];if(t.readableDidRead)return Us();let r=Tp(t);if(r!==void 0)return r instanceof Error?Promise.reject(r):(e[pr]=r,Promise.resolve(r));let a=new Promise((n,i)=>{let o=[],s=!1,l=h=>{s||(s=!0,g(),h())},c=h=>{let f=t.errored??h;return!vv(t)||f&&f.code!=="ECONNRESET"?!1:(l(()=>{let k=Tp(t,o);k instanceof Error?i(k):k===void 0?i(h??oT(e,t)):(e[pr]=k,n(k))}),!0)},u=h=>{o.push(pT(h,t.readableEncoding))},d=()=>{l(()=>{let h=o.length===1?o[0]:Buffer.concat(o);e[pr]=h,n(h)})},m=h=>{c(h)||l(()=>{i(h)})},p=()=>{if(t.readableEnded){d();return}c()||l(()=>{i(oT(e,t))})},g=()=>{t.off("data",u),t.off("end",d),t.off("error",m),t.off("close",p),e[xp]=void 0};t.on("data",u),t.on("end",d),t.on("error",m),t.on("close",p),queueMicrotask(()=>{s||(t.readableEnded?d():t.errored?m(t.errored):t.destroyed&&p())})});return e[xp]=a,a},gn={get method(){return this[mT]},get url(){return this[Bs]},get headers(){return this[gT]||=uT(this[xi])},[pv](e){this[Ls]===void 0&&(this[Ls]=e);let t=this[Ms];t&&!t.signal.aborted&&t.abort(e)},[dv](){return this[Ms]||=new AbortController,this[Ls]!==void 0&&!this[Ms].signal.aborted&&this[Ms].abort(this[Ls]),this[Ms]},[mr](){let e=this[dv]();if(this[Pn])return this[Pn];let t=this.method;if(this[jn]&&!(t==="GET"||t==="HEAD")){this[pr]=void 0;let r={method:t==="TRACE"?"GET":t,headers:this.headers,signal:e.signal};t!=="TRACE"&&(r.body=new ReadableStream({start(n){n.close()}}),r.duplex="half");let a=new Ei(this[Bs],r);return t==="TRACE"&&Object.defineProperty(a,"method",{get(){return"TRACE"}}),this[Pn]=a}return this[Pn]=wO(this.method,this[Bs],this.headers,this[xi],e)},get body(){if(!this[jn])return this[mr]().body;let e=this[mr]();return!this[iT]&&e.body&&(this[iT]=e.body.getReader()),e.body},get bodyUsed(){return this[jn]?!0:this[Pn]?this[Pn].bodyUsed:!1}};Object.defineProperty(gn,"signal",{get(){return this[dv]().signal}});["cache","credentials","destination","integrity","mode","redirect","referrer","referrerPolicy","keepalive"].forEach(e=>{Object.defineProperty(gn,e,{get(){return this[mr]()[e]}})});["clone","formData"].forEach(e=>{Object.defineProperty(gn,e,{value:function(){if(this[jn]){if(e==="clone")throw Ap();return Us()}return this[mr]()[e]()}})});Object.defineProperty(gn,"text",{value:function(){return yv(this,"text",e=>SO.decode(e))}});Object.defineProperty(gn,"arrayBuffer",{value:function(){return yv(this,"arrayBuffer",e=>xO(e))}});Object.defineProperty(gn,"blob",{value:function(){return yv(this,"blob",(e,t)=>{let r=TO(t),a=r?{headers:{"content-type":r}}:void 0;return new Response(e,a).blob()})}});Object.defineProperty(gn,"json",{value:function(){return this[jn]?Us():this.text().then(JSON.parse)}});Object.defineProperty(gn,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){return`Request (lightweight) ${r({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Pn]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(gn,Ei.prototype);var RO=(e,t)=>{let r=Object.create(gn);r[xi]=e,r[mT]=CO(e.method);let a=e.url||"";if(a[0]!=="/"&&(a.startsWith("http://")||a.startsWith("https://"))){if(e instanceof $n)throw new pn("Absolute URL for :path is not allowed in HTTP/2");try{r[Bs]=new URL(a).href}catch(o){throw new pn("Invalid absolute URL",{cause:o})}return r}let n=(e instanceof $n?e.authority:e.headers.host)||t;if(!n)throw new pn("Missing host header");let i;if(e instanceof $n){if(i=e.scheme,!(i==="http"||i==="https"))throw new pn("Unsupported scheme")}else i=e.socket&&e.socket.encrypted?"https":"http";try{r[Bs]=bO(i,n,a)}catch(o){throw o instanceof pn?o:new pn("Invalid URL",{cause:o})}return r},Yr="text/plain; charset=UTF-8",mv=Symbol("responseCache"),Si=Symbol("getResponseCache"),Rn=Symbol("cache"),Cp=global.Response,mn=class hT{#e;#t;[Si](){let t=this[Rn],r=t&&t[2]instanceof Headers?t[2]:void 0;return delete this[Rn],this[mv]||=new Cp(this.#e,r?{status:this.#t?.status,statusText:this.#t?.statusText,headers:r}:this.#t)}constructor(t,r){let a;if(this.#e=t,r instanceof Cp){let n=r[mv];if(n){this.#t=n,this[Si]();return}this.#t=r instanceof hT?r.#t:r,a=new Headers(r.headers)}else this.#t=r;(t==null||typeof t=="string"||typeof t?.getReader<"u"||t instanceof Blob||t instanceof Uint8Array)&&(this[Rn]=[r?.status||200,t??null,a||r?.headers])}get headers(){let t=this[Rn];return t?(t[2]instanceof Headers||(t[2]=new Headers(t[2]||(t[1]===null?void 0:{"content-type":Yr}))),t[2]):this[Si]().headers}get status(){return this[Rn]?.[0]??this[Si]().status}get ok(){let t=this.status;return t>=200&&t<300}};["body","bodyUsed","redirected","statusText","trailers","type","url"].forEach(e=>{Object.defineProperty(mn.prototype,e,{get(){return this[Si]()[e]}})});["arrayBuffer","blob","clone","formData","json","text"].forEach(e=>{Object.defineProperty(mn.prototype,e,{value:function(){return this[Si]()[e]()}})});Object.defineProperty(mn.prototype,Symbol.for("nodejs.util.inspect.custom"),{value:function(e,t,r){return`Response (lightweight) ${r({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[mv]},{...t,depth:e==null?null:e-1})}`}});Object.setPrototypeOf(mn,Cp);Object.setPrototypeOf(mn.prototype,Cp.prototype);var $O=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,jO=e=>e instanceof URL?e.href:$O.test(e)?e:new URL(e).href,OO=new Set([301,302,303,307,308]);Object.defineProperty(mn,"redirect",{value:function(t,r=302){if(!OO.has(r))throw new RangeError("Invalid status code");return new mn(null,{status:r,headers:{location:jO(t)}})},writable:!0,configurable:!0});Object.defineProperty(mn,"json",{value:function(t,r){let a=JSON.stringify(t);if(a===void 0)throw new TypeError("The data is not JSON serializable");let n=r?.headers,i;return n?(i=new Headers(n),i.has("content-type")||i.set("content-type","application/json")):i={"content-type":"application/json"},new mn(a,{status:r?.status??200,statusText:r?.statusText,headers:i})},writable:!0,configurable:!0});async function NO(e){return Promise.race([e,Promise.resolve().then(()=>Promise.resolve(void 0))])}function fT(e,t,r){let a=s=>{e.cancel(s).catch(()=>{})};return t.on("close",a),t.on("error",a),(r??e.read()).then(o,n),e.closed.finally(()=>{t.off("close",a),t.off("error",a)});function n(s){s&&t.destroy(s)}function i(){e.read().then(o,n)}function o({done:s,value:l}){try{if(s)t.end();else if(!t.write(l))t.once("drain",i);else return e.read().then(o,n)}catch(c){n(c)}}}function sT(e,t){if(e.locked)throw new TypeError("ReadableStream is locked.");return t.destroyed?void 0:fT(e.getReader(),t)}var gv=(e,t)=>{let r={};if(e instanceof Headers||(e=new Headers(e??void 0)),e.has("set-cookie")){let a=[];for(let[n,i]of e)n==="set-cookie"?a.push(i):r[n]=i;a.length>0&&(r["set-cookie"]=a)}else for(let[a,n]of e)r[a]=n;return t&&(r["content-type"]??=t),r},zp=Symbol("outgoingEnded"),lT=Symbol("incomingDraining"),DO=500,MO=64*1024*1024,bT=e=>{let t=e;if(e.destroyed||t[lT])return;if(t[lT]=!0,e instanceof $n){try{e.stream?.close?.(dO.NGHTTP2_NO_ERROR)}catch{}return}let r=0,a=()=>{clearTimeout(i),e.off("data",o),e.off("end",a),e.off("error",a)},n=()=>{a();let s=e.socket;s&&!s.destroyed&&(typeof s.destroySoon=="function"?s.destroySoon():typeof s.destroy=="function"&&s.destroy())},i=setTimeout(n,DO);i.unref?.();let o=s=>{r+=s.length,r>MO&&n()};e.on("data",o),e.on("end",a),e.on("error",a),e.resume()},LO=(e,t,r,a)=>()=>{t.errored?(rT(t),e[pv](t.errored.toString())):(!r.writableFinished||t instanceof $n&&t.aborted)&&(rT(t),e[pv]("Client connection prematurely closed.")),a&&!t.readableEnded&&setTimeout(()=>{t.readableEnded||setTimeout(()=>{bT(t)})})},BO=e=>{if(!(Rn in e))return!1;let t=e[Rn][1];return t===null||typeof t=="string"||t instanceof Uint8Array},UO=()=>new Response(null,{status:400}),vT=e=>new Response(null,{status:e instanceof Error&&(e.name==="TimeoutError"||e.constructor.name==="TimeoutError")?504:500}),Ip=(e,t)=>{let r=e instanceof Error?e:new Error("unknown error",{cause:e});r.code==="ERR_STREAM_PREMATURE_CLOSE"?console.info("The user aborted a request."):(console.error(e),t.headersSent||(t instanceof uO&&(t._contentLength=null),t.writeHead(500,{"Content-Type":"text/plain"})),t.end(`Error: ${r.message}`),t.destroy(r))},hv=e=>{"flushHeaders"in e&&e.writable&&e.flushHeaders()},yT=(e,t,r)=>{let a=e;return a._contentLength===null&&a._hasBody&&a.useChunkedEncodingByDefault&&!a._removedContLen&&t>=200&&t!==204&&t!==304&&!e.hasHeader("content-length")&&!e.hasHeader("transfer-encoding")&&!e.hasHeader("trailer")?(a._contentLength=r,!0):!1},cv=(e,t,r)=>{yT(e,t,r)?e.writeHead(t,{"Content-Type":Yr}):e.writeHead(t,{"Content-Type":Yr,"Content-Length":r})},kT=async(e,t)=>{let[r,a,n]=e[Rn];if(!n){a===null?(t.writeHead(r),t.end()):typeof a=="string"?(cv(t,r,Buffer.byteLength(a)),t.end(a)):a instanceof Uint8Array?(cv(t,r,a.byteLength),t.end(a)):a instanceof Blob?(cv(t,r,a.size),t.end(new Uint8Array(await a.arrayBuffer()))):(t.writeHead(r,{"Content-Type":Yr}),hv(t),await sT(a,t)?.catch(l=>Ip(l,t))),t[zp]?.();return}let i=!1,o=!1,s=!0;if(n instanceof Headers)i=n.has("content-length"),n=gv(n,a===null?void 0:Yr);else if(Array.isArray(n)){let l=new Headers(n);i=l.has("content-length"),n=gv(l,a===null?void 0:Yr)}else{o=!0;for(let l in n){if(l.length===14&&l.toLowerCase()==="content-length"){i=!0;break}(l.length===17&&l.toLowerCase()==="transfer-encoding"||l.length===7&&l.toLowerCase()==="trailer")&&(s=!1)}}if(!i){let l;typeof a=="string"?l=Buffer.byteLength(a):a instanceof Uint8Array?l=a.byteLength:a instanceof Blob&&(l=a.size),l!==void 0&&(!o||!s||!yT(t,r,l))&&(o&&(n={...n}),n["Content-Length"]=l)}t.writeHead(r,n),a==null?t.end():typeof a=="string"||a instanceof Uint8Array?t.end(a):a instanceof Blob?t.end(new Uint8Array(await a.arrayBuffer())):(hv(t),await sT(a,t)?.catch(l=>Ip(l,t))),t[zp]?.()},_T=e=>typeof e.then=="function",FO=async(e,t,r={})=>{if(_T(e))if(r.errorHandler)try{e=await e}catch(n){let i=await r.errorHandler(n);if(!i)return;e=i}else e=await e.catch(vT);if(Rn in e)return kT(e,t);let a=gv(e.headers,e.body===null?void 0:Yr);if(e.body){let n=e.body.getReader(),i=[],o=!1,s;if(a["transfer-encoding"]!=="chunked"){let l=2;for(let c=0;c<l;c++){s||=n.read();let u=await NO(s).catch(d=>{console.error(d),o=!0});if(!u){if(c===1){await new Promise(d=>setTimeout(d)),l=3;continue}break}if(s=void 0,u.value&&i.push(u.value),u.done){o=!0;break}}o&&!("content-length"in a)&&(a["content-length"]=i.reduce((c,u)=>c+u.length,0))}t.writeHead(e.status,a),i.forEach(l=>{t.write(l)}),o?t.end():(i.length===0&&hv(t),await fT(n,t,s))}else a[Xx]||(t.writeHead(e.status,a),t.end());t[zp]?.()},kv=(e,t={})=>{let r=t.autoCleanupIncoming??!0;return t.overrideGlobalObjects!==!1&&global.Request!==Ei&&(Object.defineProperty(global,"Request",{value:Ei}),Object.defineProperty(global,"Response",{value:mn})),async(a,n)=>{let i,o,s=!1,l=!1,c=()=>{!o||l||(l=!0,n.on("close",LO(o,a,n,s)))};try{if(o=RO(a,t.hostname),s=r&&!(a.method==="GET"||a.method==="HEAD"),s&&(a[dT]=!0,a instanceof $n&&(n[zp]=()=>{a.readableEnded||setTimeout(()=>{a.readableEnded||setTimeout(()=>{a.destroy(),n.destroy()})})})),i=e(o,{incoming:a,outgoing:n}),!_T(i)&&BO(i))return s&&!a.readableEnded&&n.once("finish",()=>{a.readableEnded||bT(a)}),kT(i,n);c()}catch(u){if(i)return Ip(u,n);if(t.errorHandler){if(c(),i=await t.errorHandler(o?u:vO(u)),!i)return}else o?i=vT(u):i=UO()}try{return await FO(i,n,t)}catch(u){return Ip(u,n)}}},qO=globalThis.CloseEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get wasClean(){return this.#e.wasClean??!1}get code(){return this.#e.code??0}get reason(){return this.#e.reason??""}},HO=globalThis.ErrorEvent??class extends Event{#e;constructor(e,t={}){super(e,t),this.#e=t}get message(){return this.#e.message??""}get filename(){return this.#e.filename??""}get lineno(){return this.#e.lineno??0}get colno(){return this.#e.colno??0}get error(){return this.#e.error??null}},GO=()=>Symbol("connection"),VO=Symbol("CONNECTION_SYMBOL_KEY"),WO=Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");var VV=Qx(async(e,t,r)=>{if(e.req.header("upgrade")?.toLowerCase()!=="websocket")return;let a=e.env,n=a[WO];if(!n||!a.incoming)return new Response(null,{status:500});let i=GO();return a[VO]=i,(async()=>{let o;try{o=await n(a.incoming,i)}catch{return}let s=[],l=(d,m)=>{s.push([d,m])};o.on("message",l);let c={binaryType:"arraybuffer",close(d,m){o.close(d,m)},protocol:o.protocol,raw:o,get readyState(){return o.readyState},send(d,m){o.send(d,{compress:m?.compress})},url:new URL(e.req.url)};try{t?.onOpen?.(new Event("open"),c)}catch(d){(r?.onError??console.error)(d)}let u=(d,m)=>{let p=Array.isArray(d)?d:[d];for(let g of p)try{t?.onMessage?.(new MessageEvent("message",{data:m?g instanceof ArrayBuffer?g:g.buffer.slice(g.byteOffset,g.byteOffset+g.byteLength):typeof g=="string"?g:Buffer.from(g).toString("utf-8")}),c)}catch(h){(r?.onError??console.error)(h)}};o.off("message",l);for(let d of s)u(...d);o.on("message",(d,m)=>{u(d,m)}),o.on("close",(d,m)=>{try{t?.onClose?.(new qO("close",{code:d,reason:m.toString()}),c)}catch(p){(r?.onError??console.error)(p)}}),o.on("error",d=>{try{t?.onError?.(new HO("error",{error:d}),c)}catch(m){(r?.onError??console.error)(m)}})})(),new Response});var TT=tg(xT(),1);function nN(e){if(e)try{return TT.default.parse(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();return t===""||e.slice(t.length).includes(",")?void 0:t}}function AT(e){return e==="application/json"?!0:nN(e)==="application/json"}function CT(e){return`Payload Too Large: Request body must not exceed ${e} bytes`}function zT(e){if(e===void 0)return 4194304;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new RangeError(`maxRequestBodySize must be a positive number of bytes, got ${String(e)}`);return e}async function IT(e,t=4194304){if(Number(e.headers.get("content-length"))>t)return{tooLarge:!0};if(e.body===null)return{tooLarge:!1,text:""};let r=e.body.getReader(),a=new TextDecoder,n=0,i="";try{for(;;){let{done:o,value:s}=await r.read();if(o)break;if(n+=s.byteLength,n>t)return{tooLarge:!0};i+=a.decode(s,{stream:!0})}}finally{r.releaseLock()}return{tooLarge:!1,text:i+a.decode()}}function PT(e,t){if(!Number.isFinite(e)||e<1)return;let r=setInterval(t,Math.min(e,2147483647));return r.unref?.(),r}var Pp=class{constructor(t={}){this._started=!1,this._hasHandledRequest=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._resumableStreams=new Set,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this._closed=!1,this.sessionIdGenerator=t.sessionIdGenerator,this._enableJsonResponse=t.enableJsonResponse??!1,this._eventStore=t.eventStore,this._onsessioninitialized=t.onsessioninitialized,this._onsessionclosed=t.onsessionclosed,this._allowedHosts=t.allowedHosts,this._allowedOrigins=t.allowedOrigins,this._enableDnsRebindingProtection=t.enableDnsRebindingProtection??!1,this._retryInterval=t.retryInterval,this._keepAliveMs=t.keepAliveMs??15e3,this._maxRequestBodySize=zT(t.maxRequestBodySize)}startKeepAlive(t,r){if(this._closed)return;let a=PT(this._keepAliveMs,()=>{try{t.enqueue(r.encode(`: keepalive
|
|
73
73
|
|
|
74
74
|
`))}catch{a!==void 0&&clearInterval(a)}});return a}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}createJsonErrorResponse(t,r,a,n){let i={code:r,message:a};return n?.data!==void 0&&(i.data=n.data),new Response(JSON.stringify({jsonrpc:"2.0",error:i,id:null}),{status:t,headers:{"Content-Type":"application/json",...n?.headers}})}validateRequestHeaders(t){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let r=t.headers.get("host");if(!r||!this._allowedHosts.includes(r)){let a=`Invalid Host header: ${r}`;return this.onerror?.(new Error(a)),this.createJsonErrorResponse(403,-32e3,a)}}if(this._allowedOrigins&&this._allowedOrigins.length>0){let r=t.headers.get("origin");if(r&&!this._allowedOrigins.includes(r)){let a=`Invalid Origin header: ${r}`;return this.onerror?.(new Error(a)),this.createJsonErrorResponse(403,-32e3,a)}}}}async handleRequest(t,r){if(this._closed)return this.createJsonErrorResponse(404,-32001,"Session not found");if(!this.sessionIdGenerator&&this._hasHandledRequest)throw new Error("Stateless transport cannot be reused across requests. Create a new transport per request.");this._hasHandledRequest=!0;let a=this.validateRequestHeaders(t);if(a)return a;switch(t.method){case"POST":return this.handlePostRequest(t,r);case"GET":return this.handleGetRequest(t);case"DELETE":return this.handleDeleteRequest(t);default:return this.handleUnsupportedRequest()}}async writePrimingEvent(t,r,a,n){if(!this._eventStore||n<"2025-11-25")return;let i=await this._eventStore.storeEvent(a,{}),o=`id: ${i}
|
|
75
75
|
data:
|
|
@@ -3349,7 +3349,7 @@ ${" ".repeat(t)}}`;default:return"any"}}function bN(e){let t=["namespace functio
|
|
|
3349
3349
|
`," ffur","-All","Constru","Retrieved"," incr\xEDveis"," \u0438\u043C\u043A\u043E"," foliga"," Balanced","\u1021\u101E"," schlechten"," \u03B1\u03BB\u03BB\u03B1\u03B3"," \u0436\u0430\u0441\u0430\u043F"," S\u01A1n","\u0438\u0440\u0430\u0438","\u10D8\u10DC\u10D4"," milioane","EMU","\u2019\xE9viter"," hyr"," encontre"," hallar"," tablas","_Long","<Cell"," interacted"," figsize"," \u10D6\u10E6"," \u0447\u043E\u0432\u0435\u043A"," Codigo"," dedica\xE7\xE3o"," stolet"," Orten","Philip"," \xE9mission","\u0E32\u0E2B\u0E25\u0E35"," bearbeiten"," mierda","holde","\u0443\u0432\u0430\u0432","<Component"," WPA","\u05E6\u05D9\u05DC\u05D5\u05DD","SSA"," Allies"," B\xE1r","_mer","_SMS"," \u0918\u0942\u092E"," Fixtures"," Bask"," \u5F90"," tradu\xE7\xE3o","blicke"," hammered"," \u0441\u04AF\u043F"," \u0431\u0438\u0433","olu\xE7\xE3o"," electricians","\u0631\u06CC\u0634\u0646"," pitsaaner"," cier"," Receita","\u9EBB\u5C06"," \u0437\u0430\u043A\u043E\u043D\u043E\u0434\u0430\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430"," \u10DE\u10D0\u10E1\u10E3\u10EE\u10D8\u10E1\u10DB\u10D2","-operated","\u0D4A\u0D2A\u0D4D\u0D2A\u0D02"," hassles","\u093E\u0924\u0930","\u0430\u043D\u0430\u0433\u0430\u0440\u0430","\u05E0\u05D8\u05E8","Japgolly"," doeleinden"," \u043F\u0435\u0440\u0435\u0439\u0442\u0438"," temsil"," ol\xEDmp"," Spazier"," \u0627\u0644\u0633\u0645\u0627"," pressione"," fiscais","l\u0259rini"," abode"," tantric","()],","rello"," \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044E","\u5FAE\u8F6F\u96C5\u9ED1","\u0633\u0631\u0627\u0626\u064A\u0644\u064A\u0629"," uitzending","flok"," escult"," Cerro"," is\xE6r"," kobiet","uree","\u0C95\u0CCA","encha"," adhesives"," paura","\u30C3\u30D4\u30F3\u30B0","\u0E27\u0E31\u0E22"," names"," slimmer","milk"," \u0A95\u0AB0\u0AA4\u0AC0"," Cim"," \u0441\u0432\u044F\u0437\u0430\u043D","\u200C\u0C28\u0C4D"," Chauff"," vingers","\u0430\u0446\u0430\u0440\u0442"," webcast",".notice"," m\u1EB7c","Passengers"," \u05E4\u05BC\u05E8\u05D0\u05B8\u05D3\u05D5\u05E7\u05D8\u05DF","\u0430\u043C\u0435\u0442\u0440"," VBA"," \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044F",`])));
|
|
3350
3350
|
`," surfers"," \u05DE\u05EA\u05D0\u05D9\u05DD",`')):
|
|
3351
3351
|
`,".apk","\u1EDBm"," \u05D4\u05DE\u05D6"," brincar"," AMOLED"," nate"," ayaan"," phosphorylation"," \u0985\u09AA\u09C7\u0995\u09CD\u09B7"," Eats"," Converse","\u094D\u092F\u0942\u091F\u0930","Traveler","inggi","\u05D5\u05E8\u05D2"," almoh"," \u0625\u0641\u0631\u064A\u0642\u064A\u0627"," Magazin"," Arme","\u0E23\u0E01\u0E34\u0E08"," a\u015Fk","-lines"," \u0627\u0644\u0623\u0645\u0627\u0643\u0646","\u516C\u5E73"," kv\xE4ll"," mlx"," \u092E\u0928\u094D\u0924\u094D\u0930\u0940","\u10D0\u10D5\u10D8\u10D0"," teks"," lumea"," legyen"," zwing"," boost"," J\xFA","\u5F69\u7968\u8BBA\u575B"," \u0434\u044D"," \u043E\u0448\u0438\u0431\u043E\u043A","\u0561\u056F\u0561\u0576\u056B","\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21","ebwa"," tipu"," domini"," Gurgaon","combat"," Resist"," \u0930\u094B\u091C\u0917\u093E\u0930","strategie","\u0A17\u0A40","(locator","MONTH"," atlik"," \uB79C","\u0627\u0644\u0633\u064A"," rzecz"," W\xE4"," deportivos"," Facilit","-able"," evitare"," thong"," \u6D3B","\uBB34\uB8CC"," mace"," Extraordinary","\u0927\u093E"," konflik"," livelihoods"," \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u043E\u0432"," kuitenkaan","\u5E78\u8FD0\u98DE\u8247","Corpus"," besch\xE4d"," \u05D3\u05D5\u05D3"," dentant"," nweta"," heath"," \u0936\u0941\u0915\u094D\u0930\u092C\u093E\u0930"," mnemonic",".Filters",`','".$`," \u0905\u0938\u094D\u0924","isite"," asawa","\u5E74\u6708"," gotas"," \u0C2A\u0C28\u0C3F\u0C1A","Dek"," Pact","'agence","fei\xE7o"," B\xF6yle","venteen","notif"," \u0410\u043D\u0434\u0440\u0435\u0439","\u591A\u5E74","mittedly","\u8CA1\u5E03"," \u043A\u043E\u043C\u043F\u0430\u043A\u0442","trk","\u0928\u094D\u0926\u094D\u0930\u0940\u092F"," miesto"," Kait"," \u0CAC\u0CB8"," spec"," Injector"," logarith","entions"," \u0447\u0435\u043B","Collateral"," confes","\u093F\u0939\u0930"," sufri\xF3","CRI"," tuge","urllib"," k\u013C"," verpleeg"," application's","(Constructor","\u09BE\u09B2\u09BE"," vulputate"," \u043E\u043F\u0443\u0445"," Nordrhein","allage","\xEDsimas","ornado","\u0438\u0434\u0435\u0440","m\xE9nyek","Qua"," pelicula","\uC131\uACFC","\u3011-"," hemi"," touristes"," absentee"," Nether",".PAGE"," i\u015Fg\xE4r"," efectivos"," saav"," ","flashdata"," sembler"," ikuku"," \u099F\u09BE\u0987",` \u201D
|
|
3352
|
-
`,"\u5F69\u7968\u5E73\u53F0\u5F00\u6237","\u65C1",".\u0413","uckles"," \u0627\u0644\u062E\u0627\u0631","\u0432\u043E\u043B\u044C"," \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436",".gradient"," ebile"," Athlete"," \u0442\u04B1\u0440\u0493\u0430\u043D"," Syrie",".processing"," Consultancy"," thrills","\u0642\u0631\u0627\u0621","(varargin","k\xFCnfte"," \u5F6D","-knit","riedenheit"," t\xE4nka","']//","udies","hacer"," Th\xE9\xE2tre","av\u7535\u5F71"," Armada","-techn","ibris","veli"," razloga","-Hop"," \u05DE\u05D7\u05D3\u05E9"," Bloggers"," controversies"," \u0C1A\u0C30\u0C4D\u0C2F"," \u0D2A\u0D4D\u0D30\u0D2E\u0D41\u0D16","_unc","werfen"," \u043B\u043E\u043C"," \u043F\u043E\u043A\u0443\u043F\u0430\u0442\u0435\u043B\u0435\u0439"," \u0433\u043B\u0430\u0437\u0430\u043C\u0438"," \u05D1\u05E2\u05D5\u05D3"," nanot"," ws"," \u043A\u0435\u0437\u0434\u0435\u0441","):("," Produit","Aircraft","iffen"," patrones"," par\xE2metros","Cursos"," cocos"],sA=iA.concat(oA);iA.length=0;oA.length=0;var NN=aA.getEncodingApi("o200k_base",()=>sA),{decode:
|
|
3352
|
+
`,"\u5F69\u7968\u5E73\u53F0\u5F00\u6237","\u65C1",".\u0413","uckles"," \u0627\u0644\u062E\u0627\u0631","\u0432\u043E\u043B\u044C"," \u043D\u0435\u0432\u043E\u0437\u043C\u043E\u0436",".gradient"," ebile"," Athlete"," \u0442\u04B1\u0440\u0493\u0430\u043D"," Syrie",".processing"," Consultancy"," thrills","\u0642\u0631\u0627\u0621","(varargin","k\xFCnfte"," \u5F6D","-knit","riedenheit"," t\xE4nka","']//","udies","hacer"," Th\xE9\xE2tre","av\u7535\u5F71"," Armada","-techn","ibris","veli"," razloga","-Hop"," \u05DE\u05D7\u05D3\u05E9"," Bloggers"," controversies"," \u0C1A\u0C30\u0C4D\u0C2F"," \u0D2A\u0D4D\u0D30\u0D2E\u0D41\u0D16","_unc","werfen"," \u043B\u043E\u043C"," \u043F\u043E\u043A\u0443\u043F\u0430\u0442\u0435\u043B\u0435\u0439"," \u0433\u043B\u0430\u0437\u0430\u043C\u0438"," \u05D1\u05E2\u05D5\u05D3"," nanot"," ws"," \u043A\u0435\u0437\u0434\u0435\u0441","):("," Produit","Aircraft","iffen"," patrones"," par\xE2metros","Cursos"," cocos"],sA=iA.concat(oA);iA.length=0;oA.length=0;var NN=aA.getEncodingApi("o200k_base",()=>sA),{decode:T9,decodeAsyncGenerator:A9,decodeGenerator:C9,encode:z9,encodeGenerator:I9,isWithinTokenLimit:P9,countTokens:lA,encodeChat:R9,encodeChatGenerator:$9,vocabularySize:j9,setMergeCacheSize:O9,clearMergeCache:N9,estimateCost:D9}=NN;var DN=/[A-Za-z]+|\d+|[^\sA-Za-z\d]|\n[ \t]*/g;function Rv(e,t=4){if(!e)return 0;let r=e.length/t,a=0;for(let n of e.match(DN)??[]){let i=/^[A-Za-z]/.test(n)?6:/^\d/.test(n)?3:n[0]===`
|
|
3353
3353
|
`?16:1;a+=Math.max(1,Math.ceil(n.length/i))}return Math.max(1,Math.round(Math.max(r,a)))}function Ce(e,t){if(!e)return{tokens:0,exact:t.tokenizer!=="heuristic"};if(t.tokenizer==="o200k")try{return{tokens:lA(e),exact:!0}}catch{}return{tokens:Rv(e,t.charsPerToken),exact:!1}}var MN={debugging:[/\b(error|exception|traceback|stack ?trace|crash(es|ed|ing)?|segfault|undefined is not|cannot read propert|null pointer|stack overflow)\b/],coding:[/\b(code|function|method|class|script|refactor|implement|api|endpoint|regex|sql|query|unit tests?|typescript|javascript|python|java|rust|golang|c\+\+|react|component|compile|deploy)\b/],editing:[/\b(proofread|rewrite|rephrase|reword|edit|polish|improve|fix (the )?grammar|make (it|this) (sound|more|less)|tone of)\b/],summarizing:[/\b(summari[sz]e|summary|tl;?dr|key (points|takeaways)|condense|recap|gist)\b/],translation:[/\btranslat(e|ion)\b|\b(in|into) (english|hindi|spanish|french|german|japanese|chinese|arabic|portuguese|italian|korean|russian)\b/],analysis:[/\b(analy[sz]e|analysis|dataset|csv|spreadsheet|table|chart|trend|average|median|correlat|statistics?|metrics?)\b/],brainstorming:[/\b(brainstorm|ideas? for|suggest (some|a few)|come up with|names? for|list of ideas)\b/],writing:[/\b(write|draft|compose|blog|essay|article|email|cover letter|post|story|poem|speech|announcement|outline)\b/],research:[/^(what|why|how|when|where|who|which|is|are|can|does|do|should|explain|compare|tell me)\b/,/\b(explain|difference between|compare|pros and cons|research|sources?)\b/]},LN=/\b(bug|broken|fails?|failing|doesn'?t work|not working|wrong output|fix (this|the|my|it))\b/,cA=["debugging","translation","summarizing","editing","analysis","coding","brainstorming","writing","research"],BN=/```[\s\S]*?```|~~~[\s\S]*?~~~/g,$v=/^\s*(def |class |function |const |let |var |import |from \S+ import|#include|public |private |return\b|if\s*\(|for\s*\(|while\s*\(|\}|\{|<\/?[a-z][\w-]*[ >])|;\s*$/,Np=/^\s*(\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}|\[\d{2}:\d{2}:\d{2}|\[?(INFO|WARN|WARNING|ERROR|DEBUG|TRACE|FATAL)\]?\b|at .+[(:]\d+|File ".+", line \d+|Traceback \(most recent call last\)|\w+(Error|Exception)(: |$)|Caused by:)/,UN=/^\s*([^,\t\n]+[,\t]){2,}[^,\t\n]+\s*$|^\s*[[{]\s*"\w+"\s*:/,FN=/\b(in|under|within|at most|max(imum)?|no more than|about|around|exactly|only)\s+\d+\s*(words?|sentences?|bullets?|bullet points|lines?|paragraphs?|points?|items?|characters?|chars?|tokens?)\b|\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten)[- ](words?|sentences?|bullets?|bullet points|lines?|paragraphs?|points?|ideas?|items?)\b|\b(brief(ly)?|concise(ly)?|short(ly)?|succinct(ly)?|tl;?dr|one[- ]liner|yes or no|just the (answer|code|diff))\b/,qN=/\b(full|entire|whole|complete)\s+(file|code|script|program|document|text|essay)\b|\brewrite (the )?(whole|entire)\b/;function HN(e,t){let r=e.filter(a=>a.trim());return r.length?r.filter(a=>t.test(a)).length/r.length:0}function jv(e){let t=e.replace(/^\s+/,""),r=e.length-t.length,a=/\n\s*\n|:\s*\n/.exec(t);if(!a)return{instruction:e,material:""};let n=r+a.index+a[0].length;return{instruction:e.slice(0,n),material:e.slice(n)}}function gr(e){let t=e.split(`
|
|
3354
3354
|
`),r=e.match(BN)??[],{instruction:a,material:n}=jv(e),i=a.toLowerCase().trim(),o={hasCode:r.length>0||HN(t,$v)>.3,hasLogs:t.filter(u=>Np.test(u)).length>=2,hasData:t.filter(u=>UN.test(u)).length>=3,pastedTokens:Rv(n),hasLengthLimit:FN.test(e.toLowerCase()),asksForFullOutput:qN.test(i)},s=new Map;for(let u of cA){let d=MN[u],m=d.reduce((p,g)=>p+(g.test(i)?2:0),0);!m&&n&&(m=d.reduce((p,g)=>p+(g.test(n.slice(0,2e3).toLowerCase())?.5:0),0)),s.set(u,m)}(o.hasCode||o.hasLogs)&&LN.test(i)&&s.set("debugging",(s.get("debugging")??0)+2),o.hasLogs&&s.set("debugging",(s.get("debugging")??0)+2),o.hasCode&&s.set("coding",(s.get("coding")??0)+1.5),o.hasData&&s.set("analysis",(s.get("analysis")??0)+1);let l="chat",c=0;for(let u of cA){let d=s.get(u)??0;d>c&&(l=u,c=d)}return{task:l,confidence:Math.min(1,c/4),signals:o}}var uA=new Set(["chat","writing","brainstorming","research"]);var GN=[["number",/\b\d+(?:[.,]\d+)*%?/g],["url",/https?:\/\/\S+/g],["code",/`[^`\n]+`/g],["quote",/"[^"\n]{1,200}"|“[^”\n]{1,200}”/g],["negation",/\b(?:not|no|never|none|nothing|nor|without|cannot|can't|don't|doesn't|didn't|won't|wouldn't|shouldn't|isn't|aren't|wasn't|mustn't)\b/gi],["constraint",/\b(?:must|only|exactly|always|avoid|at least|at most|required|mandatory|strictly|unless|except)\b/gi]];function Dp(e){let t=new Map;for(let[r,a]of GN)for(let n of e.match(a)??[]){let i=`${r}:${n.toLowerCase()}`;t.set(i,(t.get(i)??0)+1)}return t}function ta(e,t,r="count"){let a=Dp(e),n=Dp(t),i=[];for(let[o,s]of a)(n.get(o)??0)<(r==="count"?s:1)&&i.push(o);return{ok:i.length===0,lost:i}}function Mp(e,t){let r=Dp(e),a=Dp(t),n={};for(let i of r.keys()){let o=i.slice(0,i.indexOf(":")),[s,l]=n[o]??[0,0];n[o]=[s+1,l+(a.has(i)?1:0)]}return n}var VN=new Set("please kindly thank thanks much lot advance hi hello hey there chatgpt claude gemini basically actually really very just simply quite literally totally definitely important worth noting note make sure order regard respect fact purpose event point time near future large number majority able wondering like love want need you your would could will can helpful assistant language model act possible mind think step breath deep take reasoning thought process work before answering answer show explain spite due lets let's the that this with for are was is it's its and".split(" ")),dA=/[a-z][a-z'-]{2,}/g;function Zs(e,t){let r=new Set(t.toLowerCase().match(dA)??[]),a=new Set;for(let n of e.toLowerCase().match(dA)??[])!r.has(n)&&!VN.has(n)&&a.add(n);return[...a]}var hA=["light","balanced","aggressive"],ke=(e,t,r,a,n=!1)=>({re:new RegExp(e,"gim"),repl:t,name:r,level:a,reasoningOnly:n}),WN=[ke(String.raw`\bdue to the fact that\b`,"because","wordy phrasing","light"),ke(String.raw`\bin spite of the fact that\b`,"although","wordy phrasing","light"),ke(String.raw`\bin the event that\b`,"if","wordy phrasing","light"),ke(String.raw`\bfor the purpose of\b`,"for","wordy phrasing","light"),ke(String.raw`\bin order to\b`,"to","wordy phrasing","light"),ke(String.raw`\bwith (?:regard|respect) to\b`,"about","wordy phrasing","light"),ke(String.raw`\bat this point in time\b`,"now","wordy phrasing","light"),ke(String.raw`\bin the near future\b`,"soon","wordy phrasing","light"),ke(String.raw`\ba large number of\b`,"many","wordy phrasing","light"),ke(String.raw`\bthe majority of\b`,"most","wordy phrasing","light"),ke(String.raw`\b(is|are) able to\b`,"can","wordy phrasing","light"),ke(String.raw`\bmake sure that\b`,"ensure","wordy phrasing","light"),ke(String.raw`\b(?:let'?s|please)?\s*think (?:about (?:this|it) )?step[- ]by[- ]step\b[.,]?\s*`,"","step-by-step (model already reasons)","light",!0),ke(String.raw`\btake a deep breath(?: and)?[.,]?\s*`,"","step-by-step (model already reasons)","light",!0),ke(String.raw`\b(?:show|explain) your (?:reasoning|thought process|work) (?:step[- ]by[- ]step )?(?:before (?:answering|you answer))[.,]?\s*`,"","step-by-step (model already reasons)","light",!0),ke(String.raw`^\s*(?:hi|hello|hey)(?: there)?(?: chatgpt| claude| gemini)?[,!.]?\s*`,"","politeness","balanced"),ke(String.raw`(^|[.!?]\s+)(?:could|can|would|will) you (?:please )?(?:kindly )?([^.!?\n]*)\?`,"$1$2.","politeness","balanced"),ke(String.raw`(^|[.!?]\s+)(?:could|can|would|will) you (?:please )?(?:kindly )?`,"$1","politeness","balanced"),ke(String.raw`\bi would (?:really )?(?:like|love) (?:for )?you to\b\s*`,"","politeness","balanced"),ke(String.raw`\bi (?:want|need) you to\b\s*`,"","politeness","balanced"),ke(String.raw`\bplease\b,?\s*`,"","politeness","balanced"),ke(String.raw`\bkindly\b\s*`,"","politeness","balanced"),ke(String.raw`\bthank you(?: so much| very much| a lot)?(?: in advance)?[.!]?`,"","politeness","balanced"),ke(String.raw`\bthanks(?: so much| very much| a lot)?(?: in advance)?[.!]?`,"","politeness","balanced"),ke(String.raw`\b(?:it is|it's) (?:important|worth noting) (?:to note )?that\b\s*`,"","filler","balanced"),ke(String.raw`\b(?:please )?note that\b\s*`,"","filler","balanced"),ke(String.raw`\b(?:you are|act as|as) (?:an?|my) (?:ai|large language model|helpful assistant|ai assistant)[,.]?\s*`,"","filler","balanced"),ke(String.raw`\bi was wondering if\b\s*`,"","filler","balanced"),ke(String.raw`(?<!\bnot )\b(?:basically|actually|really|very|just|simply|quite|literally|totally|definitely)\b\s*`,"","hedges","aggressive"),ke(String.raw`\b(?:if possible|if you can|if you don't mind)\b[,.]?\s*`,"","hedges","aggressive")],Lp={light:0,balanced:1,aggressive:2},KN=/(```[\s\S]*?```|~~~[\s\S]*?~~~)/,ZN=new RegExp(["`[^`\\n]+`","https?:\\/\\/\\S+","<([A-Za-z][\\w-]*)[^>]*>[\\s\\S]*?<\\/\\1>",'"""[\\s\\S]*?"""'].join("|"),"g");function JN(e){return/^\s*>/.test(e)||/^\s{4,}\S/.test(e)||$v.test(e)||Np.test(e)}function YN(e,t){return t&&/^[A-Z]/.test(e)?t[0].toUpperCase()+t.slice(1):t}function XN(e,t,r){for(let a of WN){if(Lp[a.level]>Lp[t.level]||a.reasoningOnly&&!t.profile.reasoning)continue;a.re.lastIndex=0;let n=e.replace(a.re,(...i)=>{let o=i[0],s=i.slice(1,-2),l=a.repl.replace(/\$(\d)/g,(u,d)=>s[Number(d)-1]??""),c=a.repl.startsWith("$1")?s[0]??"":"";return c+YN(o.slice(c.length),l.slice(c.length))});n!==e&&(r.push(a.name),e=n)}return e}function QN(e,t){let r=new Set;return e.split(`
|
|
3355
3355
|
`).map(a=>a.split(/(?<=[.!?])\s+/).filter(n=>{let i=n.replace(/\W+/g," ").trim().toLowerCase();return i.split(" ").length<4?!0:r.has(i)?(t.push("repeated sentence"),!1):(r.add(i),!0)}).join(" ")).join(`
|
|
@@ -3368,7 +3368,7 @@ ${" ".repeat(t)}}`;default:return"any"}}function bN(e){let t=["namespace functio
|
|
|
3368
3368
|
`),qe=h[P].trim().endsWith(",")?",":"",D=s(qe?U.replace(/,\s*$/,""):U,`lines ${v+1}-${P+1}`);if(D!==U&&D!==U.replace(/,\s*$/,"")){f.push(C[1]+D+qe),v=P;continue}}}f.push(h[v])}let k=f.join(`
|
|
3369
3369
|
`),b=k.replace(/[ \t]+$/gm,"").replace(/\n{3,}/g,`
|
|
3370
3370
|
|
|
3371
|
-
`);return b!==k&&(d=!0),k=b,k});return a.length&&n.push(`removed indentation and line breaks from ${a.length} JSON block${a.length>1?"s":""} (same data)`),d&&n.push("removed trailing spaces and extra blank lines outside code"),o(m.join(""),a.length||d?void 0:"Nothing to compact: no pretty-printed JSON or extra whitespace found.")}var Ne=e=>e,hn={"gpt-astra":Ne({id:"gpt-astra",label:"GPT-6 Astra",family:"openai",contextWindow:105e4,tokenizer:"heuristic",charsPerToken:4.2,reasoning:!0,pricing:{inputPerMTok:10,outputPerMTok:50}}),"gpt-reasoning":Ne({id:"gpt-reasoning",label:"GPT (thinking)",family:"openai",contextWindow:196e3,tokenizer:"o200k",charsPerToken:4.2,reasoning:!0,lighterAlternative:"the Instant / non-thinking model",pricing:{inputPerMTok:5,outputPerMTok:30,cachedInputPerMTok:.5}}),gpt:Ne({id:"gpt",label:"GPT",family:"openai",contextWindow:128e3,tokenizer:"o200k",charsPerToken:4.2,reasoning:!1,pricing:{inputPerMTok:2.5,outputPerMTok:15,cachedInputPerMTok:.25}}),"claude-fable":Ne({id:"claude-fable",label:"Claude Fable",family:"anthropic",contextWindow:1e6,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!0,notes:["Claude reads XML-style tags well: wrap pasted material in <doc>\u2026</doc> instead of explaining it."],pricing:{inputPerMTok:10,outputPerMTok:50,cachedInputPerMTok:.25}}),"claude-opus":Ne({id:"claude-opus",label:"Claude Opus",family:"anthropic",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!1,lighterAlternative:"Sonnet or Haiku",notes:["Claude reads XML-style tags well: wrap pasted material in <doc>\u2026</doc> instead of explaining it."],pricing:{inputPerMTok:4,outputPerMTok:20,cachedInputPerMTok:.2}}),"claude-sonnet":Ne({id:"claude-sonnet",label:"Claude Sonnet",family:"anthropic",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!1,lighterAlternative:"Haiku",notes:["Claude reads XML-style tags well: wrap pasted material in <doc>\u2026</doc> instead of explaining it."],pricing:{inputPerMTok:2,outputPerMTok:10,cachedInputPerMTok:.2}}),"claude-haiku":Ne({id:"claude-haiku",label:"Claude Haiku",family:"anthropic",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!1,pricing:{inputPerMTok:.1,outputPerMTok:.5,cachedInputPerMTok:.01}}),"gemini-pro":Ne({id:"gemini-pro",label:"Gemini Pro",family:"google",contextWindow:1e6,tokenizer:"heuristic",charsPerToken:4,reasoning:!0,lighterAlternative:"Flash",pricing:{inputPerMTok:2,outputPerMTok:12,cachedInputPerMTok:.2,longContext:{aboveTokens:2e5,inputPerMTok:4,outputPerMTok:18}}}),"gemini-flash":Ne({id:"gemini-flash",label:"Gemini Flash",family:"google",contextWindow:1e6,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:1.5,outputPerMTok:9,cachedInputPerMTok:.15}}),deepseek:Ne({id:"deepseek",label:"DeepSeek",family:"deepseek",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.28,outputPerMTok:.42,cachedInputPerMTok:.028}}),"deepseek-reasoning":Ne({id:"deepseek-reasoning",label:"DeepSeek (thinking)",family:"deepseek",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!0,lighterAlternative:"the non-thinking mode",pricing:{inputPerMTok:.55,outputPerMTok:2.19,cachedInputPerMTok:.14}}),mistral:Ne({id:"mistral",label:"Mistral",family:"mistral",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:2,outputPerMTok:6}}),grok:Ne({id:"grok",label:"Grok",family:"xai",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:2,outputPerMTok:6}}),llama:Ne({id:"llama",label:"Llama",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.9,reasoning:!1,pricing:{inputPerMTok:.27,outputPerMTok:.85}}),qwen:Ne({id:"qwen",label:"Qwen",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.4,outputPerMTok:1.2}}),kimi:Ne({id:"kimi",label:"Kimi",family:"other",contextWindow:256e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.6,outputPerMTok:2.5,cachedInputPerMTok:.15}}),glm:Ne({id:"glm",label:"GLM",family:"other",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.6,outputPerMTok:2.2,cachedInputPerMTok:.11}}),command:Ne({id:"command",label:"Cohere Command",family:"other",contextWindow:256e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:2.5,outputPerMTok:10}}),sonar:Ne({id:"sonar",label:"Perplexity Sonar",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:1,outputPerMTok:1}}),gemma:Ne({id:"gemma",label:"Gemma",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.9,reasoning:!1,pricing:{inputPerMTok:.1,outputPerMTok:.2}}),phi:Ne({id:"phi",label:"Phi",family:"other",contextWindow:16e3,tokenizer:"heuristic",charsPerToken:3.9,reasoning:!1,pricing:{inputPerMTok:.07,outputPerMTok:.14}}),generic:Ne({id:"generic",label:"Unknown model",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:2,outputPerMTok:10}})},oD=[[/\b(fable|mythos)\b/,"claude-fable"],[/\bastra\b|\bgpt[- ]?6\b/,"gpt-astra"],[/\bclaude\b.*\bopus\b|\bopus\b/,"claude-opus"],[/\bsonnet\b/,"claude-sonnet"],[/\bhaiku\b/,"claude-haiku"],[/\b(qwen|qwq)/,"qwen"],[/\b(glm|chatglm|zhipu)\b|\bglm-?\d/,"glm"],[/\b(kimi|moonshot)/,"kimi"],[/\bgemma/,"gemma"],[/\bgemini\b.*\bflash\b|\bflash\b/,"gemini-flash"],[/\bgemini\b.*\b(pro|ultra|deep think)\b|^\s*\d(\.\d)?\s*pro\b|\bdeep think\b/,"gemini-pro"],[/\bdeepseek\b.*\b(r1|reason|think|deepthink)|\bdeepthink\b/,"deepseek-reasoning"],[/\bdeepseek\b/,"deepseek"],[/\b(mistral|le chat|magistral|codestral)\b/,"mistral"],[/\bgrok\b/,"grok"],[/\bllama|codellama/,"llama"],[/\bcommand[- ]?(r|a)\b|\bcohere\b/,"command"],[/\bsonar\b|\bperplexity\b/,"sonar"],[/\bphi-?\d/,"phi"],[/\bo[1-9](-mini|-pro)?\b|\bgpt[- ]?\S*\s*(thinking|pro)\b|\bthinking\b/,"gpt-reasoning"],[/\b(gpt|chatgpt)\b|\bgpt-?\d/,"gpt"],[/\bgemini\b/,"gemini-pro"],[/\bclaude\b/,"claude-sonnet"]];var sD={chatgpt:"gpt",claude:"claude-sonnet",gemini:"gemini-flash",deepseek:"deepseek",mistral:"mistral",grok:"grok",generic:"generic"},lD=[];var Z9={...hn};function hr(e,t="generic"){let r=(e??"").toLowerCase().replace(/\s+/g," ").trim();if(r){for(let[a,n]of lD)if(a.test(r))return hn[n];if(t==="gemini"&&/\b(pro|deep think)\b/.test(r))return hn["gemini-pro"];if(t==="gemini"&&/\bflash\b/.test(r))return hn["gemini-flash"];if(t==="deepseek"&&/\b(deepthink|r1|think)/.test(r))return hn["deepseek-reasoning"];for(let[a,n]of oD)if(a.test(r))return hn[n]}return hn[sD[t]??"generic"]}var yA="ai-toolbox.co ChatGPT limits guide",Bn={"chatgpt-free":{id:"chatgpt-free",site:"chatgpt",label:"ChatGPT Free",meter:"messages",caps:[]},"chatgpt-go":{id:"chatgpt-go",site:"chatgpt",label:"ChatGPT Go",meter:"messages",caps:[]},"chatgpt-plus":{id:"chatgpt-plus",site:"chatgpt",label:"ChatGPT Plus",meter:"messages",caps:[{models:["gpt"],messages:160,window:"3h",source:yA,asOf:"2026-10"},{models:["gpt-reasoning"],messages:3e3,window:"week",source:yA,asOf:"2026-10"}]},"chatgpt-pro":{id:"chatgpt-pro",site:"chatgpt",label:"ChatGPT Pro",meter:"messages",caps:[],note:"Pro is close to unlimited for everyday models, but GPT-6 Astra Pro use is capped (number not published)."},"chatgpt-business":{id:"chatgpt-business",site:"chatgpt",label:"ChatGPT Business",meter:"messages",caps:[]},"claude-free":{id:"claude-free",site:"claude",label:"Claude Free",meter:"compute",caps:[]},"claude-pro":{id:"claude-pro",site:"claude",label:"Claude Pro",meter:"compute",caps:[],note:"5-hour session and weekly limits shared across models; Fable runs on usage credits."},"claude-max":{id:"claude-max",site:"claude",label:"Claude Max",meter:"compute",caps:[],note:"5x or 20x Pro's session usage, with a weekly limit across models and one for the top models."},"claude-team":{id:"claude-team",site:"claude",label:"Claude Team",meter:"compute",caps:[]},"gemini-free":{id:"gemini-free",site:"gemini",label:"Gemini (free)",meter:"messages",caps:[]},"gemini-pro":{id:"gemini-pro",site:"gemini",label:"Google AI Pro",meter:"messages",caps:[]},"gemini-ultra":{id:"gemini-ultra",site:"gemini",label:"Google AI Ultra",meter:"messages",caps:[]}};var Fp=5*36e5,Mv=7*864e5,cD=1e3,uD=500,Js=e=>Math.round(e).toLocaleString("en-US");function qp(e){let t=2166136261;for(let r=0;r<e.length;r++)t=Math.imul(t^e.charCodeAt(r),16777619)>>>0;return t.toString(36)}function kA(e){let t=/\b(Free|Pro|Max|Team|Enterprise)\s+plan\b/.exec(e);if(!t)return null;let r=t[1].toLowerCase();return Bn[`claude-${r==="enterprise"?"team":r}`]??null}var dD=["sun","mon","tue","wed","thu","fri","sat"];function pD(e,t){let r=/\b(sun|mon|tue|wed|thu|fri|sat)\w*\s+(\d{1,2})(?::(\d{2}))?\s*(am|pm)?/i.exec(e);if(!r)return;let a=new Date(t),n=Number(r[2])%12;r[4]?.toLowerCase()==="pm"&&(n+=12),!r[4]&&Number(r[2])>=12&&(n=Number(r[2]));let i=(dD.indexOf(r[1].slice(0,3).toLowerCase())-a.getDay()+7)%7,o=new Date(a.getFullYear(),a.getMonth(),a.getDate()+i,n,Number(r[3]??0)).getTime();return o<=t?o+Mv:o}function mD(e){let t=/resets?\s+in\s+(?:(\d+)\s*(?:hr|hour|h)s?)?\s*(?:(\d+)\s*(?:min|minute|m)s?)?/i.exec(e);if(!(!t||!t[1]&&!t[2]))return(Number(t[1]??0)*60+Number(t[2]??0))*6e4}function _A(e,t){let r=e.replace(/\s+/g," "),a=/current session(.{0,160}?)(\d{1,3})\s*%\s*used/i.exec(r),n=/weekly (?:limits?|usage)(.{0,260}?)(\d{1,3})\s*%\s*used/i.exec(r),i=!a&&/(\d{1,3})\s*%\s+of\s+your\s+(session|5-hour|weekly)\s+(?:usage\s+)?limit/i.exec(r);if(!a&&!n&&!i)return null;let o={at:t};if(a){o.sessionPct=Math.min(100,Number(a[2]));let s=mD(a[1]);s!==void 0&&(o.sessionResetsAt=t+s)}if(n){o.weekPct=Math.min(100,Number(n[2]));let s=/resets?\s+((?:sun|mon|tue|wed|thu|fri|sat)\w*\s+\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/i.exec(n[1]);s&&(o.weekResetsText=s[1].trim(),o.weekResetsAt=pD(s[1],t))}return i&&(/weekly/i.test(i[2])?o.weekPct=Math.min(100,Number(i[1])):o.sessionPct=Math.min(100,Number(i[1]))),o}var Dv=e=>new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"});function Bv(e,t){return{...e,sends:e.sends.filter(r=>t-r.at<Mv).slice(-5e3),readings:e.readings.filter(r=>t-r.at<Mv).slice(-50)}}function wA(e,t){let r=[...e.readings].reverse().find(i=>i.sessionPct!==void 0),a=e.pctPer1k;if(r&&t.sessionPct!==void 0&&r.sessionPct!==void 0&&t.sessionPct>r.sessionPct&&t.at-r.at<Fp){let i=e.sends.filter(o=>o.at>r.at&&o.at<=t.at).reduce((o,s)=>o+s.tokens,0);if(i>=5e3){let o=(t.sessionPct-r.sessionPct)/i*1e3;a=a===void 0?o:a*.5+o*.5}}let n=r&&r.sessionPct===t.sessionPct&&r.weekPct===t.weekPct&&t.at-r.at<10*6e4;return{...e,pctPer1k:a,readings:n?e.readings:[...e.readings,t]}}function Hp(e){let{data:t,now:r,plan:a,current:n}=e,i=[...t.readings].reverse().find(S=>S.sessionPct!==void 0||S.weekPct!==void 0),o=[...t.readings].reverse().find(S=>S.weekPct!==void 0),s=[...t.readings].reverse().find(S=>S.sessionPct!==void 0),l=s&&(s.sessionResetsAt??s.at+Fp)>r,c=l&&s.sessionResetsAt?s.sessionResetsAt-Fp:r-Fp,u=t.sends.filter(S=>S.at>=c),d=S=>S.reduce((P,U)=>P+U.tokens,0),m=d(u),p={plan:a,planSource:e.planSource,session:{messages:u.length,tokens:m,since:c},week:{messages:t.sends.length,tokens:d(t.sends)},topChats:[],insights:[]};if(l&&s?.sessionPct!==void 0){let S=d(t.sends.filter(U=>U.at>s.at)),P=s.sessionPct+(t.pctPer1k?S/1e3*t.pctPer1k:0);p.sessionPct=Math.min(100,Math.round(P)),p.sessionResetsAt=s.sessionResetsAt,p.meterAgeMin=Math.round((r-s.at)/6e4)}o?.weekPct!==void 0&&(o.weekResetsAt??1/0)>r&&(p.weekPct=o.weekPct,p.weekResetsAt=o.weekResetsAt,p.weekResetsText=o.weekResetsText);let g=new Map;for(let S of u){let P=g.get(S.chat)??{chat:S.chat,title:e.titles?.get(S.chat),tokens:0,messages:0,share:0};P.tokens+=S.tokens,P.messages++,g.set(S.chat,P)}p.topChats=[...g.values()].map(S=>({...S,share:m?S.tokens/m:0})).sort((S,P)=>P.tokens-S.tokens).slice(0,5);let h=uD,f=(n?.tokens??0)+h,k=cD+h;if(p.sessionPct!==void 0&&t.pctPer1k){let S=Math.max(0,100-p.sessionPct)/t.pctPer1k*1e3;p.left={here:Math.floor(S/f),fresh:Math.floor(S/k)}}let b=p.insights,v=a?a.label:"your plan";if(p.sessionPct!==void 0){let S=p.sessionResetsAt?`; it resets at ${Dv(p.sessionResetsAt)}`:"";p.left&&n&&n.tokens>=1e4&&p.left.fresh>=p.left.here*2?b.push(`About ${Js(p.left.here)} more messages fit in ${v}'s session at this chat's size, or about ${Js(p.left.fresh)} in a new chat (${p.sessionPct}% used${S}). For a new topic, start a new chat. ${Rt}`):p.left?b.push(`About ${Js(p.left.fresh)} more messages like your recent ones fit in this session (${p.sessionPct}% used${S}).`):b.push(`Session ${p.sessionPct}% used${S}.`);let P=s&&t.readings.find(U=>U.sessionPct!==void 0&&U.at>=c);if(P&&s&&P!==s&&p.sessionResetsAt&&p.sessionPct<100){let U=(p.sessionPct-(P.sessionPct??0))/Math.max(1,r-P.at),qe=U>0?r+(100-p.sessionPct)/U:1/0;qe<p.sessionResetsAt&&b.push(`At this pace the session runs out around ${Dv(qe)}, before it resets at ${Dv(p.sessionResetsAt)}. Save the big asks for after the reset, or start new topics in new chats.`)}}let C=p.topChats[0];return C&&u.length>=4&&C.share>=.5&&g.size>1&&b.push(`${Math.round(C.share*100)}% of this session's usage came from one chat${C.title?` ("${C.title}")`:""}: each message there re-read about ${Js(C.tokens/C.messages)} tokens.`),p.weekPct!==void 0&&p.weekResetsAt&&((p.weekResetsAt-r)/36e5<=36&&p.weekPct<=50?b.push(`${100-p.weekPct}% of ${v}'s weekly allowance is unused and resets ${p.weekResetsText??"soon"}. It doesn't carry over, so this is a good time for the big jobs you've been holding back.`):p.weekPct>=80&&b.push(`Week ${p.weekPct}% used${p.weekResetsText?`, resets ${p.weekResetsText}`:""}. New topics in new chats and one complete message per ask stretch what's left.`)),n&&n.tokens>=2e4&&!b.some(S=>S.includes("new chat"))&&b.push(`Every message in this chat re-reads about ${Js(n.tokens)} tokens, ${Math.max(2,Math.round(f/k))}\xD7 a new chat. On ${v} that's what uses your allowance fastest.`),a?p.sessionPct===void 0&&a.site==="claude"&&b.push("Open Settings > Usage in Claude once and Token Lens reads your meter from it, to count how many messages you have left."):b.push("Tell Token Lens your plan once (Free, Pro, Max or Team) for advice that fits it."),p}var gD=/^(?:ok(?:ay)?|k|thanks?(?: you)?(?: so much)?|thx|ty|great|perfect|nice|cool|awesome|got it|understood|sounds good|lgtm|yes|yep|sure|done|👍|🙏)[\s!.,🙂😊👍🙏]*$/i;function SA(e){return gD.test(e.trim())}var Lv=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim();function EA(e,t){let r=Lv(e);return r.split(" ").length<8?!1:Lv(t).includes(r)}function xA(e){return e.split(/\n\s*\n/).map(t=>t.trim()).filter(t=>t.length>=1200).map(t=>qp(Lv(t)))}function TA(e,t,r){let a=Ce(e,r).tokens,n=Ce(t,r).tokens,o=ta(e,t).lost.map(d=>d.replace(":",": ")),s=Zs(e,t),l=o.length===0&&s.length===0,c=a-n,u=l?c>0?"Safe to send: the shorter version keeps every fact, constraint and instruction word.":"Same instructions, but no shorter: keep whichever you prefer.":o.length?"Check before sending: the edit drops facts or constraints that can change the answer.":"Check before sending: the edit drops words that may carry instructions.";return{before:a,after:n,saved:$t(c,r),sameInstructions:l,lostFacts:o,lostWords:s.slice(0,20),verdict:u}}var hD=new Set(["openai","anthropic","google"]);function AA(e,t){let r=e.pricing,a=Math.round(t.callsPerDay*(t.days??30));if(!r)return{priced:!1,callsPerMonth:a,longContext:!1,rates:{input:0,output:0,cached:null},lines:[]};let n=r.longContext&&t.inputTokens>r.longContext.aboveTokens?r.longContext:void 0,i=n?.inputPerMTok??r.inputPerMTok,o=n?.outputPerMTok??r.outputPerMTok,s=r.cachedInputPerMTok===void 0?null:r.cachedInputPerMTok*(i/r.inputPerMTok),l=Math.min(t.repeatedPrefixTokens??0,t.inputTokens),c=Math.min(1,Math.max(0,t.canWaitShare??0)),u=f=>{let k=f&&s!==null?t.inputTokens-l:t.inputTokens,b=f&&s!==null?l:0;return(k*i+b*(s??0)+t.outputTokens*o)/1e6},d=u(!1)*a,m=[{id:"now",label:"As it runs now",monthlyUsd:d,savedUsd:0,note:n?`Each call passes ${n.aboveTokens.toLocaleString("en-US")} input tokens, so the long-context rate applies.`:""}],p=s!==null&&l>0,g=hD.has(e.family)&&c>0;if(p){let f=u(!0)*a;m.push({id:"caching",label:"With prompt caching on the repeated part",monthlyUsd:f,savedUsd:d-f,note:"Same model, same request, same answer. Assumes calls come often enough to keep the cache warm (a few minutes apart); the first call after a gap pays full price, plus a small write fee on some providers."})}let h=f=>f-f*c*.5;if(g){let f=h(d);m.push({id:"batch",label:`Half-price batch for the ${Math.round(c*100)}% of calls that can wait`,monthlyUsd:f,savedUsd:d-f,note:"Same model and same answer, delivered within 24 hours instead of right away."})}if(p&&g){let f=h(u(!0)*a);m.push({id:"both",label:"Both together",monthlyUsd:f,savedUsd:d-f,note:""})}return{priced:!0,callsPerMonth:a,longContext:!!n,rates:{input:i,output:o,cached:s},lines:m}}function Vp(e,t){return e===t||ta(e,t,"presence").ok&&Zs(e,t).length===0}function Uv(e){return Array.isArray(e)?e.map(Uv):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).filter(([t])=>t!=="description").map(([t,r])=>[t,Uv(r)]))}function CA(e){let t=[];e.system&&t.push(["system prompt",e.system]);for(let r of e.tools??[]){r.description&&t.push([`tool ${r.name}`,r.description]);let a=(n,i)=>{if(Array.isArray(n))n.forEach((o,s)=>a(o,`${i}[${s}]`));else if(n&&typeof n=="object")for(let[o,s]of Object.entries(n))o==="description"&&typeof s=="string"?t.push([`tool ${r.name} ${i}`,s]):a(s,`${i}.${o}`)};a(r.parameters,"params")}for(let[r,a]of(e.examples??[]).entries())t.push([`example ${r+1}`,a]);return e.prompt&&t.push(["next prompt",e.prompt]),t}var Gp=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function zA(e,t){let r=[],a=CA(e),n=new Map(CA(t)),i={},o=[];for(let[h,f]of a){let k=n.get(h)??"";for(let[b,[v,C]]of Object.entries(Mp(f,k))){let[S,P]=i[b]??[0,0];i[b]=[S+v,P+C]}ta(f,k,"presence").ok||o.push(h)}let s=Object.entries(i).map(([h,[f,k]])=>`${k}/${f} ${h}s`);r.push({name:"Facts and constraints kept",passed:o.length===0,detail:o.length?`Lost in: ${o.join(", ")}`:s.length?`Kept ${s.join(", ")}.`:"No numbers, links, code or constraint words to keep."});let l=[];for(let[h,f]of a){let k=Zs(f,n.get(h)??"");k.length&&l.push(`${h}: ${k.join(", ")}`)}r.push({name:"Instructions kept",passed:l.length===0,detail:l.length?`Missing words: ${l.join("; ")}`:`Every content word of ${Gp(a.length,"text")} is still there; only filler was removed.`});let c=(h=[])=>JSON.stringify(h.map(f=>[f.name,Uv(f.parameters??null)])),u=c(e.tools)===c(t.tools);r.push({name:"Tool interface unchanged",passed:u,detail:u?`${Gp(e.tools?.length??0,"tool")}: same names, parameters, types, required fields and enums.`:"Tool names or parameter schemas differ."});let d=e.messages??[],m=t.messages??[],p=0,g=d.length===m.length&&d.every((h,f)=>{let k=m[f];if(k.role!==h.role)return!1;if(k.content===h.content)return!0;let b=/^\[Same content as message (\d+) above\.\]$/.exec(k.content),v=!!b&&d[Number(b[1])-1]?.content.trim()===h.content.trim();return v&&p++,v});return d.length&&r.push({name:"Conversation unchanged",passed:g,detail:g?`${Gp(d.length,"message")} in order${p?`; ${Gp(p,"exact repeat")} replaced by a pointer to the first copy`:", all verbatim"}.`:"Messages were dropped, reordered or edited."}),r.push({name:"Model and examples unchanged",passed:(e.examples?.length??0)===(t.examples?.length??0),detail:"Token Lens never switches the model or drops examples on its own."}),{passed:r.every(h=>h.passed),checks:r}}var Ye=e=>e.toLocaleString("en-US"),IA=(e,t)=>t?Math.round(e/t*100):0;function PA(e){return`${e.name}
|
|
3371
|
+
`);return b!==k&&(d=!0),k=b,k});return a.length&&n.push(`removed indentation and line breaks from ${a.length} JSON block${a.length>1?"s":""} (same data)`),d&&n.push("removed trailing spaces and extra blank lines outside code"),o(m.join(""),a.length||d?void 0:"Nothing to compact: no pretty-printed JSON or extra whitespace found.")}var Ne=e=>e,hn={"gpt-astra":Ne({id:"gpt-astra",label:"GPT-6 Astra",family:"openai",contextWindow:105e4,tokenizer:"heuristic",charsPerToken:4.2,reasoning:!0,pricing:{inputPerMTok:10,outputPerMTok:50}}),"gpt-reasoning":Ne({id:"gpt-reasoning",label:"GPT (thinking)",family:"openai",contextWindow:196e3,tokenizer:"o200k",charsPerToken:4.2,reasoning:!0,lighterAlternative:"the Instant / non-thinking model",pricing:{inputPerMTok:5,outputPerMTok:30,cachedInputPerMTok:.5}}),gpt:Ne({id:"gpt",label:"GPT",family:"openai",contextWindow:128e3,tokenizer:"o200k",charsPerToken:4.2,reasoning:!1,pricing:{inputPerMTok:2.5,outputPerMTok:15,cachedInputPerMTok:.25}}),"claude-fable":Ne({id:"claude-fable",label:"Claude Fable",family:"anthropic",contextWindow:1e6,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!0,notes:["Claude reads XML-style tags well: wrap pasted material in <doc>\u2026</doc> instead of explaining it."],pricing:{inputPerMTok:10,outputPerMTok:50,cachedInputPerMTok:.25}}),"claude-opus":Ne({id:"claude-opus",label:"Claude Opus",family:"anthropic",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!1,lighterAlternative:"Sonnet or Haiku",notes:["Claude reads XML-style tags well: wrap pasted material in <doc>\u2026</doc> instead of explaining it."],pricing:{inputPerMTok:4,outputPerMTok:20,cachedInputPerMTok:.2}}),"claude-sonnet":Ne({id:"claude-sonnet",label:"Claude Sonnet",family:"anthropic",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!1,lighterAlternative:"Haiku",notes:["Claude reads XML-style tags well: wrap pasted material in <doc>\u2026</doc> instead of explaining it."],pricing:{inputPerMTok:2,outputPerMTok:10,cachedInputPerMTok:.2}}),"claude-haiku":Ne({id:"claude-haiku",label:"Claude Haiku",family:"anthropic",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.5,reasoning:!1,pricing:{inputPerMTok:.1,outputPerMTok:.5,cachedInputPerMTok:.01}}),"gemini-pro":Ne({id:"gemini-pro",label:"Gemini Pro",family:"google",contextWindow:1e6,tokenizer:"heuristic",charsPerToken:4,reasoning:!0,lighterAlternative:"Flash",pricing:{inputPerMTok:2,outputPerMTok:12,cachedInputPerMTok:.2,longContext:{aboveTokens:2e5,inputPerMTok:4,outputPerMTok:18}}}),"gemini-flash":Ne({id:"gemini-flash",label:"Gemini Flash",family:"google",contextWindow:1e6,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:1.5,outputPerMTok:9,cachedInputPerMTok:.15}}),deepseek:Ne({id:"deepseek",label:"DeepSeek",family:"deepseek",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.28,outputPerMTok:.42,cachedInputPerMTok:.028}}),"deepseek-reasoning":Ne({id:"deepseek-reasoning",label:"DeepSeek (thinking)",family:"deepseek",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!0,lighterAlternative:"the non-thinking mode",pricing:{inputPerMTok:.55,outputPerMTok:2.19,cachedInputPerMTok:.14}}),mistral:Ne({id:"mistral",label:"Mistral",family:"mistral",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:2,outputPerMTok:6}}),grok:Ne({id:"grok",label:"Grok",family:"xai",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:2,outputPerMTok:6}}),llama:Ne({id:"llama",label:"Llama",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.9,reasoning:!1,pricing:{inputPerMTok:.27,outputPerMTok:.85}}),qwen:Ne({id:"qwen",label:"Qwen",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.4,outputPerMTok:1.2}}),kimi:Ne({id:"kimi",label:"Kimi",family:"other",contextWindow:256e3,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.6,outputPerMTok:2.5,cachedInputPerMTok:.15}}),glm:Ne({id:"glm",label:"GLM",family:"other",contextWindow:2e5,tokenizer:"heuristic",charsPerToken:3.8,reasoning:!1,pricing:{inputPerMTok:.6,outputPerMTok:2.2,cachedInputPerMTok:.11}}),command:Ne({id:"command",label:"Cohere Command",family:"other",contextWindow:256e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:2.5,outputPerMTok:10}}),sonar:Ne({id:"sonar",label:"Perplexity Sonar",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:1,outputPerMTok:1}}),gemma:Ne({id:"gemma",label:"Gemma",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:3.9,reasoning:!1,pricing:{inputPerMTok:.1,outputPerMTok:.2}}),phi:Ne({id:"phi",label:"Phi",family:"other",contextWindow:16e3,tokenizer:"heuristic",charsPerToken:3.9,reasoning:!1,pricing:{inputPerMTok:.07,outputPerMTok:.14}}),generic:Ne({id:"generic",label:"Unknown model",family:"other",contextWindow:128e3,tokenizer:"heuristic",charsPerToken:4,reasoning:!1,pricing:{inputPerMTok:2,outputPerMTok:10}})},oD=[[/\b(fable|mythos)\b/,"claude-fable"],[/\bastra\b|\bgpt[- ]?6\b/,"gpt-astra"],[/\bclaude\b.*\bopus\b|\bopus\b/,"claude-opus"],[/\bsonnet\b/,"claude-sonnet"],[/\bhaiku\b/,"claude-haiku"],[/\b(qwen|qwq)/,"qwen"],[/\b(glm|chatglm|zhipu)\b|\bglm-?\d/,"glm"],[/\b(kimi|moonshot)/,"kimi"],[/\bgemma/,"gemma"],[/\bgemini\b.*\bflash\b|\bflash\b/,"gemini-flash"],[/\bgemini\b.*\b(pro|ultra|deep think)\b|^\s*\d(\.\d)?\s*pro\b|\bdeep think\b/,"gemini-pro"],[/\bdeepseek\b.*\b(r1|reason|think|deepthink)|\bdeepthink\b/,"deepseek-reasoning"],[/\bdeepseek\b/,"deepseek"],[/\b(mistral|le chat|magistral|codestral)\b/,"mistral"],[/\bgrok\b/,"grok"],[/\bllama|codellama/,"llama"],[/\bcommand[- ]?(r|a)\b|\bcohere\b/,"command"],[/\bsonar\b|\bperplexity\b/,"sonar"],[/\bphi-?\d/,"phi"],[/\bo[1-9](-mini|-pro)?\b|\bgpt[- ]?\S*\s*(thinking|pro)\b|\bthinking\b/,"gpt-reasoning"],[/\b(gpt|chatgpt)\b|\bgpt-?\d/,"gpt"],[/\bgemini\b/,"gemini-pro"],[/\bclaude\b/,"claude-sonnet"]];var sD={chatgpt:"gpt",claude:"claude-sonnet",gemini:"gemini-flash",deepseek:"deepseek",mistral:"mistral",grok:"grok",generic:"generic"},lD=[];var Y9={...hn};function hr(e,t="generic"){let r=(e??"").toLowerCase().replace(/\s+/g," ").trim();if(r){for(let[a,n]of lD)if(a.test(r))return hn[n];if(t==="gemini"&&/\b(pro|deep think)\b/.test(r))return hn["gemini-pro"];if(t==="gemini"&&/\bflash\b/.test(r))return hn["gemini-flash"];if(t==="deepseek"&&/\b(deepthink|r1|think)/.test(r))return hn["deepseek-reasoning"];for(let[a,n]of oD)if(a.test(r))return hn[n]}return hn[sD[t]??"generic"]}var yA="ai-toolbox.co ChatGPT limits guide",Bn={"chatgpt-free":{id:"chatgpt-free",site:"chatgpt",label:"ChatGPT Free",meter:"messages",caps:[]},"chatgpt-go":{id:"chatgpt-go",site:"chatgpt",label:"ChatGPT Go",meter:"messages",caps:[]},"chatgpt-plus":{id:"chatgpt-plus",site:"chatgpt",label:"ChatGPT Plus",meter:"messages",caps:[{models:["gpt"],messages:160,window:"3h",source:yA,asOf:"2026-10"},{models:["gpt-reasoning"],messages:3e3,window:"week",source:yA,asOf:"2026-10"}]},"chatgpt-pro":{id:"chatgpt-pro",site:"chatgpt",label:"ChatGPT Pro",meter:"messages",caps:[],note:"Pro is close to unlimited for everyday models, but GPT-6 Astra Pro use is capped (number not published)."},"chatgpt-business":{id:"chatgpt-business",site:"chatgpt",label:"ChatGPT Business",meter:"messages",caps:[]},"claude-free":{id:"claude-free",site:"claude",label:"Claude Free",meter:"compute",caps:[]},"claude-pro":{id:"claude-pro",site:"claude",label:"Claude Pro",meter:"compute",caps:[],note:"5-hour session and weekly limits shared across models; Fable runs on usage credits."},"claude-max":{id:"claude-max",site:"claude",label:"Claude Max",meter:"compute",caps:[],note:"5x or 20x Pro's session usage, with a weekly limit across models and one for the top models."},"claude-team":{id:"claude-team",site:"claude",label:"Claude Team",meter:"compute",caps:[]},"gemini-free":{id:"gemini-free",site:"gemini",label:"Gemini (free)",meter:"messages",caps:[]},"gemini-pro":{id:"gemini-pro",site:"gemini",label:"Google AI Pro",meter:"messages",caps:[]},"gemini-ultra":{id:"gemini-ultra",site:"gemini",label:"Google AI Ultra",meter:"messages",caps:[]}};var Fp=5*36e5,Mv=7*864e5,cD=1e3,uD=500,Js=e=>Math.round(e).toLocaleString("en-US");function qp(e){let t=2166136261;for(let r=0;r<e.length;r++)t=Math.imul(t^e.charCodeAt(r),16777619)>>>0;return t.toString(36)}function kA(e){let t=/\b(Free|Pro|Max|Team|Enterprise)\s+plan\b/.exec(e);if(!t)return null;let r=t[1].toLowerCase();return Bn[`claude-${r==="enterprise"?"team":r}`]??null}var dD=["sun","mon","tue","wed","thu","fri","sat"];function pD(e,t){let r=/\b(sun|mon|tue|wed|thu|fri|sat)\w*\s+(\d{1,2})(?::(\d{2}))?\s*(am|pm)?/i.exec(e);if(!r)return;let a=new Date(t),n=Number(r[2])%12;r[4]?.toLowerCase()==="pm"&&(n+=12),!r[4]&&Number(r[2])>=12&&(n=Number(r[2]));let i=(dD.indexOf(r[1].slice(0,3).toLowerCase())-a.getDay()+7)%7,o=new Date(a.getFullYear(),a.getMonth(),a.getDate()+i,n,Number(r[3]??0)).getTime();return o<=t?o+Mv:o}function mD(e){let t=/resets?\s+in\s+(?:(\d+)\s*(?:hr|hour|h)s?)?\s*(?:(\d+)\s*(?:min|minute|m)s?)?/i.exec(e);if(!(!t||!t[1]&&!t[2]))return(Number(t[1]??0)*60+Number(t[2]??0))*6e4}function _A(e,t){let r=e.replace(/\s+/g," "),a=/current session(.{0,160}?)(\d{1,3})\s*%\s*used/i.exec(r),n=/weekly (?:limits?|usage)(.{0,260}?)(\d{1,3})\s*%\s*used/i.exec(r),i=!a&&/(\d{1,3})\s*%\s+of\s+your\s+(session|5-hour|weekly)\s+(?:usage\s+)?limit/i.exec(r);if(!a&&!n&&!i)return null;let o={at:t};if(a){o.sessionPct=Math.min(100,Number(a[2]));let s=mD(a[1]);s!==void 0&&(o.sessionResetsAt=t+s)}if(n){o.weekPct=Math.min(100,Number(n[2]));let s=/resets?\s+((?:sun|mon|tue|wed|thu|fri|sat)\w*\s+\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/i.exec(n[1]);s&&(o.weekResetsText=s[1].trim(),o.weekResetsAt=pD(s[1],t))}return i&&(/weekly/i.test(i[2])?o.weekPct=Math.min(100,Number(i[1])):o.sessionPct=Math.min(100,Number(i[1]))),o}var Dv=e=>new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"});function Bv(e,t){return{...e,sends:e.sends.filter(r=>t-r.at<Mv).slice(-5e3),readings:e.readings.filter(r=>t-r.at<Mv).slice(-50)}}function wA(e,t){let r=[...e.readings].reverse().find(i=>i.sessionPct!==void 0),a=e.pctPer1k;if(r&&t.sessionPct!==void 0&&r.sessionPct!==void 0&&t.sessionPct>r.sessionPct&&t.at-r.at<Fp){let i=e.sends.filter(o=>o.at>r.at&&o.at<=t.at).reduce((o,s)=>o+s.tokens,0);if(i>=5e3){let o=(t.sessionPct-r.sessionPct)/i*1e3;a=a===void 0?o:a*.5+o*.5}}let n=r&&r.sessionPct===t.sessionPct&&r.weekPct===t.weekPct&&t.at-r.at<10*6e4;return{...e,pctPer1k:a,readings:n?e.readings:[...e.readings,t]}}function Hp(e){let{data:t,now:r,plan:a,current:n}=e,i=[...t.readings].reverse().find(S=>S.sessionPct!==void 0||S.weekPct!==void 0),o=[...t.readings].reverse().find(S=>S.weekPct!==void 0),s=[...t.readings].reverse().find(S=>S.sessionPct!==void 0),l=s&&(s.sessionResetsAt??s.at+Fp)>r,c=l&&s.sessionResetsAt?s.sessionResetsAt-Fp:r-Fp,u=t.sends.filter(S=>S.at>=c),d=S=>S.reduce((P,U)=>P+U.tokens,0),m=d(u),p={plan:a,planSource:e.planSource,session:{messages:u.length,tokens:m,since:c},week:{messages:t.sends.length,tokens:d(t.sends)},topChats:[],insights:[]};if(l&&s?.sessionPct!==void 0){let S=d(t.sends.filter(U=>U.at>s.at)),P=s.sessionPct+(t.pctPer1k?S/1e3*t.pctPer1k:0);p.sessionPct=Math.min(100,Math.round(P)),p.sessionResetsAt=s.sessionResetsAt,p.meterAgeMin=Math.round((r-s.at)/6e4)}o?.weekPct!==void 0&&(o.weekResetsAt??1/0)>r&&(p.weekPct=o.weekPct,p.weekResetsAt=o.weekResetsAt,p.weekResetsText=o.weekResetsText);let g=new Map;for(let S of u){let P=g.get(S.chat)??{chat:S.chat,title:e.titles?.get(S.chat),tokens:0,messages:0,share:0};P.tokens+=S.tokens,P.messages++,g.set(S.chat,P)}p.topChats=[...g.values()].map(S=>({...S,share:m?S.tokens/m:0})).sort((S,P)=>P.tokens-S.tokens).slice(0,5);let h=uD,f=(n?.tokens??0)+h,k=cD+h;if(p.sessionPct!==void 0&&t.pctPer1k){let S=Math.max(0,100-p.sessionPct)/t.pctPer1k*1e3;p.left={here:Math.floor(S/f),fresh:Math.floor(S/k)}}let b=p.insights,v=a?a.label:"your plan";if(p.sessionPct!==void 0){let S=p.sessionResetsAt?`; it resets at ${Dv(p.sessionResetsAt)}`:"";p.left&&n&&n.tokens>=1e4&&p.left.fresh>=p.left.here*2?b.push(`About ${Js(p.left.here)} more messages fit in ${v}'s session at this chat's size, or about ${Js(p.left.fresh)} in a new chat (${p.sessionPct}% used${S}). For a new topic, start a new chat. ${Rt}`):p.left?b.push(`About ${Js(p.left.fresh)} more messages like your recent ones fit in this session (${p.sessionPct}% used${S}).`):b.push(`Session ${p.sessionPct}% used${S}.`);let P=s&&t.readings.find(U=>U.sessionPct!==void 0&&U.at>=c);if(P&&s&&P!==s&&p.sessionResetsAt&&p.sessionPct<100){let U=(p.sessionPct-(P.sessionPct??0))/Math.max(1,r-P.at),qe=U>0?r+(100-p.sessionPct)/U:1/0;qe<p.sessionResetsAt&&b.push(`At this pace the session runs out around ${Dv(qe)}, before it resets at ${Dv(p.sessionResetsAt)}. Save the big asks for after the reset, or start new topics in new chats.`)}}let C=p.topChats[0];return C&&u.length>=4&&C.share>=.5&&g.size>1&&b.push(`${Math.round(C.share*100)}% of this session's usage came from one chat${C.title?` ("${C.title}")`:""}: each message there re-read about ${Js(C.tokens/C.messages)} tokens.`),p.weekPct!==void 0&&p.weekResetsAt&&((p.weekResetsAt-r)/36e5<=36&&p.weekPct<=50?b.push(`${100-p.weekPct}% of ${v}'s weekly allowance is unused and resets ${p.weekResetsText??"soon"}. It doesn't carry over, so this is a good time for the big jobs you've been holding back.`):p.weekPct>=80&&b.push(`Week ${p.weekPct}% used${p.weekResetsText?`, resets ${p.weekResetsText}`:""}. New topics in new chats and one complete message per ask stretch what's left.`)),n&&n.tokens>=2e4&&!b.some(S=>S.includes("new chat"))&&b.push(`Every message in this chat re-reads about ${Js(n.tokens)} tokens, ${Math.max(2,Math.round(f/k))}\xD7 a new chat. On ${v} that's what uses your allowance fastest.`),a?p.sessionPct===void 0&&a.site==="claude"&&b.push("Open Settings > Usage in Claude once and Token Lens reads your meter from it, to count how many messages you have left."):b.push("Tell Token Lens your plan once (Free, Pro, Max or Team) for advice that fits it."),p}var gD=/^(?:ok(?:ay)?|k|thanks?(?: you)?(?: so much)?|thx|ty|great|perfect|nice|cool|awesome|got it|understood|sounds good|lgtm|yes|yep|sure|done|👍|🙏)[\s!.,🙂😊👍🙏]*$/i;function SA(e){return gD.test(e.trim())}var Lv=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim();function EA(e,t){let r=Lv(e);return r.split(" ").length<8?!1:Lv(t).includes(r)}function xA(e){return e.split(/\n\s*\n/).map(t=>t.trim()).filter(t=>t.length>=1200).map(t=>qp(Lv(t)))}function TA(e,t,r){let a=Ce(e,r).tokens,n=Ce(t,r).tokens,o=ta(e,t).lost.map(d=>d.replace(":",": ")),s=Zs(e,t),l=o.length===0&&s.length===0,c=a-n,u=l?c>0?"Safe to send: the shorter version keeps every fact, constraint and instruction word.":"Same instructions, but no shorter: keep whichever you prefer.":o.length?"Check before sending: the edit drops facts or constraints that can change the answer.":"Check before sending: the edit drops words that may carry instructions.";return{before:a,after:n,saved:$t(c,r),sameInstructions:l,lostFacts:o,lostWords:s.slice(0,20),verdict:u}}var hD=new Set(["openai","anthropic","google"]);function AA(e,t){let r=e.pricing,a=Math.round(t.callsPerDay*(t.days??30));if(!r)return{priced:!1,callsPerMonth:a,longContext:!1,rates:{input:0,output:0,cached:null},lines:[]};let n=r.longContext&&t.inputTokens>r.longContext.aboveTokens?r.longContext:void 0,i=n?.inputPerMTok??r.inputPerMTok,o=n?.outputPerMTok??r.outputPerMTok,s=r.cachedInputPerMTok===void 0?null:r.cachedInputPerMTok*(i/r.inputPerMTok),l=Math.min(t.repeatedPrefixTokens??0,t.inputTokens),c=Math.min(1,Math.max(0,t.canWaitShare??0)),u=f=>{let k=f&&s!==null?t.inputTokens-l:t.inputTokens,b=f&&s!==null?l:0;return(k*i+b*(s??0)+t.outputTokens*o)/1e6},d=u(!1)*a,m=[{id:"now",label:"As it runs now",monthlyUsd:d,savedUsd:0,note:n?`Each call passes ${n.aboveTokens.toLocaleString("en-US")} input tokens, so the long-context rate applies.`:""}],p=s!==null&&l>0,g=hD.has(e.family)&&c>0;if(p){let f=u(!0)*a;m.push({id:"caching",label:"With prompt caching on the repeated part",monthlyUsd:f,savedUsd:d-f,note:"Same model, same request, same answer. Assumes calls come often enough to keep the cache warm (a few minutes apart); the first call after a gap pays full price, plus a small write fee on some providers."})}let h=f=>f-f*c*.5;if(g){let f=h(d);m.push({id:"batch",label:`Half-price batch for the ${Math.round(c*100)}% of calls that can wait`,monthlyUsd:f,savedUsd:d-f,note:"Same model and same answer, delivered within 24 hours instead of right away."})}if(p&&g){let f=h(u(!0)*a);m.push({id:"both",label:"Both together",monthlyUsd:f,savedUsd:d-f,note:""})}return{priced:!0,callsPerMonth:a,longContext:!!n,rates:{input:i,output:o,cached:s},lines:m}}function Vp(e,t){return e===t||ta(e,t,"presence").ok&&Zs(e,t).length===0}function Uv(e){return Array.isArray(e)?e.map(Uv):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).filter(([t])=>t!=="description").map(([t,r])=>[t,Uv(r)]))}function CA(e){let t=[];e.system&&t.push(["system prompt",e.system]);for(let r of e.tools??[]){r.description&&t.push([`tool ${r.name}`,r.description]);let a=(n,i)=>{if(Array.isArray(n))n.forEach((o,s)=>a(o,`${i}[${s}]`));else if(n&&typeof n=="object")for(let[o,s]of Object.entries(n))o==="description"&&typeof s=="string"?t.push([`tool ${r.name} ${i}`,s]):a(s,`${i}.${o}`)};a(r.parameters,"params")}for(let[r,a]of(e.examples??[]).entries())t.push([`example ${r+1}`,a]);return e.prompt&&t.push(["next prompt",e.prompt]),t}var Gp=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function zA(e,t){let r=[],a=CA(e),n=new Map(CA(t)),i={},o=[];for(let[h,f]of a){let k=n.get(h)??"";for(let[b,[v,C]]of Object.entries(Mp(f,k))){let[S,P]=i[b]??[0,0];i[b]=[S+v,P+C]}ta(f,k,"presence").ok||o.push(h)}let s=Object.entries(i).map(([h,[f,k]])=>`${k}/${f} ${h}s`);r.push({name:"Facts and constraints kept",passed:o.length===0,detail:o.length?`Lost in: ${o.join(", ")}`:s.length?`Kept ${s.join(", ")}.`:"No numbers, links, code or constraint words to keep."});let l=[];for(let[h,f]of a){let k=Zs(f,n.get(h)??"");k.length&&l.push(`${h}: ${k.join(", ")}`)}r.push({name:"Instructions kept",passed:l.length===0,detail:l.length?`Missing words: ${l.join("; ")}`:`Every content word of ${Gp(a.length,"text")} is still there; only filler was removed.`});let c=(h=[])=>JSON.stringify(h.map(f=>[f.name,Uv(f.parameters??null)])),u=c(e.tools)===c(t.tools);r.push({name:"Tool interface unchanged",passed:u,detail:u?`${Gp(e.tools?.length??0,"tool")}: same names, parameters, types, required fields and enums.`:"Tool names or parameter schemas differ."});let d=e.messages??[],m=t.messages??[],p=0,g=d.length===m.length&&d.every((h,f)=>{let k=m[f];if(k.role!==h.role)return!1;if(k.content===h.content)return!0;let b=/^\[Same content as message (\d+) above\.\]$/.exec(k.content),v=!!b&&d[Number(b[1])-1]?.content.trim()===h.content.trim();return v&&p++,v});return d.length&&r.push({name:"Conversation unchanged",passed:g,detail:g?`${Gp(d.length,"message")} in order${p?`; ${Gp(p,"exact repeat")} replaced by a pointer to the first copy`:", all verbatim"}.`:"Messages were dropped, reordered or edited."}),r.push({name:"Model and examples unchanged",passed:(e.examples?.length??0)===(t.examples?.length??0),detail:"Token Lens never switches the model or drops examples on its own."}),{passed:r.every(h=>h.passed),checks:r}}var Ye=e=>e.toLocaleString("en-US"),IA=(e,t)=>t?Math.round(e/t*100):0;function PA(e){return`${e.name}
|
|
3372
3372
|
${e.description??""}
|
|
3373
3373
|
${e.parameters?JSON.stringify(e.parameters):""}`}function OA(e,t=[]){if(e&&typeof e=="object")for(let[r,a]of Object.entries(e))r==="description"&&typeof a=="string"?t.push(a):OA(a,t);return t}function RA(e){let t=(e.description??"").replace(/\s+/g," ").trim().split(/(?<=[.!?])\s/)[0]??"";return t.length>100?`${t.slice(0,97).trimEnd()}...`:t}function qv(e){let t=e.map(a=>`- ${a.name}${RA(a)?`: ${RA(a)}`:""}`).join(`
|
|
3374
3374
|
`),r=e.map(a=>a.name);return{tools:[{name:"get_tool_schema",description:`Get the full definition (description and parameters) of a tool before calling it. Available tools:
|
|
@@ -3555,7 +3555,7 @@ if(k.insights.length)h+='<ul>'+k.insights.map(t=>'<li>'+esc(t)+'</li>').join("")
|
|
|
3555
3555
|
ke.innerHTML=h;document.querySelectorAll("#plans button").forEach(b=>b.classList.toggle("on",!!k.plan&&k.planSource==="set"&&b.dataset.p===k.plan.id))}
|
|
3556
3556
|
}catch(e){document.getElementById("status").textContent="Token Lens isn't running. Open Claude."}}
|
|
3557
3557
|
tick();setInterval(tick,1000);
|
|
3558
|
-
</script></body></html>`;import{execFile as lq}from"node:child_process";var ce;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},e.getValidEnumValues=n=>{let i=e.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),o={};for(let s of i)o[s]=n[s];return e.objectValues(o)},e.objectValues=n=>e.objectKeys(n).map(function(i){return n[i]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},e.find=(n,i)=>{for(let o of n)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=a,e.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(ce||(ce={}));var YA;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(YA||(YA={}));var N=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fn=e=>{switch(typeof e){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(e)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(e)?N.array:e===null?N.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?N.promise:typeof Map<"u"&&e instanceof Map?N.map:typeof Set<"u"&&e instanceof Set?N.set:typeof Date<"u"&&e instanceof Date?N.date:N.object;default:return N.unknown}};var A=ce.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 jt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};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},a={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)a._errors.push(r(o));else{let s=a,l=0;for(;l<o.path.length;){let c=o.path[l],u=l===o.path.length-1;if(c==="_errors"){u&&s._errors.push(r(o)),l++;continue}Object.prototype.hasOwnProperty.call(s,c)||(c==="__proto__"?Object.defineProperty(s,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):s[c]={_errors:[]}),s=s[c],u&&s._errors.push(r(o)),l++}}};return n(this),a}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,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),a=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(t(n))}else a.push(t(n));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};jt.create=e=>new jt(e);var nM=(e,t)=>{let r;switch(e.code){case A.invalid_type:e.received===N.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case A.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ce.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:r=`Unrecognized key(s) in object: ${ce.joinValues(e.keys,", ")}`;break;case A.invalid_union:r="Invalid input";break;case A.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ce.joinValues(e.options)}`;break;case A.invalid_enum_value:r=`Invalid enum value. Expected ${ce.joinValues(e.options)}, received '${e.received}'`;break;case A.invalid_arguments:r="Invalid function arguments";break;case A.invalid_return_type:r="Invalid function return type";break;case A.invalid_date:r="Invalid date";break;case A.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}"`:ce.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case A.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 A.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 A.custom:r="Invalid input";break;case A.invalid_intersection_types:r="Intersection results could not be merged";break;case A.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case A.not_finite:r="Number must be finite";break;default:r=t.defaultError,ce.assertNever(e)}return{message:r}},br=nM;var rM=br;function el(){return rM}var nm=e=>{let{data:t,path:r,errorMaps:a,issueData:n}=e,i=[...r,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let s="",l=a.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:t,defaultError:s}).message;return{...n,path:i,message:s}};function R(e,t){let r=el(),a=nm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===br?void 0:br].filter(n=>!!n)});e.common.issues.push(a)}var rt=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 a=[];for(let n of r){if(n.status==="aborted")return W;n.status==="dirty"&&t.dirty(),a.push(n.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let n of r){let i=await n.key,o=await n.value;a.push({key:i,value:o})}return e.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let n of r){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return W;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(a[i.value]=o.value)}return{status:t.value,value:a}}},W=Object.freeze({status:"aborted"}),Pi=e=>({status:"dirty",value:e}),gt=e=>({status:"valid",value:e}),ry=e=>e.status==="aborted",ay=e=>e.status==="dirty",ra=e=>e.status==="valid",tl=e=>typeof Promise<"u"&&e instanceof Promise;var L;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(L||(L={}));var Ut=class{constructor(t,r,a,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=n}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}},XA=(e,t)=>{if(ra(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 jt(e.common.issues);return this._error=r,this._error}}};function X(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:n}=e;if(t&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(o,s)=>{let{message:l}=e;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??a??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:n}}var ie=class{get description(){return this._def.description}_getType(t){return Fn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(tl(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 a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},n=this._parseSync({data:t,path:a.path,parent:a});return XA(a,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return ra(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>ra(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},n=this._parse({data:t,path:a.path,parent:a}),i=await(tl(n)?n:Promise.resolve(n));return XA(a,i)}refine(t,r){let a=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let o=t(n),s=()=>i.addIssue({code:A.custom,...a(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(t,r){return this._refinement((a,n)=>t(a)?!0:(n.addIssue(typeof r=="function"?r(a,n):r),!1))}_refinement(t){return new Yt({schema:this,typeName:I.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 Jt.create(this,this._def)}nullable(){return Gn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return aa.create(this,this._def)}or(t){return Ni.create([this,t],this._def)}and(t){return Di.create(this,t,this._def)}transform(t){return new Yt({...X(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Fi({...X(this._def),innerType:this,defaultValue:r,typeName:I.ZodDefault})}brand(){return new rm({typeName:I.ZodBranded,type:this,...X(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new qi({...X(this._def),innerType:this,catchValue:r,typeName:I.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return am.create(this,t)}readonly(){return Hi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},aM=/^c[^\s-]{8,}$/i,iM=/^[0-9a-z]+$/,oM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sM=/^[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,lM=/^[a-z0-9_-]{21}$/i,cM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uM=/^[-+]?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)?)??$/,dM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pM="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",iy,mM=/^(?:(?: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])$/,gM=/^(?:(?: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])$/,hM=/^(([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]))$/,fM=/^(([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])$/,bM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,QA="((\\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])))",yM=new RegExp(`^${QA}$`);function eC(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 kM(e){return new RegExp(`^${eC(e)}$`)}function _M(e){let t=`${QA}T${eC(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 wM(e,t){return!!((t==="v4"||!t)&&mM.test(e)||(t==="v6"||!t)&&hM.test(e))}function SM(e,t){if(!cM.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function EM(e,t){return!!((t==="v4"||!t)&&gM.test(e)||(t==="v6"||!t)&&fM.test(e))}var $i=class e extends ie{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==N.string){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_type,expected:N.string,received:i.parsedType}),W}let a=new rt,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let o=t.data.length>i.value,s=t.data.length<i.value;(o||s)&&(n=this._getOrReturnCtx(t,n),o?R(n,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&R(n,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")dM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"email",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")iy||(iy=new RegExp(pM,"u")),iy.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"emoji",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")sM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"uuid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")lM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"nanoid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")aM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"cuid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")iM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"cuid2",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")oM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"ulid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),R(n,{validation:"url",code:A.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"regex",code:A.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.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)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?_M(i).test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?yM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?kM(i).test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?uM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"duration",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?wM(t.data,i.version)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"ip",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?SM(t.data,i.alg)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"jwt",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?EM(t.data,i.version)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"cidr",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?bM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"base64",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?vM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"base64url",code:A.invalid_string,message:i.message}),a.dirty()):ce.assertNever(i);return{status:a.value,value:t.data}}_regex(t,r,a){return this.refinement(n=>t.test(n),{validation:r,code:A.invalid_string,...L.errToObj(a)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...L.errToObj(t)})}url(t){return this._addCheck({kind:"url",...L.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...L.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...L.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...L.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...L.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...L.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...L.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...L.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...L.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...L.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...L.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...L.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,...L.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,...L.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...L.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...L.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...L.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...L.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...L.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...L.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...L.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...L.errToObj(r)})}nonempty(t){return this.min(1,L.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}};$i.create=e=>new $i({checks:[],typeName:I.ZodString,coerce:e?.coerce??!1,...X(e)});function xM(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=r>a?r:a,i=Number.parseInt(e.toFixed(n).replace(".","")),o=Number.parseInt(t.toFixed(n).replace(".",""));return i%o/10**n}var nl=class e extends ie{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)!==N.number){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_type,expected:N.number,received:i.parsedType}),W}let a,n=new rt;for(let i of this._def.checks)i.kind==="int"?ce.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),R(a,{code:A.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?xM(t.data,i.value)!==0&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),R(a,{code:A.not_finite,message:i.message}),n.dirty()):ce.assertNever(i);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,L.toString(r))}gt(t,r){return this.setLimit("min",t,!1,L.toString(r))}lte(t,r){return this.setLimit("max",t,!0,L.toString(r))}lt(t,r){return this.setLimit("max",t,!1,L.toString(r))}setLimit(t,r,a,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:L.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:L.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:L.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:L.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L.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"&&ce.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(t===null||a.value<t)&&(t=a.value)}return Number.isFinite(r)&&Number.isFinite(t)}};nl.create=e=>new nl({checks:[],typeName:I.ZodNumber,coerce:e?.coerce||!1,...X(e)});var rl=class e extends ie{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)!==N.bigint)return this._getInvalidInput(t);let a,n=new rt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):ce.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return R(r,{code:A.invalid_type,expected:N.bigint,received:r.parsedType}),W}gte(t,r){return this.setLimit("min",t,!0,L.toString(r))}gt(t,r){return this.setLimit("min",t,!1,L.toString(r))}lte(t,r){return this.setLimit("max",t,!0,L.toString(r))}lt(t,r){return this.setLimit("max",t,!1,L.toString(r))}setLimit(t,r,a,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:L.toString(n)}]})}_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:L.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:L.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:L.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:L.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:L.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}};rl.create=e=>new rl({checks:[],typeName:I.ZodBigInt,coerce:e?.coerce??!1,...X(e)});var al=class extends ie{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==N.boolean){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.boolean,received:a.parsedType}),W}return gt(t.data)}};al.create=e=>new al({typeName:I.ZodBoolean,coerce:e?.coerce||!1,...X(e)});var il=class e extends ie{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==N.date){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_type,expected:N.date,received:i.parsedType}),W}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_date}),W}let a=new rt,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):ce.assertNever(i);return{status:a.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:L.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:L.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}};il.create=e=>new il({checks:[],coerce:e?.coerce||!1,typeName:I.ZodDate,...X(e)});var ol=class extends ie{_parse(t){if(this._getType(t)!==N.symbol){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.symbol,received:a.parsedType}),W}return gt(t.data)}};ol.create=e=>new ol({typeName:I.ZodSymbol,...X(e)});var ji=class extends ie{_parse(t){if(this._getType(t)!==N.undefined){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.undefined,received:a.parsedType}),W}return gt(t.data)}};ji.create=e=>new ji({typeName:I.ZodUndefined,...X(e)});var Oi=class extends ie{_parse(t){if(this._getType(t)!==N.null){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.null,received:a.parsedType}),W}return gt(t.data)}};Oi.create=e=>new Oi({typeName:I.ZodNull,...X(e)});var sl=class extends ie{constructor(){super(...arguments),this._any=!0}_parse(t){return gt(t.data)}};sl.create=e=>new sl({typeName:I.ZodAny,...X(e)});var vr=class extends ie{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gt(t.data)}};vr.create=e=>new vr({typeName:I.ZodUnknown,...X(e)});var fn=class extends ie{_parse(t){let r=this._getOrReturnCtx(t);return R(r,{code:A.invalid_type,expected:N.never,received:r.parsedType}),W}};fn.create=e=>new fn({typeName:I.ZodNever,...X(e)});var ll=class extends ie{_parse(t){if(this._getType(t)!==N.undefined){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.void,received:a.parsedType}),W}return gt(t.data)}};ll.create=e=>new ll({typeName:I.ZodVoid,...X(e)});var yr=class e extends ie{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),n=this._def;if(r.parsedType!==N.array)return R(r,{code:A.invalid_type,expected:N.array,received:r.parsedType}),W;if(n.exactLength!==null){let o=r.data.length>n.exactLength.value,s=r.data.length<n.exactLength.value;(o||s)&&(R(r,{code:o?A.too_big:A.too_small,minimum:s?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(R(r,{code:A.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(R(r,{code:A.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>n.type._parseAsync(new Ut(r,o,r.path,s)))).then(o=>rt.mergeArray(a,o));let i=[...r.data].map((o,s)=>n.type._parseSync(new Ut(r,o,r.path,s)));return rt.mergeArray(a,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:L.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:L.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:L.toString(r)}})}nonempty(t){return this.min(1,t)}};yr.create=(e,t)=>new yr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...X(t)});function Ri(e){if(e instanceof Ot){let t={};for(let r in e.shape){let a=e.shape[r];t[r]=Jt.create(Ri(a))}return new Ot({...e._def,shape:()=>t})}else return e instanceof yr?new yr({...e._def,type:Ri(e.element)}):e instanceof Jt?Jt.create(Ri(e.unwrap())):e instanceof Gn?Gn.create(Ri(e.unwrap())):e instanceof Hn?Hn.create(e.items.map(t=>Ri(t))):e}var Ot=class e extends ie{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=ce.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==N.object){let c=this._getOrReturnCtx(t);return R(c,{code:A.invalid_type,expected:N.object,received:c.parsedType}),W}let{status:a,ctx:n}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof fn&&this._def.unknownKeys==="strip"))for(let c in n.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=i[c],d=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ut(n,d,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof fn){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")s.length>0&&(R(n,{code:A.unrecognized_keys,keys:s}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ut(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,m=await u.value;c.push({key:d,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>rt.mergeObjectSync(a,c)):rt.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(t){return L.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,a)=>{let n=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:L.errToObj(t).message??n}:{message:n}}}:{}})}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:I.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let a of ce.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let a of ce.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ri(this)}partial(t){let r={};for(let a of ce.objectKeys(this.shape)){let n=this.shape[a];t&&!t[a]?r[a]=n:r[a]=n.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let a of ce.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Jt;)i=i._def.innerType;r[a]=i}return new e({...this._def,shape:()=>r})}keyof(){return tC(ce.objectKeys(this.shape))}};Ot.create=(e,t)=>new Ot({shape:()=>e,unknownKeys:"strip",catchall:fn.create(),typeName:I.ZodObject,...X(t)});Ot.strictCreate=(e,t)=>new Ot({shape:()=>e,unknownKeys:"strict",catchall:fn.create(),typeName:I.ZodObject,...X(t)});Ot.lazycreate=(e,t)=>new Ot({shape:e,unknownKeys:"strip",catchall:fn.create(),typeName:I.ZodObject,...X(t)});var Ni=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;function n(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 o=i.map(s=>new jt(s.ctx.common.issues));return R(r,{code:A.invalid_union,unionErrors:o}),W}if(r.common.async)return Promise.all(a.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let l of a){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(l=>new jt(l));return R(r,{code:A.invalid_union,unionErrors:s}),W}}get options(){return this._def.options}};Ni.create=(e,t)=>new Ni({options:e,typeName:I.ZodUnion,...X(t)});var qn=e=>e instanceof Mi?qn(e.schema):e instanceof Yt?qn(e.innerType()):e instanceof Li?[e.value]:e instanceof Bi?e.options:e instanceof Ui?ce.objectValues(e.enum):e instanceof Fi?qn(e._def.innerType):e instanceof ji?[void 0]:e instanceof Oi?[null]:e instanceof Jt?[void 0,...qn(e.unwrap())]:e instanceof Gn?[null,...qn(e.unwrap())]:e instanceof rm||e instanceof Hi?qn(e.unwrap()):e instanceof qi?qn(e._def.innerType):[],oy=class e extends ie{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==N.object)return R(r,{code:A.invalid_type,expected:N.object,received:r.parsedType}),W;let a=this.discriminator,n=r.data[a],i=this.optionsMap.get(n);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}):(R(r,{code:A.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),W)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let n=new Map;for(let i of r){let o=qn(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of o){if(n.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);n.set(s,i)}}return new e({typeName:I.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...X(a)})}};function sy(e,t){let r=Fn(e),a=Fn(t);if(e===t)return{valid:!0,data:e};if(r===N.object&&a===N.object){let n=ce.objectKeys(t),i=ce.objectKeys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let s of i){if(s==="__proto__")continue;let l=sy(e[s],t[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===N.array&&a===N.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<e.length;i++){let o=e[i],s=t[i],l=sy(o,s);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return r===N.date&&a===N.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Di=class extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=(i,o)=>{if(ry(i)||ry(o))return W;let s=sy(i.value,o.value);return s.valid?((ay(i)||ay(o))&&r.dirty(),{status:r.value,value:s.data}):(R(a,{code:A.invalid_intersection_types}),W)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Di.create=(e,t,r)=>new Di({left:e,right:t,typeName:I.ZodIntersection,...X(r)});var Hn=class e extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.array)return R(a,{code:A.invalid_type,expected:N.array,received:a.parsedType}),W;if(a.data.length<this._def.items.length)return R(a,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W;!this._def.rest&&a.data.length>this._def.items.length&&(R(a,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...a.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Ut(a,o,a.path,s)):null}).filter(o=>!!o);return a.common.async?Promise.all(i).then(o=>rt.mergeArray(r,o)):rt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Hn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Hn({items:e,typeName:I.ZodTuple,rest:null,...X(t)})};var ly=class e extends ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.object)return R(a,{code:A.invalid_type,expected:N.object,received:a.parsedType}),W;let n=[],i=this._def.keyType,o=this._def.valueType;for(let s in a.data)n.push({key:i._parse(new Ut(a,s,a.path,s)),value:o._parse(new Ut(a,a.data[s],a.path,s)),alwaysSet:s in a.data});return a.common.async?rt.mergeObjectAsync(r,n):rt.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,a){return r instanceof ie?new e({keyType:t,valueType:r,typeName:I.ZodRecord,...X(a)}):new e({keyType:$i.create(),valueType:t,typeName:I.ZodRecord,...X(r)})}},cl=class extends ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.map)return R(a,{code:A.invalid_type,expected:N.map,received:a.parsedType}),W;let n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([s,l],c)=>({key:n._parse(new Ut(a,s,a.path,[c,"key"])),value:i._parse(new Ut(a,l,a.path,[c,"value"]))}));if(a.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return W;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return W;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}}}};cl.create=(e,t,r)=>new cl({valueType:t,keyType:e,typeName:I.ZodMap,...X(r)});var ul=class e extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.set)return R(a,{code:A.invalid_type,expected:N.set,received:a.parsedType}),W;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(R(a,{code:A.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(R(a,{code:A.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return W;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let s=[...a.data.values()].map((l,c)=>i._parse(new Ut(a,l,a.path,c)));return a.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:L.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:L.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ul.create=(e,t)=>new ul({valueType:e,minSize:null,maxSize:null,typeName:I.ZodSet,...X(t)});var cy=class e extends ie{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==N.function)return R(r,{code:A.invalid_type,expected:N.function,received:r.parsedType}),W;function a(s,l){return nm({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,el(),br].filter(c=>!!c),issueData:{code:A.invalid_arguments,argumentsError:l}})}function n(s,l){return nm({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,el(),br].filter(c=>!!c),issueData:{code:A.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof aa){let s=this;return gt(async function(...l){let c=new jt([]),u=await s._def.args.parseAsync(l,i).catch(p=>{throw c.addIssue(a(l,p)),c}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw c.addIssue(n(d,p)),c})})}else{let s=this;return gt(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new jt([a(l,c.error)]);let u=Reflect.apply(o,this,c.data),d=s._def.returns.safeParse(u,i);if(!d.success)throw new jt([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Hn.create(t).rest(vr.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,a){return new e({args:t||Hn.create([]).rest(vr.create()),returns:r||vr.create(),typeName:I.ZodFunction,...X(a)})}},Mi=class extends ie{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})}};Mi.create=(e,t)=>new Mi({getter:e,typeName:I.ZodLazy,...X(t)});var Li=class extends ie{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return R(r,{received:r.data,code:A.invalid_literal,expected:this._def.value}),W}return{status:"valid",value:t.data}}get value(){return this._def.value}};Li.create=(e,t)=>new Li({value:e,typeName:I.ZodLiteral,...X(t)});function tC(e,t){return new Bi({values:e,typeName:I.ZodEnum,...X(t)})}var Bi=class e extends ie{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),a=this._def.values;return R(r,{expected:ce.joinValues(a),received:r.parsedType,code:A.invalid_type}),W}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return R(r,{received:r.data,code:A.invalid_enum_value,options:a}),W}return gt(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(a=>!t.includes(a)),{...this._def,...r})}};Bi.create=tC;var Ui=class extends ie{_parse(t){let r=ce.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==N.string&&a.parsedType!==N.number){let n=ce.objectValues(r);return R(a,{expected:ce.joinValues(n),received:a.parsedType,code:A.invalid_type}),W}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=ce.objectValues(r);return R(a,{received:a.data,code:A.invalid_enum_value,options:n}),W}return gt(t.data)}get enum(){return this._def.values}};Ui.create=(e,t)=>new Ui({values:e,typeName:I.ZodNativeEnum,...X(t)});var aa=class extends ie{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==N.promise&&r.common.async===!1)return R(r,{code:A.invalid_type,expected:N.promise,received:r.parsedType}),W;let a=r.parsedType===N.promise?r.data:Promise.resolve(r.data);return gt(a.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};aa.create=(e,t)=>new aa({type:e,typeName:I.ZodPromise,...X(t)});var Yt=class extends ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:o=>{R(a,o),o.fatal?r.abort():r.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(a.data,i);if(a.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return W;let l=await this._def.schema._parseAsync({data:s,path:a.path,parent:a});return l.status==="aborted"?W:l.status==="dirty"?Pi(l.value):r.value==="dirty"?Pi(l.value):l});{if(r.value==="aborted")return W;let s=this._def.schema._parseSync({data:o,path:a.path,parent:a});return s.status==="aborted"?W:s.status==="dirty"?Pi(s.value):r.value==="dirty"?Pi(s.value):s}}if(n.type==="refinement"){let o=s=>{let l=n.refinement(s,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?W:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>s.status==="aborted"?W:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(n.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!ra(o))return W;let s=n.transform(o.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:a.data,path:a.path,parent:a}).then(o=>ra(o)?Promise.resolve(n.transform(o.value,i)).then(s=>({status:r.value,value:s})):W);ce.assertNever(n)}};Yt.create=(e,t,r)=>new Yt({schema:e,typeName:I.ZodEffects,effect:t,...X(r)});Yt.createWithPreprocess=(e,t,r)=>new Yt({schema:t,effect:{type:"preprocess",transform:e},typeName:I.ZodEffects,...X(r)});var Jt=class extends ie{_parse(t){return this._getType(t)===N.undefined?gt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Jt.create=(e,t)=>new Jt({innerType:e,typeName:I.ZodOptional,...X(t)});var Gn=class extends ie{_parse(t){return this._getType(t)===N.null?gt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Gn.create=(e,t)=>new Gn({innerType:e,typeName:I.ZodNullable,...X(t)});var Fi=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===N.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fi.create=(e,t)=>new Fi({innerType:e,typeName:I.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});var qi=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return tl(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new jt(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new jt(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};qi.create=(e,t)=>new qi({innerType:e,typeName:I.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});var dl=class extends ie{_parse(t){if(this._getType(t)!==N.nan){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.nan,received:a.parsedType}),W}return{status:"valid",value:t.data}}};dl.create=e=>new dl({typeName:I.ZodNaN,...X(e)});var rm=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},am=class e extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?W:i.status==="dirty"?(r.dirty(),Pi(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?W:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(t,r){return new e({in:t,out:r,typeName:I.ZodPipeline})}},Hi=class extends ie{_parse(t){let r=this._def.innerType._parse(t),a=n=>(ra(n)&&(n.value=Object.freeze(n.value)),n);return tl(r)?r.then(n=>a(n)):a(r)}unwrap(){return this._def.innerType}};Hi.create=(e,t)=>new Hi({innerType:e,typeName:I.ZodReadonly,...X(t)});var JK={object:Ot.lazycreate},I;(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"})(I||(I={}));var YK=$i.create,XK=nl.create,QK=dl.create,eZ=rl.create,tZ=al.create,nZ=il.create,rZ=ol.create,aZ=ji.create,iZ=Oi.create,oZ=sl.create,sZ=vr.create,lZ=fn.create,cZ=ll.create,uZ=yr.create,nC=Ot.create,dZ=Ot.strictCreate,pZ=Ni.create,mZ=oy.create,gZ=Di.create,hZ=Hn.create,fZ=ly.create,bZ=cl.create,vZ=ul.create,yZ=cy.create,kZ=Mi.create,_Z=Li.create,wZ=Bi.create,SZ=Ui.create,EZ=aa.create,xZ=Yt.create,TZ=Jt.create,AZ=Gn.create,CZ=Yt.createWithPreprocess,zZ=am.create;var AM=y("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Z.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){sn(this,"with",e)},parse(e,t){return Or(this,e,t,{callee:this.parse})},parseAsync(e,t){return Nr(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Ia(this,e,t)},safeParseAsync(e,t){return Ra(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}});var CM=y("ZodMiniObject",(e,t)=>{ru.init(e,t),AM.init(e,t),pg(e,"shape",r=>r._zod.def.shape,!1)});function uy(e,t){let r={type:"object",shape:e??{},...z(t)};return new CM(r)}function bn(e){return!!e._zod}function ia(e){let t=Object.values(e);if(t.length===0)return uy({});let r=t.every(bn),a=t.every(n=>!bn(n));if(r)return uy(e);if(a)return nC(e);throw new Error("Mixed Zod versions detected in object shape.")}function kr(e,t){return bn(e)?Ia(e,t):e.safeParse(t)}async function im(e,t){return bn(e)?await Ra(e,t):await e.safeParseAsync(t)}function _r(e){if(!e)return;let t;if(bn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Gi(e){if(e){if(typeof e=="object"){let t=e,r=e;if(!t._def&&!r._zod){let a=Object.values(e);if(a.length>0&&a.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return ia(e)}}if(bn(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function IM(e){return e.length===0?"object root":e.reduce((t,r,a)=>a===0?String(r):typeof r=="number"?`${t}[${r}]`:`${t}.${r}`,"")}function om(e){if(e&&typeof e=="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map(t=>t.path?.length?`${t.message} at ${IM(t.path)}`:t.message).join(`
|
|
3558
|
+
</script></body></html>`;import{execFile as lq}from"node:child_process";var ce;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{let i={};for(let o of n)i[o]=o;return i},e.getValidEnumValues=n=>{let i=e.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),o={};for(let s of i)o[s]=n[s];return e.objectValues(o)},e.objectValues=n=>e.objectKeys(n).map(function(i){return n[i]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let i=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(o);return i},e.find=(n,i)=>{for(let o of n)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function a(n,i=" | "){return n.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=a,e.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(ce||(ce={}));var YA;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(YA||(YA={}));var N=ce.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Fn=e=>{switch(typeof e){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(e)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(e)?N.array:e===null?N.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?N.promise:typeof Map<"u"&&e instanceof Map?N.map:typeof Set<"u"&&e instanceof Set?N.set:typeof Date<"u"&&e instanceof Date?N.date:N.object;default:return N.unknown}};var A=ce.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 jt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};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},a={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)a._errors.push(r(o));else{let s=a,l=0;for(;l<o.path.length;){let c=o.path[l],u=l===o.path.length-1;if(c==="_errors"){u&&s._errors.push(r(o)),l++;continue}Object.prototype.hasOwnProperty.call(s,c)||(c==="__proto__"?Object.defineProperty(s,c,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):s[c]={_errors:[]}),s=s[c],u&&s._errors.push(r(o)),l++}}};return n(this),a}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,ce.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),a=[];for(let n of this.issues)if(n.path.length>0){let i=n.path[0];r[i]=r[i]||[],r[i].push(t(n))}else a.push(t(n));return{formErrors:a,fieldErrors:r}}get formErrors(){return this.flatten()}};jt.create=e=>new jt(e);var nM=(e,t)=>{let r;switch(e.code){case A.invalid_type:e.received===N.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case A.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ce.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:r=`Unrecognized key(s) in object: ${ce.joinValues(e.keys,", ")}`;break;case A.invalid_union:r="Invalid input";break;case A.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ce.joinValues(e.options)}`;break;case A.invalid_enum_value:r=`Invalid enum value. Expected ${ce.joinValues(e.options)}, received '${e.received}'`;break;case A.invalid_arguments:r="Invalid function arguments";break;case A.invalid_return_type:r="Invalid function return type";break;case A.invalid_date:r="Invalid date";break;case A.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}"`:ce.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case A.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 A.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 A.custom:r="Invalid input";break;case A.invalid_intersection_types:r="Intersection results could not be merged";break;case A.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case A.not_finite:r="Number must be finite";break;default:r=t.defaultError,ce.assertNever(e)}return{message:r}},br=nM;var rM=br;function el(){return rM}var nm=e=>{let{data:t,path:r,errorMaps:a,issueData:n}=e,i=[...r,...n.path||[]],o={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let s="",l=a.filter(c=>!!c).slice().reverse();for(let c of l)s=c(o,{data:t,defaultError:s}).message;return{...n,path:i,message:s}};function R(e,t){let r=el(),a=nm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===br?void 0:br].filter(n=>!!n)});e.common.issues.push(a)}var rt=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 a=[];for(let n of r){if(n.status==="aborted")return W;n.status==="dirty"&&t.dirty(),a.push(n.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,r){let a=[];for(let n of r){let i=await n.key,o=await n.value;a.push({key:i,value:o})}return e.mergeObjectSync(t,a)}static mergeObjectSync(t,r){let a={};for(let n of r){let{key:i,value:o}=n;if(i.status==="aborted"||o.status==="aborted")return W;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(a[i.value]=o.value)}return{status:t.value,value:a}}},W=Object.freeze({status:"aborted"}),Pi=e=>({status:"dirty",value:e}),gt=e=>({status:"valid",value:e}),ry=e=>e.status==="aborted",ay=e=>e.status==="dirty",ra=e=>e.status==="valid",tl=e=>typeof Promise<"u"&&e instanceof Promise;var L;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(L||(L={}));var Ut=class{constructor(t,r,a,n){this._cachedPath=[],this.parent=t,this.data=r,this._path=a,this._key=n}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}},XA=(e,t)=>{if(ra(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 jt(e.common.issues);return this._error=r,this._error}}};function X(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:n}=e;if(t&&(r||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:n}:{errorMap:(o,s)=>{let{message:l}=e;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??a??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:n}}var ie=class{get description(){return this._def.description}_getType(t){return Fn(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rt,ctx:{common:t.parent.common,data:t.data,parsedType:Fn(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(tl(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 a=this.safeParse(t,r);if(a.success)return a.data;throw a.error}safeParse(t,r){let a={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},n=this._parseSync({data:t,path:a.path,parent:a});return XA(a,n)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)};if(!this["~standard"].async)try{let a=this._parseSync({data:t,path:[],parent:r});return ra(a)?{value:a.value}:{issues:r.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(a=>ra(a)?{value:a.value}:{issues:r.common.issues})}async parseAsync(t,r){let a=await this.safeParseAsync(t,r);if(a.success)return a.data;throw a.error}async safeParseAsync(t,r){let a={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Fn(t)},n=this._parse({data:t,path:a.path,parent:a}),i=await(tl(n)?n:Promise.resolve(n));return XA(a,i)}refine(t,r){let a=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,i)=>{let o=t(n),s=()=>i.addIssue({code:A.custom,...a(n)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(t,r){return this._refinement((a,n)=>t(a)?!0:(n.addIssue(typeof r=="function"?r(a,n):r),!1))}_refinement(t){return new Yt({schema:this,typeName:I.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 Jt.create(this,this._def)}nullable(){return Gn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return aa.create(this,this._def)}or(t){return Ni.create([this,t],this._def)}and(t){return Di.create(this,t,this._def)}transform(t){return new Yt({...X(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Fi({...X(this._def),innerType:this,defaultValue:r,typeName:I.ZodDefault})}brand(){return new rm({typeName:I.ZodBranded,type:this,...X(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new qi({...X(this._def),innerType:this,catchValue:r,typeName:I.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return am.create(this,t)}readonly(){return Hi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},aM=/^c[^\s-]{8,}$/i,iM=/^[0-9a-z]+$/,oM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,sM=/^[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,lM=/^[a-z0-9_-]{21}$/i,cM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uM=/^[-+]?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)?)??$/,dM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,pM="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",iy,mM=/^(?:(?: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])$/,gM=/^(?:(?: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])$/,hM=/^(([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]))$/,fM=/^(([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])$/,bM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,QA="((\\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])))",yM=new RegExp(`^${QA}$`);function eC(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 kM(e){return new RegExp(`^${eC(e)}$`)}function _M(e){let t=`${QA}T${eC(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 wM(e,t){return!!((t==="v4"||!t)&&mM.test(e)||(t==="v6"||!t)&&hM.test(e))}function SM(e,t){if(!cM.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(a));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||t&&n.alg!==t)}catch{return!1}}function EM(e,t){return!!((t==="v4"||!t)&&gM.test(e)||(t==="v6"||!t)&&fM.test(e))}var $i=class e extends ie{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==N.string){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_type,expected:N.string,received:i.parsedType}),W}let a=new rt,n;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="max")t.data.length>i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),a.dirty());else if(i.kind==="length"){let o=t.data.length>i.value,s=t.data.length<i.value;(o||s)&&(n=this._getOrReturnCtx(t,n),o?R(n,{code:A.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&R(n,{code:A.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),a.dirty())}else if(i.kind==="email")dM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"email",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="emoji")iy||(iy=new RegExp(pM,"u")),iy.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"emoji",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="uuid")sM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"uuid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="nanoid")lM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"nanoid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid")aM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"cuid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="cuid2")iM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"cuid2",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="ulid")oM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"ulid",code:A.invalid_string,message:i.message}),a.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),R(n,{validation:"url",code:A.invalid_string,message:i.message}),a.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"regex",code:A.invalid_string,message:i.message}),a.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),a.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)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:{startsWith:i.value},message:i.message}),a.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:{endsWith:i.value},message:i.message}),a.dirty()):i.kind==="datetime"?_M(i).test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:"datetime",message:i.message}),a.dirty()):i.kind==="date"?yM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:"date",message:i.message}),a.dirty()):i.kind==="time"?kM(i).test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{code:A.invalid_string,validation:"time",message:i.message}),a.dirty()):i.kind==="duration"?uM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"duration",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="ip"?wM(t.data,i.version)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"ip",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="jwt"?SM(t.data,i.alg)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"jwt",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="cidr"?EM(t.data,i.version)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"cidr",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="base64"?bM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"base64",code:A.invalid_string,message:i.message}),a.dirty()):i.kind==="base64url"?vM.test(t.data)||(n=this._getOrReturnCtx(t,n),R(n,{validation:"base64url",code:A.invalid_string,message:i.message}),a.dirty()):ce.assertNever(i);return{status:a.value,value:t.data}}_regex(t,r,a){return this.refinement(n=>t.test(n),{validation:r,code:A.invalid_string,...L.errToObj(a)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...L.errToObj(t)})}url(t){return this._addCheck({kind:"url",...L.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...L.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...L.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...L.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...L.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...L.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...L.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...L.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...L.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...L.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...L.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...L.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,...L.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,...L.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...L.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...L.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...L.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...L.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...L.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...L.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...L.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...L.errToObj(r)})}nonempty(t){return this.min(1,L.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}};$i.create=e=>new $i({checks:[],typeName:I.ZodString,coerce:e?.coerce??!1,...X(e)});function xM(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=r>a?r:a,i=Number.parseInt(e.toFixed(n).replace(".","")),o=Number.parseInt(t.toFixed(n).replace(".",""));return i%o/10**n}var nl=class e extends ie{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)!==N.number){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_type,expected:N.number,received:i.parsedType}),W}let a,n=new rt;for(let i of this._def.checks)i.kind==="int"?ce.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),R(a,{code:A.invalid_type,expected:"integer",received:"float",message:i.message}),n.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),n.dirty()):i.kind==="multipleOf"?xM(t.data,i.value)!==0&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),R(a,{code:A.not_finite,message:i.message}),n.dirty()):ce.assertNever(i);return{status:n.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,L.toString(r))}gt(t,r){return this.setLimit("min",t,!1,L.toString(r))}lte(t,r){return this.setLimit("max",t,!0,L.toString(r))}lt(t,r){return this.setLimit("max",t,!1,L.toString(r))}setLimit(t,r,a,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:L.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:L.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:L.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:L.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:L.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:L.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:L.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:L.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:L.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:L.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"&&ce.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(r===null||a.value>r)&&(r=a.value):a.kind==="max"&&(t===null||a.value<t)&&(t=a.value)}return Number.isFinite(r)&&Number.isFinite(t)}};nl.create=e=>new nl({checks:[],typeName:I.ZodNumber,coerce:e?.coerce||!1,...X(e)});var rl=class e extends ie{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)!==N.bigint)return this._getInvalidInput(t);let a,n=new rt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),n.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),R(a,{code:A.not_multiple_of,multipleOf:i.value,message:i.message}),n.dirty()):ce.assertNever(i);return{status:n.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return R(r,{code:A.invalid_type,expected:N.bigint,received:r.parsedType}),W}gte(t,r){return this.setLimit("min",t,!0,L.toString(r))}gt(t,r){return this.setLimit("min",t,!1,L.toString(r))}lte(t,r){return this.setLimit("max",t,!0,L.toString(r))}lt(t,r){return this.setLimit("max",t,!1,L.toString(r))}setLimit(t,r,a,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:a,message:L.toString(n)}]})}_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:L.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:L.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:L.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:L.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:L.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}};rl.create=e=>new rl({checks:[],typeName:I.ZodBigInt,coerce:e?.coerce??!1,...X(e)});var al=class extends ie{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==N.boolean){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.boolean,received:a.parsedType}),W}return gt(t.data)}};al.create=e=>new al({typeName:I.ZodBoolean,coerce:e?.coerce||!1,...X(e)});var il=class e extends ie{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==N.date){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_type,expected:N.date,received:i.parsedType}),W}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return R(i,{code:A.invalid_date}),W}let a=new rt,n;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),a.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(n=this._getOrReturnCtx(t,n),R(n,{code:A.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),a.dirty()):ce.assertNever(i);return{status:a.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:L.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:L.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}};il.create=e=>new il({checks:[],coerce:e?.coerce||!1,typeName:I.ZodDate,...X(e)});var ol=class extends ie{_parse(t){if(this._getType(t)!==N.symbol){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.symbol,received:a.parsedType}),W}return gt(t.data)}};ol.create=e=>new ol({typeName:I.ZodSymbol,...X(e)});var ji=class extends ie{_parse(t){if(this._getType(t)!==N.undefined){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.undefined,received:a.parsedType}),W}return gt(t.data)}};ji.create=e=>new ji({typeName:I.ZodUndefined,...X(e)});var Oi=class extends ie{_parse(t){if(this._getType(t)!==N.null){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.null,received:a.parsedType}),W}return gt(t.data)}};Oi.create=e=>new Oi({typeName:I.ZodNull,...X(e)});var sl=class extends ie{constructor(){super(...arguments),this._any=!0}_parse(t){return gt(t.data)}};sl.create=e=>new sl({typeName:I.ZodAny,...X(e)});var vr=class extends ie{constructor(){super(...arguments),this._unknown=!0}_parse(t){return gt(t.data)}};vr.create=e=>new vr({typeName:I.ZodUnknown,...X(e)});var fn=class extends ie{_parse(t){let r=this._getOrReturnCtx(t);return R(r,{code:A.invalid_type,expected:N.never,received:r.parsedType}),W}};fn.create=e=>new fn({typeName:I.ZodNever,...X(e)});var ll=class extends ie{_parse(t){if(this._getType(t)!==N.undefined){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.void,received:a.parsedType}),W}return gt(t.data)}};ll.create=e=>new ll({typeName:I.ZodVoid,...X(e)});var yr=class e extends ie{_parse(t){let{ctx:r,status:a}=this._processInputParams(t),n=this._def;if(r.parsedType!==N.array)return R(r,{code:A.invalid_type,expected:N.array,received:r.parsedType}),W;if(n.exactLength!==null){let o=r.data.length>n.exactLength.value,s=r.data.length<n.exactLength.value;(o||s)&&(R(r,{code:o?A.too_big:A.too_small,minimum:s?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(R(r,{code:A.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(R(r,{code:A.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>n.type._parseAsync(new Ut(r,o,r.path,s)))).then(o=>rt.mergeArray(a,o));let i=[...r.data].map((o,s)=>n.type._parseSync(new Ut(r,o,r.path,s)));return rt.mergeArray(a,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:L.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:L.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:L.toString(r)}})}nonempty(t){return this.min(1,t)}};yr.create=(e,t)=>new yr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...X(t)});function Ri(e){if(e instanceof Ot){let t={};for(let r in e.shape){let a=e.shape[r];t[r]=Jt.create(Ri(a))}return new Ot({...e._def,shape:()=>t})}else return e instanceof yr?new yr({...e._def,type:Ri(e.element)}):e instanceof Jt?Jt.create(Ri(e.unwrap())):e instanceof Gn?Gn.create(Ri(e.unwrap())):e instanceof Hn?Hn.create(e.items.map(t=>Ri(t))):e}var Ot=class e extends ie{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=ce.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==N.object){let c=this._getOrReturnCtx(t);return R(c,{code:A.invalid_type,expected:N.object,received:c.parsedType}),W}let{status:a,ctx:n}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof fn&&this._def.unknownKeys==="strip"))for(let c in n.data)o.includes(c)||s.push(c);let l=[];for(let c of o){let u=i[c],d=n.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ut(n,d,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof fn){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict")s.length>0&&(R(n,{code:A.unrecognized_keys,keys:s}),a.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of s){let d=n.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ut(n,d,n.path,u)),alwaysSet:u in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let c=[];for(let u of l){let d=await u.key,m=await u.value;c.push({key:d,value:m,alwaysSet:u.alwaysSet})}return c}).then(c=>rt.mergeObjectSync(a,c)):rt.mergeObjectSync(a,l)}get shape(){return this._def.shape()}strict(t){return L.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,a)=>{let n=this._def.errorMap?.(r,a).message??a.defaultError;return r.code==="unrecognized_keys"?{message:L.errToObj(t).message??n}:{message:n}}}:{}})}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:I.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let a of ce.objectKeys(t))t[a]&&this.shape[a]&&(r[a]=this.shape[a]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let a of ce.objectKeys(this.shape))t[a]||(r[a]=this.shape[a]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ri(this)}partial(t){let r={};for(let a of ce.objectKeys(this.shape)){let n=this.shape[a];t&&!t[a]?r[a]=n:r[a]=n.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let a of ce.objectKeys(this.shape))if(t&&!t[a])r[a]=this.shape[a];else{let i=this.shape[a];for(;i instanceof Jt;)i=i._def.innerType;r[a]=i}return new e({...this._def,shape:()=>r})}keyof(){return tC(ce.objectKeys(this.shape))}};Ot.create=(e,t)=>new Ot({shape:()=>e,unknownKeys:"strip",catchall:fn.create(),typeName:I.ZodObject,...X(t)});Ot.strictCreate=(e,t)=>new Ot({shape:()=>e,unknownKeys:"strict",catchall:fn.create(),typeName:I.ZodObject,...X(t)});Ot.lazycreate=(e,t)=>new Ot({shape:e,unknownKeys:"strip",catchall:fn.create(),typeName:I.ZodObject,...X(t)});var Ni=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a=this._def.options;function n(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 o=i.map(s=>new jt(s.ctx.common.issues));return R(r,{code:A.invalid_union,unionErrors:o}),W}if(r.common.async)return Promise.all(a.map(async i=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(n);{let i,o=[];for(let l of a){let c={...r,common:{...r.common,issues:[]},parent:null},u=l._parseSync({data:r.data,path:r.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=o.map(l=>new jt(l));return R(r,{code:A.invalid_union,unionErrors:s}),W}}get options(){return this._def.options}};Ni.create=(e,t)=>new Ni({options:e,typeName:I.ZodUnion,...X(t)});var qn=e=>e instanceof Mi?qn(e.schema):e instanceof Yt?qn(e.innerType()):e instanceof Li?[e.value]:e instanceof Bi?e.options:e instanceof Ui?ce.objectValues(e.enum):e instanceof Fi?qn(e._def.innerType):e instanceof ji?[void 0]:e instanceof Oi?[null]:e instanceof Jt?[void 0,...qn(e.unwrap())]:e instanceof Gn?[null,...qn(e.unwrap())]:e instanceof rm||e instanceof Hi?qn(e.unwrap()):e instanceof qi?qn(e._def.innerType):[],oy=class e extends ie{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==N.object)return R(r,{code:A.invalid_type,expected:N.object,received:r.parsedType}),W;let a=this.discriminator,n=r.data[a],i=this.optionsMap.get(n);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}):(R(r,{code:A.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),W)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,a){let n=new Map;for(let i of r){let o=qn(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of o){if(n.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);n.set(s,i)}}return new e({typeName:I.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:n,...X(a)})}};function sy(e,t){let r=Fn(e),a=Fn(t);if(e===t)return{valid:!0,data:e};if(r===N.object&&a===N.object){let n=ce.objectKeys(t),i=ce.objectKeys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let s of i){if(s==="__proto__")continue;let l=sy(e[s],t[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===N.array&&a===N.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<e.length;i++){let o=e[i],s=t[i],l=sy(o,s);if(!l.valid)return{valid:!1};n.push(l.data)}return{valid:!0,data:n}}else return r===N.date&&a===N.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Di=class extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=(i,o)=>{if(ry(i)||ry(o))return W;let s=sy(i.value,o.value);return s.valid?((ay(i)||ay(o))&&r.dirty(),{status:r.value,value:s.data}):(R(a,{code:A.invalid_intersection_types}),W)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([i,o])=>n(i,o)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Di.create=(e,t,r)=>new Di({left:e,right:t,typeName:I.ZodIntersection,...X(r)});var Hn=class e extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.array)return R(a,{code:A.invalid_type,expected:N.array,received:a.parsedType}),W;if(a.data.length<this._def.items.length)return R(a,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W;!this._def.rest&&a.data.length>this._def.items.length&&(R(a,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...a.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new Ut(a,o,a.path,s)):null}).filter(o=>!!o);return a.common.async?Promise.all(i).then(o=>rt.mergeArray(r,o)):rt.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Hn.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Hn({items:e,typeName:I.ZodTuple,rest:null,...X(t)})};var ly=class e extends ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.object)return R(a,{code:A.invalid_type,expected:N.object,received:a.parsedType}),W;let n=[],i=this._def.keyType,o=this._def.valueType;for(let s in a.data)n.push({key:i._parse(new Ut(a,s,a.path,s)),value:o._parse(new Ut(a,a.data[s],a.path,s)),alwaysSet:s in a.data});return a.common.async?rt.mergeObjectAsync(r,n):rt.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(t,r,a){return r instanceof ie?new e({keyType:t,valueType:r,typeName:I.ZodRecord,...X(a)}):new e({keyType:$i.create(),valueType:t,typeName:I.ZodRecord,...X(r)})}},cl=class extends ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.map)return R(a,{code:A.invalid_type,expected:N.map,received:a.parsedType}),W;let n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([s,l],c)=>({key:n._parse(new Ut(a,s,a.path,[c,"key"])),value:i._parse(new Ut(a,l,a.path,[c,"value"]))}));if(a.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return W;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return W;(c.status==="dirty"||u.status==="dirty")&&r.dirty(),s.set(c.value,u.value)}return{status:r.value,value:s}}}};cl.create=(e,t,r)=>new cl({valueType:t,keyType:e,typeName:I.ZodMap,...X(r)});var ul=class e extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.parsedType!==N.set)return R(a,{code:A.invalid_type,expected:N.set,received:a.parsedType}),W;let n=this._def;n.minSize!==null&&a.data.size<n.minSize.value&&(R(a,{code:A.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&a.data.size>n.maxSize.value&&(R(a,{code:A.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let i=this._def.valueType;function o(l){let c=new Set;for(let u of l){if(u.status==="aborted")return W;u.status==="dirty"&&r.dirty(),c.add(u.value)}return{status:r.value,value:c}}let s=[...a.data.values()].map((l,c)=>i._parse(new Ut(a,l,a.path,c)));return a.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:L.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:L.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};ul.create=(e,t)=>new ul({valueType:e,minSize:null,maxSize:null,typeName:I.ZodSet,...X(t)});var cy=class e extends ie{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==N.function)return R(r,{code:A.invalid_type,expected:N.function,received:r.parsedType}),W;function a(s,l){return nm({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,el(),br].filter(c=>!!c),issueData:{code:A.invalid_arguments,argumentsError:l}})}function n(s,l){return nm({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,el(),br].filter(c=>!!c),issueData:{code:A.invalid_return_type,returnTypeError:l}})}let i={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof aa){let s=this;return gt(async function(...l){let c=new jt([]),u=await s._def.args.parseAsync(l,i).catch(p=>{throw c.addIssue(a(l,p)),c}),d=await Reflect.apply(o,this,u);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw c.addIssue(n(d,p)),c})})}else{let s=this;return gt(function(...l){let c=s._def.args.safeParse(l,i);if(!c.success)throw new jt([a(l,c.error)]);let u=Reflect.apply(o,this,c.data),d=s._def.returns.safeParse(u,i);if(!d.success)throw new jt([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Hn.create(t).rest(vr.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,a){return new e({args:t||Hn.create([]).rest(vr.create()),returns:r||vr.create(),typeName:I.ZodFunction,...X(a)})}},Mi=class extends ie{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})}};Mi.create=(e,t)=>new Mi({getter:e,typeName:I.ZodLazy,...X(t)});var Li=class extends ie{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return R(r,{received:r.data,code:A.invalid_literal,expected:this._def.value}),W}return{status:"valid",value:t.data}}get value(){return this._def.value}};Li.create=(e,t)=>new Li({value:e,typeName:I.ZodLiteral,...X(t)});function tC(e,t){return new Bi({values:e,typeName:I.ZodEnum,...X(t)})}var Bi=class e extends ie{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),a=this._def.values;return R(r,{expected:ce.joinValues(a),received:r.parsedType,code:A.invalid_type}),W}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),a=this._def.values;return R(r,{received:r.data,code:A.invalid_enum_value,options:a}),W}return gt(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(a=>!t.includes(a)),{...this._def,...r})}};Bi.create=tC;var Ui=class extends ie{_parse(t){let r=ce.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==N.string&&a.parsedType!==N.number){let n=ce.objectValues(r);return R(a,{expected:ce.joinValues(n),received:a.parsedType,code:A.invalid_type}),W}if(this._cache||(this._cache=new Set(ce.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let n=ce.objectValues(r);return R(a,{received:a.data,code:A.invalid_enum_value,options:n}),W}return gt(t.data)}get enum(){return this._def.values}};Ui.create=(e,t)=>new Ui({values:e,typeName:I.ZodNativeEnum,...X(t)});var aa=class extends ie{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==N.promise&&r.common.async===!1)return R(r,{code:A.invalid_type,expected:N.promise,received:r.parsedType}),W;let a=r.parsedType===N.promise?r.data:Promise.resolve(r.data);return gt(a.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};aa.create=(e,t)=>new aa({type:e,typeName:I.ZodPromise,...X(t)});var Yt=class extends ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:a}=this._processInputParams(t),n=this._def.effect||null,i={addIssue:o=>{R(a,o),o.fatal?r.abort():r.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),n.type==="preprocess"){let o=n.transform(a.data,i);if(a.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return W;let l=await this._def.schema._parseAsync({data:s,path:a.path,parent:a});return l.status==="aborted"?W:l.status==="dirty"?Pi(l.value):r.value==="dirty"?Pi(l.value):l});{if(r.value==="aborted")return W;let s=this._def.schema._parseSync({data:o,path:a.path,parent:a});return s.status==="aborted"?W:s.status==="dirty"?Pi(s.value):r.value==="dirty"?Pi(s.value):s}}if(n.type==="refinement"){let o=s=>{let l=n.refinement(s,i);if(a.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(a.common.async===!1){let s=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return s.status==="aborted"?W:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(s=>s.status==="aborted"?W:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(n.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!ra(o))return W;let s=n.transform(o.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:a.data,path:a.path,parent:a}).then(o=>ra(o)?Promise.resolve(n.transform(o.value,i)).then(s=>({status:r.value,value:s})):W);ce.assertNever(n)}};Yt.create=(e,t,r)=>new Yt({schema:e,typeName:I.ZodEffects,effect:t,...X(r)});Yt.createWithPreprocess=(e,t,r)=>new Yt({schema:t,effect:{type:"preprocess",transform:e},typeName:I.ZodEffects,...X(r)});var Jt=class extends ie{_parse(t){return this._getType(t)===N.undefined?gt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Jt.create=(e,t)=>new Jt({innerType:e,typeName:I.ZodOptional,...X(t)});var Gn=class extends ie{_parse(t){return this._getType(t)===N.null?gt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Gn.create=(e,t)=>new Gn({innerType:e,typeName:I.ZodNullable,...X(t)});var Fi=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return r.parsedType===N.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Fi.create=(e,t)=>new Fi({innerType:e,typeName:I.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...X(t)});var qi=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return tl(n)?n.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new jt(a.common.issues)},input:a.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new jt(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};qi.create=(e,t)=>new qi({innerType:e,typeName:I.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...X(t)});var dl=class extends ie{_parse(t){if(this._getType(t)!==N.nan){let a=this._getOrReturnCtx(t);return R(a,{code:A.invalid_type,expected:N.nan,received:a.parsedType}),W}return{status:"valid",value:t.data}}};dl.create=e=>new dl({typeName:I.ZodNaN,...X(e)});var rm=class extends ie{_parse(t){let{ctx:r}=this._processInputParams(t),a=r.data;return this._def.type._parse({data:a,path:r.path,parent:r})}unwrap(){return this._def.type}},am=class e extends ie{_parse(t){let{status:r,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?W:i.status==="dirty"?(r.dirty(),Pi(i.value)):this._def.out._parseAsync({data:i.value,path:a.path,parent:a})})();{let n=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?W:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:a.path,parent:a})}}static create(t,r){return new e({in:t,out:r,typeName:I.ZodPipeline})}},Hi=class extends ie{_parse(t){let r=this._def.innerType._parse(t),a=n=>(ra(n)&&(n.value=Object.freeze(n.value)),n);return tl(r)?r.then(n=>a(n)):a(r)}unwrap(){return this._def.innerType}};Hi.create=(e,t)=>new Hi({innerType:e,typeName:I.ZodReadonly,...X(t)});var XK={object:Ot.lazycreate},I;(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"})(I||(I={}));var QK=$i.create,eZ=nl.create,tZ=dl.create,nZ=rl.create,rZ=al.create,aZ=il.create,iZ=ol.create,oZ=ji.create,sZ=Oi.create,lZ=sl.create,cZ=vr.create,uZ=fn.create,dZ=ll.create,pZ=yr.create,nC=Ot.create,mZ=Ot.strictCreate,gZ=Ni.create,hZ=oy.create,fZ=Di.create,bZ=Hn.create,vZ=ly.create,yZ=cl.create,kZ=ul.create,_Z=cy.create,wZ=Mi.create,SZ=Li.create,EZ=Bi.create,xZ=Ui.create,TZ=aa.create,AZ=Yt.create,CZ=Jt.create,zZ=Gn.create,IZ=Yt.createWithPreprocess,PZ=am.create;var AM=y("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");Z.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){sn(this,"with",e)},parse(e,t){return Or(this,e,t,{callee:this.parse})},parseAsync(e,t){return Nr(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Ia(this,e,t)},safeParseAsync(e,t){return Ra(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return ge(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}});var CM=y("ZodMiniObject",(e,t)=>{ru.init(e,t),AM.init(e,t),pg(e,"shape",r=>r._zod.def.shape,!1)});function uy(e,t){let r={type:"object",shape:e??{},...z(t)};return new CM(r)}function bn(e){return!!e._zod}function ia(e){let t=Object.values(e);if(t.length===0)return uy({});let r=t.every(bn),a=t.every(n=>!bn(n));if(r)return uy(e);if(a)return nC(e);throw new Error("Mixed Zod versions detected in object shape.")}function kr(e,t){return bn(e)?Ia(e,t):e.safeParse(t)}async function im(e,t){return bn(e)?await Ra(e,t):await e.safeParseAsync(t)}function _r(e){if(!e)return;let t;if(bn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Gi(e){if(e){if(typeof e=="object"){let t=e,r=e;if(!t._def&&!r._zod){let a=Object.values(e);if(a.length>0&&a.every(n=>typeof n=="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse=="function")))return ia(e)}}if(bn(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function IM(e){return e.length===0?"object root":e.reduce((t,r,a)=>a===0?String(r):typeof r=="number"?`${t}[${r}]`:`${t}.${r}`,"")}function om(e){if(e&&typeof e=="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map(t=>t.path?.length?`${t.message} at ${IM(t.path)}`:t.message).join(`
|
|
3559
3559
|
`);if("message"in e&&typeof e.message=="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function rC(e){return e.description}function aC(e){if(bn(e))return e._zod?.def?.type==="optional";let t=e;return typeof e.isOptional=="function"?e.isOptional():t._def?.typeName==="ZodOptional"}function Vi(e){if(bn(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 a=e.value;if(a!==void 0)return a}function wr(e){return e==="completed"||e==="failed"||e==="cancelled"}var oC=Symbol("Let zodToJsonSchema decide on which parser to use");var iC={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},sC=e=>typeof e=="string"?{...iC,name:e}:{...iC,...e};var lC=e=>{let t=sC(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([a,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,a],jsonSchema:void 0}]))}};function dy(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function ue(e,t,r,a,n){e[t]=r,dy(e,t,a,n)}var sm=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function je(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?sm(t,e.currentPath):t.join("/")}}function cC(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==I.ZodAny&&(r.items=K(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&ue(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&ue(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(ue(r,"minItems",e.exactLength.value,e.exactLength.message,t),ue(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function uC(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let a of e.checks)switch(a.kind){case"min":t.target==="jsonSchema7"?a.inclusive?ue(r,"minimum",a.value,a.message,t):ue(r,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(r.exclusiveMinimum=!0),ue(r,"minimum",a.value,a.message,t));break;case"max":t.target==="jsonSchema7"?a.inclusive?ue(r,"maximum",a.value,a.message,t):ue(r,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(r.exclusiveMaximum=!0),ue(r,"maximum",a.value,a.message,t));break;case"multipleOf":ue(r,"multipleOf",a.value,a.message,t);break}return r}function dC(){return{type:"boolean"}}function lm(e,t){return K(e.type._def,t)}var pC=(e,t)=>K(e.innerType._def,t);function py(e,t,r){let a=r??t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,i)=>py(e,t,n))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return PM(e,t)}}var PM=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let a of e.checks)switch(a.kind){case"min":ue(r,"minimum",a.value,a.message,t);break;case"max":ue(r,"maximum",a.value,a.message,t);break}return r};function mC(e,t){return{...K(e.innerType._def,t),default:e.defaultValue()}}function gC(e,t){return t.effectStrategy==="input"?K(e.schema._def,t):je(t)}function hC(e){return{type:"string",enum:Array.from(e.values)}}var RM=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function fC(e,t){let r=[K(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),K(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(i=>!!i),a=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach(i=>{if(RM(i))n.push(...i.allOf),i.unevaluatedProperties===void 0&&(a=void 0);else{let o=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...l}=i;o=l}else a=void 0;n.push(o)}}),n.length?{allOf:n,...a}:void 0}function bC(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var my,Xt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(my===void 0&&(my=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),my),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function cm(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Qt(r,"email",a.message,t);break;case"format:idn-email":Qt(r,"idn-email",a.message,t);break;case"pattern:zod":ht(r,Xt.email,a.message,t);break}break;case"url":Qt(r,"uri",a.message,t);break;case"uuid":Qt(r,"uuid",a.message,t);break;case"regex":ht(r,a.regex,a.message,t);break;case"cuid":ht(r,Xt.cuid,a.message,t);break;case"cuid2":ht(r,Xt.cuid2,a.message,t);break;case"startsWith":ht(r,RegExp(`^${gy(a.value,t)}`),a.message,t);break;case"endsWith":ht(r,RegExp(`${gy(a.value,t)}$`),a.message,t);break;case"datetime":Qt(r,"date-time",a.message,t);break;case"date":Qt(r,"date",a.message,t);break;case"time":Qt(r,"time",a.message,t);break;case"duration":Qt(r,"duration",a.message,t);break;case"length":ue(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,a.value):a.value,a.message,t),ue(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":{ht(r,RegExp(gy(a.value,t)),a.message,t);break}case"ip":{a.version!=="v6"&&Qt(r,"ipv4",a.message,t),a.version!=="v4"&&Qt(r,"ipv6",a.message,t);break}case"base64url":ht(r,Xt.base64url,a.message,t);break;case"jwt":ht(r,Xt.jwt,a.message,t);break;case"cidr":{a.version!=="v6"&&ht(r,Xt.ipv4Cidr,a.message,t),a.version!=="v4"&&ht(r,Xt.ipv6Cidr,a.message,t);break}case"emoji":ht(r,Xt.emoji(),a.message,t);break;case"ulid":{ht(r,Xt.ulid,a.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Qt(r,"binary",a.message,t);break}case"contentEncoding:base64":{ue(r,"contentEncoding","base64",a.message,t);break}case"pattern:zod":{ht(r,Xt.base64,a.message,t);break}}break}case"nanoid":ht(r,Xt.nanoid,a.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function gy(e,t){return t.patternStrategy==="escape"?jM(e):e}var $M=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function jM(e){let t="";for(let r=0;r<e.length;r++)$M.has(e[r])||(t+="\\"),t+=e[r];return t}function Qt(e,t,r,a){e.format||e.anyOf?.some(n=>n.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):ue(e,"format",t,r,a)}function ht(e,t,r,a){e.pattern||e.allOf?.some(n=>n.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:vC(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):ue(e,"pattern",vC(t,a),r,a)}function vC(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=r.i?e.source.toLowerCase():e.source,n="",i=!1,o=!1,s=!1;for(let l=0;l<a.length;l++){if(i){n+=a[l],i=!1;continue}if(r.i){if(o){if(a[l].match(/[a-z]/)){s?(n+=a[l],n+=`${a[l-2]}-${a[l]}`.toUpperCase(),s=!1):a[l+1]==="-"&&a[l+2]?.match(/[a-z]/)?(n+=a[l],s=!0):n+=`${a[l]}${a[l].toUpperCase()}`;continue}}else if(a[l].match(/[a-z]/)){n+=`[${a[l]}${a[l].toUpperCase()}]`;continue}}if(r.m){if(a[l]==="^"){n+=`(^|(?<=[\r
|
|
3560
3560
|
]))`;continue}else if(a[l]==="$"){n+=`($|(?=[\r
|
|
3561
3561
|
]))`;continue}}if(r.s&&a[l]==="."){n+=o?`${a[l]}\r
|
|
@@ -3832,7 +3832,7 @@ tick();setInterval(tick,1000);
|
|
|
3832
3832
|
</body>
|
|
3833
3833
|
</html>
|
|
3834
3834
|
`;var cq="0.1.0",Jn=G.string().describe('Model in use, e.g. "gpt-5"; yours if unsure.'),uo=G.object({input_per_mtok:G.number().nonnegative(),output_per_mtok:G.number().nonnegative(),cached_input_per_mtok:G.number().nonnegative().optional()}).optional().describe("USD per 1M tokens, only if not the list price.");function Sn(e,t){let r=hr(e);return t?{...r,pricing:{inputPerMTok:t.input_per_mtok,outputPerMTok:t.output_per_mtok,cachedInputPerMTok:t.cached_input_per_mtok}}:r}var Q=e=>e.toLocaleString("en-US"),va=e=>`Priced at ${e.label}: ${Nv(e.pricing)}.`;function uq(e){let t=e.optimized.originalTokens?Math.round(e.optimized.saved/e.optimized.originalTokens*100):0,r=[e.optimized.saved>0?`${zi(e.cost.saved,"send")} (${t}% of the prompt). Meaning, numbers, code and constraints kept.`:`No saving: the prompt is already tight at the ${e.level} level.`,`${e.profile.label}: ${Q(e.promptTokens)} -> ${Q(e.optimized.tokens)} tokens${e.exact?"":" (estimate)"} (${Te(e.cost.promptUsd)} as sent).${e.usage.conversationTokens?` Context: ${Math.round(e.usage.ratio*100)}% of ~${Q(e.usage.window)} tokens.`:""}`];return e.optimized.saved>0&&r.push(`Kept: ${e.best.kept}.`,"--- best prompt, same answer (paste this) ---",e.best.text,"--- end ---"),e.tips.length&&r.push("Suggestions:",...e.tips.map(a=>`- ${a.text}${a.append?` (add: "${a.append}")`:""}`)),r.join(`
|
|
3835
|
-
`)}function dq(e){let t=e.optimized.originalTokens?Math.round(e.optimized.saved/e.optimized.originalTokens*100):0;return e.optimized.saved>0?`Shown in the Token Lens card with Copy: ${Q(e.promptTokens)} -> ${Q(e.optimized.tokens)} tokens (${t}% fewer). Don't repeat the prompt; reply in one short line.`:"Shown in the Token Lens card: already tight. Reply in one short line."}function pq(e,t){let r=Ce(t,e.profile).tokens+30,a=e.promptTokens+20,n=e.profile.pricing;return{tokens:r+a,usd:n?(r*n.inputPerMTok+a*n.outputPerMTok)/1e6:null}}async function mq(e,t,r){try{let a=typeof process<"u"?process.env:{};if(r==="anthropic"&&a.ANTHROPIC_API_KEY&&/^claude-[\w.-]+$/.test(t)){let n=await fetch("https://api.anthropic.com/v1/messages/count_tokens",{method:"POST",headers:{"x-api-key":a.ANTHROPIC_API_KEY,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:t,messages:[{role:"user",content:e}]}),signal:AbortSignal.timeout(5e3)}),i=await n.json();return n.ok&&typeof i.input_tokens=="number"?{tokens:i.input_tokens,exact:!0}:null}if(r==="google"&&a.GEMINI_API_KEY&&/^gemini-[\w.-]+$/.test(t)){let n=await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${t}:countTokens`,{method:"POST",headers:{"x-goog-api-key":a.GEMINI_API_KEY,"content-type":"application/json"},body:JSON.stringify({contents:[{parts:[{text:e}]}]}),signal:AbortSignal.timeout(5e3)}),i=await n.json();return n.ok&&typeof i.totalTokens=="number"?{tokens:i.totalTokens,exact:!0}:null}}catch{}return null}var gq={shorten:"Shorten my prompt before sending",optimize_prompt:"Optimized prompts",optimize_agent:"Agent fixes (per call)",audit_agent_rules:"Rule-file trims (per turn)",compact_data:"Compacted pasted data",compare_prompts:"Checked hand-shortened prompts"},hq="io.modelcontextprotocol/ui";function w_(e){let t=e.server;return!!t.getClientCapabilities()?.extensions?.[hq]||/openai|chatgpt/i.test(t.getClientVersion()?.name??"")}function fq(e,t){return/code|cursor|vscode|windsurf|zed|cline|continue|jetbrains/i.test(e)?!1:t||/^claude-ai$|openai|chatgpt|le ?chat|mistral|perplexity|grok|gemini/i.test(e)}var bq=["savings_report","plan_coach","live_tips","token_lens_helper"],S_="token-lens/via",t1={ui:{visibility:["app"]},"openai/visibility":"private","openai/widgetAccessible":!0},x_="For the Token Lens box only; never call it yourself.";function vq(e){let t=e.server.getClientVersion()?.name??"";return[[/claude-code/i,"Claude Code"],[/claude/i,"Claude"],[/openai|chatgpt/i,"ChatGPT"],[/le ?chat|mistral/i,"Le Chat"],[/perplexity/i,"Perplexity"],[/grok/i,"Grok"],[/gemini/i,"Gemini"],[/cursor/i,"Cursor"],[/visual studio code|vscode/i,"VS Code"]].find(([a])=>a.test(t))?.[1]??""}var yq={watching:"Shorten while you type is on: tips show here and as notifications.",starting:"Shorten while you type is starting.","cant-see-box":"Can't read the message box yet: click in it, or quit and reopen Claude.","needs-helper":"Shorten while you type needs Token Lens Helper on this Mac.",helper:"Shorten while you type is on, through Token Lens Helper.","claude-closed":"Shorten while you type waits for the Claude app.",off:"Shorten while you type is off.",unsupported:""},n1={token_lens_state:{keep:[],description:x_},token_lens:{keep:["model"],description:"Open the Token Lens box, where the user shortens prompts and sees costs without sending them to you. Use when asked to use Token Lens or shorten a prompt."},optimize_prompt:{keep:["prompt","model"],appOnly:!0,description:"Shorten a prompt to fewer tokens with the same meaning (every instruction, number, negation and code kept). Returns the shorter prompt and the savings. Use when asked to shorten or optimize a prompt."},check_conversation:{keep:["model","conversation_tokens"],appOnly:!0,description:"How full this chat's context is and what each new message costs. Pass your estimate of the chat's tokens; never copy the chat in."}};function kq(e){let t=e.registerTool.bind(e);e.registerTool=(r,a,n)=>{let i=n1[r];if(i)return t(r,{...a,description:i.description,inputSchema:r1(a.inputSchema??{},i.keep),_meta:E_(a._meta,i.appOnly)},n)}}var XP=G.string().describe('Your model, e.g. "gpt-5".');function r1(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>t.includes(r)).map(([r,a])=>[r,r==="model"?a.isOptional()?XP.optional():XP:a]))}function E_(e,t){if(!t)return e;let r=e?.ui??{};return{...e,ui:{...r,visibility:["app"]},"openai/visibility":"private","openai/widgetAccessible":!0}}var _q=["savings_report"];function wq(e){let t=new Map,r=e.registerTool.bind(e);e.registerTool=(a,n,i)=>{let o=r(a,n,i);return t.set(a,{h:o,shape:n.inputSchema??{}}),o},e.server.oninitialized=()=>{if(fq(e.server.getClientVersion()?.name??"",w_(e)))for(let[a,{h:n,shape:i}]of t){let o=n1[a];o?(n.description=o.description,n.inputSchema=G.object(r1(i,o.keep)),n._meta=E_(n._meta,o.appOnly)):_q.includes(a)?n._meta=E_(n._meta,!0):bq.includes(a)||(n.enabled=!1)}}}function T_(e={}){let t=new Xm({name:"token-lens",version:cq}),r=e.ledger,a=(n,i,o,s)=>r?.record(n,i.id,o,s);return e.chat?kq(t):process.env.TOKEN_LENS_TOOLS!=="all"&&wq(t),e.live&&xq(t,e.live),Cq(t,e.live),YP(t),t.registerPrompt("shorten",{title:"Shorten my prompt before sending",description:"Paste the prompt you're writing. Token Lens shortens it locally, keeping every instruction, fact, number, code block and constraint, and puts the shorter version in your message box. The long version never reaches the model.",argsSchema:{prompt:G.string().describe("The prompt you want to send, pasted in full."),model:G.string().optional().describe(`The model you'll send it to, e.g. "claude-sonnet-4-5" or "gpt-5". Leave blank for any model.`)}},({prompt:n,model:i})=>{let o=Ys({prompt:n,model:Sn(i??"",void 0),level:"auto"});a("shorten",o.profile,o.optimized.saved,o.cost.saved.usd);let s=o.optimized.originalTokens?Math.round(o.optimized.saved/o.optimized.originalTokens*100):0;return{description:o.optimized.saved>0?`Token Lens: ${Q(o.promptTokens)} -> ${Q(o.optimized.tokens)} tokens (${s}% fewer${o.cost.saved.usd===null?"":`, ${Te(o.cost.saved.usd)} saved`}). Kept: ${o.best.kept}.`:"Token Lens: already tight, sent unchanged.",messages:[{role:"user",content:{type:"text",text:o.optimized.saved>0?o.best.text:n}}]}}),t.registerTool("token_lens",{title:"Open Token Lens",description:"Open the Token Lens box in the chat, where the user shortens prompts without sending them to you. Use when asked to open or use Token Lens with no prompt given.",inputSchema:{model:Jn.optional()},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:Qm("Opening Token Lens\u2026","Token Lens is open")},async({model:n})=>{let i=Sn(n??"",void 0);return{content:[{type:"text",text:w_(t)?'Token Lens box shown. Reply only "Open." If the user sees no box, ask for their prompt and call optimize_prompt.':"This app shows no Token Lens box. Ask the user to paste the prompt to shorten, then call optimize_prompt."}],structuredContent:{panel:!0,model:n?i.label:"",profile:i.id}}}),t.registerTool("token_lens_state",{title:"Token Lens box status",description:x_,inputSchema:{},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:t1},async(n,i)=>{let o={app:vq(t)},s=i?._meta?.[S_]==="box";if(r){let c=Sv(r.rows());o.savings={today:c.today,total:c.all}}let l=e.live;if(l){let c=l.insights.state;if(l.insights.refreshCoach(Date.now()),o.model=c.model,o.plan=l.insights.plan?.label??"",o.live={status:l.status,text:yq[l.status]??"",helperOffer:l.status==="needs-helper"&&l.helperOffer},s){let u=c.draft;o.draft=u&&{tokens:u.tokens,optimizedTokens:u.optimizedTokens,saved:u.saved,pct:u.pct,best:u.best},o.coach=c.coach?.insights.slice(0,3)??[]}}return{content:[{type:"text",text:"Token Lens box status."}],structuredContent:o}}),t.registerTool("optimize_prompt",{title:"Optimize a prompt for fewer tokens",description:"Shorten a prompt for a model with the same meaning (instructions, numbers, negations, code and quotes kept; task-aware). Returns the prompt to paste, savings and tips. Use when asked to shorten or optimize a prompt.",inputSchema:{prompt:G.string().describe("The prompt, as written."),model:Jn,level:G.enum(["auto",...hA]).optional().describe("Default auto."),conversation_tokens:G.number().int().nonnegative().optional().describe("Tokens already in the chat, if known."),pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:Qm("Shortening the prompt\u2026","Shorter prompt ready")},async({prompt:n,model:i,level:o,conversation_tokens:s,pricing:l},c)=>{let u=Ys({prompt:n,model:Sn(i,l),conversationTokens:s,level:o??"auto"}),d=w_(t)?dq(u):uq(u),p=c?._meta?.[S_]==="box"?{tokens:0,usd:0}:pq(u,d),g=u.optimized.saved-p.tokens;return a("optimize_prompt",u.profile,g,u.cost.saved.usd===null||p.usd===null?null:u.cost.saved.usd-p.usd),{content:[{type:"text",text:d}],structuredContent:{askTokens:p.tokens,askUsd:p.usd,model:u.profile.label,profile:u.profile.id,task:u.task.task,promptTokens:u.promptTokens,exact:u.exact,level:u.level,bestPrompt:u.best.text,kept:u.best.kept,optimizedTokens:u.optimized.tokens,saved:u.optimized.saved,savedUsd:u.cost.saved.usd,savedUsdPer1k:u.cost.saved.usdPer1k,promptUsd:u.cost.promptUsd,sendUsd:u.cost.sendUsd,pricing:u.cost.pricing??null,tips:u.tips.map(h=>h.text)}}}),t.registerTool("count_tokens",{title:"Count tokens",description:"Count a text's tokens for a model (exact for OpenAI; Claude and Gemini exact with the user's own API key set, else estimated). Use when asked how many tokens something is.",inputSchema:{text:G.string(),model:Jn,pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1}},async({text:n,model:i,pricing:o})=>{let s=Sn(i,o),l=await mq(n,i,s.family)??Ce(n,s),{tokens:c,exact:u}=l,d=nt(c,s),m=Math.round(c/s.contextWindow*1e3)/10;return{content:[{type:"text",text:`${u?"":"\u2248"}${Q(c)} tokens for ${s.label} (${u?"exact":"estimate"}), ${m}% of a ~${Q(s.contextWindow)} token context. Costs ${Te(d)} as input each time it is sent (${Te(d===null?null:d*1e3)} per 1,000 sends). ${va(s)}`}],structuredContent:{tokens:c,exact:u,profile:s.id,contextWindow:s.contextWindow,inputUsd:d,pricing:s.pricing??null}}}),t.registerTool("check_conversation",{title:"Check conversation token budget",description:"How full a chat's context is and what each message costs. Pass a token count (or the text). A long chat gets an optional new-chat handoff; present it as optional, since it can change later answers. Use for chat length, limits or forgotten context.",inputSchema:{model:Jn,conversation:G.string().optional().describe("The conversation so far, as text."),conversation_tokens:G.number().int().nonnegative().optional().describe("Or: its size in tokens."),latest_request:G.string().optional().describe("The latest message, to tailor the handoff."),pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:Qm("Checking the chat\u2026","Chat checked")},async({model:n,conversation:i,conversation_tokens:o,latest_request:s,pricing:l})=>{let c=Sn(n,l),u=o??Ce(i??"",c).tokens,d=Xr(u,0,c),m=gr(s??i?.slice(-2e3)??"").task,p=d.zone==="hot"||d.zone==="full"?`Context is nearly full; older messages will be dropped or compacted soon. A handoff to a new chat avoids that. ${Rt}`:d.longChat||d.zone==="warm"?`Every new message re-reads about ${Q(u)} tokens of history. A handoff to a new chat would cut that. ${Rt}`:"The conversation is still short; no handoff needed.",g=d.zone!=="ok"||d.longChat?$p(m):void 0,h=nt(u,c),f=g?Math.max(0,u-1e3):0,k=nt(f*10,c);return{content:[{type:"text",text:[`${Q(u)} tokens, ${Math.round(d.ratio*100)}% of ${c.label}'s ~${Q(d.window)} token context.`,`Each new message re-reads this history: ${Te(h)} of input per message. ${va(c)}`,...g?[`Optional: a handoff to a new chat saves about ${Q(f)} tokens (${Te(nt(f,c))}) per message, ${Te(k)} over the next 10 messages.`]:[],p,...g?["","Optional handoff request (can change later answers):",g]:[]].join(`
|
|
3835
|
+
`)}function dq(e){let t=e.optimized.originalTokens?Math.round(e.optimized.saved/e.optimized.originalTokens*100):0;return e.optimized.saved>0?`Shown in the Token Lens card with Copy: ${Q(e.promptTokens)} -> ${Q(e.optimized.tokens)} tokens (${t}% fewer). Don't repeat the prompt; reply in one short line.`:"Shown in the Token Lens card: already tight. Reply in one short line."}function pq(e,t){let r=Ce(t,e.profile).tokens+30,a=e.promptTokens+20,n=e.profile.pricing;return{tokens:r+a,usd:n?(r*n.inputPerMTok+a*n.outputPerMTok)/1e6:null}}async function mq(e,t,r){try{let a=typeof process<"u"?process.env:{};if(r==="anthropic"&&a.ANTHROPIC_API_KEY&&/^claude-[\w.-]+$/.test(t)){let n=await fetch("https://api.anthropic.com/v1/messages/count_tokens",{method:"POST",headers:{"x-api-key":a.ANTHROPIC_API_KEY,"anthropic-version":"2023-06-01","content-type":"application/json"},body:JSON.stringify({model:t,messages:[{role:"user",content:e}]}),signal:AbortSignal.timeout(5e3)}),i=await n.json();return n.ok&&typeof i.input_tokens=="number"?{tokens:i.input_tokens,exact:!0}:null}if(r==="google"&&a.GEMINI_API_KEY&&/^gemini-[\w.-]+$/.test(t)){let n=await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${t}:countTokens`,{method:"POST",headers:{"x-goog-api-key":a.GEMINI_API_KEY,"content-type":"application/json"},body:JSON.stringify({contents:[{parts:[{text:e}]}]}),signal:AbortSignal.timeout(5e3)}),i=await n.json();return n.ok&&typeof i.totalTokens=="number"?{tokens:i.totalTokens,exact:!0}:null}}catch{}return null}var gq={shorten:"Shorten my prompt before sending",optimize_prompt:"Optimized prompts",optimize_agent:"Agent fixes (per call)",audit_agent_rules:"Rule-file trims (per turn)",compact_data:"Compacted pasted data",compare_prompts:"Checked hand-shortened prompts"},hq="io.modelcontextprotocol/ui";function w_(e){let t=e.server;return!!t.getClientCapabilities()?.extensions?.[hq]||/openai|chatgpt/i.test(t.getClientVersion()?.name??"")}function fq(e,t){return/code|cursor|vscode|windsurf|zed|cline|continue|jetbrains/i.test(e)?!1:t||/^claude-ai$|openai|chatgpt|le ?chat|mistral|perplexity|grok|gemini/i.test(e)}var bq=["savings_report","plan_coach","live_tips","token_lens_helper"],S_="token-lens/via",t1={ui:{visibility:["app"]},"openai/visibility":"private","openai/widgetAccessible":!0},x_="For the Token Lens box only; never call it yourself.";function vq(e){let t=e.server.getClientVersion()?.name??"";return[[/claude-code/i,"Claude Code"],[/claude/i,"Claude"],[/openai|chatgpt/i,"ChatGPT"],[/le ?chat|mistral/i,"Le Chat"],[/perplexity/i,"Perplexity"],[/grok/i,"Grok"],[/gemini/i,"Gemini"],[/cursor/i,"Cursor"],[/visual studio code|vscode/i,"VS Code"]].find(([a])=>a.test(t))?.[1]??""}var yq={watching:"Shorten while you type is on: tips show here and as notifications.",starting:"Shorten while you type is starting.","cant-see-box":"Can't read the message box yet: click in it, or quit and reopen Claude.","needs-helper":"Shorten while you type needs Token Lens Helper on this Mac.",helper:"Shorten while you type is on: as you type in the message box, a Shorten button shows just above it when a shorter prompt says the same thing.","claude-closed":"Shorten while you type waits for the Claude app.",off:"Shorten while you type is off.",unsupported:""},kq={watching:"Tips come as notifications while you type in the message box. Set up Token Lens Helper to get a Shorten button right above the box instead, so one click puts the shorter prompt in.","needs-helper":"To get tips while you type in the message box, set up Token Lens Helper. Then a Shorten button shows right above the box."};function _q(e,t){let r=t&&!["helper","off","unsupported"].includes(e);return{status:e,text:r&&kq[e]||yq[e]||"",helperOffer:r}}var n1={token_lens_state:{keep:[],description:x_},token_lens:{keep:["model"],description:"Open the Token Lens box, where the user shortens prompts and sees costs without sending them to you. Use when asked to use Token Lens or shorten a prompt."},optimize_prompt:{keep:["prompt","model"],appOnly:!0,description:"Shorten a prompt to fewer tokens with the same meaning (every instruction, number, negation and code kept). Returns the shorter prompt and the savings. Use when asked to shorten or optimize a prompt."},check_conversation:{keep:["model","conversation_tokens"],appOnly:!0,description:"How full this chat's context is and what each new message costs. Pass your estimate of the chat's tokens; never copy the chat in."}};function wq(e){let t=e.registerTool.bind(e);e.registerTool=(r,a,n)=>{let i=n1[r];if(i)return t(r,{...a,description:i.description,inputSchema:r1(a.inputSchema??{},i.keep),_meta:E_(a._meta,i.appOnly)},n)}}var XP=G.string().describe('Your model, e.g. "gpt-5".');function r1(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>t.includes(r)).map(([r,a])=>[r,r==="model"?a.isOptional()?XP.optional():XP:a]))}function E_(e,t){if(!t)return e;let r=e?.ui??{};return{...e,ui:{...r,visibility:["app"]},"openai/visibility":"private","openai/widgetAccessible":!0}}var Sq=["savings_report"];function Eq(e){let t=new Map,r=e.registerTool.bind(e);e.registerTool=(a,n,i)=>{let o=r(a,n,i);return t.set(a,{h:o,shape:n.inputSchema??{}}),o},e.server.oninitialized=()=>{if(fq(e.server.getClientVersion()?.name??"",w_(e)))for(let[a,{h:n,shape:i}]of t){let o=n1[a];o?(n.description=o.description,n.inputSchema=G.object(r1(i,o.keep)),n._meta=E_(n._meta,o.appOnly)):Sq.includes(a)?n._meta=E_(n._meta,!0):bq.includes(a)||(n.enabled=!1)}}}function T_(e={}){let t=new Xm({name:"token-lens",version:cq}),r=e.ledger,a=(n,i,o,s)=>r?.record(n,i.id,o,s);return e.chat?wq(t):process.env.TOKEN_LENS_TOOLS!=="all"&&Eq(t),e.live&&Aq(t,e.live),Iq(t,e.live),YP(t),t.registerPrompt("shorten",{title:"Shorten my prompt before sending",description:"Paste the prompt you're writing. Token Lens shortens it locally, keeping every instruction, fact, number, code block and constraint, and puts the shorter version in your message box. The long version never reaches the model.",argsSchema:{prompt:G.string().describe("The prompt you want to send, pasted in full."),model:G.string().optional().describe(`The model you'll send it to, e.g. "claude-sonnet-4-5" or "gpt-5". Leave blank for any model.`)}},({prompt:n,model:i})=>{let o=Ys({prompt:n,model:Sn(i??"",void 0),level:"auto"});a("shorten",o.profile,o.optimized.saved,o.cost.saved.usd);let s=o.optimized.originalTokens?Math.round(o.optimized.saved/o.optimized.originalTokens*100):0;return{description:o.optimized.saved>0?`Token Lens: ${Q(o.promptTokens)} -> ${Q(o.optimized.tokens)} tokens (${s}% fewer${o.cost.saved.usd===null?"":`, ${Te(o.cost.saved.usd)} saved`}). Kept: ${o.best.kept}.`:"Token Lens: already tight, sent unchanged.",messages:[{role:"user",content:{type:"text",text:o.optimized.saved>0?o.best.text:n}}]}}),t.registerTool("token_lens",{title:"Open Token Lens",description:"Open the Token Lens box in the chat, where the user shortens prompts without sending them to you. Use when asked to open or use Token Lens with no prompt given.",inputSchema:{model:Jn.optional()},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:Qm("Opening Token Lens\u2026","Token Lens is open")},async({model:n})=>{let i=Sn(n??"",void 0);return{content:[{type:"text",text:w_(t)?'Token Lens box shown. Reply only "Open." If the user sees no box, ask for their prompt and call optimize_prompt.':"This app shows no Token Lens box. Ask the user to paste the prompt to shorten, then call optimize_prompt."}],structuredContent:{panel:!0,model:n?i.label:"",profile:i.id}}}),t.registerTool("token_lens_state",{title:"Token Lens box status",description:x_,inputSchema:{},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:t1},async(n,i)=>{let o={app:vq(t)},s=i?._meta?.[S_]==="box";if(r){let c=Sv(r.rows());o.savings={today:c.today,total:c.all}}let l=e.live;if(l){let c=l.insights.state;if(l.insights.refreshCoach(Date.now()),o.model=c.model,o.plan=l.insights.plan?.label??"",o.live=_q(l.status,l.helperOffer),s){let u=c.draft;o.draft=u&&{tokens:u.tokens,optimizedTokens:u.optimizedTokens,saved:u.saved,pct:u.pct,best:u.best},o.coach=c.coach?.insights.slice(0,3)??[]}}return{content:[{type:"text",text:"Token Lens box status."}],structuredContent:o}}),t.registerTool("optimize_prompt",{title:"Optimize a prompt for fewer tokens",description:"Shorten a prompt for a model with the same meaning (instructions, numbers, negations, code and quotes kept; task-aware). Returns the prompt to paste, savings and tips. Use when asked to shorten or optimize a prompt.",inputSchema:{prompt:G.string().describe("The prompt, as written."),model:Jn,level:G.enum(["auto",...hA]).optional().describe("Default auto."),conversation_tokens:G.number().int().nonnegative().optional().describe("Tokens already in the chat, if known."),pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:Qm("Shortening the prompt\u2026","Shorter prompt ready")},async({prompt:n,model:i,level:o,conversation_tokens:s,pricing:l},c)=>{let u=Ys({prompt:n,model:Sn(i,l),conversationTokens:s,level:o??"auto"}),d=w_(t)?dq(u):uq(u),p=c?._meta?.[S_]==="box"?{tokens:0,usd:0}:pq(u,d),g=u.optimized.saved-p.tokens;return a("optimize_prompt",u.profile,g,u.cost.saved.usd===null||p.usd===null?null:u.cost.saved.usd-p.usd),{content:[{type:"text",text:d}],structuredContent:{askTokens:p.tokens,askUsd:p.usd,model:u.profile.label,profile:u.profile.id,task:u.task.task,promptTokens:u.promptTokens,exact:u.exact,level:u.level,bestPrompt:u.best.text,kept:u.best.kept,optimizedTokens:u.optimized.tokens,saved:u.optimized.saved,savedUsd:u.cost.saved.usd,savedUsdPer1k:u.cost.saved.usdPer1k,promptUsd:u.cost.promptUsd,sendUsd:u.cost.sendUsd,pricing:u.cost.pricing??null,tips:u.tips.map(h=>h.text)}}}),t.registerTool("count_tokens",{title:"Count tokens",description:"Count a text's tokens for a model (exact for OpenAI; Claude and Gemini exact with the user's own API key set, else estimated). Use when asked how many tokens something is.",inputSchema:{text:G.string(),model:Jn,pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1}},async({text:n,model:i,pricing:o})=>{let s=Sn(i,o),l=await mq(n,i,s.family)??Ce(n,s),{tokens:c,exact:u}=l,d=nt(c,s),m=Math.round(c/s.contextWindow*1e3)/10;return{content:[{type:"text",text:`${u?"":"\u2248"}${Q(c)} tokens for ${s.label} (${u?"exact":"estimate"}), ${m}% of a ~${Q(s.contextWindow)} token context. Costs ${Te(d)} as input each time it is sent (${Te(d===null?null:d*1e3)} per 1,000 sends). ${va(s)}`}],structuredContent:{tokens:c,exact:u,profile:s.id,contextWindow:s.contextWindow,inputUsd:d,pricing:s.pricing??null}}}),t.registerTool("check_conversation",{title:"Check conversation token budget",description:"How full a chat's context is and what each message costs. Pass a token count (or the text). A long chat gets an optional new-chat handoff; present it as optional, since it can change later answers. Use for chat length, limits or forgotten context.",inputSchema:{model:Jn,conversation:G.string().optional().describe("The conversation so far, as text."),conversation_tokens:G.number().int().nonnegative().optional().describe("Or: its size in tokens."),latest_request:G.string().optional().describe("The latest message, to tailor the handoff."),pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1},_meta:Qm("Checking the chat\u2026","Chat checked")},async({model:n,conversation:i,conversation_tokens:o,latest_request:s,pricing:l})=>{let c=Sn(n,l),u=o??Ce(i??"",c).tokens,d=Xr(u,0,c),m=gr(s??i?.slice(-2e3)??"").task,p=d.zone==="hot"||d.zone==="full"?`Context is nearly full; older messages will be dropped or compacted soon. A handoff to a new chat avoids that. ${Rt}`:d.longChat||d.zone==="warm"?`Every new message re-reads about ${Q(u)} tokens of history. A handoff to a new chat would cut that. ${Rt}`:"The conversation is still short; no handoff needed.",g=d.zone!=="ok"||d.longChat?$p(m):void 0,h=nt(u,c),f=g?Math.max(0,u-1e3):0,k=nt(f*10,c);return{content:[{type:"text",text:[`${Q(u)} tokens, ${Math.round(d.ratio*100)}% of ${c.label}'s ~${Q(d.window)} token context.`,`Each new message re-reads this history: ${Te(h)} of input per message. ${va(c)}`,...g?[`Optional: a handoff to a new chat saves about ${Q(f)} tokens (${Te(nt(f,c))}) per message, ${Te(k)} over the next 10 messages.`]:[],p,...g?["","Optional handoff request (can change later answers):",g]:[]].join(`
|
|
3836
3836
|
`)}],structuredContent:{model:c.label,profile:c.id,tokens:u,ratio:d.ratio,zone:d.zone,window:d.window,usdPerMessage:h,handoffSavesTokensPerMessage:f,handoffSavesUsdOver10Messages:k,handoffPrompt:g??null}}}),t.registerTool("optimize_agent",{title:"Find token hotspots and optimize an agent or conversation",description:"Find where an agent's tokens go (system prompt, tools, examples, history, next prompt), apply verified same-output fixes and return the optimized spec ready to paste, with the checks as evidence. Fixes that could change output are only listed, opt-in. Flags caching. Use when the user builds an agent or shares a system prompt or tools.",inputSchema:{model:Jn,system:G.string().optional().describe("System prompt / instructions."),tools:G.array(G.object({name:G.string(),description:G.string().optional(),parameters:G.any().optional()})).optional().describe("Tool definitions (parameters = JSON schema)."),examples:G.array(G.string()).optional().describe("Few-shot examples."),messages:G.array(G.object({role:G.enum(["user","assistant","tool","system"]),content:G.string(),toolCalls:G.array(G.string()).optional().describe("Names of tools called in this message.")})).optional().describe("Conversation history, oldest first."),prompt:G.string().optional().describe("The next user message."),pricing:uo,calls_per_month:G.number().int().positive().optional().describe("Calls per month, if known.")},annotations:{readOnlyHint:!0,openWorldHint:!1}},async({model:n,pricing:i,calls_per_month:o,...s})=>{let l=NA(s,Sn(n,i)),c=l.report;l.verification.passed&&a("optimize_agent",c.profile,l.savings.tokens,l.savings.usd);let u=v=>o&&v!==null?v*o:null,d=c.findings.filter(v=>v.risk==="review"),m=c.findings.filter(v=>v.risk==="safe"&&!v.applied),p=[l.verification.passed&&l.savings.tokens>0?`${zi(l.savings)}${u(l.savings.usd)!==null?`, ${Te(u(l.savings.usd))} per month at ${Q(o)} calls`:""}: ${Q(l.before)} \u2192 ${Q(l.after)} tokens per call, same model and same output (checks below).`:l.verification.passed?"No wording savings to apply: the agent's text is already tight.":"No changes applied: a check failed, so the original spec is returned unchanged.",`Cost per call now: ${Te(c.costPerCall)} of input${l.savings.tokens>0?`, ${Te(nt(l.after,c.profile))} after the fixes`:""}. ${va(c.profile)}`];m.length&&m[0].usd!==null&&p.push(`Also safe, needs a config change on your side: ${Te(m[0].usd)} more per call (${m[0].id}).`),d.length&&d[0].usd!==null&&p.push(`Opt-in fixes that could change the output (not applied): the biggest saves ${Te(d[0].usd)} more per call (${d[0].id}).`),p.push("",`Model profile: ${c.profile.label}. Total ${Q(c.total)} tokens per call; ${Q(c.fixedOverhead)} of it is re-sent every call (system + tools + examples).`,"","Where the tokens go:",...c.breakdown.map(v=>`- ${v.label}: ${Q(v.tokens)} (${c.total?Math.round(v.tokens/c.total*100):0}%)`)),c.growthPerTurn&&p.push(`Growing ~${Q(c.growthPerTurn)} tokens per user turn${c.turnsLeft!==null?`, about ${c.turnsLeft} turns of room left`:""}.`),p.push("",l.verification.passed?"Evidence the output is unchanged (same model, same tools, same instructions):":"Checks (one failed, so nothing was applied):",...l.verification.checks.map(v=>`${v.passed?"\u2713":"\u2717"} ${v.name}: ${v.detail}`));let g=c.findings.filter(v=>v.risk==="safe"),h=c.findings.filter(v=>v.risk==="review"),f=v=>v.id==="structured-output"?"saves every retry after a reply that doesn't parse":v.id==="price-threshold"&&!v.saves?"keeps the call at the lower rate":`saves ~${Q(v.saves)} tokens${v.usd!==null?`, ${Te(v.usd)} per call, ${Te(v.usd*1e3)} per 1,000 calls`:""}`;if(g.length&&p.push("","Safe fixes:",...g.map(v=>`- ${v.applied?"[applied] ":"[do this] "}${v.issue} ${v.fix} (${f(v)})`)),h.length&&p.push("","Could change the output, so not applied (ask the user):",...h.map(v=>`- ${v.issue} ${v.fix} (${f(v)})`)),l.verification.passed&&l.savings.tokens>0){let v=(C,S)=>["",`--- ${C} (paste this) ---`,S,"--- end ---"];l.spec.system&&l.spec.system!==s.system&&p.push(...v("optimized system prompt",l.spec.system)),l.spec.tools&&JSON.stringify(l.spec.tools)!==JSON.stringify(s.tools)&&p.push(...v("optimized tool definitions (JSON)",JSON.stringify(l.spec.tools,null,2))),l.spec.prompt&&l.spec.prompt!==s.prompt&&p.push(...v("optimized next prompt",l.spec.prompt)),l.spec.messages&&JSON.stringify(l.spec.messages)!==JSON.stringify(s.messages)&&p.push("","Conversation: exact repeats were replaced with pointers; the full list is in structuredContent.optimized.messages.")}s.system&&c.findings.some(v=>v.id==="volatile-prefix")&&p.push("","--- system prompt with the changing lines last (paste this) ---",Hv(l.spec.system??s.system).text,"--- end ---");let k=c.findings.some(v=>v.id==="structured-output")?Gv(s,c.profile):null;k&&p.push("",`--- strict JSON mode: add to the request (${c.profile.family==="anthropic"?"Anthropic Messages API":c.profile.family==="google"?"Gemini generateContent":"OpenAI-compatible API"}; paste this) ---`,JSON.stringify(k.setup,null,2),"--- end ---");let b=c.findings.some(v=>v.id==="lazy-tools")?qv(l.spec.tools??[]):null;return b&&p.push("","--- on-demand tool loading: send these 2 tools instead of the full list (paste this) ---",JSON.stringify(b.tools,null,2),"--- end ---","Your runtime answers get_tool_schema with the tool's full definition (structuredContent.lazyTools.schemas) and runs invoke_tool by calling that tool with tool_input."),{content:[{type:"text",text:p.join(`
|
|
3837
3837
|
`)}],structuredContent:{lazyTools:b,structuredOutput:k?.setup??null,before:l.before,after:l.after,savedTokens:l.savings.tokens,savedUsdPerCall:l.savings.usd,savedUsdPer1kCalls:l.savings.usdPer1k,savedUsdPerMonth:u(l.savings.usd),costPerCallUsd:c.costPerCall,pricing:c.profile.pricing??null,breakdown:c.breakdown,growthPerTurn:c.growthPerTurn,turnsLeft:c.turnsLeft,findings:c.findings,optimized:l.spec,verification:l.verification}}}),t.registerTool("audit_agent_rules",{title:"Trim coding-agent rule files",description:"Trim coding-agent rule files (CLAUDE.md, AGENTS.md, .cursorrules and the like) without changing any instruction: repeats removed, wording tightened with every number and negation kept. Returns files to paste and savings per turn. Use when the user shares agent rule files.",inputSchema:{model:Jn,files:G.array(G.object({path:G.string(),content:G.string()})).min(1).describe("Each rule file: its path and full text."),repo_paths:G.array(G.string()).optional().describe("Repo file paths, to flag rules naming missing files."),pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1}},async({model:n,files:i,repo_paths:o,pricing:s})=>{let l=Sn(n,s),c=DA(i,l,{knownPaths:o}),u=c.before-c.after;a("audit_agent_rules",l,c.saved.tokens,c.saved.usd);let d=[u>0?`${zi(c.saved)} per turn: ${Q(c.before)} \u2192 ${Q(c.after)} tokens of rules re-sent every turn, same instructions.`:`Nothing to trim: ${Q(c.before)} tokens of rules, no repeats, wording already tight.`,va(l)],m=c.findings.filter(g=>g.kind==="duplicate");m.length&&d.push("","Exact repeats removed:",...m.map(g=>`- ${g.path}:${g.line} ${g.text} (${g.detail})`));let p=c.findings.filter(g=>g.kind==="stale-path");p.length&&d.push("","Check these (not removed): they mention files that aren't in the repo.",...p.map(g=>`- ${g.path}:${g.line} ${g.detail}`));for(let g of c.files)g.trimmed!==i.find(h=>h.path===g.path)?.content&&d.push("",`--- ${g.path}, trimmed (${Q(g.tokens)} \u2192 ${Q(g.trimmedTokens)} tokens; paste this) ---`,g.trimmed,"--- end ---");return{content:[{type:"text",text:d.join(`
|
|
3838
3838
|
`)}],structuredContent:{before:c.before,after:c.after,savedTokensPerTurn:c.saved.tokens,savedUsdPerTurn:c.saved.usd,savedUsdPer1kTurns:c.saved.usdPer1k,files:c.files,findings:c.findings,pricing:l.pricing??null}}}),t.registerTool("list_model_profiles",{title:"List model profiles",description:"List the model families Token Lens knows, with context windows and prices.",inputSchema:{},annotations:{readOnlyHint:!0,openWorldHint:!1}},async()=>({content:[{type:"text",text:Object.values(hn).map(n=>`${n.id}: ${n.label}, ~${Q(n.contextWindow)} context, ${n.tokenizer==="o200k"?"exact":"estimated"} counts${n.reasoning?", reasoning model":""}, ${Nv(n.pricing)}`).join(`
|
|
@@ -3840,10 +3840,10 @@ tick();setInterval(tick,1000);
|
|
|
3840
3840
|
`)}],structuredContent:{before:s.before,after:s.after,savedTokens:s.saved,savedUsd:l.usd,compactText:s.text,changes:s.changes,blocks:s.blocks,checks:s.checks,skipped:s.skipped??null}}}),t.registerTool("compare_prompts",{title:"Check a shortened prompt against the original",description:"Check a shortened prompt against the original: savings and any number, negation or rule lost.",inputSchema:{original:G.string(),edited:G.string(),model:Jn},annotations:{readOnlyHint:!0,openWorldHint:!1}},async({original:n,edited:i,model:o})=>{let s=Sn(o,void 0),l=TA(n,i,s);l.sameInstructions&&a("compare_prompts",s,l.saved.tokens,l.saved.usd);let c=[l.verdict,l.saved.tokens>0?`${zi(l.saved,"send")}: ${Q(l.before)} \u2192 ${Q(l.after)} tokens. ${va(s)}`:`${Q(l.before)} \u2192 ${Q(l.after)} tokens: the edit is not shorter.`];return l.lostFacts.length&&c.push("","Missing from the shorter version (can change the answer):",...l.lostFacts.map(u=>`- ${u}`)),l.lostWords.length&&c.push("",`Words dropped that may carry instructions: ${l.lostWords.join(", ")}.`),{content:[{type:"text",text:c.join(`
|
|
3841
3841
|
`)}],structuredContent:{before:l.before,after:l.after,savedTokens:l.saved.tokens,savedUsd:l.saved.usd,sameInstructions:l.sameInstructions,lostFacts:l.lostFacts,lostWords:l.lostWords,verdict:l.verdict}}}),t.registerTool("estimate_cost",{title:"Forecast monthly cost and same-answer savings",description:"Monthly cost of an app or agent on its model, and what same-answer caching and batching save. Use for LLM budgets.",inputSchema:{model:Jn,input_tokens:G.number().int().nonnegative().describe("Per call."),output_tokens:G.number().int().nonnegative().describe("Per call, incl. reasoning."),calls_per_day:G.number().positive(),repeated_prefix_tokens:G.number().int().nonnegative().optional().describe("Unchanging start of each call: system, tools, examples."),can_wait_share:G.number().min(0).max(1).optional().describe("Share of calls that can wait 24h."),pricing:uo},annotations:{readOnlyHint:!0,openWorldHint:!1}},async({model:n,input_tokens:i,output_tokens:o,calls_per_day:s,repeated_prefix_tokens:l,can_wait_share:c,pricing:u})=>{let d=Sn(n,u),m=AA(d,{inputTokens:i,outputTokens:o,callsPerDay:s,repeatedPrefixTokens:l,canWaitShare:c});if(!m.priced)return{content:[{type:"text",text:`No price is set for ${d.label}. Pass pricing with your per-1M-token rates to get a forecast.`}]};let p=m.lines.reduce((h,f)=>f.monthlyUsd<h.monthlyUsd?f:h),g=[`${d.label}, ${Q(m.callsPerMonth)} calls a month: ${Te(m.lines[0].monthlyUsd)} a month now${p.id!=="now"?`; ${Te(p.monthlyUsd)} with ${p.label.toLowerCase()}, saving ${Te(p.savedUsd)} a month (${Te(p.savedUsd*12)} a year) with the same answers`:""}.`,va(d),"",...m.lines.map(h=>`- ${h.label}: ${Te(h.monthlyUsd)} a month${h.savedUsd>0?`, saves ${Te(h.savedUsd)}`:""}.${h.note?` ${h.note}`:""}`)];return l?m.rates.cached===null&&g.push("",`${d.label} has no cached-input price on file; pass pricing.cached_input_per_mtok to include caching.`):g.push("","Tip: pass repeated_prefix_tokens (system prompt, tools and examples) to see what prompt caching saves."),!c&&["openai","anthropic","google"].includes(d.family)&&g.push("","Tip: if some calls can wait up to 24 hours (reports, bulk jobs), pass can_wait_share to see the half-price batch saving."),{content:[{type:"text",text:g.join(`
|
|
3842
3842
|
`)}],structuredContent:{profile:d.id,callsPerMonth:m.callsPerMonth,longContext:m.longContext,rates:m.rates,options:m.lines}}}),t.registerTool("savings_report",{title:"Show total tokens and money saved",description:"Tokens and money Token Lens has saved: today, 7 and 30 days, total, by action and model.",inputSchema:{},annotations:{readOnlyHint:!0,openWorldHint:!1}},async()=>{if(!r)return{content:[{type:"text",text:"Totals aren't kept here: this copy of Token Lens stores nothing. Run Token Lens on your own computer (the npm package) and it keeps a running total of numbers only, never your text."}]};let n=Sv(r.rows()),i=s=>`${Q(s.tokens)} tokens, ${Te(s.usd)} (${Q(s.count)} ${s.count===1?"time":"times"})`;return{content:[{type:"text",text:(n.since?[`Token Lens has saved ${Q(n.all.tokens)} tokens and ${Te(n.all.usd)} since ${n.since}, priced for the model each saving was on.`,"",`Today: ${i(n.today)}`,`Last 7 days: ${i(n.last7)}`,`Last 30 days: ${i(n.last30)}`,"","By action:",...n.byAction.map(s=>`- ${gq[s.action]??s.action}: ${i(s)}`),"","By model:",...n.byModel.map(s=>`- ${hn[s.model]?.label??s.model}: ${i(s)}`),"","Counts the saving each time Token Lens found one; agent and rule-file savings are per call or turn, so they repeat every time those run. Kept as numbers only"+(r.where?` in ${r.where} (set TOKEN_LENS_LEDGER=off to stop).`:" for this session.")]:["Nothing saved yet. Totals start the first time Token Lens shortens a prompt, data or an agent."]).join(`
|
|
3843
|
-
`)}],structuredContent:{...n,where:r.where}}}),t}var
|
|
3843
|
+
`)}],structuredContent:{...n,where:r.where}}}),t}var xq={watching:"Live tips are on: Token Lens is watching the message box and the open chat in the Claude app.",starting:"Live tips are starting.","cant-see-box":"Live tips are on but can't read Claude's message box yet: click in it, or quit and reopen Claude.","needs-helper":"Live tips can't read the AI app on this Mac yet. Don't suggest turning on node: macOS would give that access to every Node program. Offer Token Lens Helper instead and explain it first: a small Mac app that gives live tips in the Claude and ChatGPT apps; it reads only the message box and open chat of whichever is in front, keeps and sends none of that text, shows a Shorten button just above the message box while they type, changes the message box only when the user clicks, checks the npm registry daily for a newer Token Lens, and needs its own switch under System Settings > Privacy & Security > Accessibility. The user can click Set up Token Lens Helper in the Token Lens box, or say yes and you call live_tips with action setup_helper; either way their Mac asks them to confirm. Never send the user to a web page or localhost.",helper:"Live tips run in Token Lens Helper: while the user types, a Shorten button appears just above the message box when a shorter prompt says the same thing (one click swaps it in), and its menu bar icon shows the details. If they don't appear, the user turns on Token Lens Helper in System Settings > Privacy & Security > Accessibility. If they turned node on for Token Lens earlier, they can turn it off.","claude-closed":"Live tips are on and wait for the Claude app.",off:"Live tips are off.",unsupported:"Live tips work in the Claude desktop app on macOS only."},Tq=`Set up Token Lens Helper?
|
|
3844
3844
|
|
|
3845
3845
|
It's a small Mac app that shortens prompts while you type in the Claude and ChatGPT apps. It reads only the message box and the open chat of the app in front, keeps and sends none of that text, changes your message only when you click, and checks the npm registry daily for a newer Token Lens.
|
|
3846
3846
|
|
|
3847
|
-
macOS will then ask you to turn it on under Privacy & Security > Accessibility.`,__=!1;function QP(e){if(__)return Promise.resolve("busy");__=!0;let t=`display dialog ${JSON.stringify(`${e} ${
|
|
3848
|
-
`)}var e1={free:"claude-free",pro:"claude-pro",max:"claude-max",team:"claude-team"};function
|
|
3849
|
-
`);return}let i=T_({ledger:e}),o=new Rp({sessionIdGenerator:void 0});n.on("close",()=>{o.close(),i.close()}),await i.connect(o),await o.handleRequest(a,n)}).listen(r,()=>console.error(`Token Lens MCP server on http://localhost:${r}/mcp`))}
|
|
3847
|
+
macOS will then ask you to turn it on under Privacy & Security > Accessibility.`,__=!1;function QP(e){if(__)return Promise.resolve("busy");__=!0;let t=`display dialog ${JSON.stringify(`${e} ${Tq}`)} with title "Token Lens" buttons {"Not now", "Set up"} default button "Not now" cancel button "Not now" with icon note`;return new Promise(r=>lq("osascript",["-e",t],{timeout:3e5},(a,n)=>{if(__=!1,!a)return r(/button returned:Set up/.test(n)?"yes":"no");r(/-128/.test(String(a.message)+String(a.stderr??""))?"no":"no-dialog")}))}function Aq(e,t){e.registerTool("token_lens_helper",{title:"Set up Token Lens Helper from the box",description:x_,inputSchema:{},annotations:{readOnlyHint:!1,openWorldHint:!1},_meta:t1},async(r,a)=>{let i=a?._meta?.[S_]==="box"?t.status==="helper"?"on":t.helperOffer?await QP("You clicked Set up in the Token Lens box.").then(s=>s==="yes"?t.setupHelper():s):"unavailable":"not-box",o={on:"Token Lens Helper is already on.",started:"Set up. When macOS asks, click Open System Settings and turn on Token Lens Helper under Privacy & Security > Accessibility.",no:"Not set up.",busy:"The Mac is already asking: answer the Token Lens dialog.","no-dialog":"Your Mac couldn't show the question. Quit and reopen Claude, then click Set up again.","not-box":`This app didn't pass on your click. Type "Set up Token Lens Helper" in the chat instead; your Mac will ask you to confirm.`,unsupported:"Token Lens Helper needs macOS 13.3 or later.",unavailable:"This copy of Token Lens doesn't include Token Lens Helper yet.",failed:"Couldn't set up Token Lens Helper on this Mac."};return{content:[{type:"text",text:o[i]??o.failed}],structuredContent:{helper:i,text:o[i]??o.failed}}}),e.registerTool("live_tips",{title:"Live tips in the Claude app",description:"Turn Token Lens's live tips on or off, or check them. Live tips run on this Mac with no model calls: while the user types in the Claude or ChatGPT app, a Shorten button appears above the message box when a shorter prompt says the same thing, and a notice comes when a chat gets costly. Action setup_helper asks the user in a Mac dialog to set up Token Lens Helper, which holds the Mac permission for Token Lens alone; nothing is set up unless they click Set up there. Explain what it reads first. Never send the user to a web page or localhost. Use when the user asks about live tips, the Shorten button or notifications, or wants them off or on.",inputSchema:{action:G.enum(["status","on","off","setup_helper"]).describe("What to do. Default status.").optional()},annotations:{readOnlyHint:!1,openWorldHint:!1}},async({action:r})=>{if(r==="setup_helper"){let i=t.status==="helper"?"started":await QP("The AI in your chat asked to set this up.").then(s=>s==="yes"?t.setupHelper():s);return{content:[{type:"text",text:i==="started"?"Token Lens Helper is set up. When macOS asks, the user clicks Open System Settings and turns on Token Lens Helper under Privacy & Security > Accessibility. Then, while they type, a Shorten button appears just above the message box. No need to turn on node.":i==="unsupported"?"Token Lens Helper needs macOS 13.3 or later.":i==="unavailable"?"This copy of Token Lens doesn't include Token Lens Helper yet.":i==="no"?"The user chose Not now on their Mac. Don't ask again unless they bring it up.":i==="busy"?"The Mac is already asking the user.":i==="no-dialog"?"The Mac couldn't show its question. The user can click Set up Token Lens Helper in the Token Lens box after reopening Claude.":"Couldn't set up Token Lens Helper on this Mac."}],structuredContent:{status:t.status,helper:i}}}let a=r==="on"?t.enable():r==="off"?t.disable():t.status;return{content:[{type:"text",text:xq[a]??a}],structuredContent:{status:a,helperOffer:t.helperOffer}}})}var Cq=e=>new Date(e).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"});function zq(e,t){let r=[e.plan?`Plan: ${e.plan.label}${e.planSource==="app"?" (read from the Claude app)":""}.`:"Plan: not known yet."];return e.sessionPct!==void 0&&r.push(`Session: ${e.sessionPct}% used${e.sessionResetsAt?`, resets ${Cq(e.sessionResetsAt)}`:""}${e.meterAgeMin?` (meter read ${e.meterAgeMin} min ago, carried forward by what was sent since)`:""}.`),e.weekPct!==void 0&&r.push(`Week: ${e.weekPct}% used${e.weekResetsText?`, resets ${e.weekResetsText}`:""}.`),e.left&&r.push(`Left this session: about ${Q(e.left.here)} messages in the open chat, or about ${Q(e.left.fresh)} in a new chat.`),t&&e.session.messages&&r.push(`This session: ${Q(e.session.messages)} messages, ${Q(e.session.tokens)} tokens read.`+(e.topChats.length>1?` Where it went: ${e.topChats.map(a=>`${a.title??"a chat"} ${Math.round(a.share*100)}%`).join(", ")}.`:"")),e.insights.length&&r.push("","What to do:",...e.insights.map(a=>`- ${a}`)),r.push("","None of this changes your model or its answers. Kept on this computer as times and token counts only, never text."),r.join(`
|
|
3848
|
+
`)}var e1={free:"claude-free",pro:"claude-pro",max:"claude-max",team:"claude-team"};function Iq(e,t){e.registerTool("plan_coach",{title:"Get the most out of your Claude plan",description:"How much of the user's Claude plan is used and left, how many messages fit, what drains it, and how to make it last. Never switches the model. Use for usage, limits or plan questions.",inputSchema:{plan:G.enum(["free","pro","max","team"]).optional().describe("The user's plan, if they said; saved for next time."),session_pct_used:G.number().min(0).max(100).optional().describe("Session usage % from Claude's Settings > Usage, if the user gave it."),session_resets_in_minutes:G.number().nonnegative().optional(),week_pct_used:G.number().min(0).max(100).optional(),chat_tokens:G.number().int().nonnegative().optional().describe("Your best estimate of this chat's size in tokens.")},annotations:{readOnlyHint:!1,openWorldHint:!1}},async r=>{let a=Date.now();t&&r.plan&&t.setPlan(e1[r.plan]);let n;if(t&&r.session_pct_used===void 0&&r.week_pct_used===void 0)n=t.insights.refreshCoach(a);else{let i={at:a,sessionPct:r.session_pct_used,sessionResetsAt:r.session_resets_in_minutes!==void 0?a+r.session_resets_in_minutes*6e4:void 0,weekPct:r.week_pct_used},o=r.plan?Bn[e1[r.plan]]:t?.insights.plan??null;n=Hp({data:{sends:[],readings:r.session_pct_used!==void 0||r.week_pct_used!==void 0?[i]:[]},now:a,plan:o,planSource:o?"set":"unknown",current:r.chat_tokens?{chat:"this",tokens:r.chat_tokens}:void 0})}return{content:[{type:"text",text:zq(n,!!t)}],structuredContent:{...n}}})}async function Rq(){let e=$T(),t=process.argv.indexOf("--http");if(t===-1){let a=process.platform==="darwin"?new Qp:void 0,n=T_({ledger:e,live:a}),i=!1,o=()=>{if(!i){i=!0;try{a?.autoStart()}catch{}}};n.server.oninitialized=o,setTimeout(o,1e4).unref(),await n.connect(new Sp);return}let r=Number(process.argv[t+1]??process.env.PORT??8787);Pq(async(a,n)=>{if(!a.url?.startsWith("/mcp")){n.writeHead(a.url==="/"?200:404,{"content-type":"text/plain"}).end(`Token Lens MCP server: POST /mcp
|
|
3849
|
+
`);return}let i=T_({ledger:e}),o=new Rp({sessionIdGenerator:void 0});n.on("close",()=>{o.close(),i.close()}),await i.connect(o),await o.handleRequest(a,n)}).listen(r,()=>console.error(`Token Lens MCP server on http://localhost:${r}/mcp`))}Rq();
|