@genspectrum/dashboard-components 0.13.1 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{mutationOverTimeWorker-B1-WrM4b.js.map → mutationOverTimeWorker-Dxnxrfe0.js.map} +1 -1
- package/dist/components.d.ts +25 -25
- package/dist/components.js +30 -11
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +25 -25
- package/package.json +1 -1
- package/src/preact/components/downshift-combobox.tsx +18 -20
- package/src/preact/textInput/fetchStringAutocompleteList.spec.ts +34 -0
- package/src/preact/textInput/fetchStringAutocompleteList.ts +16 -2
- package/src/preact/textInput/text-input.tsx +22 -8
- package/src/utils/mutations.ts +1 -1
- package/standalone-bundle/assets/{mutationOverTimeWorker-Cls1J0cl.js.map → mutationOverTimeWorker-CmSrq4SZ.js.map} +1 -1
- package/standalone-bundle/dashboard-components.js +31 -18
- package/standalone-bundle/dashboard-components.js.map +1 -1
|
@@ -19057,7 +19057,7 @@ function VP(n, t) {
|
|
|
19057
19057
|
const e = t.datasets[0].data[n].values;
|
|
19058
19058
|
return `${t.datasets[0].data[n].label}: ${e.join(", ")}` || "";
|
|
19059
19059
|
}
|
|
19060
|
-
const YP = /^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\d+)(?<substitutionValue>[A-Z
|
|
19060
|
+
const YP = /^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\d+)(?<substitutionValue>[A-Z.*])?$/i;
|
|
19061
19061
|
class jo {
|
|
19062
19062
|
constructor(t, e, i, r) {
|
|
19063
19063
|
this.segment = t, this.valueAtReference = e, this.substitutionValue = i, this.position = r, this.type = "substitution";
|
|
@@ -24260,7 +24260,7 @@ wr([
|
|
|
24260
24260
|
Li = wr([
|
|
24261
24261
|
en("gs-number-sequences-over-time")
|
|
24262
24262
|
], Li);
|
|
24263
|
-
const Rx = '(function(){"use strict";var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`\'${i}\'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var nt;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(nt||(nt={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.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"]),or=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)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=r=>new N(r);const oe=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===f.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==="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 _t=oe;function cr(r){_t=r}function We(){return _t}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}},ur=[];function h(r,e){const t=We(),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 g;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 g;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 g=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),D=r=>({status:"valid",value:r}),st=r=>r.status==="aborted",at=r=>r.status==="dirty",K=r=>r.status==="valid",xe=r=>typeof Promise<"u"&&r instanceof Promise;function Pe(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function xt(r,e,t,n,s){if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;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={}));var ke,be;class Y{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kt=(r,e)=>{if(K(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)=>{var c,u;const{message:l}=r;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(c=l??n)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=l??t)!==null&&u!==void 0?u:o.defaultError}},description:s}}class _{get description(){return this._def.description}_getType(e){return V(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:V(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:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(xe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},a=this._parseSync({data:e,path:s.path,parent:s});return kt(s,a)}"~validate"(e){var t,n;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return K(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>K(a)?{value:a.value}:{issues:s.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:V(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(xe(s)?s:Promise.resolve(s));return kt(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 R({schema:this,typeName:y.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 F.create(this,this._def)}nullable(){return J.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return he.create(this,this._def)}or(e){return Ae.create([this,e],this._def)}and(e){return $e.create(this,e,this._def)}transform(e){return new R({...v(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ee({...v(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new ct({typeName:y.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ce({...v(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Ze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dr=/^c[^\\s-]{8,}$/i,lr=/^[0-9a-z]+$/,hr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fr=/^[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,mr=/^[a-z0-9_-]{21}$/i,pr=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,yr=/^[-+]?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)?)??$/,gr=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,vr="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";let it;const _r=/^(?:(?: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])$/,xr=/^(?:(?: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])$/,kr=/^(([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]))$/,br=/^(([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])$/,wr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bt="((\\\\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])))",Tr=new RegExp(`^${bt}$`);function wt(r){let e="([01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d";return r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`),e}function Ar(r){return new RegExp(`^${wt(r)}$`)}function St(r){let e=`${bt}T${wt(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 $r(r,e){return!!((e==="v4"||!e)&&_r.test(r)||(e==="v6"||!e)&&kr.test(r))}function Mr(r,e){if(!pr.test(r))return!1;try{const[t]=r.split("."),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||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function Dr(r,e){return!!((e==="v4"||!e)&&xr.test(r)||(e==="v6"||!e)&&br.test(r))}class E extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:f.string,received:a.parsedType}),g}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),h(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),h(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?h(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&h(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")gr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")it||(it=new RegExp(vr,"u")),it.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")fr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")mr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")dr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")lr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")hr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(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),h(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),h(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),h(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),h(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),h(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?St(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Tr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Ar(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?yr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?$r(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Mr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Dr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?wr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Sr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(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 E({...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){var t,n;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:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!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 E({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(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}}E.create=r=>{var e;return new E({checks:[],typeName:y.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function Or(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class H extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:f.number,received:a.parsedType}),g}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),h(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),h(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),h(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Or(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),h(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),h(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 H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new H({...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)}}H.create=r=>new H({checks:[],typeName:y.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class q extends _{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)!==f.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),h(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),h(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),h(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 h(t,{code:d.invalid_type,expected:f.bigint,received:t.parsedType}),g}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]})}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}}q.create=r=>{var e;return new q({checks:[],typeName:y.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};class we extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.boolean,received:n.parsedType}),g}return D(e.data)}}we.create=r=>new we({typeName:y.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class Q extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:f.date,received:a.parsedType}),g}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_date}),g}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),h(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),h(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 Q({...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}}Q.create=r=>new Q({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:y.ZodDate,...v(r)});class Ve extends _{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.symbol,received:n.parsedType}),g}return D(e.data)}}Ve.create=r=>new Ve({typeName:y.ZodSymbol,...v(r)});class Se extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.undefined,received:n.parsedType}),g}return D(e.data)}}Se.create=r=>new Se({typeName:y.ZodUndefined,...v(r)});class Te extends _{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.null,received:n.parsedType}),g}return D(e.data)}}Te.create=r=>new Te({typeName:y.ZodNull,...v(r)});class ue extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return D(e.data)}}ue.create=r=>new ue({typeName:y.ZodAny,...v(r)});class X extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return D(e.data)}}X.create=r=>new X({typeName:y.ZodUnknown,...v(r)});class z extends _{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),g}}z.create=r=>new z({typeName:y.ZodNever,...v(r)});class ze extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.void,received:n.parsedType}),g}return D(e.data)}}ze.create=r=>new ze({typeName:y.ZodVoid,...v(r)});class C extends _{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return h(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),g;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(h(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&&(h(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&&(h(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 Y(t,i,t.path,o)))).then(i=>M.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Y(t,i,t.path,o)));return M.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(r,e)=>new C({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...v(e)});function de(r){if(r instanceof T){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=F.create(de(n))}return new T({...r._def,shape:()=>e})}else return r instanceof C?new C({...r._def,type:de(r.element)}):r instanceof F?F.create(de(r.unwrap())):r instanceof J?J.create(de(r.unwrap())):r instanceof W?W.create(r.items.map(e=>de(e))):r}class T extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const u=this._getOrReturnCtx(e);return h(u,{code:d.invalid_type,expected:f.object,received:u.parsedType}),g}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof z&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const l=a[u],k=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Y(s,k,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof z){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")o.length>0&&(h(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 l of o){const k=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Y(s,k,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const k=await l.key,S=await l.value;u.push({key:k,value:S,alwaysSet:l.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 T({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}extend(e){return new T({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new T({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new T({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new T({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new T({...this._def,shape:()=>t})}deepPartial(){return de(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new T({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof F;)a=a._def.innerType;t[n]=a}}),new T({...this._def,shape:()=>t})}keyof(){return Tt(x.objectKeys(this.shape))}}T.create=(r,e)=>new T({shape:()=>r,unknownKeys:"strip",catchall:z.create(),typeName:y.ZodObject,...v(e)}),T.strictCreate=(r,e)=>new T({shape:()=>r,unknownKeys:"strict",catchall:z.create(),typeName:y.ZodObject,...v(e)}),T.lazycreate=(r,e)=>new T({shape:r,unknownKeys:"strip",catchall:z.create(),typeName:y.ZodObject,...v(e)});class Ae extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new N(o.ctx.common.issues));return h(t,{code:d.invalid_union,unionErrors:i}),g}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},l=c._parseSync({data:t.data,path:t.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,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 h(t,{code:d.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}Ae.create=(r,e)=>new Ae({options:r,typeName:y.ZodUnion,...v(e)});const L=r=>r instanceof De?L(r.schema):r instanceof R?L(r.innerType()):r instanceof Oe?[r.value]:r instanceof G?r.options:r instanceof Ne?x.objectValues(r.enum):r instanceof Ee?L(r._def.innerType):r instanceof Se?[void 0]:r instanceof Te?[null]:r instanceof F?[void 0,...L(r.unwrap())]:r instanceof J?[null,...L(r.unwrap())]:r instanceof ct||r instanceof Ze?L(r.unwrap()):r instanceof Ce?L(r._def.innerType):[];class Le extends _{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return h(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),g;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}):(h(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}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=L(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:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(n)})}}function ot(r,e){const t=V(r),n=V(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.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=ot(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.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=ot(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class $e extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(st(a)||st(i))return g;const o=ot(a.value,i.value);return o.valid?((at(a)||at(i))&&t.dirty(),{status:t.value,value:o.data}):(h(n,{code:d.invalid_intersection_types}),g)};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}))}}$e.create=(r,e,t)=>new $e({left:r,right:e,typeName:y.ZodIntersection,...v(t)});class W extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return h(n,{code:d.invalid_type,expected:f.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return h(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(h(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 Y(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:y.ZodTuple,rest:null,...v(e)})};class Me extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return h(n,{code:d.invalid_type,expected:f.object,received:n.parsedType}),g;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Y(n,o,n.path,o)),value:i._parse(new Y(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 _?new Me({keyType:e,valueType:t,typeName:y.ZodRecord,...v(n)}):new Me({keyType:E.create(),valueType:e,typeName:y.ZodRecord,...v(t)})}}class Ue extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return h(n,{code:d.invalid_type,expected:f.map,received:n.parsedType}),g;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new Y(n,o,n.path,[u,"key"])),value:a._parse(new Y(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,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return g;(u.status==="dirty"||l.status==="dirty")&&t.dirty(),o.set(u.value,l.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return g;(u.status==="dirty"||l.status==="dirty")&&t.dirty(),o.set(u.value,l.value)}return{status:t.value,value:o}}}}Ue.create=(r,e,t)=>new Ue({valueType:e,keyType:r,typeName:y.ZodMap,...v(t)});class ee extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return h(n,{code:d.invalid_type,expected:f.set,received:n.parsedType}),g;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(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&&(h(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 l of c){if(l.status==="aborted")return g;l.status==="dirty"&&t.dirty(),u.add(l.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new Y(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new ee({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new ee({...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)}}ee.create=(r,e)=>new ee({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,...v(e)});class le extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return h(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),g;function n(o,c){return Fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,We(),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,We(),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 D(async function(...c){const u=new N([]),l=await o._def.args.parseAsync(c,a).catch($=>{throw u.addIssue(n(c,$)),u}),k=await Reflect.apply(i,this,l);return await o._def.returns._def.type.parseAsync(k,a).catch($=>{throw u.addIssue(s(k,$)),u})})}else{const o=this;return D(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new N([n(c,u.error)]);const l=Reflect.apply(i,this,u.data),k=o._def.returns.safeParse(l,a);if(!k.success)throw new N([s(l,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(X.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(X.create()),returns:t||X.create(),typeName:y.ZodFunction,...v(n)})}}class De extends _{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}De.create=(r,e)=>new De({getter:r,typeName:y.ZodLazy,...v(e)});class Oe extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}Oe.create=(r,e)=>new Oe({value:r,typeName:y.ZodLiteral,...v(e)});function Tt(r,e){return new G({values:r,typeName:y.ZodEnum,...v(e)})}class G extends _{constructor(){super(...arguments),ke.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:d.invalid_type}),g}if(Pe(this,ke)||xt(this,ke,new Set(this._def.values)),!Pe(this,ke).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:d.invalid_enum_value,options:n}),g}return D(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 G.create(e,{...this._def,...t})}exclude(e,t=this._def){return G.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}ke=new WeakMap,G.create=Tt;class Ne extends _{constructor(){super(...arguments),be.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:d.invalid_type}),g}if(Pe(this,be)||xt(this,be,new Set(x.getValidEnumValues(this._def.values))),!Pe(this,be).has(e.data)){const s=x.objectValues(t);return h(n,{received:n.data,code:d.invalid_enum_value,options:s}),g}return D(e.data)}get enum(){return this._def.values}}be=new WeakMap,Ne.create=(r,e)=>new Ne({values:r,typeName:y.ZodNativeEnum,...v(e)});class he extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return h(t,{code:d.invalid_type,expected:f.promise,received:t.parsedType}),g;const n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return D(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}he.create=(r,e)=>new he({type:r,typeName:y.ZodPromise,...v(e)});class R extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.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=>{h(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 g;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?g:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return g;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?g: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"?g:(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"?g:(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(!K(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>K(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(s)}}R.create=(r,e,t)=>new R({schema:r,typeName:y.ZodEffects,effect:e,...v(t)}),R.createWithPreprocess=(r,e,t)=>new R({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...v(t)});class F extends _{_parse(e){return this._getType(e)===f.undefined?D(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(r,e)=>new F({innerType:r,typeName:y.ZodOptional,...v(e)});class J extends _{_parse(e){return this._getType(e)===f.null?D(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}J.create=(r,e)=>new J({innerType:r,typeName:y.ZodNullable,...v(e)});class Ee extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class Ce extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xe(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}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Be extends _{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}}Be.create=r=>new Be({typeName:y.ZodNaN,...v(r)});const Nr=Symbol("zod_brand");class ct extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Re extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?g: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"?g: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:y.ZodPipeline})}}class Ze extends _{_parse(e){const t=this._def.innerType._parse(e),n=s=>(K(s)&&(s.value=Object.freeze(s.value)),s);return xe(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ze.create=(r,e)=>new Ze({innerType:r,typeName:y.ZodReadonly,...v(e)});function At(r,e={},t){return r?ue.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:c})}}):ue.create()}const Er={object:T.lazycreate};var y;(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"})(y||(y={}));const Cr=(r,e={message:`Input not instance of ${r.name}`})=>At(t=>t instanceof r,e),$t=E.create,Mt=H.create,Rr=Be.create,Zr=q.create,Dt=we.create,Ir=Q.create,jr=Ve.create,Yr=Se.create,Wr=Te.create,Fr=ue.create,Pr=X.create,Vr=z.create,zr=ze.create,Lr=C.create,Ur=T.create,Br=T.strictCreate,Hr=Ae.create,qr=Le.create,Gr=$e.create,Jr=W.create,Kr=Me.create,Qr=Ue.create,Xr=ee.create,en=le.create,tn=De.create,rn=Oe.create,nn=G.create,sn=Ne.create,an=he.create,Ot=R.create,on=F.create,cn=J.create,un=R.createWithPreprocess,dn=Re.create;var m=Object.freeze({__proto__:null,defaultErrorMap:oe,setErrorMap:cr,getErrorMap:We,makeIssue:Fe,EMPTY_PATH:ur,addIssueToContext:h,ParseStatus:M,INVALID:g,DIRTY:ce,OK:D,isAborted:st,isDirty:at,isValid:K,isAsync:xe,get util(){return x},get objectUtil(){return nt},ZodParsedType:f,getParsedType:V,ZodType:_,datetimeRegex:St,ZodString:E,ZodNumber:H,ZodBigInt:q,ZodBoolean:we,ZodDate:Q,ZodSymbol:Ve,ZodUndefined:Se,ZodNull:Te,ZodAny:ue,ZodUnknown:X,ZodNever:z,ZodVoid:ze,ZodArray:C,ZodObject:T,ZodUnion:Ae,ZodDiscriminatedUnion:Le,ZodIntersection:$e,ZodTuple:W,ZodRecord:Me,ZodMap:Ue,ZodSet:ee,ZodFunction:le,ZodLazy:De,ZodLiteral:Oe,ZodEnum:G,ZodNativeEnum:Ne,ZodPromise:he,ZodEffects:R,ZodTransformer:R,ZodOptional:F,ZodNullable:J,ZodDefault:Ee,ZodCatch:Ce,ZodNaN:Be,BRAND:Nr,ZodBranded:ct,ZodPipeline:Re,ZodReadonly:Ze,custom:At,Schema:_,ZodSchema:_,late:Er,get ZodFirstPartyTypeKind(){return y},coerce:{string:r=>E.create({...r,coerce:!0}),number:r=>H.create({...r,coerce:!0}),boolean:r=>we.create({...r,coerce:!0}),bigint:r=>q.create({...r,coerce:!0}),date:r=>Q.create({...r,coerce:!0})},any:Fr,array:Lr,bigint:Zr,boolean:Dt,date:Ir,discriminatedUnion:qr,effect:Ot,enum:nn,function:en,instanceof:Cr,intersection:Gr,lazy:tn,literal:rn,map:Qr,nan:Rr,nativeEnum:sn,never:Vr,null:Wr,nullable:cn,number:Mt,object:Ur,oboolean:()=>Dt().optional(),onumber:()=>Mt().optional(),optional:on,ostring:()=>$t().optional(),pipeline:dn,preprocess:un,promise:an,record:Kr,set:Xr,strictObject:Br,string:$t,symbol:jr,transformer:Ot,tuple:Jr,undefined:Yr,union:Hr,unknown:Pr,void:zr,NEVER:g,ZodIssueCode:d,quotelessJson:or,ZodError:N});m.object({nucleotideSequences:m.array(m.object({name:m.string(),sequence:m.string()})),genes:m.array(m.object({name:m.string(),sequence:m.string()}))});const ln=m.enum(["ascending","descending"]),hn=m.object({field:m.string(),type:ln});m.object({limit:m.number().optional(),offset:m.number().optional(),fields:m.array(m.string()).optional(),orderBy:m.array(hn).optional()}).catchall(m.union([m.boolean(),m.undefined(),m.string(),m.number(),m.null(),m.array(m.string())])).extend({minProportion:m.number().optional()});const fn=m.object({mutation:m.string(),proportion:m.number(),count:m.number(),sequenceName:m.union([m.string(),m.null()]),mutationFrom:m.string(),mutationTo:m.string(),position:m.number()}),mn=He(m.array(fn)),pn=m.object({insertion:m.string(),count:m.number(),insertedSymbols:m.string(),position:m.number(),sequenceName:m.union([m.string(),m.null()])});He(m.array(pn));const Nt=m.union([m.string(),m.number(),m.boolean(),m.null()]),yn=m.object({count:m.number()}).catchall(Nt),gn=He(m.array(yn)),vn=m.object({}).catchall(Nt);He(m.array(vn));function He(r){return m.object({data:r})}const Et=m.object({title:m.string().optional(),status:m.number(),detail:m.string().optional(),type:m.string(),instance:m.string().optional()}),_n=m.object({error:Et});class ut extends Error{constructor(e,t,n){super(e),this.status=t,this.requestedData=n,this.name="UnknownLapisError"}}class Ct extends Error{constructor(e,t,n,s){super(e),this.status=t,this.problemDetail=n,this.requestedData=s,this.name="LapisError"}}async function xn(r,e,t){const n=await Rt(wn(r),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t},"aggregated data");return gn.parse(await n.json())}async function kn(r,e,t,n){const s=await Rt(Sn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations`);return mn.parse(await s.json())}async function Rt(r,e,t){try{const n=await fetch(r,e);return await bn(n,t),n}catch(n){const s=n instanceof Error?n.message:`${n}`;throw new ut(`Failed to connect to LAPIS: ${s}`,500,t)}}const bn=async(r,e)=>{if(!r.ok){if(r.status>=400&&r.status<500){const t=await r.json(),n=_n.safeParse(t);if(n.success)throw new Ct(r.statusText+n.data.error.detail,r.status,n.data.error,e);const s=Et.safeParse(t);throw s.success?new Ct(r.statusText+s.data.detail,r.status,s.data,e):new ut(`${r.statusText}: ${JSON.stringify(t)}`,r.status,e)}throw new ut(`${r.statusText}: ${r.status}`,r.status,e)}},wn=r=>`${r}/sample/aggregated`,Sn=(r,e)=>e==="amino acid"?`${r}/sample/aminoAcidMutations`:`${r}/sample/nucleotideMutations`;class Zt{constructor(e,t=[]){this.filter=e,this.fields=t}async evaluate(e,t){const n=(await xn(e,{...this.filter,fields:this.fields},t)).data;if(Tn(n))return{content:n};throw new Error("Aggregated response does not have count")}}function Tn(r){return r.every(e=>typeof e=="object"&&"count"in e&&typeof e.count=="number")}class An{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 $n extends An{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 dt{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 Mn extends dt{constructor(e,t,n){super(e,s=>({...s,[n]:s[t]}))}}class Dn{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,jt=It*60,Yt=jt*24,On=Yt*7,fe=1e3,lt=It*fe,Wt=jt*fe,Nn=Yt*fe,En=On*fe,ht="millisecond",me="second",pe="minute",ye="hour",Z="day",Ie="week",I="month",Ft="quarter",U="year",ge="date",Pt="YYYY-MM-DDTHH:mm:ssZ",Vt="Invalid Date",Cn=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,Rn=/\\[([^\\]]+)]|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])+"]"}},ft=function(e,t,n){var s=String(e);return!s||s.length>=t?e:""+Array(t+1-s.length).join(n)+e},In=function(e){var t=-e.utcOffset(),n=Math.abs(t),s=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+ft(s,2,"0")+":"+ft(a,2,"0")},jn=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,I),a=t-s<0,i=e.clone().add(n+(a?-1:1),I);return+(-(n+(t-s)/(a?s-i:i-s))||0)},Yn=function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},Wn=function(e){var t={M:I,y:U,w:Ie,d:Z,D:ge,h:ye,m:pe,s:me,ms:ht,Q:Ft};return t[e]||String(e||"").toLowerCase().replace(/s$/,"")},Fn=function(e){return e===void 0},Pn={s:ft,z:In,m:jn,a:Yn,p:Wn,u:Fn},je="en",te={};te[je]=Zn;var zt="$isDayjsObject",mt=function(e){return e instanceof Ge||!!(e&&e[zt])},qe=function r(e,t,n){var s;if(!e)return je;if(typeof e=="string"){var a=e.toLowerCase();te[a]&&(s=a),t&&(te[a]=t,s=a);var i=e.split("-");if(!s&&i.length>1)return r(i[0])}else{var o=e.name;te[o]=e,s=o}return!n&&s&&(je=s),s||!n&&je},w=function(e,t){if(mt(e))return e.clone();var n=typeof t=="object"?t:{};return n.date=e,n.args=arguments,new Ge(n)},Vn=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},b=Pn;b.l=qe,b.i=mt,b.w=Vn;var zn=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(b.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(Cn);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)},Ge=function(){function r(t){this.$L=qe(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[zt]=!0}var e=r.prototype;return e.parse=function(n){this.$d=zn(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 b},e.isValid=function(){return this.$d.toString()!==Vt},e.isSame=function(n,s){var a=w(n);return this.startOf(s)<=a&&a<=this.endOf(s)},e.isAfter=function(n,s){return w(n)<this.startOf(s)},e.isBefore=function(n,s){return this.endOf(s)<w(n)},e.$g=function(n,s,a){return b.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=b.u(s)?!0:s,o=b.p(n),c=function(ve,j){var O=b.w(a.$u?Date.UTC(a.$y,j,ve):new Date(a.$y,j,ve),a);return i?O:O.endOf(Z)},u=function(ve,j){var O=[0,0,0,0],_e=[23,59,59,999];return b.w(a.toDate()[ve].apply(a.toDate("s"),(i?O:_e).slice(j)),a)},l=this.$W,k=this.$M,S=this.$D,$="set"+(this.$u?"UTC":"");switch(o){case U:return i?c(1,0):c(31,11);case I:return i?c(1,k):c(0,k+1);case Ie:{var B=this.$locale().weekStart||0,ie=(l<B?l+7:l)-B;return c(i?S-ie:S+(6-ie),k)}case Z:case ge:return u($+"Hours",0);case ye:return u($+"Minutes",1);case pe:return u($+"Seconds",2);case me:return u($+"Milliseconds",3);default:return this.clone()}},e.endOf=function(n){return this.startOf(n,!1)},e.$set=function(n,s){var a,i=b.p(n),o="set"+(this.$u?"UTC":""),c=(a={},a[Z]=o+"Date",a[ge]=o+"Date",a[I]=o+"Month",a[U]=o+"FullYear",a[ye]=o+"Hours",a[pe]=o+"Minutes",a[me]=o+"Seconds",a[ht]=o+"Milliseconds",a)[i],u=i===Z?this.$D+(s-this.$W):s;if(i===I||i===U){var l=this.clone().set(ge,1);l.$d[c](u),l.init(),this.$d=l.set(ge,Math.min(this.$D,l.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[b.p(n)]()},e.add=function(n,s){var a=this,i;n=Number(n);var o=b.p(s),c=function(S){var $=w(a);return b.w($.date($.date()+Math.round(S*n)),a)};if(o===I)return this.set(I,this.$M+n);if(o===U)return this.set(U,this.$y+n);if(o===Z)return c(1);if(o===Ie)return c(7);var u=(i={},i[pe]=lt,i[ye]=Wt,i[me]=fe,i)[o]||1,l=this.$d.getTime()+n*u;return b.w(l,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||Vt;var i=n||Pt,o=b.z(this),c=this.$H,u=this.$m,l=this.$M,k=a.weekdays,S=a.months,$=a.meridiem,B=function(O,_e,rt,Ts){return O&&(O[_e]||O(s,i))||rt[_e].slice(0,Ts)},ie=function(O){return b.s(c%12||12,O,"0")},tt=$||function(j,O,_e){var rt=j<12?"AM":"PM";return _e?rt.toLowerCase():rt},ve=function(O){switch(O){case"YY":return String(s.$y).slice(-2);case"YYYY":return b.s(s.$y,4,"0");case"M":return l+1;case"MM":return b.s(l+1,2,"0");case"MMM":return B(a.monthsShort,l,S,3);case"MMMM":return B(S,l);case"D":return s.$D;case"DD":return b.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return B(a.weekdaysMin,s.$W,k,2);case"ddd":return B(a.weekdaysShort,s.$W,k,3);case"dddd":return k[s.$W];case"H":return String(c);case"HH":return b.s(c,2,"0");case"h":return ie(1);case"hh":return ie(2);case"a":return tt(c,u,!0);case"A":return tt(c,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(s.$s);case"ss":return b.s(s.$s,2,"0");case"SSS":return b.s(s.$ms,3,"0");case"Z":return o}return null};return i.replace(Rn,function(j,O){return O||ve(j)||o.replace(":","")})},e.utcOffset=function(){return-Math.round(this.$d.getTimezoneOffset()/15)*15},e.diff=function(n,s,a){var i=this,o=b.p(s),c=w(n),u=(c.utcOffset()-this.utcOffset())*lt,l=this-c,k=function(){return b.m(i,c)},S;switch(o){case U:S=k()/12;break;case I:S=k();break;case Ft:S=k()/3;break;case Ie:S=(l-u)/En;break;case Z:S=(l-u)/Nn;break;case ye:S=l/Wt;break;case pe:S=l/lt;break;case me:S=l/fe;break;default:S=l;break}return a?S:b.a(S)},e.daysInMonth=function(){return this.endOf(I).$D},e.$locale=function(){return te[this.$L]},e.locale=function(n,s){if(!n)return this.$L;var a=this.clone(),i=qe(n,s,!0);return i&&(a.$L=i),a},e.clone=function(){return b.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}(),Lt=Ge.prototype;w.prototype=Lt,[["$ms",ht],["$s",me],["$m",pe],["$H",ye],["$W",Z],["$M",I],["$y",U],["$D",ge]].forEach(function(r){Lt[r[1]]=function(e){return this.$g(e,r[0],r[1])}}),w.extend=function(r,e){return r.$i||(r(e,Ge,w),r.$i=!0),w},w.locale=qe,w.isDayjs=mt,w.unix=function(r){return w(r*1e3)},w.en=te[je],w.Ls=te,w.p={};var Ln=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(l){switch(l){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(),l==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),l==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),l==="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 l}});return n.bind(this)(u)}},Un="isoweek",Bn=function(r,e,t){var n=function(c,u){var l=(u?t.utc:t)().year(c).startOf(U),k=4-l.isoWeekday();return l.isoWeekday()>4&&(k+=7),l.add(k,Z)},s=function(c){return c.add(4-c.isoWeekday(),Z)},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,Z);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(),l=u.u(c)?!0:c,k=u.p(o);return k===Un?l?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)}};w.extend(Bn),w.extend(Ln);const pt="GGGG-[W]WW",et=class et{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,re.parse(e,this)),this.yearMonthDayCache.get(e)}getYearMonth(e){return this.yearMonthCache.has(e)||this.yearMonthCache.set(e,se.parse(e,this)),this.yearMonthCache.get(e)}getYearWeek(e){return this.yearWeekCache.has(e)||this.yearWeekCache.set(e,ne.parse(e,this)),this.yearWeekCache.get(e)}getYear(e){return this.yearCache.has(e)||this.yearCache.set(e,ae.parse(e,this)),this.yearCache.get(e)}static getInstance(){return this.instance}};et.instance=new et;let yt=et;class re{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=w(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(pt))}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 re(n,s,a,t)}}class ne{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(pt)}toString(){return this.text}englishName(){return`Week ${this.isoWeekNumber}, ${this.isoYearNumber}`}get firstDay(){const e=w().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(pt);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 ne(n,s,t)}}class se{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`${Hn(this.monthNumber)} ${this.yearNumber}`}get firstDay(){return this.cache.getYearMonthDay(w(`${this.yearNumber}-${this.monthNumber}-01`).format("YYYY-MM-DD"))}get lastDay(){return this.cache.getYearMonthDay(w(`${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 se(n,s,t)}}class ae{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 ae(n,t)}}function Hn(r){return w().month(r-1).format("MMMM")}function Ut(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 qn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addDays(s));return t}function Gn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addWeeks(s));return t}function Jn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addMonths(s));return t}function Kn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addYears(s));return t}function Qn(r,e){if(r===null||e===null)return[];if(r instanceof re&&e instanceof re)return qn(r,e);if(r instanceof ne&&e instanceof ne)return Gn(r,e);if(r instanceof se&&e instanceof se)return Jn(r,e);if(r instanceof ae&&e instanceof ae)return Kn(r,e);throw new Error(`Invalid arguments: start and end must be of the same type: ${r}, ${e}`)}function Xn(r,e){if(r instanceof re&&e instanceof re||r instanceof ne&&e instanceof ne||r instanceof se&&e instanceof se||r instanceof ae&&e instanceof ae)return r.minus(e);throw new Error(`Cannot compare ${r} and ${e}`)}function Je(r,e){if(r===null)return 1;if(e===null)return-1;const t=Xn(r,e);return t<0?-1:t>0?1:0}function es(r){let e=null,t=null;for(const n of r)n!==null&&((e===null||Je(n,e)<0)&&(e=n),(t===null||Je(n,t)>0)&&(t=n));return e===null||t===null?{min:null,max:null}:{min:e,max:t}}function Ye(r,e){const n=yt.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 ts(r,e){return r.dateRange===null?1:e.dateRange===null?-1:Je(r.dateRange,e.dateRange)}function rs(r,e){return{dateRange:r.date===null?null:Ye(r.date,e),count:r.count}}const ns=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(?<substitutionValue>[A-Z.])?$/i;class Ke{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?`${this.valueAtReference}`:"",o=this.substitutionValue?`${this.substitutionValue}`:"";this.code=`${a}${i}${this.position}${o}`}equals(e){return e instanceof Ke?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=e.match(ns);return t===null||t.groups===void 0?null:new Ke(t.groups.segment,t.groups.valueAtReference,t.groups.substitutionValue,parseInt(t.groups.position,10))}}const ss=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(-)$/i;class Qe{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.valueAtReference}`:"";this.code=`${s}${a}${this.position}-`}equals(e){return e instanceof Qe?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=e.match(ss);return t===null||t.groups===void 0?null:new Qe(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 as{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:l})=>c==="-"?{type:"deletion",mutation:new Qe(l??void 0,o,u),count:a,proportion:i}:{type:"substitution",mutation:new Ke(l??void 0,o,c,u),count:a,proportion:i})}}async fetchMutations(e,t){const n={...this.filter,minProportion:this.minProportion};return kn(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 P,gt,qt,Gt=[],A=Ht,Jt=A.__b,Kt=A.__r,Qt=A.diffed,Xt=A.__c,er=A.unmount,tr=A.__;function is(){for(var r;r=Gt.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(Xe),r.__H.__h.forEach(vt),r.__H.__h=[]}catch(e){r.__H.__h=[],A.__e(e,r.__v)}}A.__b=function(r){P=null,Jt&&Jt(r)},A.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),tr&&tr(r,e)},A.__r=function(r){Kt&&Kt(r);var e=(P=r.__c).__H;e&&(gt===P?(e.__h=[],P.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0})):(e.__h.forEach(Xe),e.__h.forEach(vt),e.__h=[])),gt=P},A.diffed=function(r){Qt&&Qt(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(Gt.push(e)!==1&&qt===A.requestAnimationFrame||((qt=A.requestAnimationFrame)||os)(is)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.i=void 0})),gt=P=null},A.__c=function(r,e){e.some(function(t){try{t.__h.forEach(Xe),t.__h=t.__h.filter(function(n){return!n.__||vt(n)})}catch(n){e.some(function(s){s.__h&&(s.__h=[])}),e=[],A.__e(n,t.__v)}}),Xt&&Xt(r,e)},A.unmount=function(r){er&&er(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Xe(n)}catch(s){e=s}}),t.__H=void 0,e&&A.__e(e,t.__v))};var rr=typeof requestAnimationFrame=="function";function os(r){var e,t=function(){clearTimeout(n),rr&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,100);rr&&(e=requestAnimationFrame(t))}function Xe(r){var e=P,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),P=e}function vt(r){var e=P;r.__c=r.__(),P=e}class nr extends Error{constructor(e,t){super(t),this.headline=e,this.name="UserFacingError"}}class cs{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 us extends cs{constructor(e){super(_s,xs,e)}}const ds=(r,e)=>{if(r.segment!==e.segment)return ls(r.segment,e.segment);if(r.position!==e.position)return hs(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?fs(r.substitutionValue,e.substitutionValue):0},ls=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),hs=(r,e)=>r-e,fs=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),sr=200;async function ms({lapisFilter:r,sequenceType:e,lapis:t,granularity:n,lapisDateField:s,signal:a}){const i=await ar(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 ir(o,e).evaluate(t,a)}async function ps({lapisFilter:r,sequenceType:e,lapis:t,lapisDateField:n,granularity:s,signal:a}){const i=await ar(r,t,s,n,a);if(i.length>sr)throw new nr("Too many dates",`The dataset would contain ${i.length} date intervals. Please reduce the number to below ${sr} 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 o=i.map(async l=>{const k=l.firstDay.toString(),S=l.lastDay.toString(),$={...r,[`${n}From`]:k,[`${n}To`]:S},B=await ir($,e).evaluate(t,a),ie=await bs($).evaluate(t,a);return{date:l,mutations:B.content,totalCount:ie.content[0].count}}),c=await Promise.all(o),u=(await ms({lapisFilter:r,sequenceType:e,lapis:t,lapisDateField:n,granularity:s})).content;return{mutationOverTimeData:ks(c,u),overallMutationData:u}}async function ar(r,e,t,n,s){const{content:a}=await gs(r,e,t,n,s),{dateFrom:i,dateTo:o}=ys(r,n,t),{min:c,max:u}=es(a);return Qn(i??c,o??u)}function ys(r,e,t){const n=r[e];if(n)return{dateFrom:Ye(n,t),dateTo:Ye(n,t)};const s=r[`${e}From`],a=r[`${e}To`];return{dateFrom:s?Ye(s,t):null,dateTo:a?Ye(a,t):null}}function gs(r,e,t,n,s){return vs(r,t,n).evaluate(e,s)}function vs(r,e,t){const n=new Zt(r,[t]),s=new Mn(n,t,"date"),a=new dt(s,c=>rs(c,e)),i=new $n(a,"dateRange","count"),o=new Dn(i,ts);return new dt(o,c=>c.dateRange)}function ir(r,e){return new as(r,e,.001)}function _s(r){return r.code}function xs(r){return r.dateString}function ks(r,e){const t=new us,n=r.map(i=>i.date),s=e.sort((i,o)=>ds(i.mutation,o.mutation)).map(i=>Bt(i.mutation)),a=n.sort((i,o)=>Je(i,o)).map(i=>Ut(i));return s.forEach(i=>{a.forEach(o=>{t.set(i,o,null)})}),r.forEach(i=>{if(i.totalCount==0)return;const o=Ut(i.date);i.mutations.forEach(c=>{const u=Bt(c.mutation);t.get(u,o)!==void 0&&t.set(u,o,{count:c.count,proportion:c.proportion,totalCount:i.totalCount})});for(const c of t.getFirstAxisKeys())t.get(c,o)===null&&t.set(c,o,{count:0,proportion:0,totalCount:i.totalCount})}),t}function bs(r){return new Zt(r)}async function ws(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 Ss(r){const e=await ps(r.data);return{overallMutationData:e.overallMutationData,mutationOverTimeSerialized:e.mutationOverTimeData.getContents()}}self.onmessage=async function(r){await ws(()=>Ss(r))}})();\n//# sourceMappingURL=mutationOverTimeWorker-Cls1J0cl.js.map\n', jv = typeof self < "u" && self.Blob && new Blob([Rx], { type: "text/javascript;charset=utf-8" });
|
|
24263
|
+
const Rx = '(function(){"use strict";var x;(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},r.getValidEnumValues=s=>{const a=r.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return r.objectValues(i)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},r.find=(s,a)=>{for(const i of s)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`\'${i}\'`:i).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var nt;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(nt||(nt={}));const f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.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"]),or=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)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}N.create=r=>new N(r);const oe=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===f.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==="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 _t=oe;function cr(r){_t=r}function We(){return _t}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}},ur=[];function h(r,e){const t=We(),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 g;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 g;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 g=Object.freeze({status:"aborted"}),ce=r=>({status:"dirty",value:r}),D=r=>({status:"valid",value:r}),st=r=>r.status==="aborted",at=r=>r.status==="dirty",K=r=>r.status==="valid",xe=r=>typeof Promise<"u"&&r instanceof Promise;function Pe(r,e,t,n){if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(r)}function xt(r,e,t,n,s){if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(r,t),t}typeof SuppressedError=="function"&&SuppressedError;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={}));var ke,be;class Y{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kt=(r,e)=>{if(K(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)=>{var c,u;const{message:l}=r;return i.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:(c=l??n)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=l??t)!==null&&u!==void 0?u:o.defaultError}},description:s}}class _{get description(){return this._def.description}_getType(e){return V(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:V(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:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(xe(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const s={common:{issues:[],async:(n=t==null?void 0:t.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},a=this._parseSync({data:e,path:s.path,parent:s});return kt(s,a)}"~validate"(e){var t,n;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return K(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((n=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>K(a)?{value:a.value}:{issues:s.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:V(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(xe(s)?s:Promise.resolve(s));return kt(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 R({schema:this,typeName:y.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 F.create(this,this._def)}nullable(){return J.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return C.create(this)}promise(){return he.create(this,this._def)}or(e){return Ae.create([this,e],this._def)}and(e){return $e.create(this,e,this._def)}transform(e){return new R({...v(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ee({...v(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new ct({typeName:y.ZodBranded,type:this,...v(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ce({...v(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Ze.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const dr=/^c[^\\s-]{8,}$/i,lr=/^[0-9a-z]+$/,hr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fr=/^[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,mr=/^[a-z0-9_-]{21}$/i,pr=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,yr=/^[-+]?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)?)??$/,gr=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,vr="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$";let it;const _r=/^(?:(?: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])$/,xr=/^(?:(?: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])$/,kr=/^(([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]))$/,br=/^(([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])$/,wr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bt="((\\\\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])))",Tr=new RegExp(`^${bt}$`);function wt(r){let e="([01]\\\\d|2[0-3]):[0-5]\\\\d:[0-5]\\\\d";return r.precision?e=`${e}\\\\.\\\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\\\.\\\\d+)?`),e}function Ar(r){return new RegExp(`^${wt(r)}$`)}function St(r){let e=`${bt}T${wt(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 $r(r,e){return!!((e==="v4"||!e)&&_r.test(r)||(e==="v6"||!e)&&kr.test(r))}function Mr(r,e){if(!pr.test(r))return!1;try{const[t]=r.split("."),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||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function Dr(r,e){return!!((e==="v4"||!e)&&xr.test(r)||(e==="v6"||!e)&&br.test(r))}class E extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:f.string,received:a.parsedType}),g}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),h(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),h(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?h(s,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&h(s,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")gr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")it||(it=new RegExp(vr,"u")),it.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"emoji",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")fr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")mr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"nanoid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")dr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")lr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid2",code:d.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")hr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(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),h(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),h(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),h(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),h(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),h(s,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?St(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?Tr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?Ar(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:d.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?yr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"duration",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?$r(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ip",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?Mr(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"jwt",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?Dr(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cidr",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?wr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"base64",code:d.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?Sr.test(e.data)||(s=this._getOrReturnCtx(e,s),h(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 E({...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){var t,n;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:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(n=e==null?void 0:e.local)!==null&&n!==void 0?n:!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 E({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new E({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(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}}E.create=r=>{var e;return new E({checks:[],typeName:y.ZodString,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};function Or(r,e){const t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class H extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:f.number,received:a.parsedType}),g}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),h(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),h(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),h(n,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Or(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),h(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),h(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 H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:p.toString(s)}]})}_addCheck(e){return new H({...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)}}H.create=r=>new H({checks:[],typeName:y.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class q extends _{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)!==f.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),h(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),h(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),h(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 h(t,{code:d.invalid_type,expected:f.bigint,received:t.parsedType}),g}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]})}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}}q.create=r=>{var e;return new q({checks:[],typeName:y.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!==null&&e!==void 0?e:!1,...v(r)})};class we extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.boolean,received:n.parsedType}),g}return D(e.data)}}we.create=r=>new we({typeName:y.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1,...v(r)});class Q extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_type,expected:f.date,received:a.parsedType}),g}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:d.invalid_date}),g}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),h(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),h(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 Q({...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}}Q.create=r=>new Q({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:y.ZodDate,...v(r)});class Ve extends _{_parse(e){if(this._getType(e)!==f.symbol){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.symbol,received:n.parsedType}),g}return D(e.data)}}Ve.create=r=>new Ve({typeName:y.ZodSymbol,...v(r)});class Se extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.undefined,received:n.parsedType}),g}return D(e.data)}}Se.create=r=>new Se({typeName:y.ZodUndefined,...v(r)});class Te extends _{_parse(e){if(this._getType(e)!==f.null){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.null,received:n.parsedType}),g}return D(e.data)}}Te.create=r=>new Te({typeName:y.ZodNull,...v(r)});class ue extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return D(e.data)}}ue.create=r=>new ue({typeName:y.ZodAny,...v(r)});class X extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return D(e.data)}}X.create=r=>new X({typeName:y.ZodUnknown,...v(r)});class z extends _{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),g}}z.create=r=>new z({typeName:y.ZodNever,...v(r)});class ze extends _{_parse(e){if(this._getType(e)!==f.undefined){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.void,received:n.parsedType}),g}return D(e.data)}}ze.create=r=>new ze({typeName:y.ZodVoid,...v(r)});class C extends _{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==f.array)return h(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),g;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(h(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&&(h(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&&(h(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 Y(t,i,t.path,o)))).then(i=>M.mergeArray(n,i));const a=[...t.data].map((i,o)=>s.type._parseSync(new Y(t,i,t.path,o)));return M.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new C({...this._def,minLength:{value:e,message:p.toString(t)}})}max(e,t){return new C({...this._def,maxLength:{value:e,message:p.toString(t)}})}length(e,t){return new C({...this._def,exactLength:{value:e,message:p.toString(t)}})}nonempty(e){return this.min(1,e)}}C.create=(r,e)=>new C({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...v(e)});function de(r){if(r instanceof T){const e={};for(const t in r.shape){const n=r.shape[t];e[t]=F.create(de(n))}return new T({...r._def,shape:()=>e})}else return r instanceof C?new C({...r._def,type:de(r.element)}):r instanceof F?F.create(de(r.unwrap())):r instanceof J?J.create(de(r.unwrap())):r instanceof W?W.create(r.items.map(e=>de(e))):r}class T extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){const u=this._getOrReturnCtx(e);return h(u,{code:d.invalid_type,expected:f.object,received:u.parsedType}),g}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof z&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const l=a[u],k=s.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Y(s,k,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof z){const u=this._def.unknownKeys;if(u==="passthrough")for(const l of o)c.push({key:{status:"valid",value:l},value:{status:"valid",value:s.data[l]}});else if(u==="strict")o.length>0&&(h(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 l of o){const k=s.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Y(s,k,s.path,l)),alwaysSet:l in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const l of c){const k=await l.key,S=await l.value;u.push({key:k,value:S,alwaysSet:l.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 T({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,i,o;const c=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&i!==void 0?i:n.defaultError;return t.code==="unrecognized_keys"?{message:(o=p.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}extend(e){return new T({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new T({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new T({...this._def,catchall:e})}pick(e){const t={};return x.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new T({...this._def,shape:()=>t})}omit(e){const t={};return x.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new T({...this._def,shape:()=>t})}deepPartial(){return de(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(n=>{const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new T({...this._def,shape:()=>t})}required(e){const t={};return x.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof F;)a=a._def.innerType;t[n]=a}}),new T({...this._def,shape:()=>t})}keyof(){return Tt(x.objectKeys(this.shape))}}T.create=(r,e)=>new T({shape:()=>r,unknownKeys:"strip",catchall:z.create(),typeName:y.ZodObject,...v(e)}),T.strictCreate=(r,e)=>new T({shape:()=>r,unknownKeys:"strict",catchall:z.create(),typeName:y.ZodObject,...v(e)}),T.lazycreate=(r,e)=>new T({shape:r,unknownKeys:"strip",catchall:z.create(),typeName:y.ZodObject,...v(e)});class Ae extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new N(o.ctx.common.issues));return h(t,{code:d.invalid_union,unionErrors:i}),g}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},l=c._parseSync({data:t.data,path:t.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!a&&(a={result:l,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 h(t,{code:d.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}Ae.create=(r,e)=>new Ae({options:r,typeName:y.ZodUnion,...v(e)});const L=r=>r instanceof De?L(r.schema):r instanceof R?L(r.innerType()):r instanceof Oe?[r.value]:r instanceof G?r.options:r instanceof Ne?x.objectValues(r.enum):r instanceof Ee?L(r._def.innerType):r instanceof Se?[void 0]:r instanceof Te?[null]:r instanceof F?[void 0,...L(r.unwrap())]:r instanceof J?[null,...L(r.unwrap())]:r instanceof ct||r instanceof Ze?L(r.unwrap()):r instanceof Ce?L(r._def.innerType):[];class Le extends _{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return h(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),g;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}):(h(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}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=L(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:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...v(n)})}}function ot(r,e){const t=V(r),n=V(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.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=ot(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.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=ot(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class $e extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(st(a)||st(i))return g;const o=ot(a.value,i.value);return o.valid?((at(a)||at(i))&&t.dirty(),{status:t.value,value:o.data}):(h(n,{code:d.invalid_intersection_types}),g)};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}))}}$e.create=(r,e,t)=>new $e({left:r,right:e,typeName:y.ZodIntersection,...v(t)});class W extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return h(n,{code:d.invalid_type,expected:f.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return h(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(h(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 Y(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:y.ZodTuple,rest:null,...v(e)})};class Me extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return h(n,{code:d.invalid_type,expected:f.object,received:n.parsedType}),g;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:a._parse(new Y(n,o,n.path,o)),value:i._parse(new Y(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 _?new Me({keyType:e,valueType:t,typeName:y.ZodRecord,...v(n)}):new Me({keyType:E.create(),valueType:e,typeName:y.ZodRecord,...v(t)})}}class Ue extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return h(n,{code:d.invalid_type,expected:f.map,received:n.parsedType}),g;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new Y(n,o,n.path,[u,"key"])),value:a._parse(new Y(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,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return g;(u.status==="dirty"||l.status==="dirty")&&t.dirty(),o.set(u.value,l.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return g;(u.status==="dirty"||l.status==="dirty")&&t.dirty(),o.set(u.value,l.value)}return{status:t.value,value:o}}}}Ue.create=(r,e,t)=>new Ue({valueType:e,keyType:r,typeName:y.ZodMap,...v(t)});class ee extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return h(n,{code:d.invalid_type,expected:f.set,received:n.parsedType}),g;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(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&&(h(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 l of c){if(l.status==="aborted")return g;l.status==="dirty"&&t.dirty(),u.add(l.value)}return{status:t.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new Y(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new ee({...this._def,minSize:{value:e,message:p.toString(t)}})}max(e,t){return new ee({...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)}}ee.create=(r,e)=>new ee({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,...v(e)});class le extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return h(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),g;function n(o,c){return Fe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,We(),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,We(),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 D(async function(...c){const u=new N([]),l=await o._def.args.parseAsync(c,a).catch($=>{throw u.addIssue(n(c,$)),u}),k=await Reflect.apply(i,this,l);return await o._def.returns._def.type.parseAsync(k,a).catch($=>{throw u.addIssue(s(k,$)),u})})}else{const o=this;return D(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new N([n(c,u.error)]);const l=Reflect.apply(i,this,u.data),k=o._def.returns.safeParse(l,a);if(!k.success)throw new N([s(l,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(X.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(X.create()),returns:t||X.create(),typeName:y.ZodFunction,...v(n)})}}class De extends _{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}De.create=(r,e)=>new De({getter:r,typeName:y.ZodLazy,...v(e)});class Oe extends _{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}Oe.create=(r,e)=>new Oe({value:r,typeName:y.ZodLiteral,...v(e)});function Tt(r,e){return new G({values:r,typeName:y.ZodEnum,...v(e)})}class G extends _{constructor(){super(...arguments),ke.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:x.joinValues(n),received:t.parsedType,code:d.invalid_type}),g}if(Pe(this,ke)||xt(this,ke,new Set(this._def.values)),!Pe(this,ke).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{received:t.data,code:d.invalid_enum_value,options:n}),g}return D(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 G.create(e,{...this._def,...t})}exclude(e,t=this._def){return G.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}ke=new WeakMap,G.create=Tt;class Ne extends _{constructor(){super(...arguments),be.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){const s=x.objectValues(t);return h(n,{expected:x.joinValues(s),received:n.parsedType,code:d.invalid_type}),g}if(Pe(this,be)||xt(this,be,new Set(x.getValidEnumValues(this._def.values))),!Pe(this,be).has(e.data)){const s=x.objectValues(t);return h(n,{received:n.data,code:d.invalid_enum_value,options:s}),g}return D(e.data)}get enum(){return this._def.values}}be=new WeakMap,Ne.create=(r,e)=>new Ne({values:r,typeName:y.ZodNativeEnum,...v(e)});class he extends _{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return h(t,{code:d.invalid_type,expected:f.promise,received:t.parsedType}),g;const n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return D(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}he.create=(r,e)=>new he({type:r,typeName:y.ZodPromise,...v(e)});class R extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.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=>{h(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 g;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?g:c.status==="dirty"||t.value==="dirty"?ce(c.value):c});{if(t.value==="aborted")return g;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?g: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"?g:(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"?g:(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(!K(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>K(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(s)}}R.create=(r,e,t)=>new R({schema:r,typeName:y.ZodEffects,effect:e,...v(t)}),R.createWithPreprocess=(r,e,t)=>new R({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...v(t)});class F extends _{_parse(e){return this._getType(e)===f.undefined?D(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(r,e)=>new F({innerType:r,typeName:y.ZodOptional,...v(e)});class J extends _{_parse(e){return this._getType(e)===f.null?D(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}J.create=(r,e)=>new J({innerType:r,typeName:y.ZodNullable,...v(e)});class Ee extends _{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ee.create=(r,e)=>new Ee({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class Ce extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xe(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}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Be extends _{_parse(e){if(this._getType(e)!==f.nan){const n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}}Be.create=r=>new Be({typeName:y.ZodNaN,...v(r)});const Nr=Symbol("zod_brand");class ct extends _{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Re extends _{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?g: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"?g: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:y.ZodPipeline})}}class Ze extends _{_parse(e){const t=this._def.innerType._parse(e),n=s=>(K(s)&&(s.value=Object.freeze(s.value)),s);return xe(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ze.create=(r,e)=>new Ze({innerType:r,typeName:y.ZodReadonly,...v(e)});function At(r,e={},t){return r?ue.create().superRefine((n,s)=>{var a,i;if(!r(n)){const o=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:c})}}):ue.create()}const Er={object:T.lazycreate};var y;(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"})(y||(y={}));const Cr=(r,e={message:`Input not instance of ${r.name}`})=>At(t=>t instanceof r,e),$t=E.create,Mt=H.create,Rr=Be.create,Zr=q.create,Dt=we.create,Ir=Q.create,jr=Ve.create,Yr=Se.create,Wr=Te.create,Fr=ue.create,Pr=X.create,Vr=z.create,zr=ze.create,Lr=C.create,Ur=T.create,Br=T.strictCreate,Hr=Ae.create,qr=Le.create,Gr=$e.create,Jr=W.create,Kr=Me.create,Qr=Ue.create,Xr=ee.create,en=le.create,tn=De.create,rn=Oe.create,nn=G.create,sn=Ne.create,an=he.create,Ot=R.create,on=F.create,cn=J.create,un=R.createWithPreprocess,dn=Re.create;var m=Object.freeze({__proto__:null,defaultErrorMap:oe,setErrorMap:cr,getErrorMap:We,makeIssue:Fe,EMPTY_PATH:ur,addIssueToContext:h,ParseStatus:M,INVALID:g,DIRTY:ce,OK:D,isAborted:st,isDirty:at,isValid:K,isAsync:xe,get util(){return x},get objectUtil(){return nt},ZodParsedType:f,getParsedType:V,ZodType:_,datetimeRegex:St,ZodString:E,ZodNumber:H,ZodBigInt:q,ZodBoolean:we,ZodDate:Q,ZodSymbol:Ve,ZodUndefined:Se,ZodNull:Te,ZodAny:ue,ZodUnknown:X,ZodNever:z,ZodVoid:ze,ZodArray:C,ZodObject:T,ZodUnion:Ae,ZodDiscriminatedUnion:Le,ZodIntersection:$e,ZodTuple:W,ZodRecord:Me,ZodMap:Ue,ZodSet:ee,ZodFunction:le,ZodLazy:De,ZodLiteral:Oe,ZodEnum:G,ZodNativeEnum:Ne,ZodPromise:he,ZodEffects:R,ZodTransformer:R,ZodOptional:F,ZodNullable:J,ZodDefault:Ee,ZodCatch:Ce,ZodNaN:Be,BRAND:Nr,ZodBranded:ct,ZodPipeline:Re,ZodReadonly:Ze,custom:At,Schema:_,ZodSchema:_,late:Er,get ZodFirstPartyTypeKind(){return y},coerce:{string:r=>E.create({...r,coerce:!0}),number:r=>H.create({...r,coerce:!0}),boolean:r=>we.create({...r,coerce:!0}),bigint:r=>q.create({...r,coerce:!0}),date:r=>Q.create({...r,coerce:!0})},any:Fr,array:Lr,bigint:Zr,boolean:Dt,date:Ir,discriminatedUnion:qr,effect:Ot,enum:nn,function:en,instanceof:Cr,intersection:Gr,lazy:tn,literal:rn,map:Qr,nan:Rr,nativeEnum:sn,never:Vr,null:Wr,nullable:cn,number:Mt,object:Ur,oboolean:()=>Dt().optional(),onumber:()=>Mt().optional(),optional:on,ostring:()=>$t().optional(),pipeline:dn,preprocess:un,promise:an,record:Kr,set:Xr,strictObject:Br,string:$t,symbol:jr,transformer:Ot,tuple:Jr,undefined:Yr,union:Hr,unknown:Pr,void:zr,NEVER:g,ZodIssueCode:d,quotelessJson:or,ZodError:N});m.object({nucleotideSequences:m.array(m.object({name:m.string(),sequence:m.string()})),genes:m.array(m.object({name:m.string(),sequence:m.string()}))});const ln=m.enum(["ascending","descending"]),hn=m.object({field:m.string(),type:ln});m.object({limit:m.number().optional(),offset:m.number().optional(),fields:m.array(m.string()).optional(),orderBy:m.array(hn).optional()}).catchall(m.union([m.boolean(),m.undefined(),m.string(),m.number(),m.null(),m.array(m.string())])).extend({minProportion:m.number().optional()});const fn=m.object({mutation:m.string(),proportion:m.number(),count:m.number(),sequenceName:m.union([m.string(),m.null()]),mutationFrom:m.string(),mutationTo:m.string(),position:m.number()}),mn=He(m.array(fn)),pn=m.object({insertion:m.string(),count:m.number(),insertedSymbols:m.string(),position:m.number(),sequenceName:m.union([m.string(),m.null()])});He(m.array(pn));const Nt=m.union([m.string(),m.number(),m.boolean(),m.null()]),yn=m.object({count:m.number()}).catchall(Nt),gn=He(m.array(yn)),vn=m.object({}).catchall(Nt);He(m.array(vn));function He(r){return m.object({data:r})}const Et=m.object({title:m.string().optional(),status:m.number(),detail:m.string().optional(),type:m.string(),instance:m.string().optional()}),_n=m.object({error:Et});class ut extends Error{constructor(e,t,n){super(e),this.status=t,this.requestedData=n,this.name="UnknownLapisError"}}class Ct extends Error{constructor(e,t,n,s){super(e),this.status=t,this.problemDetail=n,this.requestedData=s,this.name="LapisError"}}async function xn(r,e,t){const n=await Rt(wn(r),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:t},"aggregated data");return gn.parse(await n.json())}async function kn(r,e,t,n){const s=await Rt(Sn(r,t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:n},`${t} mutations`);return mn.parse(await s.json())}async function Rt(r,e,t){try{const n=await fetch(r,e);return await bn(n,t),n}catch(n){const s=n instanceof Error?n.message:`${n}`;throw new ut(`Failed to connect to LAPIS: ${s}`,500,t)}}const bn=async(r,e)=>{if(!r.ok){if(r.status>=400&&r.status<500){const t=await r.json(),n=_n.safeParse(t);if(n.success)throw new Ct(r.statusText+n.data.error.detail,r.status,n.data.error,e);const s=Et.safeParse(t);throw s.success?new Ct(r.statusText+s.data.detail,r.status,s.data,e):new ut(`${r.statusText}: ${JSON.stringify(t)}`,r.status,e)}throw new ut(`${r.statusText}: ${r.status}`,r.status,e)}},wn=r=>`${r}/sample/aggregated`,Sn=(r,e)=>e==="amino acid"?`${r}/sample/aminoAcidMutations`:`${r}/sample/nucleotideMutations`;class Zt{constructor(e,t=[]){this.filter=e,this.fields=t}async evaluate(e,t){const n=(await xn(e,{...this.filter,fields:this.fields},t)).data;if(Tn(n))return{content:n};throw new Error("Aggregated response does not have count")}}function Tn(r){return r.every(e=>typeof e=="object"&&"count"in e&&typeof e.count=="number")}class An{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 $n extends An{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 dt{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 Mn extends dt{constructor(e,t,n){super(e,s=>({...s,[n]:s[t]}))}}class Dn{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,jt=It*60,Yt=jt*24,On=Yt*7,fe=1e3,lt=It*fe,Wt=jt*fe,Nn=Yt*fe,En=On*fe,ht="millisecond",me="second",pe="minute",ye="hour",Z="day",Ie="week",I="month",Ft="quarter",U="year",ge="date",Pt="YYYY-MM-DDTHH:mm:ssZ",Vt="Invalid Date",Cn=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,Rn=/\\[([^\\]]+)]|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])+"]"}},ft=function(e,t,n){var s=String(e);return!s||s.length>=t?e:""+Array(t+1-s.length).join(n)+e},In=function(e){var t=-e.utcOffset(),n=Math.abs(t),s=Math.floor(n/60),a=n%60;return(t<=0?"+":"-")+ft(s,2,"0")+":"+ft(a,2,"0")},jn=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,I),a=t-s<0,i=e.clone().add(n+(a?-1:1),I);return+(-(n+(t-s)/(a?s-i:i-s))||0)},Yn=function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},Wn=function(e){var t={M:I,y:U,w:Ie,d:Z,D:ge,h:ye,m:pe,s:me,ms:ht,Q:Ft};return t[e]||String(e||"").toLowerCase().replace(/s$/,"")},Fn=function(e){return e===void 0},Pn={s:ft,z:In,m:jn,a:Yn,p:Wn,u:Fn},je="en",te={};te[je]=Zn;var zt="$isDayjsObject",mt=function(e){return e instanceof Ge||!!(e&&e[zt])},qe=function r(e,t,n){var s;if(!e)return je;if(typeof e=="string"){var a=e.toLowerCase();te[a]&&(s=a),t&&(te[a]=t,s=a);var i=e.split("-");if(!s&&i.length>1)return r(i[0])}else{var o=e.name;te[o]=e,s=o}return!n&&s&&(je=s),s||!n&&je},w=function(e,t){if(mt(e))return e.clone();var n=typeof t=="object"?t:{};return n.date=e,n.args=arguments,new Ge(n)},Vn=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})},b=Pn;b.l=qe,b.i=mt,b.w=Vn;var zn=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(b.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(Cn);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)},Ge=function(){function r(t){this.$L=qe(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[zt]=!0}var e=r.prototype;return e.parse=function(n){this.$d=zn(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 b},e.isValid=function(){return this.$d.toString()!==Vt},e.isSame=function(n,s){var a=w(n);return this.startOf(s)<=a&&a<=this.endOf(s)},e.isAfter=function(n,s){return w(n)<this.startOf(s)},e.isBefore=function(n,s){return this.endOf(s)<w(n)},e.$g=function(n,s,a){return b.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=b.u(s)?!0:s,o=b.p(n),c=function(ve,j){var O=b.w(a.$u?Date.UTC(a.$y,j,ve):new Date(a.$y,j,ve),a);return i?O:O.endOf(Z)},u=function(ve,j){var O=[0,0,0,0],_e=[23,59,59,999];return b.w(a.toDate()[ve].apply(a.toDate("s"),(i?O:_e).slice(j)),a)},l=this.$W,k=this.$M,S=this.$D,$="set"+(this.$u?"UTC":"");switch(o){case U:return i?c(1,0):c(31,11);case I:return i?c(1,k):c(0,k+1);case Ie:{var B=this.$locale().weekStart||0,ie=(l<B?l+7:l)-B;return c(i?S-ie:S+(6-ie),k)}case Z:case ge:return u($+"Hours",0);case ye:return u($+"Minutes",1);case pe:return u($+"Seconds",2);case me:return u($+"Milliseconds",3);default:return this.clone()}},e.endOf=function(n){return this.startOf(n,!1)},e.$set=function(n,s){var a,i=b.p(n),o="set"+(this.$u?"UTC":""),c=(a={},a[Z]=o+"Date",a[ge]=o+"Date",a[I]=o+"Month",a[U]=o+"FullYear",a[ye]=o+"Hours",a[pe]=o+"Minutes",a[me]=o+"Seconds",a[ht]=o+"Milliseconds",a)[i],u=i===Z?this.$D+(s-this.$W):s;if(i===I||i===U){var l=this.clone().set(ge,1);l.$d[c](u),l.init(),this.$d=l.set(ge,Math.min(this.$D,l.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[b.p(n)]()},e.add=function(n,s){var a=this,i;n=Number(n);var o=b.p(s),c=function(S){var $=w(a);return b.w($.date($.date()+Math.round(S*n)),a)};if(o===I)return this.set(I,this.$M+n);if(o===U)return this.set(U,this.$y+n);if(o===Z)return c(1);if(o===Ie)return c(7);var u=(i={},i[pe]=lt,i[ye]=Wt,i[me]=fe,i)[o]||1,l=this.$d.getTime()+n*u;return b.w(l,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||Vt;var i=n||Pt,o=b.z(this),c=this.$H,u=this.$m,l=this.$M,k=a.weekdays,S=a.months,$=a.meridiem,B=function(O,_e,rt,Ts){return O&&(O[_e]||O(s,i))||rt[_e].slice(0,Ts)},ie=function(O){return b.s(c%12||12,O,"0")},tt=$||function(j,O,_e){var rt=j<12?"AM":"PM";return _e?rt.toLowerCase():rt},ve=function(O){switch(O){case"YY":return String(s.$y).slice(-2);case"YYYY":return b.s(s.$y,4,"0");case"M":return l+1;case"MM":return b.s(l+1,2,"0");case"MMM":return B(a.monthsShort,l,S,3);case"MMMM":return B(S,l);case"D":return s.$D;case"DD":return b.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return B(a.weekdaysMin,s.$W,k,2);case"ddd":return B(a.weekdaysShort,s.$W,k,3);case"dddd":return k[s.$W];case"H":return String(c);case"HH":return b.s(c,2,"0");case"h":return ie(1);case"hh":return ie(2);case"a":return tt(c,u,!0);case"A":return tt(c,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(s.$s);case"ss":return b.s(s.$s,2,"0");case"SSS":return b.s(s.$ms,3,"0");case"Z":return o}return null};return i.replace(Rn,function(j,O){return O||ve(j)||o.replace(":","")})},e.utcOffset=function(){return-Math.round(this.$d.getTimezoneOffset()/15)*15},e.diff=function(n,s,a){var i=this,o=b.p(s),c=w(n),u=(c.utcOffset()-this.utcOffset())*lt,l=this-c,k=function(){return b.m(i,c)},S;switch(o){case U:S=k()/12;break;case I:S=k();break;case Ft:S=k()/3;break;case Ie:S=(l-u)/En;break;case Z:S=(l-u)/Nn;break;case ye:S=l/Wt;break;case pe:S=l/lt;break;case me:S=l/fe;break;default:S=l;break}return a?S:b.a(S)},e.daysInMonth=function(){return this.endOf(I).$D},e.$locale=function(){return te[this.$L]},e.locale=function(n,s){if(!n)return this.$L;var a=this.clone(),i=qe(n,s,!0);return i&&(a.$L=i),a},e.clone=function(){return b.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}(),Lt=Ge.prototype;w.prototype=Lt,[["$ms",ht],["$s",me],["$m",pe],["$H",ye],["$W",Z],["$M",I],["$y",U],["$D",ge]].forEach(function(r){Lt[r[1]]=function(e){return this.$g(e,r[0],r[1])}}),w.extend=function(r,e){return r.$i||(r(e,Ge,w),r.$i=!0),w},w.locale=qe,w.isDayjs=mt,w.unix=function(r){return w(r*1e3)},w.en=te[je],w.Ls=te,w.p={};var Ln=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(l){switch(l){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(),l==="w"?1:2,"0");case"W":case"WW":return o.s(a.isoWeek(),l==="W"?1:2,"0");case"k":case"kk":return o.s(String(a.$H===0?24:a.$H),l==="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 l}});return n.bind(this)(u)}},Un="isoweek",Bn=function(r,e,t){var n=function(c,u){var l=(u?t.utc:t)().year(c).startOf(U),k=4-l.isoWeekday();return l.isoWeekday()>4&&(k+=7),l.add(k,Z)},s=function(c){return c.add(4-c.isoWeekday(),Z)},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,Z);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(),l=u.u(c)?!0:c,k=u.p(o);return k===Un?l?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)}};w.extend(Bn),w.extend(Ln);const pt="GGGG-[W]WW",et=class et{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,re.parse(e,this)),this.yearMonthDayCache.get(e)}getYearMonth(e){return this.yearMonthCache.has(e)||this.yearMonthCache.set(e,se.parse(e,this)),this.yearMonthCache.get(e)}getYearWeek(e){return this.yearWeekCache.has(e)||this.yearWeekCache.set(e,ne.parse(e,this)),this.yearWeekCache.get(e)}getYear(e){return this.yearCache.has(e)||this.yearCache.set(e,ae.parse(e,this)),this.yearCache.get(e)}static getInstance(){return this.instance}};et.instance=new et;let yt=et;class re{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=w(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(pt))}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 re(n,s,a,t)}}class ne{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(pt)}toString(){return this.text}englishName(){return`Week ${this.isoWeekNumber}, ${this.isoYearNumber}`}get firstDay(){const e=w().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(pt);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 ne(n,s,t)}}class se{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`${Hn(this.monthNumber)} ${this.yearNumber}`}get firstDay(){return this.cache.getYearMonthDay(w(`${this.yearNumber}-${this.monthNumber}-01`).format("YYYY-MM-DD"))}get lastDay(){return this.cache.getYearMonthDay(w(`${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 se(n,s,t)}}class ae{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 ae(n,t)}}function Hn(r){return w().month(r-1).format("MMMM")}function Ut(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 qn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addDays(s));return t}function Gn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addWeeks(s));return t}function Jn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addMonths(s));return t}function Kn(r,e){const t=[],n=e.minus(r);for(let s=0;s<=n;s++)t.push(r.addYears(s));return t}function Qn(r,e){if(r===null||e===null)return[];if(r instanceof re&&e instanceof re)return qn(r,e);if(r instanceof ne&&e instanceof ne)return Gn(r,e);if(r instanceof se&&e instanceof se)return Jn(r,e);if(r instanceof ae&&e instanceof ae)return Kn(r,e);throw new Error(`Invalid arguments: start and end must be of the same type: ${r}, ${e}`)}function Xn(r,e){if(r instanceof re&&e instanceof re||r instanceof ne&&e instanceof ne||r instanceof se&&e instanceof se||r instanceof ae&&e instanceof ae)return r.minus(e);throw new Error(`Cannot compare ${r} and ${e}`)}function Je(r,e){if(r===null)return 1;if(e===null)return-1;const t=Xn(r,e);return t<0?-1:t>0?1:0}function es(r){let e=null,t=null;for(const n of r)n!==null&&((e===null||Je(n,e)<0)&&(e=n),(t===null||Je(n,t)>0)&&(t=n));return e===null||t===null?{min:null,max:null}:{min:e,max:t}}function Ye(r,e){const n=yt.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 ts(r,e){return r.dateRange===null?1:e.dateRange===null?-1:Je(r.dateRange,e.dateRange)}function rs(r,e){return{dateRange:r.date===null?null:Ye(r.date,e),count:r.count}}const ns=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(?<substitutionValue>[A-Z.*])?$/i;class Ke{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?`${this.valueAtReference}`:"",o=this.substitutionValue?`${this.substitutionValue}`:"";this.code=`${a}${i}${this.position}${o}`}equals(e){return e instanceof Ke?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=e.match(ns);return t===null||t.groups===void 0?null:new Ke(t.groups.segment,t.groups.valueAtReference,t.groups.substitutionValue,parseInt(t.groups.position,10))}}const ss=/^((?<segment>[A-Z0-9_-]+)(?=:):)?(?<valueAtReference>[A-Z])?(?<position>\\d+)(-)$/i;class Qe{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.valueAtReference}`:"";this.code=`${s}${a}${this.position}-`}equals(e){return e instanceof Qe?this.segment===e.segment&&this.valueAtReference===e.valueAtReference&&this.position===e.position:!1}toString(){return this.code}static parse(e){const t=e.match(ss);return t===null||t.groups===void 0?null:new Qe(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 as{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:l})=>c==="-"?{type:"deletion",mutation:new Qe(l??void 0,o,u),count:a,proportion:i}:{type:"substitution",mutation:new Ke(l??void 0,o,c,u),count:a,proportion:i})}}async fetchMutations(e,t){const n={...this.filter,minProportion:this.minProportion};return kn(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 P,gt,qt,Gt=[],A=Ht,Jt=A.__b,Kt=A.__r,Qt=A.diffed,Xt=A.__c,er=A.unmount,tr=A.__;function is(){for(var r;r=Gt.shift();)if(r.__P&&r.__H)try{r.__H.__h.forEach(Xe),r.__H.__h.forEach(vt),r.__H.__h=[]}catch(e){r.__H.__h=[],A.__e(e,r.__v)}}A.__b=function(r){P=null,Jt&&Jt(r)},A.__=function(r,e){r&&e.__k&&e.__k.__m&&(r.__m=e.__k.__m),tr&&tr(r,e)},A.__r=function(r){Kt&&Kt(r);var e=(P=r.__c).__H;e&&(gt===P?(e.__h=[],P.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0})):(e.__h.forEach(Xe),e.__h.forEach(vt),e.__h=[])),gt=P},A.diffed=function(r){Qt&&Qt(r);var e=r.__c;e&&e.__H&&(e.__H.__h.length&&(Gt.push(e)!==1&&qt===A.requestAnimationFrame||((qt=A.requestAnimationFrame)||os)(is)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.i=void 0})),gt=P=null},A.__c=function(r,e){e.some(function(t){try{t.__h.forEach(Xe),t.__h=t.__h.filter(function(n){return!n.__||vt(n)})}catch(n){e.some(function(s){s.__h&&(s.__h=[])}),e=[],A.__e(n,t.__v)}}),Xt&&Xt(r,e)},A.unmount=function(r){er&&er(r);var e,t=r.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{Xe(n)}catch(s){e=s}}),t.__H=void 0,e&&A.__e(e,t.__v))};var rr=typeof requestAnimationFrame=="function";function os(r){var e,t=function(){clearTimeout(n),rr&&cancelAnimationFrame(e),setTimeout(r)},n=setTimeout(t,100);rr&&(e=requestAnimationFrame(t))}function Xe(r){var e=P,t=r.__c;typeof t=="function"&&(r.__c=void 0,t()),P=e}function vt(r){var e=P;r.__c=r.__(),P=e}class nr extends Error{constructor(e,t){super(t),this.headline=e,this.name="UserFacingError"}}class cs{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 us extends cs{constructor(e){super(_s,xs,e)}}const ds=(r,e)=>{if(r.segment!==e.segment)return ls(r.segment,e.segment);if(r.position!==e.position)return hs(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?fs(r.substitutionValue,e.substitutionValue):0},ls=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),hs=(r,e)=>r-e,fs=(r,e)=>r===void 0?-1:e===void 0?1:r.localeCompare(e),sr=200;async function ms({lapisFilter:r,sequenceType:e,lapis:t,granularity:n,lapisDateField:s,signal:a}){const i=await ar(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 ir(o,e).evaluate(t,a)}async function ps({lapisFilter:r,sequenceType:e,lapis:t,lapisDateField:n,granularity:s,signal:a}){const i=await ar(r,t,s,n,a);if(i.length>sr)throw new nr("Too many dates",`The dataset would contain ${i.length} date intervals. Please reduce the number to below ${sr} 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 o=i.map(async l=>{const k=l.firstDay.toString(),S=l.lastDay.toString(),$={...r,[`${n}From`]:k,[`${n}To`]:S},B=await ir($,e).evaluate(t,a),ie=await bs($).evaluate(t,a);return{date:l,mutations:B.content,totalCount:ie.content[0].count}}),c=await Promise.all(o),u=(await ms({lapisFilter:r,sequenceType:e,lapis:t,lapisDateField:n,granularity:s})).content;return{mutationOverTimeData:ks(c,u),overallMutationData:u}}async function ar(r,e,t,n,s){const{content:a}=await gs(r,e,t,n,s),{dateFrom:i,dateTo:o}=ys(r,n,t),{min:c,max:u}=es(a);return Qn(i??c,o??u)}function ys(r,e,t){const n=r[e];if(n)return{dateFrom:Ye(n,t),dateTo:Ye(n,t)};const s=r[`${e}From`],a=r[`${e}To`];return{dateFrom:s?Ye(s,t):null,dateTo:a?Ye(a,t):null}}function gs(r,e,t,n,s){return vs(r,t,n).evaluate(e,s)}function vs(r,e,t){const n=new Zt(r,[t]),s=new Mn(n,t,"date"),a=new dt(s,c=>rs(c,e)),i=new $n(a,"dateRange","count"),o=new Dn(i,ts);return new dt(o,c=>c.dateRange)}function ir(r,e){return new as(r,e,.001)}function _s(r){return r.code}function xs(r){return r.dateString}function ks(r,e){const t=new us,n=r.map(i=>i.date),s=e.sort((i,o)=>ds(i.mutation,o.mutation)).map(i=>Bt(i.mutation)),a=n.sort((i,o)=>Je(i,o)).map(i=>Ut(i));return s.forEach(i=>{a.forEach(o=>{t.set(i,o,null)})}),r.forEach(i=>{if(i.totalCount==0)return;const o=Ut(i.date);i.mutations.forEach(c=>{const u=Bt(c.mutation);t.get(u,o)!==void 0&&t.set(u,o,{count:c.count,proportion:c.proportion,totalCount:i.totalCount})});for(const c of t.getFirstAxisKeys())t.get(c,o)===null&&t.set(c,o,{count:0,proportion:0,totalCount:i.totalCount})}),t}function bs(r){return new Zt(r)}async function ws(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 Ss(r){const e=await ps(r.data);return{overallMutationData:e.overallMutationData,mutationOverTimeSerialized:e.mutationOverTimeData.getContents()}}self.onmessage=async function(r){await ws(()=>Ss(r))}})();\n//# sourceMappingURL=mutationOverTimeWorker-CmSrq4SZ.js.map\n', jv = typeof self < "u" && self.Blob && new Blob([Rx], { type: "text/javascript;charset=utf-8" });
|
|
24264
24264
|
function WL(n) {
|
|
24265
24265
|
let t;
|
|
24266
24266
|
try {
|
|
@@ -35745,10 +35745,10 @@ function um({
|
|
|
35745
35745
|
]
|
|
35746
35746
|
}
|
|
35747
35747
|
) }),
|
|
35748
|
-
|
|
35748
|
+
/* @__PURE__ */ v(
|
|
35749
35749
|
"ul",
|
|
35750
35750
|
{
|
|
35751
|
-
className:
|
|
35751
|
+
className: `absolute bg-white mt-1 shadow-md max-h-80 overflow-scroll z-10 w-full min-w-32 ${_ ? "" : "hidden"}`,
|
|
35752
35752
|
...x(),
|
|
35753
35753
|
children: c.length > 0 ? c.map((Z, _t) => /* @__PURE__ */ v(
|
|
35754
35754
|
"li",
|
|
@@ -35870,7 +35870,9 @@ async function l$({
|
|
|
35870
35870
|
lapisFilter: e,
|
|
35871
35871
|
signal: i
|
|
35872
35872
|
}) {
|
|
35873
|
-
return (await new Xr(e ?? {}, [
|
|
35873
|
+
return (await new Xr(e ?? {}, [
|
|
35874
|
+
t
|
|
35875
|
+
]).evaluate(n, i)).content.map((o) => ({ count: o.count, value: o[t] })).filter((o) => o.value !== null).sort((o, l) => o.value === null ? 1 : l.value === null ? -1 : o.value.localeCompare(l.value));
|
|
35874
35876
|
}
|
|
35875
35877
|
const c$ = O.object({
|
|
35876
35878
|
lapisField: O.string().min(1),
|
|
@@ -35901,20 +35903,31 @@ const c$ = O.object({
|
|
|
35901
35903
|
value: t,
|
|
35902
35904
|
placeholderText: e,
|
|
35903
35905
|
data: i
|
|
35904
|
-
}) =>
|
|
35905
|
-
|
|
35906
|
-
|
|
35907
|
-
|
|
35908
|
-
|
|
35909
|
-
|
|
35910
|
-
|
|
35911
|
-
|
|
35912
|
-
|
|
35913
|
-
|
|
35914
|
-
|
|
35915
|
-
)
|
|
35906
|
+
}) => {
|
|
35907
|
+
const r = i.find((s) => s.value == t);
|
|
35908
|
+
return /* @__PURE__ */ v(
|
|
35909
|
+
um,
|
|
35910
|
+
{
|
|
35911
|
+
allItems: i,
|
|
35912
|
+
value: r,
|
|
35913
|
+
filterItemsByInputValue: m$,
|
|
35914
|
+
createEvent: (s) => new $k({ [n]: (s == null ? void 0 : s.value) ?? void 0 }),
|
|
35915
|
+
itemToString: (s) => (s == null ? void 0 : s.value) ?? "",
|
|
35916
|
+
placeholderText: e,
|
|
35917
|
+
formatItemInList: (s) => /* @__PURE__ */ v("p", { children: [
|
|
35918
|
+
/* @__PURE__ */ v("span", { children: s.value }),
|
|
35919
|
+
/* @__PURE__ */ v("span", { className: "ml-2 text-gray-500", children: [
|
|
35920
|
+
"(",
|
|
35921
|
+
s.count,
|
|
35922
|
+
")"
|
|
35923
|
+
] })
|
|
35924
|
+
] })
|
|
35925
|
+
}
|
|
35926
|
+
);
|
|
35927
|
+
};
|
|
35916
35928
|
function m$(n, t) {
|
|
35917
|
-
|
|
35929
|
+
var e;
|
|
35930
|
+
return t == null || t === "" ? !0 : (e = n.value) == null ? void 0 : e.toLowerCase().includes((t == null ? void 0 : t.toLowerCase()) || "");
|
|
35918
35931
|
}
|
|
35919
35932
|
var g$ = Object.defineProperty, _$ = Object.getOwnPropertyDescriptor, ra = (n, t, e, i) => {
|
|
35920
35933
|
for (var r = i > 1 ? void 0 : i ? _$(t, e) : t, s = n.length - 1, o; s >= 0; s--)
|