@synnaxlabs/freighter 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/freighter.cjs +1 -1
- package/dist/freighter.cjs.map +1 -1
- package/dist/freighter.js +153 -153
- package/dist/freighter.js.map +1 -1
- package/package.json +5 -5
package/dist/freighter.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var La=Object.defineProperty;var $a=(r,e,t)=>e in r?La(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var le=(r,e,t)=>($a(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var za=Object.defineProperty,Va=(r,e,t)=>e in r?za(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,w=(r,e,t)=>(Va(r,typeof e!="symbol"?e+"":e,t),t),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 xn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(xn||(xn={}));const O=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),it=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}},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"]),Wa=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Ce 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,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};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 Lt=(r,e)=>{let t;switch(r.code){case v.invalid_type:r.received===O.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 Zs=Lt;function Fa(r){Zs=r}function Ur(){return Zs}const Mr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Ka=[];function S(r,e){const t=Mr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ur(),Lt].filter(n=>!!n)});r.common.issues.push(t)}class ge{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 P;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 ge.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 P;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 P=Object.freeze({status:"aborted"}),js=r=>({status:"dirty",value:r}),xe=r=>({status:"valid",value:r}),kn=r=>r.status==="aborted",On=r=>r.status==="dirty",$t=r=>r.status==="valid",Pr=r=>typeof Promise<"u"&&r instanceof Promise;var E;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(E||(E={}));class Be{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 os=(r,e)=>{if($t(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 D(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:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.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 it(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:it(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ge,ctx:{common:e.parent.common,data:e.data,parsedType:it(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:it(e)},a=this._parseSync({data:e,path:s.path,parent:s});return os(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:it(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Pr(s)?s:Promise.resolve(s));return os(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(u=>u?!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 Ue({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Qe.create(this,this._def)}nullable(){return xt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ze.create(this,this._def)}promise(){return Rt.create(this,this._def)}or(e){return Ft.create([this,e],this._def)}and(e){return Kt.create(this,e,this._def)}transform(e){return new Ue({...D(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ht({...D(this._def),innerType:this,defaultValue:t,typeName:Z.ZodDefault})}brand(){return new Us({typeName:Z.ZodBranded,type:this,...D(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new $r({...D(this._def),innerType:this,catchValue:t,typeName:Z.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fr.create(this,e)}readonly(){return Vr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ya=/^c[^\s-]{8,}$/i,qa=/^[a-z][a-z0-9]*$/,Ga=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ja=/^[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,Ha=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let mn;const Qa=/^(((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}))$/,ei=/^(([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})))$/,ti=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 ri(r,e){return!!((e==="v4"||!e)&&Qa.test(r)||(e==="v6"||!e)&&ei.test(r))}class Ae extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){const s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.string,received:s.parsedType}),P}const t=new ge;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?S(n,{code:v.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&S(n,{code:v.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Ha.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"email",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")mn||(mn=new RegExp(Xa,"u")),mn.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"emoji",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Ja.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"uuid",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")Ya.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")qa.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid2",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")Ga.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"ulid",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),S(n,{validation:"url",code:v.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"regex",code:v.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?ti(s).test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?ri(e.data,s.version)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"ip",code:v.invalid_string,message:s.message}),t.dirty()):Y.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:v.invalid_string,...E.errToObj(n)})}_addCheck(e){return new Ae({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.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,...E.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...E.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new Ae({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ae({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ae({...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}}Ae.create=r=>{var e;return new Ae({checks:[],typeName:Z.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...D(r)})};function ni(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 lt 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 s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.number,received:s.parsedType}),P}let t;const n=new ge;for(const s of this._def.checks)s.kind==="int"?Y.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:v.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?ni(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:v.not_finite,message:s.message}),n.dirty()):Y.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,s){return new lt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(s)}]})}_addCheck(e){return new lt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.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)}}lt.create=r=>new lt({checks:[],typeName:Z.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...D(r)});class dt 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 s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.bigint,received:s.parsedType}),P}let t;const n=new ge;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):Y.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,s){return new dt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(s)}]})}_addCheck(e){return new dt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.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:Z.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...D(r)})};class zt extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.boolean,received:t.parsedType}),P}return xe(e.data)}}zt.create=r=>new zt({typeName:Z.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...D(r)});class bt extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){const s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.date,received:s.parsedType}),P}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_date}),P}const t=new ge;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):Y.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.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:Z.ZodDate,...D(r)});class Dr extends L{_parse(e){if(this._getType(e)!==O.symbol){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.symbol,received:t.parsedType}),P}return xe(e.data)}}Dr.create=r=>new Dr({typeName:Z.ZodSymbol,...D(r)});class Vt extends L{_parse(e){if(this._getType(e)!==O.undefined){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.undefined,received:t.parsedType}),P}return xe(e.data)}}Vt.create=r=>new Vt({typeName:Z.ZodUndefined,...D(r)});class Wt extends L{_parse(e){if(this._getType(e)!==O.null){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.null,received:t.parsedType}),P}return xe(e.data)}}Wt.create=r=>new Wt({typeName:Z.ZodNull,...D(r)});class jt extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return xe(e.data)}}jt.create=r=>new jt({typeName:Z.ZodAny,...D(r)});class vt extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xe(e.data)}}vt.create=r=>new vt({typeName:Z.ZodUnknown,...D(r)});class rt extends L{_parse(e){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.never,received:t.parsedType}),P}}rt.create=r=>new rt({typeName:Z.ZodNever,...D(r)});class Br extends L{_parse(e){if(this._getType(e)!==O.undefined){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.void,received:t.parsedType}),P}return xe(e.data)}}Br.create=r=>new Br({typeName:Z.ZodVoid,...D(r)});class Ze extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==O.array)return S(t,{code:v.invalid_type,expected:O.array,received:t.parsedType}),P;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 Be(t,i,t.path,o)))).then(i=>ge.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Be(t,i,t.path,o)));return ge.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Ze({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new Ze({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new Ze({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}Ze.create=(r,e)=>new Ze({type:r,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...D(e)});function At(r){if(r instanceof ae){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Qe.create(At(n))}return new ae({...r._def,shape:()=>e})}else return r instanceof Ze?new Ze({...r._def,type:At(r.element)}):r instanceof Qe?Qe.create(At(r.unwrap())):r instanceof xt?xt.create(At(r.unwrap())):r instanceof Le?Le.create(r.items.map(e=>At(e))):r}class ae 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=Y.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==O.object){const u=this._getOrReturnCtx(e);return S(u,{code:v.invalid_type,expected:O.object,received:u.parsedType}),P}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof rt&&this._def.unknownKeys==="strip"))for(const u in n.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const d=s[u],p=n.data[u];o.push({key:{status:"valid",value:u},value:d._parse(new Be(n,p,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof rt){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")i.length>0&&(S(n,{code:v.unrecognized_keys,keys:i}),t.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of i){const p=n.data[d];o.push({key:{status:"valid",value:d},value:u._parse(new Be(n,p,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of o){const p=await d.key;u.push({key:p,value:await d.value,alwaysSet:d.alwaysSet})}return u}).then(u=>ge.mergeObjectSync(t,u)):ge.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(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=E.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ae({...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 ae({...this._def,shape:()=>t})}omit(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ae({...this._def,shape:()=>t})}deepPartial(){return At(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 ae({...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 s=this.shape[n];for(;s instanceof Qe;)s=s._def.innerType;t[n]=s}}),new ae({...this._def,shape:()=>t})}keyof(){return Rs(Y.objectKeys(this.shape))}}ae.create=(r,e)=>new ae({shape:()=>r,unknownKeys:"strip",catchall:rt.create(),typeName:Z.ZodObject,...D(e)});ae.strictCreate=(r,e)=>new ae({shape:()=>r,unknownKeys:"strict",catchall:rt.create(),typeName:Z.ZodObject,...D(e)});ae.lazycreate=(r,e)=>new ae({shape:r,unknownKeys:"strip",catchall:rt.create(),typeName:Z.ZodObject,...D(e)});class Ft 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 Ce(o.ctx.common.issues));return S(t,{code:v.invalid_union,unionErrors:i}),P}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 u of n){const d={...t,common:{...t.common,issues:[]},parent:null},p=u._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new Ce(u));return S(t,{code:v.invalid_union,unionErrors:o}),P}}get options(){return this._def.options}}Ft.create=(r,e)=>new Ft({options:r,typeName:Z.ZodUnion,...D(e)});const kr=r=>r instanceof qt?kr(r.schema):r instanceof Ue?kr(r.innerType()):r instanceof Gt?[r.value]:r instanceof ht?r.options:r instanceof Jt?Object.keys(r.enum):r instanceof Ht?kr(r._def.innerType):r instanceof Vt?[void 0]:r instanceof Wt?[null]:null;class tn extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return S(t,{code:v.invalid_type,expected:O.object,received:t.parsedType}),P;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]}),P)}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 tn({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...D(n)})}}function Tn(r,e){const t=it(r),n=it(e);if(r===e)return{valid:!0,data:r};if(t===O.object&&n===O.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 u=Tn(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.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],u=Tn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===O.date&&n===O.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Kt extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(kn(a)||kn(i))return P;const o=Tn(a.value,i.value);return o.valid?((On(a)||On(i))&&t.dirty(),{status:t.value,value:o.data}):(S(n,{code:v.invalid_intersection_types}),P)};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}))}}Kt.create=(r,e,t)=>new Kt({left:r,right:e,typeName:Z.ZodIntersection,...D(t)});class Le extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return S(n,{code:v.invalid_type,expected:O.array,received:n.parsedType}),P;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"}),P;!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 s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new Be(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>ge.mergeArray(t,a)):ge.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Le({...this._def,rest:e})}}Le.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Le({items:r,typeName:Z.ZodTuple,rest:null,...D(e)})};class Yt 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 S(n,{code:v.invalid_type,expected:O.object,received:n.parsedType}),P;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Be(n,o,n.path,o)),value:i._parse(new Be(n,n.data[o],n.path,o))});return n.common.async?ge.mergeObjectAsync(t,s):ge.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new Yt({keyType:e,valueType:t,typeName:Z.ZodRecord,...D(n)}):new Yt({keyType:Ae.create(),valueType:e,typeName:Z.ZodRecord,...D(t)})}}class Lr 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 S(n,{code:v.invalid_type,expected:O.map,received:n.parsedType}),P;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:s._parse(new Be(n,o,n.path,[d,"key"])),value:a._parse(new Be(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return P;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return P;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}}}}Lr.create=(r,e,t)=>new Lr({valueType:e,keyType:r,typeName:Z.ZodMap,...D(t)});class wt extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return S(n,{code:v.invalid_type,expected:O.set,received:n.parsedType}),P;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(u){const d=new Set;for(const p of u){if(p.status==="aborted")return P;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((u,d)=>a._parse(new Be(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new wt({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new wt({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}wt.create=(r,e)=>new wt({valueType:r,minSize:null,maxSize:null,typeName:Z.ZodSet,...D(e)});class Ct extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return S(t,{code:v.invalid_type,expected:O.function,received:t.parsedType}),P;function n(o,u){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Lt].filter(d=>!!d),issueData:{code:v.invalid_arguments,argumentsError:u}})}function s(o,u){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Lt].filter(d=>!!d),issueData:{code:v.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Rt){const o=this;return xe(async function(...u){const d=new Ce([]),p=await o._def.args.parseAsync(u,a).catch(J=>{throw d.addIssue(n(u,J)),d}),A=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(A,a).catch(J=>{throw d.addIssue(s(A,J)),d})})}else{const o=this;return xe(function(...u){const d=o._def.args.safeParse(u,a);if(!d.success)throw new Ce([n(u,d.error)]);const p=Reflect.apply(i,this,d.data),A=o._def.returns.safeParse(p,a);if(!A.success)throw new Ce([s(p,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ct({...this._def,args:Le.create(e).rest(vt.create())})}returns(e){return new Ct({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ct({args:e||Le.create([]).rest(vt.create()),returns:t||vt.create(),typeName:Z.ZodFunction,...D(n)})}}class qt 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})}}qt.create=(r,e)=>new qt({getter:r,typeName:Z.ZodLazy,...D(e)});class Gt extends L{_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}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}}Gt.create=(r,e)=>new Gt({value:r,typeName:Z.ZodLiteral,...D(e)});function Rs(r,e){return new ht({values:r,typeName:Z.ZodEnum,...D(e)})}class ht extends L{_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}),P}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}),P}return xe(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 ht.create(e)}exclude(e){return ht.create(this.options.filter(t=>!e.includes(t)))}}ht.create=Rs;class Jt extends L{_parse(e){const t=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){const s=Y.objectValues(t);return S(n,{expected:Y.joinValues(s),received:n.parsedType,code:v.invalid_type}),P}if(t.indexOf(e.data)===-1){const s=Y.objectValues(t);return S(n,{received:n.data,code:v.invalid_enum_value,options:s}),P}return xe(e.data)}get enum(){return this._def.values}}Jt.create=(r,e)=>new Jt({values:r,typeName:Z.ZodNativeEnum,...D(e)});class Rt 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 S(t,{code:v.invalid_type,expected:O.promise,received:t.parsedType}),P;const n=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return xe(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Rt.create=(r,e)=>new Rt({type:r,typeName:Z.ZodPromise,...D(e)});class Ue extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.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 u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u 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"?P:(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"?P:(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(!$t(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=>$t(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);Y.assertNever(s)}}Ue.create=(r,e,t)=>new Ue({schema:r,typeName:Z.ZodEffects,effect:e,...D(t)});Ue.createWithPreprocess=(r,e,t)=>new Ue({schema:e,effect:{type:"preprocess",transform:r},typeName:Z.ZodEffects,...D(t)});class Qe extends L{_parse(e){return this._getType(e)===O.undefined?xe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qe.create=(r,e)=>new Qe({innerType:r,typeName:Z.ZodOptional,...D(e)});class xt extends L{_parse(e){return this._getType(e)===O.null?xe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xt.create=(r,e)=>new xt({innerType:r,typeName:Z.ZodNullable,...D(e)});class Ht 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}}Ht.create=(r,e)=>new Ht({innerType:r,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...D(e)});class $r 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 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}}$r.create=(r,e)=>new $r({innerType:r,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...D(e)});class zr extends L{_parse(e){if(this._getType(e)!==O.nan){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.nan,received:t.parsedType}),P}return{status:"valid",value:e.data}}}zr.create=r=>new zr({typeName:Z.ZodNaN,...D(r)});const si=Symbol("zod_brand");class Us 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 fr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?P:s.status==="dirty"?(t.dirty(),js(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?P: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 fr({in:e,out:t,typeName:Z.ZodPipeline})}}class Vr extends L{_parse(e){const t=this._def.innerType._parse(e);return $t(t)&&(t.value=Object.freeze(t.value)),t}}Vr.create=(r,e)=>new Vr({innerType:r,typeName:Z.ZodReadonly,...D(e)});const Ms=(r,e={},t)=>r?jt.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:u})}}):jt.create(),ai={object:ae.lazycreate};var Z;(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"})(Z||(Z={}));const ii=(r,e={message:`Input not instance of ${r.name}`})=>Ms(t=>t instanceof r,e),Ps=Ae.create,Ds=lt.create,oi=zr.create,ui=dt.create,Bs=zt.create,ci=bt.create,li=Dr.create,di=Vt.create,hi=Wt.create,fi=jt.create,pi=vt.create,mi=rt.create,yi=Br.create,gi=Ze.create,vi=ae.create,_i=ae.strictCreate,bi=Ft.create,wi=tn.create,xi=Kt.create,ki=Le.create,Oi=Yt.create,Ti=Lr.create,Si=wt.create,Ni=Ct.create,Ii=qt.create,Ai=Gt.create,Ei=ht.create,Ci=Jt.create,Zi=Rt.create,us=Ue.create,ji=Qe.create,Ri=xt.create,Ui=Ue.createWithPreprocess,Mi=fr.create,Pi=()=>Ps().optional(),Di=()=>Ds().optional(),Bi=()=>Bs().optional(),Li={string:r=>Ae.create({...r,coerce:!0}),number:r=>lt.create({...r,coerce:!0}),boolean:r=>zt.create({...r,coerce:!0}),bigint:r=>dt.create({...r,coerce:!0}),date:r=>bt.create({...r,coerce:!0})},$i=P;var m=Object.freeze({__proto__:null,defaultErrorMap:Lt,setErrorMap:Fa,getErrorMap:Ur,makeIssue:Mr,EMPTY_PATH:Ka,addIssueToContext:S,ParseStatus:ge,INVALID:P,DIRTY:js,OK:xe,isAborted:kn,isDirty:On,isValid:$t,isAsync:Pr,get util(){return Y},get objectUtil(){return xn},ZodParsedType:O,getParsedType:it,ZodType:L,ZodString:Ae,ZodNumber:lt,ZodBigInt:dt,ZodBoolean:zt,ZodDate:bt,ZodSymbol:Dr,ZodUndefined:Vt,ZodNull:Wt,ZodAny:jt,ZodUnknown:vt,ZodNever:rt,ZodVoid:Br,ZodArray:Ze,ZodObject:ae,ZodUnion:Ft,ZodDiscriminatedUnion:tn,ZodIntersection:Kt,ZodTuple:Le,ZodRecord:Yt,ZodMap:Lr,ZodSet:wt,ZodFunction:Ct,ZodLazy:qt,ZodLiteral:Gt,ZodEnum:ht,ZodNativeEnum:Jt,ZodPromise:Rt,ZodEffects:Ue,ZodTransformer:Ue,ZodOptional:Qe,ZodNullable:xt,ZodDefault:Ht,ZodCatch:$r,ZodNaN:zr,BRAND:si,ZodBranded:Us,ZodPipeline:fr,ZodReadonly:Vr,custom:Ms,Schema:L,ZodSchema:L,late:ai,get ZodFirstPartyTypeKind(){return Z},coerce:Li,any:fi,array:gi,bigint:ui,boolean:Bs,date:ci,discriminatedUnion:wi,effect:us,enum:Ei,function:Ni,instanceof:ii,intersection:xi,lazy:Ii,literal:Ai,map:Ti,nan:oi,nativeEnum:Ci,never:mi,null:hi,nullable:Ri,number:Ds,object:vi,oboolean:Bi,onumber:Di,optional:ji,ostring:Pi,pipeline:Mi,preprocess:Ui,promise:Zi,record:Oi,set:Si,strictObject:_i,string:Ps,symbol:li,transformer:us,tuple:ki,undefined:di,union:bi,unknown:pi,void:yi,NEVER:$i,ZodIssueCode:v,quotelessJson:Wa,ZodError:Ce});const Pn=m.tuple([m.number(),m.number()]),Ls=m.object({width:m.number(),height:m.number()}),zi=m.object({signedWidth:m.number(),signedHeight:m.number()}),Vi=["width","height"];m.enum(Vi);const Wi=["start","center","end"],Fi=["signedWidth","signedHeight"];m.enum(Fi);const Wr=m.object({x:m.number(),y:m.number()}),Ki=m.object({clientX:m.number(),clientY:m.number()}),Yi=["x","y"],$s=m.enum(Yi),zs=["top","right","bottom","left"];m.enum(zs);const qi=["left","right"],Vs=m.enum(qi),Gi=["top","bottom"],Ws=m.enum(Gi),Fs=["center"],cs=m.enum(Fs),Ji=[...zs,...Fs],Ks=m.enum(Ji);m.enum(Wi);const Hi=["first","last"];m.enum(Hi);const Xi=m.object({lower:m.number(),upper:m.number()});m.union([Xi,Pn]);m.union([$s,Ks]);m.union([$s,Ks,m.instanceof(String)]);const yn=(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),Qi(t)},Qi=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},W={},rn={};Object.defineProperty(rn,"__esModule",{value:!0});function eo(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()}):""}rn.default=eo;var nn={};Object.defineProperty(nn,"__esModule",{value:!0});function to(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():""}nn.default=to;var sn={};Object.defineProperty(sn,"__esModule",{value:!0});function ro(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()}):""}sn.default=ro;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});function no(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():""}Dn.default=no;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});function so(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():""}Bn.default=so;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});function ao(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():""}Ln.default=ao;var $n={};Object.defineProperty($n,"__esModule",{value:!0});function io(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)}$n.default=io;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});function oo(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}):""}zn.default=oo;var an={};Object.defineProperty(an,"__esModule",{value:!0});function uo(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():""}an.default=uo;var Vn={},St={};(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})}})(St);var co=Ie&&Ie.__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(Vn,"__esModule",{value:!0});var We=St;function Or(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=n.toLowerCase();e.recursive&&(We.isValidObject(s)?We.belongToTypes(s,e.keepTypesOnRecursion)||(s=Or(s,e)):e.recursiveInArray&&We.isArrayObject(s)&&(s=co(s).map(function(i){var o=i;if(We.isValidObject(i))We.belongToTypes(o,e.keepTypesOnRecursion)||(o=Or(i,e));else if(We.isArrayObject(i)){var u=Or({key:i},e);o=u.key}return o}))),t[a]=s}),t}Vn.default=Or;var Wn={},lo=Ie&&Ie.__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(Wn,"__esModule",{value:!0});var Fe=St;function Tr(r,e){if(e===void 0&&(e=Fe.DefaultOption),!Fe.isValidObject(r))return null;e=Fe.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toUpperCase();e.recursive&&(Fe.isValidObject(s)?Fe.belongToTypes(s,e.keepTypesOnRecursion)||(s=Tr(s,e)):e.recursiveInArray&&Fe.isArrayObject(s)&&(s=lo(s).map(function(i){var o=i;if(Fe.isValidObject(i))Fe.belongToTypes(o,e.keepTypesOnRecursion)||(o=Tr(i,e));else if(Fe.isArrayObject(i)){var u=Tr({key:i},e);o=u.key}return o}))),t[a]=s}),t}Wn.default=Tr;var Fn={},ho=Ie&&Ie.__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(Fn,"__esModule",{value:!0});var Ke=St,fo=rn;function Sr(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=fo.default(n);e.recursive&&(Ke.isValidObject(s)?Ke.belongToTypes(s,e.keepTypesOnRecursion)||(s=Sr(s,e)):e.recursiveInArray&&Ke.isArrayObject(s)&&(s=ho(s).map(function(i){var o=i;if(Ke.isValidObject(i))Ke.belongToTypes(o,e.keepTypesOnRecursion)||(o=Sr(i,e));else if(Ke.isArrayObject(i)){var u=Sr({key:i},e);o=u.key}return o}))),t[a]=s}),t}Fn.default=Sr;var Kn={},po=Ie&&Ie.__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(Kn,"__esModule",{value:!0});var Ye=St,mo=nn;function Nr(r,e){if(e===void 0&&(e=Ye.DefaultOption),!Ye.isValidObject(r))return null;e=Ye.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=mo.default(n);e.recursive&&(Ye.isValidObject(s)?Ye.belongToTypes(s,e.keepTypesOnRecursion)||(s=Nr(s,e)):e.recursiveInArray&&Ye.isArrayObject(s)&&(s=po(s).map(function(i){var o=i;if(Ye.isValidObject(i))Ye.belongToTypes(o,e.keepTypesOnRecursion)||(o=Nr(i,e));else if(Ye.isArrayObject(i)){var u=Nr({key:i},e);o=u.key}return o}))),t[a]=s}),t}Kn.default=Nr;var Yn={},yo=Ie&&Ie.__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(Yn,"__esModule",{value:!0});var qe=St,go=sn;function Ir(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=go.default(n);e.recursive&&(qe.isValidObject(s)?qe.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ir(s,e)):e.recursiveInArray&&qe.isArrayObject(s)&&(s=yo(s).map(function(i){var o=i;if(qe.isValidObject(i))qe.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ir(i,e));else if(qe.isArrayObject(i)){var u=Ir({key:i},e);o=u.key}return o}))),t[a]=s}),t}Yn.default=Ir;var qn={},vo=Ie&&Ie.__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 Ge=St,_o=an;function Ar(r,e){if(e===void 0&&(e=Ge.DefaultOption),!Ge.isValidObject(r))return null;e=Ge.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=_o.default(n);e.recursive&&(Ge.isValidObject(s)?Ge.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ar(s,e)):e.recursiveInArray&&Ge.isArrayObject(s)&&(s=vo(s).map(function(i){var o=i;if(Ge.isValidObject(i))Ge.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ar(i,e));else if(Ge.isArrayObject(i)){var u=Ar({key:i},e);o=u.key}return o}))),t[a]=s}),t}qn.default=Ar;Object.defineProperty(W,"__esModule",{value:!0});W.kebabKeys=W.pascalKeys=W.snakeKeys=W.camelKeys=W.upperKeys=W.lowerKeys=W.toLowerCase=W.toUpperCase=W.toKebabCase=W.toHeaderCase=W.toSentenceCase=W.toTextCase=W.toPathCase=W.toDotCase=W.toPascalCase=W.toSnakeCase=W.toCamelCase=void 0;var Ys=rn;W.toCamelCase=Ys.default;var qs=nn;W.toSnakeCase=qs.default;var Gs=sn;W.toPascalCase=Gs.default;var Js=Dn;W.toDotCase=Js.default;var Hs=Bn;W.toPathCase=Hs.default;var Xs=Ln;W.toTextCase=Xs.default;var Qs=$n;W.toSentenceCase=Qs.default;var ea=zn;W.toHeaderCase=ea.default;var ta=an;W.toKebabCase=ta.default;var ra=Vn;W.lowerKeys=ra.default;var na=Wn;W.upperKeys=na.default;var sa=Fn;W.camelKeys=sa.default;var aa=Kn;W.snakeKeys=aa.default;var ia=Yn;W.pascalKeys=ia.default;var oa=qn;W.kebabKeys=oa.default;var ua=function(r){return String(r||"").toLowerCase()};W.toLowerCase=ua;var ca=function(r){return String(r||"").toUpperCase()};W.toUpperCase=ca;var bo={toCamelCase:Ys.default,toSnakeCase:qs.default,toPascalCase:Gs.default,toDotCase:Js.default,toPathCase:Hs.default,toTextCase:Xs.default,toSentenceCase:Qs.default,toHeaderCase:ea.default,toKebabCase:ta.default,toUpperCase:ca,toLowerCase:ua,lowerKeys:ra.default,upperKeys:na.default,camelKeys:sa.default,snakeKeys:aa.default,pascalKeys:ia.default,kebabKeys:oa.default};W.default=bo;var la=W;const da={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},wo=r=>la.snakeKeys(r,da),xo=r=>la.camelKeys(r,da);var Ut;(r=>{r.toSnake=wo,r.toCamel=xo,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Ut||(Ut={}));m.object({x:Vs.or(cs),y:Ws.or(cs)});const ko=m.object({x:Vs,y:Ws}),Oo=Object.freeze({x:"left",y:"top"}),To=(r,e)=>r.x===e.x&&r.y===e.y,ls=m.union([m.number(),Wr,Pn,Ls,zi,Ki]),So=(r,e)=>{if(typeof r=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return r==="x"?{x:e,y:0}:{x:0,y:e}}return 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}},ds={x:0,y:0},_r=m.union([m.number(),m.string()]);m.object({top:_r,left:_r,width:_r,height:_r});m.object({left:m.number(),top:m.number(),right:m.number(),bottom:m.number()});m.object({one:Wr,two:Wr,root:ko});const Gn=(r,e,t=0,n=0,s)=>{const a={one:{...ds},two:{...ds},root:s??Oo};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))},gn=r=>{const e=Gn(r);return{lower:e.one.x,upper:e.two.x}},vn=r=>{const e=Gn(r);return{lower:e.one.y,upper:e.two.y}},No=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Io=m.object({signedWidth:m.number(),signedHeight:m.number()});m.union([Ls,Io,Wr,Pn]);const Ao=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);m.object({offset:ls,scale:ls});const Eo=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Co=r=>(e,t,n,s)=>[e,s?n/r:n*r],Zo=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,u=a-s,d=o-i;if(t==="dimension")return[r,n*(d/u)];const p=(n-s)*(d/u)+i;return[r,p]},jo=r=>(e,t,n)=>[r,n],Ro=()=>(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)]},Uo=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Ao(n,s,a),[e,n]},Sn=class Bt{constructor(){w(this,"ops",[]),w(this,"currBounds",null),w(this,"currType",null),w(this,"reversed",!1),this.ops=[]}static translate(e){return new Bt().translate(e)}static magnify(e){return new Bt().magnify(e)}static scale(e,t){return new Bt().scale(e,t)}translate(e){const t=this.new(),n=Eo(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Co(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=yn(e,t),s=this.new(),a=Zo(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=yn(e,t),s=this.new(),a=Uo(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=yn(e,t),s=this.new(),a=jo(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Ro();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 Bt;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}};w(Sn,"IDENTITY",new Sn);let hs=Sn;const fs=class Je{constructor(e=new hs,t=new hs,n=null){w(this,"x"),w(this,"y"),w(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Je().translate(e,t)}static translateX(e){return new Je().translateX(e)}static translateY(e){return new Je().translateY(e)}static clamp(e){return new Je().clamp(e)}static magnify(e){return new Je().magnify(e)}static scale(e){return new Je().scale(e)}static reBound(e){return new Je().reBound(e)}translate(e,t){const n=So(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(No(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!To(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(gn(e)),t.y=t.y.scale(vn(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(gn(e)),t.y=this.y.reBound(vn(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(gn(e)),t.y=this.y.clamp(vn(e)),t}copy(){const e=new Je;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 Gn(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};w(fs,"IDENTITY",new fs);const ha=(r,e)=>{const t=new Oe(e);if(![we.DAY,we.HOUR,we.MINUTE,we.SECOND,we.MILLISECOND,we.MICROSECOND,we.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 Oe?new Oe(n):new we(n)},Q=class M{constructor(e,t="UTC"){if(w(this,"value"),w(this,"encodeValue",!0),e==null)this.value=M.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*M.MILLISECOND.valueOf();else if(typeof e=="string")this.value=M.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=M.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=M.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=M.MAX:e=M.MIN)),this.value=BigInt(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 M(BigInt(s.getTime())*M.MILLISECOND.valueOf()).truncate(M.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let i="00",o="00";a!=null&&([i,o]=a.split("."));let u=M.hours(parseInt(n??"00",10)).add(M.minutes(parseInt(s??"00",10))).add(M.seconds(parseInt(i??"00",10))).add(M.milliseconds(parseInt(o??"00",10)));return t==="local"&&(u=u.add(M.utcOffset)),u.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return M.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new M(BigInt(n.getTime())*M.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(M.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 we(BigInt(new Date().getTimezoneOffset())*M.MINUTE.valueOf())}static since(e){return new M().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new M(e).valueOf()}span(e){return this.range(e).span}range(e){return new Mo(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new M(e).valueOf()}afterEq(e){return this.valueOf()>=new M(e).valueOf()}before(e){return this.valueOf()<new M(e).valueOf()}beforeEq(e){return this.valueOf()<=new M(e).valueOf()}add(e){return new M(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new M(this.valueOf()-BigInt(e.valueOf()))}milliseconds(){return Number(this.valueOf()/M.MILLISECOND.valueOf())}toString(){return this.date().toISOString()}remainder(e){return ha(this,e)}get isToday(){return this.truncate(we.DAY).equals(M.now().truncate(we.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new M(new Date)}static max(...e){let t=M.MIN;for(const n of e){const s=new M(n);s.after(t)&&(t=s)}return t}static min(...e){let t=M.MAX;for(const n of e){const s=new M(n);s.before(t)&&(t=s)}return t}static nanoseconds(e){return new M(e)}static microseconds(e){return M.nanoseconds(e*1e3)}static milliseconds(e){return M.microseconds(e*1e3)}static seconds(e){return M.milliseconds(e*1e3)}static minutes(e){return M.seconds(e*60)}static hours(e){return M.minutes(e*60)}static days(e){return M.hours(e*24)}};w(Q,"NANOSECOND",Q.nanoseconds(1)),w(Q,"MICROSECOND",Q.microseconds(1)),w(Q,"MILLISECOND",Q.milliseconds(1)),w(Q,"SECOND",Q.seconds(1)),w(Q,"MINUTE",Q.minutes(1)),w(Q,"HOUR",Q.hours(1)),w(Q,"DAY",Q.days(1)),w(Q,"MAX",new Q((1n<<63n)-1n)),w(Q,"MIN",new Q(0)),w(Q,"ZERO",new Q(0)),w(Q,"z",m.union([m.object({value:m.bigint()}).transform(r=>new Q(r.value)),m.string().transform(r=>new Q(BigInt(r))),m.instanceof(Number).transform(r=>new Q(r)),m.number().transform(r=>new Q(r)),m.instanceof(Q)]));let Oe=Q;const ee=class G{constructor(e){w(this,"value"),w(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new G(e).valueOf()}greaterThan(e){return this.valueOf()>new G(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new G(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new G(e).valueOf()}remainder(e){return ha(this,e)}truncate(e){return new G(BigInt(Math.trunc(Number(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),u=e,d=t.sub(e),p=n.sub(t),A=s.sub(n),J=a.sub(s),ne=i.sub(a),pe=o.sub(i);let H="";return u.isZero||(H+=`${u.days}d `),d.isZero||(H+=`${d.hours}h `),p.isZero||(H+=`${p.minutes}m `),A.isZero||(H+=`${A.seconds}s `),J.isZero||(H+=`${J.milliseconds}ms `),ne.isZero||(H+=`${ne.microseconds}µs `),pe.isZero||(H+=`${pe.nanoseconds}ns`),H.trim()}get days(){return Number(this.valueOf()/G.DAY.valueOf())}get hours(){return Number(this.valueOf()/G.HOUR.valueOf())}get minutes(){return Number(this.valueOf()/G.MINUTE.valueOf())}get seconds(){return Number(this.valueOf()/G.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf()/G.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf()/G.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(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)}};w(ee,"NANOSECOND",ee.nanoseconds(1)),w(ee,"MICROSECOND",ee.microseconds(1)),w(ee,"MILLISECOND",ee.milliseconds(1)),w(ee,"SECOND",ee.seconds(1)),w(ee,"MINUTE",ee.minutes(1)),w(ee,"HOUR",ee.hours(1)),w(ee,"DAY",ee.days(1)),w(ee,"MAX",new ee((1n<<63n)-1n)),w(ee,"MIN",new ee(0)),w(ee,"ZERO",new ee(0)),w(ee,"z",m.union([m.object({value:m.bigint()}).transform(r=>new ee(r.value)),m.string().transform(r=>new ee(BigInt(r))),m.instanceof(Number).transform(r=>new ee(r)),m.number().transform(r=>new ee(r)),m.instanceof(ee)]));let we=ee;const br=class Er extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Er(e).valueOf()}get period(){return we.seconds(1/this.valueOf())}sampleCount(e){return new we(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new be(t).valueOf()}span(e){return we.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Er(e)}static khz(e){return Er.hz(e*1e3)}};w(br,"z",m.union([m.number().transform(r=>new br(r)),m.instanceof(Number).transform(r=>new br(r)),m.instanceof(br)]));const me=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Po(e*this.valueOf())}};w(me,"UNKNOWN",new me(0)),w(me,"BIT128",new me(16)),w(me,"BIT64",new me(8)),w(me,"BIT32",new me(4)),w(me,"BIT16",new me(2)),w(me,"BIT8",new me(1)),w(me,"z",m.union([m.number().transform(r=>new me(r)),m.instanceof(Number).transform(r=>new me(r)),m.instanceof(me)]));let be=me;const Pe=class Cr{constructor(e,t){w(this,"start"),w(this,"end"),this.start=new Oe(e),this.end=new Oe(t)}get span(){return new we(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 Cr(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 Cr?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Cr(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}};w(Pe,"MAX",new Pe(Oe.MIN,Oe.MAX)),w(Pe,"MIN",new Pe(Oe.MAX,Oe.MIN)),w(Pe,"ZERO",new Pe(Oe.ZERO,Oe.ZERO)),w(Pe,"z",m.union([m.object({start:Oe.z,end:Oe.z}).transform(r=>new Pe(r.start,r.end)),m.instanceof(Pe)]));let Mo=Pe;const y=class He extends String{constructor(e){if(e instanceof He||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=He.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(He.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=He.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 isVariable(){return this.equals(He.JSON)||this.equals(He.STRING)}get density(){const e=He.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 He.BIG_INT_TYPES.some(e=>e.equals(this))}};w(y,"UNKNOWN",new y("unknown")),w(y,"FLOAT64",new y("float64")),w(y,"FLOAT32",new y("float32")),w(y,"INT64",new y("int64")),w(y,"INT32",new y("int32")),w(y,"INT16",new y("int16")),w(y,"INT8",new y("int8")),w(y,"UINT64",new y("uint64")),w(y,"UINT32",new y("uint32")),w(y,"UINT16",new y("uint16")),w(y,"UINT8",new y("uint8")),w(y,"BOOLEAN",y.UINT8),w(y,"TIMESTAMP",new y("timestamp")),w(y,"UUID",new y("uuid")),w(y,"STRING",new y("string")),w(y,"JSON",new y("json")),w(y,"ARRAY_CONSTRUCTORS",new Map([[y.UINT8.toString(),Uint8Array],[y.UINT16.toString(),Uint16Array],[y.UINT32.toString(),Uint32Array],[y.UINT64.toString(),BigUint64Array],[y.FLOAT32.toString(),Float32Array],[y.FLOAT64.toString(),Float64Array],[y.INT8.toString(),Int8Array],[y.INT16.toString(),Int16Array],[y.INT32.toString(),Int32Array],[y.INT64.toString(),BigInt64Array],[y.TIMESTAMP.toString(),BigInt64Array],[y.STRING.toString(),Uint8Array],[y.JSON.toString(),Uint8Array],[y.UUID.toString(),Uint8Array]])),w(y,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,y.UINT8],[Uint16Array.name,y.UINT16],[Uint32Array.name,y.UINT32],[BigUint64Array.name,y.UINT64],[Float32Array.name,y.FLOAT32],[Float64Array.name,y.FLOAT64],[Int8Array.name,y.INT8],[Int16Array.name,y.INT16],[Int32Array.name,y.INT32],[BigInt64Array.name,y.INT64]])),w(y,"DENSITIES",new Map([[y.UINT8.toString(),be.BIT8],[y.UINT16.toString(),be.BIT16],[y.UINT32.toString(),be.BIT32],[y.UINT64.toString(),be.BIT64],[y.FLOAT32.toString(),be.BIT32],[y.FLOAT64.toString(),be.BIT64],[y.INT8.toString(),be.BIT8],[y.INT16.toString(),be.BIT16],[y.INT32.toString(),be.BIT32],[y.INT64.toString(),be.BIT64],[y.TIMESTAMP.toString(),be.BIT64],[y.STRING.toString(),be.UNKNOWN],[y.JSON.toString(),be.UNKNOWN],[y.UUID.toString(),be.BIT128]])),w(y,"ALL",[y.UNKNOWN,y.FLOAT64,y.FLOAT32,y.INT64,y.INT32,y.INT16,y.INT8,y.UINT64,y.UINT32,y.UINT16,y.UINT8,y.TIMESTAMP,y.UUID,y.STRING,y.JSON]),w(y,"BIG_INT_TYPES",[y.INT64,y.UINT64,y.TIMESTAMP]),w(y,"z",m.union([m.string().transform(r=>new y(r)),m.instanceof(y)]));const ye=class de extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return de.bytes(this.valueOf()+e.valueOf())}sub(e){return de.bytes(this.valueOf()-e.valueOf())}truncate(e){return new de(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return de.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/de.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/de.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/de.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/de.TERABYTE.valueOf()}toString(){const e=this.truncate(de.TERABYTE),t=this.truncate(de.GIGABYTE),n=this.truncate(de.MEGABYTE),s=this.truncate(de.KILOBYTE),a=this.truncate(de.BYTE),i=e,o=t.sub(e),u=n.sub(t),d=s.sub(n),p=a.sub(s);let A="";return i.isZero||(A+=`${i.terabytes}TB `),o.isZero||(A+=`${o.gigabytes}GB `),u.isZero||(A+=`${u.megabytes}MB `),d.isZero||(A+=`${d.kilobytes}KB `),(!p.isZero||A==="")&&(A+=`${p.valueOf()}B`),A.trim()}static bytes(e=1){return new de(e)}static kilobytes(e=1){return de.bytes(e.valueOf()*1e3)}static megabytes(e=1){return de.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return de.megabytes(e.valueOf()*1e3)}static terabytes(e){return de.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};w(ye,"BYTE",new ye(1)),w(ye,"KILOBYTE",ye.kilobytes(1)),w(ye,"MEGABYTE",ye.megabytes(1)),w(ye,"GIGABYTE",ye.gigabytes(1)),w(ye,"TERABYTE",ye.terabytes(1)),w(ye,"ZERO",new ye(0)),w(ye,"z",m.union([m.number().transform(r=>new ye(r)),m.instanceof(ye)]));let Po=ye;m.union([m.instanceof(Uint8Array),m.instanceof(Uint16Array),m.instanceof(Uint32Array),m.instanceof(BigUint64Array),m.instanceof(Float32Array),m.instanceof(Float64Array),m.instanceof(Int8Array),m.instanceof(Int16Array),m.instanceof(Int32Array),m.instanceof(BigInt64Array)]);m.record(m.union([m.number(),m.string(),m.symbol()]),m.unknown());const Do=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),fa=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Bo=fa(),pa=["MacOS","Windows","Linux","Docker"],Lo=m.enum(pa);let _n;const $o=()=>{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"},zo=(r={})=>{const{force:e,default:t}=r;return e??_n??(_n=$o(),_n??t)},ma=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:pa,RUNTIME:Bo,detect:fa,getOS:zo,osZ:Lo},Symbol.toStringTag,{value:"Module"})),Vo=(...r)=>r.map(ya).join(""),ya=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),Wo=r=>r.endsWith("/")?r.slice(0,-1):r,Fo=(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("&");var Nt;let Ko=(Nt=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){w(this,"protocol"),w(this,"host"),w(this,"port"),w(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=ya(n)}replace(r){return new Nt({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new Nt({...this,pathPrefix:Vo(this.path,r)})}toString(){return Wo(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},w(Nt,"UNKNOWN",new Nt({host:"unknown",port:0})),Nt);var Nn;try{Nn=new TextDecoder}catch{}var x,Ne,c=0,re={},K,ut,Se=0,De=0,fe,et,Te=[],F,ps={useRecords:!1,mapsAsObjects:!0};class ga{}const va=new ga;va.name="MessagePack 0xC1";var ct=!1,_a=2,ms;try{new Function("")}catch{_a=1/0}class Xt{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 Oa(()=>(An(),this?this.unpack(e,t):Xt.prototype.unpack.call(ps,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Ne=t.end||e.length,c=t.start||0):(c=0,Ne=t>-1?t:e.length),De=0,ut=null,fe=null,x=e;try{F=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 Xt){if(re=this,this.structures)return K=this.structures,wr(t);(!K||K.length>0)&&(K=[])}else re=ps,(!K||K.length>0)&&(K=[]);return wr(t)}unpackMultiple(e,t){let n,s=0;try{ct=!0;let a=e.length,i=this?this.unpack(e,a):on.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{ct=!1,An()}}_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(!re.trusted&&!ct){let t=K.sharedLength||0;t<K.length&&(K.length=t)}let e;if(re.randomAccessStructure&&x[c]<64&&x[c]>=32&&ms?(e=ms(x,c,Ne,re),x=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),c=Ne):e=ce(),fe&&(c=fe.postBundlePosition,fe=null),ct&&(K.restoreStructures=null),c==Ne)K&&K.restoreStructures&&ys(),K=null,x=null,et&&(et=null);else{if(c>Ne)throw new Error("Unexpected end of MessagePack data");if(!ct){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&&ys(),An(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||c>Ne)&&(e.incomplete=!0),e}}function ys(){for(let r in K.restoreStructures)K[r]=K.restoreStructures[r];K.restoreStructures=null}function ce(){let r=x[c++];if(r<160)if(r<128){if(r<64)return r;{let e=K[r&63]||re.getStructures&&ba()[r&63];return e?(e.read||(e.read=Jn(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=xa();n==="__proto__"&&(n="__proto_"),e[n]=ce()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(ce(),ce());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=ce();return re.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(De>=c)return ut.slice(c-Se,(c+=e)-Se);if(De==0&&Ne<140){let t=e<16?Hn(e):wa(e);if(t!=null)return t}return In(e)}else{let e;switch(r){case 192:return null;case 193:return fe?(e=ce(),e>0?fe[1].slice(fe.position1,fe.position1+=e):fe[0].slice(fe.position0,fe.position0-=e)):va;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 bn(e);case 197:return e=F.getUint16(c),c+=2,bn(e);case 198:return e=F.getUint32(c),c+=4,bn(e);case 199:return gt(x[c++]);case 200:return e=F.getUint16(c),c+=2,gt(e);case 201:return e=F.getUint32(c),c+=4,gt(e);case 202:if(e=F.getFloat32(c),re.useFloat32>2){let t=Xn[(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=F.getFloat64(c),c+=8,e;case 204:return x[c++];case 205:return e=F.getUint16(c),c+=2,e;case 206:return e=F.getUint32(c),c+=4,e;case 207:return re.int64AsType==="number"?(e=F.getUint32(c)*4294967296,e+=F.getUint32(c+4)):re.int64AsType==="string"?e=F.getBigUint64(c).toString():re.int64AsType==="auto"?(e=F.getBigUint64(c),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=F.getBigUint64(c),c+=8,e;case 208:return F.getInt8(c++);case 209:return e=F.getInt16(c),c+=2,e;case 210:return e=F.getInt32(c),c+=4,e;case 211:return re.int64AsType==="number"?(e=F.getInt32(c)*4294967296,e+=F.getUint32(c+4)):re.int64AsType==="string"?e=F.getBigInt64(c).toString():re.int64AsType==="auto"?(e=F.getBigInt64(c),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=F.getBigInt64(c),c+=8,e;case 212:if(e=x[c++],e==114)return xs(x[c++]&63);{let t=Te[e];if(t)return t.read?(c++,t.read(ce())):t.noBuffer?(c++,t()):t(x.subarray(c,++c));throw new Error("Unknown extension "+e)}case 213:return e=x[c],e==114?(c++,xs(x[c++]&63,x[c++])):gt(2);case 214:return gt(4);case 215:return gt(8);case 216:return gt(16);case 217:return e=x[c++],De>=c?ut.slice(c-Se,(c+=e)-Se):qo(e);case 218:return e=F.getUint16(c),c+=2,De>=c?ut.slice(c-Se,(c+=e)-Se):Go(e);case 219:return e=F.getUint32(c),c+=4,De>=c?ut.slice(c-Se,(c+=e)-Se):Jo(e);case 220:return e=F.getUint16(c),c+=2,vs(e);case 221:return e=F.getUint32(c),c+=4,vs(e);case 222:return e=F.getUint16(c),c+=2,_s(e);case 223:return e=F.getUint32(c),c+=4,_s(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 Yo=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Jn(r,e){function t(){if(t.count++>_a){let s=r.read=new Function("r","return function(){return "+(re.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":Yo.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(ce);return r.highByte===0&&(r.read=gs(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]=ce()}return re.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?gs(e,t):t}const gs=(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]||ba()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=Jn(s,r)),s.read()};function ba(){let r=Oa(()=>(x=null,re.getStructures()));return K=re._mergeStructures(r,K)}var In=pr,qo=pr,Go=pr,Jo=pr;function pr(r){let e;if(r<16&&(e=Hn(r)))return e;if(r>64&&Nn)return Nn.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 u=(s&7)<<18|a<<12|i<<6|o;u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u)}else n.push(s);n.length>=4096&&(e+=he.apply(String,n),n.length=0)}return n.length>0&&(e+=he.apply(String,n)),e}function vs(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=ce();return re.freezeData?Object.freeze(e):e}function _s(r){if(re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=xa();n==="__proto__"&&(n="__proto_"),e[n]=ce()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(ce(),ce());return e}}var he=String.fromCharCode;function wa(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 he.apply(String,t)}function Hn(r){if(r<4)if(r<2){if(r===0)return"";{let e=x[c++];if((e&128)>1){c-=1;return}return he(e)}}else{let e=x[c++],t=x[c++];if((e&128)>0||(t&128)>0){c-=2;return}if(r<3)return he(e,t);let n=x[c++];if((n&128)>0){c-=3;return}return he(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 he(e,t,n,s);{let a=x[c++];if((a&128)>0){c-=5;return}return he(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 he(e,t,n,s,a,i);let o=x[c++];if((o&128)>0){c-=7;return}return he(e,t,n,s,a,i,o)}else{let a=x[c++],i=x[c++],o=x[c++],u=x[c++];if((a&128)>0||(i&128)>0||(o&128)>0||(u&128)>0){c-=8;return}if(r<10){if(r===8)return he(e,t,n,s,a,i,o,u);{let d=x[c++];if((d&128)>0){c-=9;return}return he(e,t,n,s,a,i,o,u,d)}}else if(r<12){let d=x[c++],p=x[c++];if((d&128)>0||(p&128)>0){c-=10;return}if(r<11)return he(e,t,n,s,a,i,o,u,d,p);let A=x[c++];if((A&128)>0){c-=11;return}return he(e,t,n,s,a,i,o,u,d,p,A)}else{let d=x[c++],p=x[c++],A=x[c++],J=x[c++];if((d&128)>0||(p&128)>0||(A&128)>0||(J&128)>0){c-=12;return}if(r<14){if(r===12)return he(e,t,n,s,a,i,o,u,d,p,A,J);{let ne=x[c++];if((ne&128)>0){c-=13;return}return he(e,t,n,s,a,i,o,u,d,p,A,J,ne)}}else{let ne=x[c++],pe=x[c++];if((ne&128)>0||(pe&128)>0){c-=14;return}if(r<15)return he(e,t,n,s,a,i,o,u,d,p,A,J,ne,pe);let H=x[c++];if((H&128)>0){c-=15;return}return he(e,t,n,s,a,i,o,u,d,p,A,J,ne,pe,H)}}}}}function bs(){let r=x[c++],e;if(r<192)e=r-160;else switch(r){case 217:e=x[c++];break;case 218:e=F.getUint16(c),c+=2;break;case 219:e=F.getUint32(c),c+=4;break;default:throw new Error("Expected string")}return pr(e)}function bn(r){return re.copyBuffers?Uint8Array.prototype.slice.call(x,c,c+=r):x.subarray(c,c+=r)}function gt(r){let e=x[c++];if(Te[e]){let t;return Te[e](x.subarray(c,t=c+=r),n=>{c=n;try{return ce()}finally{c=t}})}else throw new Error("Unknown extension type "+e)}var ws=new Array(4096);function xa(){let r=x[c++];if(r>=160&&r<192){if(r=r-160,De>=c)return ut.slice(c-Se,(c+=r)-Se);if(!(De==0&&Ne<180))return In(r)}else return c--,ce().toString();let e=(r<<5^(r>1?F.getUint16(c):r>0?x[c]:0))&4095,t=ws[e],n=c,s=c+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=F.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=[],ws[e]=t,t.bytes=r;n<s;)a=F.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=x[n++],t.push(a);let o=r<16?Hn(r):wa(r);return o!=null?t.string=o:t.string=In(r)}const xs=(r,e)=>{let t=ce().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||ct)&&((K.restoreStructures||(K.restoreStructures=[]))[r]=s),K[r]=t,t.read=Jn(t,n),t.read()};Te[0]=()=>{};Te[0].noBuffer=!0;let Ho={Error,TypeError,ReferenceError};Te[101]=()=>{let r=ce();return(Ho[r[0]]||Error)(r[1])};Te[105]=r=>{let e=F.getUint32(c-4);et||(et=new Map);let t=x[c],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};et.set(e,s);let a=ce();return s.used?Object.assign(n,a):(s.target=a,a)};Te[112]=r=>{let e=F.getUint32(c-4),t=et.get(e);return t.used=!0,t.target};Te[115]=()=>new Set(ce());const ka=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let Xo=typeof globalThis=="object"?globalThis:window;Te[116]=r=>{let e=r[0],t=ka[e];if(!t)throw new Error("Could not find typed array for code "+e);return new Xo[t](Uint8Array.prototype.slice.call(r,1).buffer)};Te[120]=()=>{let r=ce();return new RegExp(r[0],r[1])};const Qo=[];Te[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=c;return c+=e-r.length,fe=Qo,fe=[bs(),bs()],fe.position0=0,fe.position1=0,fe.postBundlePosition=c,c=t,ce()};Te[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 Oa(r){let e=Ne,t=c,n=Se,s=De,a=ut,i=et,o=fe,u=new Uint8Array(x.slice(0,Ne)),d=K,p=K.slice(0,K.length),A=re,J=ct,ne=r();return Ne=e,c=t,Se=n,De=s,ut=a,et=i,fe=o,x=u,ct=J,K=d,K.splice(0,K.length,...p),re=A,F=new DataView(x.buffer,x.byteOffset,x.byteLength),ne}function An(){x=null,et=null,K=null}const Xn=new Array(147);for(let r=0;r<256;r++)Xn[r]=+("1e"+Math.floor(45.15-r*.30103));var on=new Xt({useRecords:!1});const eu=on.unpack;on.unpackMultiple;on.unpack;let tu=new Float32Array(1);new Uint8Array(tu.buffer,0,4);let Zr;try{Zr=new TextEncoder}catch{}let En,Ta;const un=typeof Buffer<"u",xr=un?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,Sa=un?Buffer:Uint8Array,ks=un?4294967296:2144337920;let h,Dt,te,l=0,_e,se=null,ru;const nu=21760,su=/[\u0080-\uFFFF]/,It=Symbol("record-id");class au extends Xt{constructor(e){super(e),this.offset=0;let t,n,s,a,i=Sa.prototype.utf8Write?function(f,I){return h.utf8Write(f,I,4294967295)}:Zr&&Zr.encodeInto?function(f,I){return Zr.encodeInto(f,h.subarray(I)).written}:!1,o=this;e||(e={});let u=e&&e.sequential,d=e.structures||e.saveStructures,p=e.maxSharedStructures;if(p==null&&(p=d?32:0),p>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let A=e.maxOwnStructures;A==null&&(A=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let J=p>32||A+p>64,ne=p+64,pe=p+A+64;if(pe>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let H=[],hn=0,gr=0;this.pack=this.encode=function(f,I){if(h||(h=new xr(8192),te=h.dataView||(h.dataView=new DataView(h.buffer,0,8192)),l=0),_e=h.length-10,_e-l<2048?(h=new xr(h.length),te=h.dataView||(h.dataView=new DataView(h.buffer,0,h.length)),_e=h.length-10,l=0):l=l+7&2147483640,t=l,I&hu&&(l+=I&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof f!="string"?(se=[],se.size=1/0):se=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 b=0;b<g;b++){let k=s[b];if(!k)continue;let z,V=s.transitions;for(let R=0,ue=k.length;R<ue;R++){let X=k[R];z=V[X],z||(z=V[X]=Object.create(null)),V=z}V[It]=b+64}this.lastNamedStructuresLength=g}u||(s.nextId=g+64)}n&&(n=!1);try{o.randomAccessStructure&&f&&f.constructor&&f.constructor===Object?Ba(f):oe(f);let g=se;if(se&&Ss(t,oe,0),a&&a.idsToInsert){let b=a.idsToInsert.sort((R,ue)=>R.offset>ue.offset?1:-1),k=b.length,z=-1;for(;g&&k>0;){let R=b[--k].offset+t;R<g.stringsPosition+t&&z===-1&&(z=0),R>g.position+t?z>=0&&(z+=6):(z>=0&&(te.setUint32(g.position+t,te.getUint32(g.position+t)+z),z=-1),g=g.previous,k++)}z>=0&&g&&te.setUint32(g.position+t,te.getUint32(g.position+t)+z),l+=b.length*6,l>_e&&st(l),o.offset=l;let V=ou(h.subarray(t,l),b);return a=null,V}return o.offset=l,I&lu?(h.start=t,h.end=l,h):h.subarray(t,l)}finally{if(s&&(rs(),n&&o.saveStructures)){let g=s.sharedLength||0,b=h.subarray(t,l),k=uu(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(f,I):(o.lastNamedStructuresLength=g,b)}I&du&&(l=t)}};const rs=()=>{gr<10&&gr++;let f=s.sharedLength||0;if(s.length>f&&!u&&(s.length=f),hn>1e4)s.transitions=null,gr=0,hn=0,H.length>0&&(H=[]);else if(H.length>0&&!u){for(let I=0,g=H.length;I<g;I++)H[I][It]=0;H=[]}},fn=f=>{var I=f.length;I<16?h[l++]=144|I:I<65536?(h[l++]=220,h[l++]=I>>8,h[l++]=I&255):(h[l++]=221,te.setUint32(l,I),l+=4);for(let g=0;g<I;g++)oe(f[g])},oe=f=>{l>_e&&(h=st(l));var I=typeof f,g;if(I==="string"){let b=f.length;if(se&&b>=4&&b<4096){if((se.size+=b)>nu){let R,ue=(se[0]?se[0].length*3+se[1].length:0)+10;l+ue>_e&&(h=st(l+ue));let X;se.position?(X=se,h[l]=200,l+=3,h[l++]=98,R=l-t,l+=4,Ss(t,oe,0),te.setUint16(R+t-3,l-t-R)):(h[l++]=214,h[l++]=98,R=l-t,l+=4),se=["",""],se.previous=X,se.size=0,se.position=R}let V=su.test(f);se[V?0:1]+=f,h[l++]=193,oe(V?-b:b);return}let k;b<32?k=1:b<256?k=2:b<65536?k=3:k=5;let z=b*3;if(l+z>_e&&(h=st(l+z)),b<64||!i){let V,R,ue,X=l+k;for(V=0;V<b;V++)R=f.charCodeAt(V),R<128?h[X++]=R:R<2048?(h[X++]=R>>6|192,h[X++]=R&63|128):(R&64512)===55296&&((ue=f.charCodeAt(V+1))&64512)===56320?(R=65536+((R&1023)<<10)+(ue&1023),V++,h[X++]=R>>18|240,h[X++]=R>>12&63|128,h[X++]=R>>6&63|128,h[X++]=R&63|128):(h[X++]=R>>12|224,h[X++]=R>>6&63|128,h[X++]=R&63|128);g=X-l-k}else g=i(f,l+k);g<32?h[l++]=160|g:g<256?(k<2&&h.copyWithin(l+2,l+1,l+1+g),h[l++]=217,h[l++]=g):g<65536?(k<3&&h.copyWithin(l+3,l+2,l+2+g),h[l++]=218,h[l++]=g>>8,h[l++]=g&255):(k<5&&h.copyWithin(l+5,l+3,l+3+g),h[l++]=219,te.setUint32(l,g),l+=4),l+=g}else if(I==="number")if(f>>>0===f)f<32||f<128&&this.useRecords===!1||f<64&&!this.randomAccessStructure?h[l++]=f:f<256?(h[l++]=204,h[l++]=f):f<65536?(h[l++]=205,h[l++]=f>>8,h[l++]=f&255):(h[l++]=206,te.setUint32(l,f),l+=4);else if(f>>0===f)f>=-32?h[l++]=256+f:f>=-128?(h[l++]=208,h[l++]=f+256):f>=-32768?(h[l++]=209,te.setInt16(l,f),l+=2):(h[l++]=210,te.setInt32(l,f),l+=4);else{let b;if((b=this.useFloat32)>0&&f<4294967296&&f>=-2147483648){h[l++]=202,te.setFloat32(l,f);let k;if(b<4||(k=f*Xn[(h[l]&127)<<1|h[l+1]>>7])>>0===k){l+=4;return}else l--}h[l++]=203,te.setFloat64(l,f),l+=8}else if(I==="object"||I==="function")if(!f)h[l++]=192;else{if(a){let k=a.get(f);if(k){if(!k.id){let z=a.idsToInsert||(a.idsToInsert=[]);k.id=z.push(k)}h[l++]=214,h[l++]=112,te.setUint32(l,k.id),l+=4;return}else a.set(f,{offset:l-t})}let b=f.constructor;if(b===Object)vr(f,!0);else if(b===Array)fn(f);else if(b===Map)if(this.mapAsEmptyObject)h[l++]=128;else{g=f.size,g<16?h[l++]=128|g:g<65536?(h[l++]=222,h[l++]=g>>8,h[l++]=g&255):(h[l++]=223,te.setUint32(l,g),l+=4);for(let[k,z]of f)oe(k),oe(z)}else{for(let k=0,z=En.length;k<z;k++){let V=Ta[k];if(f instanceof V){let R=En[k];if(R.write){R.type&&(h[l++]=212,h[l++]=R.type,h[l++]=0);let at=R.write.call(this,f);at===f?Array.isArray(f)?fn(f):vr(f):oe(at);return}let ue=h,X=te,Ve=l;h=null;let yt;try{yt=R.pack.call(this,f,at=>(h=ue,ue=null,l+=at,l>_e&&st(l),{target:h,targetView:te,position:l-at}),oe)}finally{ue&&(h=ue,te=X,l=Ve,_e=h.length-10)}yt&&(yt.length+l>_e&&st(yt.length+l),l=iu(yt,h,l,R.type));return}}if(Array.isArray(f))fn(f);else{if(f.toJSON){const k=f.toJSON();if(k!==f)return oe(k)}if(I==="function")return oe(this.writeFunction&&this.writeFunction(f));vr(f,!f.hasOwnProperty)}}}else if(I==="boolean")h[l++]=f?195:194;else if(I==="bigint"){if(f<BigInt(1)<<BigInt(63)&&f>=-(BigInt(1)<<BigInt(63)))h[l++]=211,te.setBigInt64(l,f);else if(f<BigInt(1)<<BigInt(64)&&f>0)h[l++]=207,te.setBigUint64(l,f);else if(this.largeBigIntToFloat)h[l++]=203,te.setFloat64(l,Number(f));else throw new RangeError(f+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");l+=8}else if(I==="undefined")this.encodeUndefinedAsNil?h[l++]=192:(h[l++]=212,h[l++]=0,h[l++]=0);else throw new Error("Unknown type: "+I)},ns=this.variableMapSize||this.coercibleKeyAsNumber?f=>{let I=Object.keys(f),g=I.length;g<16?h[l++]=128|g:g<65536?(h[l++]=222,h[l++]=g>>8,h[l++]=g&255):(h[l++]=223,te.setUint32(l,g),l+=4);let b;if(this.coercibleKeyAsNumber)for(let k=0;k<g;k++){b=I[k];let z=Number(b);oe(isNaN(z)?b:z),oe(f[b])}else for(let k=0;k<g;k++)oe(b=I[k]),oe(f[b])}:(f,I)=>{h[l++]=222;let g=l-t;l+=2;let b=0;for(let k in f)(I||f.hasOwnProperty(k))&&(oe(k),oe(f[k]),b++);h[g+++t]=b>>8,h[g+t]=b&255},ss=this.useRecords===!1?ns:e.progressiveRecords&&!J?(f,I)=>{let g,b=s.transitions||(s.transitions=Object.create(null)),k=l++-t,z;for(let V in f)if(I||f.hasOwnProperty(V)){if(g=b[V],g)b=g;else{let R=Object.keys(f),ue=b;b=s.transitions;let X=0;for(let Ve=0,yt=R.length;Ve<yt;Ve++){let at=R[Ve];g=b[at],g||(g=b[at]=Object.create(null),X++),b=g}k+t+1==l?(l--,pn(b,R,X)):is(b,R,k,X),z=!0,b=ue[V]}oe(f[V])}if(!z){let V=b[It];V?h[k+t]=V:is(b,Object.keys(f),k,0)}}:(f,I)=>{let g,b=s.transitions||(s.transitions=Object.create(null)),k=0;for(let V in f)(I||f.hasOwnProperty(V))&&(g=b[V],g||(g=b[V]=Object.create(null),k++),b=g);let z=b[It];z?z>=96&&J?(h[l++]=((z-=96)&31)+96,h[l++]=z>>5):h[l++]=z:pn(b,b.__keys__||Object.keys(f),k);for(let V in f)(I||f.hasOwnProperty(V))&&oe(f[V])},as=typeof this.useRecords=="function"&&this.useRecords,vr=as?(f,I)=>{as(f)?ss(f,I):ns(f,I)}:ss,st=f=>{let I;if(f>16777216){if(f-t>ks)throw new Error("Packed buffer would be larger than maximum buffer size");I=Math.min(ks,Math.round(Math.max((f-t)*(f>67108864?1.25:2),4194304)/4096)*4096)}else I=(Math.max(f-t<<2,h.length-1)>>12)+1<<12;let g=new xr(I);return te=g.dataView||(g.dataView=new DataView(g.buffer,0,I)),f=Math.min(f,h.length),h.copy?h.copy(g,0,t,f):g.set(h.slice(t,f)),l-=t,t=0,_e=g.length-10,h=g},pn=(f,I,g)=>{let b=s.nextId;b||(b=64),b<ne&&this.shouldShareStructure&&!this.shouldShareStructure(I)?(b=s.nextOwnId,b<pe||(b=ne),s.nextOwnId=b+1):(b>=pe&&(b=ne),s.nextId=b+1);let k=I.highByte=b>=96&&J?b-96>>5:-1;f[It]=b,f.__keys__=I,s[b-64]=I,b<ne?(I.isShared=!0,s.sharedLength=b-63,n=!0,k>=0?(h[l++]=(b&31)+96,h[l++]=k):h[l++]=b):(k>=0?(h[l++]=213,h[l++]=114,h[l++]=(b&31)+96,h[l++]=k):(h[l++]=212,h[l++]=114,h[l++]=b),g&&(hn+=gr*g),H.length>=A&&(H.shift()[It]=0),H.push(f),oe(I))},is=(f,I,g,b)=>{let k=h,z=l,V=_e,R=t;h=Dt,l=0,t=0,h||(Dt=h=new xr(8192)),_e=h.length-10,pn(f,I,b),Dt=h;let ue=l;if(h=k,l=z,_e=V,t=R,ue>1){let X=l+ue-1;X>_e&&st(X);let Ve=g+t;h.copyWithin(Ve+ue,Ve+1,l),h.set(Dt.slice(0,ue),Ve),l=X}else h[g+t]=Dt[0]},Ba=(f,I)=>{let g=ru(f,h,t,l,s,st,(b,k,z)=>{if(z)return n=!0;l=k;let V=h;return oe(b),rs(),V!==h?{position:l,targetView:te,target:h}:l},this);if(g===0)return vr(f,!0);l=g}}useBuffer(e){h=e,te=new DataView(h.buffer,h.byteOffset,h.byteLength),l=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}Ta=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,ga];En=[{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?Os(r,16,e):Ts(un?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==Sa&&this.moreTypes?Os(r,ka.indexOf(t.name),e):Ts(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function Os(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 Ts(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 iu(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 ou(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 Ss(r,e,t){if(se.length>0){te.setUint32(se.position+r,l+t-se.position-r),se.stringsPosition=l-r;let n=se;se=null,e(n[0]),e(n[1])}}function uu(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Na=new au({useRecords:!1});const cu=Na.pack;Na.pack;const lu=512,du=1024,hu=2048;class fu{constructor(){w(this,"contentType","application/msgpack")}encode(e){return cu(Ut.toSnake(e))}decode(e,t){const n=Ut.toCamel(eu(new Uint8Array(e)));return t!=null?t.parse(n):n}}class pu{constructor(){w(this,"contentType","application/json"),w(this,"decoder"),this.decoder=new TextDecoder}encode(e){const t=JSON.stringify(Ut.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):Do(s)&&"encode_value"in s?typeof s.value=="bigint"?s.value.toString():s.value:typeof s=="bigint"?s.toString():s);return new TextEncoder().encode(t)}decode(e,t){const n=Ut.toCamel(JSON.parse(this.decoder.decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new fu,new pu;var q;(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})(q||(q={}));var Cn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Cn||(Cn={}));const T=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ot=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}},_=q.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"]),mu=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class je 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,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.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()}}je.create=r=>new je(r);const Qt=(r,e)=>{let t;switch(r.code){case _.invalid_type:r.received===T.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case _.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,q.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:t=`Unrecognized key(s) in object: ${q.joinValues(r.keys,", ")}`;break;case _.invalid_union:t="Invalid input";break;case _.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${q.joinValues(r.options)}`;break;case _.invalid_enum_value:t=`Invalid enum value. Expected ${q.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}"`:q.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,q.assertNever(r)}return{message:t}};let Ia=Qt;function yu(r){Ia=r}function Fr(){return Ia}const Kr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},gu=[];function N(r,e){const t=Kr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Fr(),Qt].filter(n=>!!n)});r.common.issues.push(t)}class ve{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 ve.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"}),Aa=r=>({status:"dirty",value:r}),ke=r=>({status:"valid",value:r}),Zn=r=>r.status==="aborted",jn=r=>r.status==="dirty",er=r=>r.status==="valid",Yr=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={}));class $e{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 Ns=(r,e)=>{if(er(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 je(r.common.issues);return this._error=t,this._error}}};function B(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 ${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 ot(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ot(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:ot(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Yr(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:ot(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Ns(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:ot(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Yr(s)?s:Promise.resolve(s));return Ns(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(u=>u?!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 Me({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return tt.create(this,this._def)}nullable(){return Tt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Re.create(this,this._def)}promise(){return Pt.create(this,this._def)}or(e){return sr.create([this,e],this._def)}and(e){return ar.create(this,e,this._def)}transform(e){return new Me({...B(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new lr({...B(this._def),innerType:this,defaultValue:t,typeName:j.ZodDefault})}brand(){return new Ca({typeName:j.ZodBranded,type:this,...B(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Hr({...B(this._def),innerType:this,catchValue:t,typeName:j.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return mr.create(this,e)}readonly(){return Qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vu=/^c[^\s-]{8,}$/i,_u=/^[a-z][a-z0-9]*$/,bu=/^[0-9A-HJKMNP-TV-Z]{26}$/,wu=/^[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,xu=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ku="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wn;const Ou=/^(((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}))$/,Tu=/^(([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})))$/,Su=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 Nu(r,e){return!!((e==="v4"||!e)&&Ou.test(r)||(e==="v6"||!e)&&Tu.test(r))}class Ee extends ${_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==T.string){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:T.string,received:a.parsedType}),U}const n=new ve;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")xu.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")wn||(wn=new RegExp(ku,"u")),wn.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")wu.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")vu.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")_u.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")bu.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"?Su(a).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Nu(e.data,a.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:_.invalid_string,message:a.message}),n.dirty()):q.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,...C.errToObj(n)})}_addCheck(e){return new Ee({...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 Ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ee({...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}}Ee.create=r=>{var e;return new Ee({checks:[],typeName:j.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...B(r)})};function Iu(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 ft extends ${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 N(a,{code:_.invalid_type,expected:T.number,received:a.parsedType}),U}let n;const s=new ve;for(const a of this._def.checks)a.kind==="int"?q.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"?Iu(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()):q.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 ft({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new ft({...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"&&q.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)}}ft.create=r=>new ft({checks:[],typeName:j.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...B(r)});class pt extends ${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 N(a,{code:_.invalid_type,expected:T.bigint,received:a.parsedType}),U}let n;const s=new ve;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()):q.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 pt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new pt({...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}}pt.create=r=>{var e;return new pt({checks:[],typeName:j.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...B(r)})};class tr extends ${_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==T.boolean){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.boolean,received:n.parsedType}),U}return ke(e.data)}}tr.create=r=>new tr({typeName:j.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...B(r)});class kt extends ${_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==T.date){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:T.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 ve;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()):q.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new kt({...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}}kt.create=r=>new kt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:j.ZodDate,...B(r)});class qr extends ${_parse(e){if(this._getType(e)!==T.symbol){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.symbol,received:n.parsedType}),U}return ke(e.data)}}qr.create=r=>new qr({typeName:j.ZodSymbol,...B(r)});class rr extends ${_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.undefined,received:n.parsedType}),U}return ke(e.data)}}rr.create=r=>new rr({typeName:j.ZodUndefined,...B(r)});class nr extends ${_parse(e){if(this._getType(e)!==T.null){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.null,received:n.parsedType}),U}return ke(e.data)}}nr.create=r=>new nr({typeName:j.ZodNull,...B(r)});class Mt extends ${constructor(){super(...arguments),this._any=!0}_parse(e){return ke(e.data)}}Mt.create=r=>new Mt({typeName:j.ZodAny,...B(r)});class _t extends ${constructor(){super(...arguments),this._unknown=!0}_parse(e){return ke(e.data)}}_t.create=r=>new _t({typeName:j.ZodUnknown,...B(r)});class nt extends ${_parse(e){const t=this._getOrReturnCtx(e);return N(t,{code:_.invalid_type,expected:T.never,received:t.parsedType}),U}}nt.create=r=>new nt({typeName:j.ZodNever,...B(r)});class Gr extends ${_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.void,received:n.parsedType}),U}return ke(e.data)}}Gr.create=r=>new Gr({typeName:j.ZodVoid,...B(r)});class Re extends ${_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==T.array)return N(t,{code:_.invalid_type,expected:T.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 $e(t,i,t.path,o)))).then(i=>ve.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new $e(t,i,t.path,o)));return ve.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Re({...this._def,minLength:{value:e,message:C.toString(t)}})}max(e,t){return new Re({...this._def,maxLength:{value:e,message:C.toString(t)}})}length(e,t){return new Re({...this._def,exactLength:{value:e,message:C.toString(t)}})}nonempty(e){return this.min(1,e)}}Re.create=(r,e)=>new Re({type:r,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...B(e)});function Et(r){if(r instanceof ie){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=tt.create(Et(n))}return new ie({...r._def,shape:()=>e})}else return r instanceof Re?new Re({...r._def,type:Et(r.element)}):r instanceof tt?tt.create(Et(r.unwrap())):r instanceof Tt?Tt.create(Et(r.unwrap())):r instanceof ze?ze.create(r.items.map(e=>Et(e))):r}class ie extends ${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=q.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==T.object){const d=this._getOrReturnCtx(e);return N(d,{code:_.invalid_type,expected:T.object,received:d.parsedType}),U}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof nt&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||o.push(d);const u=[];for(const d of i){const p=a[d],A=s.data[d];u.push({key:{status:"valid",value:d},value:p._parse(new $e(s,A,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof nt){const d=this._def.unknownKeys;if(d==="passthrough")for(const p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")o.length>0&&(N(s,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const p of o){const A=s.data[p];u.push({key:{status:"valid",value:p},value:d._parse(new $e(s,A,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const p of u){const A=await p.key;d.push({key:A,value:await p.value,alwaysSet:p.alwaysSet})}return d}).then(d=>ve.mergeObjectSync(n,d)):ve.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new ie({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(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:u}:{message:u}}}:{}})}strip(){return new ie({...this._def,unknownKeys:"strip"})}passthrough(){return new ie({...this._def,unknownKeys:"passthrough"})}extend(e){return new ie({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ie({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:j.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ie({...this._def,catchall:e})}pick(e){const t={};return q.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ie({...this._def,shape:()=>t})}omit(e){const t={};return q.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ie({...this._def,shape:()=>t})}deepPartial(){return Et(this)}partial(e){const t={};return q.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new ie({...this._def,shape:()=>t})}required(e){const t={};return q.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof tt;)a=a._def.innerType;t[n]=a}}),new ie({...this._def,shape:()=>t})}keyof(){return Ea(q.objectKeys(this.shape))}}ie.create=(r,e)=>new ie({shape:()=>r,unknownKeys:"strip",catchall:nt.create(),typeName:j.ZodObject,...B(e)});ie.strictCreate=(r,e)=>new ie({shape:()=>r,unknownKeys:"strict",catchall:nt.create(),typeName:j.ZodObject,...B(e)});ie.lazycreate=(r,e)=>new ie({shape:r,unknownKeys:"strip",catchall:nt.create(),typeName:j.ZodObject,...B(e)});class sr extends ${_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 je(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 u of n){const d={...t,common:{...t.common,issues:[]},parent:null},p=u._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new je(u));return N(t,{code:_.invalid_union,unionErrors:o}),U}}get options(){return this._def.options}}sr.create=(r,e)=>new sr({options:r,typeName:j.ZodUnion,...B(e)});const jr=r=>r instanceof or?jr(r.schema):r instanceof Me?jr(r.innerType()):r instanceof ur?[r.value]:r instanceof mt?r.options:r instanceof cr?Object.keys(r.enum):r instanceof lr?jr(r._def.innerType):r instanceof rr?[void 0]:r instanceof nr?[null]:null;class cn extends ${_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.object)return N(t,{code:_.invalid_type,expected:T.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 cn({typeName:j.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...B(n)})}}function Rn(r,e){const t=ot(r),n=ot(e);if(r===e)return{valid:!0,data:r};if(t===T.object&&n===T.object){const s=q.objectKeys(e),a=q.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const u=Rn(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.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],u=Rn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===T.date&&n===T.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ar extends ${_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Zn(a)||Zn(i))return U;const o=Rn(a.value,i.value);return o.valid?((jn(a)||jn(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}))}}ar.create=(r,e,t)=>new ar({left:r,right:e,typeName:j.ZodIntersection,...B(t)});class ze extends ${_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.array)return N(n,{code:_.invalid_type,expected:T.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 u=this._def.items[o]||this._def.rest;return u?u._parse(new $e(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>ve.mergeArray(t,i)):ve.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ze({...this._def,rest:e})}}ze.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ze({items:r,typeName:j.ZodTuple,rest:null,...B(e)})};class ir extends ${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 N(n,{code:_.invalid_type,expected:T.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 $e(n,o,n.path,o)),value:i._parse(new $e(n,n.data[o],n.path,o))});return n.common.async?ve.mergeObjectAsync(t,s):ve.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof $?new ir({keyType:e,valueType:t,typeName:j.ZodRecord,...B(n)}):new ir({keyType:Ee.create(),valueType:e,typeName:j.ZodRecord,...B(t)})}}class Jr extends ${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 N(n,{code:_.invalid_type,expected:T.map,received:n.parsedType}),U;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:s._parse(new $e(n,o,n.path,[d,"key"])),value:a._parse(new $e(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return U;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return U;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}}}}Jr.create=(r,e,t)=>new Jr({valueType:e,keyType:r,typeName:j.ZodMap,...B(t)});class Ot extends ${_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.set)return N(n,{code:_.invalid_type,expected:T.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(u){const d=new Set;for(const p of u){if(p.status==="aborted")return U;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((u,d)=>a._parse(new $e(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new Ot({...this._def,minSize:{value:e,message:C.toString(t)}})}max(e,t){return new Ot({...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)}}Ot.create=(r,e)=>new Ot({valueType:r,minSize:null,maxSize:null,typeName:j.ZodSet,...B(e)});class Zt extends ${constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.function)return N(t,{code:_.invalid_type,expected:T.function,received:t.parsedType}),U;function n(o,u){return Kr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fr(),Qt].filter(d=>!!d),issueData:{code:_.invalid_arguments,argumentsError:u}})}function s(o,u){return Kr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Fr(),Qt].filter(d=>!!d),issueData:{code:_.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Pt){const o=this;return ke(async function(...u){const d=new je([]),p=await o._def.args.parseAsync(u,a).catch(ne=>{throw d.addIssue(n(u,ne)),d}),A=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(A,a).catch(ne=>{throw d.addIssue(s(A,ne)),d})})}else{const o=this;return ke(function(...u){const d=o._def.args.safeParse(u,a);if(!d.success)throw new je([n(u,d.error)]);const p=Reflect.apply(i,this,d.data),A=o._def.returns.safeParse(p,a);if(!A.success)throw new je([s(p,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Zt({...this._def,args:ze.create(e).rest(_t.create())})}returns(e){return new Zt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Zt({args:e||ze.create([]).rest(_t.create()),returns:t||_t.create(),typeName:j.ZodFunction,...B(n)})}}class or extends ${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})}}or.create=(r,e)=>new or({getter:r,typeName:j.ZodLazy,...B(e)});class ur extends ${_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}}ur.create=(r,e)=>new ur({value:r,typeName:j.ZodLiteral,...B(e)});function Ea(r,e){return new mt({values:r,typeName:j.ZodEnum,...B(e)})}class mt extends ${_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return N(t,{expected:q.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 ke(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 mt.create(e)}exclude(e){return mt.create(this.options.filter(t=>!e.includes(t)))}}mt.create=Ea;class cr extends ${_parse(e){const t=q.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==T.string&&n.parsedType!==T.number){const s=q.objectValues(t);return N(n,{expected:q.joinValues(s),received:n.parsedType,code:_.invalid_type}),U}if(t.indexOf(e.data)===-1){const s=q.objectValues(t);return N(n,{received:n.data,code:_.invalid_enum_value,options:s}),U}return ke(e.data)}get enum(){return this._def.values}}cr.create=(r,e)=>new cr({values:r,typeName:j.ZodNativeEnum,...B(e)});class Pt extends ${unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.promise&&t.common.async===!1)return N(t,{code:_.invalid_type,expected:T.promise,received:t.parsedType}),U;const n=t.parsedType===T.promise?t.data:Promise.resolve(t.data);return ke(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Pt.create=(r,e)=>new Pt({type:r,typeName:j.ZodPromise,...B(e)});class Me extends ${innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.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 u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u 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(!er(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=>er(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);q.assertNever(s)}}Me.create=(r,e,t)=>new Me({schema:r,typeName:j.ZodEffects,effect:e,...B(t)});Me.createWithPreprocess=(r,e,t)=>new Me({schema:e,effect:{type:"preprocess",transform:r},typeName:j.ZodEffects,...B(t)});class tt extends ${_parse(e){return this._getType(e)===T.undefined?ke(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tt.create=(r,e)=>new tt({innerType:r,typeName:j.ZodOptional,...B(e)});class Tt extends ${_parse(e){return this._getType(e)===T.null?ke(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tt.create=(r,e)=>new Tt({innerType:r,typeName:j.ZodNullable,...B(e)});class lr extends ${_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}}lr.create=(r,e)=>new lr({innerType:r,typeName:j.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...B(e)});class Hr extends ${_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 Yr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new je(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new je(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Hr.create=(r,e)=>new Hr({innerType:r,typeName:j.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...B(e)});class Xr extends ${_parse(e){if(this._getType(e)!==T.nan){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.nan,received:n.parsedType}),U}return{status:"valid",value:e.data}}}Xr.create=r=>new Xr({typeName:j.ZodNaN,...B(r)});const Au=Symbol("zod_brand");class Ca extends ${_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 mr extends ${_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(),Aa(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 mr({in:e,out:t,typeName:j.ZodPipeline})}}class Qr extends ${_parse(e){const t=this._def.innerType._parse(e);return er(t)&&(t.value=Object.freeze(t.value)),t}}Qr.create=(r,e)=>new Qr({innerType:r,typeName:j.ZodReadonly,...B(e)});const Za=(r,e={},t)=>r?Mt.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:u})}}):Mt.create(),Eu={object:ie.lazycreate};var j;(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"})(j||(j={}));const Cu=(r,e={message:`Input not instance of ${r.name}`})=>Za(t=>t instanceof r,e),ja=Ee.create,Ra=ft.create,Zu=Xr.create,ju=pt.create,Ua=tr.create,Ru=kt.create,Uu=qr.create,Mu=rr.create,Pu=nr.create,Du=Mt.create,Bu=_t.create,Lu=nt.create,$u=Gr.create,zu=Re.create,Vu=ie.create,Wu=ie.strictCreate,Fu=sr.create,Ku=cn.create,Yu=ar.create,qu=ze.create,Gu=ir.create,Ju=Jr.create,Hu=Ot.create,Xu=Zt.create,Qu=or.create,ec=ur.create,tc=mt.create,rc=cr.create,nc=Pt.create,Is=Me.create,sc=tt.create,ac=Tt.create,ic=Me.createWithPreprocess,oc=mr.create,uc=()=>ja().optional(),cc=()=>Ra().optional(),lc=()=>Ua().optional(),dc={string:r=>Ee.create({...r,coerce:!0}),number:r=>ft.create({...r,coerce:!0}),boolean:r=>tr.create({...r,coerce:!0}),bigint:r=>pt.create({...r,coerce:!0}),date:r=>kt.create({...r,coerce:!0})},hc=U;var Xe=Object.freeze({__proto__:null,defaultErrorMap:Qt,setErrorMap:yu,getErrorMap:Fr,makeIssue:Kr,EMPTY_PATH:gu,addIssueToContext:N,ParseStatus:ve,INVALID:U,DIRTY:Aa,OK:ke,isAborted:Zn,isDirty:jn,isValid:er,isAsync:Yr,get util(){return q},get objectUtil(){return Cn},ZodParsedType:T,getParsedType:ot,ZodType:$,ZodString:Ee,ZodNumber:ft,ZodBigInt:pt,ZodBoolean:tr,ZodDate:kt,ZodSymbol:qr,ZodUndefined:rr,ZodNull:nr,ZodAny:Mt,ZodUnknown:_t,ZodNever:nt,ZodVoid:Gr,ZodArray:Re,ZodObject:ie,ZodUnion:sr,ZodDiscriminatedUnion:cn,ZodIntersection:ar,ZodTuple:ze,ZodRecord:ir,ZodMap:Jr,ZodSet:Ot,ZodFunction:Zt,ZodLazy:or,ZodLiteral:ur,ZodEnum:mt,ZodNativeEnum:cr,ZodPromise:Pt,ZodEffects:Me,ZodTransformer:Me,ZodOptional:tt,ZodNullable:Tt,ZodDefault:lr,ZodCatch:Hr,ZodNaN:Xr,BRAND:Au,ZodBranded:Ca,ZodPipeline:mr,ZodReadonly:Qr,custom:Za,Schema:$,ZodSchema:$,late:Eu,get ZodFirstPartyTypeKind(){return j},coerce:dc,any:Du,array:zu,bigint:ju,boolean:Ua,date:Ru,discriminatedUnion:Ku,effect:Is,enum:tc,function:Xu,instanceof:Cu,intersection:Yu,lazy:Qu,literal:ec,map:Ju,nan:Zu,nativeEnum:rc,never:Lu,null:Pu,nullable:ac,number:Ra,object:Vu,oboolean:lc,onumber:cc,optional:sc,ostring:uc,pipeline:oc,preprocess:ic,promise:nc,record:Gu,set:Hu,strictObject:Wu,string:ja,symbol:Uu,transformer:Is,tuple:qu,undefined:Mu,union:Fu,unknown:Bu,void:$u,NEVER:hc,ZodIssueCode:_,quotelessJson:mu,ZodError:je});class yr extends Error{constructor(t,n){super(t);le(this,"discriminator","FreighterError");le(this,"type");this.type=n}}const fc=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},Un="unknown",As="nil",ln="freighter",Qn=Xe.object({type:Xe.string(),data:Xe.string()});class pc{constructor(){le(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:As,data:""};if(fc(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Un,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===As)return null;if(e.type===Un)return new Es(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Es(e.data)}}const es=new pc,Ma=({encode:r,decode:e})=>es.register({encode:r,decode:e}),mc=r=>es.encode(r),ts=r=>es.decode(r);class Es extends yr{constructor(e){super(e,Un)}}class dr extends yr{constructor(){super("EOF",ln)}}class hr extends yr{constructor(){super("StreamClosed",ln)}}class dn extends yr{constructor(t={}){const{message:n="Unreachable",url:s=Ko.UNKNOWN}=t;super(n,ln);le(this,"url");this.url=s}}const Rr="freighter",yc=r=>{if(r.type!==ln)return null;if(r instanceof dr)return{type:Rr,data:"EOF"};if(r instanceof hr)return{type:Rr,data:"StreamClosed"};if(r instanceof dn)return{type:Rr,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},gc=r=>{if(r.type!==Rr)return null;switch(r.data){case"EOF":return new dr;case"StreamClosed":return new hr;case"Unreachable":return new dn;default:throw new Error(`Unknown error type: ${r.data}`)}};Ma({encode:yc,decode:gc});class Pa{constructor(){le(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 Da="Content-Type",Cs=r=>{if(ma.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 vc extends Pa{constructor(t,n,s=!1){super();le(this,"endpoint");le(this,"encoder");le(this,"fetch");return this.endpoint=t.replace({protocol:s?"https":"http"}),this.encoder=n,this.fetch=Cs(this.endpoint.protocol),new Proxy(this,{get:(a,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(a,i,o)})}get headers(){return{[Da]:this.encoder.contentType}}async send(t,n,s,a){n=s==null?void 0:s.parse(n);let i=null;const o=this.endpoint.child(t),u={};u.method="POST",u.body=this.encoder.encode(n??{});const[,d]=await this.executeMiddleware({target:o.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async p=>{const A={...p,params:{}};u.headers={...this.headers,...p.params};let J;try{J=await Cs(p.protocol)(p.target,u)}catch(pe){let H=pe;return H.message==="Load failed"&&(H=new dn({url:o})),[A,H]}const ne=await J.arrayBuffer();if(J!=null&&J.ok)return a!=null&&(i=this.encoder.decode(ne,a)),[A,null];try{if(J.status!==400)return[A,new Error(J.statusText)];const pe=this.encoder.decode(ne,Qn),H=ts(pe);return[A,H]}catch(pe){return[A,new Error(`[freighter] - failed to decode error: ${J.statusText}: ${pe.message}`)]}});return[i,d]}}const _c=async(r,e,t,n,s)=>{const[a,i]=await r.send(e,t,n,s);if(i!=null)throw i;return a},bc=()=>ma.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),wc=Xe.object({type:Xe.union([Xe.literal("data"),Xe.literal("close")]),payload:Xe.unknown().optional(),error:Xe.optional(Qn)});class xc{constructor(e,t,n,s){le(this,"encoder");le(this,"reqSchema");le(this,"resSchema");le(this,"ws");le(this,"serverClosed");le(this,"sendClosed");le(this,"receiveDataQueue",[]);le(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 dr;if(this.sendClosed)throw new hr;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=ts(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,wc),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=Nc(e)?new dr:new hr}}}const kc="freighterctx",Oc=1e3,Tc=1001,Sc=[Oc,Tc],Nc=r=>Sc.includes(r.code),en=class en extends Pa{constructor(t,n,s=!1){super();le(this,"baseUrl");le(this,"encoder");this.baseUrl=t.replace({protocol:s?"wss":"ws"}),this.encoder=n}async stream(t,n,s){const a=bc();let i;const[,o]=await this.executeMiddleware({target:t,protocol:"websocket",params:{},role:"client"},async u=>{const d=a(this.buildURL(t,u)),p={...u,params:{}};d.binaryType=en.MESSAGE_TYPE;const A=await this.wrapSocket(d,n,s);return A instanceof Error?[p,A]:(i=A,[p,null])});if(o!=null)throw o;return i}buildURL(t,n){const s=Fo({[Da]:this.encoder.contentType,...n.params},kc);return this.baseUrl.child(t).toString()+s}async wrapSocket(t,n,s){return await new Promise(a=>{t.onopen=()=>{a(new xc(t,this.encoder,n,s))},t.onerror=i=>{const o=i;a(new Error(o.message))}})}};le(en,"MESSAGE_TYPE","arraybuffer");let Mn=en;exports.BaseTypedError=yr;exports.EOF=dr;exports.HTTPClient=vc;exports.StreamClosed=hr;exports.Unreachable=dn;exports.WebSocketClient=Mn;exports.decodeError=ts;exports.encodeError=mc;exports.errorZ=Qn;exports.registerError=Ma;exports.sendRequired=_c;
|
|
1
|
+
"use strict";var La=Object.defineProperty;var $a=(r,e,t)=>e in r?La(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var le=(r,e,t)=>($a(r,typeof e!="symbol"?e+"":e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var za=Object.defineProperty,Va=(r,e,t)=>e in r?za(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,w=(r,e,t)=>(Va(r,typeof e!="symbol"?e+"":e,t),t),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 xn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(xn||(xn={}));const O=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),it=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}},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"]),Fa=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class Ce 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,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};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 Lt=(r,e)=>{let t;switch(r.code){case v.invalid_type:r.received===O.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 Zs=Lt;function Ka(r){Zs=r}function Ur(){return Zs}const Mr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},Wa=[];function S(r,e){const t=Mr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ur(),Lt].filter(n=>!!n)});r.common.issues.push(t)}class ge{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 P;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 ge.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 P;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 P=Object.freeze({status:"aborted"}),js=r=>({status:"dirty",value:r}),xe=r=>({status:"valid",value:r}),kn=r=>r.status==="aborted",On=r=>r.status==="dirty",$t=r=>r.status==="valid",Pr=r=>typeof Promise<"u"&&r instanceof Promise;var E;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(E||(E={}));class De{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 os=(r,e)=>{if($t(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 B(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:(a,i)=>a.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:t??i.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 it(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:it(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ge,ctx:{common:e.parent.common,data:e.data,parsedType:it(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:it(e)},a=this._parseSync({data:e,path:s.path,parent:s});return os(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:it(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Pr(s)?s:Promise.resolve(s));return os(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(u=>u?!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 Ue({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Qe.create(this,this._def)}nullable(){return xt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ze.create(this,this._def)}promise(){return Rt.create(this,this._def)}or(e){return Kt.create([this,e],this._def)}and(e){return Wt.create(this,e,this._def)}transform(e){return new Ue({...B(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ht({...B(this._def),innerType:this,defaultValue:t,typeName:Z.ZodDefault})}brand(){return new Us({typeName:Z.ZodBranded,type:this,...B(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new $r({...B(this._def),innerType:this,catchValue:t,typeName:Z.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return fr.create(this,e)}readonly(){return Vr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ya=/^c[^\s-]{8,}$/i,qa=/^[a-z][a-z0-9]*$/,Ga=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ja=/^[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,Ha=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let mn;const Qa=/^(((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}))$/,ei=/^(([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})))$/,ti=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 ri(r,e){return!!((e==="v4"||!e)&&Qa.test(r)||(e==="v6"||!e)&&ei.test(r))}class Ae extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==O.string){const s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.string,received:s.parsedType}),P}const t=new ge;let n;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(n=this._getOrReturnCtx(e,n),a?S(n,{code:v.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&S(n,{code:v.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Ha.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"email",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")mn||(mn=new RegExp(Xa,"u")),mn.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"emoji",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Ja.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"uuid",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")Ya.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")qa.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"cuid2",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")Ga.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"ulid",code:v.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),S(n,{validation:"url",code:v.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"regex",code:v.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?ti(s).test(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="ip"?ri(e.data,s.version)||(n=this._getOrReturnCtx(e,n),S(n,{validation:"ip",code:v.invalid_string,message:s.message}),t.dirty()):Y.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:v.invalid_string,...E.errToObj(n)})}_addCheck(e){return new Ae({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.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,...E.errToObj(e==null?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...E.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new Ae({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ae({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ae({...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}}Ae.create=r=>{var e;return new Ae({checks:[],typeName:Z.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...B(r)})};function ni(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 lt 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 s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.number,received:s.parsedType}),P}let t;const n=new ge;for(const s of this._def.checks)s.kind==="int"?Y.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:v.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?ni(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),S(t,{code:v.not_finite,message:s.message}),n.dirty()):Y.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,s){return new lt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(s)}]})}_addCheck(e){return new lt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.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)}}lt.create=r=>new lt({checks:[],typeName:Z.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...B(r)});class dt 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 s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.bigint,received:s.parsedType}),P}let t;const n=new ge;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),S(t,{code:v.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):Y.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,n,s){return new dt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:E.toString(s)}]})}_addCheck(e){return new dt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.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:Z.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...B(r)})};class zt extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==O.boolean){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.boolean,received:t.parsedType}),P}return xe(e.data)}}zt.create=r=>new zt({typeName:Z.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...B(r)});class bt extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==O.date){const s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:O.date,received:s.parsedType}),P}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_date}),P}const t=new ge;let n;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):Y.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new bt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.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:Z.ZodDate,...B(r)});class Br extends L{_parse(e){if(this._getType(e)!==O.symbol){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.symbol,received:t.parsedType}),P}return xe(e.data)}}Br.create=r=>new Br({typeName:Z.ZodSymbol,...B(r)});class Vt extends L{_parse(e){if(this._getType(e)!==O.undefined){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.undefined,received:t.parsedType}),P}return xe(e.data)}}Vt.create=r=>new Vt({typeName:Z.ZodUndefined,...B(r)});class Ft extends L{_parse(e){if(this._getType(e)!==O.null){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.null,received:t.parsedType}),P}return xe(e.data)}}Ft.create=r=>new Ft({typeName:Z.ZodNull,...B(r)});class jt extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return xe(e.data)}}jt.create=r=>new jt({typeName:Z.ZodAny,...B(r)});class vt extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xe(e.data)}}vt.create=r=>new vt({typeName:Z.ZodUnknown,...B(r)});class rt extends L{_parse(e){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.never,received:t.parsedType}),P}}rt.create=r=>new rt({typeName:Z.ZodNever,...B(r)});class Dr extends L{_parse(e){if(this._getType(e)!==O.undefined){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.void,received:t.parsedType}),P}return xe(e.data)}}Dr.create=r=>new Dr({typeName:Z.ZodVoid,...B(r)});class Ze extends L{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==O.array)return S(t,{code:v.invalid_type,expected:O.array,received:t.parsedType}),P;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 De(t,i,t.path,o)))).then(i=>ge.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new De(t,i,t.path,o)));return ge.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Ze({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new Ze({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new Ze({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}Ze.create=(r,e)=>new Ze({type:r,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...B(e)});function At(r){if(r instanceof ae){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=Qe.create(At(n))}return new ae({...r._def,shape:()=>e})}else return r instanceof Ze?new Ze({...r._def,type:At(r.element)}):r instanceof Qe?Qe.create(At(r.unwrap())):r instanceof xt?xt.create(At(r.unwrap())):r instanceof Le?Le.create(r.items.map(e=>At(e))):r}class ae 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=Y.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==O.object){const u=this._getOrReturnCtx(e);return S(u,{code:v.invalid_type,expected:O.object,received:u.parsedType}),P}const{status:t,ctx:n}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof rt&&this._def.unknownKeys==="strip"))for(const u in n.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const d=s[u],p=n.data[u];o.push({key:{status:"valid",value:u},value:d._parse(new De(n,p,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof rt){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of i)o.push({key:{status:"valid",value:d},value:{status:"valid",value:n.data[d]}});else if(u==="strict")i.length>0&&(S(n,{code:v.unrecognized_keys,keys:i}),t.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of i){const p=n.data[d];o.push({key:{status:"valid",value:d},value:u._parse(new De(n,p,n.path,d)),alwaysSet:d in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of o){const p=await d.key;u.push({key:p,value:await d.value,alwaysSet:d.alwaysSet})}return u}).then(u=>ge.mergeObjectSync(t,u)):ge.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new ae({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(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=E.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new ae({...this._def,unknownKeys:"strip"})}passthrough(){return new ae({...this._def,unknownKeys:"passthrough"})}extend(e){return new ae({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ae({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Z.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ae({...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 ae({...this._def,shape:()=>t})}omit(e){const t={};return Y.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ae({...this._def,shape:()=>t})}deepPartial(){return At(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 ae({...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 s=this.shape[n];for(;s instanceof Qe;)s=s._def.innerType;t[n]=s}}),new ae({...this._def,shape:()=>t})}keyof(){return Rs(Y.objectKeys(this.shape))}}ae.create=(r,e)=>new ae({shape:()=>r,unknownKeys:"strip",catchall:rt.create(),typeName:Z.ZodObject,...B(e)});ae.strictCreate=(r,e)=>new ae({shape:()=>r,unknownKeys:"strict",catchall:rt.create(),typeName:Z.ZodObject,...B(e)});ae.lazycreate=(r,e)=>new ae({shape:r,unknownKeys:"strip",catchall:rt.create(),typeName:Z.ZodObject,...B(e)});class Kt 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 Ce(o.ctx.common.issues));return S(t,{code:v.invalid_union,unionErrors:i}),P}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 u of n){const d={...t,common:{...t.common,issues:[]},parent:null},p=u._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new Ce(u));return S(t,{code:v.invalid_union,unionErrors:o}),P}}get options(){return this._def.options}}Kt.create=(r,e)=>new Kt({options:r,typeName:Z.ZodUnion,...B(e)});const kr=r=>r instanceof qt?kr(r.schema):r instanceof Ue?kr(r.innerType()):r instanceof Gt?[r.value]:r instanceof ht?r.options:r instanceof Jt?Object.keys(r.enum):r instanceof Ht?kr(r._def.innerType):r instanceof Vt?[void 0]:r instanceof Ft?[null]:null;class tn extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.object)return S(t,{code:v.invalid_type,expected:O.object,received:t.parsedType}),P;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]}),P)}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 tn({typeName:Z.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...B(n)})}}function Tn(r,e){const t=it(r),n=it(e);if(r===e)return{valid:!0,data:r};if(t===O.object&&n===O.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 u=Tn(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.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],u=Tn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===O.date&&n===O.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Wt extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(kn(a)||kn(i))return P;const o=Tn(a.value,i.value);return o.valid?((On(a)||On(i))&&t.dirty(),{status:t.value,value:o.data}):(S(n,{code:v.invalid_intersection_types}),P)};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:Z.ZodIntersection,...B(t)});class Le extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.array)return S(n,{code:v.invalid_type,expected:O.array,received:n.parsedType}),P;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"}),P;!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 s=[...n.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new De(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>ge.mergeArray(t,a)):ge.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Le({...this._def,rest:e})}}Le.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Le({items:r,typeName:Z.ZodTuple,rest:null,...B(e)})};class Yt 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 S(n,{code:v.invalid_type,expected:O.object,received:n.parsedType}),P;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new De(n,o,n.path,o)),value:i._parse(new De(n,n.data[o],n.path,o))});return n.common.async?ge.mergeObjectAsync(t,s):ge.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof L?new Yt({keyType:e,valueType:t,typeName:Z.ZodRecord,...B(n)}):new Yt({keyType:Ae.create(),valueType:e,typeName:Z.ZodRecord,...B(t)})}}class Lr 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 S(n,{code:v.invalid_type,expected:O.map,received:n.parsedType}),P;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:s._parse(new De(n,o,n.path,[d,"key"])),value:a._parse(new De(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return P;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return P;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}}}}Lr.create=(r,e,t)=>new Lr({valueType:e,keyType:r,typeName:Z.ZodMap,...B(t)});class wt extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==O.set)return S(n,{code:v.invalid_type,expected:O.set,received:n.parsedType}),P;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(u){const d=new Set;for(const p of u){if(p.status==="aborted")return P;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((u,d)=>a._parse(new De(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new wt({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new wt({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}wt.create=(r,e)=>new wt({valueType:r,minSize:null,maxSize:null,typeName:Z.ZodSet,...B(e)});class Ct extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==O.function)return S(t,{code:v.invalid_type,expected:O.function,received:t.parsedType}),P;function n(o,u){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Lt].filter(d=>!!d),issueData:{code:v.invalid_arguments,argumentsError:u}})}function s(o,u){return Mr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Lt].filter(d=>!!d),issueData:{code:v.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Rt){const o=this;return xe(async function(...u){const d=new Ce([]),p=await o._def.args.parseAsync(u,a).catch(J=>{throw d.addIssue(n(u,J)),d}),A=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(A,a).catch(J=>{throw d.addIssue(s(A,J)),d})})}else{const o=this;return xe(function(...u){const d=o._def.args.safeParse(u,a);if(!d.success)throw new Ce([n(u,d.error)]);const p=Reflect.apply(i,this,d.data),A=o._def.returns.safeParse(p,a);if(!A.success)throw new Ce([s(p,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ct({...this._def,args:Le.create(e).rest(vt.create())})}returns(e){return new Ct({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ct({args:e||Le.create([]).rest(vt.create()),returns:t||vt.create(),typeName:Z.ZodFunction,...B(n)})}}class qt 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})}}qt.create=(r,e)=>new qt({getter:r,typeName:Z.ZodLazy,...B(e)});class Gt extends L{_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}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}}Gt.create=(r,e)=>new Gt({value:r,typeName:Z.ZodLiteral,...B(e)});function Rs(r,e){return new ht({values:r,typeName:Z.ZodEnum,...B(e)})}class ht extends L{_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}),P}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}),P}return xe(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 ht.create(e)}exclude(e){return ht.create(this.options.filter(t=>!e.includes(t)))}}ht.create=Rs;class Jt extends L{_parse(e){const t=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==O.string&&n.parsedType!==O.number){const s=Y.objectValues(t);return S(n,{expected:Y.joinValues(s),received:n.parsedType,code:v.invalid_type}),P}if(t.indexOf(e.data)===-1){const s=Y.objectValues(t);return S(n,{received:n.data,code:v.invalid_enum_value,options:s}),P}return xe(e.data)}get enum(){return this._def.values}}Jt.create=(r,e)=>new Jt({values:r,typeName:Z.ZodNativeEnum,...B(e)});class Rt 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 S(t,{code:v.invalid_type,expected:O.promise,received:t.parsedType}),P;const n=t.parsedType===O.promise?t.data:Promise.resolve(t.data);return xe(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Rt.create=(r,e)=>new Rt({type:r,typeName:Z.ZodPromise,...B(e)});class Ue extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.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 u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u 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"?P:(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"?P:(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(!$t(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=>$t(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);Y.assertNever(s)}}Ue.create=(r,e,t)=>new Ue({schema:r,typeName:Z.ZodEffects,effect:e,...B(t)});Ue.createWithPreprocess=(r,e,t)=>new Ue({schema:e,effect:{type:"preprocess",transform:r},typeName:Z.ZodEffects,...B(t)});class Qe extends L{_parse(e){return this._getType(e)===O.undefined?xe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Qe.create=(r,e)=>new Qe({innerType:r,typeName:Z.ZodOptional,...B(e)});class xt extends L{_parse(e){return this._getType(e)===O.null?xe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xt.create=(r,e)=>new xt({innerType:r,typeName:Z.ZodNullable,...B(e)});class Ht 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}}Ht.create=(r,e)=>new Ht({innerType:r,typeName:Z.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...B(e)});class $r 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 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}}$r.create=(r,e)=>new $r({innerType:r,typeName:Z.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...B(e)});class zr extends L{_parse(e){if(this._getType(e)!==O.nan){const t=this._getOrReturnCtx(e);return S(t,{code:v.invalid_type,expected:O.nan,received:t.parsedType}),P}return{status:"valid",value:e.data}}}zr.create=r=>new zr({typeName:Z.ZodNaN,...B(r)});const si=Symbol("zod_brand");class Us 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 fr extends L{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?P:s.status==="dirty"?(t.dirty(),js(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?P: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 fr({in:e,out:t,typeName:Z.ZodPipeline})}}class Vr extends L{_parse(e){const t=this._def.innerType._parse(e);return $t(t)&&(t.value=Object.freeze(t.value)),t}}Vr.create=(r,e)=>new Vr({innerType:r,typeName:Z.ZodReadonly,...B(e)});const Ms=(r,e={},t)=>r?jt.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:u})}}):jt.create(),ai={object:ae.lazycreate};var Z;(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"})(Z||(Z={}));const ii=(r,e={message:`Input not instance of ${r.name}`})=>Ms(t=>t instanceof r,e),Ps=Ae.create,Bs=lt.create,oi=zr.create,ui=dt.create,Ds=zt.create,ci=bt.create,li=Br.create,di=Vt.create,hi=Ft.create,fi=jt.create,pi=vt.create,mi=rt.create,yi=Dr.create,gi=Ze.create,vi=ae.create,_i=ae.strictCreate,bi=Kt.create,wi=tn.create,xi=Wt.create,ki=Le.create,Oi=Yt.create,Ti=Lr.create,Si=wt.create,Ni=Ct.create,Ii=qt.create,Ai=Gt.create,Ei=ht.create,Ci=Jt.create,Zi=Rt.create,us=Ue.create,ji=Qe.create,Ri=xt.create,Ui=Ue.createWithPreprocess,Mi=fr.create,Pi=()=>Ps().optional(),Bi=()=>Bs().optional(),Di=()=>Ds().optional(),Li={string:r=>Ae.create({...r,coerce:!0}),number:r=>lt.create({...r,coerce:!0}),boolean:r=>zt.create({...r,coerce:!0}),bigint:r=>dt.create({...r,coerce:!0}),date:r=>bt.create({...r,coerce:!0})},$i=P;var m=Object.freeze({__proto__:null,defaultErrorMap:Lt,setErrorMap:Ka,getErrorMap:Ur,makeIssue:Mr,EMPTY_PATH:Wa,addIssueToContext:S,ParseStatus:ge,INVALID:P,DIRTY:js,OK:xe,isAborted:kn,isDirty:On,isValid:$t,isAsync:Pr,get util(){return Y},get objectUtil(){return xn},ZodParsedType:O,getParsedType:it,ZodType:L,ZodString:Ae,ZodNumber:lt,ZodBigInt:dt,ZodBoolean:zt,ZodDate:bt,ZodSymbol:Br,ZodUndefined:Vt,ZodNull:Ft,ZodAny:jt,ZodUnknown:vt,ZodNever:rt,ZodVoid:Dr,ZodArray:Ze,ZodObject:ae,ZodUnion:Kt,ZodDiscriminatedUnion:tn,ZodIntersection:Wt,ZodTuple:Le,ZodRecord:Yt,ZodMap:Lr,ZodSet:wt,ZodFunction:Ct,ZodLazy:qt,ZodLiteral:Gt,ZodEnum:ht,ZodNativeEnum:Jt,ZodPromise:Rt,ZodEffects:Ue,ZodTransformer:Ue,ZodOptional:Qe,ZodNullable:xt,ZodDefault:Ht,ZodCatch:$r,ZodNaN:zr,BRAND:si,ZodBranded:Us,ZodPipeline:fr,ZodReadonly:Vr,custom:Ms,Schema:L,ZodSchema:L,late:ai,get ZodFirstPartyTypeKind(){return Z},coerce:Li,any:fi,array:gi,bigint:ui,boolean:Ds,date:ci,discriminatedUnion:wi,effect:us,enum:Ei,function:Ni,instanceof:ii,intersection:xi,lazy:Ii,literal:Ai,map:Ti,nan:oi,nativeEnum:Ci,never:mi,null:hi,nullable:Ri,number:Bs,object:vi,oboolean:Di,onumber:Bi,optional:ji,ostring:Pi,pipeline:Mi,preprocess:Ui,promise:Zi,record:Oi,set:Si,strictObject:_i,string:Ps,symbol:li,transformer:us,tuple:ki,undefined:di,union:bi,unknown:pi,void:yi,NEVER:$i,ZodIssueCode:v,quotelessJson:Fa,ZodError:Ce});const Pn=m.tuple([m.number(),m.number()]),Ls=m.object({width:m.number(),height:m.number()}),zi=m.object({signedWidth:m.number(),signedHeight:m.number()}),Vi=["width","height"];m.enum(Vi);const Fi=["start","center","end"],Ki=["signedWidth","signedHeight"];m.enum(Ki);const Fr=m.object({x:m.number(),y:m.number()}),Wi=m.object({clientX:m.number(),clientY:m.number()}),Yi=["x","y"],$s=m.enum(Yi),zs=["top","right","bottom","left"];m.enum(zs);const qi=["left","right"],Vs=m.enum(qi),Gi=["top","bottom"],Fs=m.enum(Gi),Ks=["center"],cs=m.enum(Ks),Ji=[...zs,...Ks],Ws=m.enum(Ji);m.enum(Fi);const Hi=["first","last"];m.enum(Hi);const Xi=m.object({lower:m.number(),upper:m.number()});m.union([Xi,Pn]);m.union([$s,Ws]);m.union([$s,Ws,m.instanceof(String)]);const yn=(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),Qi(t)},Qi=r=>r.lower>r.upper?{lower:r.upper,upper:r.lower}:r;var Ie=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},F={},rn={};Object.defineProperty(rn,"__esModule",{value:!0});function eo(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()}):""}rn.default=eo;var nn={};Object.defineProperty(nn,"__esModule",{value:!0});function to(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():""}nn.default=to;var sn={};Object.defineProperty(sn,"__esModule",{value:!0});function ro(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()}):""}sn.default=ro;var Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});function no(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():""}Bn.default=no;var Dn={};Object.defineProperty(Dn,"__esModule",{value:!0});function so(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():""}Dn.default=so;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});function ao(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():""}Ln.default=ao;var $n={};Object.defineProperty($n,"__esModule",{value:!0});function io(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)}$n.default=io;var zn={};Object.defineProperty(zn,"__esModule",{value:!0});function oo(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}):""}zn.default=oo;var an={};Object.defineProperty(an,"__esModule",{value:!0});function uo(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():""}an.default=uo;var Vn={},St={};(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})}})(St);var co=Ie&&Ie.__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(Vn,"__esModule",{value:!0});var Fe=St;function Or(r,e){if(e===void 0&&(e=Fe.DefaultOption),!Fe.isValidObject(r))return null;e=Fe.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=n.toLowerCase();e.recursive&&(Fe.isValidObject(s)?Fe.belongToTypes(s,e.keepTypesOnRecursion)||(s=Or(s,e)):e.recursiveInArray&&Fe.isArrayObject(s)&&(s=co(s).map(function(i){var o=i;if(Fe.isValidObject(i))Fe.belongToTypes(o,e.keepTypesOnRecursion)||(o=Or(i,e));else if(Fe.isArrayObject(i)){var u=Or({key:i},e);o=u.key}return o}))),t[a]=s}),t}Vn.default=Or;var Fn={},lo=Ie&&Ie.__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(Fn,"__esModule",{value:!0});var Ke=St;function Tr(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=n.toUpperCase();e.recursive&&(Ke.isValidObject(s)?Ke.belongToTypes(s,e.keepTypesOnRecursion)||(s=Tr(s,e)):e.recursiveInArray&&Ke.isArrayObject(s)&&(s=lo(s).map(function(i){var o=i;if(Ke.isValidObject(i))Ke.belongToTypes(o,e.keepTypesOnRecursion)||(o=Tr(i,e));else if(Ke.isArrayObject(i)){var u=Tr({key:i},e);o=u.key}return o}))),t[a]=s}),t}Fn.default=Tr;var Kn={},ho=Ie&&Ie.__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(Kn,"__esModule",{value:!0});var We=St,fo=rn;function Sr(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=fo.default(n);e.recursive&&(We.isValidObject(s)?We.belongToTypes(s,e.keepTypesOnRecursion)||(s=Sr(s,e)):e.recursiveInArray&&We.isArrayObject(s)&&(s=ho(s).map(function(i){var o=i;if(We.isValidObject(i))We.belongToTypes(o,e.keepTypesOnRecursion)||(o=Sr(i,e));else if(We.isArrayObject(i)){var u=Sr({key:i},e);o=u.key}return o}))),t[a]=s}),t}Kn.default=Sr;var Wn={},po=Ie&&Ie.__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(Wn,"__esModule",{value:!0});var Ye=St,mo=nn;function Nr(r,e){if(e===void 0&&(e=Ye.DefaultOption),!Ye.isValidObject(r))return null;e=Ye.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=mo.default(n);e.recursive&&(Ye.isValidObject(s)?Ye.belongToTypes(s,e.keepTypesOnRecursion)||(s=Nr(s,e)):e.recursiveInArray&&Ye.isArrayObject(s)&&(s=po(s).map(function(i){var o=i;if(Ye.isValidObject(i))Ye.belongToTypes(o,e.keepTypesOnRecursion)||(o=Nr(i,e));else if(Ye.isArrayObject(i)){var u=Nr({key:i},e);o=u.key}return o}))),t[a]=s}),t}Wn.default=Nr;var Yn={},yo=Ie&&Ie.__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(Yn,"__esModule",{value:!0});var qe=St,go=sn;function Ir(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=go.default(n);e.recursive&&(qe.isValidObject(s)?qe.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ir(s,e)):e.recursiveInArray&&qe.isArrayObject(s)&&(s=yo(s).map(function(i){var o=i;if(qe.isValidObject(i))qe.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ir(i,e));else if(qe.isArrayObject(i)){var u=Ir({key:i},e);o=u.key}return o}))),t[a]=s}),t}Yn.default=Ir;var qn={},vo=Ie&&Ie.__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 Ge=St,_o=an;function Ar(r,e){if(e===void 0&&(e=Ge.DefaultOption),!Ge.isValidObject(r))return null;e=Ge.validateOptions(e);var t={};return Object.keys(r).forEach(function(n){var s=r[n],a=_o.default(n);e.recursive&&(Ge.isValidObject(s)?Ge.belongToTypes(s,e.keepTypesOnRecursion)||(s=Ar(s,e)):e.recursiveInArray&&Ge.isArrayObject(s)&&(s=vo(s).map(function(i){var o=i;if(Ge.isValidObject(i))Ge.belongToTypes(o,e.keepTypesOnRecursion)||(o=Ar(i,e));else if(Ge.isArrayObject(i)){var u=Ar({key:i},e);o=u.key}return o}))),t[a]=s}),t}qn.default=Ar;Object.defineProperty(F,"__esModule",{value:!0});F.kebabKeys=F.pascalKeys=F.snakeKeys=F.camelKeys=F.upperKeys=F.lowerKeys=F.toLowerCase=F.toUpperCase=F.toKebabCase=F.toHeaderCase=F.toSentenceCase=F.toTextCase=F.toPathCase=F.toDotCase=F.toPascalCase=F.toSnakeCase=F.toCamelCase=void 0;var Ys=rn;F.toCamelCase=Ys.default;var qs=nn;F.toSnakeCase=qs.default;var Gs=sn;F.toPascalCase=Gs.default;var Js=Bn;F.toDotCase=Js.default;var Hs=Dn;F.toPathCase=Hs.default;var Xs=Ln;F.toTextCase=Xs.default;var Qs=$n;F.toSentenceCase=Qs.default;var ea=zn;F.toHeaderCase=ea.default;var ta=an;F.toKebabCase=ta.default;var ra=Vn;F.lowerKeys=ra.default;var na=Fn;F.upperKeys=na.default;var sa=Kn;F.camelKeys=sa.default;var aa=Wn;F.snakeKeys=aa.default;var ia=Yn;F.pascalKeys=ia.default;var oa=qn;F.kebabKeys=oa.default;var ua=function(r){return String(r||"").toLowerCase()};F.toLowerCase=ua;var ca=function(r){return String(r||"").toUpperCase()};F.toUpperCase=ca;var bo={toCamelCase:Ys.default,toSnakeCase:qs.default,toPascalCase:Gs.default,toDotCase:Js.default,toPathCase:Hs.default,toTextCase:Xs.default,toSentenceCase:Qs.default,toHeaderCase:ea.default,toKebabCase:ta.default,toUpperCase:ca,toLowerCase:ua,lowerKeys:ra.default,upperKeys:na.default,camelKeys:sa.default,snakeKeys:aa.default,pascalKeys:ia.default,kebabKeys:oa.default};F.default=bo;var la=F;const da={recursive:!0,recursiveInArray:!0,keepTypesOnRecursion:[Number,String,Uint8Array]},wo=r=>la.snakeKeys(r,da),xo=r=>la.camelKeys(r,da);var Ut;(r=>{r.toSnake=wo,r.toCamel=xo,r.capitalize=e=>e[0].toUpperCase()+e.slice(1)})(Ut||(Ut={}));m.object({x:Vs.or(cs),y:Fs.or(cs)});const ko=m.object({x:Vs,y:Fs}),Oo=Object.freeze({x:"left",y:"top"}),To=(r,e)=>r.x===e.x&&r.y===e.y,ls=m.union([m.number(),Fr,Pn,Ls,zi,Wi]),So=(r,e)=>{if(typeof r=="string"){if(e===void 0)throw new Error("The y coordinate must be given.");return r==="x"?{x:e,y:0}:{x:0,y:e}}return 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}},ds={x:0,y:0},_r=m.union([m.number(),m.string()]);m.object({top:_r,left:_r,width:_r,height:_r});m.object({left:m.number(),top:m.number(),right:m.number(),bottom:m.number()});m.object({one:Fr,two:Fr,root:ko});const Gn=(r,e,t=0,n=0,s)=>{const a={one:{...ds},two:{...ds},root:s??Oo};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))},gn=r=>{const e=Gn(r);return{lower:e.one.x,upper:e.two.x}},vn=r=>{const e=Gn(r);return{lower:e.one.y,upper:e.two.y}},No=r=>typeof r!="object"||r==null?!1:"one"in r&&"two"in r&&"root"in r,Io=m.object({signedWidth:m.number(),signedHeight:m.number()});m.union([Ls,Io,Fr,Pn]);const Ao=(r,e,t)=>(e!=null&&(r=Math.max(r,e)),t!=null&&(r=Math.min(r,t)),r);m.object({offset:ls,scale:ls});const Eo=r=>(e,t,n,s)=>t==="dimension"?[e,n]:[e,s?n-r:n+r],Co=r=>(e,t,n,s)=>[e,s?n/r:n*r],Zo=r=>(e,t,n)=>{if(e===null)return[r,n];const{lower:s,upper:a}=e,{lower:i,upper:o}=r,u=a-s,d=o-i;if(t==="dimension")return[r,n*(d/u)];const p=(n-s)*(d/u)+i;return[r,p]},jo=r=>(e,t,n)=>[r,n],Ro=()=>(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)]},Uo=r=>(e,t,n)=>{const{lower:s,upper:a}=r;return n=Ao(n,s,a),[e,n]},Sn=class Dt{constructor(){w(this,"ops",[]),w(this,"currBounds",null),w(this,"currType",null),w(this,"reversed",!1),this.ops=[]}static translate(e){return new Dt().translate(e)}static magnify(e){return new Dt().magnify(e)}static scale(e,t){return new Dt().scale(e,t)}translate(e){const t=this.new(),n=Eo(e);return n.type="translate",t.ops.push(n),t}magnify(e){const t=this.new(),n=Co(e);return n.type="magnify",t.ops.push(n),t}scale(e,t){const n=yn(e,t),s=this.new(),a=Zo(n);return a.type="scale",s.ops.push(a),s}clamp(e,t){const n=yn(e,t),s=this.new(),a=Uo(n);return a.type="clamp",s.ops.push(a),s}reBound(e,t){const n=yn(e,t),s=this.new(),a=jo(n);return a.type="re-bound",s.ops.push(a),s}invert(){const e=Ro();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 Dt;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}};w(Sn,"IDENTITY",new Sn);let hs=Sn;const fs=class Je{constructor(e=new hs,t=new hs,n=null){w(this,"x"),w(this,"y"),w(this,"currRoot"),this.x=e,this.y=t,this.currRoot=n}static translate(e,t){return new Je().translate(e,t)}static translateX(e){return new Je().translateX(e)}static translateY(e){return new Je().translateY(e)}static clamp(e){return new Je().clamp(e)}static magnify(e){return new Je().magnify(e)}static scale(e){return new Je().scale(e)}static reBound(e){return new Je().reBound(e)}translate(e,t){const n=So(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(No(e)){const n=this.currRoot;return t.currRoot=e.root,n!=null&&!To(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(gn(e)),t.y=t.y.scale(vn(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(gn(e)),t.y=this.y.reBound(vn(e)),t}clamp(e){const t=this.copy();return t.x=this.x.clamp(gn(e)),t.y=this.y.clamp(vn(e)),t}copy(){const e=new Je;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 Gn(this.pos(e.one),this.pos(e.two),0,0,this.currRoot??e.root)}};w(fs,"IDENTITY",new fs);const ha=(r,e)=>{const t=new Oe(e);if(![we.DAY,we.HOUR,we.MINUTE,we.SECOND,we.MILLISECOND,we.MICROSECOND,we.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 Oe?new Oe(n):new we(n)},Q=class M{constructor(e,t="UTC"){if(w(this,"value"),w(this,"encodeValue",!0),e==null)this.value=M.now().valueOf();else if(e instanceof Date)this.value=BigInt(e.getTime())*M.MILLISECOND.valueOf();else if(typeof e=="string")this.value=M.parseDateTimeString(e,t).valueOf();else if(Array.isArray(e))this.value=M.parseDate(e);else{let n=BigInt(0);e instanceof Number&&(e=e.valueOf()),t==="local"&&(n=M.utcOffset.valueOf()),typeof e=="number"&&(isFinite(e)?e=Math.trunc(e):(isNaN(e)&&(e=0),e===1/0?e=M.MAX:e=M.MIN)),this.value=BigInt(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 M(BigInt(s.getTime())*M.MILLISECOND.valueOf()).truncate(M.DAY).valueOf()}encode(){return this.value.toString()}valueOf(){return this.value}static parseTimeString(e,t="UTC"){const[n,s,a]=e.split(":");let i="00",o="00";a!=null&&([i,o]=a.split("."));let u=M.hours(parseInt(n??"00",10)).add(M.minutes(parseInt(s??"00",10))).add(M.seconds(parseInt(i??"00",10))).add(M.milliseconds(parseInt(o??"00",10)));return t==="local"&&(u=u.add(M.utcOffset)),u.valueOf()}static parseDateTimeString(e,t="UTC"){if(!e.includes("/")&&!e.includes("-"))return M.parseTimeString(e,t);const n=new Date(e);return e.includes(":")||n.setUTCHours(0,0,0,0),new M(BigInt(n.getTime())*M.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(M.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 we(BigInt(new Date().getTimezoneOffset())*M.MINUTE.valueOf())}static since(e){return new M().span(e)}date(){return new Date(this.milliseconds())}equals(e){return this.valueOf()===new M(e).valueOf()}span(e){return this.range(e).span}range(e){return new Mo(this,e).makeValid()}spanRange(e){return this.range(this.add(e)).makeValid()}get isZero(){return this.valueOf()===BigInt(0)}after(e){return this.valueOf()>new M(e).valueOf()}afterEq(e){return this.valueOf()>=new M(e).valueOf()}before(e){return this.valueOf()<new M(e).valueOf()}beforeEq(e){return this.valueOf()<=new M(e).valueOf()}add(e){return new M(this.valueOf()+BigInt(e.valueOf()))}sub(e){return new M(this.valueOf()-BigInt(e.valueOf()))}milliseconds(){return Number(this.valueOf()/M.MILLISECOND.valueOf())}toString(){return this.date().toISOString()}remainder(e){return ha(this,e)}get isToday(){return this.truncate(we.DAY).equals(M.now().truncate(we.DAY))}truncate(e){return this.sub(this.remainder(e))}static now(){return new M(new Date)}static max(...e){let t=M.MIN;for(const n of e){const s=new M(n);s.after(t)&&(t=s)}return t}static min(...e){let t=M.MAX;for(const n of e){const s=new M(n);s.before(t)&&(t=s)}return t}static nanoseconds(e){return new M(e)}static microseconds(e){return M.nanoseconds(e*1e3)}static milliseconds(e){return M.microseconds(e*1e3)}static seconds(e){return M.milliseconds(e*1e3)}static minutes(e){return M.seconds(e*60)}static hours(e){return M.minutes(e*60)}static days(e){return M.hours(e*24)}};w(Q,"NANOSECOND",Q.nanoseconds(1)),w(Q,"MICROSECOND",Q.microseconds(1)),w(Q,"MILLISECOND",Q.milliseconds(1)),w(Q,"SECOND",Q.seconds(1)),w(Q,"MINUTE",Q.minutes(1)),w(Q,"HOUR",Q.hours(1)),w(Q,"DAY",Q.days(1)),w(Q,"MAX",new Q((1n<<63n)-1n)),w(Q,"MIN",new Q(0)),w(Q,"ZERO",new Q(0)),w(Q,"z",m.union([m.object({value:m.bigint()}).transform(r=>new Q(r.value)),m.string().transform(r=>new Q(BigInt(r))),m.instanceof(Number).transform(r=>new Q(r)),m.number().transform(r=>new Q(r)),m.instanceof(Q)]));let Oe=Q;const ee=class G{constructor(e){w(this,"value"),w(this,"encodeValue",!0),typeof e=="number"&&(e=Math.trunc(e.valueOf())),this.value=BigInt(e.valueOf())}encode(){return this.value.toString()}valueOf(){return this.value}lessThan(e){return this.valueOf()<new G(e).valueOf()}greaterThan(e){return this.valueOf()>new G(e).valueOf()}lessThanOrEqual(e){return this.valueOf()<=new G(e).valueOf()}greaterThanOrEqual(e){return this.valueOf()>=new G(e).valueOf()}remainder(e){return ha(this,e)}truncate(e){return new G(BigInt(Math.trunc(Number(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),u=e,d=t.sub(e),p=n.sub(t),A=s.sub(n),J=a.sub(s),ne=i.sub(a),pe=o.sub(i);let H="";return u.isZero||(H+=`${u.days}d `),d.isZero||(H+=`${d.hours}h `),p.isZero||(H+=`${p.minutes}m `),A.isZero||(H+=`${A.seconds}s `),J.isZero||(H+=`${J.milliseconds}ms `),ne.isZero||(H+=`${ne.microseconds}µs `),pe.isZero||(H+=`${pe.nanoseconds}ns`),H.trim()}get days(){return Number(this.valueOf()/G.DAY.valueOf())}get hours(){return Number(this.valueOf()/G.HOUR.valueOf())}get minutes(){return Number(this.valueOf()/G.MINUTE.valueOf())}get seconds(){return Number(this.valueOf()/G.SECOND.valueOf())}get milliseconds(){return Number(this.valueOf()/G.MILLISECOND.valueOf())}get microseconds(){return Number(this.valueOf()/G.MICROSECOND.valueOf())}get nanoseconds(){return Number(this.valueOf())}get isZero(){return this.valueOf()===BigInt(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)}};w(ee,"NANOSECOND",ee.nanoseconds(1)),w(ee,"MICROSECOND",ee.microseconds(1)),w(ee,"MILLISECOND",ee.milliseconds(1)),w(ee,"SECOND",ee.seconds(1)),w(ee,"MINUTE",ee.minutes(1)),w(ee,"HOUR",ee.hours(1)),w(ee,"DAY",ee.days(1)),w(ee,"MAX",new ee((1n<<63n)-1n)),w(ee,"MIN",new ee(0)),w(ee,"ZERO",new ee(0)),w(ee,"z",m.union([m.object({value:m.bigint()}).transform(r=>new ee(r.value)),m.string().transform(r=>new ee(BigInt(r))),m.instanceof(Number).transform(r=>new ee(r)),m.number().transform(r=>new ee(r)),m.instanceof(ee)]));let we=ee;const br=class Er extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}toString(){return`${this.valueOf()} Hz`}equals(e){return this.valueOf()===new Er(e).valueOf()}get period(){return we.seconds(1/this.valueOf())}sampleCount(e){return new we(e).seconds*this.valueOf()}byteCount(e,t){return this.sampleCount(e)*new be(t).valueOf()}span(e){return we.seconds(e/this.valueOf())}byteSpan(e,t){return this.span(e.valueOf()/t.valueOf())}static hz(e){return new Er(e)}static khz(e){return Er.hz(e*1e3)}};w(br,"z",m.union([m.number().transform(r=>new br(r)),m.instanceof(Number).transform(r=>new br(r)),m.instanceof(br)]));const me=class extends Number{constructor(e){e instanceof Number?super(e.valueOf()):super(e)}length(e){return e.valueOf()/this.valueOf()}size(e){return new Po(e*this.valueOf())}};w(me,"UNKNOWN",new me(0)),w(me,"BIT128",new me(16)),w(me,"BIT64",new me(8)),w(me,"BIT32",new me(4)),w(me,"BIT16",new me(2)),w(me,"BIT8",new me(1)),w(me,"z",m.union([m.number().transform(r=>new me(r)),m.instanceof(Number).transform(r=>new me(r)),m.instanceof(me)]));let be=me;const Pe=class Cr{constructor(e,t){w(this,"start"),w(this,"end"),this.start=new Oe(e),this.end=new Oe(t)}get span(){return new we(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 Cr(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 Cr?this.contains(e.start)&&this.contains(e.end):this.start.beforeEq(e)&&this.end.after(e)}boundBy(e){const t=new Cr(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}};w(Pe,"MAX",new Pe(Oe.MIN,Oe.MAX)),w(Pe,"MIN",new Pe(Oe.MAX,Oe.MIN)),w(Pe,"ZERO",new Pe(Oe.ZERO,Oe.ZERO)),w(Pe,"z",m.union([m.object({start:Oe.z,end:Oe.z}).transform(r=>new Pe(r.start,r.end)),m.instanceof(Pe)]));let Mo=Pe;const y=class He extends String{constructor(e){if(e instanceof He||typeof e=="string"||typeof e.valueOf()=="string"){super(e.valueOf());return}else{const t=He.ARRAY_CONSTRUCTOR_DATA_TYPES.get(e.constructor.name);if(t!=null){super(t.valueOf());return}}throw super(He.UNKNOWN.valueOf()),new Error(`unable to find data type for ${e.toString()}`)}get Array(){const e=He.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 isVariable(){return this.equals(He.JSON)||this.equals(He.STRING)}get density(){const e=He.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 He.BIG_INT_TYPES.some(e=>e.equals(this))}};w(y,"UNKNOWN",new y("unknown")),w(y,"FLOAT64",new y("float64")),w(y,"FLOAT32",new y("float32")),w(y,"INT64",new y("int64")),w(y,"INT32",new y("int32")),w(y,"INT16",new y("int16")),w(y,"INT8",new y("int8")),w(y,"UINT64",new y("uint64")),w(y,"UINT32",new y("uint32")),w(y,"UINT16",new y("uint16")),w(y,"UINT8",new y("uint8")),w(y,"BOOLEAN",y.UINT8),w(y,"TIMESTAMP",new y("timestamp")),w(y,"UUID",new y("uuid")),w(y,"STRING",new y("string")),w(y,"JSON",new y("json")),w(y,"ARRAY_CONSTRUCTORS",new Map([[y.UINT8.toString(),Uint8Array],[y.UINT16.toString(),Uint16Array],[y.UINT32.toString(),Uint32Array],[y.UINT64.toString(),BigUint64Array],[y.FLOAT32.toString(),Float32Array],[y.FLOAT64.toString(),Float64Array],[y.INT8.toString(),Int8Array],[y.INT16.toString(),Int16Array],[y.INT32.toString(),Int32Array],[y.INT64.toString(),BigInt64Array],[y.TIMESTAMP.toString(),BigInt64Array],[y.STRING.toString(),Uint8Array],[y.JSON.toString(),Uint8Array],[y.UUID.toString(),Uint8Array]])),w(y,"ARRAY_CONSTRUCTOR_DATA_TYPES",new Map([[Uint8Array.name,y.UINT8],[Uint16Array.name,y.UINT16],[Uint32Array.name,y.UINT32],[BigUint64Array.name,y.UINT64],[Float32Array.name,y.FLOAT32],[Float64Array.name,y.FLOAT64],[Int8Array.name,y.INT8],[Int16Array.name,y.INT16],[Int32Array.name,y.INT32],[BigInt64Array.name,y.INT64]])),w(y,"DENSITIES",new Map([[y.UINT8.toString(),be.BIT8],[y.UINT16.toString(),be.BIT16],[y.UINT32.toString(),be.BIT32],[y.UINT64.toString(),be.BIT64],[y.FLOAT32.toString(),be.BIT32],[y.FLOAT64.toString(),be.BIT64],[y.INT8.toString(),be.BIT8],[y.INT16.toString(),be.BIT16],[y.INT32.toString(),be.BIT32],[y.INT64.toString(),be.BIT64],[y.TIMESTAMP.toString(),be.BIT64],[y.STRING.toString(),be.UNKNOWN],[y.JSON.toString(),be.UNKNOWN],[y.UUID.toString(),be.BIT128]])),w(y,"ALL",[y.UNKNOWN,y.FLOAT64,y.FLOAT32,y.INT64,y.INT32,y.INT16,y.INT8,y.UINT64,y.UINT32,y.UINT16,y.UINT8,y.TIMESTAMP,y.UUID,y.STRING,y.JSON]),w(y,"BIG_INT_TYPES",[y.INT64,y.UINT64,y.TIMESTAMP]),w(y,"z",m.union([m.string().transform(r=>new y(r)),m.instanceof(y)]));const ye=class de extends Number{constructor(e){super(e.valueOf())}largerThan(e){return this.valueOf()>e.valueOf()}smallerThan(e){return this.valueOf()<e.valueOf()}add(e){return de.bytes(this.valueOf()+e.valueOf())}sub(e){return de.bytes(this.valueOf()-e.valueOf())}truncate(e){return new de(Math.trunc(this.valueOf()/e.valueOf())*e.valueOf())}remainder(e){return de.bytes(this.valueOf()%e.valueOf())}get gigabytes(){return this.valueOf()/de.GIGABYTE.valueOf()}get megabytes(){return this.valueOf()/de.MEGABYTE.valueOf()}get kilobytes(){return this.valueOf()/de.KILOBYTE.valueOf()}get terabytes(){return this.valueOf()/de.TERABYTE.valueOf()}toString(){const e=this.truncate(de.TERABYTE),t=this.truncate(de.GIGABYTE),n=this.truncate(de.MEGABYTE),s=this.truncate(de.KILOBYTE),a=this.truncate(de.BYTE),i=e,o=t.sub(e),u=n.sub(t),d=s.sub(n),p=a.sub(s);let A="";return i.isZero||(A+=`${i.terabytes}TB `),o.isZero||(A+=`${o.gigabytes}GB `),u.isZero||(A+=`${u.megabytes}MB `),d.isZero||(A+=`${d.kilobytes}KB `),(!p.isZero||A==="")&&(A+=`${p.valueOf()}B`),A.trim()}static bytes(e=1){return new de(e)}static kilobytes(e=1){return de.bytes(e.valueOf()*1e3)}static megabytes(e=1){return de.kilobytes(e.valueOf()*1e3)}static gigabytes(e=1){return de.megabytes(e.valueOf()*1e3)}static terabytes(e){return de.gigabytes(e.valueOf()*1e3)}get isZero(){return this.valueOf()===0}};w(ye,"BYTE",new ye(1)),w(ye,"KILOBYTE",ye.kilobytes(1)),w(ye,"MEGABYTE",ye.megabytes(1)),w(ye,"GIGABYTE",ye.gigabytes(1)),w(ye,"TERABYTE",ye.terabytes(1)),w(ye,"ZERO",new ye(0)),w(ye,"z",m.union([m.number().transform(r=>new ye(r)),m.instanceof(ye)]));let Po=ye;m.union([m.instanceof(Uint8Array),m.instanceof(Uint16Array),m.instanceof(Uint32Array),m.instanceof(BigUint64Array),m.instanceof(Float32Array),m.instanceof(Float64Array),m.instanceof(Int8Array),m.instanceof(Int16Array),m.instanceof(Int32Array),m.instanceof(BigInt64Array)]);m.record(m.union([m.number(),m.string(),m.symbol()]),m.unknown());const Bo=r=>r!=null&&typeof r=="object"&&!Array.isArray(r),fa=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null?"node":typeof window>"u"||window.document===void 0?"webworker":"browser",Do=fa(),pa=["MacOS","Windows","Linux","Docker"],Lo=m.enum(pa);let _n;const $o=()=>{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"},zo=(r={})=>{const{force:e,default:t}=r;return e??_n??(_n=$o(),_n??t)},ma=Object.freeze(Object.defineProperty({__proto__:null,OPERATING_SYSTEMS:pa,RUNTIME:Do,detect:fa,getOS:zo,osZ:Lo},Symbol.toStringTag,{value:"Module"})),Vo=(...r)=>r.map(ya).join(""),ya=r=>(r.endsWith("/")||(r+="/"),r.startsWith("/")&&(r=r.slice(1)),r),Fo=r=>r.endsWith("/")?r.slice(0,-1):r,Ko=(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("&");var Nt;let Wo=(Nt=class{constructor({host:r,port:e,protocol:t="",pathPrefix:n=""}){w(this,"protocol"),w(this,"host"),w(this,"port"),w(this,"path"),this.protocol=t,this.host=r,this.port=e,this.path=ya(n)}replace(r){return new Nt({host:r.host??this.host,port:r.port??this.port,protocol:r.protocol??this.protocol,pathPrefix:r.pathPrefix??this.path})}child(r){return new Nt({...this,pathPrefix:Vo(this.path,r)})}toString(){return Fo(`${this.protocol}://${this.host}:${this.port}/${this.path}`)}},w(Nt,"UNKNOWN",new Nt({host:"unknown",port:0})),Nt);var Nn;try{Nn=new TextDecoder}catch{}var x,Ne,c=0,re={},W,ut,Se=0,Be=0,fe,et,Te=[],K,ps={useRecords:!1,mapsAsObjects:!0};class ga{}const va=new ga;va.name="MessagePack 0xC1";var ct=!1,_a=2,ms;try{new Function("")}catch{_a=1/0}class Xt{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 Oa(()=>(An(),this?this.unpack(e,t):Xt.prototype.unpack.call(ps,e,t)));!e.buffer&&e.constructor===ArrayBuffer&&(e=typeof Buffer<"u"?Buffer.from(e):new Uint8Array(e)),typeof t=="object"?(Ne=t.end||e.length,c=t.start||0):(c=0,Ne=t>-1?t:e.length),Be=0,ut=null,fe=null,x=e;try{K=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 Xt){if(re=this,this.structures)return W=this.structures,wr(t);(!W||W.length>0)&&(W=[])}else re=ps,(!W||W.length>0)&&(W=[]);return wr(t)}unpackMultiple(e,t){let n,s=0;try{ct=!0;let a=e.length,i=this?this.unpack(e,a):on.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{ct=!1,An()}}_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(!re.trusted&&!ct){let t=W.sharedLength||0;t<W.length&&(W.length=t)}let e;if(re.randomAccessStructure&&x[c]<64&&x[c]>=32&&ms?(e=ms(x,c,Ne,re),x=null,!(r&&r.lazy)&&e&&(e=e.toJSON()),c=Ne):e=ce(),fe&&(c=fe.postBundlePosition,fe=null),ct&&(W.restoreStructures=null),c==Ne)W&&W.restoreStructures&&ys(),W=null,x=null,et&&(et=null);else{if(c>Ne)throw new Error("Unexpected end of MessagePack data");if(!ct){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 W&&W.restoreStructures&&ys(),An(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer")||c>Ne)&&(e.incomplete=!0),e}}function ys(){for(let r in W.restoreStructures)W[r]=W.restoreStructures[r];W.restoreStructures=null}function ce(){let r=x[c++];if(r<160)if(r<128){if(r<64)return r;{let e=W[r&63]||re.getStructures&&ba()[r&63];return e?(e.read||(e.read=Jn(e,r&63)),e.read()):r}}else if(r<144)if(r-=128,re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=xa();n==="__proto__"&&(n="__proto_"),e[n]=ce()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(ce(),ce());return e}else{r-=144;let e=new Array(r);for(let t=0;t<r;t++)e[t]=ce();return re.freezeData?Object.freeze(e):e}else if(r<192){let e=r-160;if(Be>=c)return ut.slice(c-Se,(c+=e)-Se);if(Be==0&&Ne<140){let t=e<16?Hn(e):wa(e);if(t!=null)return t}return In(e)}else{let e;switch(r){case 192:return null;case 193:return fe?(e=ce(),e>0?fe[1].slice(fe.position1,fe.position1+=e):fe[0].slice(fe.position0,fe.position0-=e)):va;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 bn(e);case 197:return e=K.getUint16(c),c+=2,bn(e);case 198:return e=K.getUint32(c),c+=4,bn(e);case 199:return gt(x[c++]);case 200:return e=K.getUint16(c),c+=2,gt(e);case 201:return e=K.getUint32(c),c+=4,gt(e);case 202:if(e=K.getFloat32(c),re.useFloat32>2){let t=Xn[(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=K.getFloat64(c),c+=8,e;case 204:return x[c++];case 205:return e=K.getUint16(c),c+=2,e;case 206:return e=K.getUint32(c),c+=4,e;case 207:return re.int64AsType==="number"?(e=K.getUint32(c)*4294967296,e+=K.getUint32(c+4)):re.int64AsType==="string"?e=K.getBigUint64(c).toString():re.int64AsType==="auto"?(e=K.getBigUint64(c),e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=K.getBigUint64(c),c+=8,e;case 208:return K.getInt8(c++);case 209:return e=K.getInt16(c),c+=2,e;case 210:return e=K.getInt32(c),c+=4,e;case 211:return re.int64AsType==="number"?(e=K.getInt32(c)*4294967296,e+=K.getUint32(c+4)):re.int64AsType==="string"?e=K.getBigInt64(c).toString():re.int64AsType==="auto"?(e=K.getBigInt64(c),e>=BigInt(-2)<<BigInt(52)&&e<=BigInt(2)<<BigInt(52)&&(e=Number(e))):e=K.getBigInt64(c),c+=8,e;case 212:if(e=x[c++],e==114)return xs(x[c++]&63);{let t=Te[e];if(t)return t.read?(c++,t.read(ce())):t.noBuffer?(c++,t()):t(x.subarray(c,++c));throw new Error("Unknown extension "+e)}case 213:return e=x[c],e==114?(c++,xs(x[c++]&63,x[c++])):gt(2);case 214:return gt(4);case 215:return gt(8);case 216:return gt(16);case 217:return e=x[c++],Be>=c?ut.slice(c-Se,(c+=e)-Se):qo(e);case 218:return e=K.getUint16(c),c+=2,Be>=c?ut.slice(c-Se,(c+=e)-Se):Go(e);case 219:return e=K.getUint32(c),c+=4,Be>=c?ut.slice(c-Se,(c+=e)-Se):Jo(e);case 220:return e=K.getUint16(c),c+=2,vs(e);case 221:return e=K.getUint32(c),c+=4,vs(e);case 222:return e=K.getUint16(c),c+=2,_s(e);case 223:return e=K.getUint32(c),c+=4,_s(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 Yo=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Jn(r,e){function t(){if(t.count++>_a){let s=r.read=new Function("r","return function(){return "+(re.freezeData?"Object.freeze":"")+"({"+r.map(a=>a==="__proto__"?"__proto_:r()":Yo.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(ce);return r.highByte===0&&(r.read=gs(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]=ce()}return re.freezeData?Object.freeze(n):n}return t.count=0,r.highByte===0?gs(e,t):t}const gs=(r,e)=>function(){let t=x[c++];if(t===0)return e();let n=r<32?-(r+(t<<5)):r+(t<<5),s=W[n]||ba()[n];if(!s)throw new Error("Record id is not defined for "+n);return s.read||(s.read=Jn(s,r)),s.read()};function ba(){let r=Oa(()=>(x=null,re.getStructures()));return W=re._mergeStructures(r,W)}var In=pr,qo=pr,Go=pr,Jo=pr;function pr(r){let e;if(r<16&&(e=Hn(r)))return e;if(r>64&&Nn)return Nn.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 u=(s&7)<<18|a<<12|i<<6|o;u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|u&1023),n.push(u)}else n.push(s);n.length>=4096&&(e+=he.apply(String,n),n.length=0)}return n.length>0&&(e+=he.apply(String,n)),e}function vs(r){let e=new Array(r);for(let t=0;t<r;t++)e[t]=ce();return re.freezeData?Object.freeze(e):e}function _s(r){if(re.mapsAsObjects){let e={};for(let t=0;t<r;t++){let n=xa();n==="__proto__"&&(n="__proto_"),e[n]=ce()}return e}else{let e=new Map;for(let t=0;t<r;t++)e.set(ce(),ce());return e}}var he=String.fromCharCode;function wa(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 he.apply(String,t)}function Hn(r){if(r<4)if(r<2){if(r===0)return"";{let e=x[c++];if((e&128)>1){c-=1;return}return he(e)}}else{let e=x[c++],t=x[c++];if((e&128)>0||(t&128)>0){c-=2;return}if(r<3)return he(e,t);let n=x[c++];if((n&128)>0){c-=3;return}return he(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 he(e,t,n,s);{let a=x[c++];if((a&128)>0){c-=5;return}return he(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 he(e,t,n,s,a,i);let o=x[c++];if((o&128)>0){c-=7;return}return he(e,t,n,s,a,i,o)}else{let a=x[c++],i=x[c++],o=x[c++],u=x[c++];if((a&128)>0||(i&128)>0||(o&128)>0||(u&128)>0){c-=8;return}if(r<10){if(r===8)return he(e,t,n,s,a,i,o,u);{let d=x[c++];if((d&128)>0){c-=9;return}return he(e,t,n,s,a,i,o,u,d)}}else if(r<12){let d=x[c++],p=x[c++];if((d&128)>0||(p&128)>0){c-=10;return}if(r<11)return he(e,t,n,s,a,i,o,u,d,p);let A=x[c++];if((A&128)>0){c-=11;return}return he(e,t,n,s,a,i,o,u,d,p,A)}else{let d=x[c++],p=x[c++],A=x[c++],J=x[c++];if((d&128)>0||(p&128)>0||(A&128)>0||(J&128)>0){c-=12;return}if(r<14){if(r===12)return he(e,t,n,s,a,i,o,u,d,p,A,J);{let ne=x[c++];if((ne&128)>0){c-=13;return}return he(e,t,n,s,a,i,o,u,d,p,A,J,ne)}}else{let ne=x[c++],pe=x[c++];if((ne&128)>0||(pe&128)>0){c-=14;return}if(r<15)return he(e,t,n,s,a,i,o,u,d,p,A,J,ne,pe);let H=x[c++];if((H&128)>0){c-=15;return}return he(e,t,n,s,a,i,o,u,d,p,A,J,ne,pe,H)}}}}}function bs(){let r=x[c++],e;if(r<192)e=r-160;else switch(r){case 217:e=x[c++];break;case 218:e=K.getUint16(c),c+=2;break;case 219:e=K.getUint32(c),c+=4;break;default:throw new Error("Expected string")}return pr(e)}function bn(r){return re.copyBuffers?Uint8Array.prototype.slice.call(x,c,c+=r):x.subarray(c,c+=r)}function gt(r){let e=x[c++];if(Te[e]){let t;return Te[e](x.subarray(c,t=c+=r),n=>{c=n;try{return ce()}finally{c=t}})}else throw new Error("Unknown extension type "+e)}var ws=new Array(4096);function xa(){let r=x[c++];if(r>=160&&r<192){if(r=r-160,Be>=c)return ut.slice(c-Se,(c+=r)-Se);if(!(Be==0&&Ne<180))return In(r)}else return c--,ce().toString();let e=(r<<5^(r>1?K.getUint16(c):r>0?x[c]:0))&4095,t=ws[e],n=c,s=c+r-3,a,i=0;if(t&&t.bytes==r){for(;n<s;){if(a=K.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=[],ws[e]=t,t.bytes=r;n<s;)a=K.getUint32(n),t.push(a),n+=4;for(s+=3;n<s;)a=x[n++],t.push(a);let o=r<16?Hn(r):wa(r);return o!=null?t.string=o:t.string=In(r)}const xs=(r,e)=>{let t=ce().map(a=>a.toString()),n=r;e!==void 0&&(r=r<32?-((e<<5)+r):(e<<5)+r,t.highByte=e);let s=W[r];return s&&(s.isShared||ct)&&((W.restoreStructures||(W.restoreStructures=[]))[r]=s),W[r]=t,t.read=Jn(t,n),t.read()};Te[0]=()=>{};Te[0].noBuffer=!0;let Ho={Error,TypeError,ReferenceError};Te[101]=()=>{let r=ce();return(Ho[r[0]]||Error)(r[1])};Te[105]=r=>{let e=K.getUint32(c-4);et||(et=new Map);let t=x[c],n;t>=144&&t<160||t==220||t==221?n=[]:n={};let s={target:n};et.set(e,s);let a=ce();return s.used?Object.assign(n,a):(s.target=a,a)};Te[112]=r=>{let e=K.getUint32(c-4),t=et.get(e);return t.used=!0,t.target};Te[115]=()=>new Set(ce());const ka=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(r=>r+"Array");let Xo=typeof globalThis=="object"?globalThis:window;Te[116]=r=>{let e=r[0],t=ka[e];if(!t)throw new Error("Could not find typed array for code "+e);return new Xo[t](Uint8Array.prototype.slice.call(r,1).buffer)};Te[120]=()=>{let r=ce();return new RegExp(r[0],r[1])};const Qo=[];Te[98]=r=>{let e=(r[0]<<24)+(r[1]<<16)+(r[2]<<8)+r[3],t=c;return c+=e-r.length,fe=Qo,fe=[bs(),bs()],fe.position0=0,fe.position1=0,fe.postBundlePosition=c,c=t,ce()};Te[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 Oa(r){let e=Ne,t=c,n=Se,s=Be,a=ut,i=et,o=fe,u=new Uint8Array(x.slice(0,Ne)),d=W,p=W.slice(0,W.length),A=re,J=ct,ne=r();return Ne=e,c=t,Se=n,Be=s,ut=a,et=i,fe=o,x=u,ct=J,W=d,W.splice(0,W.length,...p),re=A,K=new DataView(x.buffer,x.byteOffset,x.byteLength),ne}function An(){x=null,et=null,W=null}const Xn=new Array(147);for(let r=0;r<256;r++)Xn[r]=+("1e"+Math.floor(45.15-r*.30103));var on=new Xt({useRecords:!1});const eu=on.unpack;on.unpackMultiple;on.unpack;let tu=new Float32Array(1);new Uint8Array(tu.buffer,0,4);let Zr;try{Zr=new TextEncoder}catch{}let En,Ta;const un=typeof Buffer<"u",xr=un?function(r){return Buffer.allocUnsafeSlow(r)}:Uint8Array,Sa=un?Buffer:Uint8Array,ks=un?4294967296:2144337920;let h,Bt,te,l=0,_e,se=null,ru;const nu=21760,su=/[\u0080-\uFFFF]/,It=Symbol("record-id");class au extends Xt{constructor(e){super(e),this.offset=0;let t,n,s,a,i=Sa.prototype.utf8Write?function(f,I){return h.utf8Write(f,I,4294967295)}:Zr&&Zr.encodeInto?function(f,I){return Zr.encodeInto(f,h.subarray(I)).written}:!1,o=this;e||(e={});let u=e&&e.sequential,d=e.structures||e.saveStructures,p=e.maxSharedStructures;if(p==null&&(p=d?32:0),p>8160)throw new Error("Maximum maxSharedStructure is 8160");e.structuredClone&&e.moreTypes==null&&(this.moreTypes=!0);let A=e.maxOwnStructures;A==null&&(A=d?32:64),!this.structures&&e.useRecords!=!1&&(this.structures=[]);let J=p>32||A+p>64,ne=p+64,pe=p+A+64;if(pe>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let H=[],hn=0,gr=0;this.pack=this.encode=function(f,I){if(h||(h=new xr(8192),te=h.dataView||(h.dataView=new DataView(h.buffer,0,8192)),l=0),_e=h.length-10,_e-l<2048?(h=new xr(h.length),te=h.dataView||(h.dataView=new DataView(h.buffer,0,h.length)),_e=h.length-10,l=0):l=l+7&2147483640,t=l,I&hu&&(l+=I&255),a=o.structuredClone?new Map:null,o.bundleStrings&&typeof f!="string"?(se=[],se.size=1/0):se=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 b=0;b<g;b++){let k=s[b];if(!k)continue;let z,V=s.transitions;for(let R=0,ue=k.length;R<ue;R++){let X=k[R];z=V[X],z||(z=V[X]=Object.create(null)),V=z}V[It]=b+64}this.lastNamedStructuresLength=g}u||(s.nextId=g+64)}n&&(n=!1);try{o.randomAccessStructure&&f&&f.constructor&&f.constructor===Object?Da(f):oe(f);let g=se;if(se&&Ss(t,oe,0),a&&a.idsToInsert){let b=a.idsToInsert.sort((R,ue)=>R.offset>ue.offset?1:-1),k=b.length,z=-1;for(;g&&k>0;){let R=b[--k].offset+t;R<g.stringsPosition+t&&z===-1&&(z=0),R>g.position+t?z>=0&&(z+=6):(z>=0&&(te.setUint32(g.position+t,te.getUint32(g.position+t)+z),z=-1),g=g.previous,k++)}z>=0&&g&&te.setUint32(g.position+t,te.getUint32(g.position+t)+z),l+=b.length*6,l>_e&&st(l),o.offset=l;let V=ou(h.subarray(t,l),b);return a=null,V}return o.offset=l,I&lu?(h.start=t,h.end=l,h):h.subarray(t,l)}finally{if(s&&(rs(),n&&o.saveStructures)){let g=s.sharedLength||0,b=h.subarray(t,l),k=uu(s,o);return o.saveStructures(k,k.isCompatible)===!1?o.pack(f,I):(o.lastNamedStructuresLength=g,b)}I&du&&(l=t)}};const rs=()=>{gr<10&&gr++;let f=s.sharedLength||0;if(s.length>f&&!u&&(s.length=f),hn>1e4)s.transitions=null,gr=0,hn=0,H.length>0&&(H=[]);else if(H.length>0&&!u){for(let I=0,g=H.length;I<g;I++)H[I][It]=0;H=[]}},fn=f=>{var I=f.length;I<16?h[l++]=144|I:I<65536?(h[l++]=220,h[l++]=I>>8,h[l++]=I&255):(h[l++]=221,te.setUint32(l,I),l+=4);for(let g=0;g<I;g++)oe(f[g])},oe=f=>{l>_e&&(h=st(l));var I=typeof f,g;if(I==="string"){let b=f.length;if(se&&b>=4&&b<4096){if((se.size+=b)>nu){let R,ue=(se[0]?se[0].length*3+se[1].length:0)+10;l+ue>_e&&(h=st(l+ue));let X;se.position?(X=se,h[l]=200,l+=3,h[l++]=98,R=l-t,l+=4,Ss(t,oe,0),te.setUint16(R+t-3,l-t-R)):(h[l++]=214,h[l++]=98,R=l-t,l+=4),se=["",""],se.previous=X,se.size=0,se.position=R}let V=su.test(f);se[V?0:1]+=f,h[l++]=193,oe(V?-b:b);return}let k;b<32?k=1:b<256?k=2:b<65536?k=3:k=5;let z=b*3;if(l+z>_e&&(h=st(l+z)),b<64||!i){let V,R,ue,X=l+k;for(V=0;V<b;V++)R=f.charCodeAt(V),R<128?h[X++]=R:R<2048?(h[X++]=R>>6|192,h[X++]=R&63|128):(R&64512)===55296&&((ue=f.charCodeAt(V+1))&64512)===56320?(R=65536+((R&1023)<<10)+(ue&1023),V++,h[X++]=R>>18|240,h[X++]=R>>12&63|128,h[X++]=R>>6&63|128,h[X++]=R&63|128):(h[X++]=R>>12|224,h[X++]=R>>6&63|128,h[X++]=R&63|128);g=X-l-k}else g=i(f,l+k);g<32?h[l++]=160|g:g<256?(k<2&&h.copyWithin(l+2,l+1,l+1+g),h[l++]=217,h[l++]=g):g<65536?(k<3&&h.copyWithin(l+3,l+2,l+2+g),h[l++]=218,h[l++]=g>>8,h[l++]=g&255):(k<5&&h.copyWithin(l+5,l+3,l+3+g),h[l++]=219,te.setUint32(l,g),l+=4),l+=g}else if(I==="number")if(f>>>0===f)f<32||f<128&&this.useRecords===!1||f<64&&!this.randomAccessStructure?h[l++]=f:f<256?(h[l++]=204,h[l++]=f):f<65536?(h[l++]=205,h[l++]=f>>8,h[l++]=f&255):(h[l++]=206,te.setUint32(l,f),l+=4);else if(f>>0===f)f>=-32?h[l++]=256+f:f>=-128?(h[l++]=208,h[l++]=f+256):f>=-32768?(h[l++]=209,te.setInt16(l,f),l+=2):(h[l++]=210,te.setInt32(l,f),l+=4);else{let b;if((b=this.useFloat32)>0&&f<4294967296&&f>=-2147483648){h[l++]=202,te.setFloat32(l,f);let k;if(b<4||(k=f*Xn[(h[l]&127)<<1|h[l+1]>>7])>>0===k){l+=4;return}else l--}h[l++]=203,te.setFloat64(l,f),l+=8}else if(I==="object"||I==="function")if(!f)h[l++]=192;else{if(a){let k=a.get(f);if(k){if(!k.id){let z=a.idsToInsert||(a.idsToInsert=[]);k.id=z.push(k)}h[l++]=214,h[l++]=112,te.setUint32(l,k.id),l+=4;return}else a.set(f,{offset:l-t})}let b=f.constructor;if(b===Object)vr(f,!0);else if(b===Array)fn(f);else if(b===Map)if(this.mapAsEmptyObject)h[l++]=128;else{g=f.size,g<16?h[l++]=128|g:g<65536?(h[l++]=222,h[l++]=g>>8,h[l++]=g&255):(h[l++]=223,te.setUint32(l,g),l+=4);for(let[k,z]of f)oe(k),oe(z)}else{for(let k=0,z=En.length;k<z;k++){let V=Ta[k];if(f instanceof V){let R=En[k];if(R.write){R.type&&(h[l++]=212,h[l++]=R.type,h[l++]=0);let at=R.write.call(this,f);at===f?Array.isArray(f)?fn(f):vr(f):oe(at);return}let ue=h,X=te,Ve=l;h=null;let yt;try{yt=R.pack.call(this,f,at=>(h=ue,ue=null,l+=at,l>_e&&st(l),{target:h,targetView:te,position:l-at}),oe)}finally{ue&&(h=ue,te=X,l=Ve,_e=h.length-10)}yt&&(yt.length+l>_e&&st(yt.length+l),l=iu(yt,h,l,R.type));return}}if(Array.isArray(f))fn(f);else{if(f.toJSON){const k=f.toJSON();if(k!==f)return oe(k)}if(I==="function")return oe(this.writeFunction&&this.writeFunction(f));vr(f,!f.hasOwnProperty)}}}else if(I==="boolean")h[l++]=f?195:194;else if(I==="bigint"){if(f<BigInt(1)<<BigInt(63)&&f>=-(BigInt(1)<<BigInt(63)))h[l++]=211,te.setBigInt64(l,f);else if(f<BigInt(1)<<BigInt(64)&&f>0)h[l++]=207,te.setBigUint64(l,f);else if(this.largeBigIntToFloat)h[l++]=203,te.setFloat64(l,Number(f));else throw new RangeError(f+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");l+=8}else if(I==="undefined")this.encodeUndefinedAsNil?h[l++]=192:(h[l++]=212,h[l++]=0,h[l++]=0);else throw new Error("Unknown type: "+I)},ns=this.variableMapSize||this.coercibleKeyAsNumber?f=>{let I=Object.keys(f),g=I.length;g<16?h[l++]=128|g:g<65536?(h[l++]=222,h[l++]=g>>8,h[l++]=g&255):(h[l++]=223,te.setUint32(l,g),l+=4);let b;if(this.coercibleKeyAsNumber)for(let k=0;k<g;k++){b=I[k];let z=Number(b);oe(isNaN(z)?b:z),oe(f[b])}else for(let k=0;k<g;k++)oe(b=I[k]),oe(f[b])}:(f,I)=>{h[l++]=222;let g=l-t;l+=2;let b=0;for(let k in f)(I||f.hasOwnProperty(k))&&(oe(k),oe(f[k]),b++);h[g+++t]=b>>8,h[g+t]=b&255},ss=this.useRecords===!1?ns:e.progressiveRecords&&!J?(f,I)=>{let g,b=s.transitions||(s.transitions=Object.create(null)),k=l++-t,z;for(let V in f)if(I||f.hasOwnProperty(V)){if(g=b[V],g)b=g;else{let R=Object.keys(f),ue=b;b=s.transitions;let X=0;for(let Ve=0,yt=R.length;Ve<yt;Ve++){let at=R[Ve];g=b[at],g||(g=b[at]=Object.create(null),X++),b=g}k+t+1==l?(l--,pn(b,R,X)):is(b,R,k,X),z=!0,b=ue[V]}oe(f[V])}if(!z){let V=b[It];V?h[k+t]=V:is(b,Object.keys(f),k,0)}}:(f,I)=>{let g,b=s.transitions||(s.transitions=Object.create(null)),k=0;for(let V in f)(I||f.hasOwnProperty(V))&&(g=b[V],g||(g=b[V]=Object.create(null),k++),b=g);let z=b[It];z?z>=96&&J?(h[l++]=((z-=96)&31)+96,h[l++]=z>>5):h[l++]=z:pn(b,b.__keys__||Object.keys(f),k);for(let V in f)(I||f.hasOwnProperty(V))&&oe(f[V])},as=typeof this.useRecords=="function"&&this.useRecords,vr=as?(f,I)=>{as(f)?ss(f,I):ns(f,I)}:ss,st=f=>{let I;if(f>16777216){if(f-t>ks)throw new Error("Packed buffer would be larger than maximum buffer size");I=Math.min(ks,Math.round(Math.max((f-t)*(f>67108864?1.25:2),4194304)/4096)*4096)}else I=(Math.max(f-t<<2,h.length-1)>>12)+1<<12;let g=new xr(I);return te=g.dataView||(g.dataView=new DataView(g.buffer,0,I)),f=Math.min(f,h.length),h.copy?h.copy(g,0,t,f):g.set(h.slice(t,f)),l-=t,t=0,_e=g.length-10,h=g},pn=(f,I,g)=>{let b=s.nextId;b||(b=64),b<ne&&this.shouldShareStructure&&!this.shouldShareStructure(I)?(b=s.nextOwnId,b<pe||(b=ne),s.nextOwnId=b+1):(b>=pe&&(b=ne),s.nextId=b+1);let k=I.highByte=b>=96&&J?b-96>>5:-1;f[It]=b,f.__keys__=I,s[b-64]=I,b<ne?(I.isShared=!0,s.sharedLength=b-63,n=!0,k>=0?(h[l++]=(b&31)+96,h[l++]=k):h[l++]=b):(k>=0?(h[l++]=213,h[l++]=114,h[l++]=(b&31)+96,h[l++]=k):(h[l++]=212,h[l++]=114,h[l++]=b),g&&(hn+=gr*g),H.length>=A&&(H.shift()[It]=0),H.push(f),oe(I))},is=(f,I,g,b)=>{let k=h,z=l,V=_e,R=t;h=Bt,l=0,t=0,h||(Bt=h=new xr(8192)),_e=h.length-10,pn(f,I,b),Bt=h;let ue=l;if(h=k,l=z,_e=V,t=R,ue>1){let X=l+ue-1;X>_e&&st(X);let Ve=g+t;h.copyWithin(Ve+ue,Ve+1,l),h.set(Bt.slice(0,ue),Ve),l=X}else h[g+t]=Bt[0]},Da=(f,I)=>{let g=ru(f,h,t,l,s,st,(b,k,z)=>{if(z)return n=!0;l=k;let V=h;return oe(b),rs(),V!==h?{position:l,targetView:te,target:h}:l},this);if(g===0)return vr(f,!0);l=g}}useBuffer(e){h=e,te=new DataView(h.buffer,h.byteOffset,h.byteLength),l=0}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}Ta=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,ga];En=[{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?Os(r,16,e):Ts(un?Buffer.from(r):new Uint8Array(r),e)}},{pack(r,e){let t=r.constructor;t!==Sa&&this.moreTypes?Os(r,ka.indexOf(t.name),e):Ts(r,e)}},{pack(r,e){let{target:t,position:n}=e(1);t[n]=193}}];function Os(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 Ts(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 iu(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 ou(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 Ss(r,e,t){if(se.length>0){te.setUint32(se.position+r,l+t-se.position-r),se.stringsPosition=l-r;let n=se;se=null,e(n[0]),e(n[1])}}function uu(r,e){return r.isCompatible=t=>{let n=!t||(e.lastNamedStructuresLength||0)===t.length;return n||e._mergeStructures(t),n},r}let Na=new au({useRecords:!1});const cu=Na.pack;Na.pack;const lu=512,du=1024,hu=2048;class fu{constructor(){w(this,"contentType","application/msgpack")}encode(e){return cu(Ut.toSnake(e))}decode(e,t){const n=Ut.toCamel(eu(new Uint8Array(e)));return t!=null?t.parse(n):n}}class pu{constructor(){w(this,"contentType","application/json"),w(this,"decoder"),this.decoder=new TextDecoder}encode(e){const t=JSON.stringify(Ut.toSnake(e),(n,s)=>ArrayBuffer.isView(s)?Array.from(s):Bo(s)&&"encode_value"in s?typeof s.value=="bigint"?s.value.toString():s.value:typeof s=="bigint"?s.toString():s);return new TextEncoder().encode(t)}decode(e,t){const n=Ut.toCamel(JSON.parse(this.decoder.decode(e)));return t!=null?t.parse(n):n}static registerCustomType(){}}new fu,new pu;var q;(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})(q||(q={}));var Cn;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Cn||(Cn={}));const T=q.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ot=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}},_=q.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"]),mu=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class je 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,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,q.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()}}je.create=r=>new je(r);const Qt=(r,e)=>{let t;switch(r.code){case _.invalid_type:r.received===T.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case _.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,q.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:t=`Unrecognized key(s) in object: ${q.joinValues(r.keys,", ")}`;break;case _.invalid_union:t="Invalid input";break;case _.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${q.joinValues(r.options)}`;break;case _.invalid_enum_value:t=`Invalid enum value. Expected ${q.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}"`:q.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,q.assertNever(r)}return{message:t}};let Ia=Qt;function yu(r){Ia=r}function Kr(){return Ia}const Wr=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(i,{data:e,defaultError:o}).message;return{...s,path:a,message:s.message||o}},gu=[];function N(r,e){const t=Wr({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Kr(),Qt].filter(n=>!!n)});r.common.issues.push(t)}class ve{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 ve.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"}),Aa=r=>({status:"dirty",value:r}),ke=r=>({status:"valid",value:r}),Zn=r=>r.status==="aborted",jn=r=>r.status==="dirty",er=r=>r.status==="valid",Yr=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={}));class $e{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 Ns=(r,e)=>{if(er(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 je(r.common.issues);return this._error=t,this._error}}};function D(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 ${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 ot(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ot(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:ot(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Yr(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:ot(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Ns(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:ot(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Yr(s)?s:Promise.resolve(s));return Ns(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(u=>u?!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 Me({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return tt.create(this,this._def)}nullable(){return Tt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Re.create(this,this._def)}promise(){return Pt.create(this,this._def)}or(e){return sr.create([this,e],this._def)}and(e){return ar.create(this,e,this._def)}transform(e){return new Me({...D(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new lr({...D(this._def),innerType:this,defaultValue:t,typeName:j.ZodDefault})}brand(){return new Ca({typeName:j.ZodBranded,type:this,...D(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Hr({...D(this._def),innerType:this,catchValue:t,typeName:j.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return mr.create(this,e)}readonly(){return Qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const vu=/^c[^\s-]{8,}$/i,_u=/^[a-z][a-z0-9]*$/,bu=/^[0-9A-HJKMNP-TV-Z]{26}$/,wu=/^[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,xu=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ku="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wn;const Ou=/^(((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}))$/,Tu=/^(([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})))$/,Su=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 Nu(r,e){return!!((e==="v4"||!e)&&Ou.test(r)||(e==="v6"||!e)&&Tu.test(r))}class Ee extends ${_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==T.string){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:T.string,received:a.parsedType}),U}const n=new ve;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")xu.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")wn||(wn=new RegExp(ku,"u")),wn.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")wu.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")vu.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")_u.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")bu.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"?Su(a).test(e.data)||(s=this._getOrReturnCtx(e,s),N(s,{code:_.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Nu(e.data,a.version)||(s=this._getOrReturnCtx(e,s),N(s,{validation:"ip",code:_.invalid_string,message:a.message}),n.dirty()):q.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,...C.errToObj(n)})}_addCheck(e){return new Ee({...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 Ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ee({...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}}Ee.create=r=>{var e;return new Ee({checks:[],typeName:j.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...D(r)})};function Iu(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 ft extends ${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 N(a,{code:_.invalid_type,expected:T.number,received:a.parsedType}),U}let n;const s=new ve;for(const a of this._def.checks)a.kind==="int"?q.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"?Iu(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()):q.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 ft({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new ft({...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"&&q.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)}}ft.create=r=>new ft({checks:[],typeName:j.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...D(r)});class pt extends ${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 N(a,{code:_.invalid_type,expected:T.bigint,received:a.parsedType}),U}let n;const s=new ve;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()):q.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 pt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:C.toString(s)}]})}_addCheck(e){return new pt({...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}}pt.create=r=>{var e;return new pt({checks:[],typeName:j.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...D(r)})};class tr extends ${_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==T.boolean){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.boolean,received:n.parsedType}),U}return ke(e.data)}}tr.create=r=>new tr({typeName:j.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...D(r)});class kt extends ${_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==T.date){const a=this._getOrReturnCtx(e);return N(a,{code:_.invalid_type,expected:T.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 ve;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()):q.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new kt({...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}}kt.create=r=>new kt({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:j.ZodDate,...D(r)});class qr extends ${_parse(e){if(this._getType(e)!==T.symbol){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.symbol,received:n.parsedType}),U}return ke(e.data)}}qr.create=r=>new qr({typeName:j.ZodSymbol,...D(r)});class rr extends ${_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.undefined,received:n.parsedType}),U}return ke(e.data)}}rr.create=r=>new rr({typeName:j.ZodUndefined,...D(r)});class nr extends ${_parse(e){if(this._getType(e)!==T.null){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.null,received:n.parsedType}),U}return ke(e.data)}}nr.create=r=>new nr({typeName:j.ZodNull,...D(r)});class Mt extends ${constructor(){super(...arguments),this._any=!0}_parse(e){return ke(e.data)}}Mt.create=r=>new Mt({typeName:j.ZodAny,...D(r)});class _t extends ${constructor(){super(...arguments),this._unknown=!0}_parse(e){return ke(e.data)}}_t.create=r=>new _t({typeName:j.ZodUnknown,...D(r)});class nt extends ${_parse(e){const t=this._getOrReturnCtx(e);return N(t,{code:_.invalid_type,expected:T.never,received:t.parsedType}),U}}nt.create=r=>new nt({typeName:j.ZodNever,...D(r)});class Gr extends ${_parse(e){if(this._getType(e)!==T.undefined){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.void,received:n.parsedType}),U}return ke(e.data)}}Gr.create=r=>new Gr({typeName:j.ZodVoid,...D(r)});class Re extends ${_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==T.array)return N(t,{code:_.invalid_type,expected:T.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 $e(t,i,t.path,o)))).then(i=>ve.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new $e(t,i,t.path,o)));return ve.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new Re({...this._def,minLength:{value:e,message:C.toString(t)}})}max(e,t){return new Re({...this._def,maxLength:{value:e,message:C.toString(t)}})}length(e,t){return new Re({...this._def,exactLength:{value:e,message:C.toString(t)}})}nonempty(e){return this.min(1,e)}}Re.create=(r,e)=>new Re({type:r,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...D(e)});function Et(r){if(r instanceof ie){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=tt.create(Et(n))}return new ie({...r._def,shape:()=>e})}else return r instanceof Re?new Re({...r._def,type:Et(r.element)}):r instanceof tt?tt.create(Et(r.unwrap())):r instanceof Tt?Tt.create(Et(r.unwrap())):r instanceof ze?ze.create(r.items.map(e=>Et(e))):r}class ie extends ${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=q.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==T.object){const d=this._getOrReturnCtx(e);return N(d,{code:_.invalid_type,expected:T.object,received:d.parsedType}),U}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof nt&&this._def.unknownKeys==="strip"))for(const d in s.data)i.includes(d)||o.push(d);const u=[];for(const d of i){const p=a[d],A=s.data[d];u.push({key:{status:"valid",value:d},value:p._parse(new $e(s,A,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof nt){const d=this._def.unknownKeys;if(d==="passthrough")for(const p of o)u.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(d==="strict")o.length>0&&(N(s,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const p of o){const A=s.data[p];u.push({key:{status:"valid",value:p},value:d._parse(new $e(s,A,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const p of u){const A=await p.key;d.push({key:A,value:await p.value,alwaysSet:p.alwaysSet})}return d}).then(d=>ve.mergeObjectSync(n,d)):ve.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return C.errToObj,new ie({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const u=(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:u}:{message:u}}}:{}})}strip(){return new ie({...this._def,unknownKeys:"strip"})}passthrough(){return new ie({...this._def,unknownKeys:"passthrough"})}extend(e){return new ie({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ie({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:j.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ie({...this._def,catchall:e})}pick(e){const t={};return q.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new ie({...this._def,shape:()=>t})}omit(e){const t={};return q.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new ie({...this._def,shape:()=>t})}deepPartial(){return Et(this)}partial(e){const t={};return q.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new ie({...this._def,shape:()=>t})}required(e){const t={};return q.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof tt;)a=a._def.innerType;t[n]=a}}),new ie({...this._def,shape:()=>t})}keyof(){return Ea(q.objectKeys(this.shape))}}ie.create=(r,e)=>new ie({shape:()=>r,unknownKeys:"strip",catchall:nt.create(),typeName:j.ZodObject,...D(e)});ie.strictCreate=(r,e)=>new ie({shape:()=>r,unknownKeys:"strict",catchall:nt.create(),typeName:j.ZodObject,...D(e)});ie.lazycreate=(r,e)=>new ie({shape:r,unknownKeys:"strip",catchall:nt.create(),typeName:j.ZodObject,...D(e)});class sr extends ${_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 je(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 u of n){const d={...t,common:{...t.common,issues:[]},parent:null},p=u._parseSync({data:t.data,path:t.path,parent:d});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new je(u));return N(t,{code:_.invalid_union,unionErrors:o}),U}}get options(){return this._def.options}}sr.create=(r,e)=>new sr({options:r,typeName:j.ZodUnion,...D(e)});const jr=r=>r instanceof or?jr(r.schema):r instanceof Me?jr(r.innerType()):r instanceof ur?[r.value]:r instanceof mt?r.options:r instanceof cr?Object.keys(r.enum):r instanceof lr?jr(r._def.innerType):r instanceof rr?[void 0]:r instanceof nr?[null]:null;class cn extends ${_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.object)return N(t,{code:_.invalid_type,expected:T.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 cn({typeName:j.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...D(n)})}}function Rn(r,e){const t=ot(r),n=ot(e);if(r===e)return{valid:!0,data:r};if(t===T.object&&n===T.object){const s=q.objectKeys(e),a=q.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const u=Rn(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.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],u=Rn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return t===T.date&&n===T.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class ar extends ${_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(Zn(a)||Zn(i))return U;const o=Rn(a.value,i.value);return o.valid?((jn(a)||jn(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}))}}ar.create=(r,e,t)=>new ar({left:r,right:e,typeName:j.ZodIntersection,...D(t)});class ze extends ${_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.array)return N(n,{code:_.invalid_type,expected:T.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 u=this._def.items[o]||this._def.rest;return u?u._parse(new $e(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>ve.mergeArray(t,i)):ve.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ze({...this._def,rest:e})}}ze.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ze({items:r,typeName:j.ZodTuple,rest:null,...D(e)})};class ir extends ${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 N(n,{code:_.invalid_type,expected:T.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 $e(n,o,n.path,o)),value:i._parse(new $e(n,n.data[o],n.path,o))});return n.common.async?ve.mergeObjectAsync(t,s):ve.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof $?new ir({keyType:e,valueType:t,typeName:j.ZodRecord,...D(n)}):new ir({keyType:Ee.create(),valueType:e,typeName:j.ZodRecord,...D(t)})}}class Jr extends ${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 N(n,{code:_.invalid_type,expected:T.map,received:n.parsedType}),U;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,u],d)=>({key:s._parse(new $e(n,o,n.path,[d,"key"])),value:a._parse(new $e(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const d=await u.key,p=await u.value;if(d.status==="aborted"||p.status==="aborted")return U;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const d=u.key,p=u.value;if(d.status==="aborted"||p.status==="aborted")return U;(d.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(d.value,p.value)}return{status:t.value,value:o}}}}Jr.create=(r,e,t)=>new Jr({valueType:e,keyType:r,typeName:j.ZodMap,...D(t)});class Ot extends ${_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.set)return N(n,{code:_.invalid_type,expected:T.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(u){const d=new Set;for(const p of u){if(p.status==="aborted")return U;p.status==="dirty"&&t.dirty(),d.add(p.value)}return{status:t.value,value:d}}const o=[...n.data.values()].map((u,d)=>a._parse(new $e(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new Ot({...this._def,minSize:{value:e,message:C.toString(t)}})}max(e,t){return new Ot({...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)}}Ot.create=(r,e)=>new Ot({valueType:r,minSize:null,maxSize:null,typeName:j.ZodSet,...D(e)});class Zt extends ${constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.function)return N(t,{code:_.invalid_type,expected:T.function,received:t.parsedType}),U;function n(o,u){return Wr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),Qt].filter(d=>!!d),issueData:{code:_.invalid_arguments,argumentsError:u}})}function s(o,u){return Wr({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kr(),Qt].filter(d=>!!d),issueData:{code:_.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Pt){const o=this;return ke(async function(...u){const d=new je([]),p=await o._def.args.parseAsync(u,a).catch(ne=>{throw d.addIssue(n(u,ne)),d}),A=await Reflect.apply(i,this,p);return await o._def.returns._def.type.parseAsync(A,a).catch(ne=>{throw d.addIssue(s(A,ne)),d})})}else{const o=this;return ke(function(...u){const d=o._def.args.safeParse(u,a);if(!d.success)throw new je([n(u,d.error)]);const p=Reflect.apply(i,this,d.data),A=o._def.returns.safeParse(p,a);if(!A.success)throw new je([s(p,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Zt({...this._def,args:ze.create(e).rest(_t.create())})}returns(e){return new Zt({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Zt({args:e||ze.create([]).rest(_t.create()),returns:t||_t.create(),typeName:j.ZodFunction,...D(n)})}}class or extends ${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})}}or.create=(r,e)=>new or({getter:r,typeName:j.ZodLazy,...D(e)});class ur extends ${_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}}ur.create=(r,e)=>new ur({value:r,typeName:j.ZodLiteral,...D(e)});function Ea(r,e){return new mt({values:r,typeName:j.ZodEnum,...D(e)})}class mt extends ${_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return N(t,{expected:q.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 ke(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 mt.create(e)}exclude(e){return mt.create(this.options.filter(t=>!e.includes(t)))}}mt.create=Ea;class cr extends ${_parse(e){const t=q.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==T.string&&n.parsedType!==T.number){const s=q.objectValues(t);return N(n,{expected:q.joinValues(s),received:n.parsedType,code:_.invalid_type}),U}if(t.indexOf(e.data)===-1){const s=q.objectValues(t);return N(n,{received:n.data,code:_.invalid_enum_value,options:s}),U}return ke(e.data)}get enum(){return this._def.values}}cr.create=(r,e)=>new cr({values:r,typeName:j.ZodNativeEnum,...D(e)});class Pt extends ${unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==T.promise&&t.common.async===!1)return N(t,{code:_.invalid_type,expected:T.promise,received:t.parsedType}),U;const n=t.parsedType===T.promise?t.data:Promise.resolve(t.data);return ke(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Pt.create=(r,e)=>new Pt({type:r,typeName:j.ZodPromise,...D(e)});class Me extends ${innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.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 u=s.refinement(o,a);if(n.common.async)return Promise.resolve(u);if(u 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(!er(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=>er(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);q.assertNever(s)}}Me.create=(r,e,t)=>new Me({schema:r,typeName:j.ZodEffects,effect:e,...D(t)});Me.createWithPreprocess=(r,e,t)=>new Me({schema:e,effect:{type:"preprocess",transform:r},typeName:j.ZodEffects,...D(t)});class tt extends ${_parse(e){return this._getType(e)===T.undefined?ke(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tt.create=(r,e)=>new tt({innerType:r,typeName:j.ZodOptional,...D(e)});class Tt extends ${_parse(e){return this._getType(e)===T.null?ke(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tt.create=(r,e)=>new Tt({innerType:r,typeName:j.ZodNullable,...D(e)});class lr extends ${_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}}lr.create=(r,e)=>new lr({innerType:r,typeName:j.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...D(e)});class Hr extends ${_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 Yr(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new je(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new je(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Hr.create=(r,e)=>new Hr({innerType:r,typeName:j.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...D(e)});class Xr extends ${_parse(e){if(this._getType(e)!==T.nan){const n=this._getOrReturnCtx(e);return N(n,{code:_.invalid_type,expected:T.nan,received:n.parsedType}),U}return{status:"valid",value:e.data}}}Xr.create=r=>new Xr({typeName:j.ZodNaN,...D(r)});const Au=Symbol("zod_brand");class Ca extends ${_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 mr extends ${_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(),Aa(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 mr({in:e,out:t,typeName:j.ZodPipeline})}}class Qr extends ${_parse(e){const t=this._def.innerType._parse(e);return er(t)&&(t.value=Object.freeze(t.value)),t}}Qr.create=(r,e)=>new Qr({innerType:r,typeName:j.ZodReadonly,...D(e)});const Za=(r,e={},t)=>r?Mt.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...d,fatal:u})}}):Mt.create(),Eu={object:ie.lazycreate};var j;(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"})(j||(j={}));const Cu=(r,e={message:`Input not instance of ${r.name}`})=>Za(t=>t instanceof r,e),ja=Ee.create,Ra=ft.create,Zu=Xr.create,ju=pt.create,Ua=tr.create,Ru=kt.create,Uu=qr.create,Mu=rr.create,Pu=nr.create,Bu=Mt.create,Du=_t.create,Lu=nt.create,$u=Gr.create,zu=Re.create,Vu=ie.create,Fu=ie.strictCreate,Ku=sr.create,Wu=cn.create,Yu=ar.create,qu=ze.create,Gu=ir.create,Ju=Jr.create,Hu=Ot.create,Xu=Zt.create,Qu=or.create,ec=ur.create,tc=mt.create,rc=cr.create,nc=Pt.create,Is=Me.create,sc=tt.create,ac=Tt.create,ic=Me.createWithPreprocess,oc=mr.create,uc=()=>ja().optional(),cc=()=>Ra().optional(),lc=()=>Ua().optional(),dc={string:r=>Ee.create({...r,coerce:!0}),number:r=>ft.create({...r,coerce:!0}),boolean:r=>tr.create({...r,coerce:!0}),bigint:r=>pt.create({...r,coerce:!0}),date:r=>kt.create({...r,coerce:!0})},hc=U;var Xe=Object.freeze({__proto__:null,defaultErrorMap:Qt,setErrorMap:yu,getErrorMap:Kr,makeIssue:Wr,EMPTY_PATH:gu,addIssueToContext:N,ParseStatus:ve,INVALID:U,DIRTY:Aa,OK:ke,isAborted:Zn,isDirty:jn,isValid:er,isAsync:Yr,get util(){return q},get objectUtil(){return Cn},ZodParsedType:T,getParsedType:ot,ZodType:$,ZodString:Ee,ZodNumber:ft,ZodBigInt:pt,ZodBoolean:tr,ZodDate:kt,ZodSymbol:qr,ZodUndefined:rr,ZodNull:nr,ZodAny:Mt,ZodUnknown:_t,ZodNever:nt,ZodVoid:Gr,ZodArray:Re,ZodObject:ie,ZodUnion:sr,ZodDiscriminatedUnion:cn,ZodIntersection:ar,ZodTuple:ze,ZodRecord:ir,ZodMap:Jr,ZodSet:Ot,ZodFunction:Zt,ZodLazy:or,ZodLiteral:ur,ZodEnum:mt,ZodNativeEnum:cr,ZodPromise:Pt,ZodEffects:Me,ZodTransformer:Me,ZodOptional:tt,ZodNullable:Tt,ZodDefault:lr,ZodCatch:Hr,ZodNaN:Xr,BRAND:Au,ZodBranded:Ca,ZodPipeline:mr,ZodReadonly:Qr,custom:Za,Schema:$,ZodSchema:$,late:Eu,get ZodFirstPartyTypeKind(){return j},coerce:dc,any:Bu,array:zu,bigint:ju,boolean:Ua,date:Ru,discriminatedUnion:Wu,effect:Is,enum:tc,function:Xu,instanceof:Cu,intersection:Yu,lazy:Qu,literal:ec,map:Ju,nan:Zu,nativeEnum:rc,never:Lu,null:Pu,nullable:ac,number:Ra,object:Vu,oboolean:lc,onumber:cc,optional:sc,ostring:uc,pipeline:oc,preprocess:ic,promise:nc,record:Gu,set:Hu,strictObject:Fu,string:ja,symbol:Uu,transformer:Is,tuple:qu,undefined:Mu,union:Ku,unknown:Du,void:$u,NEVER:hc,ZodIssueCode:_,quotelessJson:mu,ZodError:je});class yr extends Error{constructor(t,n){super(t);le(this,"discriminator","FreighterError");le(this,"type");this.type=n}}const fc=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},Un="unknown",As="nil",ln="freighter",Qn=Xe.object({type:Xe.string(),data:Xe.string()});class pc{constructor(){le(this,"providers",[])}register(e){this.providers.push(e)}encode(e){if(e==null)return{type:As,data:""};if(fc(e))for(const t of this.providers){const n=t.encode(e);if(n!=null)return n}return{type:Un,data:JSON.stringify(e)}}decode(e){if(e==null||e.type===As)return null;if(e.type===Un)return new Es(e.data);for(const t of this.providers){const n=t.decode(e);if(n!=null)return n}return new Es(e.data)}}const es=new pc,Ma=({encode:r,decode:e})=>es.register({encode:r,decode:e}),mc=r=>es.encode(r),ts=r=>es.decode(r);class Es extends yr{constructor(e){super(e,Un)}}class dr extends yr{constructor(){super("EOF",ln)}}class hr extends yr{constructor(){super("StreamClosed",ln)}}class dn extends yr{constructor(t={}){const{message:n="Unreachable",url:s=Wo.UNKNOWN}=t;super(n,ln);le(this,"url");this.url=s}}const Rr="freighter",yc=r=>{if(r.type!==ln)return null;if(r instanceof dr)return{type:Rr,data:"EOF"};if(r instanceof hr)return{type:Rr,data:"StreamClosed"};if(r instanceof dn)return{type:Rr,data:"Unreachable"};throw new Error(`Unknown error type: ${r.type}: ${r.message}`)},gc=r=>{if(r.type!==Rr)return null;switch(r.data){case"EOF":return new dr;case"StreamClosed":return new hr;case"Unreachable":return new dn;default:throw new Error(`Unknown error type: ${r.data}`)}};Ma({encode:yc,decode:gc});class Pa{constructor(){le(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 Ba="Content-Type",Cs=r=>{if(ma.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 vc extends Pa{constructor(t,n,s=!1){super();le(this,"endpoint");le(this,"encoder");le(this,"fetch");return this.endpoint=t.replace({protocol:s?"https":"http"}),this.encoder=n,this.fetch=Cs(this.endpoint.protocol),new Proxy(this,{get:(a,i,o)=>i==="endpoint"?this.endpoint:Reflect.get(a,i,o)})}get headers(){return{[Ba]:this.encoder.contentType}}async send(t,n,s,a){n=s==null?void 0:s.parse(n);let i=null;const o=this.endpoint.child(t),u={};u.method="POST",u.body=this.encoder.encode(n??{});const[,d]=await this.executeMiddleware({target:o.toString(),protocol:this.endpoint.protocol,params:{},role:"client"},async p=>{const A={...p,params:{}};u.headers={...this.headers,...p.params};let J;try{J=await Cs(p.protocol)(p.target,u)}catch(pe){let H=pe;return H.message==="Load failed"&&(H=new dn({url:o})),[A,H]}const ne=await J.arrayBuffer();if(J!=null&&J.ok)return a!=null&&(i=this.encoder.decode(ne,a)),[A,null];try{if(J.status!==400)return[A,new Error(J.statusText)];const pe=this.encoder.decode(ne,Qn),H=ts(pe);return[A,H]}catch(pe){return[A,new Error(`[freighter] - failed to decode error: ${J.statusText}: ${pe.message}`)]}});return[i,d]}}const _c=async(r,e,t,n,s)=>{const[a,i]=await r.send(e,t,n,s);if(i!=null)throw i;return a},bc=()=>ma.RUNTIME!=="node"?r=>new WebSocket(r):r=>new(require("ws")).WebSocket(r,{rejectUnauthorized:!1}),wc=Xe.object({type:Xe.union([Xe.literal("data"),Xe.literal("close")]),payload:Xe.unknown().optional(),error:Xe.optional(Qn)});class xc{constructor(e,t,n,s){le(this,"encoder");le(this,"reqSchema");le(this,"resSchema");le(this,"ws");le(this,"serverClosed");le(this,"sendClosed");le(this,"receiveDataQueue",[]);le(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 dr;if(this.sendClosed)throw new hr;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=ts(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,wc),n=this.receiveCallbacksQueue.shift();n!=null?n.resolve(t):this.receiveDataQueue.push(t)},this.ws.onclose=e=>{this.serverClosed=Nc(e)?new dr:new hr}}}const kc="freighterctx",Oc=1e3,Tc=1001,Sc=[Oc,Tc],Nc=r=>Sc.includes(r.code),en=class en extends Pa{constructor(t,n,s=!1){super();le(this,"baseUrl");le(this,"encoder");this.baseUrl=t.replace({protocol:s?"wss":"ws"}),this.encoder=n}async stream(t,n,s){const a=bc();let i;const[,o]=await this.executeMiddleware({target:t,protocol:"websocket",params:{},role:"client"},async u=>{const d=a(this.buildURL(t,u)),p={...u,params:{}};d.binaryType=en.MESSAGE_TYPE;const A=await this.wrapSocket(d,n,s);return A instanceof Error?[p,A]:(i=A,[p,null])});if(o!=null)throw o;return i}buildURL(t,n){const s=Ko({[Ba]:this.encoder.contentType,...n.params},kc);return this.baseUrl.child(t).toString()+s}async wrapSocket(t,n,s){return await new Promise(a=>{t.onopen=()=>{a(new xc(t,this.encoder,n,s))},t.onerror=i=>{const o=i;a(new Error(o.message))}})}};le(en,"MESSAGE_TYPE","arraybuffer");let Mn=en;exports.BaseTypedError=yr;exports.EOF=dr;exports.HTTPClient=vc;exports.StreamClosed=hr;exports.Unreachable=dn;exports.WebSocketClient=Mn;exports.decodeError=ts;exports.encodeError=mc;exports.errorZ=Qn;exports.registerError=Ma;exports.sendRequired=_c;
|
|
2
2
|
//# sourceMappingURL=freighter.cjs.map
|