@arenarium/maps 1.0.189 → 1.0.190

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.
@@ -0,0 +1 @@
1
+ "use strict";var xt=Object.defineProperty;var kt=(n,e,t)=>e in n?xt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var R=(n,e,t)=>kt(n,typeof e!="symbol"?e+"":e,t);exports.Rectangle=void 0;(n=>{function e(t,s,r){const a=t/2,i=s/2,o=Math.sqrt(a*a+i*i),u=Math.atan(i/a)*(180/Math.PI),c=r*(Math.PI/180);return r<180?r<90?r<u?{x:0,y:o*Math.sin(c)-i}:{x:o*Math.cos(c)-a,y:0}:r<180-u?{x:o*Math.cos(c)-a,y:0}:{x:-t,y:o*Math.sin(c)-i}:r<270?r<180+u?{x:-t,y:o*Math.sin(c)-i}:{x:o*Math.cos(c)-a,y:-s}:r<360-u?{x:o*Math.cos(c)-a,y:-s}:{x:0,y:o*Math.sin(c)-i}}n.getOffsets=e})(exports.Rectangle||(exports.Rectangle={}));exports.Mercator=void 0;(n=>{function e(o,u,c){return{x:s(u)*c,y:r(o)*c}}n.project=e;function t(o,u,c){return{lat:i(u/c),lng:a(o/c)}}n.unproject=t;function s(o){return(180+o)/360}function r(o){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+o*Math.PI/360)))/360}function a(o){return o*360-180}function i(o){return 360/Math.PI*Math.atan(Math.exp((180-o*360)*Math.PI/180))-90}})(exports.Mercator||(exports.Mercator={}));exports.Angles=void 0;(n=>{n.COUNT=12,n.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330],n.DEGREES_DEFAULT=270})(exports.Angles||(exports.Angles={}));var ye;(n=>{const e=exports.Angles.DEGREES.map(c=>c*Math.PI/180),t=e.map(c=>Math.cos(c)),s=e.map(c=>Math.sin(c));function r(c,v){const N=Math.abs(v/c);return N<1?N<.26795?0:1:N<3.73205?2:3}function a(c,v){const N=r(c,v);return c>0?v>0?(12-N)%12:0+N:v>0?6+N:6-N}function i(c,v){return v==0?c:((c+v)%exports.Angles.COUNT+exports.Angles.COUNT)%exports.Angles.COUNT}function o(c){let v=!0;for(let N=0;N<c.length;N++){const z=c[N],j=z.particle,$=z.x,p=z.y,l=j.distX,f=j.distY,g=j.index,x=i(g,-1),_=i(g,1),k=$+l*t[x],E=p+f*s[x],C=$+l*t[g],me=p+f*s[g],be=$+l*t[_],ie=p+f*s[_];let H=0,U=0,J=0;const oe=z.neighbours;for(let we=0;we<oe.length;we++){const Ae=oe[we],Se=Ae.particle,gt=Ae.x,yt=Ae.y,vt=Se.distX,_t=Se.distY,Ge=Se.index,Ne=gt+vt*t[Ge],Te=yt+_t*s[Ge],Ye=k-Ne,Xe=E-Te;H+=1/(Ye*Ye+Xe*Xe);const He=C-Ne,Je=me-Te;U+=1/(He*He+Je*Je);const Qe=be-Ne,Ke=ie-Te;J+=1/(Qe*Qe+Ke*Ke)}let pe=0;H<U&&H<J&&(pe=-1),J<U&&J<H&&(pe=1),pe!=0&&(j.index=i(g,pe),v=!1)}return v}n.updateAngleIndexes=o;function u(c){for(let v=0;v<c.length;v++){const N=c[v],z=N.x,j=N.y;let $=0,p=0;for(let l=0;l<c.length;l++){const f=c[l],g=f.x,x=f.y,_=z-g,k=j-x;if(_==0&&k==0)continue;const E=Math.sqrt(_*_+k*k),C=1/(E*E);$+=C*_/E,p+=-(C*k)/E}N.particle.index=a($,p)}}n.initializeAngleIndexes=u})(ye||(ye={}));exports.Bounds=void 0;(n=>{function e(s,r){return!(s.x-s.distances.left>r.x+r.distances.right||s.x+s.distances.right<r.x-r.distances.left||s.y-s.distances.top>r.y+r.distances.bottom||s.y+s.distances.bottom<r.y-r.distances.top)}n.areOverlaping=e;function t(s,r){let a=Math.abs(s.x-r.x),o=(s.x<r.x?s.distances.right+r.distances.left:s.distances.left+r.distances.right)/a,u=Math.abs(s.y-r.y),v=(s.y<r.y?s.distances.bottom+r.distances.top:s.distances.top+r.distances.bottom)/u,N=Math.min(o,v);return Math.log2(N)}n.getZoomWhenTouching=t})(exports.Bounds||(exports.Bounds={}));var O;(function(n){n.assertEqual=r=>{};function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},n.getValidEnumValues=r=>{const a=n.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return n.objectValues(i)},n.objectValues=r=>n.objectKeys(r).map(function(a){return r[a]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},n.find=(r,a)=>{for(const i of r)if(a(i))return i},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}n.joinValues=s,n.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(O||(O={}));var et;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(et||(et={}));const m=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),W=n=>{switch(typeof n){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(n)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(n)?m.array:n===null?m.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?m.promise:typeof Map<"u"&&n instanceof Map?m.map:typeof Set<"u"&&n instanceof Set?m.set:typeof Date<"u"&&n instanceof Date?m.date:m.object;default:return m.unknown}},d=O.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"]);class L extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return r(this),s}static assert(e){if(!(e instanceof L))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const r of this.issues)if(r.path.length>0){const a=r.path[0];t[a]=t[a]||[],t[a].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}L.create=n=>new L(n);const ue=(n,e)=>{let t;switch(n.code){case d.invalid_type:n.received===m.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,O.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${O.joinValues(n.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${O.joinValues(n.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${O.joinValues(n.options)}, received '${n.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:O.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case d.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case d.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,O.assertNever(n)}return{message:t}};let bt=ue;function Ie(){return bt}const Ee=n=>{const{data:e,path:t,errorMaps:s,issueData:r}=n,a=[...t,...r.path||[]],i={...r,path:a};if(r.message!==void 0)return{...r,path:a,message:r.message};let o="";const u=s.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return{...r,path:a,message:o}};function h(n,e){const t=Ie(),s=Ee({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===ue?void 0:ue].filter(r=>!!r)});n.common.issues.push(s)}class D{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const r of t){if(r.status==="aborted")return b;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const r of t){const a=await r.key,i=await r.value;s.push({key:a,value:i})}return D.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const r of t){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return b;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||r.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const b=Object.freeze({status:"aborted"}),ce=n=>({status:"dirty",value:n}),P=n=>({status:"valid",value:n}),tt=n=>n.status==="aborted",nt=n=>n.status==="dirty",te=n=>n.status==="valid",ve=n=>typeof Promise<"u"&&n instanceof Promise;var y;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class Y{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const st=(n,e)=>{if(te(e))return{success:!0,data:e.value};if(!n.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 L(n.common.issues);return this._error=t,this._error}}};function A(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:r}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{const{message:u}=n;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??t??o.defaultError}},description:r}}class T{get description(){return this._def.description}_getType(e){return W(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:W(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new D,ctx:{common:e.parent.common,data:e.data,parsedType:W(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ve(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 s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:W(e)},r=this._parseSync({data:e,path:s.path,parent:s});return st(s,r)}"~validate"(e){var s,r;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:W(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return te(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(r=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>te(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={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:W(e)},r=this._parse({data:e,path:s.path,parent:s}),a=await(ve(r)?r:Promise.resolve(r));return st(s,a)}refine(e,t){const s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue({code:d.custom,...s(r)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new re({schema:this,typeName:w.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return G.create(this,this._def)}nullable(){return ae.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return fe.create(this,this._def)}or(e){return xe.create([this,e],this._def)}and(e){return ke.create(this,e,this._def)}transform(e){return new re({...A(this._def),schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ze({...A(this._def),innerType:this,defaultValue:t,typeName:w.ZodDefault})}brand(){return new Wt({typeName:w.ZodBranded,type:this,...A(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Pe({...A(this._def),innerType:this,catchValue:t,typeName:w.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Fe.create(this,e)}readonly(){return $e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const wt=/^c[^\s-]{8,}$/i,At=/^[0-9a-z]+$/,St=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nt=/^[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,Tt=/^[a-z0-9_-]{21}$/i,Ot=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ct=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,It=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Et="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Oe;const Rt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Mt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Pt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ft="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",$t=new RegExp(`^${ft}$`);function mt(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Dt(n){return new RegExp(`^${mt(n)}$`)}function Lt(n){let e=`${ft}T${mt(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Vt(n,e){return!!((e==="v4"||!e)&&Rt.test(n)||(e==="v6"||!e)&&Mt.test(n))}function Bt(n,e){if(!Ot.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Ft(n,e){return!!((e==="v4"||!e)&&Zt.test(n)||(e==="v6"||!e)&&jt.test(n))}class q extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:m.string,received:a.parsedType}),b}const s=new D;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?h(r,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&h(r,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")It.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"email",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Oe||(Oe=new RegExp(Et,"u")),Oe.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"emoji",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Nt.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"uuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Tt.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"nanoid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")wt.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")At.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid2",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")St.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"ulid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),h(r,{validation:"url",code:d.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"regex",code:d.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.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)||(r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Lt(a).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?$t.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Dt(a).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:d.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Ct.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"duration",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Vt(e.data,a.version)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"ip",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Bt(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"jwt",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Ft(e.data,a.version)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cidr",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?zt.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Pt.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64url",code:d.invalid_string,message:a.message}),s.dirty()):O.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:d.invalid_string,...y.errToObj(s)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(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}}q.create=n=>new q({checks:[],typeName:w.ZodString,coerce:(n==null?void 0:n.coerce)??!1,...A(n)});function Ut(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,a=Number.parseInt(n.toFixed(r).replace(".","")),i=Number.parseInt(e.toFixed(r).replace(".",""));return a%i/10**r}class ne extends T{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)!==m.number){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:m.number,received:a.parsedType}),b}let s;const r=new D;for(const a of this._def.checks)a.kind==="int"?O.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Ut(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.not_finite,message:a.message}),r.dirty()):O.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,s,r){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:y.toString(r)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.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"&&O.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ne.create=n=>new ne({checks:[],typeName:w.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...A(n)});class le extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let s;const r=new D;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),h(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):O.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),b}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,s,r){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:y.toString(r)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.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}}le.create=n=>new le({checks:[],typeName:w.ZodBigInt,coerce:(n==null?void 0:n.coerce)??!1,...A(n)});class Re extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.boolean,received:s.parsedType}),b}return P(e.data)}}Re.create=n=>new Re({typeName:w.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...A(n)});class _e extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:m.date,received:a.parsedType}),b}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_date}),b}const s=new D;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):O.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new _e({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.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}}_e.create=n=>new _e({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:w.ZodDate,...A(n)});class rt extends T{_parse(e){if(this._getType(e)!==m.symbol){const s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.symbol,received:s.parsedType}),b}return P(e.data)}}rt.create=n=>new rt({typeName:w.ZodSymbol,...A(n)});class at extends T{_parse(e){if(this._getType(e)!==m.undefined){const s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.undefined,received:s.parsedType}),b}return P(e.data)}}at.create=n=>new at({typeName:w.ZodUndefined,...A(n)});class it extends T{_parse(e){if(this._getType(e)!==m.null){const s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.null,received:s.parsedType}),b}return P(e.data)}}it.create=n=>new it({typeName:w.ZodNull,...A(n)});class Ze extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}}Ze.create=n=>new Ze({typeName:w.ZodAny,...A(n)});class ee extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}}ee.create=n=>new ee({typeName:w.ZodUnknown,...A(n)});class X extends T{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),b}}X.create=n=>new X({typeName:w.ZodNever,...A(n)});class Me extends T{_parse(e){if(this._getType(e)!==m.undefined){const s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.void,received:s.parsedType}),b}return P(e.data)}}Me.create=n=>new Me({typeName:w.ZodVoid,...A(n)});class B extends T{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.array)return h(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),b;if(r.exactLength!==null){const i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(h(t,{code:i?d.too_big:d.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(h(t,{code:d.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(h(t,{code:d.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new Y(t,i,t.path,o)))).then(i=>D.mergeArray(s,i));const a=[...t.data].map((i,o)=>r.type._parseSync(new Y(t,i,t.path,o)));return D.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new B({...this._def,minLength:{value:e,message:y.toString(t)}})}max(e,t){return new B({...this._def,maxLength:{value:e,message:y.toString(t)}})}length(e,t){return new B({...this._def,exactLength:{value:e,message:y.toString(t)}})}nonempty(e){return this.min(1,e)}}B.create=(n,e)=>new B({type:n,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray,...A(e)});function K(n){if(n instanceof Z){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=G.create(K(s))}return new Z({...n._def,shape:()=>e})}else return n instanceof B?new B({...n._def,type:K(n.element)}):n instanceof G?G.create(K(n.unwrap())):n instanceof ae?ae.create(K(n.unwrap())):n instanceof F?F.create(n.items.map(e=>K(e))):n}class Z extends T{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=O.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const c=this._getOrReturnCtx(e);return h(c,{code:d.invalid_type,expected:m.object,received:c.parsedType}),b}const{status:s,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof X&&this._def.unknownKeys==="strip"))for(const c in r.data)i.includes(c)||o.push(c);const u=[];for(const c of i){const v=a[c],N=r.data[c];u.push({key:{status:"valid",value:c},value:v._parse(new Y(r,N,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof X){const c=this._def.unknownKeys;if(c==="passthrough")for(const v of o)u.push({key:{status:"valid",value:v},value:{status:"valid",value:r.data[v]}});else if(c==="strict")o.length>0&&(h(r,{code:d.unrecognized_keys,keys:o}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const v of o){const N=r.data[v];u.push({key:{status:"valid",value:v},value:c._parse(new Y(r,N,r.path,v)),alwaysSet:v in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const v of u){const N=await v.key,z=await v.value;c.push({key:N,value:z,alwaysSet:v.alwaysSet})}return c}).then(c=>D.mergeObjectSync(s,c)):D.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new Z({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var a,i;const r=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,s).message)??s.defaultError;return t.code==="unrecognized_keys"?{message:y.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new Z({...this._def,unknownKeys:"strip"})}passthrough(){return new Z({...this._def,unknownKeys:"passthrough"})}extend(e){return new Z({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Z({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:w.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Z({...this._def,catchall:e})}pick(e){const t={};for(const s of O.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new Z({...this._def,shape:()=>t})}omit(e){const t={};for(const s of O.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new Z({...this._def,shape:()=>t})}deepPartial(){return K(this)}partial(e){const t={};for(const s of O.objectKeys(this.shape)){const r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new Z({...this._def,shape:()=>t})}required(e){const t={};for(const s of O.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof G;)a=a._def.innerType;t[s]=a}return new Z({...this._def,shape:()=>t})}keyof(){return pt(O.objectKeys(this.shape))}}Z.create=(n,e)=>new Z({shape:()=>n,unknownKeys:"strip",catchall:X.create(),typeName:w.ZodObject,...A(e)});Z.strictCreate=(n,e)=>new Z({shape:()=>n,unknownKeys:"strict",catchall:X.create(),typeName:w.ZodObject,...A(e)});Z.lazycreate=(n,e)=>new Z({shape:n,unknownKeys:"strip",catchall:X.create(),typeName:w.ZodObject,...A(e)});class xe extends T{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function r(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 L(o.ctx.common.issues));return h(t,{code:d.invalid_union,unionErrors:i}),b}if(t.common.async)return Promise.all(s.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(r);{let a;const i=[];for(const u of s){const c={...t,common:{...t.common,issues:[]},parent:null},v=u._parseSync({data:t.data,path:t.path,parent:c});if(v.status==="valid")return v;v.status==="dirty"&&!a&&(a={result:v,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new L(u));return h(t,{code:d.invalid_union,unionErrors:o}),b}}get options(){return this._def.options}}xe.create=(n,e)=>new xe({options:n,typeName:w.ZodUnion,...A(e)});function je(n,e){const t=W(n),s=W(e);if(n===e)return{valid:!0,data:n};if(t===m.object&&s===m.object){const r=O.objectKeys(e),a=O.objectKeys(n).filter(o=>r.indexOf(o)!==-1),i={...n,...e};for(const o of a){const u=je(n[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===m.array&&s===m.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<n.length;a++){const i=n[a],o=e[a],u=je(i,o);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===m.date&&s===m.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class ke extends T{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=(a,i)=>{if(tt(a)||tt(i))return b;const o=je(a.value,i.value);return o.valid?((nt(a)||nt(i))&&t.dirty(),{status:t.value,value:o.data}):(h(s,{code:d.invalid_intersection_types}),b)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ke.create=(n,e,t)=>new ke({left:n,right:e,typeName:w.ZodIntersection,...A(t)});class F extends T{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.array)return h(s,{code:d.invalid_type,expected:m.array,received:s.parsedType}),b;if(s.data.length<this._def.items.length)return h(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&s.data.length>this._def.items.length&&(h(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new Y(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>D.mergeArray(t,i)):D.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new F({...this._def,rest:e})}}F.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new F({items:n,typeName:w.ZodTuple,rest:null,...A(e)})};class ot extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.map)return h(s,{code:d.invalid_type,expected:m.map,received:s.parsedType}),b;const r=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,u],c)=>({key:r._parse(new Y(s,o,s.path,[c,"key"])),value:a._parse(new Y(s,u,s.path,[c,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of i){const c=await u.key,v=await u.value;if(c.status==="aborted"||v.status==="aborted")return b;(c.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(c.value,v.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const u of i){const c=u.key,v=u.value;if(c.status==="aborted"||v.status==="aborted")return b;(c.status==="dirty"||v.status==="dirty")&&t.dirty(),o.set(c.value,v.value)}return{status:t.value,value:o}}}}ot.create=(n,e,t)=>new ot({valueType:e,keyType:n,typeName:w.ZodMap,...A(t)});class he extends T{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==m.set)return h(s,{code:d.invalid_type,expected:m.set,received:s.parsedType}),b;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(h(s,{code:d.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(h(s,{code:d.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const v of u){if(v.status==="aborted")return b;v.status==="dirty"&&t.dirty(),c.add(v.value)}return{status:t.value,value:c}}const o=[...s.data.values()].map((u,c)=>a._parse(new Y(s,u,s.path,c)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new he({...this._def,minSize:{value:e,message:y.toString(t)}})}max(e,t){return new he({...this._def,maxSize:{value:e,message:y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}he.create=(n,e)=>new he({valueType:n,minSize:null,maxSize:null,typeName:w.ZodSet,...A(e)});class de extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return h(t,{code:d.invalid_type,expected:m.function,received:t.parsedType}),b;function s(o,u){return Ee({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ie(),ue].filter(c=>!!c),issueData:{code:d.invalid_arguments,argumentsError:u}})}function r(o,u){return Ee({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ie(),ue].filter(c=>!!c),issueData:{code:d.invalid_return_type,returnTypeError:u}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof fe){const o=this;return P(async function(...u){const c=new L([]),v=await o._def.args.parseAsync(u,a).catch(j=>{throw c.addIssue(s(u,j)),c}),N=await Reflect.apply(i,this,v);return await o._def.returns._def.type.parseAsync(N,a).catch(j=>{throw c.addIssue(r(N,j)),c})})}else{const o=this;return P(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new L([s(u,c.error)]);const v=Reflect.apply(i,this,c.data),N=o._def.returns.safeParse(v,a);if(!N.success)throw new L([r(v,N.error)]);return N.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new de({...this._def,args:F.create(e).rest(ee.create())})}returns(e){return new de({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new de({args:e||F.create([]).rest(ee.create()),returns:t||ee.create(),typeName:w.ZodFunction,...A(s)})}}class ct extends T{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})}}ct.create=(n,e)=>new ct({getter:n,typeName:w.ZodLazy,...A(e)});class dt extends T{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}}dt.create=(n,e)=>new dt({value:n,typeName:w.ZodLiteral,...A(e)});function pt(n,e){return new se({values:n,typeName:w.ZodEnum,...A(e)})}class se extends T{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{expected:O.joinValues(s),received:t.parsedType,code:d.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{received:t.data,code:d.invalid_enum_value,options:s}),b}return P(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,t=this._def){return se.create(e,{...this._def,...t})}exclude(e,t=this._def){return se.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}se.create=pt;class ut extends T{_parse(e){const t=O.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==m.string&&s.parsedType!==m.number){const r=O.objectValues(t);return h(s,{expected:O.joinValues(r),received:s.parsedType,code:d.invalid_type}),b}if(this._cache||(this._cache=new Set(O.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=O.objectValues(t);return h(s,{received:s.data,code:d.invalid_enum_value,options:r}),b}return P(e.data)}get enum(){return this._def.values}}ut.create=(n,e)=>new ut({values:n,typeName:w.ZodNativeEnum,...A(e)});class fe extends T{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return h(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),b;const s=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return P(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}fe.create=(n,e)=>new fe({type:n,typeName:w.ZodPromise,...A(e)});class re extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{h(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return b;const u=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return u.status==="aborted"?b:u.status==="dirty"||t.value==="dirty"?ce(u.value):u});{if(t.value==="aborted")return b;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?b:o.status==="dirty"||t.value==="dirty"?ce(o.value):o}}if(r.type==="refinement"){const i=o=>{const u=r.refinement(o,a);if(s.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(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?b:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?b:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!te(i))return b;const o=r.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:s.data,path:s.path,parent:s}).then(i=>te(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:t.value,value:o})):b);O.assertNever(r)}}re.create=(n,e,t)=>new re({schema:n,typeName:w.ZodEffects,effect:e,...A(t)});re.createWithPreprocess=(n,e,t)=>new re({schema:e,effect:{type:"preprocess",transform:n},typeName:w.ZodEffects,...A(t)});class G extends T{_parse(e){return this._getType(e)===m.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(n,e)=>new G({innerType:n,typeName:w.ZodOptional,...A(e)});class ae extends T{_parse(e){return this._getType(e)===m.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ae.create=(n,e)=>new ae({innerType:n,typeName:w.ZodNullable,...A(e)});class ze extends T{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===m.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ze.create=(n,e)=>new ze({innerType:n,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...A(e)});class Pe extends T{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ve(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new L(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new L(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Pe.create=(n,e)=>new Pe({innerType:n,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...A(e)});class lt extends T{_parse(e){if(this._getType(e)!==m.nan){const s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:m.nan,received:s.parsedType}),b}return{status:"valid",value:e.data}}}lt.create=n=>new lt({typeName:w.ZodNaN,...A(n)});class Wt extends T{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Fe extends T{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?b:a.status==="dirty"?(t.dirty(),ce(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?b:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new Fe({in:e,out:t,typeName:w.ZodPipeline})}}class $e extends T{_parse(e){const t=this._def.innerType._parse(e),s=r=>(te(r)&&(r.value=Object.freeze(r.value)),r);return ve(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}}$e.create=(n,e)=>new $e({innerType:n,typeName:w.ZodReadonly,...A(e)});var w;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(w||(w={}));const Q=q.create,S=ne.create,De=Re.create,Ue=Ze.create;ee.create;X.create;const ge=Me.create,We=B.create,I=Z.create;xe.create;ke.create;const ht=F.create,V=de.create,qt=se.create,Gt=fe.create;G.create;ae.create;I({pin:I({fade:De().optional(),maxCount:S().optional(),maxZoom:S().optional()}).optional(),animation:I({queue:I({limit:S().optional()}).optional()}).optional(),api:I({states:I({url:Q().optional(),key:Q()}).optional(),log:I({enabled:De()}).optional()}).optional()});const Le=S().min(-90).max(90),Ve=S().min(-180).max(180),Yt=I({sw:I({lat:Le,lng:Ve}),ne:I({lat:Le,lng:Ve})}),Be=Ue().refine(n=>n instanceof HTMLElement,"Must be an HTMLElement"),qe=I({mapSize:S().min(1),zoomMin:S().min(0),zoomMax:S().min(0),zoomScale:S().min(1).max(10)}),Xt=I({instance:Ue(),inserted:V().returns(De()),insert:V().returns(ge()),remove:V().returns(ge()),update:V().args(S()).returns(ge())}),Ht=I({getParameters:V().args().returns(qe),getContainer:V().args().returns(Be),getZoom:V().args().returns(S()),getBounds:V().args().returns(Yt),panBy:V().args(S(),S()).returns(ge()),createMarker:V().args(Be,Le,Ve,S()).returns(Xt)}),Ce=V().args(Q()).returns(Gt(Be)),Jt=I({id:Q().min(1),rank:S(),lat:S().min(-90).max(90),lng:S().min(-180).max(180),tooltip:I({style:I({width:S(),height:S(),margin:S(),radius:S()}).refine(n=>Math.min(n.width,n.height)/n.margin>=5,"Tooltip width and height must be at least 5 times the margin"),body:Ce}),pin:I({style:I({width:S(),height:S(),radius:S()}),body:Ce}).optional(),popup:I({style:I({width:S(),height:S(),radius:S(),margin:S()}),body:Ce}).optional()}),Qt=We(Jt);ht([S(),We(ht([S(),S()]))]);const Kt=qe,en=I({id:Q(),rank:S(),lat:S(),lng:S(),width:S(),height:S(),margin:S()});I({key:Q(),parameters:qe,input:We(en)});const tn=qt(["info","warn","error"]);I({title:Q(),level:tn,content:Ue()});var M;(n=>{class e{constructor(){R(this,"zoomAfterExpanded");R(this,"zoomAfterAngleIndexes");this.zoomAfterExpanded=NaN,this.zoomAfterAngleIndexes=[]}}n.State=e;class t{constructor(l){R(this,"min");R(this,"max");R(this,"scale");R(this,"step");Kt.parse(l),this.min=l.zoomMin,this.max=l.zoomMax,this.scale=Math.round(l.zoomScale),this.step=1/this.scale}addSteps(l,f){return Math.round((l+f*this.step)*this.scale)/this.scale}getLevel(l){if(!(l<this.min))return l>this.max?this.max*this.scale:Math.floor(l*this.scale)}}n.Zoom=t;class s{constructor(l,f,g){R(this,"id","");R(this,"index",NaN);R(this,"rank",NaN);R(this,"x",NaN);R(this,"y",NaN);R(this,"width",NaN);R(this,"height",NaN);R(this,"expanded",!0);R(this,"scale",1);R(this,"angle",exports.Angles.DEGREES_DEFAULT);R(this,"neighbours",new Array);R(this,"distances",{left:NaN,right:NaN,top:NaN,bottom:NaN});R(this,"particle",{index:exports.Angles.DEGREES.indexOf(exports.Angles.DEGREES_DEFAULT),distX:NaN,distY:NaN});const x=exports.Mercator.project(f.lat,f.lng,l.mapSize);this.index=g,this.id=f.id,this.rank=f.rank,this.x=x.x,this.y=x.y,this.width=f.width+2*f.margin,this.height=f.height+2*f.margin}updateScale(l){l!=this.scale&&(this.scale=l,this.updateBounds(l,this.angle),this.updateParticle(l))}updateAngle(l){l!=this.angle&&(this.angle=l,this.updateBounds(this.scale,l))}updateBounds(l,f){const g=exports.Rectangle.getOffsets(this.width,this.height,f),x=-g.x,_=this.width-x,k=-g.y,E=this.height-k,C=this.distances;C.left=x/l,C.right=_/l,C.top=k/l,C.bottom=E/l}updateParticle(l){this.particle.distX=this.width/2/l,this.particle.distY=this.height/2/l}}n.Tooltip=s;function r(p,l){let f=new Array(l.length);for(let g=0;g<l.length;g++)f[g]=new s(p,l[g],g);return f}n.createTooltips=r;function a(p,l){let f=new Array,g=0;for(let _=l.min*l.scale;_<=l.max*l.scale;_++)f[_]=new Array(p.length);const x=new Array(p.length);for(let _=0;_<p.length;_++){const k=p[_];x[_]={x:k.x,y:k.y,distances:{left:k.width,right:k.width,top:k.height,bottom:k.height}}}for(let _=0;_<p.length;_++){const k=p[_],E=x[_];for(let C=_+1;C<p.length;C++){const me=p[C],be=x[C],ie=exports.Bounds.getZoomWhenTouching(E,be);ie>g&&(g=ie);const H=l.getLevel(ie);if(H==null)continue;const U=f[H],J=U[_];J?J.push(me):U[_]=[me];const oe=U[C];oe?oe.push(k):U[C]=[k]}}return{zoomMax:g,zoomLevelDeltas:f}}n.createNeighbours=a;function i(p,l){for(let f=0;f<p.length;f++){let g=p[f];if(g.expanded==!1){g.neighbours.length=0;continue}const x=l[f];if(x!=null)for(let _=0;_<x.length;_++){const k=x[_];k.expanded!=!1&&g.neighbours.push(k)}}}n.updateNeighbours=i;function o(p){const l=new Set,f=[];for(let g=0;g<p.length;g++){let x=p[g];if(x.expanded==!1||x.neighbours.length==0||l.has(x))continue;l.add(x);const _=[],k=[x];for(;k.length>0;){const E=k.pop();_.push(E);for(const C of E.neighbours)l.has(C)||(l.add(C),k.push(C))}f.push(_)}return f}n.getNeighbourGraphs=o;function u(p){p.expanded=!1;const l=p.neighbours;for(let f=0;f<l.length;f++){const g=l[f],x=g.neighbours.indexOf(p);g.neighbours.splice(x,1)}}n.updateCollapsed=u;function c(p,l,f){for(let g=0;g<l.length;g++){const x=l[g];if(x.expanded==!1)continue;const _=p.get(x.id);if(!_)throw new Error("Tooltip not found");_.zoomAfterExpanded=f;const k=exports.Angles.DEGREES.indexOf(x.angle);_.zoomAfterAngleIndexes.length==0?_.zoomAfterAngleIndexes.push([f,k]):_.zoomAfterAngleIndexes[0][1]!=k?_.zoomAfterAngleIndexes.unshift([f,k]):_.zoomAfterAngleIndexes[0][0]=f}}n.updateStates=c;function v(p,l){for(let f=0;f<p.length;f++)p[f].updateScale(l)}n.updateScale=v;function N(p){const l=new Set;for(let f=0;f<p.length;f++){const g=p[f],x=p[f].neighbours;for(let _=0;_<x.length;_++){const k=x[_];exports.Bounds.areOverlaping(g,k)&&(l.add(g),l.add(k))}}return l}n.getOverlaps=N;function z(p,l){let f=!1;for(let g=0;g<l.length;g++){const x=l[g],_=l[g].neighbours;for(let k=0;k<_.length;k++){const E=_[k];exports.Bounds.areOverlaping(x,E)&&(p.has(x)||(p.add(x),f=!0),p.has(E)||(p.add(E),f=!0))}}return f}n.updateOverlaps=z;function j(p){let l,f=0;for(let g=0;g<p.length;g++){const x=p[g],_=p[g].neighbours;let k=0;for(let E=0;E<_.length;E++){const C=_[E];exports.Bounds.areOverlaping(x,C)&&(k+=1+(C.rank-x.rank))}k=k*_.length,k>f&&(f=k,l=x)}return l}n.getOverlapsWorstTooltip=j;function $(p){for(let l=0;l<p.length;l++){const f=p[l];for(let g=l+1;g<p.length;g++){const x=p[g];if(exports.Bounds.areOverlaping(f,x))return!0}}return!1}n.areOverlaping=$,(p=>{function l(x){ye.initializeAngleIndexes(x),g(x)}p.initializeAngles=l;function f(x){const _=ye.updateAngleIndexes(x);return g(x),_}p.updateAngles=f;function g(x){for(let _=0;_<x.length;_++){const k=x[_];k.updateAngle(exports.Angles.DEGREES[k.particle.index])}}p.updateTooltips=g})(n.Particles||(n.Particles={}))})(M||(M={}));function nn(n,e){const t=new M.Zoom(n);if(e.length==0)return[];if(e.length==1)return[[t.min,[[t.min,exports.Angles.DEGREES.indexOf(exports.Angles.DEGREES_DEFAULT)]]]];const s=new Map(e.map(c=>[c.id,new M.State])),r=M.createTooltips(n,e),a=M.createNeighbours(r,t);M.Particles.initializeAngles(r),M.updateStates(s,r,t.addSteps(t.max,1));const i=t.getLevel(a.zoomMax);if(i==null)return Array.from(s.values()).map(c=>[c.zoomAfterExpanded,c.zoomAfterAngleIndexes]);const o=t.min,u=i/t.scale;for(let c=u;c>=o;c=t.addSteps(c,-1)){const v=Math.pow(2,c),N=c*t.scale;M.updateNeighbours(r,a.zoomLevelDeltas[N]);const z=M.getNeighbourGraphs(r);for(const j of z){M.updateScale(j,v);const $=M.getOverlaps(j);for(;$.size>1;){const p=Array.from($);for(let g=0;g<exports.Angles.COUNT&&!(M.Particles.updateAngles(p)==!0||M.areOverlaping(p)==!1);g++);if(M.updateOverlaps($,p))continue;const f=M.getOverlapsWorstTooltip(p);if(f==null)break;M.updateCollapsed(f),$.delete(f)}}M.updateStates(s,r,Number(c.toFixed(1)))}return Array.from(s.values()).map(c=>[c.zoomAfterExpanded,c.zoomAfterAngleIndexes])}exports.getStates=nn;exports.mapMarkersSchema=Qt;exports.mapProviderSchema=Ht;