@synnaxlabs/freighter 0.7.0 → 0.7.1

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.
@@ -1,2 +1,2 @@
1
- "use strict";var Ga=Object.defineProperty;var Xa=(r,e,t)=>e in r?Ga(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ce=(r,e,t)=>(Xa(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Qa=Object.defineProperty,ei=(r,e,t)=>e in r?Qa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,b=(r,e,t)=>(ei(r,typeof e!="symbol"?e+"":e,t),t),xt,Y;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(Y||(Y={}));var Tn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Tn||(Tn={}));const T=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=r=>{switch(typeof r){case"undefined":return T.undefined;case"string":return T.string;case"number":return isNaN(r)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":return Array.isArray(r)?T.array:r===null?T.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?T.promise:typeof Map<"u"&&r instanceof Map?T.map:typeof Set<"u"&&r instanceof Set?T.set:typeof Date<"u"&&r instanceof Date?T.date:T.object;default:return T.unknown}},v=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ti=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let Ce=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=r=>new Ce(r);const Ut=(r,e)=>{let t;switch(r.code){case v.invalid_type:r.received===T.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case v.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Y.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:t=`Unrecognized key(s) in object: ${Y.joinValues(r.keys,", ")}`;break;case v.invalid_union:t="Invalid input";break;case v.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Y.joinValues(r.options)}`;break;case v.invalid_enum_value:t=`Invalid enum value. Expected ${Y.joinValues(r.options)}, received '${r.received}'`;break;case v.invalid_arguments:t="Invalid function arguments";break;case v.invalid_return_type:t="Invalid function return type";break;case v.invalid_date:t="Invalid date";break;case v.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:Y.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case v.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case v.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case v.custom:t="Invalid input";break;case v.invalid_intersection_types:t="Intersection results could not be merged";break;case v.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case v.not_finite:t="Number must be finite";break;default:t=e.defaultError,Y.assertNever(r)}return{message:t}};let Ds=Ut;function ri(r){Ds=r}function Ur(){return Ds}const Mr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const d=n.filter(u=>!!u).slice().reverse();for(const u of d)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},ni=[];function S(r,e){const t=Mr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ur(),Ut].filter(n=>!!n)});r.common.issues.push(t)}let xe=class Ls{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return $;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return Ls.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return $;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}};const $=Object.freeze({status:"aborted"}),Bs=r=>({status:"dirty",value:r}),_e=r=>({status:"valid",value:r}),On=r=>r.status==="aborted",Sn=r=>r.status==="dirty",Mt=r=>r.status==="valid",Pr=r=>typeof Promise<"u"&&r instanceof Promise;var C;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(C||(C={}));let Me=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ms=(r,e)=>{if(Mt(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ce(r.common.issues);return this._error=t,this._error}}};function M(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}let D=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xe,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Pr(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},a=this._parseSync({data:e,path:s.path,parent:s});return ms(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Pr(s)?s:Promise.resolve(s));return ms(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:v.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Re({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Je.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yt.create(this,this._def)}promise(){return It.create(this,this._def)}or(e){return qt.create([this,e],this._def)}and(e){return Wt.create(this,e,this._def)}transform(e){return new Re({...M(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Jt({...M(this._def),innerType:this,defaultValue:t,typeName:A.ZodDefault})}brand(){return new Js({typeName:A.ZodBranded,type:this,...M(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new zr({...M(this._def),innerType:this,catchValue:t,typeName:A.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return zn.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const si=/^c[^\s-]{8,}$/i,ai=/^[a-z][a-z0-9]*$/,ii=/^[0-9A-HJKMNP-TV-Z]{26}$/,oi=/^[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,ci=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ui="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let vn;const li=/^(((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}))$/,di=/^(([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})))$/,fi=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function hi(r,e){return!!((e==="v4"||!e)&&li.test(r)||(e==="v6"||!e)&&di.test(r))}let Nt=class jt extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==T.string){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.string,received:a.parsedType}),$}const n=new xe;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?S(s,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&S(s,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ci.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"email",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")vn||(vn=new RegExp(ui,"u")),vn.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"emoji",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")oi.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"uuid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")si.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ai.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid2",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ii.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ulid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),S(s,{validation:"url",code:v.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"regex",code:v.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?fi(a).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?hi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ip",code:v.invalid_string,message:a.message}),n.dirty()):Y.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:v.invalid_string,...C.errToObj(n)})}_addCheck(e){return new jt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...C.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...C.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...C.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...C.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...C.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...C.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...C.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...C.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...C.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...C.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...C.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...C.errToObj(t)})}nonempty(e){return this.min(1,C.errToObj(e))}trim(){return new jt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Nt.create=r=>{var e;return new Nt({checks:[],typeName:A.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...M(r)})};function pi(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}let Pt=class Nn extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==T.number){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.number,received:a.parsedType}),$}let n;const s=new xe;for(const a of this._def.checks)a.kind==="int"?Y.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?pi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_finite,message:a.message}),s.dirty()):Y.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,n,s){return new Nn({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new Nn({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:C.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Pt.create=r=>new Pt({checks:[],typeName:A.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...M(r)});let Dt=class En extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==T.bigint){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.bigint,received:a.parsedType}),$}let n;const s=new xe;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):Y.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,n,s){return new En({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new En({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Dt.create=r=>{var e;return new Dt({checks:[],typeName:A.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...M(r)})};let Lt=class extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==T.boolean){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.boolean,received:n.parsedType}),$}return _e(e.data)}};Lt.create=r=>new Lt({typeName:A.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...M(r)});let Bt=class Vs extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==T.date){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.date,received:a.parsedType}),$}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_date}),$}const n=new xe;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Y.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Vs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:C.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:C.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Bt.create=r=>new Bt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:A.ZodDate,...M(r)});let Dr=class extends D{_parse(e){if(this._getType(e)!==T.symbol){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.symbol,received:n.parsedType}),$}return _e(e.data)}};Dr.create=r=>new Dr({typeName:A.ZodSymbol,...M(r)});let Vt=class extends D{_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.undefined,received:n.parsedType}),$}return _e(e.data)}};Vt.create=r=>new Vt({typeName:A.ZodUndefined,...M(r)});let zt=class extends D{_parse(e){if(this._getType(e)!==T.null){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.null,received:n.parsedType}),$}return _e(e.data)}};zt.create=r=>new zt({typeName:A.ZodNull,...M(r)});let Et=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return _e(e.data)}};Et.create=r=>new Et({typeName:A.ZodAny,...M(r)});let pt=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _e(e.data)}};pt.create=r=>new pt({typeName:A.ZodUnknown,...M(r)});let Xe=class extends D{_parse(e){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:T.never,received:t.parsedType}),$}};Xe.create=r=>new Xe({typeName:A.ZodNever,...M(r)});let Lr=class extends D{_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.void,received:n.parsedType}),$}return _e(e.data)}};Lr.create=r=>new Lr({typeName:A.ZodVoid,...M(r)});let yt=class xr extends D{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==T.array)return S(t,{code:v.invalid_type,expected:T.array,received:t.parsedType}),$;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(S(t,{code:i?v.too_big:v.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(S(t,{code:v.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(S(t,{code:v.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Me(t,i,t.path,o)))).then(i=>xe.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Me(t,i,t.path,o)));return xe.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new xr({...this._def,minLength:{value:e,message:C.toString(t)}})}max(e,t){return new xr({...this._def,maxLength:{value:e,message:C.toString(t)}})}length(e,t){return new xr({...this._def,exactLength:{value:e,message:C.toString(t)}})}nonempty(e){return this.min(1,e)}};yt.create=(r,e)=>new yt({type:r,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...M(e)});function Tt(r){if(r instanceof Se){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Je.create(Tt(n))}return new Se({...r._def,shape:()=>e})}else return r instanceof yt?new yt({...r._def,type:Tt(r.element)}):r instanceof Je?Je.create(Tt(r.unwrap())):r instanceof gt?gt.create(Tt(r.unwrap())):r instanceof ot?ot.create(r.items.map(e=>Tt(e))):r}let Se=class Ee extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=Y.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==T.object){const u=this._getOrReturnCtx(e);return S(u,{code:v.invalid_type,expected:T.object,received:u.parsedType}),$}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Xe&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const d=[];for(const u of i){const p=a[u],I=s.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new Me(s,I,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Xe){const u=this._def.unknownKeys;if(u==="passthrough")for(const p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(u==="strict")o.length>0&&(S(s,{code:v.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const p of o){const I=s.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new Me(s,I,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const p of d){const I=await p.key;u.push({key:I,value:await p.value,alwaysSet:p.alwaysSet})}return u}).then(u=>xe.mergeObjectSync(n,u)):xe.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new Ee({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const d=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=C.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}strip(){return new Ee({...this._def,unknownKeys:"strip"})}passthrough(){return new Ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ee({...this._def,catchall:e})}pick(e){const t={};return Y.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Ee({...this._def,shape:()=>t})}omit(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Ee({...this._def,shape:()=>t})}deepPartial(){return Tt(this)}partial(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Ee({...this._def,shape:()=>t})}required(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Je;)a=a._def.innerType;t[n]=a}}),new Ee({...this._def,shape:()=>t})}keyof(){return Fs(Y.objectKeys(this.shape))}};Se.create=(r,e)=>new Se({shape:()=>r,unknownKeys:"strip",catchall:Xe.create(),typeName:A.ZodObject,...M(e)});Se.strictCreate=(r,e)=>new Se({shape:()=>r,unknownKeys:"strict",catchall:Xe.create(),typeName:A.ZodObject,...M(e)});Se.lazycreate=(r,e)=>new Se({shape:r,unknownKeys:"strip",catchall:Xe.create(),typeName:A.ZodObject,...M(e)});let qt=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Ce(o.ctx.common.issues));return S(t,{code:v.invalid_union,unionErrors:i}),$}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const d of n){const u={...t,common:{...t.common,issues:[]},parent:null},p=d._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new Ce(d));return S(t,{code:v.invalid_union,unionErrors:o}),$}}get options(){return this._def.options}};qt.create=(r,e)=>new qt({options:r,typeName:A.ZodUnion,...M(e)});const kr=r=>r instanceof Kt?kr(r.schema):r instanceof Re?kr(r.innerType()):r instanceof Yt?[r.value]:r instanceof dr?r.options:r instanceof Ft?Object.keys(r.enum):r instanceof Jt?kr(r._def.innerType):r instanceof Vt?[void 0]:r instanceof zt?[null]:null;let zs=class qs extends D{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.object)return S(t,{code:v.invalid_type,expected:T.object,received:t.parsedType}),$;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(S(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=kr(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new qs({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...M(n)})}};function In(r,e){const t=nt(r),n=nt(e);if(r===e)return{valid:!0,data:r};if(t===T.object&&n===T.object){const s=Y.objectKeys(e),a=Y.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const d=In(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===T.array&&n===T.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],d=In(i,o);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return t===T.date&&n===T.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let Wt=class extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(On(a)||On(i))return $;const o=In(a.value,i.value);return o.valid?((Sn(a)||Sn(i))&&t.dirty(),{status:t.value,value:o.data}):(S(n,{code:v.invalid_intersection_types}),$)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Wt.create=(r,e,t)=>new Wt({left:r,right:e,typeName:A.ZodIntersection,...M(t)});let ot=class Ws extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.array)return S(n,{code:v.invalid_type,expected:T.array,received:n.parsedType}),$;if(n.data.length<this._def.items.length)return S(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new Me(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>xe.mergeArray(t,i)):xe.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Ws({...this._def,rest:e})}};ot.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ot({items:r,typeName:A.ZodTuple,rest:null,...M(e)})};let Ks=class Cn extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.object)return S(n,{code:v.invalid_type,expected:T.object,received:n.parsedType}),$;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Me(n,o,n.path,o)),value:i._parse(new Me(n,n.data[o],n.path,o))});return n.common.async?xe.mergeObjectAsync(t,s):xe.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof D?new Cn({keyType:e,valueType:t,typeName:A.ZodRecord,...M(n)}):new Cn({keyType:Nt.create(),valueType:e,typeName:A.ZodRecord,...M(t)})}},Br=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.map)return S(n,{code:v.invalid_type,expected:T.map,received:n.parsedType}),$;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,d],u)=>({key:s._parse(new Me(n,o,n.path,[u,"key"])),value:a._parse(new Me(n,d,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const u=await d.key,p=await d.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of i){const u=d.key,p=d.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}};Br.create=(r,e,t)=>new Br({valueType:e,keyType:r,typeName:A.ZodMap,...M(t)});let Vr=class Zn extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.set)return S(n,{code:v.invalid_type,expected:T.set,received:n.parsedType}),$;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(S(n,{code:v.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(S(n,{code:v.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(d){const u=new Set;for(const p of d){if(p.status==="aborted")return $;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((d,u)=>a._parse(new Me(n,d,n.path,u)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new Zn({...this._def,minSize:{value:e,message:C.toString(t)}})}max(e,t){return new Zn({...this._def,maxSize:{value:e,message:C.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Vr.create=(r,e)=>new Vr({valueType:r,minSize:null,maxSize:null,typeName:A.ZodSet,...M(e)});let Ys=class Tr extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.function)return S(t,{code:v.invalid_type,expected:T.function,received:t.parsedType}),$;function n(o,d){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Ut].filter(u=>!!u),issueData:{code:v.invalid_arguments,argumentsError:d}})}function s(o,d){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Ut].filter(u=>!!u),issueData:{code:v.invalid_return_type,returnTypeError:d}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof It){const o=this;return _e(async function(...d){const u=new Ce([]),p=await o._def.args.parseAsync(d,a).catch(J=>{throw u.addIssue(n(d,J)),u}),I=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(I,a).catch(J=>{throw u.addIssue(s(I,J)),u})})}else{const o=this;return _e(function(...d){const u=o._def.args.safeParse(d,a);if(!u.success)throw new Ce([n(d,u.error)]);const p=Reflect.apply(i,this,u.data),I=o._def.returns.safeParse(p,a);if(!I.success)throw new Ce([s(p,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Tr({...this._def,args:ot.create(e).rest(pt.create())})}returns(e){return new Tr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Tr({args:e||ot.create([]).rest(pt.create()),returns:t||pt.create(),typeName:A.ZodFunction,...M(n)})}},Kt=class extends D{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Kt.create=(r,e)=>new Kt({getter:r,typeName:A.ZodLazy,...M(e)});let Yt=class extends D{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return S(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),$}return{status:"valid",value:e.data}}get value(){return this._def.value}};Yt.create=(r,e)=>new Yt({value:r,typeName:A.ZodLiteral,...M(e)});function Fs(r,e){return new dr({values:r,typeName:A.ZodEnum,...M(e)})}let dr=class An extends D{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{expected:Y.joinValues(n),received:t.parsedType,code:v.invalid_type}),$}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{received:t.data,code:v.invalid_enum_value,options:n}),$}return _e(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return An.create(e)}exclude(e){return An.create(this.options.filter(t=>!e.includes(t)))}};dr.create=Fs;let Ft=class extends D{_parse(e){const t=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==T.string&&n.parsedType!==T.number){const s=Y.objectValues(t);return S(n,{expected:Y.joinValues(s),received:n.parsedType,code:v.invalid_type}),$}if(t.indexOf(e.data)===-1){const s=Y.objectValues(t);return S(n,{received:n.data,code:v.invalid_enum_value,options:s}),$}return _e(e.data)}get enum(){return this._def.values}};Ft.create=(r,e)=>new Ft({values:r,typeName:A.ZodNativeEnum,...M(e)});let It=class extends D{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.promise&&t.common.async===!1)return S(t,{code:v.invalid_type,expected:T.promise,received:t.parsedType}),$;const n=t.parsedType===T.promise?t.data:Promise.resolve(t.data);return _e(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};It.create=(r,e)=>new It({type:r,typeName:A.ZodPromise,...M(e)});let Re=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{S(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const d=s.refinement(o,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?$:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?$:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Mt(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Mt(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);Y.assertNever(s)}};Re.create=(r,e,t)=>new Re({schema:r,typeName:A.ZodEffects,effect:e,...M(t)});Re.createWithPreprocess=(r,e,t)=>new Re({schema:e,effect:{type:"preprocess",transform:r},typeName:A.ZodEffects,...M(t)});let Je=class extends D{_parse(e){return this._getType(e)===T.undefined?_e(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Je.create=(r,e)=>new Je({innerType:r,typeName:A.ZodOptional,...M(e)});let gt=class extends D{_parse(e){return this._getType(e)===T.null?_e(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(r,e)=>new gt({innerType:r,typeName:A.ZodNullable,...M(e)});let Jt=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===T.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Jt.create=(r,e)=>new Jt({innerType:r,typeName:A.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...M(e)});let zr=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Pr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zr.create=(r,e)=>new zr({innerType:r,typeName:A.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...M(e)});let qr=class extends D{_parse(e){if(this._getType(e)!==T.nan){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.nan,received:n.parsedType}),$}return{status:"valid",value:e.data}}};qr.create=r=>new qr({typeName:A.ZodNaN,...M(r)});const mi=Symbol("zod_brand");let Js=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},zn=class Hs extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?$:a.status==="dirty"?(t.dirty(),Bs(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?$:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Hs({in:e,out:t,typeName:A.ZodPipeline})}},Wr=class extends D{_parse(e){const t=this._def.innerType._parse(e);return Mt(t)&&(t.value=Object.freeze(t.value)),t}};Wr.create=(r,e)=>new Wr({innerType:r,typeName:A.ZodReadonly,...M(e)});const Gs=(r,e={},t)=>r?Et.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:d})}}):Et.create(),yi={object:Se.lazycreate};var A;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(A||(A={}));const gi=(r,e={message:`Input not instance of ${r.name}`})=>Gs(t=>t instanceof r,e),Xs=Nt.create,Qs=Pt.create,vi=qr.create,_i=Dt.create,ea=Lt.create,wi=Bt.create,bi=Dr.create,xi=Vt.create,ki=zt.create,Ti=Et.create,Oi=pt.create,Si=Xe.create,Ni=Lr.create,Ei=yt.create,Ii=Se.create,Ci=Se.strictCreate,Zi=qt.create,Ai=zs.create,Ri=Wt.create,ji=ot.create,$i=Ks.create,Ui=Br.create,Mi=Vr.create,Pi=Ys.create,Di=Kt.create,Li=Yt.create,Bi=dr.create,Vi=Ft.create,zi=It.create,ys=Re.create,qi=Je.create,Wi=gt.create,Ki=Re.createWithPreprocess,Yi=zn.create,Fi=()=>Xs().optional(),Ji=()=>Qs().optional(),Hi=()=>ea().optional(),Gi={string:r=>Nt.create({...r,coerce:!0}),number:r=>Pt.create({...r,coerce:!0}),boolean:r=>Lt.create({...r,coerce:!0}),bigint:r=>Dt.create({...r,coerce:!0}),date:r=>Bt.create({...r,coerce:!0})},Xi=$;var y=Object.freeze({__proto__:null,defaultErrorMap:Ut,setErrorMap:ri,getErrorMap:Ur,makeIssue:Mr,EMPTY_PATH:ni,addIssueToContext:S,ParseStatus:xe,INVALID:$,DIRTY:Bs,OK:_e,isAborted:On,isDirty:Sn,isValid:Mt,isAsync:Pr,get util(){return Y},get objectUtil(){return Tn},ZodParsedType:T,getParsedType:nt,ZodType:D,ZodString:Nt,ZodNumber:Pt,ZodBigInt:Dt,ZodBoolean:Lt,ZodDate:Bt,ZodSymbol:Dr,ZodUndefined:Vt,ZodNull:zt,ZodAny:Et,ZodUnknown:pt,ZodNever:Xe,ZodVoid:Lr,ZodArray:yt,ZodObject:Se,ZodUnion:qt,ZodDiscriminatedUnion:zs,ZodIntersection:Wt,ZodTuple:ot,ZodRecord:Ks,ZodMap:Br,ZodSet:Vr,ZodFunction:Ys,ZodLazy:Kt,ZodLiteral:Yt,ZodEnum:dr,ZodNativeEnum:Ft,ZodPromise:It,ZodEffects:Re,ZodTransformer:Re,ZodOptional:Je,ZodNullable:gt,ZodDefault:Jt,ZodCatch:zr,ZodNaN:qr,BRAND:mi,ZodBranded:Js,ZodPipeline:zn,ZodReadonly:Wr,custom:Gs,Schema:D,ZodSchema:D,late:yi,get ZodFirstPartyTypeKind(){return A},coerce:Gi,any:Ti,array:Ei,bigint:_i,boolean:ea,date:wi,discriminatedUnion:Ai,effect:ys,enum:Bi,function:Pi,instanceof:gi,intersection:Ri,lazy:Di,literal:Li,map:Ui,nan:vi,nativeEnum:Vi,never:Si,null:ki,nullable:Wi,number:Qs,object:Ii,oboolean:Hi,onumber:Ji,optional:qi,ostring:Fi,pipeline:Yi,preprocess:Ki,promise:zi,record:$i,set:Mi,strictObject:Ci,string:Xs,symbol:bi,transformer:ys,tuple:ji,undefined:xi,union:Zi,unknown:Oi,void:Ni,NEVER:Xi,ZodIssueCode:v,quotelessJson:ti,ZodError:Ce});const qn=y.tuple([y.number(),y.number()]),ta=y.object({width:y.number(),height:y.number()}),Qi=y.object({signedWidth:y.number(),signedHeight:y.number()}),eo=["width","height"];y.enum(eo);const to=["start","center","end"],ro=["signedWidth","signedHeight"];y.enum(ro);const Kr=y.object({x:y.number(),y:y.number()}),no=y.object({clientX:y.number(),clientY:y.number()}),so=["x","y"],ra=y.enum(so),na=["top","right","bottom","left"];y.enum(na);const ao=["left","right"],io=y.enum(ao),oo=["top","bottom"],co=y.enum(oo),sa=["center"];y.enum(sa);const uo=[...na,...sa],Yr=y.enum(uo);y.enum(to);const lo=["first","last"];y.enum(lo);const fo=y.object({lower:y.number(),upper:y.number()});y.union([fo,qn]);y.union([ra,Yr]);y.union([ra,Yr,y.instanceof(String)]);const _n=(r,e)=>{const t={lower:0,upper:0};return typeof r=="number"?e!=null?(t.lower=r,t.upper=e):(t.lower=0,t.upper=r):Array.isArray(r)?[t.lower,t.upper]=r:(t.lower=r.lower,t.upper=r.upper),ho(t)},ho=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},q={},an={};Object.defineProperty(an,"__esModule",{value:!0});function po(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w)/g,function(e,t,n){return n.toUpperCase()}):""}an.default=po;var on={};Object.defineProperty(on,"__esModule",{value:!0});function mo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"_").toLowerCase():""}on.default=mo;var cn={};Object.defineProperty(cn,"__esModule",{value:!0});function yo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"$").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w?)/g,function(e,t,n){return n.toUpperCase()}):""}cn.default=yo;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});function go(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,".").toLowerCase():""}Wn.default=go;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});function vo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"/").toLowerCase():""}Kn.default=vo;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});function _o(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase():""}Yn.default=_o;var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});function wo(r){if(r===void 0&&(r=""),!r)return"";var e=String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(t,n,s){return n+"_"+s.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}Fn.default=wo;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});function bo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase().replace(/( ?)(\w+)( ?)/g,function(e,t,n,s){return t+n.charAt(0).toUpperCase()+n.slice(1)+s}):""}Jn.default=bo;var un={};Object.defineProperty(un,"__esModule",{value:!0});function xo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"-").toLowerCase():""}un.default=xo;var Hn={},bt={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.belongToTypes=r.isValidObject=r.isArrayObject=r.validateOptions=r.DefaultOption=void 0,r.DefaultOption={recursive:!1,recursiveInArray:!1,keepTypesOnRecursion:[]},r.validateOptions=function(e){return e===void 0&&(e=r.DefaultOption),e.recursive==null?e=r.DefaultOption:e.recursiveInArray==null&&(e.recursiveInArray=!1),e},r.isArrayObject=function(e){return e!=null&&Array.isArray(e)},r.isValidObject=function(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)},r.belongToTypes=function(e,t){return(t||[]).some(function(n){return e instanceof n})}})(bt);var ko=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Hn,"__esModule",{value:!0});var Be=bt;function Or(r,e){if(e===void 0&&(e=Be.DefaultOption),!Be.isValidObject(r))return null;e=Be.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(Be.isValidObject(s)?Be.belongToTypes(s,e.keepTypesOnRecursion)||(s=Or(s,e)):e.recursiveInArray&&Be.isArrayObject(s)&&(s=ko(s).map(function(i){var o=i;if(Be.isValidObject(i))Be.belongToTypes(o,e.keepTypesOnRecursion)||(o=Or(i,e));else if(Be.isArrayObject(i)){var d=Or({key:i},e);o=d.key}return o}))),t[a]=s}),t}Hn.default=Or;var Gn={},To=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Gn,"__esModule",{value:!0});var Ve=bt;function Sr(r,e){if(e===void 0&&(e=Ve.DefaultOption),!Ve.isValidObject(r))return null;e=Ve.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(Ve.isValidObject(s)?Ve.belongToTypes(s,e.keepTypesOnRecursion)||(s=Sr(s,e)):e.recursiveInArray&&Ve.isArrayObject(s)&&(s=To(s).map(function(i){var o=i;if(Ve.isValidObject(i))Ve.belongToTypes(o,e.keepTypesOnRecursion)||(o=Sr(i,e));else if(Ve.isArrayObject(i)){var d=Sr({key:i},e);o=d.key}return o}))),t[a]=s}),t}Gn.default=Sr;var Xn={},Oo=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Xn,"__esModule",{value:!0});var ze=bt,So=an;function Nr(r,e){if(e===void 0&&(e=ze.DefaultOption),!ze.isValidObject(r))return null;e=ze.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=So.default(n);e.recursive&&(ze.isValidObject(s)?ze.belongToTypes(s,e.keepTypesOnRecursion)||(s=Nr(s,e)):e.recursiveInArray&&ze.isArrayObject(s)&&(s=Oo(s).map(function(i){var o=i;if(ze.isValidObject(i))ze.belongToTypes(o,e.keepTypesOnRecursion)||(o=Nr(i,e));else if(ze.isArrayObject(i)){var d=Nr({key:i},e);o=d.key}return o}))),t[a]=s}),t}Xn.default=Nr;var Qn={},No=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Qn,"__esModule",{value:!0});var qe=bt,Eo=on;function Er(r,e){if(e===void 0&&(e=qe.DefaultOption),!qe.isValidObject(r))return null;e=qe.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Eo.default(n);e.recursive&&(qe.isValidObject(s)?qe.belongToTypes(s,e.keepTypesOnRecursion)||(s=Er(s,e)):e.recursiveInArray&&qe.isArrayObject(s)&&(s=No(s).map(function(i){var o=i;if(qe.isValidObject(i))qe.belongToTypes(o,e.keepTypesOnRecursion)||(o=Er(i,e));else if(qe.isArrayObject(i)){var d=Er({key:i},e);o=d.key}return o}))),t[a]=s}),t}Qn.default=Er;var es={},Io=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(es,"__esModule",{value:!0});var We=bt,Co=cn;function Ir(r,e){if(e===void 0&&(e=We.DefaultOption),!We.isValidObject(r))return null;e=We.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Co.default(n);e.recursive&&(We.isValidObject(s)?We.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ir(s,e)):e.recursiveInArray&&We.isArrayObject(s)&&(s=Io(s).map(function(i){var o=i;if(We.isValidObject(i))We.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ir(i,e));else if(We.isArrayObject(i)){var d=Ir({key:i},e);o=d.key}return o}))),t[a]=s}),t}es.default=Ir;var ts={},Zo=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(ts,"__esModule",{value:!0});var Ke=bt,Ao=un;function Cr(r,e){if(e===void 0&&(e=Ke.DefaultOption),!Ke.isValidObject(r))return null;e=Ke.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Ao.default(n);e.recursive&&(Ke.isValidObject(s)?Ke.belongToTypes(s,e.keepTypesOnRecursion)||(s=Cr(s,e)):e.recursiveInArray&&Ke.isArrayObject(s)&&(s=Zo(s).map(function(i){var o=i;if(Ke.isValidObject(i))Ke.belongToTypes(o,e.keepTypesOnRecursion)||(o=Cr(i,e));else if(Ke.isArrayObject(i)){var d=Cr({key:i},e);o=d.key}return o}))),t[a]=s}),t}ts.default=Cr;Object.defineProperty(q,"__esModule",{value:!0});q.kebabKeys=q.pascalKeys=q.snakeKeys=q.camelKeys=q.upperKeys=q.lowerKeys=q.toLowerCase=q.toUpperCase=q.toKebabCase=q.toHeaderCase=q.toSentenceCase=q.toTextCase=q.toPathCase=q.toDotCase=q.toPascalCase=q.toSnakeCase=q.toCamelCase=void 0;var aa=an;q.toCamelCase=aa.default;var ia=on;q.toSnakeCase=ia.default;var oa=cn;q.toPascalCase=oa.default;var ca=Wn;q.toDotCase=ca.default;var ua=Kn;q.toPathCase=ua.default;var la=Yn;q.toTextCase=la.default;var da=Fn;q.toSentenceCase=da.default;var fa=Jn;q.toHeaderCase=fa.default;var ha=un;q.toKebabCase=ha.default;var pa=Hn;q.lowerKeys=pa.default;var ma=Gn;q.upperKeys=ma.default;var ya=Xn;q.camelKeys=ya.default;var ga=Qn;q.snakeKeys=ga.default;var va=es;q.pascalKeys=va.default;var _a=ts;q.kebabKeys=_a.default;var wa=function(r){return String(r||"").toLowerCase()};q.toLowerCase=wa;var ba=function(r){return String(r||"").toUpperCase()};q.toUpperCase=ba;var Ro={toCamelCase:aa.default,toSnakeCase:ia.default,toPascalCase:oa.default,toDotCase:ca.default,toPathCase:ua.default,toTextCase:la.default,toSentenceCase:da.default,toHeaderCase:fa.default,toKebabCase:ha.default,toUpperCase:ba,toLowerCase:wa,lowerKeys:pa.default,upperKeys:ma.default,camelKeys:ya.default,snakeKeys:ga.default,pascalKeys:va.default,kebabKeys:_a.default};q.default=Ro;var xa=q;const ka={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},jo=r=>xa.snakeKeys(r,ka),$o=r=>xa.camelKeys(r,ka);var Ct;(r=>{r.toSnake=jo,r.toCamel=$o,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Ct||(Ct={}));y.object({x:Yr,y:Yr});const Uo=y.object({x:io,y:co}),Mo={x:"left",y:"top"},Po=(r,e)=>r.x===e.x&&r.y===e.y,gs=y.union([y.number(),Kr,qn,ta,Qi,no]),Do=(r,e)=>typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{x:r.x,y:r.y},vs={x:0,y:0},gr=y.union([y.number(),y.string()]);y.object({top:gr,left:gr,width:gr,height:gr});y.object({left:y.number(),top:y.number(),right:y.number(),bottom:y.number()});y.object({one:Kr,two:Kr,root:Uo});const rs=(r,e,t=0,n=0,s)=>{const a={one:{...vs},two:{...vs},root:s??Mo};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return a.one={x:r,y:e},a.two={x:a.one.x+t,y:a.one.y+n},a}return"one"in r&&"two"in r&&"root"in r?{...r,root:s??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(a.one={x:r.left,y:r.top},a.two={x:r.right,y:r.bottom},a):(a.one=r,e==null?a.two={x:a.one.x+t,y:a.one.y+n}:typeof e=="number"?a.two={x:a.one.x+e,y:a.one.y+t}:"width"in e?a.two={x:a.one.x+e.width,y:a.one.y+e.height}:"signedWidth"in e?a.two={x:a.one.x+e.signedWidth,y:a.one.y+e.signedHeight}:a.two=e,a))},wn=r=>{const e=rs(r);return{lower:e.one.x,upper:e.two.x}},bn=r=>{const e=rs(r);return{lower:e.one.y,upper:e.two.y}},Lo=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Bo=y.object({signedWidth:y.number(),signedHeight:y.number()});y.union([ta,Bo,Kr,qn]);const Vo=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);y.object({offset:gs,scale:gs});const zo=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],qo=r=>(e,t,n,s)=>[e,s?n/r:n*r],Wo=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,d=a-s,u=o-i;if(t==="dimension")return[r,n*(u/d)];const p=(n-s)*(u/d)+i;return[r,p]},Ko=r=>(e,t,n)=>[r,n],Yo=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:s}=r;return[r,s-(t-n)]},Fo=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Vo(n,s,a),[e,n]},Rn=class $t{constructor(){b(this,"ops",[]),b(this,"currBounds",null),b(this,"currType",null),b(this,"reversed",!1),this.ops=[]}static translate(e){return new $t().translate(e)}static magnify(e){return new $t().magnify(e)}static scale(e,t){return new $t().scale(e,t)}translate(e){const t=this.new(),n=zo(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=qo(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=_n(e,t),s=this.new(),a=Wo(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=_n(e,t),s=this.new(),a=Fo(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=_n(e,t),s=this.new(),a=Ko(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Yo();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new $t;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,s],a)=>a(n,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||t.some(([i,o])=>s>=i&&s<=o))return;const a=e.ops.findIndex((i,o)=>i.type==="scale"&&o>s);a!==-1&&t.push([s,a])}),t.forEach(([n,s])=>{const a=e.ops.slice(n,s);a.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...a)}),e.reversed=!e.reversed,e}};b(Rn,"IDENTITY",new Rn);let _s=Rn;const ws=class Ye{constructor(e=new _s,t=new _s,n=null){b(this,"x"),b(this,"y"),b(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Ye().translate(e,t)}static translateX(e){return new Ye().translateX(e)}static translateY(e){return new Ye().translateY(e)}static clamp(e){return new Ye().clamp(e)}static magnify(e){return new Ye().magnify(e)}static scale(e){return new Ye().scale(e)}static reBound(e){return new Ye().reBound(e)}translate(e,t){const n=Do(e,t),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(Lo(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Po(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(wn(e)),t.y=t.y.scale(bn(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(wn(e)),t.y=this.y.reBound(bn(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(wn(e)),t.y=this.y.clamp(bn(e)),t}copy(){const e=new Ye;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}box(e){return rs(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};b(ws,"IDENTITY",new ws);const Ta=(r,e)=>{const t=new ke(e);if(![ve.DAY,ve.HOUR,ve.MINUTE,ve.SECOND,ve.MILLISECOND,ve.MICROSECOND,ve.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof ke?new ke(n):new ve(n)},ee=class z extends Number{constructor(e,t="UTC"){if(e==null)return z.now();if(e instanceof Date)super(e.getTime()*z.MILLISECOND.valueOf());else if(typeof e=="string")super(z.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(z.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=z.utcOffset.valueOf()),super(e.valueOf()+n)}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new z(s.getTime()*z.MILLISECOND.valueOf()).truncate(z.DAY).valueOf()}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let i="00",o="00";a!=null&&([i,o]=a.split("."));let d=z.hours(parseInt(n??"00",10)).add(z.minutes(parseInt(s??"00",10))).add(z.seconds(parseInt(i??"00",10))).add(z.milliseconds(parseInt(o??"00",10)));return t==="local"&&(d=d.add(z.utcOffset)),d.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return z.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new z(n.getTime()*z.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString(t);case"preciseDate":return`${this.dateString(t)} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString(t)} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(z.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(e="UTC"){const t=this.date(),n=t.toLocaleString("default",{month:"short"}),s=t.toLocaleString("default",{day:"numeric"});return`${n} ${s}`}static get utcOffset(){return new ve(new Date().getTimezoneOffset()*z.MINUTE.valueOf())}static since(e){return new z().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new z(e).valueOf()}span(e){return this.range(e).span}range(e){return new Jo(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new z(e).valueOf()}afterEq(e){return this.valueOf()>=new z(e).valueOf()}before(e){return this.valueOf()<new z(e).valueOf()}beforeEq(e){return this.valueOf()<=new z(e).valueOf()}add(e){return new z(this.valueOf()+e.valueOf())}sub(e){return new z(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/z.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return Ta(this,e)}get isToday(){return this.truncate(ve.DAY).equals(z.now().truncate(ve.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new z(new Date)}static nanoseconds(e){return new z(e)}static microseconds(e){return z.nanoseconds(e*1e3)}static milliseconds(e){return z.microseconds(e*1e3)}static seconds(e){return z.milliseconds(e*1e3)}static minutes(e){return z.seconds(e*60)}static hours(e){return z.minutes(e*60)}static days(e){return z.hours(e*24)}};b(ee,"NANOSECOND",ee.nanoseconds(1));b(ee,"MICROSECOND",ee.microseconds(1));b(ee,"MILLISECOND",ee.milliseconds(1));b(ee,"SECOND",ee.seconds(1));b(ee,"MINUTE",ee.minutes(1));b(ee,"HOUR",ee.hours(1));b(ee,"DAY",ee.days(1));b(ee,"MAX",new ee(9122272036554776e3));b(ee,"MIN",new ee(0));b(ee,"ZERO",new ee(0));b(ee,"z",y.union([y.instanceof(Number).transform(r=>new ee(r)),y.number().transform(r=>new ee(r)),y.instanceof(ee)]));let ke=ee;const Q=class G extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return Ta(this,e)}truncate(e){return new G(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}toString(){const e=this.truncate(G.DAY),t=this.truncate(G.HOUR),n=this.truncate(G.MINUTE),s=this.truncate(G.SECOND),a=this.truncate(G.MILLISECOND),i=this.truncate(G.MICROSECOND),o=this.truncate(G.NANOSECOND),d=e,u=t.sub(e),p=n.sub(t),I=s.sub(n),ue=a.sub(s),J=i.sub(a),he=o.sub(i);let se="";return d.isZero||(se+=`${d.days}d `),u.isZero||(se+=`${u.hours}h `),p.isZero||(se+=`${p.minutes}m `),I.isZero||(se+=`${I.seconds}s `),ue.isZero||(se+=`${ue.milliseconds}ms `),J.isZero||(se+=`${J.microseconds}µs `),he.isZero||(se+=`${he.nanoseconds}ns`),se.trim()}get days(){return this.valueOf()/G.DAY.valueOf()}get hours(){return this.valueOf()/G.HOUR.valueOf()}get minutes(){return this.valueOf()/G.MINUTE.valueOf()}get seconds(){return this.valueOf()/G.SECOND.valueOf()}get milliseconds(){return this.valueOf()/G.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/G.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new G(e).valueOf()}add(e){return new G(this.valueOf()+new G(e).valueOf())}sub(e){return new G(this.valueOf()-new G(e).valueOf())}static nanoseconds(e=1){return new G(e)}static microseconds(e=1){return G.nanoseconds(e*1e3)}static milliseconds(e=1){return G.microseconds(e*1e3)}static seconds(e=1){return G.milliseconds(e*1e3)}static minutes(e){return G.seconds(e.valueOf()*60)}static hours(e){return G.minutes(e*60)}static days(e){return G.hours(e*24)}};b(Q,"NANOSECOND",Q.nanoseconds(1));b(Q,"MICROSECOND",Q.microseconds(1));b(Q,"MILLISECOND",Q.milliseconds(1));b(Q,"SECOND",Q.seconds(1));b(Q,"MINUTE",Q.minutes(1));b(Q,"HOUR",Q.hours(1));b(Q,"DAY",Q.days(1));b(Q,"MAX",new Q(Q.MAX_SAFE_INTEGER));b(Q,"MIN",new Q(-Q.MAX_SAFE_INTEGER));b(Q,"ZERO",new Q(0));b(Q,"z",y.union([y.instanceof(Number).transform(r=>new Q(r)),y.number().transform(r=>new Q(r)),y.instanceof(Q)]));let ve=Q;const vr=class Zr extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Zr(e).valueOf()}get period(){return ve.seconds(1/this.valueOf())}sampleCount(e){return new ve(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new ge(t).valueOf()}span(e){return ve.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Zr(e)}static khz(e){return Zr.hz(e*1e3)}};b(vr,"z",y.union([y.number().transform(r=>new vr(r)),y.instanceof(Number).transform(r=>new vr(r)),y.instanceof(vr)]));const fe=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Ho(e*this.valueOf())}};b(fe,"UNKNOWN",new fe(0));b(fe,"BIT128",new fe(16));b(fe,"BIT64",new fe(8));b(fe,"BIT32",new fe(4));b(fe,"BIT16",new fe(2));b(fe,"BIT8",new fe(1));b(fe,"z",y.union([y.number().transform(r=>new fe(r)),y.instanceof(Number).transform(r=>new fe(r)),y.instanceof(fe)]));let ge=fe;const Ue=class Ar{constructor(e,t){b(this,"start"),b(this,"end"),this.start=new ke(e),this.end=new ke(t)}get span(){return new ve(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}swap(){return new Ar(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e){e=e.makeValid();const t=this.makeValid();return e.start.equals(t.start)?!0:e.end.equals(this.start)||e.start.equals(this.end)?!1:this.contains(e.end)||this.contains(e.start)||e.contains(this.start)||e.contains(this.end)}contains(e){return e instanceof Ar?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Ar(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}};b(Ue,"MAX",new Ue(ke.MIN,ke.MAX));b(Ue,"MIN",new Ue(ke.MAX,ke.MIN));b(Ue,"ZERO",new Ue(ke.ZERO,ke.ZERO));b(Ue,"z",y.union([y.object({start:ke.z,end:ke.z}).transform(r=>new Ue(r.start,r.end)),y.instanceof(Ue)]));let Jo=Ue;const m=class ht extends String{constructor(e){if(e instanceof ht||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=ht.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(ht.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=ht.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get density(){const e=ht.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return ht.BIG_INT_TYPES.some(e=>e.equals(this))}};b(m,"UNKNOWN",new m("unknown"));b(m,"FLOAT64",new m("float64"));b(m,"FLOAT32",new m("float32"));b(m,"INT64",new m("int64"));b(m,"INT32",new m("int32"));b(m,"INT16",new m("int16"));b(m,"INT8",new m("int8"));b(m,"UINT64",new m("uint64"));b(m,"UINT32",new m("uint32"));b(m,"UINT16",new m("uint16"));b(m,"UINT8",new m("uint8"));b(m,"TIMESTAMP",new m("timestamp"));b(m,"UUID",new m("uuid"));b(m,"STRING",new m("string"));b(m,"JSON",new m("json"));b(m,"ARRAY_CONSTRUCTORS",new Map([[m.UINT8.toString(),Uint8Array],[m.UINT16.toString(),Uint16Array],[m.UINT32.toString(),Uint32Array],[m.UINT64.toString(),BigUint64Array],[m.FLOAT32.toString(),Float32Array],[m.FLOAT64.toString(),Float64Array],[m.INT8.toString(),Int8Array],[m.INT16.toString(),Int16Array],[m.INT32.toString(),Int32Array],[m.INT64.toString(),BigInt64Array],[m.TIMESTAMP.toString(),BigInt64Array],[m.STRING.toString(),Uint8Array],[m.JSON.toString(),Uint8Array],[m.UUID.toString(),Uint8Array]]));b(m,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,m.UINT8],[Uint16Array.name,m.UINT16],[Uint32Array.name,m.UINT32],[BigUint64Array.name,m.UINT64],[Float32Array.name,m.FLOAT32],[Float64Array.name,m.FLOAT64],[Int8Array.name,m.INT8],[Int16Array.name,m.INT16],[Int32Array.name,m.INT32],[BigInt64Array.name,m.INT64]]));b(m,"DENSITIES",new Map([[m.UINT8.toString(),ge.BIT8],[m.UINT16.toString(),ge.BIT16],[m.UINT32.toString(),ge.BIT32],[m.UINT64.toString(),ge.BIT64],[m.FLOAT32.toString(),ge.BIT32],[m.FLOAT64.toString(),ge.BIT64],[m.INT8.toString(),ge.BIT8],[m.INT16.toString(),ge.BIT16],[m.INT32.toString(),ge.BIT32],[m.INT64.toString(),ge.BIT64],[m.TIMESTAMP.toString(),ge.BIT64],[m.STRING.toString(),ge.UNKNOWN],[m.JSON.toString(),ge.UNKNOWN],[m.UUID.toString(),ge.BIT128]]));b(m,"ALL",[m.UNKNOWN,m.FLOAT64,m.FLOAT32,m.INT64,m.INT32,m.INT16,m.INT8,m.UINT64,m.UINT32,m.UINT16,m.UINT8,m.TIMESTAMP,m.UUID,m.STRING,m.JSON]);b(m,"BIG_INT_TYPES",[m.INT64,m.UINT64,m.TIMESTAMP]);b(m,"z",y.union([y.string().transform(r=>new m(r)),y.instanceof(m)]));const pe=class rt extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return rt.bytes(this.valueOf()+e.valueOf())}sub(e){return rt.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new rt(e)}static kilobytes(e=1){return rt.bytes(e.valueOf()*1e3)}static megabytes(e=1){return rt.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return rt.megabytes(e.valueOf()*1e3)}static terabytes(e){return rt.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};b(pe,"BYTE",new pe(1));b(pe,"KILOBYTE",pe.kilobytes(1));b(pe,"MEGABYTE",pe.megabytes(1));b(pe,"GIGABYTE",pe.gigabytes(1));b(pe,"TERABYTE",pe.terabytes(1));b(pe,"ZERO",new pe(0));b(pe,"z",y.union([y.number().transform(r=>new pe(r)),y.instanceof(pe)]));let Ho=pe;y.union([y.instanceof(Uint8Array),y.instanceof(Uint16Array),y.instanceof(Uint32Array),y.instanceof(BigUint64Array),y.instanceof(Float32Array),y.instanceof(Float64Array),y.instanceof(Int8Array),y.instanceof(Int16Array),y.instanceof(Int32Array),y.instanceof(BigInt64Array)]);y.record(y.union([y.number(),y.string(),y.symbol()]),y.unknown());const Oa=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Go=Oa(),Sa=["MacOS","Windows","Linux","Docker"],Xo=y.enum(Sa);let _r;const Qo=()=>{if(typeof window>"u")return;const r=window.navigator.userAgent.toLowerCase();if(r.includes("mac"))return"MacOS";if(r.includes("win"))return"Windows";if(r.includes("linux"))return"Linux"},ec=(r={})=>{const{force:e,default:t}=r;return e??_r??(_r=Qo(),_r??t)},Na=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Sa,RUNTIME:Go,detect:Oa,getOS:ec,osZ:Xo},Symbol.toStringTag,{value:"Module"})),tc=(...r)=>r.map(Ea).join(""),Ea=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),rc=r=>r.endsWith("/")?r.slice(0,-1):r,nc=(r,e="")=>r===null?"":"?"+Object.entries(r).filter(([,t])=>t==null?!1:Array.isArray(t)?t.length>0:!0).map(([t,n])=>`${e}${t}=${n}`).join("&");let sc=(xt=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){b(this,"protocol"),b(this,"host"),b(this,"port"),b(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=Ea(n)}replace(r){return new xt({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new xt({...this,pathPrefix:tc(this.path,r)})}toString(){return rc(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},b(xt,"UNKNOWN",new xt({host:"unknown",port:0})),xt);var jn;try{jn=new TextDecoder}catch{}var x,Oe,c=0,te={},K,at,Te=0,$e=0,de,He,we=[],W,bs={useRecords:!1,mapsAsObjects:!0};class Ia{}const Ca=new Ia;Ca.name="MessagePack 0xC1";var it=!1,Za=2,xs;try{new Function("")}catch{Za=1/0}class Ht{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=!1&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(x)return Ua(()=>(Un(),this?this.unpack(e,t):Ht.prototype.unpack.call(bs,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Oe=t.end||e.length,c=t.start||0):(c=0,Oe=t>-1?t:e.length),$e=0,at=null,de=null,x=e;try{W=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw x=null,e instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Ht){if(te=this,this.structures)return K=this.structures,wr(t);(!K||K.length>0)&&(K=[])}else te=bs,(!K||K.length>0)&&(K=[]);return wr(t)}unpackMultiple(e,t){let n,s=0;try{it=!0;let a=e.length,i=this?this.unpack(e,a):ln.unpack(e,a);if(t){if(t(i,s,c)===!1)return;for(;c<a;)if(s=c,t(wr(),s,c)===!1)return}else{for(n=[i];c<a;)s=c,n.push(wr());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{it=!1,Un()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(n=>n.slice(0)));for(let n=0,s=e.length;n<s;n++){let a=e[n];a&&(a.isShared=!0,n>=32&&(a.highByte=n-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let s=e[n],a=t[n];a&&(s&&((e.restoreStructures||(e.restoreStructures=[]))[n]=s),e[n]=a)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function wr(r){try{if(!te.trusted&&!it){let t=K.sharedLength||0;t<K.length&&(K.length=t)}let e;if(te.randomAccessStructure&&x[c]<64&&x[c]>=32&&xs?(e=xs(x,c,Oe,te),x=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),c=Oe):e=oe(),de&&(c=de.postBundlePosition,de=null),it&&(K.restoreStructures=null),c==Oe)K&&K.restoreStructures&&ks(),K=null,x=null,He&&(He=null);else{if(c>Oe)throw new Error("Unexpected end of MessagePack data");if(!it){let t;try{t=JSON.stringify(e,(n,s)=>typeof s=="bigint"?`${s}n`:s).slice(0,100)}catch(n){t="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw K&&K.restoreStructures&&ks(),Un(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||c>Oe)&&(e.incomplete=!0),e}}function ks(){for(let r in K.restoreStructures)K[r]=K.restoreStructures[r];K.restoreStructures=null}function oe(){let r=x[c++];if(r<160)if(r<128){if(r<64)return r;{let e=K[r&63]||te.getStructures&&Aa()[r&63];return e?(e.read||(e.read=ns(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,te.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=ja();n==="__proto__"&&(n="__proto_"),e[n]=oe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(oe(),oe());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=oe();return te.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if($e>=c)return at.slice(c-Te,(c+=e)-Te);if($e==0&&Oe<140){let t=e<16?ss(e):Ra(e);if(t!=null)return t}return $n(e)}else{let e;switch(r){case 192:return null;case 193:return de?(e=oe(),e>0?de[1].slice(de.position1,de.position1+=e):de[0].slice(de.position0,de.position0-=e)):Ca;case 194:return!1;case 195:return!0;case 196:if(e=x[c++],e===void 0)throw new Error("Unexpected end of buffer");return xn(e);case 197:return e=W.getUint16(c),c+=2,xn(e);case 198:return e=W.getUint32(c),c+=4,xn(e);case 199:return ft(x[c++]);case 200:return e=W.getUint16(c),c+=2,ft(e);case 201:return e=W.getUint32(c),c+=4,ft(e);case 202:if(e=W.getFloat32(c),te.useFloat32>2){let t=as[(x[c]&127)<<1|x[c+1]>>7];return c+=4,(t*e+(e>0?.5:-.5)>>0)/t}return c+=4,e;case 203:return e=W.getFloat64(c),c+=8,e;case 204:return x[c++];case 205:return e=W.getUint16(c),c+=2,e;case 206:return e=W.getUint32(c),c+=4,e;case 207:return te.int64AsType==="number"?(e=W.getUint32(c)*4294967296,e+=W.getUint32(c+4)):te.int64AsType==="string"?e=W.getBigUint64(c).toString():te.int64AsType==="auto"?(e=W.getBigUint64(c),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=W.getBigUint64(c),c+=8,e;case 208:return W.getInt8(c++);case 209:return e=W.getInt16(c),c+=2,e;case 210:return e=W.getInt32(c),c+=4,e;case 211:return te.int64AsType==="number"?(e=W.getInt32(c)*4294967296,e+=W.getUint32(c+4)):te.int64AsType==="string"?e=W.getBigInt64(c).toString():te.int64AsType==="auto"?(e=W.getBigInt64(c),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=W.getBigInt64(c),c+=8,e;case 212:if(e=x[c++],e==114)return Is(x[c++]&63);{let t=we[e];if(t)return t.read?(c++,t.read(oe())):t.noBuffer?(c++,t()):t(x.subarray(c,++c));throw new Error("Unknown extension "+e)}case 213:return e=x[c],e==114?(c++,Is(x[c++]&63,x[c++])):ft(2);case 214:return ft(4);case 215:return ft(8);case 216:return ft(16);case 217:return e=x[c++],$e>=c?at.slice(c-Te,(c+=e)-Te):ic(e);case 218:return e=W.getUint16(c),c+=2,$e>=c?at.slice(c-Te,(c+=e)-Te):oc(e);case 219:return e=W.getUint32(c),c+=4,$e>=c?at.slice(c-Te,(c+=e)-Te):cc(e);case 220:return e=W.getUint16(c),c+=2,Os(e);case 221:return e=W.getUint32(c),c+=4,Os(e);case 222:return e=W.getUint16(c),c+=2,Ss(e);case 223:return e=W.getUint32(c),c+=4,Ss(e);default:if(r>=224)return r-256;if(r===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+r)}}}const ac=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function ns(r,e){function t(){if(t.count++>Za){let s=r.read=new Function("r","return function(){return "+(te.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":ac.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(oe);return r.highByte===0&&(r.read=Ts(e,r.read)),s()}let n={};for(let s=0,a=r.length;s<a;s++){let i=r[s];i==="__proto__"&&(i="__proto_"),n[i]=oe()}return te.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?Ts(e,t):t}const Ts=(r,e)=>function(){let t=x[c++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=K[n]||Aa()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=ns(s,r)),s.read()};function Aa(){let r=Ua(()=>(x=null,te.getStructures()));return K=te._mergeStructures(r,K)}var $n=fr,ic=fr,oc=fr,cc=fr;function fr(r){let e;if(r<16&&(e=ss(r)))return e;if(r>64&&jn)return jn.decode(x.subarray(c,c+=r));const t=c+r,n=[];for(e="";c<t;){const s=x[c++];if(!(s&128))n.push(s);else if((s&224)===192){const a=x[c++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=x[c++]&63,i=x[c++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=x[c++]&63,i=x[c++]&63,o=x[c++]&63;let d=(s&7)<<18|a<<12|i<<6|o;d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|d&1023),n.push(d)}else n.push(s);n.length>=4096&&(e+=le.apply(String,n),n.length=0)}return n.length>0&&(e+=le.apply(String,n)),e}function Os(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=oe();return te.freezeData?Object.freeze(e):e}function Ss(r){if(te.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=ja();n==="__proto__"&&(n="__proto_"),e[n]=oe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(oe(),oe());return e}}var le=String.fromCharCode;function Ra(r){let e=c,t=new Array(r);for(let n=0;n<r;n++){const s=x[c++];if((s&128)>0){c=e;return}t[n]=s}return le.apply(String,t)}function ss(r){if(r<4)if(r<2){if(r===0)return"";{let e=x[c++];if((e&128)>1){c-=1;return}return le(e)}}else{let e=x[c++],t=x[c++];if((e&128)>0||(t&128)>0){c-=2;return}if(r<3)return le(e,t);let n=x[c++];if((n&128)>0){c-=3;return}return le(e,t,n)}else{let e=x[c++],t=x[c++],n=x[c++],s=x[c++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){c-=4;return}if(r<6){if(r===4)return le(e,t,n,s);{let a=x[c++];if((a&128)>0){c-=5;return}return le(e,t,n,s,a)}}else if(r<8){let a=x[c++],i=x[c++];if((a&128)>0||(i&128)>0){c-=6;return}if(r<7)return le(e,t,n,s,a,i);let o=x[c++];if((o&128)>0){c-=7;return}return le(e,t,n,s,a,i,o)}else{let a=x[c++],i=x[c++],o=x[c++],d=x[c++];if((a&128)>0||(i&128)>0||(o&128)>0||(d&128)>0){c-=8;return}if(r<10){if(r===8)return le(e,t,n,s,a,i,o,d);{let u=x[c++];if((u&128)>0){c-=9;return}return le(e,t,n,s,a,i,o,d,u)}}else if(r<12){let u=x[c++],p=x[c++];if((u&128)>0||(p&128)>0){c-=10;return}if(r<11)return le(e,t,n,s,a,i,o,d,u,p);let I=x[c++];if((I&128)>0){c-=11;return}return le(e,t,n,s,a,i,o,d,u,p,I)}else{let u=x[c++],p=x[c++],I=x[c++],ue=x[c++];if((u&128)>0||(p&128)>0||(I&128)>0||(ue&128)>0){c-=12;return}if(r<14){if(r===12)return le(e,t,n,s,a,i,o,d,u,p,I,ue);{let J=x[c++];if((J&128)>0){c-=13;return}return le(e,t,n,s,a,i,o,d,u,p,I,ue,J)}}else{let J=x[c++],he=x[c++];if((J&128)>0||(he&128)>0){c-=14;return}if(r<15)return le(e,t,n,s,a,i,o,d,u,p,I,ue,J,he);let se=x[c++];if((se&128)>0){c-=15;return}return le(e,t,n,s,a,i,o,d,u,p,I,ue,J,he,se)}}}}}function Ns(){let r=x[c++],e;if(r<192)e=r-160;else switch(r){case 217:e=x[c++];break;case 218:e=W.getUint16(c),c+=2;break;case 219:e=W.getUint32(c),c+=4;break;default:throw new Error("Expected string")}return fr(e)}function xn(r){return te.copyBuffers?Uint8Array.prototype.slice.call(x,c,c+=r):x.subarray(c,c+=r)}function ft(r){let e=x[c++];if(we[e]){let t;return we[e](x.subarray(c,t=c+=r),n=>{c=n;try{return oe()}finally{c=t}})}else throw new Error("Unknown extension type "+e)}var Es=new Array(4096);function ja(){let r=x[c++];if(r>=160&&r<192){if(r=r-160,$e>=c)return at.slice(c-Te,(c+=r)-Te);if(!($e==0&&Oe<180))return $n(r)}else return c--,oe().toString();let e=(r<<5^(r>1?W.getUint16(c):r>0?x[c]:0))&4095,t=Es[e],n=c,s=c+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=W.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=x[n++],a!=t[i++]){n=1879048192;break}if(n===s)return c=n,t.string;s-=3,n=c}for(t=[],Es[e]=t,t.bytes=r;n<s;)a=W.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=x[n++],t.push(a);let o=r<16?ss(r):Ra(r);return o!=null?t.string=o:t.string=$n(r)}const Is=(r,e)=>{let t=oe().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=K[r];return s&&(s.isShared||it)&&((K.restoreStructures||(K.restoreStructures=[]))[r]=s),K[r]=t,t.read=ns(t,n),t.read()};we[0]=()=>{};we[0].noBuffer=!0;let uc={Error,TypeError,ReferenceError};we[101]=()=>{let r=oe();return(uc[r[0]]||Error)(r[1])};we[105]=r=>{let e=W.getUint32(c-4);He||(He=new Map);let t=x[c],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};He.set(e,s);let a=oe();return s.used?Object.assign(n,a):(s.target=a,a)};we[112]=r=>{let e=W.getUint32(c-4),t=He.get(e);return t.used=!0,t.target};we[115]=()=>new Set(oe());const $a=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let lc=typeof globalThis=="object"?globalThis:window;we[116]=r=>{let e=r[0],t=$a[e];if(!t)throw new Error("Could not find typed array for code "+e);return new lc[t](Uint8Array.prototype.slice.call(r,1).buffer)};we[120]=()=>{let r=oe();return new RegExp(r[0],r[1])};const dc=[];we[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=c;return c+=e-r.length,de=dc,de=[Ns(),Ns()],de.position0=0,de.position1=0,de.postBundlePosition=c,c=t,oe()};we[255]=r=>r.length==4?new Date((r[0]*16777216+(r[1]<<16)+(r[2]<<8)+r[3])*1e3):r.length==8?new Date(((r[0]<<22)+(r[1]<<14)+(r[2]<<6)+(r[3]>>2))/1e6+((r[3]&3)*4294967296+r[4]*16777216+(r[5]<<16)+(r[6]<<8)+r[7])*1e3):r.length==12?new Date(((r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3])/1e6+((r[4]&128?-281474976710656:0)+r[6]*1099511627776+r[7]*4294967296+r[8]*16777216+(r[9]<<16)+(r[10]<<8)+r[11])*1e3):new Date("invalid");function Ua(r){let e=Oe,t=c,n=Te,s=$e,a=at,i=He,o=de,d=new Uint8Array(x.slice(0,Oe)),u=K,p=K.slice(0,K.length),I=te,ue=it,J=r();return Oe=e,c=t,Te=n,$e=s,at=a,He=i,de=o,x=d,it=ue,K=u,K.splice(0,K.length,...p),te=I,W=new DataView(x.buffer,x.byteOffset,x.byteLength),J}function Un(){x=null,He=null,K=null}function fc(r){r.unpack?we[r.type]=r.unpack:we[r.type]=r}const as=new Array(147);for(let r=0;r<256;r++)as[r]=+("1e"+Math.floor(45.15-r*.30103));var ln=new Ht({useRecords:!1});const hc=ln.unpack;ln.unpackMultiple;ln.unpack;let pc=new Float32Array(1);new Uint8Array(pc.buffer,0,4);let Rr;try{Rr=new TextEncoder}catch{}let Fr,is;const dn=typeof Buffer<"u",br=dn?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,Ma=dn?Buffer:Uint8Array,Cs=dn?4294967296:2144337920;let f,Rt,X,l=0,ye,re=null,mc;const yc=21760,gc=/[\u0080-\uFFFF]/,kt=Symbol("record-id");class vc extends Ht{constructor(e){super(e),this.offset=0;let t,n,s,a,i=Ma.prototype.utf8Write?function(h,E){return f.utf8Write(h,E,4294967295)}:Rr&&Rr.encodeInto?function(h,E){return Rr.encodeInto(h,f.subarray(E)).written}:!1,o=this;e||(e={});let d=e&&e.sequential,u=e.structures||e.saveStructures,p=e.maxSharedStructures;if(p==null&&(p=u?32:0),p>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let I=e.maxOwnStructures;I==null&&(I=u?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let ue=p>32||I+p>64,J=p+64,he=p+I+64;if(he>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let se=[],mn=0,mr=0;this.pack=this.encode=function(h,E){if(f||(f=new br(8192),X=f.dataView||(f.dataView=new DataView(f.buffer,0,8192)),l=0),ye=f.length-10,ye-l<2048?(f=new br(f.length),X=f.dataView||(f.dataView=new DataView(f.buffer,0,f.length)),ye=f.length-10,l=0):l=l+7&2147483640,t=l,E&Sc&&(l+=E&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof h!="string"?(re=[],re.size=1/0):re=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let g=s.sharedLength||0;if(g>p)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let w=0;w<g;w++){let k=s[w];if(!k)continue;let B,V=s.transitions;for(let j=0,ie=k.length;j<ie;j++){let H=k[j];B=V[H],B||(B=V[H]=Object.create(null)),V=B}V[kt]=w+64}this.lastNamedStructuresLength=g}d||(s.nextId=g+64)}n&&(n=!1);try{o.randomAccessStructure&&h&&h.constructor&&h.constructor===Object?Ha(h):ae(h);let g=re;if(re&&Rs(t,ae,0),a&&a.idsToInsert){let w=a.idsToInsert.sort((j,ie)=>j.offset>ie.offset?1:-1),k=w.length,B=-1;for(;g&&k>0;){let j=w[--k].offset+t;j<g.stringsPosition+t&&B===-1&&(B=0),j>g.position+t?B>=0&&(B+=6):(B>=0&&(X.setUint32(g.position+t,X.getUint32(g.position+t)+B),B=-1),g=g.previous,k++)}B>=0&&g&&X.setUint32(g.position+t,X.getUint32(g.position+t)+B),l+=w.length*6,l>ye&&et(l),o.offset=l;let V=wc(f.subarray(t,l),w);return a=null,V}return o.offset=l,E&Tc?(f.start=t,f.end=l,f):f.subarray(t,l)}finally{if(s&&(ls(),n&&o.saveStructures)){let g=s.sharedLength||0,w=f.subarray(t,l),k=xc(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(h,E):(o.lastNamedStructuresLength=g,w)}E&Oc&&(l=t)}};const ls=()=>{mr<10&&mr++;let h=s.sharedLength||0;if(s.length>h&&!d&&(s.length=h),mn>1e4)s.transitions=null,mr=0,mn=0,se.length>0&&(se=[]);else if(se.length>0&&!d){for(let E=0,g=se.length;E<g;E++)se[E][kt]=0;se=[]}},yn=h=>{var E=h.length;E<16?f[l++]=144|E:E<65536?(f[l++]=220,f[l++]=E>>8,f[l++]=E&255):(f[l++]=221,X.setUint32(l,E),l+=4);for(let g=0;g<E;g++)ae(h[g])},ae=h=>{l>ye&&(f=et(l));var E=typeof h,g;if(E==="string"){let w=h.length;if(re&&w>=4&&w<4096){if((re.size+=w)>yc){let j,ie=(re[0]?re[0].length*3+re[1].length:0)+10;l+ie>ye&&(f=et(l+ie));let H;re.position?(H=re,f[l]=200,l+=3,f[l++]=98,j=l-t,l+=4,Rs(t,ae,0),X.setUint16(j+t-3,l-t-j)):(f[l++]=214,f[l++]=98,j=l-t,l+=4),re=["",""],re.previous=H,re.size=0,re.position=j}let V=gc.test(h);re[V?0:1]+=h,f[l++]=193,ae(V?-w:w);return}let k;w<32?k=1:w<256?k=2:w<65536?k=3:k=5;let B=w*3;if(l+B>ye&&(f=et(l+B)),w<64||!i){let V,j,ie,H=l+k;for(V=0;V<w;V++)j=h.charCodeAt(V),j<128?f[H++]=j:j<2048?(f[H++]=j>>6|192,f[H++]=j&63|128):(j&64512)===55296&&((ie=h.charCodeAt(V+1))&64512)===56320?(j=65536+((j&1023)<<10)+(ie&1023),V++,f[H++]=j>>18|240,f[H++]=j>>12&63|128,f[H++]=j>>6&63|128,f[H++]=j&63|128):(f[H++]=j>>12|224,f[H++]=j>>6&63|128,f[H++]=j&63|128);g=H-l-k}else g=i(h,l+k);g<32?f[l++]=160|g:g<256?(k<2&&f.copyWithin(l+2,l+1,l+1+g),f[l++]=217,f[l++]=g):g<65536?(k<3&&f.copyWithin(l+3,l+2,l+2+g),f[l++]=218,f[l++]=g>>8,f[l++]=g&255):(k<5&&f.copyWithin(l+5,l+3,l+3+g),f[l++]=219,X.setUint32(l,g),l+=4),l+=g}else if(E==="number")if(h>>>0===h)h<32||h<128&&this.useRecords===!1||h<64&&!this.randomAccessStructure?f[l++]=h:h<256?(f[l++]=204,f[l++]=h):h<65536?(f[l++]=205,f[l++]=h>>8,f[l++]=h&255):(f[l++]=206,X.setUint32(l,h),l+=4);else if(h>>0===h)h>=-32?f[l++]=256+h:h>=-128?(f[l++]=208,f[l++]=h+256):h>=-32768?(f[l++]=209,X.setInt16(l,h),l+=2):(f[l++]=210,X.setInt32(l,h),l+=4);else{let w;if((w=this.useFloat32)>0&&h<4294967296&&h>=-2147483648){f[l++]=202,X.setFloat32(l,h);let k;if(w<4||(k=h*as[(f[l]&127)<<1|f[l+1]>>7])>>0===k){l+=4;return}else l--}f[l++]=203,X.setFloat64(l,h),l+=8}else if(E==="object"||E==="function")if(!h)f[l++]=192;else{if(a){let k=a.get(h);if(k){if(!k.id){let B=a.idsToInsert||(a.idsToInsert=[]);k.id=B.push(k)}f[l++]=214,f[l++]=112,X.setUint32(l,k.id),l+=4;return}else a.set(h,{offset:l-t})}let w=h.constructor;if(w===Object)yr(h,!0);else if(w===Array)yn(h);else if(w===Map)if(this.mapAsEmptyObject)f[l++]=128;else{g=h.size,g<16?f[l++]=128|g:g<65536?(f[l++]=222,f[l++]=g>>8,f[l++]=g&255):(f[l++]=223,X.setUint32(l,g),l+=4);for(let[k,B]of h)ae(k),ae(B)}else{for(let k=0,B=Fr.length;k<B;k++){let V=is[k];if(h instanceof V){let j=Fr[k];if(j.write){j.type&&(f[l++]=212,f[l++]=j.type,f[l++]=0);let tt=j.write.call(this,h);tt===h?Array.isArray(h)?yn(h):yr(h):ae(tt);return}let ie=f,H=X,Le=l;f=null;let dt;try{dt=j.pack.call(this,h,tt=>(f=ie,ie=null,l+=tt,l>ye&&et(l),{target:f,targetView:X,position:l-tt}),ae)}finally{ie&&(f=ie,X=H,l=Le,ye=f.length-10)}dt&&(dt.length+l>ye&&et(dt.length+l),l=_c(dt,f,l,j.type));return}}if(Array.isArray(h))yn(h);else{if(h.toJSON){const k=h.toJSON();if(k!==h)return ae(k)}if(E==="function")return ae(this.writeFunction&&this.writeFunction(h));yr(h,!h.hasOwnProperty)}}}else if(E==="boolean")f[l++]=h?195:194;else if(E==="bigint"){if(h<BigInt(1)<<BigInt(63)&&h>=-(BigInt(1)<<BigInt(63)))f[l++]=211,X.setBigInt64(l,h);else if(h<BigInt(1)<<BigInt(64)&&h>0)f[l++]=207,X.setBigUint64(l,h);else if(this.largeBigIntToFloat)f[l++]=203,X.setFloat64(l,Number(h));else throw new RangeError(h+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");l+=8}else if(E==="undefined")this.encodeUndefinedAsNil?f[l++]=192:(f[l++]=212,f[l++]=0,f[l++]=0);else throw new Error("Unknown type: "+E)},ds=this.variableMapSize||this.coercibleKeyAsNumber?h=>{let E=Object.keys(h),g=E.length;g<16?f[l++]=128|g:g<65536?(f[l++]=222,f[l++]=g>>8,f[l++]=g&255):(f[l++]=223,X.setUint32(l,g),l+=4);let w;if(this.coercibleKeyAsNumber)for(let k=0;k<g;k++){w=E[k];let B=Number(w);ae(isNaN(B)?w:B),ae(h[w])}else for(let k=0;k<g;k++)ae(w=E[k]),ae(h[w])}:(h,E)=>{f[l++]=222;let g=l-t;l+=2;let w=0;for(let k in h)(E||h.hasOwnProperty(k))&&(ae(k),ae(h[k]),w++);f[g+++t]=w>>8,f[g+t]=w&255},fs=this.useRecords===!1?ds:e.progressiveRecords&&!ue?(h,E)=>{let g,w=s.transitions||(s.transitions=Object.create(null)),k=l++-t,B;for(let V in h)if(E||h.hasOwnProperty(V)){if(g=w[V],g)w=g;else{let j=Object.keys(h),ie=w;w=s.transitions;let H=0;for(let Le=0,dt=j.length;Le<dt;Le++){let tt=j[Le];g=w[tt],g||(g=w[tt]=Object.create(null),H++),w=g}k+t+1==l?(l--,gn(w,j,H)):ps(w,j,k,H),B=!0,w=ie[V]}ae(h[V])}if(!B){let V=w[kt];V?f[k+t]=V:ps(w,Object.keys(h),k,0)}}:(h,E)=>{let g,w=s.transitions||(s.transitions=Object.create(null)),k=0;for(let V in h)(E||h.hasOwnProperty(V))&&(g=w[V],g||(g=w[V]=Object.create(null),k++),w=g);let B=w[kt];B?B>=96&&ue?(f[l++]=((B-=96)&31)+96,f[l++]=B>>5):f[l++]=B:gn(w,w.__keys__||Object.keys(h),k);for(let V in h)(E||h.hasOwnProperty(V))&&ae(h[V])},hs=typeof this.useRecords=="function"&&this.useRecords,yr=hs?(h,E)=>{hs(h)?fs(h,E):ds(h,E)}:fs,et=h=>{let E;if(h>16777216){if(h-t>Cs)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(Cs,Math.round(Math.max((h-t)*(h>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(h-t<<2,f.length-1)>>12)+1<<12;let g=new br(E);return X=g.dataView||(g.dataView=new DataView(g.buffer,0,E)),h=Math.min(h,f.length),f.copy?f.copy(g,0,t,h):g.set(f.slice(t,h)),l-=t,t=0,ye=g.length-10,f=g},gn=(h,E,g)=>{let w=s.nextId;w||(w=64),w<J&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(w=s.nextOwnId,w<he||(w=J),s.nextOwnId=w+1):(w>=he&&(w=J),s.nextId=w+1);let k=E.highByte=w>=96&&ue?w-96>>5:-1;h[kt]=w,h.__keys__=E,s[w-64]=E,w<J?(E.isShared=!0,s.sharedLength=w-63,n=!0,k>=0?(f[l++]=(w&31)+96,f[l++]=k):f[l++]=w):(k>=0?(f[l++]=213,f[l++]=114,f[l++]=(w&31)+96,f[l++]=k):(f[l++]=212,f[l++]=114,f[l++]=w),g&&(mn+=mr*g),se.length>=I&&(se.shift()[kt]=0),se.push(h),ae(E))},ps=(h,E,g,w)=>{let k=f,B=l,V=ye,j=t;f=Rt,l=0,t=0,f||(Rt=f=new br(8192)),ye=f.length-10,gn(h,E,w),Rt=f;let ie=l;if(f=k,l=B,ye=V,t=j,ie>1){let H=l+ie-1;H>ye&&et(H);let Le=g+t;f.copyWithin(Le+ie,Le+1,l),f.set(Rt.slice(0,ie),Le),l=H}else f[g+t]=Rt[0]},Ha=(h,E)=>{let g=mc(h,f,t,l,s,et,(w,k,B)=>{if(B)return n=!0;l=k;let V=f;return ae(w),ls(),V!==f?{position:l,targetView:X,target:f}:l},this);if(g===0)return yr(h,!0);l=g}}useBuffer(e){f=e,X=new DataView(f.buffer,f.byteOffset,f.byteLength),l=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}is=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ia];Fr=[{pack(r,e,t){let n=r.getTime()/1e3;if((this.useTimestamp32||r.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:s,targetView:a,position:i}=e(6);s[i++]=214,s[i++]=255,a.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:s,targetView:a,position:i}=e(10);s[i++]=215,s[i++]=255,a.setUint32(i,r.getMilliseconds()*4e6+(n/1e3/4294967296>>0)),a.setUint32(i+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:s,targetView:a,position:i}=e(3);s[i++]=212,s[i++]=255,s[i++]=255}else{let{target:s,targetView:a,position:i}=e(15);s[i++]=199,s[i++]=12,s[i++]=255,a.setUint32(i,r.getMilliseconds()*1e6),a.setBigInt64(i+4,BigInt(Math.floor(n)))}}},{pack(r,e,t){if(this.setAsEmptyObject)return e(0),t({});let n=Array.from(r),{target:s,position:a}=e(this.moreTypes?3:0);this.moreTypes&&(s[a++]=212,s[a++]=115,s[a++]=0),t(n)}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=101,n[s++]=0),t([r.name,r.message])}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=120,n[s++]=0),t([r.source,r.flags])}},{pack(r,e){this.moreTypes?Zs(r,16,e):As(dn?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==Ma&&this.moreTypes?Zs(r,$a.indexOf(t.name),e):As(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function Zs(r,e,t,n){let s=r.byteLength;if(s+1<256){var{target:a,position:i}=t(4+s);a[i++]=199,a[i++]=s+1}else if(s+1<65536){var{target:a,position:i}=t(5+s);a[i++]=200,a[i++]=s+1>>8,a[i++]=s+1&255}else{var{target:a,position:i,targetView:o}=t(7+s);a[i++]=201,o.setUint32(i,s+1),i+=4}a[i++]=116,a[i++]=e,a.set(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i)}function As(r,e){let t=r.byteLength;var n,s;if(t<256){var{target:n,position:s}=e(t+2);n[s++]=196,n[s++]=t}else if(t<65536){var{target:n,position:s}=e(t+3);n[s++]=197,n[s++]=t>>8,n[s++]=t&255}else{var{target:n,position:s,targetView:a}=e(t+5);n[s++]=198,a.setUint32(s,t),s+=4}n.set(r,s)}function _c(r,e,t,n){let s=r.length;switch(s){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:s<256?(e[t++]=199,e[t++]=s):s<65536?(e[t++]=200,e[t++]=s>>8,e[t++]=s&255):(e[t++]=201,e[t++]=s>>24,e[t++]=s>>16&255,e[t++]=s>>8&255,e[t++]=s&255)}return e[t++]=n,e.set(r,t),t+=s,t}function wc(r,e){let t,n=e.length*6,s=r.length-n;for(;t=e.pop();){let a=t.offset,i=t.id;r.copyWithin(a+n,a,s),n-=6;let o=a+n;r[o++]=214,r[o++]=105,r[o++]=i>>24,r[o++]=i>>16&255,r[o++]=i>>8&255,r[o++]=i&255,s=a}return r}function Rs(r,e,t){if(re.length>0){X.setUint32(re.position+r,l+t-re.position-r),re.stringsPosition=l-r;let n=re;re=null,e(n[0]),e(n[1])}}function bc(r){if(r.Class){if(!r.pack&&!r.write)throw new Error("Extension has no pack or write function");if(r.pack&&!r.type)throw new Error("Extension has no type (numeric code to identify the extension)");is.unshift(r.Class),Fr.unshift(r)}fc(r)}function xc(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Pa=new vc({useRecords:!1});const kc=Pa.pack;Pa.pack;const Tc=512,Oc=1024,Sc=2048;class Nc{constructor(){b(this,"contentType","application/msgpack")}encode(e){return kc(Ct.toSnake(e))}decode(e,t){const n=Ct.toCamel(hc(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){bc({type:0,...e})}}class Ec{constructor(){b(this,"contentType","application/json")}encode(e){const t=JSON.stringify(Ct.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=Ct.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new Nc,new Ec;var F;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(F||(F={}));var Mn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Mn||(Mn={}));const O=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),st=r=>{switch(typeof r){case"undefined":return O.undefined;case"string":return O.string;case"number":return isNaN(r)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(r)?O.array:r===null?O.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?O.promise:typeof Map<"u"&&r instanceof Map?O.map:typeof Set<"u"&&r instanceof Set?O.set:typeof Date<"u"&&r instanceof Date?O.date:O.object;default:return O.unknown}},_=F.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"]),Ic=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Ze extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Ze.create=r=>new Ze(r);const Gt=(r,e)=>{let t;switch(r.code){case _.invalid_type:r.received===O.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case _.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,F.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:t=`Unrecognized key(s) in object: ${F.joinValues(r.keys,", ")}`;break;case _.invalid_union:t="Invalid input";break;case _.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${F.joinValues(r.options)}`;break;case _.invalid_enum_value:t=`Invalid enum value. Expected ${F.joinValues(r.options)}, received '${r.received}'`;break;case _.invalid_arguments:t="Invalid function arguments";break;case _.invalid_return_type:t="Invalid function return type";break;case _.invalid_date:t="Invalid date";break;case _.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:F.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case _.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case _.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case _.custom:t="Invalid input";break;case _.invalid_intersection_types:t="Intersection results could not be merged";break;case _.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case _.not_finite:t="Number must be finite";break;default:t=e.defaultError,F.assertNever(r)}return{message:t}};let Da=Gt;function Cc(r){Da=r}function Jr(){return Da}const Hr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const d=n.filter(u=>!!u).slice().reverse();for(const u of d)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Zc=[];function N(r,e){const t=Hr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Jr(),Gt].filter(n=>!!n)});r.common.issues.push(t)}class me{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return U;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return me.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return U;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const U=Object.freeze({status:"aborted"}),La=r=>({status:"dirty",value:r}),be=r=>({status:"valid",value:r}),Pn=r=>r.status==="aborted",Dn=r=>r.status==="dirty",Xt=r=>r.status==="valid",Gr=r=>typeof Promise<"u"&&r instanceof Promise;var Z;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Z||(Z={}));class Pe{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const js=(r,e)=>{if(Xt(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ze(r.common.issues);return this._error=t,this._error}}};function P(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}class L{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return st(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:st(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new me,ctx:{common:e.parent.common,data:e.data,parsedType:st(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Gr(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:st(e)},a=this._parseSync({data:e,path:s.path,parent:s});return js(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:st(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Gr(s)?s:Promise.resolve(s));return js(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:_.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new je({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ge.create(this,this._def)}nullable(){return wt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ae.create(this,this._def)}promise(){return At.create(this,this._def)}or(e){return rr.create([this,e],this._def)}and(e){return nr.create(this,e,this._def)}transform(e){return new je({...P(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new cr({...P(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new Va({typeName:R.ZodBranded,type:this,...P(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new tn({...P(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hr.create(this,e)}readonly(){return nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ac=/^c[^\s-]{8,}$/i,Rc=/^[a-z][a-z0-9]*$/,jc=/^[0-9A-HJKMNP-TV-Z]{26}$/,$c=/^[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,Uc=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kn;const Pc=/^(((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}))$/,Dc=/^(([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})))$/,Lc=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Bc(r,e){return!!((e==="v4"||!e)&&Pc.test(r)||(e==="v6"||!e)&&Dc.test(r))}class Ie extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.string,received:a.parsedType}),U}const n=new me;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?N(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&N(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Uc.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"email",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")kn||(kn=new RegExp(Mc,"u")),kn.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"emoji",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")$c.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"uuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Ac.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Rc.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid2",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")jc.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ulid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),N(s,{validation:"url",code:_.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"regex",code:_.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Lc(a).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Bc(e.data,a.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:_.invalid_string,message:a.message}),n.dirty()):F.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:_.invalid_string,...Z.errToObj(n)})}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...Z.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Z.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new Ie({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ie({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ie({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ie.create=r=>{var e;return new Ie({checks:[],typeName:R.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...P(r)})};function Vc(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class ct extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.number,received:a.parsedType}),U}let n;const s=new me;for(const a of this._def.checks)a.kind==="int"?F.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:_.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Vc(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:_.not_finite,message:a.message}),s.dirty()):F.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,s){return new ct({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(s)}]})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&F.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ct.create=r=>new ct({checks:[],typeName:R.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...P(r)});class ut extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==O.bigint){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.bigint,received:a.parsedType}),U}let n;const s=new me;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):F.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,s){return new ut({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(s)}]})}_addCheck(e){return new ut({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ut.create=r=>{var e;return new ut({checks:[],typeName:R.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...P(r)})};class Qt extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.boolean,received:n.parsedType}),U}return be(e.data)}}Qt.create=r=>new Qt({typeName:R.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...P(r)});class vt extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.date,received:a.parsedType}),U}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_date}),U}const n=new me;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):F.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new vt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}vt.create=r=>new vt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:R.ZodDate,...P(r)});class Xr extends L{_parse(e){if(this._getType(e)!==O.symbol){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.symbol,received:n.parsedType}),U}return be(e.data)}}Xr.create=r=>new Xr({typeName:R.ZodSymbol,...P(r)});class er extends L{_parse(e){if(this._getType(e)!==O.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.undefined,received:n.parsedType}),U}return be(e.data)}}er.create=r=>new er({typeName:R.ZodUndefined,...P(r)});class tr extends L{_parse(e){if(this._getType(e)!==O.null){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.null,received:n.parsedType}),U}return be(e.data)}}tr.create=r=>new tr({typeName:R.ZodNull,...P(r)});class Zt extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return be(e.data)}}Zt.create=r=>new Zt({typeName:R.ZodAny,...P(r)});class mt extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return be(e.data)}}mt.create=r=>new mt({typeName:R.ZodUnknown,...P(r)});class Qe extends L{_parse(e){const t=this._getOrReturnCtx(e);return N(t,{code:_.invalid_type,expected:O.never,received:t.parsedType}),U}}Qe.create=r=>new Qe({typeName:R.ZodNever,...P(r)});class Qr extends L{_parse(e){if(this._getType(e)!==O.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.void,received:n.parsedType}),U}return be(e.data)}}Qr.create=r=>new Qr({typeName:R.ZodVoid,...P(r)});class Ae extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==O.array)return N(t,{code:_.invalid_type,expected:O.array,received:t.parsedType}),U;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(N(t,{code:i?_.too_big:_.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(N(t,{code:_.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(N(t,{code:_.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Pe(t,i,t.path,o)))).then(i=>me.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Pe(t,i,t.path,o)));return me.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Ae({...this._def,minLength:{value:e,message:Z.toString(t)}})}max(e,t){return new Ae({...this._def,maxLength:{value:e,message:Z.toString(t)}})}length(e,t){return new Ae({...this._def,exactLength:{value:e,message:Z.toString(t)}})}nonempty(e){return this.min(1,e)}}Ae.create=(r,e)=>new Ae({type:r,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...P(e)});function Ot(r){if(r instanceof ne){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Ge.create(Ot(n))}return new ne({...r._def,shape:()=>e})}else return r instanceof Ae?new Ae({...r._def,type:Ot(r.element)}):r instanceof Ge?Ge.create(Ot(r.unwrap())):r instanceof wt?wt.create(Ot(r.unwrap())):r instanceof De?De.create(r.items.map(e=>Ot(e))):r}class ne extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=F.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==O.object){const u=this._getOrReturnCtx(e);return N(u,{code:_.invalid_type,expected:O.object,received:u.parsedType}),U}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Qe&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const d=[];for(const u of i){const p=a[u],I=s.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new Pe(s,I,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Qe){const u=this._def.unknownKeys;if(u==="passthrough")for(const p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(u==="strict")o.length>0&&(N(s,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const p of o){const I=s.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new Pe(s,I,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const p of d){const I=await p.key;u.push({key:I,value:await p.value,alwaysSet:p.alwaysSet})}return u}).then(u=>me.mergeObjectSync(n,u)):me.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new ne({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const d=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=Z.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}strip(){return new ne({...this._def,unknownKeys:"strip"})}passthrough(){return new ne({...this._def,unknownKeys:"passthrough"})}extend(e){return new ne({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ne({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ne({...this._def,catchall:e})}pick(e){const t={};return F.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ne({...this._def,shape:()=>t})}omit(e){const t={};return F.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ne({...this._def,shape:()=>t})}deepPartial(){return Ot(this)}partial(e){const t={};return F.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new ne({...this._def,shape:()=>t})}required(e){const t={};return F.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ge;)a=a._def.innerType;t[n]=a}}),new ne({...this._def,shape:()=>t})}keyof(){return Ba(F.objectKeys(this.shape))}}ne.create=(r,e)=>new ne({shape:()=>r,unknownKeys:"strip",catchall:Qe.create(),typeName:R.ZodObject,...P(e)});ne.strictCreate=(r,e)=>new ne({shape:()=>r,unknownKeys:"strict",catchall:Qe.create(),typeName:R.ZodObject,...P(e)});ne.lazycreate=(r,e)=>new ne({shape:r,unknownKeys:"strip",catchall:Qe.create(),typeName:R.ZodObject,...P(e)});class rr extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Ze(o.ctx.common.issues));return N(t,{code:_.invalid_union,unionErrors:i}),U}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const d of n){const u={...t,common:{...t.common,issues:[]},parent:null},p=d._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new Ze(d));return N(t,{code:_.invalid_union,unionErrors:o}),U}}get options(){return this._def.options}}rr.create=(r,e)=>new rr({options:r,typeName:R.ZodUnion,...P(e)});const jr=r=>r instanceof ar?jr(r.schema):r instanceof je?jr(r.innerType()):r instanceof ir?[r.value]:r instanceof lt?r.options:r instanceof or?Object.keys(r.enum):r instanceof cr?jr(r._def.innerType):r instanceof er?[void 0]:r instanceof tr?[null]:null;class fn extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return N(t,{code:_.invalid_type,expected:O.object,received:t.parsedType}),U;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(N(t,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=jr(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new fn({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...P(n)})}}function Ln(r,e){const t=st(r),n=st(e);if(r===e)return{valid:!0,data:r};if(t===O.object&&n===O.object){const s=F.objectKeys(e),a=F.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const d=Ln(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===O.array&&n===O.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],d=Ln(i,o);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return t===O.date&&n===O.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class nr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Pn(a)||Pn(i))return U;const o=Ln(a.value,i.value);return o.valid?((Dn(a)||Dn(i))&&t.dirty(),{status:t.value,value:o.data}):(N(n,{code:_.invalid_intersection_types}),U)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}nr.create=(r,e,t)=>new nr({left:r,right:e,typeName:R.ZodIntersection,...P(t)});class De extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return N(n,{code:_.invalid_type,expected:O.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return N(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&n.data.length>this._def.items.length&&(N(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new Pe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>me.mergeArray(t,i)):me.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new De({...this._def,rest:e})}}De.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new De({items:r,typeName:R.ZodTuple,rest:null,...P(e)})};class sr extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return N(n,{code:_.invalid_type,expected:O.object,received:n.parsedType}),U;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Pe(n,o,n.path,o)),value:i._parse(new Pe(n,n.data[o],n.path,o))});return n.common.async?me.mergeObjectAsync(t,s):me.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new sr({keyType:e,valueType:t,typeName:R.ZodRecord,...P(n)}):new sr({keyType:Ie.create(),valueType:e,typeName:R.ZodRecord,...P(t)})}}class en extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.map)return N(n,{code:_.invalid_type,expected:O.map,received:n.parsedType}),U;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,d],u)=>({key:s._parse(new Pe(n,o,n.path,[u,"key"])),value:a._parse(new Pe(n,d,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const u=await d.key,p=await d.value;if(u.status==="aborted"||p.status==="aborted")return U;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of i){const u=d.key,p=d.value;if(u.status==="aborted"||p.status==="aborted")return U;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}}en.create=(r,e,t)=>new en({valueType:e,keyType:r,typeName:R.ZodMap,...P(t)});class _t extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return N(n,{code:_.invalid_type,expected:O.set,received:n.parsedType}),U;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(N(n,{code:_.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(N(n,{code:_.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(d){const u=new Set;for(const p of d){if(p.status==="aborted")return U;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((d,u)=>a._parse(new Pe(n,d,n.path,u)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new _t({...this._def,minSize:{value:e,message:Z.toString(t)}})}max(e,t){return new _t({...this._def,maxSize:{value:e,message:Z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_t.create=(r,e)=>new _t({valueType:r,minSize:null,maxSize:null,typeName:R.ZodSet,...P(e)});class St extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return N(t,{code:_.invalid_type,expected:O.function,received:t.parsedType}),U;function n(o,d){return Hr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jr(),Gt].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:d}})}function s(o,d){return Hr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jr(),Gt].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:d}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof At){const o=this;return be(async function(...d){const u=new Ze([]),p=await o._def.args.parseAsync(d,a).catch(J=>{throw u.addIssue(n(d,J)),u}),I=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(I,a).catch(J=>{throw u.addIssue(s(I,J)),u})})}else{const o=this;return be(function(...d){const u=o._def.args.safeParse(d,a);if(!u.success)throw new Ze([n(d,u.error)]);const p=Reflect.apply(i,this,u.data),I=o._def.returns.safeParse(p,a);if(!I.success)throw new Ze([s(p,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new St({...this._def,args:De.create(e).rest(mt.create())})}returns(e){return new St({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new St({args:e||De.create([]).rest(mt.create()),returns:t||mt.create(),typeName:R.ZodFunction,...P(n)})}}class ar extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ar.create=(r,e)=>new ar({getter:r,typeName:R.ZodLazy,...P(e)});class ir extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return N(t,{received:t.data,code:_.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:e.data}}get value(){return this._def.value}}ir.create=(r,e)=>new ir({value:r,typeName:R.ZodLiteral,...P(e)});function Ba(r,e){return new lt({values:r,typeName:R.ZodEnum,...P(e)})}class lt extends L{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return N(t,{expected:F.joinValues(n),received:t.parsedType,code:_.invalid_type}),U}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return N(t,{received:t.data,code:_.invalid_enum_value,options:n}),U}return be(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return lt.create(e)}exclude(e){return lt.create(this.options.filter(t=>!e.includes(t)))}}lt.create=Ba;class or extends L{_parse(e){const t=F.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){const s=F.objectValues(t);return N(n,{expected:F.joinValues(s),received:n.parsedType,code:_.invalid_type}),U}if(t.indexOf(e.data)===-1){const s=F.objectValues(t);return N(n,{received:n.data,code:_.invalid_enum_value,options:s}),U}return be(e.data)}get enum(){return this._def.values}}or.create=(r,e)=>new or({values:r,typeName:R.ZodNativeEnum,...P(e)});class At extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.promise&&t.common.async===!1)return N(t,{code:_.invalid_type,expected:O.promise,received:t.parsedType}),U;const n=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return be(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}At.create=(r,e)=>new At({type:r,typeName:R.ZodPromise,...P(e)});class je extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{N(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const d=s.refinement(o,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?U:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?U:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xt(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Xt(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);F.assertNever(s)}}je.create=(r,e,t)=>new je({schema:r,typeName:R.ZodEffects,effect:e,...P(t)});je.createWithPreprocess=(r,e,t)=>new je({schema:e,effect:{type:"preprocess",transform:r},typeName:R.ZodEffects,...P(t)});class Ge extends L{_parse(e){return this._getType(e)===O.undefined?be(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ge.create=(r,e)=>new Ge({innerType:r,typeName:R.ZodOptional,...P(e)});class wt extends L{_parse(e){return this._getType(e)===O.null?be(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wt.create=(r,e)=>new wt({innerType:r,typeName:R.ZodNullable,...P(e)});class cr extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===O.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}cr.create=(r,e)=>new cr({innerType:r,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});class tn extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Gr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ze(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ze(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}tn.create=(r,e)=>new tn({innerType:r,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});class rn extends L{_parse(e){if(this._getType(e)!==O.nan){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.nan,received:n.parsedType}),U}return{status:"valid",value:e.data}}}rn.create=r=>new rn({typeName:R.ZodNaN,...P(r)});const zc=Symbol("zod_brand");class Va extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class hr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?U:a.status==="dirty"?(t.dirty(),La(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?U:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new hr({in:e,out:t,typeName:R.ZodPipeline})}}class nn extends L{_parse(e){const t=this._def.innerType._parse(e);return Xt(t)&&(t.value=Object.freeze(t.value)),t}}nn.create=(r,e)=>new nn({innerType:r,typeName:R.ZodReadonly,...P(e)});const za=(r,e={},t)=>r?Zt.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:d})}}):Zt.create(),qc={object:ne.lazycreate};var R;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(R||(R={}));const Wc=(r,e={message:`Input not instance of ${r.name}`})=>za(t=>t instanceof r,e),qa=Ie.create,Wa=ct.create,Kc=rn.create,Yc=ut.create,Ka=Qt.create,Fc=vt.create,Jc=Xr.create,Hc=er.create,Gc=tr.create,Xc=Zt.create,Qc=mt.create,eu=Qe.create,tu=Qr.create,ru=Ae.create,nu=ne.create,su=ne.strictCreate,au=rr.create,iu=fn.create,ou=nr.create,cu=De.create,uu=sr.create,lu=en.create,du=_t.create,fu=St.create,hu=ar.create,pu=ir.create,mu=lt.create,yu=or.create,gu=At.create,$s=je.create,vu=Ge.create,_u=wt.create,wu=je.createWithPreprocess,bu=hr.create,xu=()=>qa().optional(),ku=()=>Wa().optional(),Tu=()=>Ka().optional(),Ou={string:r=>Ie.create({...r,coerce:!0}),number:r=>ct.create({...r,coerce:!0}),boolean:r=>Qt.create({...r,coerce:!0}),bigint:r=>ut.create({...r,coerce:!0}),date:r=>vt.create({...r,coerce:!0})},Su=U;var Fe=Object.freeze({__proto__:null,defaultErrorMap:Gt,setErrorMap:Cc,getErrorMap:Jr,makeIssue:Hr,EMPTY_PATH:Zc,addIssueToContext:N,ParseStatus:me,INVALID:U,DIRTY:La,OK:be,isAborted:Pn,isDirty:Dn,isValid:Xt,isAsync:Gr,get util(){return F},get objectUtil(){return Mn},ZodParsedType:O,getParsedType:st,ZodType:L,ZodString:Ie,ZodNumber:ct,ZodBigInt:ut,ZodBoolean:Qt,ZodDate:vt,ZodSymbol:Xr,ZodUndefined:er,ZodNull:tr,ZodAny:Zt,ZodUnknown:mt,ZodNever:Qe,ZodVoid:Qr,ZodArray:Ae,ZodObject:ne,ZodUnion:rr,ZodDiscriminatedUnion:fn,ZodIntersection:nr,ZodTuple:De,ZodRecord:sr,ZodMap:en,ZodSet:_t,ZodFunction:St,ZodLazy:ar,ZodLiteral:ir,ZodEnum:lt,ZodNativeEnum:or,ZodPromise:At,ZodEffects:je,ZodTransformer:je,ZodOptional:Ge,ZodNullable:wt,ZodDefault:cr,ZodCatch:tn,ZodNaN:rn,BRAND:zc,ZodBranded:Va,ZodPipeline:hr,ZodReadonly:nn,custom:za,Schema:L,ZodSchema:L,late:qc,get ZodFirstPartyTypeKind(){return R},coerce:Ou,any:Xc,array:ru,bigint:Yc,boolean:Ka,date:Fc,discriminatedUnion:iu,effect:$s,enum:mu,function:fu,instanceof:Wc,intersection:ou,lazy:hu,literal:pu,map:lu,nan:Kc,nativeEnum:yu,never:eu,null:Gc,nullable:_u,number:Wa,object:nu,oboolean:Tu,onumber:ku,optional:vu,ostring:xu,pipeline:bu,preprocess:wu,promise:gu,record:uu,set:du,strictObject:su,string:qa,symbol:Jc,transformer:$s,tuple:cu,undefined:Hc,union:au,unknown:Qc,void:tu,NEVER:Su,ZodIssueCode:_,quotelessJson:Ic,ZodError:Ze});class pr extends Error{constructor(t,n){super(t);ce(this,"discriminator","FreighterError");ce(this,"type");this.type=n}}const Nu=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!=="FreighterError")return!1;if(!("type"in e))throw new Error(`Freighter error is missing its type property: ${JSON.stringify(e)}`);return!0},Bn="unknown",Us="nil",hn="freighter",os=Fe.object({type:Fe.string(),data:Fe.string()});class Eu{constructor(){ce(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Us,data:""};if(Nu(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Bn,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===Us)return null;if(e.type===Bn)return new Ms(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Ms(e.data)}}const cs=new Eu,Ya=({encode:r,decode:e})=>cs.register({encode:r,decode:e}),Iu=r=>cs.encode(r),us=r=>cs.decode(r);class Ms extends pr{constructor(e){super(e,Bn)}}class ur extends pr{constructor(){super("EOF",hn)}}class lr extends pr{constructor(){super("StreamClosed",hn)}}class pn extends pr{constructor(t={}){const{message:n="Unreachable",url:s=sc.UNKNOWN}=t;super(n,hn);ce(this,"url");this.url=s}}const $r="freighter",Cu=r=>{if(r.type!==hn)return null;if(r instanceof ur)return{type:$r,data:"EOF"};if(r instanceof lr)return{type:$r,data:"StreamClosed"};if(r instanceof pn)return{type:$r,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},Zu=r=>{if(r.type!==$r)return null;switch(r.data){case"EOF":return new ur;case"StreamClosed":return new lr;case"Unreachable":return new pn;default:throw new Error(`Unknown error type: ${r.data}`)}};Ya({encode:Cu,decode:Zu});class Fa{constructor(){ce(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,t){let n=0;const s=async a=>{if(n===this.middleware.length)return await t(a);const i=this.middleware[n];return n++,await i(a,s)};return await s(e)}}const Ja="Content-Type",Ps=r=>{if(Na.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(r==="http")return e;const t=require("https"),n=new t.Agent({rejectUnauthorized:!1});return async(s,a)=>await e(s,{...a,agent:n})};class Au extends Fa{constructor(t,n,s=!1){super();ce(this,"endpoint");ce(this,"encoder");ce(this,"fetch");return this.endpoint=t.replace({protocol:s?"https":"http"}),this.encoder=n,this.fetch=Ps(this.endpoint.protocol),new Proxy(this,{get:(a,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(a,i,o)})}get headers(){return{[Ja]:this.encoder.contentType}}async send(t,n,s){let a=null;const i=this.endpoint.child(t),o={};o.method="POST",o.body=this.encoder.encode(n??{});const[,d]=await this.executeMiddleware({target:i.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async u=>{const p={...u,params:{}};o.headers={...this.headers,...u.params};let I;try{I=await Ps(u.protocol)(u.target,o)}catch(J){let he=J;return he.message==="Load failed"&&(he=new pn({url:i})),[p,he]}const ue=await I.arrayBuffer();if(I!=null&&I.ok)return s!=null&&(a=this.encoder.decode(ue,s)),[p,null];try{if(I.status!==400)return[p,new Error(I.statusText)];const J=this.encoder.decode(ue,os),he=us(J);return[p,he]}catch(J){return[p,new Error(`[freighter] - failed to decode error: ${I.statusText}: ${J.message}`)]}});return[a,d]}}const Ru=async(r,e,t,n)=>{const[s,a]=await r.send(e,t,n);if(a!=null)throw a;return s},ju=()=>Na.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),$u=Fe.object({type:Fe.union([Fe.literal("data"),Fe.literal("close")]),payload:Fe.unknown().optional(),error:Fe.optional(os)});class Uu{constructor(e,t,n,s){ce(this,"encoder");ce(this,"reqSchema");ce(this,"resSchema");ce(this,"ws");ce(this,"serverClosed");ce(this,"sendClosed");ce(this,"receiveDataQueue",[]);ce(this,"receiveCallbacksQueue",[]);this.encoder=t,this.reqSchema=n,this.resSchema=s,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}send(e){if(this.serverClosed!=null)return new ur;if(this.sendClosed)throw new lr;return this.ws.send(this.encoder.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");return this.serverClosed=us(e.error),[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.encoder.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){const e=this.receiveDataQueue.shift();return e??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}listenForMessages(){this.ws.onmessage=e=>{const t=this.encoder.decode(e.data,$u),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=Bu(e)?new ur:new lr}}}const Mu="freighterctx",Pu=1e3,Du=1001,Lu=[Pu,Du],Bu=r=>Lu.includes(r.code),sn=class sn extends Fa{constructor(t,n,s=!1){super();ce(this,"baseUrl");ce(this,"encoder");this.baseUrl=t.replace({protocol:s?"wss":"ws"}),this.encoder=n}async stream(t,n,s){const a=ju();let i;const[,o]=await this.executeMiddleware({target:t,protocol:"websocket",params:{},role:"client"},async d=>{const u=a(this.buildURL(t,d)),p={...d,params:{}};u.binaryType=sn.MESSAGE_TYPE;const I=await this.wrapSocket(u,n,s);return I instanceof Error?[p,I]:(i=I,[p,null])});if(o!=null)throw o;return i}buildURL(t,n){const s=nc({[Ja]:this.encoder.contentType,...n.params},Mu);return this.baseUrl.child(t).toString()+s}async wrapSocket(t,n,s){return await new Promise(a=>{t.onopen=()=>{a(new Uu(t,this.encoder,n,s))},t.onerror=i=>{const o=i;a(new Error(o.message))}})}};ce(sn,"MESSAGE_TYPE","arraybuffer");let Vn=sn;exports.BaseTypedError=pr;exports.EOF=ur;exports.HTTPClient=Au;exports.StreamClosed=lr;exports.Unreachable=pn;exports.WebSocketClient=Vn;exports.decodeError=us;exports.encodeError=Iu;exports.errorZ=os;exports.registerError=Ya;exports.sendRequired=Ru;
1
+ "use strict";var Ga=Object.defineProperty;var Xa=(r,e,t)=>e in r?Ga(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ce=(r,e,t)=>(Xa(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Qa=Object.defineProperty,ei=(r,e,t)=>e in r?Qa(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,b=(r,e,t)=>(ei(r,typeof e!="symbol"?e+"":e,t),t),xt,Y;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(Y||(Y={}));var Tn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Tn||(Tn={}));const T=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nt=r=>{switch(typeof r){case"undefined":return T.undefined;case"string":return T.string;case"number":return isNaN(r)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":return Array.isArray(r)?T.array:r===null?T.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?T.promise:typeof Map<"u"&&r instanceof Map?T.map:typeof Set<"u"&&r instanceof Set?T.set:typeof Date<"u"&&r instanceof Date?T.date:T.object;default:return T.unknown}},v=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ti=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");let Ce=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Ce.create=r=>new Ce(r);const Ut=(r,e)=>{let t;switch(r.code){case v.invalid_type:r.received===T.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case v.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,Y.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:t=`Unrecognized key(s) in object: ${Y.joinValues(r.keys,", ")}`;break;case v.invalid_union:t="Invalid input";break;case v.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${Y.joinValues(r.options)}`;break;case v.invalid_enum_value:t=`Invalid enum value. Expected ${Y.joinValues(r.options)}, received '${r.received}'`;break;case v.invalid_arguments:t="Invalid function arguments";break;case v.invalid_return_type:t="Invalid function return type";break;case v.invalid_date:t="Invalid date";break;case v.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:Y.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case v.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case v.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case v.custom:t="Invalid input";break;case v.invalid_intersection_types:t="Intersection results could not be merged";break;case v.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case v.not_finite:t="Number must be finite";break;default:t=e.defaultError,Y.assertNever(r)}return{message:t}};let Ds=Ut;function ri(r){Ds=r}function Ur(){return Ds}const Mr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const d=n.filter(u=>!!u).slice().reverse();for(const u of d)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},ni=[];function S(r,e){const t=Mr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ur(),Ut].filter(n=>!!n)});r.common.issues.push(t)}let xe=class Ls{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return $;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return Ls.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return $;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}};const $=Object.freeze({status:"aborted"}),Bs=r=>({status:"dirty",value:r}),_e=r=>({status:"valid",value:r}),On=r=>r.status==="aborted",Sn=r=>r.status==="dirty",Mt=r=>r.status==="valid",Pr=r=>typeof Promise<"u"&&r instanceof Promise;var C;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(C||(C={}));let Me=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ms=(r,e)=>{if(Mt(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ce(r.common.issues);return this._error=t,this._error}}};function M(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}let D=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return nt(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xe,ctx:{common:e.parent.common,data:e.data,parsedType:nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Pr(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},a=this._parseSync({data:e,path:s.path,parent:s});return ms(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nt(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Pr(s)?s:Promise.resolve(s));return ms(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:v.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Re({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Je.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yt.create(this,this._def)}promise(){return It.create(this,this._def)}or(e){return qt.create([this,e],this._def)}and(e){return Wt.create(this,e,this._def)}transform(e){return new Re({...M(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Jt({...M(this._def),innerType:this,defaultValue:t,typeName:A.ZodDefault})}brand(){return new Js({typeName:A.ZodBranded,type:this,...M(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new zr({...M(this._def),innerType:this,catchValue:t,typeName:A.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return zn.create(this,e)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const si=/^c[^\s-]{8,}$/i,ai=/^[a-z][a-z0-9]*$/,ii=/^[0-9A-HJKMNP-TV-Z]{26}$/,oi=/^[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,ci=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ui="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let vn;const li=/^(((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}))$/,di=/^(([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})))$/,fi=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function hi(r,e){return!!((e==="v4"||!e)&&li.test(r)||(e==="v6"||!e)&&di.test(r))}let Nt=class jt extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==T.string){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.string,received:a.parsedType}),$}const n=new xe;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?S(s,{code:v.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&S(s,{code:v.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")ci.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"email",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")vn||(vn=new RegExp(ui,"u")),vn.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"emoji",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")oi.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"uuid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")si.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")ai.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"cuid2",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")ii.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ulid",code:v.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),S(s,{validation:"url",code:v.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"regex",code:v.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?fi(a).test(e.data)||(s=this._getOrReturnCtx(e,s),S(s,{code:v.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?hi(e.data,a.version)||(s=this._getOrReturnCtx(e,s),S(s,{validation:"ip",code:v.invalid_string,message:a.message}),n.dirty()):Y.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:v.invalid_string,...C.errToObj(n)})}_addCheck(e){return new jt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...C.errToObj(e)})}url(e){return this._addCheck({kind:"url",...C.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...C.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...C.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...C.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...C.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...C.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...C.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...C.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...C.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...C.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...C.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...C.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...C.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...C.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...C.errToObj(t)})}nonempty(e){return this.min(1,C.errToObj(e))}trim(){return new jt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new jt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Nt.create=r=>{var e;return new Nt({checks:[],typeName:A.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...M(r)})};function pi(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}let Pt=class Nn extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==T.number){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.number,received:a.parsedType}),$}let n;const s=new xe;for(const a of this._def.checks)a.kind==="int"?Y.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?pi(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_finite,message:a.message}),s.dirty()):Y.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,n,s){return new Nn({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new Nn({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:C.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:C.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:C.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:C.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Y.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Pt.create=r=>new Pt({checks:[],typeName:A.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...M(r)});let Dt=class En extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==T.bigint){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.bigint,received:a.parsedType}),$}let n;const s=new xe;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):Y.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,C.toString(t))}gt(e,t){return this.setLimit("min",e,!1,C.toString(t))}lte(e,t){return this.setLimit("max",e,!0,C.toString(t))}lt(e,t){return this.setLimit("max",e,!1,C.toString(t))}setLimit(e,t,n,s){return new En({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new En({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:C.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:C.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:C.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:C.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:C.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Dt.create=r=>{var e;return new Dt({checks:[],typeName:A.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...M(r)})};let Lt=class extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==T.boolean){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.boolean,received:n.parsedType}),$}return _e(e.data)}};Lt.create=r=>new Lt({typeName:A.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...M(r)});let Bt=class Vs extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==T.date){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_type,expected:T.date,received:a.parsedType}),$}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return S(a,{code:v.invalid_date}),$}const n=new xe;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),S(s,{code:v.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):Y.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Vs({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:C.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:C.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Bt.create=r=>new Bt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:A.ZodDate,...M(r)});let Dr=class extends D{_parse(e){if(this._getType(e)!==T.symbol){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.symbol,received:n.parsedType}),$}return _e(e.data)}};Dr.create=r=>new Dr({typeName:A.ZodSymbol,...M(r)});let Vt=class extends D{_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.undefined,received:n.parsedType}),$}return _e(e.data)}};Vt.create=r=>new Vt({typeName:A.ZodUndefined,...M(r)});let zt=class extends D{_parse(e){if(this._getType(e)!==T.null){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.null,received:n.parsedType}),$}return _e(e.data)}};zt.create=r=>new zt({typeName:A.ZodNull,...M(r)});let Et=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return _e(e.data)}};Et.create=r=>new Et({typeName:A.ZodAny,...M(r)});let pt=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _e(e.data)}};pt.create=r=>new pt({typeName:A.ZodUnknown,...M(r)});let Xe=class extends D{_parse(e){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:T.never,received:t.parsedType}),$}};Xe.create=r=>new Xe({typeName:A.ZodNever,...M(r)});let Lr=class extends D{_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.void,received:n.parsedType}),$}return _e(e.data)}};Lr.create=r=>new Lr({typeName:A.ZodVoid,...M(r)});let yt=class xr extends D{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==T.array)return S(t,{code:v.invalid_type,expected:T.array,received:t.parsedType}),$;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(S(t,{code:i?v.too_big:v.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(S(t,{code:v.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(S(t,{code:v.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Me(t,i,t.path,o)))).then(i=>xe.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Me(t,i,t.path,o)));return xe.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new xr({...this._def,minLength:{value:e,message:C.toString(t)}})}max(e,t){return new xr({...this._def,maxLength:{value:e,message:C.toString(t)}})}length(e,t){return new xr({...this._def,exactLength:{value:e,message:C.toString(t)}})}nonempty(e){return this.min(1,e)}};yt.create=(r,e)=>new yt({type:r,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...M(e)});function Tt(r){if(r instanceof Se){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Je.create(Tt(n))}return new Se({...r._def,shape:()=>e})}else return r instanceof yt?new yt({...r._def,type:Tt(r.element)}):r instanceof Je?Je.create(Tt(r.unwrap())):r instanceof gt?gt.create(Tt(r.unwrap())):r instanceof ot?ot.create(r.items.map(e=>Tt(e))):r}let Se=class Ee extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=Y.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==T.object){const u=this._getOrReturnCtx(e);return S(u,{code:v.invalid_type,expected:T.object,received:u.parsedType}),$}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Xe&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const d=[];for(const u of i){const p=a[u],I=s.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new Me(s,I,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Xe){const u=this._def.unknownKeys;if(u==="passthrough")for(const p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(u==="strict")o.length>0&&(S(s,{code:v.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const p of o){const I=s.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new Me(s,I,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const p of d){const I=await p.key;u.push({key:I,value:await p.value,alwaysSet:p.alwaysSet})}return u}).then(u=>xe.mergeObjectSync(n,u)):xe.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new Ee({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const d=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=C.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}strip(){return new Ee({...this._def,unknownKeys:"strip"})}passthrough(){return new Ee({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ee({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ee({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ee({...this._def,catchall:e})}pick(e){const t={};return Y.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new Ee({...this._def,shape:()=>t})}omit(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new Ee({...this._def,shape:()=>t})}deepPartial(){return Tt(this)}partial(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new Ee({...this._def,shape:()=>t})}required(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Je;)a=a._def.innerType;t[n]=a}}),new Ee({...this._def,shape:()=>t})}keyof(){return Fs(Y.objectKeys(this.shape))}};Se.create=(r,e)=>new Se({shape:()=>r,unknownKeys:"strip",catchall:Xe.create(),typeName:A.ZodObject,...M(e)});Se.strictCreate=(r,e)=>new Se({shape:()=>r,unknownKeys:"strict",catchall:Xe.create(),typeName:A.ZodObject,...M(e)});Se.lazycreate=(r,e)=>new Se({shape:r,unknownKeys:"strip",catchall:Xe.create(),typeName:A.ZodObject,...M(e)});let qt=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Ce(o.ctx.common.issues));return S(t,{code:v.invalid_union,unionErrors:i}),$}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const d of n){const u={...t,common:{...t.common,issues:[]},parent:null},p=d._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new Ce(d));return S(t,{code:v.invalid_union,unionErrors:o}),$}}get options(){return this._def.options}};qt.create=(r,e)=>new qt({options:r,typeName:A.ZodUnion,...M(e)});const kr=r=>r instanceof Kt?kr(r.schema):r instanceof Re?kr(r.innerType()):r instanceof Yt?[r.value]:r instanceof dr?r.options:r instanceof Ft?Object.keys(r.enum):r instanceof Jt?kr(r._def.innerType):r instanceof Vt?[void 0]:r instanceof zt?[null]:null;let zs=class qs extends D{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.object)return S(t,{code:v.invalid_type,expected:T.object,received:t.parsedType}),$;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(S(t,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=kr(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new qs({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...M(n)})}};function In(r,e){const t=nt(r),n=nt(e);if(r===e)return{valid:!0,data:r};if(t===T.object&&n===T.object){const s=Y.objectKeys(e),a=Y.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const d=In(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===T.array&&n===T.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],d=In(i,o);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return t===T.date&&n===T.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}let Wt=class extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(On(a)||On(i))return $;const o=In(a.value,i.value);return o.valid?((Sn(a)||Sn(i))&&t.dirty(),{status:t.value,value:o.data}):(S(n,{code:v.invalid_intersection_types}),$)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Wt.create=(r,e,t)=>new Wt({left:r,right:e,typeName:A.ZodIntersection,...M(t)});let ot=class Ws extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.array)return S(n,{code:v.invalid_type,expected:T.array,received:n.parsedType}),$;if(n.data.length<this._def.items.length)return S(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new Me(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>xe.mergeArray(t,i)):xe.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Ws({...this._def,rest:e})}};ot.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ot({items:r,typeName:A.ZodTuple,rest:null,...M(e)})};let Ks=class Cn extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.object)return S(n,{code:v.invalid_type,expected:T.object,received:n.parsedType}),$;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Me(n,o,n.path,o)),value:i._parse(new Me(n,n.data[o],n.path,o))});return n.common.async?xe.mergeObjectAsync(t,s):xe.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof D?new Cn({keyType:e,valueType:t,typeName:A.ZodRecord,...M(n)}):new Cn({keyType:Nt.create(),valueType:e,typeName:A.ZodRecord,...M(t)})}},Br=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.map)return S(n,{code:v.invalid_type,expected:T.map,received:n.parsedType}),$;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,d],u)=>({key:s._parse(new Me(n,o,n.path,[u,"key"])),value:a._parse(new Me(n,d,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const u=await d.key,p=await d.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of i){const u=d.key,p=d.value;if(u.status==="aborted"||p.status==="aborted")return $;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}};Br.create=(r,e,t)=>new Br({valueType:e,keyType:r,typeName:A.ZodMap,...M(t)});let Vr=class Zn extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.set)return S(n,{code:v.invalid_type,expected:T.set,received:n.parsedType}),$;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(S(n,{code:v.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(S(n,{code:v.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(d){const u=new Set;for(const p of d){if(p.status==="aborted")return $;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((d,u)=>a._parse(new Me(n,d,n.path,u)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new Zn({...this._def,minSize:{value:e,message:C.toString(t)}})}max(e,t){return new Zn({...this._def,maxSize:{value:e,message:C.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Vr.create=(r,e)=>new Vr({valueType:r,minSize:null,maxSize:null,typeName:A.ZodSet,...M(e)});let Ys=class Tr extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.function)return S(t,{code:v.invalid_type,expected:T.function,received:t.parsedType}),$;function n(o,d){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Ut].filter(u=>!!u),issueData:{code:v.invalid_arguments,argumentsError:d}})}function s(o,d){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Ut].filter(u=>!!u),issueData:{code:v.invalid_return_type,returnTypeError:d}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof It){const o=this;return _e(async function(...d){const u=new Ce([]),p=await o._def.args.parseAsync(d,a).catch(J=>{throw u.addIssue(n(d,J)),u}),I=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(I,a).catch(J=>{throw u.addIssue(s(I,J)),u})})}else{const o=this;return _e(function(...d){const u=o._def.args.safeParse(d,a);if(!u.success)throw new Ce([n(d,u.error)]);const p=Reflect.apply(i,this,u.data),I=o._def.returns.safeParse(p,a);if(!I.success)throw new Ce([s(p,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Tr({...this._def,args:ot.create(e).rest(pt.create())})}returns(e){return new Tr({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Tr({args:e||ot.create([]).rest(pt.create()),returns:t||pt.create(),typeName:A.ZodFunction,...M(n)})}},Kt=class extends D{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Kt.create=(r,e)=>new Kt({getter:r,typeName:A.ZodLazy,...M(e)});let Yt=class extends D{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return S(t,{received:t.data,code:v.invalid_literal,expected:this._def.value}),$}return{status:"valid",value:e.data}}get value(){return this._def.value}};Yt.create=(r,e)=>new Yt({value:r,typeName:A.ZodLiteral,...M(e)});function Fs(r,e){return new dr({values:r,typeName:A.ZodEnum,...M(e)})}let dr=class An extends D{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{expected:Y.joinValues(n),received:t.parsedType,code:v.invalid_type}),$}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return S(t,{received:t.data,code:v.invalid_enum_value,options:n}),$}return _e(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return An.create(e)}exclude(e){return An.create(this.options.filter(t=>!e.includes(t)))}};dr.create=Fs;let Ft=class extends D{_parse(e){const t=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==T.string&&n.parsedType!==T.number){const s=Y.objectValues(t);return S(n,{expected:Y.joinValues(s),received:n.parsedType,code:v.invalid_type}),$}if(t.indexOf(e.data)===-1){const s=Y.objectValues(t);return S(n,{received:n.data,code:v.invalid_enum_value,options:s}),$}return _e(e.data)}get enum(){return this._def.values}};Ft.create=(r,e)=>new Ft({values:r,typeName:A.ZodNativeEnum,...M(e)});let It=class extends D{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.promise&&t.common.async===!1)return S(t,{code:v.invalid_type,expected:T.promise,received:t.parsedType}),$;const n=t.parsedType===T.promise?t.data:Promise.resolve(t.data);return _e(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};It.create=(r,e)=>new It({type:r,typeName:A.ZodPromise,...M(e)});let Re=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{S(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const d=s.refinement(o,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?$:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?$:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Mt(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Mt(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);Y.assertNever(s)}};Re.create=(r,e,t)=>new Re({schema:r,typeName:A.ZodEffects,effect:e,...M(t)});Re.createWithPreprocess=(r,e,t)=>new Re({schema:e,effect:{type:"preprocess",transform:r},typeName:A.ZodEffects,...M(t)});let Je=class extends D{_parse(e){return this._getType(e)===T.undefined?_e(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Je.create=(r,e)=>new Je({innerType:r,typeName:A.ZodOptional,...M(e)});let gt=class extends D{_parse(e){return this._getType(e)===T.null?_e(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(r,e)=>new gt({innerType:r,typeName:A.ZodNullable,...M(e)});let Jt=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===T.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Jt.create=(r,e)=>new Jt({innerType:r,typeName:A.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...M(e)});let zr=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Pr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ce(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};zr.create=(r,e)=>new zr({innerType:r,typeName:A.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...M(e)});let qr=class extends D{_parse(e){if(this._getType(e)!==T.nan){const n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:T.nan,received:n.parsedType}),$}return{status:"valid",value:e.data}}};qr.create=r=>new qr({typeName:A.ZodNaN,...M(r)});const mi=Symbol("zod_brand");let Js=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},zn=class Hs extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?$:a.status==="dirty"?(t.dirty(),Bs(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?$:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Hs({in:e,out:t,typeName:A.ZodPipeline})}},Wr=class extends D{_parse(e){const t=this._def.innerType._parse(e);return Mt(t)&&(t.value=Object.freeze(t.value)),t}};Wr.create=(r,e)=>new Wr({innerType:r,typeName:A.ZodReadonly,...M(e)});const Gs=(r,e={},t)=>r?Et.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:d})}}):Et.create(),yi={object:Se.lazycreate};var A;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(A||(A={}));const gi=(r,e={message:`Input not instance of ${r.name}`})=>Gs(t=>t instanceof r,e),Xs=Nt.create,Qs=Pt.create,vi=qr.create,_i=Dt.create,ea=Lt.create,wi=Bt.create,bi=Dr.create,xi=Vt.create,ki=zt.create,Ti=Et.create,Oi=pt.create,Si=Xe.create,Ni=Lr.create,Ei=yt.create,Ii=Se.create,Ci=Se.strictCreate,Zi=qt.create,Ai=zs.create,Ri=Wt.create,ji=ot.create,$i=Ks.create,Ui=Br.create,Mi=Vr.create,Pi=Ys.create,Di=Kt.create,Li=Yt.create,Bi=dr.create,Vi=Ft.create,zi=It.create,ys=Re.create,qi=Je.create,Wi=gt.create,Ki=Re.createWithPreprocess,Yi=zn.create,Fi=()=>Xs().optional(),Ji=()=>Qs().optional(),Hi=()=>ea().optional(),Gi={string:r=>Nt.create({...r,coerce:!0}),number:r=>Pt.create({...r,coerce:!0}),boolean:r=>Lt.create({...r,coerce:!0}),bigint:r=>Dt.create({...r,coerce:!0}),date:r=>Bt.create({...r,coerce:!0})},Xi=$;var y=Object.freeze({__proto__:null,defaultErrorMap:Ut,setErrorMap:ri,getErrorMap:Ur,makeIssue:Mr,EMPTY_PATH:ni,addIssueToContext:S,ParseStatus:xe,INVALID:$,DIRTY:Bs,OK:_e,isAborted:On,isDirty:Sn,isValid:Mt,isAsync:Pr,get util(){return Y},get objectUtil(){return Tn},ZodParsedType:T,getParsedType:nt,ZodType:D,ZodString:Nt,ZodNumber:Pt,ZodBigInt:Dt,ZodBoolean:Lt,ZodDate:Bt,ZodSymbol:Dr,ZodUndefined:Vt,ZodNull:zt,ZodAny:Et,ZodUnknown:pt,ZodNever:Xe,ZodVoid:Lr,ZodArray:yt,ZodObject:Se,ZodUnion:qt,ZodDiscriminatedUnion:zs,ZodIntersection:Wt,ZodTuple:ot,ZodRecord:Ks,ZodMap:Br,ZodSet:Vr,ZodFunction:Ys,ZodLazy:Kt,ZodLiteral:Yt,ZodEnum:dr,ZodNativeEnum:Ft,ZodPromise:It,ZodEffects:Re,ZodTransformer:Re,ZodOptional:Je,ZodNullable:gt,ZodDefault:Jt,ZodCatch:zr,ZodNaN:qr,BRAND:mi,ZodBranded:Js,ZodPipeline:zn,ZodReadonly:Wr,custom:Gs,Schema:D,ZodSchema:D,late:yi,get ZodFirstPartyTypeKind(){return A},coerce:Gi,any:Ti,array:Ei,bigint:_i,boolean:ea,date:wi,discriminatedUnion:Ai,effect:ys,enum:Bi,function:Pi,instanceof:gi,intersection:Ri,lazy:Di,literal:Li,map:Ui,nan:vi,nativeEnum:Vi,never:Si,null:ki,nullable:Wi,number:Qs,object:Ii,oboolean:Hi,onumber:Ji,optional:qi,ostring:Fi,pipeline:Yi,preprocess:Ki,promise:zi,record:$i,set:Mi,strictObject:Ci,string:Xs,symbol:bi,transformer:ys,tuple:ji,undefined:xi,union:Zi,unknown:Oi,void:Ni,NEVER:Xi,ZodIssueCode:v,quotelessJson:ti,ZodError:Ce});const qn=y.tuple([y.number(),y.number()]),ta=y.object({width:y.number(),height:y.number()}),Qi=y.object({signedWidth:y.number(),signedHeight:y.number()}),eo=["width","height"];y.enum(eo);const to=["start","center","end"],ro=["signedWidth","signedHeight"];y.enum(ro);const Kr=y.object({x:y.number(),y:y.number()}),no=y.object({clientX:y.number(),clientY:y.number()}),so=["x","y"],ra=y.enum(so),na=["top","right","bottom","left"];y.enum(na);const ao=["left","right"],io=y.enum(ao),oo=["top","bottom"],co=y.enum(oo),sa=["center"];y.enum(sa);const uo=[...na,...sa],Yr=y.enum(uo);y.enum(to);const lo=["first","last"];y.enum(lo);const fo=y.object({lower:y.number(),upper:y.number()});y.union([fo,qn]);y.union([ra,Yr]);y.union([ra,Yr,y.instanceof(String)]);const _n=(r,e)=>{const t={lower:0,upper:0};return typeof r=="number"?e!=null?(t.lower=r,t.upper=e):(t.lower=0,t.upper=r):Array.isArray(r)?[t.lower,t.upper]=r:(t.lower=r.lower,t.upper=r.upper),ho(t)},ho=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ne=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},q={},an={};Object.defineProperty(an,"__esModule",{value:!0});function po(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w)/g,function(e,t,n){return n.toUpperCase()}):""}an.default=po;var on={};Object.defineProperty(on,"__esModule",{value:!0});function mo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"_").toLowerCase():""}on.default=mo;var cn={};Object.defineProperty(cn,"__esModule",{value:!0});function yo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"$").replace(/[^A-Za-z0-9]+/g,"$").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"$"+n}).toLowerCase().replace(/(\$)(\w?)/g,function(e,t,n){return n.toUpperCase()}):""}cn.default=yo;var Wn={};Object.defineProperty(Wn,"__esModule",{value:!0});function go(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,".").toLowerCase():""}Wn.default=go;var Kn={};Object.defineProperty(Kn,"__esModule",{value:!0});function vo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"/").toLowerCase():""}Kn.default=vo;var Yn={};Object.defineProperty(Yn,"__esModule",{value:!0});function _o(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase():""}Yn.default=_o;var Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});function wo(r){if(r===void 0&&(r=""),!r)return"";var e=String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(t,n,s){return n+"_"+s.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}Fn.default=wo;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});function bo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g," ").toLowerCase().replace(/( ?)(\w+)( ?)/g,function(e,t,n,s){return t+n.charAt(0).toUpperCase()+n.slice(1)+s}):""}Jn.default=bo;var un={};Object.defineProperty(un,"__esModule",{value:!0});function xo(r){return r===void 0&&(r=""),r?String(r).replace(/^[^A-Za-z0-9]*|[^A-Za-z0-9]*$/g,"").replace(/([a-z])([A-Z])/g,function(e,t,n){return t+"_"+n.toLowerCase()}).replace(/[^A-Za-z0-9]+|_+/g,"-").toLowerCase():""}un.default=xo;var Hn={},bt={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.belongToTypes=r.isValidObject=r.isArrayObject=r.validateOptions=r.DefaultOption=void 0,r.DefaultOption={recursive:!1,recursiveInArray:!1,keepTypesOnRecursion:[]},r.validateOptions=function(e){return e===void 0&&(e=r.DefaultOption),e.recursive==null?e=r.DefaultOption:e.recursiveInArray==null&&(e.recursiveInArray=!1),e},r.isArrayObject=function(e){return e!=null&&Array.isArray(e)},r.isValidObject=function(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)},r.belongToTypes=function(e,t){return(t||[]).some(function(n){return e instanceof n})}})(bt);var ko=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Hn,"__esModule",{value:!0});var Be=bt;function Or(r,e){if(e===void 0&&(e=Be.DefaultOption),!Be.isValidObject(r))return null;e=Be.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(Be.isValidObject(s)?Be.belongToTypes(s,e.keepTypesOnRecursion)||(s=Or(s,e)):e.recursiveInArray&&Be.isArrayObject(s)&&(s=ko(s).map(function(i){var o=i;if(Be.isValidObject(i))Be.belongToTypes(o,e.keepTypesOnRecursion)||(o=Or(i,e));else if(Be.isArrayObject(i)){var d=Or({key:i},e);o=d.key}return o}))),t[a]=s}),t}Hn.default=Or;var Gn={},To=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Gn,"__esModule",{value:!0});var Ve=bt;function Sr(r,e){if(e===void 0&&(e=Ve.DefaultOption),!Ve.isValidObject(r))return null;e=Ve.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(Ve.isValidObject(s)?Ve.belongToTypes(s,e.keepTypesOnRecursion)||(s=Sr(s,e)):e.recursiveInArray&&Ve.isArrayObject(s)&&(s=To(s).map(function(i){var o=i;if(Ve.isValidObject(i))Ve.belongToTypes(o,e.keepTypesOnRecursion)||(o=Sr(i,e));else if(Ve.isArrayObject(i)){var d=Sr({key:i},e);o=d.key}return o}))),t[a]=s}),t}Gn.default=Sr;var Xn={},Oo=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Xn,"__esModule",{value:!0});var ze=bt,So=an;function Nr(r,e){if(e===void 0&&(e=ze.DefaultOption),!ze.isValidObject(r))return null;e=ze.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=So.default(n);e.recursive&&(ze.isValidObject(s)?ze.belongToTypes(s,e.keepTypesOnRecursion)||(s=Nr(s,e)):e.recursiveInArray&&ze.isArrayObject(s)&&(s=Oo(s).map(function(i){var o=i;if(ze.isValidObject(i))ze.belongToTypes(o,e.keepTypesOnRecursion)||(o=Nr(i,e));else if(ze.isArrayObject(i)){var d=Nr({key:i},e);o=d.key}return o}))),t[a]=s}),t}Xn.default=Nr;var Qn={},No=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(Qn,"__esModule",{value:!0});var qe=bt,Eo=on;function Er(r,e){if(e===void 0&&(e=qe.DefaultOption),!qe.isValidObject(r))return null;e=qe.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Eo.default(n);e.recursive&&(qe.isValidObject(s)?qe.belongToTypes(s,e.keepTypesOnRecursion)||(s=Er(s,e)):e.recursiveInArray&&qe.isArrayObject(s)&&(s=No(s).map(function(i){var o=i;if(qe.isValidObject(i))qe.belongToTypes(o,e.keepTypesOnRecursion)||(o=Er(i,e));else if(qe.isArrayObject(i)){var d=Er({key:i},e);o=d.key}return o}))),t[a]=s}),t}Qn.default=Er;var es={},Io=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(es,"__esModule",{value:!0});var We=bt,Co=cn;function Ir(r,e){if(e===void 0&&(e=We.DefaultOption),!We.isValidObject(r))return null;e=We.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Co.default(n);e.recursive&&(We.isValidObject(s)?We.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ir(s,e)):e.recursiveInArray&&We.isArrayObject(s)&&(s=Io(s).map(function(i){var o=i;if(We.isValidObject(i))We.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ir(i,e));else if(We.isArrayObject(i)){var d=Ir({key:i},e);o=d.key}return o}))),t[a]=s}),t}es.default=Ir;var ts={},Zo=Ne&&Ne.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),s=0,e=0;e<t;e++)for(var a=arguments[e],i=0,o=a.length;i<o;i++,s++)n[s]=a[i];return n};Object.defineProperty(ts,"__esModule",{value:!0});var Ke=bt,Ao=un;function Cr(r,e){if(e===void 0&&(e=Ke.DefaultOption),!Ke.isValidObject(r))return null;e=Ke.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=Ao.default(n);e.recursive&&(Ke.isValidObject(s)?Ke.belongToTypes(s,e.keepTypesOnRecursion)||(s=Cr(s,e)):e.recursiveInArray&&Ke.isArrayObject(s)&&(s=Zo(s).map(function(i){var o=i;if(Ke.isValidObject(i))Ke.belongToTypes(o,e.keepTypesOnRecursion)||(o=Cr(i,e));else if(Ke.isArrayObject(i)){var d=Cr({key:i},e);o=d.key}return o}))),t[a]=s}),t}ts.default=Cr;Object.defineProperty(q,"__esModule",{value:!0});q.kebabKeys=q.pascalKeys=q.snakeKeys=q.camelKeys=q.upperKeys=q.lowerKeys=q.toLowerCase=q.toUpperCase=q.toKebabCase=q.toHeaderCase=q.toSentenceCase=q.toTextCase=q.toPathCase=q.toDotCase=q.toPascalCase=q.toSnakeCase=q.toCamelCase=void 0;var aa=an;q.toCamelCase=aa.default;var ia=on;q.toSnakeCase=ia.default;var oa=cn;q.toPascalCase=oa.default;var ca=Wn;q.toDotCase=ca.default;var ua=Kn;q.toPathCase=ua.default;var la=Yn;q.toTextCase=la.default;var da=Fn;q.toSentenceCase=da.default;var fa=Jn;q.toHeaderCase=fa.default;var ha=un;q.toKebabCase=ha.default;var pa=Hn;q.lowerKeys=pa.default;var ma=Gn;q.upperKeys=ma.default;var ya=Xn;q.camelKeys=ya.default;var ga=Qn;q.snakeKeys=ga.default;var va=es;q.pascalKeys=va.default;var _a=ts;q.kebabKeys=_a.default;var wa=function(r){return String(r||"").toLowerCase()};q.toLowerCase=wa;var ba=function(r){return String(r||"").toUpperCase()};q.toUpperCase=ba;var Ro={toCamelCase:aa.default,toSnakeCase:ia.default,toPascalCase:oa.default,toDotCase:ca.default,toPathCase:ua.default,toTextCase:la.default,toSentenceCase:da.default,toHeaderCase:fa.default,toKebabCase:ha.default,toUpperCase:ba,toLowerCase:wa,lowerKeys:pa.default,upperKeys:ma.default,camelKeys:ya.default,snakeKeys:ga.default,pascalKeys:va.default,kebabKeys:_a.default};q.default=Ro;var xa=q;const ka={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},jo=r=>xa.snakeKeys(r,ka),$o=r=>xa.camelKeys(r,ka);var Ct;(r=>{r.toSnake=jo,r.toCamel=$o,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Ct||(Ct={}));y.object({x:Yr,y:Yr});const Uo=y.object({x:io,y:co}),Mo={x:"left",y:"top"},Po=(r,e)=>r.x===e.x&&r.y===e.y,gs=y.union([y.number(),Kr,qn,ta,Qi,no]),Do=(r,e)=>typeof r=="number"?{x:r,y:e??r}:Array.isArray(r)?{x:r[0],y:r[1]}:"signedWidth"in r?{x:r.signedWidth,y:r.signedHeight}:"clientX"in r?{x:r.clientX,y:r.clientY}:"width"in r?{x:r.width,y:r.height}:{x:r.x,y:r.y},vs={x:0,y:0},gr=y.union([y.number(),y.string()]);y.object({top:gr,left:gr,width:gr,height:gr});y.object({left:y.number(),top:y.number(),right:y.number(),bottom:y.number()});y.object({one:Kr,two:Kr,root:Uo});const rs=(r,e,t=0,n=0,s)=>{const a={one:{...vs},two:{...vs},root:s??Mo};if(typeof r=="number"){if(typeof e!="number")throw new Error("Box constructor called with invalid arguments");return a.one={x:r,y:e},a.two={x:a.one.x+t,y:a.one.y+n},a}return"one"in r&&"two"in r&&"root"in r?{...r,root:s??r.root}:("getBoundingClientRect"in r&&(r=r.getBoundingClientRect()),"left"in r?(a.one={x:r.left,y:r.top},a.two={x:r.right,y:r.bottom},a):(a.one=r,e==null?a.two={x:a.one.x+t,y:a.one.y+n}:typeof e=="number"?a.two={x:a.one.x+e,y:a.one.y+t}:"width"in e?a.two={x:a.one.x+e.width,y:a.one.y+e.height}:"signedWidth"in e?a.two={x:a.one.x+e.signedWidth,y:a.one.y+e.signedHeight}:a.two=e,a))},wn=r=>{const e=rs(r);return{lower:e.one.x,upper:e.two.x}},bn=r=>{const e=rs(r);return{lower:e.one.y,upper:e.two.y}},Lo=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Bo=y.object({signedWidth:y.number(),signedHeight:y.number()});y.union([ta,Bo,Kr,qn]);const Vo=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);y.object({offset:gs,scale:gs});const zo=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],qo=r=>(e,t,n,s)=>[e,s?n/r:n*r],Wo=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,d=a-s,u=o-i;if(t==="dimension")return[r,n*(u/d)];const p=(n-s)*(u/d)+i;return[r,p]},Ko=r=>(e,t,n)=>[r,n],Yo=()=>(r,e,t)=>{if(r===null)throw new Error("cannot invert without bounds");if(e==="dimension")return[r,t];const{lower:n,upper:s}=r;return[r,s-(t-n)]},Fo=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Vo(n,s,a),[e,n]},Rn=class $t{constructor(){b(this,"ops",[]),b(this,"currBounds",null),b(this,"currType",null),b(this,"reversed",!1),this.ops=[]}static translate(e){return new $t().translate(e)}static magnify(e){return new $t().magnify(e)}static scale(e,t){return new $t().scale(e,t)}translate(e){const t=this.new(),n=zo(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=qo(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=_n(e,t),s=this.new(),a=Wo(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=_n(e,t),s=this.new(),a=Fo(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=_n(e,t),s=this.new(),a=Ko(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Yo();e.type="invert";const t=this.new();return t.ops.push(e),t}pos(e){return this.exec("position",e)}dim(e){return this.exec("dimension",e)}new(){const e=new $t;return e.ops=this.ops.slice(),e.reversed=this.reversed,e}exec(e,t){return this.currBounds=null,this.ops.reduce(([n,s],a)=>a(n,e,s,this.reversed),[null,t])[1]}reverse(){const e=this.new();e.ops.reverse();const t=[];return e.ops.forEach((n,s)=>{if(n.type==="scale"||t.some(([i,o])=>s>=i&&s<=o))return;const a=e.ops.findIndex((i,o)=>i.type==="scale"&&o>s);a!==-1&&t.push([s,a])}),t.forEach(([n,s])=>{const a=e.ops.slice(n,s);a.unshift(e.ops[s]),e.ops.splice(n,s-n+1,...a)}),e.reversed=!e.reversed,e}};b(Rn,"IDENTITY",new Rn);let _s=Rn;const ws=class Ye{constructor(e=new _s,t=new _s,n=null){b(this,"x"),b(this,"y"),b(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Ye().translate(e,t)}static translateX(e){return new Ye().translateX(e)}static translateY(e){return new Ye().translateY(e)}static clamp(e){return new Ye().clamp(e)}static magnify(e){return new Ye().magnify(e)}static scale(e){return new Ye().scale(e)}static reBound(e){return new Ye().reBound(e)}translate(e,t){const n=Do(e,t),s=this.copy();return s.x=this.x.translate(n.x),s.y=this.y.translate(n.y),s}translateX(e){const t=this.copy();return t.x=this.x.translate(e),t}translateY(e){const t=this.copy();return t.y=this.y.translate(e),t}magnify(e){const t=this.copy();return t.x=this.x.magnify(e.x),t.y=this.y.magnify(e.y),t}scale(e){const t=this.copy();if(Lo(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!Po(n,e.root)&&(n.x!==e.root.x&&(t.x=t.x.invert()),n.y!==e.root.y&&(t.y=t.y.invert())),t.x=t.x.scale(wn(e)),t.y=t.y.scale(bn(e)),t}return t.x=t.x.scale(e.width),t.y=t.y.scale(e.height),t}reBound(e){const t=this.copy();return t.x=this.x.reBound(wn(e)),t.y=this.y.reBound(bn(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(wn(e)),t.y=this.y.clamp(bn(e)),t}copy(){const e=new Ye;return e.currRoot=this.currRoot,e.x=this.x,e.y=this.y,e}reverse(){const e=this.copy();return e.x=this.x.reverse(),e.y=this.y.reverse(),e}pos(e){return{x:this.x.pos(e.x),y:this.y.pos(e.y)}}box(e){return rs(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};b(ws,"IDENTITY",new ws);const Ta=(r,e)=>{const t=new ke(e);if(![ve.DAY,ve.HOUR,ve.MINUTE,ve.SECOND,ve.MILLISECOND,ve.MICROSECOND,ve.NANOSECOND].some(s=>s.equals(t)))throw new Error("Invalid argument for remainder. Must be an even TimeSpan or Timestamp");const n=r.valueOf()%t.valueOf();return r instanceof ke?new ke(n):new ve(n)},ee=class z extends Number{constructor(e,t="UTC"){if(e==null)return z.now();if(e instanceof Date)super(e.getTime()*z.MILLISECOND.valueOf());else if(typeof e=="string")super(z.parseDateTimeString(e,t).valueOf());else if(Array.isArray(e))super(z.parseDate(e));else{let n=0;e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=z.utcOffset.valueOf()),super(e.valueOf()+n)}}static parseDate([e=1970,t=1,n=1]){const s=new Date(e,t-1,n,0,0,0,0);return new z(s.getTime()*z.MILLISECOND.valueOf()).truncate(z.DAY).valueOf()}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let i="00",o="00";a!=null&&([i,o]=a.split("."));let d=z.hours(parseInt(n??"00",10)).add(z.minutes(parseInt(s??"00",10))).add(z.seconds(parseInt(i??"00",10))).add(z.milliseconds(parseInt(o??"00",10)));return t==="local"&&(d=d.add(z.utcOffset)),d.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return z.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new z(n.getTime()*z.MILLISECOND.valueOf(),t).valueOf()}fString(e="ISO",t="UTC"){switch(e){case"ISODate":return this.toISOString(t).slice(0,10);case"ISOTime":return this.toISOString(t).slice(11,23);case"time":return this.timeString(!1,t);case"preciseTime":return this.timeString(!0,t);case"date":return this.dateString(t);case"preciseDate":return`${this.dateString(t)} ${this.timeString(!0,t)}`;case"dateTime":return`${this.dateString(t)} ${this.timeString(!1,t)}`;default:return this.toISOString(t)}}toISOString(e="UTC"){return e==="UTC"?this.date().toISOString():this.sub(z.utcOffset).date().toISOString()}timeString(e=!1,t="UTC"){const n=this.toISOString(t);return e?n.slice(11,23):n.slice(11,19)}dateString(e="UTC"){const t=this.date(),n=t.toLocaleString("default",{month:"short"}),s=t.toLocaleString("default",{day:"numeric"});return`${n} ${s}`}static get utcOffset(){return new ve(new Date().getTimezoneOffset()*z.MINUTE.valueOf())}static since(e){return new z().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new z(e).valueOf()}span(e){return this.range(e).span}range(e){return new Jo(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===0}after(e){return this.valueOf()>new z(e).valueOf()}afterEq(e){return this.valueOf()>=new z(e).valueOf()}before(e){return this.valueOf()<new z(e).valueOf()}beforeEq(e){return this.valueOf()<=new z(e).valueOf()}add(e){return new z(this.valueOf()+e.valueOf())}sub(e){return new z(this.valueOf()-e.valueOf())}milliseconds(){return this.valueOf()/z.MILLISECOND.valueOf()}toString(){return this.date().toISOString()}remainder(e){return Ta(this,e)}get isToday(){return this.truncate(ve.DAY).equals(z.now().truncate(ve.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new z(new Date)}static nanoseconds(e){return new z(e)}static microseconds(e){return z.nanoseconds(e*1e3)}static milliseconds(e){return z.microseconds(e*1e3)}static seconds(e){return z.milliseconds(e*1e3)}static minutes(e){return z.seconds(e*60)}static hours(e){return z.minutes(e*60)}static days(e){return z.hours(e*24)}};b(ee,"NANOSECOND",ee.nanoseconds(1));b(ee,"MICROSECOND",ee.microseconds(1));b(ee,"MILLISECOND",ee.milliseconds(1));b(ee,"SECOND",ee.seconds(1));b(ee,"MINUTE",ee.minutes(1));b(ee,"HOUR",ee.hours(1));b(ee,"DAY",ee.days(1));b(ee,"MAX",new ee(9122272036554776e3));b(ee,"MIN",new ee(0));b(ee,"ZERO",new ee(0));b(ee,"z",y.union([y.instanceof(Number).transform(r=>new ee(r)),y.number().transform(r=>new ee(r)),y.instanceof(ee)]));let ke=ee;const Q=class H extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}remainder(e){return Ta(this,e)}truncate(e){return new H(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}multiply(e){return new H(this.valueOf()*e)}toString(){const e=this.truncate(H.DAY),t=this.truncate(H.HOUR),n=this.truncate(H.MINUTE),s=this.truncate(H.SECOND),a=this.truncate(H.MILLISECOND),i=this.truncate(H.MICROSECOND),o=this.truncate(H.NANOSECOND),d=e,u=t.sub(e),p=n.sub(t),I=s.sub(n),ue=a.sub(s),J=i.sub(a),he=o.sub(i);let se="";return d.isZero||(se+=`${d.days}d `),u.isZero||(se+=`${u.hours}h `),p.isZero||(se+=`${p.minutes}m `),I.isZero||(se+=`${I.seconds}s `),ue.isZero||(se+=`${ue.milliseconds}ms `),J.isZero||(se+=`${J.microseconds}µs `),he.isZero||(se+=`${he.nanoseconds}ns`),se.trim()}get days(){return this.valueOf()/H.DAY.valueOf()}get hours(){return this.valueOf()/H.HOUR.valueOf()}get minutes(){return this.valueOf()/H.MINUTE.valueOf()}get seconds(){return this.valueOf()/H.SECOND.valueOf()}get milliseconds(){return this.valueOf()/H.MILLISECOND.valueOf()}get microseconds(){return this.valueOf()/H.MICROSECOND.valueOf()}get nanoseconds(){return this.valueOf()}get isZero(){return this.valueOf()===0}equals(e){return this.valueOf()===new H(e).valueOf()}add(e){return new H(this.valueOf()+new H(e).valueOf())}sub(e){return new H(this.valueOf()-new H(e).valueOf())}static nanoseconds(e=1){return new H(e)}static microseconds(e=1){return H.nanoseconds(e*1e3)}static milliseconds(e=1){return H.microseconds(e*1e3)}static seconds(e=1){return H.milliseconds(e*1e3)}static minutes(e){return H.seconds(e.valueOf()*60)}static hours(e){return H.minutes(e*60)}static days(e){return H.hours(e*24)}};b(Q,"NANOSECOND",Q.nanoseconds(1));b(Q,"MICROSECOND",Q.microseconds(1));b(Q,"MILLISECOND",Q.milliseconds(1));b(Q,"SECOND",Q.seconds(1));b(Q,"MINUTE",Q.minutes(1));b(Q,"HOUR",Q.hours(1));b(Q,"DAY",Q.days(1));b(Q,"MAX",new Q(Q.MAX_SAFE_INTEGER));b(Q,"MIN",new Q(-Q.MAX_SAFE_INTEGER));b(Q,"ZERO",new Q(0));b(Q,"z",y.union([y.instanceof(Number).transform(r=>new Q(r)),y.number().transform(r=>new Q(r)),y.instanceof(Q)]));let ve=Q;const vr=class Zr extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Zr(e).valueOf()}get period(){return ve.seconds(1/this.valueOf())}sampleCount(e){return new ve(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new ge(t).valueOf()}span(e){return ve.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Zr(e)}static khz(e){return Zr.hz(e*1e3)}};b(vr,"z",y.union([y.number().transform(r=>new vr(r)),y.instanceof(Number).transform(r=>new vr(r)),y.instanceof(vr)]));const fe=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Ho(e*this.valueOf())}};b(fe,"UNKNOWN",new fe(0));b(fe,"BIT128",new fe(16));b(fe,"BIT64",new fe(8));b(fe,"BIT32",new fe(4));b(fe,"BIT16",new fe(2));b(fe,"BIT8",new fe(1));b(fe,"z",y.union([y.number().transform(r=>new fe(r)),y.instanceof(Number).transform(r=>new fe(r)),y.instanceof(fe)]));let ge=fe;const Ue=class Ar{constructor(e,t){b(this,"start"),b(this,"end"),this.start=new ke(e),this.end=new ke(t)}get span(){return new ve(this.end.valueOf()-this.start.valueOf())}get isValid(){return this.start.valueOf()<=this.end.valueOf()}makeValid(){return this.isValid?this:this.swap()}get isZero(){return this.span.isZero}swap(){return new Ar(this.end,this.start)}equals(e){return this.start.equals(e.start)&&this.end.equals(e.end)}toString(){return`${this.start.toString()} - ${this.end.toString()}`}toPrettyString(){return`${this.start.fString("preciseDate")} - ${this.span.toString()}`}overlapsWith(e){e=e.makeValid();const t=this.makeValid();return e.start.equals(t.start)?!0:e.end.equals(this.start)||e.start.equals(this.end)?!1:this.contains(e.end)||this.contains(e.start)||e.contains(this.start)||e.contains(this.end)}contains(e){return e instanceof Ar?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Ar(this.start,this.end);return e.start.after(this.start)&&(t.start=e.start),e.start.after(this.end)&&(t.end=e.start),e.end.before(this.end)&&(t.end=e.end),e.end.before(this.start)&&(t.start=e.end),t}};b(Ue,"MAX",new Ue(ke.MIN,ke.MAX));b(Ue,"MIN",new Ue(ke.MAX,ke.MIN));b(Ue,"ZERO",new Ue(ke.ZERO,ke.ZERO));b(Ue,"z",y.union([y.object({start:ke.z,end:ke.z}).transform(r=>new Ue(r.start,r.end)),y.instanceof(Ue)]));let Jo=Ue;const m=class ht extends String{constructor(e){if(e instanceof ht||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=ht.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(ht.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=ht.ARRAY_CONSTRUCTORS.get(this.toString());if(e==null)throw new Error(`unable to find array constructor for ${this.valueOf()}`);return e}equals(e){return this.valueOf()===e.valueOf()}toString(){return this.valueOf()}get density(){const e=ht.DENSITIES.get(this.toString());if(e==null)throw new Error(`unable to find density for ${this.valueOf()}`);return e}checkArray(e){return e.constructor===this.Array}toJSON(){return this.toString()}get usesBigInt(){return ht.BIG_INT_TYPES.some(e=>e.equals(this))}};b(m,"UNKNOWN",new m("unknown"));b(m,"FLOAT64",new m("float64"));b(m,"FLOAT32",new m("float32"));b(m,"INT64",new m("int64"));b(m,"INT32",new m("int32"));b(m,"INT16",new m("int16"));b(m,"INT8",new m("int8"));b(m,"UINT64",new m("uint64"));b(m,"UINT32",new m("uint32"));b(m,"UINT16",new m("uint16"));b(m,"UINT8",new m("uint8"));b(m,"TIMESTAMP",new m("timestamp"));b(m,"UUID",new m("uuid"));b(m,"STRING",new m("string"));b(m,"JSON",new m("json"));b(m,"ARRAY_CONSTRUCTORS",new Map([[m.UINT8.toString(),Uint8Array],[m.UINT16.toString(),Uint16Array],[m.UINT32.toString(),Uint32Array],[m.UINT64.toString(),BigUint64Array],[m.FLOAT32.toString(),Float32Array],[m.FLOAT64.toString(),Float64Array],[m.INT8.toString(),Int8Array],[m.INT16.toString(),Int16Array],[m.INT32.toString(),Int32Array],[m.INT64.toString(),BigInt64Array],[m.TIMESTAMP.toString(),BigInt64Array],[m.STRING.toString(),Uint8Array],[m.JSON.toString(),Uint8Array],[m.UUID.toString(),Uint8Array]]));b(m,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,m.UINT8],[Uint16Array.name,m.UINT16],[Uint32Array.name,m.UINT32],[BigUint64Array.name,m.UINT64],[Float32Array.name,m.FLOAT32],[Float64Array.name,m.FLOAT64],[Int8Array.name,m.INT8],[Int16Array.name,m.INT16],[Int32Array.name,m.INT32],[BigInt64Array.name,m.INT64]]));b(m,"DENSITIES",new Map([[m.UINT8.toString(),ge.BIT8],[m.UINT16.toString(),ge.BIT16],[m.UINT32.toString(),ge.BIT32],[m.UINT64.toString(),ge.BIT64],[m.FLOAT32.toString(),ge.BIT32],[m.FLOAT64.toString(),ge.BIT64],[m.INT8.toString(),ge.BIT8],[m.INT16.toString(),ge.BIT16],[m.INT32.toString(),ge.BIT32],[m.INT64.toString(),ge.BIT64],[m.TIMESTAMP.toString(),ge.BIT64],[m.STRING.toString(),ge.UNKNOWN],[m.JSON.toString(),ge.UNKNOWN],[m.UUID.toString(),ge.BIT128]]));b(m,"ALL",[m.UNKNOWN,m.FLOAT64,m.FLOAT32,m.INT64,m.INT32,m.INT16,m.INT8,m.UINT64,m.UINT32,m.UINT16,m.UINT8,m.TIMESTAMP,m.UUID,m.STRING,m.JSON]);b(m,"BIG_INT_TYPES",[m.INT64,m.UINT64,m.TIMESTAMP]);b(m,"z",y.union([y.string().transform(r=>new m(r)),y.instanceof(m)]));const pe=class rt extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return rt.bytes(this.valueOf()+e.valueOf())}sub(e){return rt.bytes(this.valueOf()-e.valueOf())}static bytes(e=1){return new rt(e)}static kilobytes(e=1){return rt.bytes(e.valueOf()*1e3)}static megabytes(e=1){return rt.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return rt.megabytes(e.valueOf()*1e3)}static terabytes(e){return rt.gigabytes(e.valueOf()*1e3)}isZero(){return this.valueOf()===0}};b(pe,"BYTE",new pe(1));b(pe,"KILOBYTE",pe.kilobytes(1));b(pe,"MEGABYTE",pe.megabytes(1));b(pe,"GIGABYTE",pe.gigabytes(1));b(pe,"TERABYTE",pe.terabytes(1));b(pe,"ZERO",new pe(0));b(pe,"z",y.union([y.number().transform(r=>new pe(r)),y.instanceof(pe)]));let Ho=pe;y.union([y.instanceof(Uint8Array),y.instanceof(Uint16Array),y.instanceof(Uint32Array),y.instanceof(BigUint64Array),y.instanceof(Float32Array),y.instanceof(Float64Array),y.instanceof(Int8Array),y.instanceof(Int16Array),y.instanceof(Int32Array),y.instanceof(BigInt64Array)]);y.record(y.union([y.number(),y.string(),y.symbol()]),y.unknown());const Oa=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Go=Oa(),Sa=["MacOS","Windows","Linux","Docker"],Xo=y.enum(Sa);let _r;const Qo=()=>{if(typeof window>"u")return;const r=window.navigator.userAgent.toLowerCase();if(r.includes("mac"))return"MacOS";if(r.includes("win"))return"Windows";if(r.includes("linux"))return"Linux"},ec=(r={})=>{const{force:e,default:t}=r;return e??_r??(_r=Qo(),_r??t)},Na=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:Sa,RUNTIME:Go,detect:Oa,getOS:ec,osZ:Xo},Symbol.toStringTag,{value:"Module"})),tc=(...r)=>r.map(Ea).join(""),Ea=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),rc=r=>r.endsWith("/")?r.slice(0,-1):r,nc=(r,e="")=>r===null?"":"?"+Object.entries(r).filter(([,t])=>t==null?!1:Array.isArray(t)?t.length>0:!0).map(([t,n])=>`${e}${t}=${n}`).join("&");let sc=(xt=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){b(this,"protocol"),b(this,"host"),b(this,"port"),b(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=Ea(n)}replace(r){return new xt({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new xt({...this,pathPrefix:tc(this.path,r)})}toString(){return rc(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},b(xt,"UNKNOWN",new xt({host:"unknown",port:0})),xt);var jn;try{jn=new TextDecoder}catch{}var x,Oe,c=0,te={},K,at,Te=0,$e=0,de,He,we=[],W,bs={useRecords:!1,mapsAsObjects:!0};class Ia{}const Ca=new Ia;Ca.name="MessagePack 0xC1";var it=!1,Za=2,xs;try{new Function("")}catch{Za=1/0}class Ht{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.sequential&&e.trusted!==!1&&(e.trusted=!0,!e.structures&&e.useRecords!=!1&&(e.structures=[],e.maxSharedStructures||(e.maxSharedStructures=0))),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0),e.int64AsNumber&&(e.int64AsType="number")),Object.assign(this,e)}unpack(e,t){if(x)return Ua(()=>(Un(),this?this.unpack(e,t):Ht.prototype.unpack.call(bs,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Oe=t.end||e.length,c=t.start||0):(c=0,Oe=t>-1?t:e.length),$e=0,at=null,de=null,x=e;try{W=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(n){throw x=null,e instanceof Uint8Array?n:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Ht){if(te=this,this.structures)return K=this.structures,wr(t);(!K||K.length>0)&&(K=[])}else te=bs,(!K||K.length>0)&&(K=[]);return wr(t)}unpackMultiple(e,t){let n,s=0;try{it=!0;let a=e.length,i=this?this.unpack(e,a):ln.unpack(e,a);if(t){if(t(i,s,c)===!1)return;for(;c<a;)if(s=c,t(wr(),s,c)===!1)return}else{for(n=[i];c<a;)s=c,n.push(wr());return n}}catch(a){throw a.lastPosition=s,a.values=n,a}finally{it=!1,Un()}}_mergeStructures(e,t){e=e||[],Object.isFrozen(e)&&(e=e.map(n=>n.slice(0)));for(let n=0,s=e.length;n<s;n++){let a=e[n];a&&(a.isShared=!0,n>=32&&(a.highByte=n-32>>5))}e.sharedLength=e.length;for(let n in t||[])if(n>=0){let s=e[n],a=t[n];a&&(s&&((e.restoreStructures||(e.restoreStructures=[]))[n]=s),e[n]=a)}return this.structures=e}decode(e,t){return this.unpack(e,t)}}function wr(r){try{if(!te.trusted&&!it){let t=K.sharedLength||0;t<K.length&&(K.length=t)}let e;if(te.randomAccessStructure&&x[c]<64&&x[c]>=32&&xs?(e=xs(x,c,Oe,te),x=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),c=Oe):e=oe(),de&&(c=de.postBundlePosition,de=null),it&&(K.restoreStructures=null),c==Oe)K&&K.restoreStructures&&ks(),K=null,x=null,He&&(He=null);else{if(c>Oe)throw new Error("Unexpected end of MessagePack data");if(!it){let t;try{t=JSON.stringify(e,(n,s)=>typeof s=="bigint"?`${s}n`:s).slice(0,100)}catch(n){t="(JSON view not available "+n+")"}throw new Error("Data read, but end of buffer not reached "+t)}}return e}catch(e){throw K&&K.restoreStructures&&ks(),Un(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||c>Oe)&&(e.incomplete=!0),e}}function ks(){for(let r in K.restoreStructures)K[r]=K.restoreStructures[r];K.restoreStructures=null}function oe(){let r=x[c++];if(r<160)if(r<128){if(r<64)return r;{let e=K[r&63]||te.getStructures&&Aa()[r&63];return e?(e.read||(e.read=ns(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,te.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=ja();n==="__proto__"&&(n="__proto_"),e[n]=oe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(oe(),oe());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=oe();return te.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if($e>=c)return at.slice(c-Te,(c+=e)-Te);if($e==0&&Oe<140){let t=e<16?ss(e):Ra(e);if(t!=null)return t}return $n(e)}else{let e;switch(r){case 192:return null;case 193:return de?(e=oe(),e>0?de[1].slice(de.position1,de.position1+=e):de[0].slice(de.position0,de.position0-=e)):Ca;case 194:return!1;case 195:return!0;case 196:if(e=x[c++],e===void 0)throw new Error("Unexpected end of buffer");return xn(e);case 197:return e=W.getUint16(c),c+=2,xn(e);case 198:return e=W.getUint32(c),c+=4,xn(e);case 199:return ft(x[c++]);case 200:return e=W.getUint16(c),c+=2,ft(e);case 201:return e=W.getUint32(c),c+=4,ft(e);case 202:if(e=W.getFloat32(c),te.useFloat32>2){let t=as[(x[c]&127)<<1|x[c+1]>>7];return c+=4,(t*e+(e>0?.5:-.5)>>0)/t}return c+=4,e;case 203:return e=W.getFloat64(c),c+=8,e;case 204:return x[c++];case 205:return e=W.getUint16(c),c+=2,e;case 206:return e=W.getUint32(c),c+=4,e;case 207:return te.int64AsType==="number"?(e=W.getUint32(c)*4294967296,e+=W.getUint32(c+4)):te.int64AsType==="string"?e=W.getBigUint64(c).toString():te.int64AsType==="auto"?(e=W.getBigUint64(c),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=W.getBigUint64(c),c+=8,e;case 208:return W.getInt8(c++);case 209:return e=W.getInt16(c),c+=2,e;case 210:return e=W.getInt32(c),c+=4,e;case 211:return te.int64AsType==="number"?(e=W.getInt32(c)*4294967296,e+=W.getUint32(c+4)):te.int64AsType==="string"?e=W.getBigInt64(c).toString():te.int64AsType==="auto"?(e=W.getBigInt64(c),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=W.getBigInt64(c),c+=8,e;case 212:if(e=x[c++],e==114)return Is(x[c++]&63);{let t=we[e];if(t)return t.read?(c++,t.read(oe())):t.noBuffer?(c++,t()):t(x.subarray(c,++c));throw new Error("Unknown extension "+e)}case 213:return e=x[c],e==114?(c++,Is(x[c++]&63,x[c++])):ft(2);case 214:return ft(4);case 215:return ft(8);case 216:return ft(16);case 217:return e=x[c++],$e>=c?at.slice(c-Te,(c+=e)-Te):ic(e);case 218:return e=W.getUint16(c),c+=2,$e>=c?at.slice(c-Te,(c+=e)-Te):oc(e);case 219:return e=W.getUint32(c),c+=4,$e>=c?at.slice(c-Te,(c+=e)-Te):cc(e);case 220:return e=W.getUint16(c),c+=2,Os(e);case 221:return e=W.getUint32(c),c+=4,Os(e);case 222:return e=W.getUint16(c),c+=2,Ss(e);case 223:return e=W.getUint32(c),c+=4,Ss(e);default:if(r>=224)return r-256;if(r===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+r)}}}const ac=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function ns(r,e){function t(){if(t.count++>Za){let s=r.read=new Function("r","return function(){return "+(te.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":ac.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(oe);return r.highByte===0&&(r.read=Ts(e,r.read)),s()}let n={};for(let s=0,a=r.length;s<a;s++){let i=r[s];i==="__proto__"&&(i="__proto_"),n[i]=oe()}return te.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?Ts(e,t):t}const Ts=(r,e)=>function(){let t=x[c++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=K[n]||Aa()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=ns(s,r)),s.read()};function Aa(){let r=Ua(()=>(x=null,te.getStructures()));return K=te._mergeStructures(r,K)}var $n=fr,ic=fr,oc=fr,cc=fr;function fr(r){let e;if(r<16&&(e=ss(r)))return e;if(r>64&&jn)return jn.decode(x.subarray(c,c+=r));const t=c+r,n=[];for(e="";c<t;){const s=x[c++];if(!(s&128))n.push(s);else if((s&224)===192){const a=x[c++]&63;n.push((s&31)<<6|a)}else if((s&240)===224){const a=x[c++]&63,i=x[c++]&63;n.push((s&31)<<12|a<<6|i)}else if((s&248)===240){const a=x[c++]&63,i=x[c++]&63,o=x[c++]&63;let d=(s&7)<<18|a<<12|i<<6|o;d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|d&1023),n.push(d)}else n.push(s);n.length>=4096&&(e+=le.apply(String,n),n.length=0)}return n.length>0&&(e+=le.apply(String,n)),e}function Os(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=oe();return te.freezeData?Object.freeze(e):e}function Ss(r){if(te.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=ja();n==="__proto__"&&(n="__proto_"),e[n]=oe()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(oe(),oe());return e}}var le=String.fromCharCode;function Ra(r){let e=c,t=new Array(r);for(let n=0;n<r;n++){const s=x[c++];if((s&128)>0){c=e;return}t[n]=s}return le.apply(String,t)}function ss(r){if(r<4)if(r<2){if(r===0)return"";{let e=x[c++];if((e&128)>1){c-=1;return}return le(e)}}else{let e=x[c++],t=x[c++];if((e&128)>0||(t&128)>0){c-=2;return}if(r<3)return le(e,t);let n=x[c++];if((n&128)>0){c-=3;return}return le(e,t,n)}else{let e=x[c++],t=x[c++],n=x[c++],s=x[c++];if((e&128)>0||(t&128)>0||(n&128)>0||(s&128)>0){c-=4;return}if(r<6){if(r===4)return le(e,t,n,s);{let a=x[c++];if((a&128)>0){c-=5;return}return le(e,t,n,s,a)}}else if(r<8){let a=x[c++],i=x[c++];if((a&128)>0||(i&128)>0){c-=6;return}if(r<7)return le(e,t,n,s,a,i);let o=x[c++];if((o&128)>0){c-=7;return}return le(e,t,n,s,a,i,o)}else{let a=x[c++],i=x[c++],o=x[c++],d=x[c++];if((a&128)>0||(i&128)>0||(o&128)>0||(d&128)>0){c-=8;return}if(r<10){if(r===8)return le(e,t,n,s,a,i,o,d);{let u=x[c++];if((u&128)>0){c-=9;return}return le(e,t,n,s,a,i,o,d,u)}}else if(r<12){let u=x[c++],p=x[c++];if((u&128)>0||(p&128)>0){c-=10;return}if(r<11)return le(e,t,n,s,a,i,o,d,u,p);let I=x[c++];if((I&128)>0){c-=11;return}return le(e,t,n,s,a,i,o,d,u,p,I)}else{let u=x[c++],p=x[c++],I=x[c++],ue=x[c++];if((u&128)>0||(p&128)>0||(I&128)>0||(ue&128)>0){c-=12;return}if(r<14){if(r===12)return le(e,t,n,s,a,i,o,d,u,p,I,ue);{let J=x[c++];if((J&128)>0){c-=13;return}return le(e,t,n,s,a,i,o,d,u,p,I,ue,J)}}else{let J=x[c++],he=x[c++];if((J&128)>0||(he&128)>0){c-=14;return}if(r<15)return le(e,t,n,s,a,i,o,d,u,p,I,ue,J,he);let se=x[c++];if((se&128)>0){c-=15;return}return le(e,t,n,s,a,i,o,d,u,p,I,ue,J,he,se)}}}}}function Ns(){let r=x[c++],e;if(r<192)e=r-160;else switch(r){case 217:e=x[c++];break;case 218:e=W.getUint16(c),c+=2;break;case 219:e=W.getUint32(c),c+=4;break;default:throw new Error("Expected string")}return fr(e)}function xn(r){return te.copyBuffers?Uint8Array.prototype.slice.call(x,c,c+=r):x.subarray(c,c+=r)}function ft(r){let e=x[c++];if(we[e]){let t;return we[e](x.subarray(c,t=c+=r),n=>{c=n;try{return oe()}finally{c=t}})}else throw new Error("Unknown extension type "+e)}var Es=new Array(4096);function ja(){let r=x[c++];if(r>=160&&r<192){if(r=r-160,$e>=c)return at.slice(c-Te,(c+=r)-Te);if(!($e==0&&Oe<180))return $n(r)}else return c--,oe().toString();let e=(r<<5^(r>1?W.getUint16(c):r>0?x[c]:0))&4095,t=Es[e],n=c,s=c+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=W.getUint32(n),a!=t[i++]){n=1879048192;break}n+=4}for(s+=3;n<s;)if(a=x[n++],a!=t[i++]){n=1879048192;break}if(n===s)return c=n,t.string;s-=3,n=c}for(t=[],Es[e]=t,t.bytes=r;n<s;)a=W.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=x[n++],t.push(a);let o=r<16?ss(r):Ra(r);return o!=null?t.string=o:t.string=$n(r)}const Is=(r,e)=>{let t=oe().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=K[r];return s&&(s.isShared||it)&&((K.restoreStructures||(K.restoreStructures=[]))[r]=s),K[r]=t,t.read=ns(t,n),t.read()};we[0]=()=>{};we[0].noBuffer=!0;let uc={Error,TypeError,ReferenceError};we[101]=()=>{let r=oe();return(uc[r[0]]||Error)(r[1])};we[105]=r=>{let e=W.getUint32(c-4);He||(He=new Map);let t=x[c],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};He.set(e,s);let a=oe();return s.used?Object.assign(n,a):(s.target=a,a)};we[112]=r=>{let e=W.getUint32(c-4),t=He.get(e);return t.used=!0,t.target};we[115]=()=>new Set(oe());const $a=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let lc=typeof globalThis=="object"?globalThis:window;we[116]=r=>{let e=r[0],t=$a[e];if(!t)throw new Error("Could not find typed array for code "+e);return new lc[t](Uint8Array.prototype.slice.call(r,1).buffer)};we[120]=()=>{let r=oe();return new RegExp(r[0],r[1])};const dc=[];we[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=c;return c+=e-r.length,de=dc,de=[Ns(),Ns()],de.position0=0,de.position1=0,de.postBundlePosition=c,c=t,oe()};we[255]=r=>r.length==4?new Date((r[0]*16777216+(r[1]<<16)+(r[2]<<8)+r[3])*1e3):r.length==8?new Date(((r[0]<<22)+(r[1]<<14)+(r[2]<<6)+(r[3]>>2))/1e6+((r[3]&3)*4294967296+r[4]*16777216+(r[5]<<16)+(r[6]<<8)+r[7])*1e3):r.length==12?new Date(((r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3])/1e6+((r[4]&128?-281474976710656:0)+r[6]*1099511627776+r[7]*4294967296+r[8]*16777216+(r[9]<<16)+(r[10]<<8)+r[11])*1e3):new Date("invalid");function Ua(r){let e=Oe,t=c,n=Te,s=$e,a=at,i=He,o=de,d=new Uint8Array(x.slice(0,Oe)),u=K,p=K.slice(0,K.length),I=te,ue=it,J=r();return Oe=e,c=t,Te=n,$e=s,at=a,He=i,de=o,x=d,it=ue,K=u,K.splice(0,K.length,...p),te=I,W=new DataView(x.buffer,x.byteOffset,x.byteLength),J}function Un(){x=null,He=null,K=null}function fc(r){r.unpack?we[r.type]=r.unpack:we[r.type]=r}const as=new Array(147);for(let r=0;r<256;r++)as[r]=+("1e"+Math.floor(45.15-r*.30103));var ln=new Ht({useRecords:!1});const hc=ln.unpack;ln.unpackMultiple;ln.unpack;let pc=new Float32Array(1);new Uint8Array(pc.buffer,0,4);let Rr;try{Rr=new TextEncoder}catch{}let Fr,is;const dn=typeof Buffer<"u",br=dn?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,Ma=dn?Buffer:Uint8Array,Cs=dn?4294967296:2144337920;let f,Rt,X,l=0,ye,re=null,mc;const yc=21760,gc=/[\u0080-\uFFFF]/,kt=Symbol("record-id");class vc extends Ht{constructor(e){super(e),this.offset=0;let t,n,s,a,i=Ma.prototype.utf8Write?function(h,E){return f.utf8Write(h,E,4294967295)}:Rr&&Rr.encodeInto?function(h,E){return Rr.encodeInto(h,f.subarray(E)).written}:!1,o=this;e||(e={});let d=e&&e.sequential,u=e.structures||e.saveStructures,p=e.maxSharedStructures;if(p==null&&(p=u?32:0),p>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let I=e.maxOwnStructures;I==null&&(I=u?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let ue=p>32||I+p>64,J=p+64,he=p+I+64;if(he>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let se=[],mn=0,mr=0;this.pack=this.encode=function(h,E){if(f||(f=new br(8192),X=f.dataView||(f.dataView=new DataView(f.buffer,0,8192)),l=0),ye=f.length-10,ye-l<2048?(f=new br(f.length),X=f.dataView||(f.dataView=new DataView(f.buffer,0,f.length)),ye=f.length-10,l=0):l=l+7&2147483640,t=l,E&Sc&&(l+=E&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof h!="string"?(re=[],re.size=1/0):re=null,s=o.structures,s){s.uninitialized&&(s=o._mergeStructures(o.getStructures()));let g=s.sharedLength||0;if(g>p)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+s.sharedLength);if(!s.transitions){s.transitions=Object.create(null);for(let w=0;w<g;w++){let k=s[w];if(!k)continue;let B,V=s.transitions;for(let j=0,ie=k.length;j<ie;j++){let G=k[j];B=V[G],B||(B=V[G]=Object.create(null)),V=B}V[kt]=w+64}this.lastNamedStructuresLength=g}d||(s.nextId=g+64)}n&&(n=!1);try{o.randomAccessStructure&&h&&h.constructor&&h.constructor===Object?Ha(h):ae(h);let g=re;if(re&&Rs(t,ae,0),a&&a.idsToInsert){let w=a.idsToInsert.sort((j,ie)=>j.offset>ie.offset?1:-1),k=w.length,B=-1;for(;g&&k>0;){let j=w[--k].offset+t;j<g.stringsPosition+t&&B===-1&&(B=0),j>g.position+t?B>=0&&(B+=6):(B>=0&&(X.setUint32(g.position+t,X.getUint32(g.position+t)+B),B=-1),g=g.previous,k++)}B>=0&&g&&X.setUint32(g.position+t,X.getUint32(g.position+t)+B),l+=w.length*6,l>ye&&et(l),o.offset=l;let V=wc(f.subarray(t,l),w);return a=null,V}return o.offset=l,E&Tc?(f.start=t,f.end=l,f):f.subarray(t,l)}finally{if(s&&(ls(),n&&o.saveStructures)){let g=s.sharedLength||0,w=f.subarray(t,l),k=xc(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(h,E):(o.lastNamedStructuresLength=g,w)}E&Oc&&(l=t)}};const ls=()=>{mr<10&&mr++;let h=s.sharedLength||0;if(s.length>h&&!d&&(s.length=h),mn>1e4)s.transitions=null,mr=0,mn=0,se.length>0&&(se=[]);else if(se.length>0&&!d){for(let E=0,g=se.length;E<g;E++)se[E][kt]=0;se=[]}},yn=h=>{var E=h.length;E<16?f[l++]=144|E:E<65536?(f[l++]=220,f[l++]=E>>8,f[l++]=E&255):(f[l++]=221,X.setUint32(l,E),l+=4);for(let g=0;g<E;g++)ae(h[g])},ae=h=>{l>ye&&(f=et(l));var E=typeof h,g;if(E==="string"){let w=h.length;if(re&&w>=4&&w<4096){if((re.size+=w)>yc){let j,ie=(re[0]?re[0].length*3+re[1].length:0)+10;l+ie>ye&&(f=et(l+ie));let G;re.position?(G=re,f[l]=200,l+=3,f[l++]=98,j=l-t,l+=4,Rs(t,ae,0),X.setUint16(j+t-3,l-t-j)):(f[l++]=214,f[l++]=98,j=l-t,l+=4),re=["",""],re.previous=G,re.size=0,re.position=j}let V=gc.test(h);re[V?0:1]+=h,f[l++]=193,ae(V?-w:w);return}let k;w<32?k=1:w<256?k=2:w<65536?k=3:k=5;let B=w*3;if(l+B>ye&&(f=et(l+B)),w<64||!i){let V,j,ie,G=l+k;for(V=0;V<w;V++)j=h.charCodeAt(V),j<128?f[G++]=j:j<2048?(f[G++]=j>>6|192,f[G++]=j&63|128):(j&64512)===55296&&((ie=h.charCodeAt(V+1))&64512)===56320?(j=65536+((j&1023)<<10)+(ie&1023),V++,f[G++]=j>>18|240,f[G++]=j>>12&63|128,f[G++]=j>>6&63|128,f[G++]=j&63|128):(f[G++]=j>>12|224,f[G++]=j>>6&63|128,f[G++]=j&63|128);g=G-l-k}else g=i(h,l+k);g<32?f[l++]=160|g:g<256?(k<2&&f.copyWithin(l+2,l+1,l+1+g),f[l++]=217,f[l++]=g):g<65536?(k<3&&f.copyWithin(l+3,l+2,l+2+g),f[l++]=218,f[l++]=g>>8,f[l++]=g&255):(k<5&&f.copyWithin(l+5,l+3,l+3+g),f[l++]=219,X.setUint32(l,g),l+=4),l+=g}else if(E==="number")if(h>>>0===h)h<32||h<128&&this.useRecords===!1||h<64&&!this.randomAccessStructure?f[l++]=h:h<256?(f[l++]=204,f[l++]=h):h<65536?(f[l++]=205,f[l++]=h>>8,f[l++]=h&255):(f[l++]=206,X.setUint32(l,h),l+=4);else if(h>>0===h)h>=-32?f[l++]=256+h:h>=-128?(f[l++]=208,f[l++]=h+256):h>=-32768?(f[l++]=209,X.setInt16(l,h),l+=2):(f[l++]=210,X.setInt32(l,h),l+=4);else{let w;if((w=this.useFloat32)>0&&h<4294967296&&h>=-2147483648){f[l++]=202,X.setFloat32(l,h);let k;if(w<4||(k=h*as[(f[l]&127)<<1|f[l+1]>>7])>>0===k){l+=4;return}else l--}f[l++]=203,X.setFloat64(l,h),l+=8}else if(E==="object"||E==="function")if(!h)f[l++]=192;else{if(a){let k=a.get(h);if(k){if(!k.id){let B=a.idsToInsert||(a.idsToInsert=[]);k.id=B.push(k)}f[l++]=214,f[l++]=112,X.setUint32(l,k.id),l+=4;return}else a.set(h,{offset:l-t})}let w=h.constructor;if(w===Object)yr(h,!0);else if(w===Array)yn(h);else if(w===Map)if(this.mapAsEmptyObject)f[l++]=128;else{g=h.size,g<16?f[l++]=128|g:g<65536?(f[l++]=222,f[l++]=g>>8,f[l++]=g&255):(f[l++]=223,X.setUint32(l,g),l+=4);for(let[k,B]of h)ae(k),ae(B)}else{for(let k=0,B=Fr.length;k<B;k++){let V=is[k];if(h instanceof V){let j=Fr[k];if(j.write){j.type&&(f[l++]=212,f[l++]=j.type,f[l++]=0);let tt=j.write.call(this,h);tt===h?Array.isArray(h)?yn(h):yr(h):ae(tt);return}let ie=f,G=X,Le=l;f=null;let dt;try{dt=j.pack.call(this,h,tt=>(f=ie,ie=null,l+=tt,l>ye&&et(l),{target:f,targetView:X,position:l-tt}),ae)}finally{ie&&(f=ie,X=G,l=Le,ye=f.length-10)}dt&&(dt.length+l>ye&&et(dt.length+l),l=_c(dt,f,l,j.type));return}}if(Array.isArray(h))yn(h);else{if(h.toJSON){const k=h.toJSON();if(k!==h)return ae(k)}if(E==="function")return ae(this.writeFunction&&this.writeFunction(h));yr(h,!h.hasOwnProperty)}}}else if(E==="boolean")f[l++]=h?195:194;else if(E==="bigint"){if(h<BigInt(1)<<BigInt(63)&&h>=-(BigInt(1)<<BigInt(63)))f[l++]=211,X.setBigInt64(l,h);else if(h<BigInt(1)<<BigInt(64)&&h>0)f[l++]=207,X.setBigUint64(l,h);else if(this.largeBigIntToFloat)f[l++]=203,X.setFloat64(l,Number(h));else throw new RangeError(h+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");l+=8}else if(E==="undefined")this.encodeUndefinedAsNil?f[l++]=192:(f[l++]=212,f[l++]=0,f[l++]=0);else throw new Error("Unknown type: "+E)},ds=this.variableMapSize||this.coercibleKeyAsNumber?h=>{let E=Object.keys(h),g=E.length;g<16?f[l++]=128|g:g<65536?(f[l++]=222,f[l++]=g>>8,f[l++]=g&255):(f[l++]=223,X.setUint32(l,g),l+=4);let w;if(this.coercibleKeyAsNumber)for(let k=0;k<g;k++){w=E[k];let B=Number(w);ae(isNaN(B)?w:B),ae(h[w])}else for(let k=0;k<g;k++)ae(w=E[k]),ae(h[w])}:(h,E)=>{f[l++]=222;let g=l-t;l+=2;let w=0;for(let k in h)(E||h.hasOwnProperty(k))&&(ae(k),ae(h[k]),w++);f[g+++t]=w>>8,f[g+t]=w&255},fs=this.useRecords===!1?ds:e.progressiveRecords&&!ue?(h,E)=>{let g,w=s.transitions||(s.transitions=Object.create(null)),k=l++-t,B;for(let V in h)if(E||h.hasOwnProperty(V)){if(g=w[V],g)w=g;else{let j=Object.keys(h),ie=w;w=s.transitions;let G=0;for(let Le=0,dt=j.length;Le<dt;Le++){let tt=j[Le];g=w[tt],g||(g=w[tt]=Object.create(null),G++),w=g}k+t+1==l?(l--,gn(w,j,G)):ps(w,j,k,G),B=!0,w=ie[V]}ae(h[V])}if(!B){let V=w[kt];V?f[k+t]=V:ps(w,Object.keys(h),k,0)}}:(h,E)=>{let g,w=s.transitions||(s.transitions=Object.create(null)),k=0;for(let V in h)(E||h.hasOwnProperty(V))&&(g=w[V],g||(g=w[V]=Object.create(null),k++),w=g);let B=w[kt];B?B>=96&&ue?(f[l++]=((B-=96)&31)+96,f[l++]=B>>5):f[l++]=B:gn(w,w.__keys__||Object.keys(h),k);for(let V in h)(E||h.hasOwnProperty(V))&&ae(h[V])},hs=typeof this.useRecords=="function"&&this.useRecords,yr=hs?(h,E)=>{hs(h)?fs(h,E):ds(h,E)}:fs,et=h=>{let E;if(h>16777216){if(h-t>Cs)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(Cs,Math.round(Math.max((h-t)*(h>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(h-t<<2,f.length-1)>>12)+1<<12;let g=new br(E);return X=g.dataView||(g.dataView=new DataView(g.buffer,0,E)),h=Math.min(h,f.length),f.copy?f.copy(g,0,t,h):g.set(f.slice(t,h)),l-=t,t=0,ye=g.length-10,f=g},gn=(h,E,g)=>{let w=s.nextId;w||(w=64),w<J&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(w=s.nextOwnId,w<he||(w=J),s.nextOwnId=w+1):(w>=he&&(w=J),s.nextId=w+1);let k=E.highByte=w>=96&&ue?w-96>>5:-1;h[kt]=w,h.__keys__=E,s[w-64]=E,w<J?(E.isShared=!0,s.sharedLength=w-63,n=!0,k>=0?(f[l++]=(w&31)+96,f[l++]=k):f[l++]=w):(k>=0?(f[l++]=213,f[l++]=114,f[l++]=(w&31)+96,f[l++]=k):(f[l++]=212,f[l++]=114,f[l++]=w),g&&(mn+=mr*g),se.length>=I&&(se.shift()[kt]=0),se.push(h),ae(E))},ps=(h,E,g,w)=>{let k=f,B=l,V=ye,j=t;f=Rt,l=0,t=0,f||(Rt=f=new br(8192)),ye=f.length-10,gn(h,E,w),Rt=f;let ie=l;if(f=k,l=B,ye=V,t=j,ie>1){let G=l+ie-1;G>ye&&et(G);let Le=g+t;f.copyWithin(Le+ie,Le+1,l),f.set(Rt.slice(0,ie),Le),l=G}else f[g+t]=Rt[0]},Ha=(h,E)=>{let g=mc(h,f,t,l,s,et,(w,k,B)=>{if(B)return n=!0;l=k;let V=f;return ae(w),ls(),V!==f?{position:l,targetView:X,target:f}:l},this);if(g===0)return yr(h,!0);l=g}}useBuffer(e){f=e,X=new DataView(f.buffer,f.byteOffset,f.byteLength),l=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}is=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ia];Fr=[{pack(r,e,t){let n=r.getTime()/1e3;if((this.useTimestamp32||r.getMilliseconds()===0)&&n>=0&&n<4294967296){let{target:s,targetView:a,position:i}=e(6);s[i++]=214,s[i++]=255,a.setUint32(i,n)}else if(n>0&&n<4294967296){let{target:s,targetView:a,position:i}=e(10);s[i++]=215,s[i++]=255,a.setUint32(i,r.getMilliseconds()*4e6+(n/1e3/4294967296>>0)),a.setUint32(i+4,n)}else if(isNaN(n)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:s,targetView:a,position:i}=e(3);s[i++]=212,s[i++]=255,s[i++]=255}else{let{target:s,targetView:a,position:i}=e(15);s[i++]=199,s[i++]=12,s[i++]=255,a.setUint32(i,r.getMilliseconds()*1e6),a.setBigInt64(i+4,BigInt(Math.floor(n)))}}},{pack(r,e,t){if(this.setAsEmptyObject)return e(0),t({});let n=Array.from(r),{target:s,position:a}=e(this.moreTypes?3:0);this.moreTypes&&(s[a++]=212,s[a++]=115,s[a++]=0),t(n)}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=101,n[s++]=0),t([r.name,r.message])}},{pack(r,e,t){let{target:n,position:s}=e(this.moreTypes?3:0);this.moreTypes&&(n[s++]=212,n[s++]=120,n[s++]=0),t([r.source,r.flags])}},{pack(r,e){this.moreTypes?Zs(r,16,e):As(dn?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==Ma&&this.moreTypes?Zs(r,$a.indexOf(t.name),e):As(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function Zs(r,e,t,n){let s=r.byteLength;if(s+1<256){var{target:a,position:i}=t(4+s);a[i++]=199,a[i++]=s+1}else if(s+1<65536){var{target:a,position:i}=t(5+s);a[i++]=200,a[i++]=s+1>>8,a[i++]=s+1&255}else{var{target:a,position:i,targetView:o}=t(7+s);a[i++]=201,o.setUint32(i,s+1),i+=4}a[i++]=116,a[i++]=e,a.set(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),i)}function As(r,e){let t=r.byteLength;var n,s;if(t<256){var{target:n,position:s}=e(t+2);n[s++]=196,n[s++]=t}else if(t<65536){var{target:n,position:s}=e(t+3);n[s++]=197,n[s++]=t>>8,n[s++]=t&255}else{var{target:n,position:s,targetView:a}=e(t+5);n[s++]=198,a.setUint32(s,t),s+=4}n.set(r,s)}function _c(r,e,t,n){let s=r.length;switch(s){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:s<256?(e[t++]=199,e[t++]=s):s<65536?(e[t++]=200,e[t++]=s>>8,e[t++]=s&255):(e[t++]=201,e[t++]=s>>24,e[t++]=s>>16&255,e[t++]=s>>8&255,e[t++]=s&255)}return e[t++]=n,e.set(r,t),t+=s,t}function wc(r,e){let t,n=e.length*6,s=r.length-n;for(;t=e.pop();){let a=t.offset,i=t.id;r.copyWithin(a+n,a,s),n-=6;let o=a+n;r[o++]=214,r[o++]=105,r[o++]=i>>24,r[o++]=i>>16&255,r[o++]=i>>8&255,r[o++]=i&255,s=a}return r}function Rs(r,e,t){if(re.length>0){X.setUint32(re.position+r,l+t-re.position-r),re.stringsPosition=l-r;let n=re;re=null,e(n[0]),e(n[1])}}function bc(r){if(r.Class){if(!r.pack&&!r.write)throw new Error("Extension has no pack or write function");if(r.pack&&!r.type)throw new Error("Extension has no type (numeric code to identify the extension)");is.unshift(r.Class),Fr.unshift(r)}fc(r)}function xc(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Pa=new vc({useRecords:!1});const kc=Pa.pack;Pa.pack;const Tc=512,Oc=1024,Sc=2048;class Nc{constructor(){b(this,"contentType","application/msgpack")}encode(e){return kc(Ct.toSnake(e))}decode(e,t){const n=Ct.toCamel(hc(new Uint8Array(e)));return t!=null?t.parse(n):n}static registerCustomType(e){bc({type:0,...e})}}class Ec{constructor(){b(this,"contentType","application/json")}encode(e){const t=JSON.stringify(Ct.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):s);return new TextEncoder().encode(t)}decode(e,t){const n=Ct.toCamel(JSON.parse(new TextDecoder().decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new Nc,new Ec;var F;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(F||(F={}));var Mn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Mn||(Mn={}));const O=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),st=r=>{switch(typeof r){case"undefined":return O.undefined;case"string":return O.string;case"number":return isNaN(r)?O.nan:O.number;case"boolean":return O.boolean;case"function":return O.function;case"bigint":return O.bigint;case"symbol":return O.symbol;case"object":return Array.isArray(r)?O.array:r===null?O.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?O.promise:typeof Map<"u"&&r instanceof Map?O.map:typeof Set<"u"&&r instanceof Set?O.set:typeof Date<"u"&&r instanceof Date?O.date:O.object;default:return O.unknown}},_=F.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"]),Ic=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Ze extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],d++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Ze.create=r=>new Ze(r);const Gt=(r,e)=>{let t;switch(r.code){case _.invalid_type:r.received===O.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case _.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,F.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:t=`Unrecognized key(s) in object: ${F.joinValues(r.keys,", ")}`;break;case _.invalid_union:t="Invalid input";break;case _.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${F.joinValues(r.options)}`;break;case _.invalid_enum_value:t=`Invalid enum value. Expected ${F.joinValues(r.options)}, received '${r.received}'`;break;case _.invalid_arguments:t="Invalid function arguments";break;case _.invalid_return_type:t="Invalid function return type";break;case _.invalid_date:t="Invalid date";break;case _.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:F.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case _.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case _.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case _.custom:t="Invalid input";break;case _.invalid_intersection_types:t="Intersection results could not be merged";break;case _.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case _.not_finite:t="Number must be finite";break;default:t=e.defaultError,F.assertNever(r)}return{message:t}};let Da=Gt;function Cc(r){Da=r}function Jr(){return Da}const Hr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const d=n.filter(u=>!!u).slice().reverse();for(const u of d)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Zc=[];function N(r,e){const t=Hr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Jr(),Gt].filter(n=>!!n)});r.common.issues.push(t)}class me{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return U;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t)n.push({key:await s.key,value:await s.value});return me.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return U;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const U=Object.freeze({status:"aborted"}),La=r=>({status:"dirty",value:r}),be=r=>({status:"valid",value:r}),Pn=r=>r.status==="aborted",Dn=r=>r.status==="dirty",Xt=r=>r.status==="valid",Gr=r=>typeof Promise<"u"&&r instanceof Promise;var Z;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Z||(Z={}));class Pe{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const js=(r,e)=>{if(Xt(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Ze(r.common.issues);return this._error=t,this._error}}};function P(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:n??o.defaultError}:{message:t??o.defaultError},description:s}}class L{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return st(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:st(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new me,ctx:{common:e.parent.common,data:e.data,parsedType:st(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Gr(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:st(e)},a=this._parseSync({data:e,path:s.path,parent:s});return js(s,a)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:st(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Gr(s)?s:Promise.resolve(s));return js(n,a)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:_.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new je({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ge.create(this,this._def)}nullable(){return wt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ae.create(this,this._def)}promise(){return At.create(this,this._def)}or(e){return rr.create([this,e],this._def)}and(e){return nr.create(this,e,this._def)}transform(e){return new je({...P(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new cr({...P(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new Va({typeName:R.ZodBranded,type:this,...P(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new tn({...P(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return hr.create(this,e)}readonly(){return nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ac=/^c[^\s-]{8,}$/i,Rc=/^[a-z][a-z0-9]*$/,jc=/^[0-9A-HJKMNP-TV-Z]{26}$/,$c=/^[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,Uc=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let kn;const Pc=/^(((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}))$/,Dc=/^(([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})))$/,Lc=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Bc(r,e){return!!((e==="v4"||!e)&&Pc.test(r)||(e==="v6"||!e)&&Dc.test(r))}class Ie extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.string,received:a.parsedType}),U}const n=new me;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?N(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&N(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Uc.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"email",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")kn||(kn=new RegExp(Mc,"u")),kn.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"emoji",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")$c.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"uuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Ac.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Rc.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"cuid2",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")jc.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ulid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),N(s,{validation:"url",code:_.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"regex",code:_.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Lc(a).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Bc(e.data,a.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:_.invalid_string,message:a.message}),n.dirty()):F.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:_.invalid_string,...Z.errToObj(n)})}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Z.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Z.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Z.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Z.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Z.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Z.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Z.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Z.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,...Z.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Z.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...Z.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Z.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Z.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Z.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Z.errToObj(t)})}nonempty(e){return this.min(1,Z.errToObj(e))}trim(){return new Ie({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ie({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ie({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}Ie.create=r=>{var e;return new Ie({checks:[],typeName:R.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...P(r)})};function Vc(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class ct extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==O.number){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.number,received:a.parsedType}),U}let n;const s=new me;for(const a of this._def.checks)a.kind==="int"?F.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:_.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Vc(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),N(n,{code:_.not_finite,message:a.message}),s.dirty()):F.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,s){return new ct({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(s)}]})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Z.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Z.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Z.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Z.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&F.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ct.create=r=>new ct({checks:[],typeName:R.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...P(r)});class ut extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==O.bigint){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.bigint,received:a.parsedType}),U}let n;const s=new me;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),N(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):F.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Z.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Z.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Z.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Z.toString(t))}setLimit(e,t,n,s){return new ut({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Z.toString(s)}]})}_addCheck(e){return new ut({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Z.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Z.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ut.create=r=>{var e;return new ut({checks:[],typeName:R.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...P(r)})};class Qt extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.boolean,received:n.parsedType}),U}return be(e.data)}}Qt.create=r=>new Qt({typeName:R.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...P(r)});class vt extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:O.date,received:a.parsedType}),U}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_date}),U}const n=new me;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),N(s,{code:_.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):F.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new vt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Z.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Z.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}vt.create=r=>new vt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:R.ZodDate,...P(r)});class Xr extends L{_parse(e){if(this._getType(e)!==O.symbol){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.symbol,received:n.parsedType}),U}return be(e.data)}}Xr.create=r=>new Xr({typeName:R.ZodSymbol,...P(r)});class er extends L{_parse(e){if(this._getType(e)!==O.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.undefined,received:n.parsedType}),U}return be(e.data)}}er.create=r=>new er({typeName:R.ZodUndefined,...P(r)});class tr extends L{_parse(e){if(this._getType(e)!==O.null){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.null,received:n.parsedType}),U}return be(e.data)}}tr.create=r=>new tr({typeName:R.ZodNull,...P(r)});class Zt extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return be(e.data)}}Zt.create=r=>new Zt({typeName:R.ZodAny,...P(r)});class mt extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return be(e.data)}}mt.create=r=>new mt({typeName:R.ZodUnknown,...P(r)});class Qe extends L{_parse(e){const t=this._getOrReturnCtx(e);return N(t,{code:_.invalid_type,expected:O.never,received:t.parsedType}),U}}Qe.create=r=>new Qe({typeName:R.ZodNever,...P(r)});class Qr extends L{_parse(e){if(this._getType(e)!==O.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.void,received:n.parsedType}),U}return be(e.data)}}Qr.create=r=>new Qr({typeName:R.ZodVoid,...P(r)});class Ae extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==O.array)return N(t,{code:_.invalid_type,expected:O.array,received:t.parsedType}),U;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(N(t,{code:i?_.too_big:_.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(N(t,{code:_.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(N(t,{code:_.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new Pe(t,i,t.path,o)))).then(i=>me.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Pe(t,i,t.path,o)));return me.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Ae({...this._def,minLength:{value:e,message:Z.toString(t)}})}max(e,t){return new Ae({...this._def,maxLength:{value:e,message:Z.toString(t)}})}length(e,t){return new Ae({...this._def,exactLength:{value:e,message:Z.toString(t)}})}nonempty(e){return this.min(1,e)}}Ae.create=(r,e)=>new Ae({type:r,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...P(e)});function Ot(r){if(r instanceof ne){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Ge.create(Ot(n))}return new ne({...r._def,shape:()=>e})}else return r instanceof Ae?new Ae({...r._def,type:Ot(r.element)}):r instanceof Ge?Ge.create(Ot(r.unwrap())):r instanceof wt?wt.create(Ot(r.unwrap())):r instanceof De?De.create(r.items.map(e=>Ot(e))):r}class ne extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=F.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==O.object){const u=this._getOrReturnCtx(e);return N(u,{code:_.invalid_type,expected:O.object,received:u.parsedType}),U}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Qe&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const d=[];for(const u of i){const p=a[u],I=s.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new Pe(s,I,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Qe){const u=this._def.unknownKeys;if(u==="passthrough")for(const p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(u==="strict")o.length>0&&(N(s,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const p of o){const I=s.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new Pe(s,I,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const p of d){const I=await p.key;u.push({key:I,value:await p.value,alwaysSet:p.alwaysSet})}return u}).then(u=>me.mergeObjectSync(n,u)):me.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return Z.errToObj,new ne({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const d=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=Z.errToObj(e).message)!==null&&o!==void 0?o:d}:{message:d}}}:{}})}strip(){return new ne({...this._def,unknownKeys:"strip"})}passthrough(){return new ne({...this._def,unknownKeys:"passthrough"})}extend(e){return new ne({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ne({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ne({...this._def,catchall:e})}pick(e){const t={};return F.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ne({...this._def,shape:()=>t})}omit(e){const t={};return F.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ne({...this._def,shape:()=>t})}deepPartial(){return Ot(this)}partial(e){const t={};return F.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new ne({...this._def,shape:()=>t})}required(e){const t={};return F.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Ge;)a=a._def.innerType;t[n]=a}}),new ne({...this._def,shape:()=>t})}keyof(){return Ba(F.objectKeys(this.shape))}}ne.create=(r,e)=>new ne({shape:()=>r,unknownKeys:"strip",catchall:Qe.create(),typeName:R.ZodObject,...P(e)});ne.strictCreate=(r,e)=>new ne({shape:()=>r,unknownKeys:"strict",catchall:Qe.create(),typeName:R.ZodObject,...P(e)});ne.lazycreate=(r,e)=>new ne({shape:r,unknownKeys:"strip",catchall:Qe.create(),typeName:R.ZodObject,...P(e)});class rr extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new Ze(o.ctx.common.issues));return N(t,{code:_.invalid_union,unionErrors:i}),U}if(t.common.async)return Promise.all(n.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const d of n){const u={...t,common:{...t.common,issues:[]},parent:null},p=d._parseSync({data:t.data,path:t.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(d=>new Ze(d));return N(t,{code:_.invalid_union,unionErrors:o}),U}}get options(){return this._def.options}}rr.create=(r,e)=>new rr({options:r,typeName:R.ZodUnion,...P(e)});const jr=r=>r instanceof ar?jr(r.schema):r instanceof je?jr(r.innerType()):r instanceof ir?[r.value]:r instanceof lt?r.options:r instanceof or?Object.keys(r.enum):r instanceof cr?jr(r._def.innerType):r instanceof er?[void 0]:r instanceof tr?[null]:null;class fn extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return N(t,{code:_.invalid_type,expected:O.object,received:t.parsedType}),U;const n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(N(t,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const s=new Map;for(const a of t){const i=jr(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new fn({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...P(n)})}}function Ln(r,e){const t=st(r),n=st(e);if(r===e)return{valid:!0,data:r};if(t===O.object&&n===O.object){const s=F.objectKeys(e),a=F.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const d=Ln(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===O.array&&n===O.array){if(r.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],d=Ln(i,o);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return t===O.date&&n===O.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class nr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Pn(a)||Pn(i))return U;const o=Ln(a.value,i.value);return o.valid?((Dn(a)||Dn(i))&&t.dirty(),{status:t.value,value:o.data}):(N(n,{code:_.invalid_intersection_types}),U)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}nr.create=(r,e,t)=>new nr({left:r,right:e,typeName:R.ZodIntersection,...P(t)});class De extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return N(n,{code:_.invalid_type,expected:O.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return N(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&n.data.length>this._def.items.length&&(N(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const d=this._def.items[o]||this._def.rest;return d?d._parse(new Pe(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>me.mergeArray(t,i)):me.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new De({...this._def,rest:e})}}De.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new De({items:r,typeName:R.ZodTuple,rest:null,...P(e)})};class sr extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.object)return N(n,{code:_.invalid_type,expected:O.object,received:n.parsedType}),U;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Pe(n,o,n.path,o)),value:i._parse(new Pe(n,n.data[o],n.path,o))});return n.common.async?me.mergeObjectAsync(t,s):me.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new sr({keyType:e,valueType:t,typeName:R.ZodRecord,...P(n)}):new sr({keyType:Ie.create(),valueType:e,typeName:R.ZodRecord,...P(t)})}}class en extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.map)return N(n,{code:_.invalid_type,expected:O.map,received:n.parsedType}),U;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,d],u)=>({key:s._parse(new Pe(n,o,n.path,[u,"key"])),value:a._parse(new Pe(n,d,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const d of i){const u=await d.key,p=await d.value;if(u.status==="aborted"||p.status==="aborted")return U;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const d of i){const u=d.key,p=d.value;if(u.status==="aborted"||p.status==="aborted")return U;(u.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(u.value,p.value)}return{status:t.value,value:o}}}}en.create=(r,e,t)=>new en({valueType:e,keyType:r,typeName:R.ZodMap,...P(t)});class _t extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return N(n,{code:_.invalid_type,expected:O.set,received:n.parsedType}),U;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(N(n,{code:_.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(N(n,{code:_.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const a=this._def.valueType;function i(d){const u=new Set;for(const p of d){if(p.status==="aborted")return U;p.status==="dirty"&&t.dirty(),u.add(p.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((d,u)=>a._parse(new Pe(n,d,n.path,u)));return n.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new _t({...this._def,minSize:{value:e,message:Z.toString(t)}})}max(e,t){return new _t({...this._def,maxSize:{value:e,message:Z.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_t.create=(r,e)=>new _t({valueType:r,minSize:null,maxSize:null,typeName:R.ZodSet,...P(e)});class St extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return N(t,{code:_.invalid_type,expected:O.function,received:t.parsedType}),U;function n(o,d){return Hr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jr(),Gt].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:d}})}function s(o,d){return Hr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Jr(),Gt].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:d}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof At){const o=this;return be(async function(...d){const u=new Ze([]),p=await o._def.args.parseAsync(d,a).catch(J=>{throw u.addIssue(n(d,J)),u}),I=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(I,a).catch(J=>{throw u.addIssue(s(I,J)),u})})}else{const o=this;return be(function(...d){const u=o._def.args.safeParse(d,a);if(!u.success)throw new Ze([n(d,u.error)]);const p=Reflect.apply(i,this,u.data),I=o._def.returns.safeParse(p,a);if(!I.success)throw new Ze([s(p,I.error)]);return I.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new St({...this._def,args:De.create(e).rest(mt.create())})}returns(e){return new St({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new St({args:e||De.create([]).rest(mt.create()),returns:t||mt.create(),typeName:R.ZodFunction,...P(n)})}}class ar extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ar.create=(r,e)=>new ar({getter:r,typeName:R.ZodLazy,...P(e)});class ir extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return N(t,{received:t.data,code:_.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:e.data}}get value(){return this._def.value}}ir.create=(r,e)=>new ir({value:r,typeName:R.ZodLiteral,...P(e)});function Ba(r,e){return new lt({values:r,typeName:R.ZodEnum,...P(e)})}class lt extends L{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return N(t,{expected:F.joinValues(n),received:t.parsedType,code:_.invalid_type}),U}if(this._def.values.indexOf(e.data)===-1){const t=this._getOrReturnCtx(e),n=this._def.values;return N(t,{received:t.data,code:_.invalid_enum_value,options:n}),U}return be(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return lt.create(e)}exclude(e){return lt.create(this.options.filter(t=>!e.includes(t)))}}lt.create=Ba;class or extends L{_parse(e){const t=F.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){const s=F.objectValues(t);return N(n,{expected:F.joinValues(s),received:n.parsedType,code:_.invalid_type}),U}if(t.indexOf(e.data)===-1){const s=F.objectValues(t);return N(n,{received:n.data,code:_.invalid_enum_value,options:s}),U}return be(e.data)}get enum(){return this._def.values}}or.create=(r,e)=>new or({values:r,typeName:R.ZodNativeEnum,...P(e)});class At extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.promise&&t.common.async===!1)return N(t,{code:_.invalid_type,expected:O.promise,received:t.parsedType}),U;const n=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return be(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}At.create=(r,e)=>new At({type:r,typeName:R.ZodPromise,...P(e)});class je extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{N(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:n.path,parent:n})):this._def.schema._parseSync({data:i,path:n.path,parent:n})}if(s.type==="refinement"){const i=o=>{const d=s.refinement(o,a);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?U:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?U:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xt(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>Xt(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);F.assertNever(s)}}je.create=(r,e,t)=>new je({schema:r,typeName:R.ZodEffects,effect:e,...P(t)});je.createWithPreprocess=(r,e,t)=>new je({schema:e,effect:{type:"preprocess",transform:r},typeName:R.ZodEffects,...P(t)});class Ge extends L{_parse(e){return this._getType(e)===O.undefined?be(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ge.create=(r,e)=>new Ge({innerType:r,typeName:R.ZodOptional,...P(e)});class wt extends L{_parse(e){return this._getType(e)===O.null?be(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}wt.create=(r,e)=>new wt({innerType:r,typeName:R.ZodNullable,...P(e)});class cr extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===O.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}cr.create=(r,e)=>new cr({innerType:r,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...P(e)});class tn extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Gr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ze(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ze(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}tn.create=(r,e)=>new tn({innerType:r,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...P(e)});class rn extends L{_parse(e){if(this._getType(e)!==O.nan){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:O.nan,received:n.parsedType}),U}return{status:"valid",value:e.data}}}rn.create=r=>new rn({typeName:R.ZodNaN,...P(r)});const zc=Symbol("zod_brand");class Va extends L{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class hr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?U:a.status==="dirty"?(t.dirty(),La(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?U:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new hr({in:e,out:t,typeName:R.ZodPipeline})}}class nn extends L{_parse(e){const t=this._def.innerType._parse(e);return Xt(t)&&(t.value=Object.freeze(t.value)),t}}nn.create=(r,e)=>new nn({innerType:r,typeName:R.ZodReadonly,...P(e)});const za=(r,e={},t)=>r?Zt.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:d})}}):Zt.create(),qc={object:ne.lazycreate};var R;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(R||(R={}));const Wc=(r,e={message:`Input not instance of ${r.name}`})=>za(t=>t instanceof r,e),qa=Ie.create,Wa=ct.create,Kc=rn.create,Yc=ut.create,Ka=Qt.create,Fc=vt.create,Jc=Xr.create,Hc=er.create,Gc=tr.create,Xc=Zt.create,Qc=mt.create,eu=Qe.create,tu=Qr.create,ru=Ae.create,nu=ne.create,su=ne.strictCreate,au=rr.create,iu=fn.create,ou=nr.create,cu=De.create,uu=sr.create,lu=en.create,du=_t.create,fu=St.create,hu=ar.create,pu=ir.create,mu=lt.create,yu=or.create,gu=At.create,$s=je.create,vu=Ge.create,_u=wt.create,wu=je.createWithPreprocess,bu=hr.create,xu=()=>qa().optional(),ku=()=>Wa().optional(),Tu=()=>Ka().optional(),Ou={string:r=>Ie.create({...r,coerce:!0}),number:r=>ct.create({...r,coerce:!0}),boolean:r=>Qt.create({...r,coerce:!0}),bigint:r=>ut.create({...r,coerce:!0}),date:r=>vt.create({...r,coerce:!0})},Su=U;var Fe=Object.freeze({__proto__:null,defaultErrorMap:Gt,setErrorMap:Cc,getErrorMap:Jr,makeIssue:Hr,EMPTY_PATH:Zc,addIssueToContext:N,ParseStatus:me,INVALID:U,DIRTY:La,OK:be,isAborted:Pn,isDirty:Dn,isValid:Xt,isAsync:Gr,get util(){return F},get objectUtil(){return Mn},ZodParsedType:O,getParsedType:st,ZodType:L,ZodString:Ie,ZodNumber:ct,ZodBigInt:ut,ZodBoolean:Qt,ZodDate:vt,ZodSymbol:Xr,ZodUndefined:er,ZodNull:tr,ZodAny:Zt,ZodUnknown:mt,ZodNever:Qe,ZodVoid:Qr,ZodArray:Ae,ZodObject:ne,ZodUnion:rr,ZodDiscriminatedUnion:fn,ZodIntersection:nr,ZodTuple:De,ZodRecord:sr,ZodMap:en,ZodSet:_t,ZodFunction:St,ZodLazy:ar,ZodLiteral:ir,ZodEnum:lt,ZodNativeEnum:or,ZodPromise:At,ZodEffects:je,ZodTransformer:je,ZodOptional:Ge,ZodNullable:wt,ZodDefault:cr,ZodCatch:tn,ZodNaN:rn,BRAND:zc,ZodBranded:Va,ZodPipeline:hr,ZodReadonly:nn,custom:za,Schema:L,ZodSchema:L,late:qc,get ZodFirstPartyTypeKind(){return R},coerce:Ou,any:Xc,array:ru,bigint:Yc,boolean:Ka,date:Fc,discriminatedUnion:iu,effect:$s,enum:mu,function:fu,instanceof:Wc,intersection:ou,lazy:hu,literal:pu,map:lu,nan:Kc,nativeEnum:yu,never:eu,null:Gc,nullable:_u,number:Wa,object:nu,oboolean:Tu,onumber:ku,optional:vu,ostring:xu,pipeline:bu,preprocess:wu,promise:gu,record:uu,set:du,strictObject:su,string:qa,symbol:Jc,transformer:$s,tuple:cu,undefined:Hc,union:au,unknown:Qc,void:tu,NEVER:Su,ZodIssueCode:_,quotelessJson:Ic,ZodError:Ze});class pr extends Error{constructor(t,n){super(t);ce(this,"discriminator","FreighterError");ce(this,"type");this.type=n}}const Nu=r=>{if(r==null||typeof r!="object")return!1;const e=r;if(e.discriminator!=="FreighterError")return!1;if(!("type"in e))throw new Error(`Freighter error is missing its type property: ${JSON.stringify(e)}`);return!0},Bn="unknown",Us="nil",hn="freighter",os=Fe.object({type:Fe.string(),data:Fe.string()});class Eu{constructor(){ce(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:Us,data:""};if(Nu(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Bn,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===Us)return null;if(e.type===Bn)return new Ms(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Ms(e.data)}}const cs=new Eu,Ya=({encode:r,decode:e})=>cs.register({encode:r,decode:e}),Iu=r=>cs.encode(r),us=r=>cs.decode(r);class Ms extends pr{constructor(e){super(e,Bn)}}class ur extends pr{constructor(){super("EOF",hn)}}class lr extends pr{constructor(){super("StreamClosed",hn)}}class pn extends pr{constructor(t={}){const{message:n="Unreachable",url:s=sc.UNKNOWN}=t;super(n,hn);ce(this,"url");this.url=s}}const $r="freighter",Cu=r=>{if(r.type!==hn)return null;if(r instanceof ur)return{type:$r,data:"EOF"};if(r instanceof lr)return{type:$r,data:"StreamClosed"};if(r instanceof pn)return{type:$r,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},Zu=r=>{if(r.type!==$r)return null;switch(r.data){case"EOF":return new ur;case"StreamClosed":return new lr;case"Unreachable":return new pn;default:throw new Error(`Unknown error type: ${r.data}`)}};Ya({encode:Cu,decode:Zu});class Fa{constructor(){ce(this,"middleware",[])}use(...e){this.middleware.push(...e)}async executeMiddleware(e,t){let n=0;const s=async a=>{if(n===this.middleware.length)return await t(a);const i=this.middleware[n];return n++,await i(a,s)};return await s(e)}}const Ja="Content-Type",Ps=r=>{if(Na.RUNTIME!=="node")return fetch;const e=require("node-fetch");if(r==="http")return e;const t=require("https"),n=new t.Agent({rejectUnauthorized:!1});return async(s,a)=>await e(s,{...a,agent:n})};class Au extends Fa{constructor(t,n,s=!1){super();ce(this,"endpoint");ce(this,"encoder");ce(this,"fetch");return this.endpoint=t.replace({protocol:s?"https":"http"}),this.encoder=n,this.fetch=Ps(this.endpoint.protocol),new Proxy(this,{get:(a,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(a,i,o)})}get headers(){return{[Ja]:this.encoder.contentType}}async send(t,n,s){let a=null;const i=this.endpoint.child(t),o={};o.method="POST",o.body=this.encoder.encode(n??{});const[,d]=await this.executeMiddleware({target:i.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async u=>{const p={...u,params:{}};o.headers={...this.headers,...u.params};let I;try{I=await Ps(u.protocol)(u.target,o)}catch(J){let he=J;return he.message==="Load failed"&&(he=new pn({url:i})),[p,he]}const ue=await I.arrayBuffer();if(I!=null&&I.ok)return s!=null&&(a=this.encoder.decode(ue,s)),[p,null];try{if(I.status!==400)return[p,new Error(I.statusText)];const J=this.encoder.decode(ue,os),he=us(J);return[p,he]}catch(J){return[p,new Error(`[freighter] - failed to decode error: ${I.statusText}: ${J.message}`)]}});return[a,d]}}const Ru=async(r,e,t,n)=>{const[s,a]=await r.send(e,t,n);if(a!=null)throw a;return s},ju=()=>Na.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),$u=Fe.object({type:Fe.union([Fe.literal("data"),Fe.literal("close")]),payload:Fe.unknown().optional(),error:Fe.optional(os)});class Uu{constructor(e,t,n,s){ce(this,"encoder");ce(this,"reqSchema");ce(this,"resSchema");ce(this,"ws");ce(this,"serverClosed");ce(this,"sendClosed");ce(this,"receiveDataQueue",[]);ce(this,"receiveCallbacksQueue",[]);this.encoder=t,this.reqSchema=n,this.resSchema=s,this.ws=e,this.sendClosed=!1,this.serverClosed=null,this.listenForMessages()}send(e){if(this.serverClosed!=null)return new ur;if(this.sendClosed)throw new lr;return this.ws.send(this.encoder.encode({type:"data",payload:e})),null}async receive(){if(this.serverClosed!=null)return[null,this.serverClosed];const e=await this.receiveMsg();if(e.type==="close"){if(e.error==null)throw new Error("Message error must be defined");return this.serverClosed=us(e.error),[null,this.serverClosed]}return[this.resSchema.parse(e.payload),null]}received(){return this.receiveDataQueue.length!==0}closeSend(){if(this.sendClosed||this.serverClosed!=null)return;const e={type:"close"};try{this.ws.send(this.encoder.encode(e))}finally{this.sendClosed=!0}}async receiveMsg(){const e=this.receiveDataQueue.shift();return e??await new Promise((t,n)=>this.receiveCallbacksQueue.push({resolve:t,reject:n}))}listenForMessages(){this.ws.onmessage=e=>{const t=this.encoder.decode(e.data,$u),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=Bu(e)?new ur:new lr}}}const Mu="freighterctx",Pu=1e3,Du=1001,Lu=[Pu,Du],Bu=r=>Lu.includes(r.code),sn=class sn extends Fa{constructor(t,n,s=!1){super();ce(this,"baseUrl");ce(this,"encoder");this.baseUrl=t.replace({protocol:s?"wss":"ws"}),this.encoder=n}async stream(t,n,s){const a=ju();let i;const[,o]=await this.executeMiddleware({target:t,protocol:"websocket",params:{},role:"client"},async d=>{const u=a(this.buildURL(t,d)),p={...d,params:{}};u.binaryType=sn.MESSAGE_TYPE;const I=await this.wrapSocket(u,n,s);return I instanceof Error?[p,I]:(i=I,[p,null])});if(o!=null)throw o;return i}buildURL(t,n){const s=nc({[Ja]:this.encoder.contentType,...n.params},Mu);return this.baseUrl.child(t).toString()+s}async wrapSocket(t,n,s){return await new Promise(a=>{t.onopen=()=>{a(new Uu(t,this.encoder,n,s))},t.onerror=i=>{const o=i;a(new Error(o.message))}})}};ce(sn,"MESSAGE_TYPE","arraybuffer");let Vn=sn;exports.BaseTypedError=pr;exports.EOF=ur;exports.HTTPClient=Au;exports.StreamClosed=lr;exports.Unreachable=pn;exports.WebSocketClient=Vn;exports.decodeError=us;exports.encodeError=Iu;exports.errorZ=os;exports.registerError=Ya;exports.sendRequired=Ru;
2
2
  //# sourceMappingURL=freighter.cjs.js.map