@genspectrum/dashboard-components 1.3.0 → 1.4.0

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.
@@ -25851,7 +25851,7 @@ so([
25851
25851
  fr = so([
25852
25852
  sn("gs-number-sequences-over-time")
25853
25853
  ], fr);
25854
- const ek = '(function(){"use strict";var x;(function(r){r.assertEqual=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"&&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})(x||(x={}));var et;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(et||(et={}));const m=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(r)?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(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},d=x.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"]),dr=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class N extends Error{get errors(){return this.issues}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}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,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=r=>new N(r);const oe=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received \'${r.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 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}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.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==="bigint"?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 d.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 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 ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}};let gt=oe;function lr(r){gt=r}function Ye(){return gt}const Fe=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},hr=[];function f(r,e){const t=Ye(),n=Fe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===oe?void 0:oe].filter(s=>!!s)});r.common.issues.push(n)}class M{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 y;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){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return M.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 y;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 y=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),O=r=>({status:"valid",value:r}),tt=r=>r.status==="aborted",rt=r=>r.status==="dirty",Q=r=>r.status==="valid",ke=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));class P{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const vt=(r,e)=>{if(Q(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 N(r.common.issues);return this._error=t,this._error}}};function v(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)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:s}}class k{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new M,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ke(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){const n={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:L(e)},s=this._parseSync({data:e,path:n.path,parent:n});return vt(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Q(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>Q(a)?{value:a.value}:{issues:t.common.issues})}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:L(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(ke(s)?s:Promise.resolve(s));return vt(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:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!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 Z({schema:this,typeName:g.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 V.create(this,this._def)}nullable(){return K.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return I.create(this)}promise(){return he.create(this,this._def)}or(e){return Se.create([this,e],this._def)}and(e){return Te.create(this,e,this._def)}transform(e){return new Z({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new De({...v(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new at({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ne({...v(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Ee.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const fr=/^c[^\\s-]{8,}$/i,mr=/^[0-9a-z]+$/,pr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yr=/^[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,gr=/^[a-z0-9_-]{21}$/i,vr=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,_r=/^[-+]?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)?)??$/,kr=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,xr="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";let nt;const br=/^(?:(?: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])$/,wr=/^(?:(?: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])$/,Sr=/^(([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]))$/,Tr=/^(([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])$/,Ar=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$r=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_t="((\\\\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])))",Mr=new RegExp(`^${_t}$`);function kt(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);const t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Or(r){return new RegExp(`^${kt(r)}$`)}function xt(r){let e=`${_t}T${kt(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Dr(r,e){return!!((e==="v4"||!e)&&br.test(r)||(e==="v6"||!e)&&Sr.test(r))}function Nr(r,e){if(!vr.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Rr(r,e){return!!((e==="v4"||!e)&&wr.test(r)||(e==="v6"||!e)&&Tr.test(r))}class C extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.string,received:a.parsedType}),y}const n=new M;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.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),f(s,{code:d.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?f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")kr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")nt||(nt=new RegExp(xr,"u")),nt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")yr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")gr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")fr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")mr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")pr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:d.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),f(s,{validation:"regex",code:d.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),f(s,{code:d.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),f(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?xt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Mr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Or(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?_r.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Dr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Nr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Rr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?Ar.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?$r.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64url",code:d.invalid_string,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...p.errToObj(n)})}_addCheck(e){return new C({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.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,...p.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,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new C({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C({...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}}C.create=r=>new C({checks:[],typeName:g.ZodString,coerce:(r==null?void 0:r.coerce)??!1,...v(r)});function Er(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class q extends k{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 f(a,{code:d.invalid_type,expected:m.number,received:a.parsedType}),y}let n;const s=new M;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.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),f(n,{code:d.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),f(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Er(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_finite,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.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"&&x.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)}}q.create=r=>new q({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class G extends k{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 n;const s=new M;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),f(n,{code:d.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),f(n,{code:d.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),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.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}}G.create=r=>new G({checks:[],typeName:g.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,...v(r)});class xe extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),y}return O(e.data)}}xe.create=r=>new xe({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class X extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),y}const n=new M;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.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),f(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):x.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.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}}X.create=r=>new X({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate,...v(r)});class Pe extends k{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),y}return O(e.data)}}Pe.create=r=>new Pe({typeName:g.ZodSymbol,...v(r)});class be extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),y}return O(e.data)}}be.create=r=>new be({typeName:g.ZodUndefined,...v(r)});class we extends k{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),y}return O(e.data)}}we.create=r=>new we({typeName:g.ZodNull,...v(r)});class ue extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}}ue.create=r=>new ue({typeName:g.ZodAny,...v(r)});class ee extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}}ee.create=r=>new ee({typeName:g.ZodUnknown,...v(r)});class U extends k{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),y}}U.create=r=>new U({typeName:g.ZodNever,...v(r)});class We extends k{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),y}return O(e.data)}}We.create=r=>new We({typeName:g.ZodVoid,...v(r)});class I extends k{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return f(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(f(t,{code:i?d.too_big:d.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&&(f(t,{code:d.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&&(f(t,{code:d.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 P(t,i,t.path,o)))).then(i=>M.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new P(t,i,t.path,o)));return M.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new I({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new I({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new I({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}I.create=(r,e)=>new I({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function de(r){if(r instanceof A){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=V.create(de(n))}return new A({...r._def,shape:()=>e})}else return r instanceof I?new I({...r._def,type:de(r.element)}):r instanceof V?V.create(de(r.unwrap())):r instanceof K?K.create(de(r.unwrap())):r instanceof W?W.create(r.items.map(e=>de(e))):r}class A extends k{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=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const u=this._getOrReturnCtx(e);return f(u,{code:d.invalid_type,expected:m.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof U&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const h=a[u],b=s.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new P(s,b,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof U){const u=this._def.unknownKeys;if(u==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(u==="strict")o.length>0&&(f(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const h of o){const b=s.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new P(s,b,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const h of c){const b=await h.key,_=await h.value;u.push({key:b,value:_,alwaysSet:h.alwaysSet})}return u}).then(u=>M.mergeObjectSync(n,u)):M.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new A({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new A({...this._def,unknownKeys:"strip"})}passthrough(){return new A({...this._def,unknownKeys:"passthrough"})}extend(e){return new A({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new A({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new A({...this._def,catchall:e})}pick(e){const t={};for(const n of x.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}omit(e){const t={};for(const n of x.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}deepPartial(){return de(this)}partial(e){const t={};for(const n of x.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new A({...this._def,shape:()=>t})}required(e){const t={};for(const n of x.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof V;)a=a._def.innerType;t[n]=a}return new A({...this._def,shape:()=>t})}keyof(){return bt(x.objectKeys(this.shape))}}A.create=(r,e)=>new A({shape:()=>r,unknownKeys:"strip",catchall:U.create(),typeName:g.ZodObject,...v(e)}),A.strictCreate=(r,e)=>new A({shape:()=>r,unknownKeys:"strict",catchall:U.create(),typeName:g.ZodObject,...v(e)}),A.lazycreate=(r,e)=>new A({shape:r,unknownKeys:"strip",catchall:U.create(),typeName:g.ZodObject,...v(e)});class Se extends k{_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 N(o.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:i}),y}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 c of n){const u={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new N(c));return f(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}Se.create=(r,e)=>new Se({options:r,typeName:g.ZodUnion,...v(e)});const B=r=>r instanceof $e?B(r.schema):r instanceof Z?B(r.innerType()):r instanceof Me?[r.value]:r instanceof J?r.options:r instanceof Oe?x.objectValues(r.enum):r instanceof De?B(r._def.innerType):r instanceof be?[void 0]:r instanceof we?[null]:r instanceof V?[void 0,...B(r.unwrap())]:r instanceof K?[null,...B(r.unwrap())]:r instanceof at||r instanceof Ee?B(r.unwrap()):r instanceof Ne?B(r._def.innerType):[];class Ve extends k{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return f(t,{code:d.invalid_type,expected:m.object,received:t.parsedType}),y;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}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}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=B(a.shape[e]);if(!i.length)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 Ve({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(n)})}}function st(r,e){const t=L(r),n=L(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){const s=x.objectKeys(e),a=x.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=st(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.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],c=st(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Te extends k{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(tt(a)||tt(i))return y;const o=st(a.value,i.value);return o.valid?((rt(a)||rt(i))&&t.dirty(),{status:t.value,value:o.data}):(f(n,{code:d.invalid_intersection_types}),y)};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}))}}Te.create=(r,e,t)=>new Te({left:r,right:e,typeName:g.ZodIntersection,...v(t)});class W extends k{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return f(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return f(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new P(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>M.mergeArray(t,i)):M.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new W({...this._def,rest:e})}}W.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W({items:r,typeName:g.ZodTuple,rest:null,...v(e)})};class Ae extends k{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!==m.object)return f(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new P(n,o,n.path,o)),value:i._parse(new P(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?M.mergeObjectAsync(t,s):M.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof k?new Ae({keyType:e,valueType:t,typeName:g.ZodRecord,...v(n)}):new Ae({keyType:C.create(),valueType:e,typeName:g.ZodRecord,...v(t)})}}class ze extends k{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!==m.map)return f(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new P(n,o,n.path,[u,"key"])),value:a._parse(new P(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,h=await c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}}}ze.create=(r,e,t)=>new ze({valueType:e,keyType:r,typeName:g.ZodMap,...v(t)});class te extends k{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return f(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(f(n,{code:d.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&&(f(n,{code:d.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(c){const u=new Set;for(const h of c){if(h.status==="aborted")return y;h.status==="dirty"&&t.dirty(),u.add(h.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new P(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new te({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new te({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}te.create=(r,e)=>new te({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});class le extends k{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return f(t,{code:d.invalid_type,expected:m.function,received:t.parsedType}),y;function n(o,c){return Fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),oe].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function s(o,c){return Fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),oe].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof he){const o=this;return O(async function(...c){const u=new N([]),h=await o._def.args.parseAsync(c,a).catch(S=>{throw u.addIssue(n(c,S)),u}),b=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(b,a).catch(S=>{throw u.addIssue(s(b,S)),u})})}else{const o=this;return O(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new N([n(c,u.error)]);const h=Reflect.apply(i,this,u.data),b=o._def.returns.safeParse(h,a);if(!b.success)throw new N([s(h,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new le({...this._def,args:W.create(e).rest(ee.create())})}returns(e){return new le({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new le({args:e||W.create([]).rest(ee.create()),returns:t||ee.create(),typeName:g.ZodFunction,...v(n)})}}class $e extends k{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})}}$e.create=(r,e)=>new $e({getter:r,typeName:g.ZodLazy,...v(e)});class Me extends k{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}Me.create=(r,e)=>new Me({value:r,typeName:g.ZodLiteral,...v(e)});function bt(r,e){return new J({values:r,typeName:g.ZodEnum,...v(e)})}class J extends k{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:x.joinValues(n),received:t.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:n}),y}return O(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 J.create(e,{...this._def,...t})}exclude(e,t=this._def){return J.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}J.create=bt;class Oe extends k{_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const s=x.objectValues(t);return f(n,{expected:x.joinValues(s),received:n.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=x.objectValues(t);return f(n,{received:n.data,code:d.invalid_enum_value,options:s}),y}return O(e.data)}get enum(){return this._def.values}}Oe.create=(r,e)=>new Oe({values:r,typeName:g.ZodNativeEnum,...v(e)});class he extends k{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),y;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return O(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}he.create=(r,e)=>new he({type:r,typeName:g.ZodPromise,...v(e)});class Z extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.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=>{f(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);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?ce(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(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"?y:(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(!Q(i))return y;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=>Q(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);x.assertNever(s)}}Z.create=(r,e,t)=>new Z({schema:r,typeName:g.ZodEffects,effect:e,...v(t)}),Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,...v(t)});class V extends k{_parse(e){return this._getType(e)===m.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V.create=(r,e)=>new V({innerType:r,typeName:g.ZodOptional,...v(e)});class K extends k{_parse(e){return this._getType(e)===m.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}K.create=(r,e)=>new K({innerType:r,typeName:g.ZodNullable,...v(e)});class De extends k{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}De.create=(r,e)=>new De({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class Ne extends k{_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 ke(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ne.create=(r,e)=>new Ne({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Le extends k{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Le.create=r=>new Le({typeName:g.ZodNaN,...v(r)});const Cr=Symbol("zod_brand");class at extends k{_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 Re extends k{_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"?y:a.status==="dirty"?(t.dirty(),ce(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"?y: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 Re({in:e,out:t,typeName:g.ZodPipeline})}}class Ee extends k{_parse(e){const t=this._def.innerType._parse(e),n=s=>(Q(s)&&(s.value=Object.freeze(s.value)),s);return ke(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:g.ZodReadonly,...v(e)});function wt(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function St(r,e={},t){return r?ue.create().superRefine((n,s)=>{const a=r(n);if(a instanceof Promise)return a.then(i=>{if(!i){const o=wt(e,n),c=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:c})}});if(!a){const i=wt(e,n),o=i.fatal??t??!0;s.addIssue({code:"custom",...i,fatal:o})}}):ue.create()}const Ir={object:A.lazycreate};var g;(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"})(g||(g={}));const Zr=(r,e={message:`Input not instance of ${r.name}`})=>St(t=>t instanceof r,e),Tt=C.create,At=q.create,jr=Le.create,Yr=G.create,$t=xe.create,Fr=X.create,Pr=Pe.create,Wr=be.create,Vr=we.create,zr=ue.create,Lr=ee.create,Ur=U.create,Br=We.create,Hr=I.create,qr=A.create,Gr=A.strictCreate,Jr=Se.create,Kr=Ve.create,Qr=Te.create,Xr=W.create,en=Ae.create,tn=ze.create,rn=te.create,nn=le.create,sn=$e.create,an=Me.create,on=J.create,cn=Oe.create,un=he.create,Mt=Z.create,dn=V.create,ln=K.create,hn=Z.createWithPreprocess,fn=Re.create;var l=Object.freeze({__proto__:null,BRAND:Cr,DIRTY:ce,EMPTY_PATH:hr,INVALID:y,NEVER:y,OK:O,ParseStatus:M,Schema:k,ZodAny:ue,ZodArray:I,ZodBigInt:G,ZodBoolean:xe,ZodBranded:at,ZodCatch:Ne,ZodDate:X,ZodDefault:De,ZodDiscriminatedUnion:Ve,ZodEffects:Z,ZodEnum:J,ZodError:N,get ZodFirstPartyTypeKind(){return g},ZodFunction:le,ZodIntersection:Te,ZodIssueCode:d,ZodLazy:$e,ZodLiteral:Me,ZodMap:ze,ZodNaN:Le,ZodNativeEnum:Oe,ZodNever:U,ZodNull:we,ZodNullable:K,ZodNumber:q,ZodObject:A,ZodOptional:V,ZodParsedType:m,ZodPipeline:Re,ZodPromise:he,ZodReadonly:Ee,ZodRecord:Ae,ZodSchema:k,ZodSet:te,ZodString:C,ZodSymbol:Pe,ZodTransformer:Z,ZodTuple:W,ZodType:k,ZodUndefined:be,ZodUnion:Se,ZodUnknown:ee,ZodVoid:We,addIssueToContext:f,any:zr,array:Hr,bigint:Yr,boolean:$t,coerce:{string:r=>C.create({...r,coerce:!0}),number:r=>q.create({...r,coerce:!0}),boolean:r=>xe.create({...r,coerce:!0}),bigint:r=>G.create({...r,coerce:!0}),date:r=>X.create({...r,coerce:!0})},custom:St,date:Fr,datetimeRegex:xt,defaultErrorMap:oe,discriminatedUnion:Kr,effect:Mt,enum:on,function:nn,getErrorMap:Ye,getParsedType:L,instanceof:Zr,intersection:Qr,isAborted:tt,isAsync:ke,isDirty:rt,isValid:Q,late:Ir,lazy:sn,literal:an,makeIssue:Fe,map:tn,nan:jr,nativeEnum:cn,never:Ur,null:Vr,nullable:ln,number:At,object:qr,get objectUtil(){return et},oboolean:()=>$t().optional(),onumber:()=>At().optional(),optional:dn,ostring:()=>Tt().optional(),pipeline:fn,preprocess:hn,promise:un,quotelessJson:dr,record:en,set:rn,setErrorMap:lr,strictObject:Gr,string:Tt,symbol:Pr,transformer:Mt,tuple:Xr,undefined:Wr,union:Jr,unknown:Lr,get util(){return x},void:Br});l.object({nucleotideSequences:l.array(l.object({name:l.string(),sequence:l.string()})),genes:l.array(l.object({name:l.string(),sequence:l.string()}))});const mn=l.enum(["ascending","descending"]),pn=l.object({field:l.string(),type:mn}),Ot=l.union([l.string(),l.number(),l.boolean(),l.null(),l.undefined(),l.array(l.string())]),Dt=l.object({dateFrom:l.string(),dateTo:l.string()});l.object({limit:l.number().optional(),offset:l.number().optional(),fields:l.array(l.string()).optional(),orderBy:l.array(pn).optional()}).catchall(Ot).extend({minProportion:l.number().optional()});const yn=l.object({mutation:l.string(),proportion:l.number(),count:l.number(),sequenceName:l.union([l.string(),l.null()]),mutationFrom:l.string(),mutationTo:l.string(),position:l.number()}),gn=Ce(l.array(yn));l.object({filters:l.record(Ot),downloadAsFile:l.boolean().optional(),downloadFileBasename:l.string().optional(),compression:l.enum(["gzip","none"]).optional(),includeMutations:l.array(l.string()).optional(),dateRanges:l.array(Dt).optional(),dateField:l.string().optional()});const vn=Ce(l.object({mutations:l.array(l.string()),dateRanges:l.array(Dt),data:l.array(l.array(l.object({count:l.number(),coverage:l.number()})))})),_n=l.object({insertion:l.string(),count:l.number(),insertedSymbols:l.string(),position:l.number(),sequenceName:l.union([l.string(),l.null()])});Ce(l.array(_n));const Nt=l.union([l.string(),l.number(),l.boolean(),l.null()]),kn=l.object({count:l.number()}).catchall(Nt),xn=Ce(l.array(kn)),bn=l.object({}).catchall(Nt);Ce(l.array(bn));function Ce(r){return l.object({data:r})}const Rt=l.object({title:l.string().optional(),status:l.number(),detail:l.string().optional(),type:l.string(),instance:l.string().optional()}),wn=l.object({error:Rt}),Sn=l.object({parents:l.array(l.string()).optional(),aliases:l.array(l.string()).optional()});l.record(Sn);class it extends Error{constructor(e,t,n){super(e),this.status=t,this.requestedData=n,this.name="UnknownLapisError"}}class Et extends Error{constructor(e,t,n,s){super(e),this.status=t,this.problemDetail=n,this.requestedData=s,this.name="LapisError"}}async function Tn(r,e,t){const n=await ot(On(r),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t},"aggregated data");return xn.parse(await n.json())}async function An(r,e,t,n){const s=await ot(Dn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations`);return gn.parse(await s.json())}async function $n(r,e,t,n){const s=await ot(Nn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations over time`);return vn.parse(await s.json())}async function ot(r,e,t){try{const n=await fetch(r,e);return await Mn(n,t),n}catch(n){const s=n instanceof Error?n.message:`${n}`;throw new it(`Failed to connect to LAPIS: ${s}`,500,t)}}const Mn=async(r,e)=>{if(!r.ok){if(r.status>=400&&r.status<500){const t=await r.json(),n=wn.safeParse(t);if(n.success)throw new Et(r.statusText+(n.data.error.detail??""),r.status,n.data.error,e);const s=Rt.safeParse(t);throw s.success?new Et(r.statusText+(s.data.detail??""),r.status,s.data,e):new it(`${r.statusText}: ${JSON.stringify(t)}`,r.status,e)}throw new it(`${r.statusText}: ${r.status}`,r.status,e)}},On=r=>`${r}/sample/aggregated`,Dn=(r,e)=>e==="amino acid"?`${r}/sample/aminoAcidMutations`:`${r}/sample/nucleotideMutations`,Nn=(r,e)=>e==="amino acid"?`${r}/component/aminoAcidMutationsOverTime`:`${r}/component/nucleotideMutationsOverTime`;class Ct{constructor(e,t=[]){this.filter=e,this.fields=t}async evaluate(e,t){const n=(await Tn(e,{...this.filter,fields:this.fields},t)).data;if(Rn(n))return{content:n};throw new Error("Aggregated response does not have count")}}function Rn(r){return r.every(e=>typeof e=="object"&&"count"in e&&typeof e.count=="number")}class En{constructor(e,t,n){this.child=e,this.field=t,this.aggregate=n}async evaluate(e,t){const n=await this.child.evaluate(e,t),s=new Map;for(const i of n.content){const o=i[this.field];s.has(o)||s.set(o,[]),s.get(o).push(i)}const a=new Array;for(const[,i]of s)a.push(this.aggregate(i));return{content:a}}}class Cn extends En{constructor(e,t,n){super(e,t,s=>{let a=0;for(const i of s)a+=i[n];return{[t]:s[0][t],[n]:a}})}}class ct{constructor(e,t){this.child=e,this.func=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.map(this.func)}}}class In extends ct{constructor(e,t,n){super(e,s=>({...s,[n]:s[t]}))}}class Zn{constructor(e,t){this.child=e,this.compareFn=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.sort(this.compareFn)}}}var It=60,Zt=It*60,jt=Zt*24,jn=jt*7,fe=1e3,ut=It*fe,Yt=Zt*fe,Yn=jt*fe,Fn=jn*fe,dt="millisecond",me="second",pe="minute",ye="hour",j="day",Ie="week",Y="month",Ft="quarter",H="year",ge="date",Pt="YYYY-MM-DDTHH:mm:ssZ",Wt="Invalid Date",Pn=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,Wn=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Vn={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},lt=function(e,t,n){var s=String(e);return!s||s.length>=t?e:""+Array(t+1-s.length).join(n)+e},zn=function(e){var t=-e.utcOffset(),n=Math.abs(t),s=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+lt(s,2,"0")+":"+lt(a,2,"0")},Ln=function r(e,t){if(e.date()<t.date())return-r(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,Y),a=t-s<0,i=e.clone().add(n+(a?-1:1),Y);return+(-(n+(t-s)/(a?s-i:i-s))||0)},Un=function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},Bn=function(e){var t={M:Y,y:H,w:Ie,d:j,D:ge,h:ye,m:pe,s:me,ms:dt,Q:Ft};return t[e]||String(e||"").toLowerCase().replace(/s$/,"")},Hn=function(e){return e===void 0},qn={s:lt,z:zn,m:Ln,a:Un,p:Bn,u:Hn},Ze="en",re={};re[Ze]=Vn;var Vt="$isDayjsObject",ht=function(e){return e instanceof Be||!!(e&&e[Vt])},Ue=function r(e,t,n){var s;if(!e)return Ze;if(typeof e=="string"){var a=e.toLowerCase();re[a]&&(s=a),t&&(re[a]=t,s=a);var i=e.split("-");if(!s&&i.length>1)return r(i[0])}else{var o=e.name;re[o]=e,s=o}return!n&&s&&(Ze=s),s||!n&&Ze},T=function(e,t){if(ht(e))return e.clone();var n=typeof t=="object"?t:{};return n.date=e,n.args=arguments,new Be(n)},Gn=function(e,t){return T(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},w=qn;w.l=Ue,w.i=ht,w.w=Gn;var Jn=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){var s=t.match(Pn);if(s){var a=s[2]-1||0,i=(s[7]||"0").substring(0,3);return n?new Date(Date.UTC(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)):new Date(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)}}return new Date(t)},Be=function(){function r(t){this.$L=Ue(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[Vt]=!0}var e=r.prototype;return e.parse=function(n){this.$d=Jn(n),this.init()},e.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},e.$utils=function(){return w},e.isValid=function(){return this.$d.toString()!==Wt},e.isSame=function(n,s){var a=T(n);return this.startOf(s)<=a&&a<=this.endOf(s)},e.isAfter=function(n,s){return T(n)<this.startOf(s)},e.isBefore=function(n,s){return this.endOf(s)<T(n)},e.$g=function(n,s,a){return w.u(n)?this[s]:this.set(a,n)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(n,s){var a=this,i=w.u(s)?!0:s,o=w.p(n),c=function(ve,F){var D=w.w(a.$u?Date.UTC(a.$y,F,ve):new Date(a.$y,F,ve),a);return i?D:D.endOf(j)},u=function(ve,F){var D=[0,0,0,0],_e=[23,59,59,999];return w.w(a.toDate()[ve].apply(a.toDate("s"),(i?D:_e).slice(F)),a)},h=this.$W,b=this.$M,_=this.$D,S="set"+(this.$u?"UTC":"");switch(o){case H:return i?c(1,0):c(31,11);case Y:return i?c(1,b):c(0,b+1);case Ie:{var R=this.$locale().weekStart||0,E=(h<R?h+7:h)-R;return c(i?_-E:_+(6-E),b)}case j:case ge:return u(S+"Hours",0);case ye:return u(S+"Minutes",1);case pe:return u(S+"Seconds",2);case me:return u(S+"Milliseconds",3);default:return this.clone()}},e.endOf=function(n){return this.startOf(n,!1)},e.$set=function(n,s){var a,i=w.p(n),o="set"+(this.$u?"UTC":""),c=(a={},a[j]=o+"Date",a[ge]=o+"Date",a[Y]=o+"Month",a[H]=o+"FullYear",a[ye]=o+"Hours",a[pe]=o+"Minutes",a[me]=o+"Seconds",a[dt]=o+"Milliseconds",a)[i],u=i===j?this.$D+(s-this.$W):s;if(i===Y||i===H){var h=this.clone().set(ge,1);h.$d[c](u),h.init(),this.$d=h.set(ge,Math.min(this.$D,h.daysInMonth())).$d}else c&&this.$d[c](u);return this.init(),this},e.set=function(n,s){return this.clone().$set(n,s)},e.get=function(n){return this[w.p(n)]()},e.add=function(n,s){var a=this,i;n=Number(n);var o=w.p(s),c=function(_){var S=T(a);return w.w(S.date(S.date()+Math.round(_*n)),a)};if(o===Y)return this.set(Y,this.$M+n);if(o===H)return this.set(H,this.$y+n);if(o===j)return c(1);if(o===Ie)return c(7);var u=(i={},i[pe]=ut,i[ye]=Yt,i[me]=fe,i)[o]||1,h=this.$d.getTime()+n*u;return w.w(h,this)},e.subtract=function(n,s){return this.add(n*-1,s)},e.format=function(n){var s=this,a=this.$locale();if(!this.isValid())return a.invalidDate||Wt;var i=n||Pt,o=w.z(this),c=this.$H,u=this.$m,h=this.$M,b=a.weekdays,_=a.months,S=a.meridiem,R=function(D,_e,Xe,Ns){return D&&(D[_e]||D(s,i))||Xe[_e].slice(0,Ns)},E=function(D){return w.s(c%12||12,D,"0")},Qe=S||function(F,D,_e){var Xe=F<12?"AM":"PM";return _e?Xe.toLowerCase():Xe},ve=function(D){switch(D){case"YY":return String(s.$y).slice(-2);case"YYYY":return w.s(s.$y,4,"0");case"M":return h+1;case"MM":return w.s(h+1,2,"0");case"MMM":return R(a.monthsShort,h,_,3);case"MMMM":return R(_,h);case"D":return s.$D;case"DD":return w.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return R(a.weekdaysMin,s.$W,b,2);case"ddd":return R(a.weekdaysShort,s.$W,b,3);case"dddd":return b[s.$W];case"H":return String(c);case"HH":return w.s(c,2,"0");case"h":return E(1);case"hh":return E(2);case"a":return Qe(c,u,!0);case"A":return Qe(c,u,!1);case"m":return String(u);case"mm":return w.s(u,2,"0");case"s":return String(s.$s);case"ss":return w.s(s.$s,2,"0");case"SSS":return w.s(s.$ms,3,"0");case"Z":return o}return null};return i.replace(Wn,function(F,D){return D||ve(F)||o.replace(":","")})},e.utcOffset=function(){return-Math.round(this.$d.getTimezoneOffset()/15)*15},e.diff=function(n,s,a){var i=this,o=w.p(s),c=T(n),u=(c.utcOffset()-this.utcOffset())*ut,h=this-c,b=function(){return w.m(i,c)},_;switch(o){case H:_=b()/12;break;case Y:_=b();break;case Ft:_=b()/3;break;case Ie:_=(h-u)/Fn;break;case j:_=(h-u)/Yn;break;case ye:_=h/Yt;break;case pe:_=h/ut;break;case me:_=h/fe;break;default:_=h;break}return a?_:w.a(_)},e.daysInMonth=function(){return this.endOf(Y).$D},e.$locale=function(){return re[this.$L]},e.locale=function(n,s){if(!n)return this.$L;var a=this.clone(),i=Ue(n,s,!0);return i&&(a.$L=i),a},e.clone=function(){return w.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},r}(),zt=Be.prototype;T.prototype=zt,[["$ms",dt],["$s",me],["$m",pe],["$H",ye],["$W",j],["$M",Y],["$y",H],["$D",ge]].forEach(function(r){zt[r[1]]=function(e){return this.$g(e,r[0],r[1])}}),T.extend=function(r,e){return r.$i||(r(e,Be,T),r.$i=!0),T},T.locale=Ue,T.isDayjs=ht,T.unix=function(r){return T(r*1e3)},T.en=re[Ze],T.Ls=re,T.p={};var Kn=function(r,e){var t=e.prototype,n=t.format;t.format=function(s){var a=this,i=this.$locale();if(!this.isValid())return n.bind(this)(s);var o=this.$utils(),c=s||Pt,u=c.replace(/\\[([^\\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return i.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return i.ordinal(a.week(),"W");case"w":case"ww":return o.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return n.bind(this)(u)}},Qn="isoweek",Xn=function(r,e,t){var n=function(c,u){var h=(u?t.utc:t)().year(c).startOf(H),b=4-h.isoWeekday();return h.isoWeekday()>4&&(b+=7),h.add(b,j)},s=function(c){return c.add(4-c.isoWeekday(),j)},a=e.prototype;a.isoWeekYear=function(){var o=s(this);return o.year()},a.isoWeek=function(o){if(!this.$utils().u(o))return this.add((o-this.isoWeek())*7,j);var c=s(this),u=n(this.isoWeekYear(),this.$u);return c.diff(u,Ie)+1},a.isoWeekday=function(o){return this.$utils().u(o)?this.day()||7:this.day(this.day()%7?o:o-7)};var i=a.startOf;a.startOf=function(o,c){var u=this.$utils(),h=u.u(c)?!0:c,b=u.p(o);return b===Qn?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):i.bind(this)(o,c)}};T.extend(Xn),T.extend(Kn);const ft="GGGG-[W]WW",Ke=class Ke{constructor(){this.yearMonthDayCache=new Map,this.yearWeekCache=new Map,this.yearMonthCache=new Map,this.yearCache=new Map}getYearMonthDay(e){return this.yearMonthDayCache.has(e)||this.yearMonthDayCache.set(e,ne.parse(e,this)),this.yearMonthDayCache.get(e)}getYearMonth(e){return this.yearMonthCache.has(e)||this.yearMonthCache.set(e,ae.parse(e,this)),this.yearMonthCache.get(e)}getYearWeek(e){return this.yearWeekCache.has(e)||this.yearWeekCache.set(e,se.parse(e,this)),this.yearWeekCache.get(e)}getYear(e){return this.yearCache.has(e)||this.yearCache.set(e,ie.parse(e,this)),this.yearCache.get(e)}static getInstance(){return this.instance}};Ke.instance=new Ke;let mt=Ke;class ne{constructor(e,t,n,s){this.yearNumber=e,this.monthNumber=t,this.dayNumber=n,this.cache=s,this.type="YearMonthDay",this.date=new Date(this.yearNumber,this.monthNumber-1,this.dayNumber),this.dayjs=T(this.date),this.dateString=this.toString()}get text(){return this.dayjs.format("YYYY-MM-DD")}toString(){return this.text}englishName(){return this.dayjs.format("dddd, MMMM D, YYYY")}get firstDay(){return this}get lastDay(){return this}get year(){return this.cache.getYear(`${this.yearNumber}`)}get month(){return this.cache.getYearMonth(this.dayjs.format("YYYY-MM"))}get week(){return this.cache.getYearWeek(this.dayjs.format(ft))}addDays(e){const n=this.dayjs.add(e,"day").format("YYYY-MM-DD");return this.cache.getYearMonthDay(n)}minus(e){return this.dayjs.diff(e.dayjs,"day")}static parse(e,t){const[n,s,a]=e.split("-").map(i=>parseInt(i,10));return new ne(n,s,a,t)}}class se{constructor(e,t,n){this.isoYearNumber=e,this.isoWeekNumber=t,this.cache=n,this.type="YearWeek",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format(ft)}toString(){return this.text}englishName(){return`Week ${this.isoWeekNumber}, ${this.isoYearNumber}`}get firstDay(){const e=T().year(this.isoYearNumber).month(1).date(4).isoWeek(this.isoWeekNumber).startOf("isoWeek");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get lastDay(){const e=this.firstDay.dayjs.add(6,"days");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.isoYearNumber}`)}addWeeks(e){const n=this.firstDay.dayjs.add(e,"week").format(ft);return this.cache.getYearWeek(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"week")}static parse(e,t){const[n,s]=e.split("-W").map(a=>parseInt(a,10));return new se(n,s,t)}}class ae{constructor(e,t,n){this.yearNumber=e,this.monthNumber=t,this.cache=n,this.type="YearMonth",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY-MM")}toString(){return this.text}englishName(){return`${es(this.monthNumber)} ${this.yearNumber}`}get firstDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).format("YYYY-MM-DD"))}get lastDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).endOf("month").format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.yearNumber}`)}addMonths(e){const n=this.firstDay.dayjs.add(e,"month").format("YYYY-MM");return this.cache.getYearMonth(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"month")}static parse(e,t){const[n,s]=e.split("-").map(a=>parseInt(a,10));return new ae(n,s,t)}}class ie{constructor(e,t){this.year=e,this.cache=t,this.type="Year",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY")}toString(){return this.text}englishName(){return this.year.toString()}get firstMonth(){return this.cache.getYearMonth(`${this.year}-01`)}get lastMonth(){return this.cache.getYearMonth(`${this.year}-12`)}get firstDay(){return this.firstMonth.firstDay}get lastDay(){return this.lastMonth.lastDay}addYears(e){const n=this.firstDay.dayjs.add(e,"year").format("YYYY");return this.cache.getYear(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"year")}static parse(e,t){const n=parseInt(e,10);return new ie(n,t)}}function es(r){return T().month(r-1).format("MMMM")}function Lt(r){switch(r.type){case"YearMonthDay":return{type:"YearMonthDay",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dayNumber:r.dayNumber,dateString:r.dateString};case"YearWeek":return{type:"YearWeek",isoYearNumber:r.isoYearNumber,isoWeekNumber:r.isoWeekNumber,dateString:r.dateString};case"YearMonth":return{type:"YearMonth",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dateString:r.dateString};case"Year":return{type:"Year",year:r.year,dateString:r.dateString}}}function ts(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addDays(s));return t}function rs(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addWeeks(s));return t}function ns(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addMonths(s));return t}function ss(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addYears(s));return t}function Ut(r,e){if(r===null||e===null)return[];if(r instanceof ne&&e instanceof ne)return ts(r,e);if(r instanceof se&&e instanceof se)return rs(r,e);if(r instanceof ae&&e instanceof ae)return ns(r,e);if(r instanceof ie&&e instanceof ie)return ss(r,e);throw new Error(`Invalid arguments: start and end must be of the same type: ${r}, ${e}`)}function as(r,e){if(r instanceof ne&&e instanceof ne||r instanceof se&&e instanceof se||r instanceof ae&&e instanceof ae||r instanceof ie&&e instanceof ie)return r.minus(e);throw new Error(`Cannot compare ${r} and ${e}`)}function He(r,e){if(r===null)return 1;if(e===null)return-1;const t=as(r,e);return t<0?-1:t>0?1:0}function is(r){let e=null,t=null;for(const n of r)n!==null&&((e===null||He(n,e)<0)&&(e=n),(t===null||He(n,t)>0)&&(t=n));return e===null||t===null?{min:null,max:null}:{min:e,max:t}}function je(r,e){const n=mt.getInstance().getYearMonthDay(r);switch(e){case"day":return n;case"week":return n.week;case"month":return n.month;case"year":return n.year}}function os(r,e){return r.dateRange===null?1:e.dateRange===null?-1:He(r.dateRange,e.dateRange)}function cs(r,e){return{dateRange:r.date===null?null:je(r.date,e),count:r.count}}const us=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(?<substitutionValue>[A-Z.*])?$/i;class qe{constructor(e,t,n,s){this.segment=e,this.valueAtReference=t,this.substitutionValue=n,this.position=s,this.type="substitution";const a=this.segment?`${this.segment}:`:"",i=this.valueAtReference??"",o=this.substitutionValue??"";this.code=`${a}${i}${this.position}${o}`}equals(e){return e instanceof qe?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.substitutionValue===e.substitutionValue&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=us.exec(e);return(t==null?void 0:t.groups)===void 0?null:new qe(t.groups.segment,t.groups.valueAtReference,t.groups.substitutionValue,parseInt(t.groups.position,10))}}const ds=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(-)$/i;class Ge{constructor(e,t,n){this.segment=e,this.valueAtReference=t,this.position=n,this.type="deletion";const s=this.segment?`${this.segment}:`:"",a=this.valueAtReference??"";this.code=`${s}${a}${this.position}-`}equals(e){return e instanceof Ge?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=ds.exec(e);return(t==null?void 0:t.groups)===void 0?null:new Ge(t.groups.segment,t.groups.valueAtReference,parseInt(t.groups.position,10))}}function Bt(r){switch(r.type){case"substitution":return{type:"substitution",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference,substitutionValue:r.substitutionValue};case"deletion":return{type:"deletion",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference}}}class ls{constructor(e,t,n){this.filter=e,this.sequenceType=t,this.minProportion=n}async evaluate(e,t){return{content:(await this.fetchMutations(e,t)).map(({count:a,proportion:i,mutationFrom:o,mutationTo:c,position:u,sequenceName:h})=>c==="-"?{type:"deletion",mutation:new Ge(h??void 0,o,u),count:a,proportion:i}:{type:"substitution",mutation:new qe(h??void 0,o,c,u),count:a,proportion:i})}}async fetchMutations(e,t){const n={...this.filter,minProportion:this.minProportion};return An(e,n,this.sequenceType,t).then(s=>s.data)}}var Ht;Ht={__e:function(r,e,t,n){for(var s,a,i;e=e.__;)if((s=e.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(r)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(r,n||{}),i=s.__d),i)return s.__E=s}catch(o){r=o}throw r}},typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var z,pt,qt,Gt=[],$=Ht,Jt=$.__b,Kt=$.__r,Qt=$.diffed,Xt=$.__c,er=$.unmount,tr=$.__;function hs(){for(var r;r=Gt.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(Je),r.__H.__h.forEach(yt),r.__H.__h=[]}catch(e){r.__H.__h=[],$.__e(e,r.__v)}}$.__b=function(r){z=null,Jt&&Jt(r)},$.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),tr&&tr(r,e)},$.__r=function(r){Kt&&Kt(r);var e=(z=r.__c).__H;e&&(pt===z?(e.__h=[],z.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Je),e.__h.forEach(yt),e.__h=[])),pt=z},$.diffed=function(r){Qt&&Qt(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(Gt.push(e)!==1&&qt===$.requestAnimationFrame||((qt=$.requestAnimationFrame)||fs)(hs)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),pt=z=null},$.__c=function(r,e){e.some(function(t){try{t.__h.forEach(Je),t.__h=t.__h.filter(function(n){return!n.__||yt(n)})}catch(n){e.some(function(s){s.__h&&(s.__h=[])}),e=[],$.__e(n,t.__v)}}),Xt&&Xt(r,e)},$.unmount=function(r){er&&er(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Je(n)}catch(s){e=s}}),t.__H=void 0,e&&$.__e(e,t.__v))};var rr=typeof requestAnimationFrame=="function";function fs(r){var e,t=function(){clearTimeout(n),rr&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,35);rr&&(e=requestAnimationFrame(t))}function Je(r){var e=z,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),z=e}function yt(r){var e=z;r.__c=r.__(),z=e}class nr extends Error{constructor(e,t){super(t),this.headline=e,this.name="UserFacingError"}}class ms{constructor(e,t,n){this.serializeFirstAxis=e,this.serializeSecondAxis=t,this.data=new Map,this.keysFirstAxis=new Map,this.keysSecondAxis=new Map,n&&(this.keysFirstAxis=new Map(n.keysFirstAxis),this.keysSecondAxis=new Map(n.keysSecondAxis),this.data=new Map(n.data))}get(e,t){var a;const n=this.serializeFirstAxis(e),s=this.serializeSecondAxis(t);return(a=this.data.get(n))==null?void 0:a.get(s)}getRow(e){const t=this.serializeFirstAxis(e),n=this.data.get(t);return n===void 0?[]:Array.from(this.keysSecondAxis.keys()).map(s=>n.get(s))}set(e,t,n){const s=this.serializeFirstAxis(e),a=this.serializeSecondAxis(t);this.data.has(s)||this.data.set(s,new Map),this.data.get(s).set(a,n),this.keysFirstAxis.set(s,e),this.keysSecondAxis.set(a,t)}deleteRow(e){const t=this.serializeFirstAxis(e);this.data.delete(t),this.keysFirstAxis.delete(t)}getFirstAxisKeys(){return Array.from(this.keysFirstAxis.values())}getSecondAxisKeys(){return Array.from(this.keysSecondAxis.values())}getAsArray(){return this.getFirstAxisKeys().map(e=>this.getSecondAxisKeys().map(t=>this.get(e,t)))}getContents(){return{keysFirstAxis:this.keysFirstAxis,keysSecondAxis:this.keysSecondAxis,data:this.data}}}class sr extends ms{constructor(e){super(As,$s,e)}}const ar=(r,e)=>{if(r.segment!==e.segment)return ps(r.segment,e.segment);if(r.position!==e.position)return ys(r.position,e.position);const t=r.type==="deletion",n=e.type==="deletion";return t!==n?t?1:-1:!t&&!n&&r.substitutionValue!==e.substitutionValue?gs(r.substitutionValue,e.substitutionValue):0},ps=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),ys=(r,e)=>r-e,gs=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),ir=200,vs=.001;async function _s({lapisFilter:r,sequenceType:e,lapis:t,granularity:n,lapisDateField:s,signal:a}){const i=await or(r,t,n,s,a);if(i.length===0)return{content:[]};const o={...r,[`${s}From`]:i[0].firstDay.toString(),[`${s}To`]:i[i.length-1].lastDay.toString()};return cr(o,e).evaluate(t,a)}async function ks(r){const{lapisFilter:e,sequenceType:t,lapis:n,lapisDateField:s,granularity:a,useNewEndpoint:i,signal:o}=r,c=await or(e,n,a,s,o);if(c.length>ir)throw new nr("Too many dates",`The dataset would contain ${c.length} date intervals. Please reduce the number to below ${ir} to display the data. You can achieve this by either narrowing the date range in the provided LAPIS filter or by selecting a larger granularity.`);const u=_s({lapisFilter:e,sequenceType:t,lapis:n,lapisDateField:s,granularity:a}).then(h=>h.content);return i===!0?bs(c,u,r):xs(c,u,r)}async function xs(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=r.map(async h=>{const b=h.firstDay.toString(),_=h.lastDay.toString(),S={...t,[`${a}From`]:b,[`${a}To`]:_},[R,E]=await Promise.all([cr(S,n).evaluate(s,i),ur(S).evaluate(s,i)]);return{date:h,mutations:R.content,totalCount:E.content[0].count}}),c=await Promise.all(o),u=await e;return{mutationOverTimeData:Ms(c,u),overallMutationData:u}}async function bs(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=await e;o.sort((_,S)=>ar(_.mutation,S.mutation));const c=await Promise.all(r.map(async _=>{const S={...t,[`${a}From`]:_.firstDay.toString(),[`${a}To`]:_.lastDay.toString()};return(await ur(S).evaluate(s,i)).content[0].count})),u=o.map(_=>_.mutation.code),h=await $n(s,{filters:t,dateRanges:r.map(_=>({dateFrom:_.firstDay.toString(),dateTo:_.lastDay.toString()})),includeMutations:u,dateField:a},n,i),b={keysFirstAxis:new Map(o.map(_=>[_.mutation.code,_.mutation])),keysSecondAxis:new Map(r.map(_=>[_.dateString,_])),data:new Map(o.map((_,S)=>[_.mutation.code,new Map(r.map((R,E)=>[R.dateString,{type:"value",proportion:h.data.data[S][E].count/h.data.data[S][E].coverage,count:h.data.data[S][E].count,totalCount:c[E]}]))]))};return{mutationOverTimeData:new sr(b),overallMutationData:o}}async function or(r,e,t,n,s){const{dateFrom:a,dateTo:i}=ws(r,n,t);if(a!==null&&i!==null)return Ut(a,i);const{content:o}=await Ss(r,e,t,n,s),{min:c,max:u}=is(o);return Ut(a??c,i??u)}function ws(r,e,t){const n=r[e];if(n)return{dateFrom:je(n,t),dateTo:je(n,t)};const s=r[`${e}From`],a=r[`${e}To`];return{dateFrom:s?je(s,t):null,dateTo:a?je(a,t):null}}function Ss(r,e,t,n,s){return Ts(r,t,n).evaluate(e,s)}function Ts(r,e,t){const n=new Ct(r,[t]),s=new In(n,t,"date"),a=new ct(s,c=>cs(c,e)),i=new Cn(a,"dateRange","count"),o=new Zn(i,os);return new ct(o,c=>c.dateRange)}function cr(r,e){return new ls(r,e,vs)}function As(r){return r.code}function $s(r){return r.dateString}function Ms(r,e){const t=new sr,n=r.map(i=>i.date),s=e.sort((i,o)=>ar(i.mutation,o.mutation)).map(i=>Bt(i.mutation)),a=n.sort((i,o)=>He(i,o)).map(i=>Lt(i));return s.forEach(i=>{a.forEach(o=>{t.set(i,o,null)})}),r.forEach(i=>{if(i.totalCount==0)return;const o=Lt(i.date);i.mutations.forEach(c=>{const u=Bt(c.mutation);t.get(u,o)!==void 0&&t.set(u,o,{type:"value",count:c.count,proportion:c.proportion,totalCount:i.totalCount})});for(const c of t.getFirstAxisKeys())t.get(c,o)===null&&t.set(c,o,{type:"belowThreshold",totalCount:i.totalCount})}),t}function ur(r){return new Ct(r)}async function Os(r){try{postMessage({status:"loading"});const e=await r();postMessage({status:"success",data:e})}catch(e){postMessage(e instanceof nr?{status:"error",userFacing:!0,headline:e.headline,error:e}:{status:"error",userFacing:!1,error:e instanceof Error?e:new Error(`${e}`)})}}async function Ds(r){const e=await ks(r.data);return{overallMutationData:e.overallMutationData,mutationOverTimeSerialized:e.mutationOverTimeData.getContents()}}self.onmessage=async function(r){await Os(()=>Ds(r))}})();\n//# sourceMappingURL=mutationOverTimeWorker-DRRi3aMG.js.map\n', jb = typeof self < "u" && self.Blob && new Blob([ek], { type: "text/javascript;charset=utf-8" });
25854
+ const ek = '(function(){"use strict";var b;(function(r){r.assertEqual=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"&&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})(b||(b={}));var et;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(et||(et={}));const m=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),L=r=>{switch(typeof r){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(r)?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(r)?m.array:r===null?m.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?m.promise:typeof Map<"u"&&r instanceof Map?m.map:typeof Set<"u"&&r instanceof Set?m.set:typeof Date<"u"&&r instanceof Date?m.date:m.object;default:return m.unknown}},d=b.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"]),lr=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:");class N extends Error{get errors(){return this.issues}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}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,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof N))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=r=>new N(r);const oe=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===m.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(r.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(r.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(r.options)}, received \'${r.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 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}"`:b.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case d.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==="bigint"?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 d.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 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 ${r.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}};let gt=oe;function hr(r){gt=r}function Pe(){return gt}const We=r=>{const{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},fr=[];function f(r,e){const t=Pe(),n=We({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===oe?void 0:oe].filter(s=>!!s)});r.common.issues.push(n)}class M{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 y;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){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return M.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 y;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 y=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),O=r=>({status:"valid",value:r}),tt=r=>r.status==="aborted",rt=r=>r.status==="dirty",Q=r=>r.status==="valid",ke=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));class P{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||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const vt=(r,e)=>{if(Q(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 N(r.common.issues);return this._error=t,this._error}}};function _(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)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:s}}class x{get description(){return this._def.description}_getType(e){return L(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new M,ctx:{common:e.parent.common,data:e.data,parsedType:L(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ke(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){const n={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:L(e)},s=this._parseSync({data:e,path:n.path,parent:n});return vt(n,s)}"~validate"(e){var n,s;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:L(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return Q(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(s=(n=a==null?void 0:a.message)==null?void 0:n.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>Q(a)?{value:a.value}:{issues:t.common.issues})}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:L(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(ke(s)?s:Promise.resolve(s));return vt(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:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!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 Z({schema:this,typeName:g.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 V.create(this,this._def)}nullable(){return K.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return I.create(this)}promise(){return he.create(this,this._def)}or(e){return Se.create([this,e],this._def)}and(e){return Te.create(this,e,this._def)}transform(e){return new Z({..._(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new De({..._(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new at({typeName:g.ZodBranded,type:this,..._(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ne({..._(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Ee.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mr=/^c[^\\s-]{8,}$/i,pr=/^[0-9a-z]+$/,yr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,gr=/^[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,vr=/^[a-z0-9_-]{21}$/i,_r=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,kr=/^[-+]?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)?)??$/,xr=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,br="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";let nt;const wr=/^(?:(?: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])$/,Sr=/^(?:(?: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])$/,Tr=/^(([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]))$/,Ar=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$r=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Mr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_t="((\\\\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])))",Or=new RegExp(`^${_t}$`);function kt(r){let e="[0-5]\\\\d";r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`);const t=r.precision?"+":"?";return`([01]\\\\d|2[0-3]):[0-5]\\\\d(:${e})${t}`}function Dr(r){return new RegExp(`^${kt(r)}$`)}function xt(r){let e=`${_t}T${kt(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Nr(r,e){return!!((e==="v4"||!e)&&wr.test(r)||(e==="v6"||!e)&&Tr.test(r))}function Rr(r,e){if(!_r.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Er(r,e){return!!((e==="v4"||!e)&&Sr.test(r)||(e==="v6"||!e)&&Ar.test(r))}class C extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.string,received:a.parsedType}),y}const n=new M;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.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),f(s,{code:d.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?f(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")xr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")nt||(nt=new RegExp(br,"u")),nt.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")gr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")vr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")mr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")pr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")yr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ulid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),f(s,{validation:"url",code:d.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),f(s,{validation:"regex",code:d.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),f(s,{code:d.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),f(s,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?xt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Or.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Dr(a).test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?kr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?Nr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Rr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Er(e.data,a.version)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?$r.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Mr.test(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{validation:"base64url",code:d.invalid_string,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...p.errToObj(n)})}_addCheck(e){return new C({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...p.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...p.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,...p.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,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...p.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...p.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...p.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...p.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...p.errToObj(t)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new C({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new C({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new C({...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}}C.create=r=>new C({checks:[],typeName:g.ZodString,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});function Cr(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=Number.parseInt(r.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class q extends x{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 f(a,{code:d.invalid_type,expected:m.number,received:a.parsedType}),y}let n;const s=new M;for(const a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.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),f(n,{code:d.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),f(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Cr(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.not_finite,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new q({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.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"&&b.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)}}q.create=r=>new q({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class G extends x{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 n;const s=new M;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),f(n,{code:d.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),f(n,{code:d.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),f(n,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,n,s){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.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}}G.create=r=>new G({checks:[],typeName:g.ZodBigInt,coerce:(r==null?void 0:r.coerce)??!1,..._(r)});class xe extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),y}return O(e.data)}}xe.create=r=>new xe({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,..._(r)});class X extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:m.date,received:a.parsedType}),y}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),y}const n=new M;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.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),f(s,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):b.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.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}}X.create=r=>new X({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate,..._(r)});class Ve extends x{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),y}return O(e.data)}}Ve.create=r=>new Ve({typeName:g.ZodSymbol,..._(r)});class be extends x{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),y}return O(e.data)}}be.create=r=>new be({typeName:g.ZodUndefined,..._(r)});class we extends x{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),y}return O(e.data)}}we.create=r=>new we({typeName:g.ZodNull,..._(r)});class ue extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}}ue.create=r=>new ue({typeName:g.ZodAny,..._(r)});class ee extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}}ee.create=r=>new ee({typeName:g.ZodUnknown,..._(r)});class U extends x{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),y}}U.create=r=>new U({typeName:g.ZodNever,..._(r)});class ze extends x{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),y}return O(e.data)}}ze.create=r=>new ze({typeName:g.ZodVoid,..._(r)});class I extends x{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return f(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),y;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(f(t,{code:i?d.too_big:d.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&&(f(t,{code:d.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&&(f(t,{code:d.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 P(t,i,t.path,o)))).then(i=>M.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new P(t,i,t.path,o)));return M.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new I({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new I({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new I({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}I.create=(r,e)=>new I({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,..._(e)});function de(r){if(r instanceof A){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=V.create(de(n))}return new A({...r._def,shape:()=>e})}else return r instanceof I?new I({...r._def,type:de(r.element)}):r instanceof V?V.create(de(r.unwrap())):r instanceof K?K.create(de(r.unwrap())):r instanceof W?W.create(r.items.map(e=>de(e))):r}class A extends x{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=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const u=this._getOrReturnCtx(e);return f(u,{code:d.invalid_type,expected:m.object,received:u.parsedType}),y}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof U&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const h=a[u],k=s.data[u];c.push({key:{status:"valid",value:u},value:h._parse(new P(s,k,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof U){const u=this._def.unknownKeys;if(u==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(u==="strict")o.length>0&&(f(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const h of o){const k=s.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new P(s,k,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const h of c){const k=await h.key,v=await h.value;u.push({key:k,value:v,alwaysSet:h.alwaysSet})}return u}).then(u=>M.mergeObjectSync(n,u)):M.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new A({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var a,i;const s=((i=(a=this._def).errorMap)==null?void 0:i.call(a,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:p.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new A({...this._def,unknownKeys:"strip"})}passthrough(){return new A({...this._def,unknownKeys:"passthrough"})}extend(e){return new A({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new A({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new A({...this._def,catchall:e})}pick(e){const t={};for(const n of b.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}omit(e){const t={};for(const n of b.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}deepPartial(){return de(this)}partial(e){const t={};for(const n of b.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new A({...this._def,shape:()=>t})}required(e){const t={};for(const n of b.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof V;)a=a._def.innerType;t[n]=a}return new A({...this._def,shape:()=>t})}keyof(){return bt(b.objectKeys(this.shape))}}A.create=(r,e)=>new A({shape:()=>r,unknownKeys:"strip",catchall:U.create(),typeName:g.ZodObject,..._(e)}),A.strictCreate=(r,e)=>new A({shape:()=>r,unknownKeys:"strict",catchall:U.create(),typeName:g.ZodObject,..._(e)}),A.lazycreate=(r,e)=>new A({shape:r,unknownKeys:"strip",catchall:U.create(),typeName:g.ZodObject,..._(e)});class Se extends x{_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 N(o.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:i}),y}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 c of n){const u={...t,common:{...t.common,issues:[]},parent:null},h=c._parseSync({data:t.data,path:t.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new N(c));return f(t,{code:d.invalid_union,unionErrors:o}),y}}get options(){return this._def.options}}Se.create=(r,e)=>new Se({options:r,typeName:g.ZodUnion,..._(e)});const B=r=>r instanceof $e?B(r.schema):r instanceof Z?B(r.innerType()):r instanceof Me?[r.value]:r instanceof J?r.options:r instanceof Oe?b.objectValues(r.enum):r instanceof De?B(r._def.innerType):r instanceof be?[void 0]:r instanceof we?[null]:r instanceof V?[void 0,...B(r.unwrap())]:r instanceof K?[null,...B(r.unwrap())]:r instanceof at||r instanceof Ee?B(r.unwrap()):r instanceof Ne?B(r._def.innerType):[];class Le extends x{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return f(t,{code:d.invalid_type,expected:m.object,received:t.parsedType}),y;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}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}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=B(a.shape[e]);if(!i.length)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 Le({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,..._(n)})}}function st(r,e){const t=L(r),n=L(e);if(r===e)return{valid:!0,data:r};if(t===m.object&&n===m.object){const s=b.objectKeys(e),a=b.objectKeys(r).filter(o=>s.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=st(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.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],c=st(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class Te extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(tt(a)||tt(i))return y;const o=st(a.value,i.value);return o.valid?((rt(a)||rt(i))&&t.dirty(),{status:t.value,value:o.data}):(f(n,{code:d.invalid_intersection_types}),y)};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}))}}Te.create=(r,e,t)=>new Te({left:r,right:e,typeName:g.ZodIntersection,..._(t)});class W extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return f(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return f(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new P(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>M.mergeArray(t,i)):M.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new W({...this._def,rest:e})}}W.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W({items:r,typeName:g.ZodTuple,rest:null,..._(e)})};class Ae extends x{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!==m.object)return f(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),y;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new P(n,o,n.path,o)),value:i._parse(new P(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?M.mergeObjectAsync(t,s):M.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new Ae({keyType:e,valueType:t,typeName:g.ZodRecord,..._(n)}):new Ae({keyType:C.create(),valueType:e,typeName:g.ZodRecord,..._(t)})}}class Ue extends x{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!==m.map)return f(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),y;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new P(n,o,n.path,[u,"key"])),value:a._parse(new P(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,h=await c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return y;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}}}Ue.create=(r,e,t)=>new Ue({valueType:e,keyType:r,typeName:g.ZodMap,..._(t)});class te extends x{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return f(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),y;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(f(n,{code:d.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&&(f(n,{code:d.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(c){const u=new Set;for(const h of c){if(h.status==="aborted")return y;h.status==="dirty"&&t.dirty(),u.add(h.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new P(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new te({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new te({...this._def,maxSize:{value:e,message:p.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}te.create=(r,e)=>new te({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet,..._(e)});class le extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return f(t,{code:d.invalid_type,expected:m.function,received:t.parsedType}),y;function n(o,c){return We({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pe(),oe].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:c}})}function s(o,c){return We({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pe(),oe].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof he){const o=this;return O(async function(...c){const u=new N([]),h=await o._def.args.parseAsync(c,a).catch(S=>{throw u.addIssue(n(c,S)),u}),k=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(k,a).catch(S=>{throw u.addIssue(s(k,S)),u})})}else{const o=this;return O(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new N([n(c,u.error)]);const h=Reflect.apply(i,this,u.data),k=o._def.returns.safeParse(h,a);if(!k.success)throw new N([s(h,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new le({...this._def,args:W.create(e).rest(ee.create())})}returns(e){return new le({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new le({args:e||W.create([]).rest(ee.create()),returns:t||ee.create(),typeName:g.ZodFunction,..._(n)})}}class $e extends x{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})}}$e.create=(r,e)=>new $e({getter:r,typeName:g.ZodLazy,..._(e)});class Me extends x{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}Me.create=(r,e)=>new Me({value:r,typeName:g.ZodLiteral,..._(e)});function bt(r,e){return new J({values:r,typeName:g.ZodEnum,..._(e)})}class J extends x{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:b.joinValues(n),received:t.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:n}),y}return O(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 J.create(e,{...this._def,...t})}exclude(e,t=this._def){return J.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}J.create=bt;class Oe extends x{_parse(e){const t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const s=b.objectValues(t);return f(n,{expected:b.joinValues(s),received:n.parsedType,code:d.invalid_type}),y}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=b.objectValues(t);return f(n,{received:n.data,code:d.invalid_enum_value,options:s}),y}return O(e.data)}get enum(){return this._def.values}}Oe.create=(r,e)=>new Oe({values:r,typeName:g.ZodNativeEnum,..._(e)});class he extends x{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),y;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return O(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}he.create=(r,e)=>new he({type:r,typeName:g.ZodPromise,..._(e)});class Z extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.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=>{f(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);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return y;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?y:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return y;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?y:o.status==="dirty"||t.value==="dirty"?ce(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?y:(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"?y:(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(!Q(i))return y;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=>Q(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):y);b.assertNever(s)}}Z.create=(r,e,t)=>new Z({schema:r,typeName:g.ZodEffects,effect:e,..._(t)}),Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects,..._(t)});class V extends x{_parse(e){return this._getType(e)===m.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}V.create=(r,e)=>new V({innerType:r,typeName:g.ZodOptional,..._(e)});class K extends x{_parse(e){return this._getType(e)===m.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}K.create=(r,e)=>new K({innerType:r,typeName:g.ZodNullable,..._(e)});class De extends x{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}De.create=(r,e)=>new De({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});class Ne extends x{_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 ke(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new N(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ne.create=(r,e)=>new Ne({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});class Be extends x{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return f(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}}Be.create=r=>new Be({typeName:g.ZodNaN,..._(r)});const Ir=Symbol("zod_brand");class at extends x{_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 Re extends x{_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"?y:a.status==="dirty"?(t.dirty(),ce(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"?y: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 Re({in:e,out:t,typeName:g.ZodPipeline})}}class Ee extends x{_parse(e){const t=this._def.innerType._parse(e),n=s=>(Q(s)&&(s.value=Object.freeze(s.value)),s);return ke(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:g.ZodReadonly,..._(e)});function wt(r,e){const t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function St(r,e={},t){return r?ue.create().superRefine((n,s)=>{const a=r(n);if(a instanceof Promise)return a.then(i=>{if(!i){const o=wt(e,n),c=o.fatal??t??!0;s.addIssue({code:"custom",...o,fatal:c})}});if(!a){const i=wt(e,n),o=i.fatal??t??!0;s.addIssue({code:"custom",...i,fatal:o})}}):ue.create()}const Zr={object:A.lazycreate};var g;(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"})(g||(g={}));const jr=(r,e={message:`Input not instance of ${r.name}`})=>St(t=>t instanceof r,e),Tt=C.create,At=q.create,Yr=Be.create,Fr=G.create,$t=xe.create,Pr=X.create,Wr=Ve.create,Vr=be.create,zr=we.create,Lr=ue.create,Ur=ee.create,Br=U.create,Hr=ze.create,qr=I.create,Gr=A.create,Jr=A.strictCreate,Kr=Se.create,Qr=Le.create,Xr=Te.create,en=W.create,tn=Ae.create,rn=Ue.create,nn=te.create,sn=le.create,an=$e.create,on=Me.create,cn=J.create,un=Oe.create,dn=he.create,Mt=Z.create,ln=V.create,hn=K.create,fn=Z.createWithPreprocess,mn=Re.create;var l=Object.freeze({__proto__:null,BRAND:Ir,DIRTY:ce,EMPTY_PATH:fr,INVALID:y,NEVER:y,OK:O,ParseStatus:M,Schema:x,ZodAny:ue,ZodArray:I,ZodBigInt:G,ZodBoolean:xe,ZodBranded:at,ZodCatch:Ne,ZodDate:X,ZodDefault:De,ZodDiscriminatedUnion:Le,ZodEffects:Z,ZodEnum:J,ZodError:N,get ZodFirstPartyTypeKind(){return g},ZodFunction:le,ZodIntersection:Te,ZodIssueCode:d,ZodLazy:$e,ZodLiteral:Me,ZodMap:Ue,ZodNaN:Be,ZodNativeEnum:Oe,ZodNever:U,ZodNull:we,ZodNullable:K,ZodNumber:q,ZodObject:A,ZodOptional:V,ZodParsedType:m,ZodPipeline:Re,ZodPromise:he,ZodReadonly:Ee,ZodRecord:Ae,ZodSchema:x,ZodSet:te,ZodString:C,ZodSymbol:Ve,ZodTransformer:Z,ZodTuple:W,ZodType:x,ZodUndefined:be,ZodUnion:Se,ZodUnknown:ee,ZodVoid:ze,addIssueToContext:f,any:Lr,array:qr,bigint:Fr,boolean:$t,coerce:{string:r=>C.create({...r,coerce:!0}),number:r=>q.create({...r,coerce:!0}),boolean:r=>xe.create({...r,coerce:!0}),bigint:r=>G.create({...r,coerce:!0}),date:r=>X.create({...r,coerce:!0})},custom:St,date:Pr,datetimeRegex:xt,defaultErrorMap:oe,discriminatedUnion:Qr,effect:Mt,enum:cn,function:sn,getErrorMap:Pe,getParsedType:L,instanceof:jr,intersection:Xr,isAborted:tt,isAsync:ke,isDirty:rt,isValid:Q,late:Zr,lazy:an,literal:on,makeIssue:We,map:rn,nan:Yr,nativeEnum:un,never:Br,null:zr,nullable:hn,number:At,object:Gr,get objectUtil(){return et},oboolean:()=>$t().optional(),onumber:()=>At().optional(),optional:ln,ostring:()=>Tt().optional(),pipeline:mn,preprocess:fn,promise:dn,quotelessJson:lr,record:tn,set:nn,setErrorMap:hr,strictObject:Jr,string:Tt,symbol:Wr,transformer:Mt,tuple:en,undefined:Vr,union:Kr,unknown:Ur,get util(){return b},void:Hr});l.object({nucleotideSequences:l.array(l.object({name:l.string(),sequence:l.string()})),genes:l.array(l.object({name:l.string(),sequence:l.string()}))});const pn=l.enum(["ascending","descending"]),yn=l.object({field:l.string(),type:pn}),Ot=l.union([l.string(),l.number(),l.boolean(),l.null(),l.undefined(),l.array(l.string())]),Dt=l.object({dateFrom:l.string(),dateTo:l.string()});l.object({limit:l.number().optional(),offset:l.number().optional(),fields:l.array(l.string()).optional(),orderBy:l.array(yn).optional()}).catchall(Ot).extend({minProportion:l.number().optional()});const gn=l.object({mutation:l.string(),proportion:l.number(),count:l.number(),sequenceName:l.union([l.string(),l.null()]),mutationFrom:l.string(),mutationTo:l.string(),position:l.number()}),vn=Ce(l.array(gn));l.object({filters:l.record(Ot),downloadAsFile:l.boolean().optional(),downloadFileBasename:l.string().optional(),compression:l.enum(["gzip","none"]).optional(),includeMutations:l.array(l.string()).optional(),dateRanges:l.array(Dt).optional(),dateField:l.string().optional()});const _n=Ce(l.object({mutations:l.array(l.string()),dateRanges:l.array(Dt),data:l.array(l.array(l.object({count:l.number(),coverage:l.number()})))})),kn=l.object({insertion:l.string(),count:l.number(),insertedSymbols:l.string(),position:l.number(),sequenceName:l.union([l.string(),l.null()])});Ce(l.array(kn));const Nt=l.union([l.string(),l.number(),l.boolean(),l.null()]),xn=l.object({count:l.number()}).catchall(Nt),bn=Ce(l.array(xn)),wn=l.object({}).catchall(Nt);Ce(l.array(wn));function Ce(r){return l.object({data:r})}const Rt=l.object({title:l.string().optional(),status:l.number(),detail:l.string().optional(),type:l.string(),instance:l.string().optional()}),Sn=l.object({error:Rt}),Tn=l.object({parents:l.array(l.string()).optional(),aliases:l.array(l.string()).optional()});l.record(Tn);class it extends Error{constructor(e,t,n){super(e),this.status=t,this.requestedData=n,this.name="UnknownLapisError"}}class Et extends Error{constructor(e,t,n,s){super(e),this.status=t,this.problemDetail=n,this.requestedData=s,this.name="LapisError"}}async function An(r,e,t){const n=await ot(Dn(r),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t},"aggregated data");return bn.parse(await n.json())}async function $n(r,e,t,n){const s=await ot(Nn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations`);return vn.parse(await s.json())}async function Mn(r,e,t,n){const s=await ot(Rn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations over time`);return _n.parse(await s.json())}async function ot(r,e,t){try{const n=await fetch(r,e);return await On(n,t),n}catch(n){const s=n instanceof Error?n.message:`${n}`;throw new it(`Failed to connect to LAPIS: ${s}`,500,t)}}const On=async(r,e)=>{if(!r.ok){if(r.status>=400&&r.status<500){const t=await r.json(),n=Sn.safeParse(t);if(n.success)throw new Et(r.statusText+(n.data.error.detail??""),r.status,n.data.error,e);const s=Rt.safeParse(t);throw s.success?new Et(r.statusText+(s.data.detail??""),r.status,s.data,e):new it(`${r.statusText}: ${JSON.stringify(t)}`,r.status,e)}throw new it(`${r.statusText}: ${r.status}`,r.status,e)}},Dn=r=>`${r}/sample/aggregated`,Nn=(r,e)=>e==="amino acid"?`${r}/sample/aminoAcidMutations`:`${r}/sample/nucleotideMutations`,Rn=(r,e)=>e==="amino acid"?`${r}/component/aminoAcidMutationsOverTime`:`${r}/component/nucleotideMutationsOverTime`;class Ct{constructor(e,t=[]){this.filter=e,this.fields=t}async evaluate(e,t){const n=(await An(e,{...this.filter,fields:this.fields},t)).data;if(En(n))return{content:n};throw new Error("Aggregated response does not have count")}}function En(r){return r.every(e=>typeof e=="object"&&"count"in e&&typeof e.count=="number")}class Cn{constructor(e,t,n){this.child=e,this.field=t,this.aggregate=n}async evaluate(e,t){const n=await this.child.evaluate(e,t),s=new Map;for(const i of n.content){const o=i[this.field];s.has(o)||s.set(o,[]),s.get(o).push(i)}const a=new Array;for(const[,i]of s)a.push(this.aggregate(i));return{content:a}}}class In extends Cn{constructor(e,t,n){super(e,t,s=>{let a=0;for(const i of s)a+=i[n];return{[t]:s[0][t],[n]:a}})}}class ct{constructor(e,t){this.child=e,this.func=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.map(this.func)}}}class Zn extends ct{constructor(e,t,n){super(e,s=>({...s,[n]:s[t]}))}}class jn{constructor(e,t){this.child=e,this.compareFn=t}async evaluate(e,t){return{content:(await this.child.evaluate(e,t)).content.sort(this.compareFn)}}}var It=60,Zt=It*60,jt=Zt*24,Yn=jt*7,fe=1e3,ut=It*fe,Yt=Zt*fe,Fn=jt*fe,Pn=Yn*fe,dt="millisecond",me="second",pe="minute",ye="hour",j="day",Ie="week",Y="month",Ft="quarter",H="year",ge="date",Pt="YYYY-MM-DDTHH:mm:ssZ",Wt="Invalid Date",Wn=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,Vn=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,zn={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},lt=function(e,t,n){var s=String(e);return!s||s.length>=t?e:""+Array(t+1-s.length).join(n)+e},Ln=function(e){var t=-e.utcOffset(),n=Math.abs(t),s=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+lt(s,2,"0")+":"+lt(a,2,"0")},Un=function r(e,t){if(e.date()<t.date())return-r(t,e);var n=(t.year()-e.year())*12+(t.month()-e.month()),s=e.clone().add(n,Y),a=t-s<0,i=e.clone().add(n+(a?-1:1),Y);return+(-(n+(t-s)/(a?s-i:i-s))||0)},Bn=function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},Hn=function(e){var t={M:Y,y:H,w:Ie,d:j,D:ge,h:ye,m:pe,s:me,ms:dt,Q:Ft};return t[e]||String(e||"").toLowerCase().replace(/s$/,"")},qn=function(e){return e===void 0},Gn={s:lt,z:Ln,m:Un,a:Bn,p:Hn,u:qn},Ze="en",re={};re[Ze]=zn;var Vt="$isDayjsObject",ht=function(e){return e instanceof qe||!!(e&&e[Vt])},He=function r(e,t,n){var s;if(!e)return Ze;if(typeof e=="string"){var a=e.toLowerCase();re[a]&&(s=a),t&&(re[a]=t,s=a);var i=e.split("-");if(!s&&i.length>1)return r(i[0])}else{var o=e.name;re[o]=e,s=o}return!n&&s&&(Ze=s),s||!n&&Ze},T=function(e,t){if(ht(e))return e.clone();var n=typeof t=="object"?t:{};return n.date=e,n.args=arguments,new qe(n)},Jn=function(e,t){return T(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},w=Gn;w.l=He,w.i=ht,w.w=Jn;var Kn=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(w.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){var s=t.match(Wn);if(s){var a=s[2]-1||0,i=(s[7]||"0").substring(0,3);return n?new Date(Date.UTC(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)):new Date(s[1],a,s[3]||1,s[4]||0,s[5]||0,s[6]||0,i)}}return new Date(t)},qe=function(){function r(t){this.$L=He(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[Vt]=!0}var e=r.prototype;return e.parse=function(n){this.$d=Kn(n),this.init()},e.init=function(){var n=this.$d;this.$y=n.getFullYear(),this.$M=n.getMonth(),this.$D=n.getDate(),this.$W=n.getDay(),this.$H=n.getHours(),this.$m=n.getMinutes(),this.$s=n.getSeconds(),this.$ms=n.getMilliseconds()},e.$utils=function(){return w},e.isValid=function(){return this.$d.toString()!==Wt},e.isSame=function(n,s){var a=T(n);return this.startOf(s)<=a&&a<=this.endOf(s)},e.isAfter=function(n,s){return T(n)<this.startOf(s)},e.isBefore=function(n,s){return this.endOf(s)<T(n)},e.$g=function(n,s,a){return w.u(n)?this[s]:this.set(a,n)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(n,s){var a=this,i=w.u(s)?!0:s,o=w.p(n),c=function(ve,F){var D=w.w(a.$u?Date.UTC(a.$y,F,ve):new Date(a.$y,F,ve),a);return i?D:D.endOf(j)},u=function(ve,F){var D=[0,0,0,0],_e=[23,59,59,999];return w.w(a.toDate()[ve].apply(a.toDate("s"),(i?D:_e).slice(F)),a)},h=this.$W,k=this.$M,v=this.$D,S="set"+(this.$u?"UTC":"");switch(o){case H:return i?c(1,0):c(31,11);case Y:return i?c(1,k):c(0,k+1);case Ie:{var R=this.$locale().weekStart||0,E=(h<R?h+7:h)-R;return c(i?v-E:v+(6-E),k)}case j:case ge:return u(S+"Hours",0);case ye:return u(S+"Minutes",1);case pe:return u(S+"Seconds",2);case me:return u(S+"Milliseconds",3);default:return this.clone()}},e.endOf=function(n){return this.startOf(n,!1)},e.$set=function(n,s){var a,i=w.p(n),o="set"+(this.$u?"UTC":""),c=(a={},a[j]=o+"Date",a[ge]=o+"Date",a[Y]=o+"Month",a[H]=o+"FullYear",a[ye]=o+"Hours",a[pe]=o+"Minutes",a[me]=o+"Seconds",a[dt]=o+"Milliseconds",a)[i],u=i===j?this.$D+(s-this.$W):s;if(i===Y||i===H){var h=this.clone().set(ge,1);h.$d[c](u),h.init(),this.$d=h.set(ge,Math.min(this.$D,h.daysInMonth())).$d}else c&&this.$d[c](u);return this.init(),this},e.set=function(n,s){return this.clone().$set(n,s)},e.get=function(n){return this[w.p(n)]()},e.add=function(n,s){var a=this,i;n=Number(n);var o=w.p(s),c=function(v){var S=T(a);return w.w(S.date(S.date()+Math.round(v*n)),a)};if(o===Y)return this.set(Y,this.$M+n);if(o===H)return this.set(H,this.$y+n);if(o===j)return c(1);if(o===Ie)return c(7);var u=(i={},i[pe]=ut,i[ye]=Yt,i[me]=fe,i)[o]||1,h=this.$d.getTime()+n*u;return w.w(h,this)},e.subtract=function(n,s){return this.add(n*-1,s)},e.format=function(n){var s=this,a=this.$locale();if(!this.isValid())return a.invalidDate||Wt;var i=n||Pt,o=w.z(this),c=this.$H,u=this.$m,h=this.$M,k=a.weekdays,v=a.months,S=a.meridiem,R=function(D,_e,Xe,Rs){return D&&(D[_e]||D(s,i))||Xe[_e].slice(0,Rs)},E=function(D){return w.s(c%12||12,D,"0")},Qe=S||function(F,D,_e){var Xe=F<12?"AM":"PM";return _e?Xe.toLowerCase():Xe},ve=function(D){switch(D){case"YY":return String(s.$y).slice(-2);case"YYYY":return w.s(s.$y,4,"0");case"M":return h+1;case"MM":return w.s(h+1,2,"0");case"MMM":return R(a.monthsShort,h,v,3);case"MMMM":return R(v,h);case"D":return s.$D;case"DD":return w.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return R(a.weekdaysMin,s.$W,k,2);case"ddd":return R(a.weekdaysShort,s.$W,k,3);case"dddd":return k[s.$W];case"H":return String(c);case"HH":return w.s(c,2,"0");case"h":return E(1);case"hh":return E(2);case"a":return Qe(c,u,!0);case"A":return Qe(c,u,!1);case"m":return String(u);case"mm":return w.s(u,2,"0");case"s":return String(s.$s);case"ss":return w.s(s.$s,2,"0");case"SSS":return w.s(s.$ms,3,"0");case"Z":return o}return null};return i.replace(Vn,function(F,D){return D||ve(F)||o.replace(":","")})},e.utcOffset=function(){return-Math.round(this.$d.getTimezoneOffset()/15)*15},e.diff=function(n,s,a){var i=this,o=w.p(s),c=T(n),u=(c.utcOffset()-this.utcOffset())*ut,h=this-c,k=function(){return w.m(i,c)},v;switch(o){case H:v=k()/12;break;case Y:v=k();break;case Ft:v=k()/3;break;case Ie:v=(h-u)/Pn;break;case j:v=(h-u)/Fn;break;case ye:v=h/Yt;break;case pe:v=h/ut;break;case me:v=h/fe;break;default:v=h;break}return a?v:w.a(v)},e.daysInMonth=function(){return this.endOf(Y).$D},e.$locale=function(){return re[this.$L]},e.locale=function(n,s){if(!n)return this.$L;var a=this.clone(),i=He(n,s,!0);return i&&(a.$L=i),a},e.clone=function(){return w.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},r}(),zt=qe.prototype;T.prototype=zt,[["$ms",dt],["$s",me],["$m",pe],["$H",ye],["$W",j],["$M",Y],["$y",H],["$D",ge]].forEach(function(r){zt[r[1]]=function(e){return this.$g(e,r[0],r[1])}}),T.extend=function(r,e){return r.$i||(r(e,qe,T),r.$i=!0),T},T.locale=He,T.isDayjs=ht,T.unix=function(r){return T(r*1e3)},T.en=re[Ze],T.Ls=re,T.p={};var Qn=function(r,e){var t=e.prototype,n=t.format;t.format=function(s){var a=this,i=this.$locale();if(!this.isValid())return n.bind(this)(s);var o=this.$utils(),c=s||Pt,u=c.replace(/\\[([^\\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return i.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return i.ordinal(a.week(),"W");case"w":case"ww":return o.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return n.bind(this)(u)}},Xn="isoweek",es=function(r,e,t){var n=function(c,u){var h=(u?t.utc:t)().year(c).startOf(H),k=4-h.isoWeekday();return h.isoWeekday()>4&&(k+=7),h.add(k,j)},s=function(c){return c.add(4-c.isoWeekday(),j)},a=e.prototype;a.isoWeekYear=function(){var o=s(this);return o.year()},a.isoWeek=function(o){if(!this.$utils().u(o))return this.add((o-this.isoWeek())*7,j);var c=s(this),u=n(this.isoWeekYear(),this.$u);return c.diff(u,Ie)+1},a.isoWeekday=function(o){return this.$utils().u(o)?this.day()||7:this.day(this.day()%7?o:o-7)};var i=a.startOf;a.startOf=function(o,c){var u=this.$utils(),h=u.u(c)?!0:c,k=u.p(o);return k===Xn?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):i.bind(this)(o,c)}};T.extend(es),T.extend(Qn);const ft="GGGG-[W]WW",Ke=class Ke{constructor(){this.yearMonthDayCache=new Map,this.yearWeekCache=new Map,this.yearMonthCache=new Map,this.yearCache=new Map}getYearMonthDay(e){return this.yearMonthDayCache.has(e)||this.yearMonthDayCache.set(e,ne.parse(e,this)),this.yearMonthDayCache.get(e)}getYearMonth(e){return this.yearMonthCache.has(e)||this.yearMonthCache.set(e,ae.parse(e,this)),this.yearMonthCache.get(e)}getYearWeek(e){return this.yearWeekCache.has(e)||this.yearWeekCache.set(e,se.parse(e,this)),this.yearWeekCache.get(e)}getYear(e){return this.yearCache.has(e)||this.yearCache.set(e,ie.parse(e,this)),this.yearCache.get(e)}static getInstance(){return this.instance}};Ke.instance=new Ke;let mt=Ke;class ne{constructor(e,t,n,s){this.yearNumber=e,this.monthNumber=t,this.dayNumber=n,this.cache=s,this.type="YearMonthDay",this.date=new Date(this.yearNumber,this.monthNumber-1,this.dayNumber),this.dayjs=T(this.date),this.dateString=this.toString()}get text(){return this.dayjs.format("YYYY-MM-DD")}toString(){return this.text}englishName(){return this.dayjs.format("dddd, MMMM D, YYYY")}get firstDay(){return this}get lastDay(){return this}get year(){return this.cache.getYear(`${this.yearNumber}`)}get month(){return this.cache.getYearMonth(this.dayjs.format("YYYY-MM"))}get week(){return this.cache.getYearWeek(this.dayjs.format(ft))}addDays(e){const n=this.dayjs.add(e,"day").format("YYYY-MM-DD");return this.cache.getYearMonthDay(n)}minus(e){return this.dayjs.diff(e.dayjs,"day")}static parse(e,t){const[n,s,a]=e.split("-").map(i=>parseInt(i,10));return new ne(n,s,a,t)}}class se{constructor(e,t,n){this.isoYearNumber=e,this.isoWeekNumber=t,this.cache=n,this.type="YearWeek",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format(ft)}toString(){return this.text}englishName(){return`Week ${this.isoWeekNumber}, ${this.isoYearNumber}`}get firstDay(){const e=T().year(this.isoYearNumber).month(1).date(4).isoWeek(this.isoWeekNumber).startOf("isoWeek");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get lastDay(){const e=this.firstDay.dayjs.add(6,"days");return this.cache.getYearMonthDay(e.format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.isoYearNumber}`)}addWeeks(e){const n=this.firstDay.dayjs.add(e,"week").format(ft);return this.cache.getYearWeek(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"week")}static parse(e,t){const[n,s]=e.split("-W").map(a=>parseInt(a,10));return new se(n,s,t)}}class ae{constructor(e,t,n){this.yearNumber=e,this.monthNumber=t,this.cache=n,this.type="YearMonth",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY-MM")}toString(){return this.text}englishName(){return`${ts(this.monthNumber)} ${this.yearNumber}`}get firstDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).format("YYYY-MM-DD"))}get lastDay(){return this.cache.getYearMonthDay(T(`${this.yearNumber}-${this.monthNumber}-01`).endOf("month").format("YYYY-MM-DD"))}get year(){return this.cache.getYear(`${this.yearNumber}`)}addMonths(e){const n=this.firstDay.dayjs.add(e,"month").format("YYYY-MM");return this.cache.getYearMonth(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"month")}static parse(e,t){const[n,s]=e.split("-").map(a=>parseInt(a,10));return new ae(n,s,t)}}class ie{constructor(e,t){this.year=e,this.cache=t,this.type="Year",this.dateString=this.toString()}get text(){return this.firstDay.dayjs.format("YYYY")}toString(){return this.text}englishName(){return this.year.toString()}get firstMonth(){return this.cache.getYearMonth(`${this.year}-01`)}get lastMonth(){return this.cache.getYearMonth(`${this.year}-12`)}get firstDay(){return this.firstMonth.firstDay}get lastDay(){return this.lastMonth.lastDay}addYears(e){const n=this.firstDay.dayjs.add(e,"year").format("YYYY");return this.cache.getYear(n)}minus(e){return this.firstDay.dayjs.diff(e.firstDay.dayjs,"year")}static parse(e,t){const n=parseInt(e,10);return new ie(n,t)}}function ts(r){return T().month(r-1).format("MMMM")}function Lt(r){switch(r.type){case"YearMonthDay":return{type:"YearMonthDay",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dayNumber:r.dayNumber,dateString:r.dateString};case"YearWeek":return{type:"YearWeek",isoYearNumber:r.isoYearNumber,isoWeekNumber:r.isoWeekNumber,dateString:r.dateString};case"YearMonth":return{type:"YearMonth",yearNumber:r.yearNumber,monthNumber:r.monthNumber,dateString:r.dateString};case"Year":return{type:"Year",year:r.year,dateString:r.dateString}}}function rs(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addDays(s));return t}function ns(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addWeeks(s));return t}function ss(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addMonths(s));return t}function as(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addYears(s));return t}function Ut(r,e){if(r===null||e===null)return[];if(r instanceof ne&&e instanceof ne)return rs(r,e);if(r instanceof se&&e instanceof se)return ns(r,e);if(r instanceof ae&&e instanceof ae)return ss(r,e);if(r instanceof ie&&e instanceof ie)return as(r,e);throw new Error(`Invalid arguments: start and end must be of the same type: ${r}, ${e}`)}function is(r,e){if(r instanceof ne&&e instanceof ne||r instanceof se&&e instanceof se||r instanceof ae&&e instanceof ae||r instanceof ie&&e instanceof ie)return r.minus(e);throw new Error(`Cannot compare ${r} and ${e}`)}function Ge(r,e){if(r===null)return 1;if(e===null)return-1;const t=is(r,e);return t<0?-1:t>0?1:0}function os(r){let e=null,t=null;for(const n of r)n!==null&&((e===null||Ge(n,e)<0)&&(e=n),(t===null||Ge(n,t)>0)&&(t=n));return e===null||t===null?{min:null,max:null}:{min:e,max:t}}function je(r,e){const n=mt.getInstance().getYearMonthDay(r);switch(e){case"day":return n;case"week":return n.week;case"month":return n.month;case"year":return n.year}}function cs(r,e){return r.dateRange===null?1:e.dateRange===null?-1:Ge(r.dateRange,e.dateRange)}function us(r,e){return{dateRange:r.date===null?null:je(r.date,e),count:r.count}}const ds=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(?<substitutionValue>[A-Z.*])?$/i;class Ye{constructor(e,t,n,s){this.segment=e,this.valueAtReference=t,this.substitutionValue=n,this.position=s,this.type="substitution";const a=this.segment?`${this.segment}:`:"",i=this.valueAtReference??"",o=this.substitutionValue??"";this.code=`${a}${i}${this.position}${o}`}equals(e){return e instanceof Ye?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.substitutionValue===e.substitutionValue&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=ds.exec(e);return(t==null?void 0:t.groups)===void 0?null:new Ye(t.groups.segment,t.groups.valueAtReference,t.groups.substitutionValue,parseInt(t.groups.position,10))}}const ls=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(-)$/i;class Fe{constructor(e,t,n){this.segment=e,this.valueAtReference=t,this.position=n,this.type="deletion";const s=this.segment?`${this.segment}:`:"",a=this.valueAtReference??"";this.code=`${s}${a}${this.position}-`}equals(e){return e instanceof Fe?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=ls.exec(e);return(t==null?void 0:t.groups)===void 0?null:new Fe(t.groups.segment,t.groups.valueAtReference,parseInt(t.groups.position,10))}}function Bt(r){switch(r.type){case"substitution":return{type:"substitution",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference,substitutionValue:r.substitutionValue};case"deletion":return{type:"deletion",code:r.code,segment:r.segment,position:r.position,valueAtReference:r.valueAtReference}}}class hs{constructor(e,t,n){this.filter=e,this.sequenceType=t,this.minProportion=n}async evaluate(e,t){return{content:(await this.fetchMutations(e,t)).map(({count:a,proportion:i,mutationFrom:o,mutationTo:c,position:u,sequenceName:h})=>c==="-"?{type:"deletion",mutation:new Fe(h??void 0,o,u),count:a,proportion:i}:{type:"substitution",mutation:new Ye(h??void 0,o,c,u),count:a,proportion:i})}}async fetchMutations(e,t){const n={...this.filter,minProportion:this.minProportion};return $n(e,n,this.sequenceType,t).then(s=>s.data)}}var Ht;Ht={__e:function(r,e,t,n){for(var s,a,i;e=e.__;)if((s=e.__c)&&!s.__)try{if((a=s.constructor)&&a.getDerivedStateFromError!=null&&(s.setState(a.getDerivedStateFromError(r)),i=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(r,n||{}),i=s.__d),i)return s.__E=s}catch(o){r=o}throw r}},typeof Promise=="function"&&Promise.prototype.then.bind(Promise.resolve());var z,pt,qt,Gt=[],$=Ht,Jt=$.__b,Kt=$.__r,Qt=$.diffed,Xt=$.__c,er=$.unmount,tr=$.__;function fs(){for(var r;r=Gt.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(Je),r.__H.__h.forEach(yt),r.__H.__h=[]}catch(e){r.__H.__h=[],$.__e(e,r.__v)}}$.__b=function(r){z=null,Jt&&Jt(r)},$.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),tr&&tr(r,e)},$.__r=function(r){Kt&&Kt(r);var e=(z=r.__c).__H;e&&(pt===z?(e.__h=[],z.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Je),e.__h.forEach(yt),e.__h=[])),pt=z},$.diffed=function(r){Qt&&Qt(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(Gt.push(e)!==1&&qt===$.requestAnimationFrame||((qt=$.requestAnimationFrame)||ms)(fs)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),pt=z=null},$.__c=function(r,e){e.some(function(t){try{t.__h.forEach(Je),t.__h=t.__h.filter(function(n){return!n.__||yt(n)})}catch(n){e.some(function(s){s.__h&&(s.__h=[])}),e=[],$.__e(n,t.__v)}}),Xt&&Xt(r,e)},$.unmount=function(r){er&&er(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Je(n)}catch(s){e=s}}),t.__H=void 0,e&&$.__e(e,t.__v))};var rr=typeof requestAnimationFrame=="function";function ms(r){var e,t=function(){clearTimeout(n),rr&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,35);rr&&(e=requestAnimationFrame(t))}function Je(r){var e=z,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),z=e}function yt(r){var e=z;r.__c=r.__(),z=e}class nr extends Error{constructor(e,t){super(t),this.headline=e,this.name="UserFacingError"}}class ps{constructor(e,t,n){this.serializeFirstAxis=e,this.serializeSecondAxis=t,this.data=new Map,this.keysFirstAxis=new Map,this.keysSecondAxis=new Map,n&&(this.keysFirstAxis=new Map(n.keysFirstAxis),this.keysSecondAxis=new Map(n.keysSecondAxis),this.data=new Map(n.data))}get(e,t){var a;const n=this.serializeFirstAxis(e),s=this.serializeSecondAxis(t);return(a=this.data.get(n))==null?void 0:a.get(s)}getRow(e){const t=this.serializeFirstAxis(e),n=this.data.get(t);return n===void 0?[]:Array.from(this.keysSecondAxis.keys()).map(s=>n.get(s))}set(e,t,n){const s=this.serializeFirstAxis(e),a=this.serializeSecondAxis(t);this.data.has(s)||this.data.set(s,new Map),this.data.get(s).set(a,n),this.keysFirstAxis.set(s,e),this.keysSecondAxis.set(a,t)}deleteRow(e){const t=this.serializeFirstAxis(e);this.data.delete(t),this.keysFirstAxis.delete(t)}getFirstAxisKeys(){return Array.from(this.keysFirstAxis.values())}getSecondAxisKeys(){return Array.from(this.keysSecondAxis.values())}getAsArray(){return this.getFirstAxisKeys().map(e=>this.getSecondAxisKeys().map(t=>this.get(e,t)))}getContents(){return{keysFirstAxis:this.keysFirstAxis,keysSecondAxis:this.keysSecondAxis,data:this.data}}}class sr extends ps{constructor(e){super($s,Ms,e)}}const ar=(r,e)=>{if(r.segment!==e.segment)return ys(r.segment,e.segment);if(r.position!==e.position)return gs(r.position,e.position);const t=r.type==="deletion",n=e.type==="deletion";return t!==n?t?1:-1:!t&&!n&&r.substitutionValue!==e.substitutionValue?vs(r.substitutionValue,e.substitutionValue):0},ys=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),gs=(r,e)=>r-e,vs=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),ir=200,_s=.001;function or(r){const e=Fe.parse(r);if(e)return{type:"deletion",mutation:e,count:0,proportion:0};const t=Ye.parse(r);return t?{type:"substitution",mutation:t,count:0,proportion:0}:null}async function ks({lapisFilter:r,sequenceType:e,lapis:t,granularity:n,lapisDateField:s,includeMutations:a,signal:i}){const o=await cr(r,t,n,s,i);if(o.length===0)return a?{content:a.map(or).filter(h=>h!==null)}:{content:[]};const c={...r,[`${s}From`]:o[0].firstDay.toString(),[`${s}To`]:o[o.length-1].lastDay.toString()};let u=ur(c,e).evaluate(t,i);return a&&(u=u.then(h=>({content:a.map(k=>h.content.find(S=>S.mutation.code===k)??or(k)).filter(k=>k!==null)}))),u}async function xs(r){const{lapisFilter:e,displayMutations:t,sequenceType:n,lapis:s,lapisDateField:a,granularity:i,useNewEndpoint:o,signal:c}=r,u=await cr(e,s,i,a,c);if(u.length>ir)throw new nr("Too many dates",`The dataset would contain ${u.length} date intervals. Please reduce the number to below ${ir} to display the data. You can achieve this by either narrowing the date range in the provided LAPIS filter or by selecting a larger granularity.`);const h=ks({lapisFilter:e,sequenceType:n,lapis:s,lapisDateField:a,includeMutations:t,granularity:i}).then(k=>k.content);return o===!0?ws(u,h,r):bs(u,h,r)}async function bs(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=r.map(async h=>{const k=h.firstDay.toString(),v=h.lastDay.toString(),S={...t,[`${a}From`]:k,[`${a}To`]:v},[R,E]=await Promise.all([ur(S,n).evaluate(s,i),dr(S).evaluate(s,i)]);return{date:h,mutations:R.content,totalCount:E.content[0].count}}),c=await Promise.all(o),u=await e;return{mutationOverTimeData:Os(c,u),overallMutationData:u}}async function ws(r,e,{lapisFilter:t,sequenceType:n,lapis:s,lapisDateField:a,signal:i}){const o=await e;o.sort((v,S)=>ar(v.mutation,S.mutation));const c=await Promise.all(r.map(async v=>{const S={...t,[`${a}From`]:v.firstDay.toString(),[`${a}To`]:v.lastDay.toString()};return(await dr(S).evaluate(s,i)).content[0].count})),u=o.map(v=>v.mutation.code),h=await Mn(s,{filters:t,dateRanges:r.map(v=>({dateFrom:v.firstDay.toString(),dateTo:v.lastDay.toString()})),includeMutations:u,dateField:a},n,i),k={keysFirstAxis:new Map(o.map(v=>[v.mutation.code,v.mutation])),keysSecondAxis:new Map(r.map(v=>[v.dateString,v])),data:new Map(o.map((v,S)=>[v.mutation.code,new Map(r.map((R,E)=>[R.dateString,{type:"value",proportion:h.data.data[S][E].count/h.data.data[S][E].coverage,count:h.data.data[S][E].count,totalCount:c[E]}]))]))};return{mutationOverTimeData:new sr(k),overallMutationData:o}}async function cr(r,e,t,n,s){const{dateFrom:a,dateTo:i}=Ss(r,n,t);if(a!==null&&i!==null)return Ut(a,i);const{content:o}=await Ts(r,e,t,n,s),{min:c,max:u}=os(o);return Ut(a??c,i??u)}function Ss(r,e,t){const n=r[e];if(n)return{dateFrom:je(n,t),dateTo:je(n,t)};const s=r[`${e}From`],a=r[`${e}To`];return{dateFrom:s?je(s,t):null,dateTo:a?je(a,t):null}}function Ts(r,e,t,n,s){return As(r,t,n).evaluate(e,s)}function As(r,e,t){const n=new Ct(r,[t]),s=new Zn(n,t,"date"),a=new ct(s,c=>us(c,e)),i=new In(a,"dateRange","count"),o=new jn(i,cs);return new ct(o,c=>c.dateRange)}function ur(r,e){return new hs(r,e,_s)}function $s(r){return r.code}function Ms(r){return r.dateString}function Os(r,e){const t=new sr,n=r.map(i=>i.date),s=e.sort((i,o)=>ar(i.mutation,o.mutation)).map(i=>Bt(i.mutation)),a=n.sort((i,o)=>Ge(i,o)).map(i=>Lt(i));return s.forEach(i=>{a.forEach(o=>{t.set(i,o,null)})}),r.forEach(i=>{if(i.totalCount==0)return;const o=Lt(i.date);i.mutations.forEach(c=>{const u=Bt(c.mutation);t.get(u,o)!==void 0&&t.set(u,o,{type:"value",count:c.count,proportion:c.proportion,totalCount:i.totalCount})});for(const c of t.getFirstAxisKeys())t.get(c,o)===null&&t.set(c,o,{type:"belowThreshold",totalCount:i.totalCount})}),t}function dr(r){return new Ct(r)}async function Ds(r){try{postMessage({status:"loading"});const e=await r();postMessage({status:"success",data:e})}catch(e){postMessage(e instanceof nr?{status:"error",userFacing:!0,headline:e.headline,error:e}:{status:"error",userFacing:!1,error:e instanceof Error?e:new Error(`${e}`)})}}async function Ns(r){const e=await xs(r.data);return{overallMutationData:e.overallMutationData,mutationOverTimeSerialized:e.mutationOverTimeData.getContents()}}self.onmessage=async function(r){await Ds(()=>Ns(r))}})();\n//# sourceMappingURL=mutationOverTimeWorker-CDACUs6w.js.map\n', jb = typeof self < "u" && self.Blob && new Blob([ek], { type: "text/javascript;charset=utf-8" });
25855
25855
  function n$(n) {
25856
25856
  let e;
25857
25857
  try {
@@ -25983,24 +25983,23 @@ class ik extends nk {
25983
25983
  super(i$, r$, e);
25984
25984
  }
25985
25985
  }
25986
- const s$ = T.array(T.string()).min(1);
25986
+ const s$ = T.array(T.string());
25987
25987
  function a$({
25988
25988
  data: n,
25989
25989
  overallMutationData: e,
25990
25990
  displayedSegments: t,
25991
25991
  displayedMutationTypes: i,
25992
25992
  proportionInterval: r,
25993
- displayMutations: o,
25994
- mutationFilterValue: s,
25995
- sequenceType: l,
25996
- annotationProvider: c
25993
+ mutationFilterValue: o,
25994
+ sequenceType: s,
25995
+ annotationProvider: l
25997
25996
  }) {
25998
- const u = new Sh(n), h = o === void 0 ? null : new Set(o.map((m) => m.toUpperCase()));
25999
- return e.filter((m) => m.proportion < r.min || m.proportion > r.max || t.some((g) => g.segment === m.mutation.segment && !g.checked) || h !== null && !h.has(m.mutation.code.toUpperCase()) || rk(m.mutation, l, s, c) ? !0 : i.some(
26000
- (g) => g.type === m.mutation.type && !g.checked
26001
- )).forEach((m) => {
26002
- u.deleteRow(m.mutation);
26003
- }), u;
25997
+ const c = new Sh(n);
25998
+ return e.filter((h) => h.proportion < r.min || h.proportion > r.max || t.some((f) => f.segment === h.mutation.segment && !f.checked) || rk(h.mutation, s, o, l) ? !0 : i.some(
25999
+ (f) => f.type === h.mutation.type && !f.checked
26000
+ )).forEach((h) => {
26001
+ c.deleteRow(h.mutation);
26002
+ }), c;
26004
26003
  }
26005
26004
  function rk(n, e, t, i) {
26006
26005
  return !(l$(n, e, t.textFilter, i) && c$(n, e, t.annotationNameFilter, i));
@@ -28212,30 +28211,31 @@ const w3 = T.literal(vt.grid), k3 = T.object({
28212
28211
  useNewEndpoint: n = !1,
28213
28212
  ...e
28214
28213
  }) => {
28215
- const t = It(), { lapisFilter: i, sequenceType: r, granularity: o, lapisDateField: s } = e, l = Ue(() => ({
28214
+ const t = It(), { lapisFilter: i, sequenceType: r, granularity: o, lapisDateField: s, displayMutations: l } = e, c = Ue(() => ({
28216
28215
  lapisFilter: i,
28217
28216
  sequenceType: r,
28218
28217
  granularity: o,
28219
28218
  lapisDateField: s,
28220
28219
  lapis: t,
28220
+ displayMutations: l,
28221
28221
  useNewEndpoint: n
28222
- }), [o, t, s, i, r, n]), { data: c, error: u, isLoading: h } = x3(
28223
- l,
28222
+ }), [o, t, s, i, r, l, n]), { data: u, error: h, isLoading: f } = x3(
28223
+ c,
28224
28224
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
28225
28225
  n$
28226
28226
  );
28227
- if (h)
28227
+ if (f)
28228
28228
  return /* @__PURE__ */ v(Jn, {});
28229
- if (u !== void 0)
28230
- throw u;
28231
- if (c === void 0 || c.overallMutationData.length === 0)
28229
+ if (h !== void 0)
28230
+ throw h;
28231
+ if (u === void 0 || u.overallMutationData.length === 0)
28232
28232
  return /* @__PURE__ */ v(oo, {});
28233
- const { overallMutationData: f, mutationOverTimeSerialized: m } = c, g = new ik(m);
28233
+ const { overallMutationData: m, mutationOverTimeSerialized: g } = u, _ = new ik(g);
28234
28234
  return /* @__PURE__ */ v(
28235
28235
  C3,
28236
28236
  {
28237
- overallMutationData: f,
28238
- mutationOverTimeData: g,
28237
+ overallMutationData: m,
28238
+ mutationOverTimeData: _,
28239
28239
  originalComponentProps: e
28240
28240
  }
28241
28241
  );
@@ -28256,7 +28256,6 @@ const w3 = T.literal(vt.grid), k3 = T.object({
28256
28256
  displayedSegments: f,
28257
28257
  displayedMutationTypes: g,
28258
28258
  proportionInterval: l,
28259
- displayMutations: e.displayMutations,
28260
28259
  mutationFilterValue: r,
28261
28260
  sequenceType: e.sequenceType,
28262
28261
  annotationProvider: s
@@ -28266,7 +28265,6 @@ const w3 = T.literal(vt.grid), k3 = T.object({
28266
28265
  f,
28267
28266
  g,
28268
28267
  l,
28269
- e.displayMutations,
28270
28268
  e.sequenceType,
28271
28269
  r,
28272
28270
  s