point-click-lib 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,20 @@
1
- var PointClickLib=(function(u){"use strict";const ta=[{schemaVersion:3,changes:[{breaking:!1,description:"Designs have schemaVersion property"},{breaking:!1,description:"storyBoards array is required"}]},{schemaVersion:4,changes:[{breaking:!0,description:"Endings deprecated in favour of storyBoards. Any Endings have been converted to Storyboards."},{breaking:!1,description:"StoryBoards have end of game option."}]}];var C;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function t(s){throw new Error}a.assertNever=t,a.arrayToEnum=s=>{const r={};for(const i of s)r[i]=i;return r},a.getValidEnumValues=s=>{const r=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of r)i[o]=s[o];return a.objectValues(i)},a.objectValues=s=>a.objectKeys(s).map(function(r){return s[r]}),a.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const r=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&r.push(i);return r},a.find=(s,r)=>{for(const i of s)if(r(i))return i},a.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,r=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}a.joinValues=n,a.jsonStringifyReplacer=(s,r)=>typeof r=="bigint"?r.toString():r})(C||(C={}));var ft;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(ft||(ft={}));const m=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=a=>{switch(typeof a){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(a)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(a)?m.array:a===null?m.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?m.promise:typeof Map<"u"&&a instanceof Map?m.map:typeof Set<"u"&&a instanceof Set?m.set:typeof Date<"u"&&a instanceof Date?m.date:m.object;default:return m.unknown}},d=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class V 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(r){return r.message},n={_errors:[]},s=r=>{for(const i of r.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,p=0;for(;p<i.path.length;){const y=i.path[p];p===i.path.length-1?(o[y]=o[y]||{_errors:[]},o[y]._errors.push(t(i))):o[y]=o[y]||{_errors:[]},o=o[y],p++}}};return s(this),n}static assert(e){if(!(e instanceof V))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const r=s.path[0];t[r]=t[r]||[],t[r].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}V.create=a=>new V(a);const Pe=(a,e)=>{let t;switch(a.code){case d.invalid_type:a.received===m.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,C.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${C.joinValues(a.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${C.joinValues(a.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${C.joinValues(a.options)}, received '${a.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 a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:C.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case d.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case d.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.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 ${a.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,C.assertNever(a)}return{message:t}};let aa=Pe;function na(){return aa}const sa=a=>{const{data:e,path:t,errorMaps:n,issueData:s}=a,r=[...t,...s.path||[]],i={...s,path:r};if(s.message!==void 0)return{...s,path:r,message:s.message};let o="";const p=n.filter(y=>!!y).slice().reverse();for(const y of p)o=y(i,{data:e,defaultError:o}).message;return{...s,path:r,message:o}};function l(a,e){const t=na(),n=sa({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===Pe?void 0:Pe].filter(s=>!!s)});a.common.issues.push(n)}class R{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return _;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const r=await s.key,i=await s.value;n.push({key:r,value:i})}return R.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:r,value:i}=s;if(r.status==="aborted"||i.status==="aborted")return _;r.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[r.value]=i.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),me=a=>({status:"dirty",value:a}),Z=a=>({status:"valid",value:a}),pt=a=>a.status==="aborted",yt=a=>a.status==="dirty",U=a=>a.status==="valid",ke=a=>typeof Promise<"u"&&a instanceof Promise;var f;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(f||(f={}));class j{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gt=(a,e)=>{if(U(e))return{success:!0,data:e.value};if(!a.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 V(a.common.issues);return this._error=t,this._error}}};function k(a){if(!a)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=a;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:p}=a;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:p??t??o.defaultError}},description:s}}class b{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ke(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},s=this._parseSync({data:e,path:n.path,parent:n});return gt(n,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return U(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>U(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},s=this._parse({data:e,path:n.path,parent:n}),r=await(ke(s)?s:Promise.resolve(s));return gt(n,r)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,r)=>{const i=e(s),o=()=>r.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(p=>p?!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 Y({schema:this,typeName:v.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 M.create(this,this._def)}nullable(){return X.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return Te.create(this,this._def)}or(e){return xe.create([this,e],this._def)}and(e){return Ce.create(this,e,this._def)}transform(e){return new Y({...k(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Fe({...k(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new Ia({typeName:v.ZodBranded,type:this,...k(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new We({...k(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ue.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ra=/^c[^\s-]{8,}$/i,ia=/^[0-9a-z]+$/,oa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ca=/^[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,da=/^[a-z0-9_-]{21}$/i,ua=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,la=/^[-+]?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)?)??$/,ha=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ma="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $e;const fa=/^(?:(?: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])$/,pa=/^(?:(?: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])$/,ya=/^(([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]))$/,ga=/^(([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])$/,va=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_a=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vt="((\\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])))",Sa=new RegExp(`^${vt}$`);function _t(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);const t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ka(a){return new RegExp(`^${_t(a)}$`)}function ba(a){let e=`${vt}T${_t(a)}`;const t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function xa(a,e){return!!((e==="v4"||!e)&&fa.test(a)||(e==="v6"||!e)&&ya.test(a))}function Ca(a,e){if(!ua.test(a))return!1;try{const[t]=a.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function wa(a,e){return!!((e==="v4"||!e)&&pa.test(a)||(e==="v6"||!e)&&ga.test(a))}class P extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.string,received:r.parsedType}),_}const n=new R;let s;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){const i=e.data.length>r.value,o=e.data.length<r.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&l(s,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")ha.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")$e||($e=new RegExp(ma,"u")),$e.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")ca.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")da.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")ra.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")ia.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")oa.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:d.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:d.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?ba(r).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?Sa.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?ka(r).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?la.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?xa(e.data,r.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?Ca(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"jwt",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?wa(e.data,r.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cidr",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?va.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?_a.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64url",code:d.invalid_string,message:r.message}),n.dirty()):C.assertNever(r);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...f.errToObj(n)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...f.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...f.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...f.errToObj(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?.precision>"u"?null:e?.precision,...f.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...f.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...f.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...f.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...f.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...f.errToObj(t)})}nonempty(e){return this.min(1,f.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...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}}P.create=a=>new P({checks:[],typeName:v.ZodString,coerce:a?.coerce??!1,...k(a)});function Ta(a,e){const t=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,r=Number.parseInt(a.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return r%i/10**s}class G extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.number,received:r.parsedType}),_}let n;const s=new R;for(const r of this._def.checks)r.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?Ta(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_finite,message:r.message}),s.dirty()):C.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,n,s){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:f.toString(s)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.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"&&C.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)}}G.create=a=>new G({checks:[],typeName:v.ZodNumber,coerce:a?.coerce||!1,...k(a)});class fe extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const s=new R;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):C.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,n,s){return new fe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:f.toString(s)}]})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.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}}fe.create=a=>new fe({checks:[],typeName:v.ZodBigInt,coerce:a?.coerce??!1,...k(a)});class Be extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),_}return Z(e.data)}}Be.create=a=>new Be({typeName:v.ZodBoolean,coerce:a?.coerce||!1,...k(a)});class be extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.date,received:r.parsedType}),_}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_date}),_}const n=new R;let s;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):C.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new be({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:f.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:f.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}}be.create=a=>new be({checks:[],coerce:a?.coerce||!1,typeName:v.ZodDate,...k(a)});class St extends b{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),_}return Z(e.data)}}St.create=a=>new St({typeName:v.ZodSymbol,...k(a)});class Me extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),_}return Z(e.data)}}Me.create=a=>new Me({typeName:v.ZodUndefined,...k(a)});class kt extends b{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),_}return Z(e.data)}}kt.create=a=>new kt({typeName:v.ZodNull,...k(a)});class bt extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}bt.create=a=>new bt({typeName:v.ZodAny,...k(a)});class xt extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}xt.create=a=>new xt({typeName:v.ZodUnknown,...k(a)});class B extends b{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),_}}B.create=a=>new B({typeName:v.ZodNever,...k(a)});class Ct extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),_}return Z(e.data)}}Ct.create=a=>new Ct({typeName:v.ZodVoid,...k(a)});class D extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return l(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),_;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(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&&(l(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&&(l(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 j(t,i,t.path,o)))).then(i=>R.mergeArray(n,i));const r=[...t.data].map((i,o)=>s.type._parseSync(new j(t,i,t.path,o)));return R.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new D({...this._def,minLength:{value:e,message:f.toString(t)}})}max(e,t){return new D({...this._def,maxLength:{value:e,message:f.toString(t)}})}length(e,t){return new D({...this._def,exactLength:{value:e,message:f.toString(t)}})}nonempty(e){return this.min(1,e)}}D.create=(a,e)=>new D({type:a,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...k(e)});function H(a){if(a instanceof A){const e={};for(const t in a.shape){const n=a.shape[t];e[t]=M.create(H(n))}return new A({...a._def,shape:()=>e})}else return a instanceof D?new D({...a._def,type:H(a.element)}):a instanceof M?M.create(H(a.unwrap())):a instanceof X?X.create(H(a.unwrap())):a instanceof L?L.create(a.items.map(e=>H(e))):a}class A extends b{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=C.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const y=this._getOrReturnCtx(e);return l(y,{code:d.invalid_type,expected:m.object,received:y.parsedType}),_}const{status:n,ctx:s}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(const y in s.data)i.includes(y)||o.push(y);const p=[];for(const y of i){const x=r[y],W=s.data[y];p.push({key:{status:"valid",value:y},value:x._parse(new j(s,W,s.path,y)),alwaysSet:y in s.data})}if(this._def.catchall instanceof B){const y=this._def.unknownKeys;if(y==="passthrough")for(const x of o)p.push({key:{status:"valid",value:x},value:{status:"valid",value:s.data[x]}});else if(y==="strict")o.length>0&&(l(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const y=this._def.catchall;for(const x of o){const W=s.data[x];p.push({key:{status:"valid",value:x},value:y._parse(new j(s,W,s.path,x)),alwaysSet:x in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const y=[];for(const x of p){const W=await x.key,lt=await x.value;y.push({key:W,value:lt,alwaysSet:x.alwaysSet})}return y}).then(y=>R.mergeObjectSync(n,y)):R.mergeObjectSync(n,p)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new A({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{const s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:f.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new A({...this._def,unknownKeys:"strip"})}passthrough(){return new A({...this._def,unknownKeys:"passthrough"})}extend(e){return new A({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new A({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new A({...this._def,catchall:e})}pick(e){const t={};for(const n of C.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}omit(e){const t={};for(const n of C.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}deepPartial(){return H(this)}partial(e){const t={};for(const n of C.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new A({...this._def,shape:()=>t})}required(e){const t={};for(const n of C.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof M;)r=r._def.innerType;t[n]=r}return new A({...this._def,shape:()=>t})}keyof(){return It(C.objectKeys(this.shape))}}A.create=(a,e)=>new A({shape:()=>a,unknownKeys:"strip",catchall:B.create(),typeName:v.ZodObject,...k(e)}),A.strictCreate=(a,e)=>new A({shape:()=>a,unknownKeys:"strict",catchall:B.create(),typeName:v.ZodObject,...k(e)}),A.lazycreate=(a,e)=>new A({shape:a,unknownKeys:"strip",catchall:B.create(),typeName:v.ZodObject,...k(e)});class xe extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new V(o.ctx.common.issues));return l(t,{code:d.invalid_union,unionErrors:i}),_}if(t.common.async)return Promise.all(n.map(async r=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let r;const i=[];for(const p of n){const y={...t,common:{...t.common,issues:[]},parent:null},x=p._parseSync({data:t.data,path:t.path,parent:y});if(x.status==="valid")return x;x.status==="dirty"&&!r&&(r={result:x,ctx:y}),y.common.issues.length&&i.push(y.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(p=>new V(p));return l(t,{code:d.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}xe.create=(a,e)=>new xe({options:a,typeName:v.ZodUnion,...k(e)});function ze(a,e){const t=$(a),n=$(e);if(a===e)return{valid:!0,data:a};if(t===m.object&&n===m.object){const s=C.objectKeys(e),r=C.objectKeys(a).filter(o=>s.indexOf(o)!==-1),i={...a,...e};for(const o of r){const p=ze(a[o],e[o]);if(!p.valid)return{valid:!1};i[o]=p.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.array){if(a.length!==e.length)return{valid:!1};const s=[];for(let r=0;r<a.length;r++){const i=a[r],o=e[r],p=ze(i,o);if(!p.valid)return{valid:!1};s.push(p.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class Ce extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(r,i)=>{if(pt(r)||pt(i))return _;const o=ze(r.value,i.value);return o.valid?((yt(r)||yt(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:d.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([r,i])=>s(r,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}))}}Ce.create=(a,e,t)=>new Ce({left:a,right:e,typeName:v.ZodIntersection,...k(t)});class L extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return l(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return l(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((i,o)=>{const p=this._def.items[o]||this._def.rest;return p?p._parse(new j(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>R.mergeArray(t,i)):R.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new L({...this._def,rest:e})}}L.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new L({items:a,typeName:v.ZodTuple,rest:null,...k(e)})};class we extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return l(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),_;const s=[],r=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:r._parse(new j(n,o,n.path,o)),value:i._parse(new j(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?R.mergeObjectAsync(t,s):R.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof b?new we({keyType:e,valueType:t,typeName:v.ZodRecord,...k(n)}):new we({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...k(t)})}}class wt extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return l(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),_;const s=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([o,p],y)=>({key:s._parse(new j(n,o,n.path,[y,"key"])),value:r._parse(new j(n,p,n.path,[y,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const p of i){const y=await p.key,x=await p.value;if(y.status==="aborted"||x.status==="aborted")return _;(y.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(y.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const p of i){const y=p.key,x=p.value;if(y.status==="aborted"||x.status==="aborted")return _;(y.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(y.value,x.value)}return{status:t.value,value:o}}}}wt.create=(a,e,t)=>new wt({valueType:e,keyType:a,typeName:v.ZodMap,...k(t)});class pe extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return l(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),_;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(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&&(l(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const r=this._def.valueType;function i(p){const y=new Set;for(const x of p){if(x.status==="aborted")return _;x.status==="dirty"&&t.dirty(),y.add(x.value)}return{status:t.value,value:y}}const o=[...n.data.values()].map((p,y)=>r._parse(new j(n,p,n.path,y)));return n.common.async?Promise.all(o).then(p=>i(p)):i(o)}min(e,t){return new pe({...this._def,minSize:{value:e,message:f.toString(t)}})}max(e,t){return new pe({...this._def,maxSize:{value:e,message:f.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}pe.create=(a,e)=>new pe({valueType:a,minSize:null,maxSize:null,typeName:v.ZodSet,...k(e)});class Tt extends b{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})}}Tt.create=(a,e)=>new Tt({getter:a,typeName:v.ZodLazy,...k(e)});class Le extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}Le.create=(a,e)=>new Le({value:a,typeName:v.ZodLiteral,...k(e)});function It(a,e){return new J({values:a,typeName:v.ZodEnum,...k(e)})}class J extends b{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:C.joinValues(n),received:t.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:d.invalid_enum_value,options:n}),_}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return J.create(e,{...this._def,...t})}exclude(e,t=this._def){return J.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}J.create=It;class Ot extends b{_parse(e){const t=C.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const s=C.objectValues(t);return l(n,{expected:C.joinValues(s),received:n.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(C.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=C.objectValues(t);return l(n,{received:n.data,code:d.invalid_enum_value,options:s}),_}return Z(e.data)}get enum(){return this._def.values}}Ot.create=(a,e)=>new Ot({values:a,typeName:v.ZodNativeEnum,...k(e)});class Te extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return l(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),_;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Te.create=(a,e)=>new Te({type:a,typeName:v.ZodPromise,...k(e)});class Y extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),s.type==="preprocess"){const i=s.transform(n.data,r);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return _;const p=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return p.status==="aborted"?_:p.status==="dirty"||t.value==="dirty"?me(p.value):p});{if(t.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"||t.value==="dirty"?me(o.value):o}}if(s.type==="refinement"){const i=o=>{const p=s.refinement(o,r);if(n.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!U(i))return _;const o=s.transform(i.value,r);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=>U(i)?Promise.resolve(s.transform(i.value,r)).then(o=>({status:t.value,value:o})):_);C.assertNever(s)}}Y.create=(a,e,t)=>new Y({schema:a,typeName:v.ZodEffects,effect:e,...k(t)}),Y.createWithPreprocess=(a,e,t)=>new Y({schema:e,effect:{type:"preprocess",transform:a},typeName:v.ZodEffects,...k(t)});class M extends b{_parse(e){return this._getType(e)===m.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}M.create=(a,e)=>new M({innerType:a,typeName:v.ZodOptional,...k(e)});class X extends b{_parse(e){return this._getType(e)===m.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}X.create=(a,e)=>new X({innerType:a,typeName:v.ZodNullable,...k(e)});class Fe extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Fe.create=(a,e)=>new Fe({innerType:a,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...k(e)});class We extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ke(s)?s.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}We.create=(a,e)=>new We({innerType:a,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...k(e)});class At extends b{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}}At.create=a=>new At({typeName:v.ZodNaN,...k(a)});class Ia extends b{_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 Ue extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?_:r.status==="dirty"?(t.dirty(),me(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ue({in:e,out:t,typeName:v.ZodPipeline})}}class Ge extends b{_parse(e){const t=this._def.innerType._parse(e),n=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return ke(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ge.create=(a,e)=>new Ge({innerType:a,typeName:v.ZodReadonly,...k(e)});var v;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(v||(v={}));const c=P.create,g=G.create,T=Be.create,Oa=Me.create;B.create;const N=D.create,h=A.create,Q=xe.create;Ce.create;const He=L.create,z=we.create,w=Le.create,q=J.create;Te.create;const S=M.create;X.create;const Rt=()=>T().optional(),K=q(["left","right","up","down"]),Aa=K.options,Ie=h({type:c(),id:c(),name:S(c()),status:S(c())}),Nt=h({height:g(),width:g(),sprite:c().optional(),direction:S(K),filter:S(c())}),Zt=h({room:S(c()),x:g(),y:g()}),ye=h({imageId:c(),col:g().optional(),row:g().optional()}),I=h({text:c().array()}),Et=h({x:g(),y:g()}),Oe=h({soundId:c(),volume:g().optional()}),Ae={_started:Rt(),narrative:I.optional(),startDirection:K.optional(),endDirection:K.optional(),endStatus:c().optional()},Ra={_started:!0,narrative:!0,startDirection:!0,endDirection:!0,endStatus:!0,type:!0},Na=h({animation:S(c()),x:g(),y:g(),speed:S(g())}),qt=h({type:w("move"),roomId:c().optional(),pathIsSet:S(T()),doPendingInteractionWhenFinished:S(T()),steps:N(Na)}).extend(Ae),jt=h({type:w("goTo"),animation:S(c()),speed:S(g()),targetId:c()}).extend(Ae),Dt=h({type:w("say"),animation:S(c()),text:c(),time:g()}).extend(Ae),Za=h({animation:S(c()),duration:g(),timeElapsed:S(g()),reverse:S(T())}),Vt=h({type:w("act"),steps:N(Za)}).extend(Ae),ge=Q([qt,Vt,Dt,jt]),Ea=ge.options.map(a=>a.shape.type.value),Re=h({type:w("order"),actorId:c().optional(),orders:N(ge),replaceCurrentOrders:S(T()),narrative:I.optional()}),ee=h({type:w("changeRoom"),roomId:c(),takePlayer:T(),x:S(g()),y:S(g()),narrative:I.optional()}),te=h({type:w("inventory"),itemId:c(),actorId:c().optional(),addOrRemove:q(["ADD","REMOVE"]),narrative:I.optional()}),ae=h({type:w("removeActor"),actorId:c(),narrative:I.optional()}),ne=h({type:w("changeStatus"),targetId:c(),targetType:q(["actor","item","hotspot"]),status:c(),narrative:I.optional()}),Ne=h({type:w("sequence"),sequence:c(),narrative:I.optional()}),se=h({type:w("conversation"),conversationId:c(),end:S(T()),narrative:I.optional()}),re=h({type:w("conversationChoice"),on:T(),conversationId:c(),branchId:c(),choiceRef:c(),narrative:I.optional()}),ie=h({type:w("teleportActor"),actorId:c(),roomId:S(c()),x:g(),y:g(),narrative:I.optional()}),F=h({type:w("toggleZone"),roomId:S(c()),on:T(),ref:c(),zoneType:q(["hotspot","obstacle","walkable"]),narrative:I.optional()}),oe=h({type:w("soundEffect"),sound:c(),volume:g().optional(),narrative:I.optional()}),ce=h({type:w("backgroundMusic"),sound:c().optional(),roomId:c().optional(),volume:g().optional(),narrative:I.optional()}),de=h({type:w("ambientNoise"),sound:c().optional(),roomId:c().optional(),volume:g().optional(),narrative:I.optional()}),ue=h({type:w("flag"),on:T(),flag:c(),narrative:I.optional()}),le=h({type:w("storyBoardConsequence"),storyBoardId:c(),narrative:I.optional()}),he=h({type:w("changePlayerCharacter"),actorId:c(),narrative:I.optional()}),qa=F.shape.zoneType.options,Pt=Q([Re,ee,te,ae,ne,Ne,se,ie,F,oe,ce,de,ue,re,le,he]),ja=q(["conversation","sequence","changeStatus","backgroundMusic","ambientNoise","removeActor","inventory","changeRoom","order","teleportActor","toggleZone","soundEffect","flag","conversationChoice","storyBoardConsequence","changePlayerCharacter"]).options,Da={conversation:se,sequence:Ne,changeStatus:ne,removeActor:ae,inventory:te,changeRoom:ee,order:Re,teleportActor:ie,toggleZone:F,soundEffect:oe,flag:ue,conversationChoice:re,backgroundMusic:ce,ambientNoise:de,storyBoardConsequence:le,changePlayerCharacter:he},Je=Q([ae,ne,te,se,ie,F,oe,ue,ee,re,ce,de,le,he]),Va=Je.options.map(a=>a.shape.type.value),Ze=h({verbId:c(),targetId:c(),roomId:c().optional(),itemId:c().optional(),targetStatus:c().optional(),mustReachFirst:T().optional(),consequences:N(Pt),flagsThatMustBeFalse:N(c()).optional(),flagsThatMustBeTrue:N(c()).optional(),requiredInventory:N(c()).optional()}),Ye=h({actorOrders:S(z(c(),ge.array())),immediateConsequences:S(Je.array()),narrative:I.optional(),_started:Rt()}),ve=h({id:c(),description:c().optional(),stages:Ye.array()}),$t=h({conversationId:c().optional(),branchId:c().optional(),choiceRef:c().optional()}),Xe=h({ref:c().optional(),text:c(),sequence:c().optional(),nextBranch:S(c()),once:S(T()),disabled:S(T()),enablesChoices:N($t).optional(),disablesChoices:N($t).optional(),end:S(T()),choiceSequence:ve.optional()}),Bt=h({choices:N(Xe)}),Qe=h({id:c(),branches:z(c(),S(Bt)),currentBranch:S(c()),defaultBranch:c()}),Ke=h({id:c(),message:c(),imageId:c().optional(),imageWidth:g().optional()}),et=h({type:w("ending"),endingId:c(),narrative:I.optional()}),Pa=Q([Re,ee,te,ae,ne,Ne,se,ie,F,oe,ce,de,ue,re,le,he,et]),Mt=Q([ae,ne,te,se,ie,F,oe,ue,ee,re,ce,de,le,he,et]),tt=Ze.merge(h({consequences:N(Pa)})),Ee=ve.merge(h({stages:Ye.merge(h({immediateConsequences:S(Mt.array())})).array()})),$a=Xe.merge(h({choiceSequence:Ee.optional()})),Ba=h({choices:N($a)}),at=Qe.merge(h({branches:z(c(),S(Ba))})),nt=h({soundId:c(),frameIndex:g().optional(),volume:g().optional()}),Ma=z(c(),nt.or(nt.array()).or(Oa())),qe=Ie.merge(Zt).merge(Nt).merge(h({type:w("actor"),isPlayer:S(T()),noInteraction:S(T()),speed:S(g()),baseline:S(g()),dialogueColor:S(c()),soundEffectMap:Ma.optional(),walkToX:g().optional(),walkToY:g().optional(),defaultFrame:ye.optional(),statusFrames:z(ye).optional()})),zt=h({value:T(),default:T(),description:c().optional()}),st=z(c(),zt.optional()),_e=Ie.extend({type:w("item"),actorId:c().optional()}).and(ye.partial());q(["rect","circle","polygon"]);const za=N(He([g(),g()])),Lt=h({type:c().optional(),x:g(),y:g(),path:S(c()),polygon:S(za),circle:S(g()),rect:S(He([g(),g()]))}),rt=Lt.merge(h({ref:c().optional(),disabled:T().optional()})),it=Lt.merge(Ie).merge(h({type:w("hotspot"),parallax:g(),walkToX:g().optional(),walkToY:g().optional()})),La=h({parallax:g(),imageId:c(),placement:h({x:g(),y:g(),width:g(),height:g()}).optional()}),Fa=N(He([g(),g()])),ot=h({id:c(),frameWidth:g(),frameHeight:g().optional(),width:g(),height:g(),background:La.array(),hotspots:it.array().optional(),obstacleAreas:S(rt.array()),walkableAreas:S(rt.array()),scaling:S(Fa),backgroundColor:c().optional(),name:c().optional(),narrative:I.optional(),backgroundMusic:Oe.optional(),ambientNoise:Oe.optional()}),Se=h({imageId:c(),row:g(),col:g()}),Wa=h({left:Se.array().optional(),right:Se.array().optional(),up:Se.array().optional(),down:Se.array().optional()}),ct=h({id:c(),defaultDirection:K,animations:z(c(),Wa)}),Ft=q(["center","left","right"]),Wt=q(["center","top","bottom"]),Ua=h({x:Ft,y:Wt,width:g().optional(),height:g().optional(),aspectRatio:Et.optional()}).merge(h({image:ye})),Ut=h({title:c(),narrative:I,pictures:Ua.array(),backgroundColor:c(),color:c()}),Gt=q(["sound","buttons"]),Ht=q(["serif","sans-serif","monospace","cursive","fantasy","math"]),dt=h({id:c(),isEndOfGame:T().optional(),pages:Ut.array(),font:Ht.optional(),sound:Oe.optional(),progression:Gt.optional()}),je=h({id:c(),label:c(),preposition:c().optional(),isMoveVerb:T().optional(),isNotForItems:T().optional(),isLookVerb:T().optional(),requiresItem:T().optional(),defaultResponseNoItem:c().optional(),defaultResponseWithItem:c().optional(),defaultResponseCannotReach:c().optional()}),Ga=h({schemaVersion:g().optional(),rooms:ot.array(),items:_e.array(),actors:qe.array(),interactions:tt.array(),conversations:at.array(),flagMap:st,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),Ha=h({verbs:je.array(),sequences:Ee.array(),sprites:ct.array(),endings:Ke.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:dt.array().optional()}),Jt=Ga.and(Ha).describe("The game schema"),De=4,Yt=h({sequenceRunning:ve.optional(),currentStoryBoardId:c().optional(),actorOrders:z(c(),ge.array()),currentConversationId:c().optional(),pendingInteraction:Ze.optional(),gameNotBegun:T()}),Ve=h({schemaVersion:w(De),rooms:ot.array(),items:_e.array(),actors:qe.array(),interactions:Ze.array(),conversations:Qe.array(),flagMap:st,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),ut=h({verbs:je.array(),sequences:ve.array(),sprites:ct.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:dt.array()}),Ja=Ve.and(Yt),Xt=Ve.and(ut).describe("The game schema"),Ya=q(["rooms","items","actors","conversations","sprites","sequences","verbs","storyBoards"]),Xa=Ve.merge(h({schemaVersion:w(3),interactions:tt.array(),conversations:at.array()})),Qa=ut.merge(h({endings:Ke.array(),sequences:Ee.array()})),Qt=Xa.and(Qa).describe("The game schema"),Kt=Q([qe,_e,it]),Ka=h({verb:je,target:Kt,item:S(_e)}),en=a=>({...a,storyBoards:a.storyBoards??[],schemaVersion:3}),tn=a=>ea(en(a)),an=(a,e)=>{const t=a.imageId?{x:"center",y:"center",width:a.imageWidth?a.imageWidth/16:20,height:a.imageWidth?a.imageWidth/16:20,image:{imageId:a.imageId}}:void 0;return{id:e??a.id,isEndOfGame:!0,pages:[{title:a.message,narrative:{text:[]},color:"#FFFFFF",backgroundColor:"#000000",pictures:t?[t]:[]}]}},nn=(a,e)=>{const t=e.filter(s=>s.startsWith(a)),n=(s=1)=>{const r=`${a}_${s}`;return t.includes(r)?n(s+1):r};return n()},ea=a=>{const{storyBoards:e,interactions:t,sequences:n,conversations:s}=a,r=e.map(O=>O.id),i={},o=a.endings.map(O=>{const E=r.includes(O.id)?nn(O.id,r):void 0;return E&&r.push(E),i[O.id]=E??O.id,an(O,E)}),p=O=>O.type!=="ending"?O:{type:"storyBoardConsequence",storyBoardId:i[O.endingId]??O.endingId,narrative:O.narrative},y=O=>({...O,stages:O.stages.map(E=>({...E,immediateConsequences:E.immediateConsequences?.map(p)}))}),x=O=>{const{branches:E}=O;for(let on in E){const ht=E[on];ht&&(ht.choices=ht.choices.map(mt=>({...mt,choiceSequence:mt.choiceSequence?y(mt.choiceSequence):void 0})))}return{...O,branches:E}},W=t.map(O=>({...O,consequences:O.consequences.map(p)})),lt=n.map(y),rn=s.map(x);return{...a,storyBoards:[...e,...o],interactions:W,sequences:lt,conversations:rn,schemaVersion:De}},sn=a=>{const e=Xt.safeParse(a);if(e.success)return{success:!0,gameDesign:e.data,sourceVersion:De,updated:!1};const t=Qt.safeParse(a);if(t.success)return{success:!0,gameDesign:ea(t.data),sourceVersion:3,updated:!0};const n=Jt.safeParse(a);return n.success?{success:!0,gameDesign:tn(n.data),sourceVersion:2,updated:!0}:{success:!1,failureMessage:n.error.message}};return u.ActOrderSchema=Vt,u.ActorDataSchema=qe,u.AmbientNoiseConsequenceSchema=de,u.AspectRatioSchema=Et,u.BackgroundMusicConsequenceSchema=ce,u.BoardFontSchema=Ht,u.BoardProgressionSchema=Gt,u.ChangePlayerCharacterConsequenceSchema=he,u.ChangeRoomConsequenceSchema=ee,u.ChangeStatusConsequenceSchema=ne,u.CommandSchema=Ka,u.CommandTargetSchema=Kt,u.ConsequenceSchema=Pt,u.ConversationBranchSchema=Bt,u.ConversationChoiceConsequenceSchema=re,u.ConversationChoiceSchema=Xe,u.ConversationConsequenceSchema=se,u.ConversationSchema=Qe,u.ConversationSchemaWithDeprecatedConsequences=at,u.DB_VERSION=De,u.DirectionEnum=K,u.EndingConsequenceSchema=et,u.EndingSchema=Ke,u.FixedGameInfoSchema=ut,u.FlagConsequenceSchema=ue,u.FlagMapSchema=st,u.FlagSchema=zt,u.GameContentsDataSchema=Ve,u.GameDataItemTypeEnum=Ya,u.GameDataSchema=Ja,u.GameDesignSchema=Xt,u.GameHappeningsSchema=Yt,u.GotoOrderSchema=jt,u.HotspotZoneSchema=it,u.IdentSchema=Ie,u.ImmediateConsequenceSchema=Je,u.ImmediateConsequenceSchemaWithDeprecated=Mt,u.InteractionSchema=Ze,u.InteractionSchemaWithDeprecatedConsequences=tt,u.InventoryConsequenceSchema=te,u.ItemDataSchema=_e,u.MoveOrderSchema=qt,u.NarrativeSchema=I,u.OrderConsequenceSchema=Re,u.PositionSchema=Zt,u.RemoveActorConsequenceSchema=ae,u.RoomDataSchema=ot,u.SayOrderSchema=Dt,u.SequenceConsequenceSchema=Ne,u.SequenceSchema=ve,u.SequenceSchemaWithDeprecatedConsequences=Ee,u.SoundEffectConsequenceSchema=oe,u.SoundValueSchema=nt,u.SpriteDataSchema=ct,u.SpriteFrameSchema=Se,u.SpriteParamsSchema=Nt,u.StageSchema=Ye,u.StaticFrameParamsSchema=ye,u.StoryBoardConsequenceSchema=le,u.StoryBoardPageSchema=Ut,u.StoryBoardSchema=dt,u.TeleportActorConsequenceSchema=ie,u.ToggleZoneConsequenceSchema=F,u.VerbSchema=je,u.ZoneSchema=rt,u.changeHistory=ta,u.consequenceMap=Da,u.consequenceTypes=ja,u.directions=Aa,u.immediateConsequenceTypes=Va,u.orderBaseOmits=Ra,u.orderSchema=ge,u.orderTypes=Ea,u.parseAndUpgrade=sn,u.soundInstanceSchema=Oe,u.v2GameDesignSchema=Jt,u.v3GameDesignSchema=Qt,u.xPlacement=Ft,u.yPlacement=Wt,u.zoneTypes=qa,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u})({});
1
+ var PointClickLib=(function(R){"use strict";const sf=[{schemaVersion:3,changes:[{breaking:!1,description:"Designs have schemaVersion property"},{breaking:!1,description:"storyBoards array is required"}]},{schemaVersion:4,changes:[{breaking:!0,description:"Endings deprecated in favour of storyBoards. Any Endings have been converted to Storyboards."},{breaking:!1,description:"StoryBoards have end of game option."}]}];var fe;(function(s){s.assertEqual=u=>{};function r(u){}s.assertIs=r;function i(u){throw new Error}s.assertNever=i,s.arrayToEnum=u=>{const c={};for(const h of u)c[h]=h;return c},s.getValidEnumValues=u=>{const c=s.objectKeys(u).filter(g=>typeof u[u[g]]!="number"),h={};for(const g of c)h[g]=u[g];return s.objectValues(h)},s.objectValues=u=>s.objectKeys(u).map(function(c){return u[c]}),s.objectKeys=typeof Object.keys=="function"?u=>Object.keys(u):u=>{const c=[];for(const h in u)Object.prototype.hasOwnProperty.call(u,h)&&c.push(h);return c},s.find=(u,c)=>{for(const h of u)if(c(h))return h},s.isInteger=typeof Number.isInteger=="function"?u=>Number.isInteger(u):u=>typeof u=="number"&&Number.isFinite(u)&&Math.floor(u)===u;function o(u,c=" | "){return u.map(h=>typeof h=="string"?`'${h}'`:h).join(c)}s.joinValues=o,s.jsonStringifyReplacer=(u,c)=>typeof c=="bigint"?c.toString():c})(fe||(fe={}));var ps;(function(s){s.mergeShapes=(r,i)=>({...r,...i})})(ps||(ps={}));const F=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tt=s=>{switch(typeof s){case"undefined":return F.undefined;case"string":return F.string;case"number":return Number.isNaN(s)?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(s)?F.array:s===null?F.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?F.promise:typeof Map<"u"&&s instanceof Map?F.map:typeof Set<"u"&&s instanceof Set?F.set:typeof Date<"u"&&s instanceof Date?F.date:F.object;default:return F.unknown}},k=fe.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"]),af=s=>JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:");class Ye extends Error{get errors(){return this.issues}constructor(r){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=r}format(r){const i=r||function(c){return c.message},o={_errors:[]},u=c=>{for(const h of c.issues)if(h.code==="invalid_union")h.unionErrors.map(u);else if(h.code==="invalid_return_type")u(h.returnTypeError);else if(h.code==="invalid_arguments")u(h.argumentsError);else if(h.path.length===0)o._errors.push(i(h));else{let g=o,m=0;for(;m<h.path.length;){const v=h.path[m];m===h.path.length-1?(g[v]=g[v]||{_errors:[]},g[v]._errors.push(i(h))):g[v]=g[v]||{_errors:[]},g=g[v],m++}}};return u(this),o}static assert(r){if(!(r instanceof Ye))throw new Error(`Not a ZodError: ${r}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=i=>i.message){const i={},o=[];for(const u of this.issues)if(u.path.length>0){const c=u.path[0];i[c]=i[c]||[],i[c].push(r(u))}else o.push(r(u));return{formErrors:o,fieldErrors:i}}get formErrors(){return this.flatten()}}Ye.create=s=>new Ye(s);const yn=(s,r)=>{let i;switch(s.code){case k.invalid_type:s.received===F.undefined?i="Required":i=`Expected ${s.expected}, received ${s.received}`;break;case k.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(s.expected,fe.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:i=`Unrecognized key(s) in object: ${fe.joinValues(s.keys,", ")}`;break;case k.invalid_union:i="Invalid input";break;case k.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${fe.joinValues(s.options)}`;break;case k.invalid_enum_value:i=`Invalid enum value. Expected ${fe.joinValues(s.options)}, received '${s.received}'`;break;case k.invalid_arguments:i="Invalid function arguments";break;case k.invalid_return_type:i="Invalid function return type";break;case k.invalid_date:i="Invalid date";break;case k.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(i=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?i=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?i=`Invalid input: must end with "${s.validation.endsWith}"`:fe.assertNever(s.validation):s.validation!=="regex"?i=`Invalid ${s.validation}`:i="Invalid";break;case k.too_small:s.type==="array"?i=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?i=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?i=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?i=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?i=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:i="Invalid input";break;case k.too_big:s.type==="array"?i=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?i=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?i=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?i=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?i=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:i="Invalid input";break;case k.custom:i="Invalid input";break;case k.invalid_intersection_types:i="Intersection results could not be merged";break;case k.not_multiple_of:i=`Number must be a multiple of ${s.multipleOf}`;break;case k.not_finite:i="Number must be finite";break;default:i=r.defaultError,fe.assertNever(s)}return{message:i}};let lo=yn;function of(s){lo=s}function Kr(){return lo}const Jr=s=>{const{data:r,path:i,errorMaps:o,issueData:u}=s,c=[...i,...u.path||[]],h={...u,path:c};if(u.message!==void 0)return{...u,path:c,message:u.message};let g="";const m=o.filter(v=>!!v).slice().reverse();for(const v of m)g=v(h,{data:r,defaultError:g}).message;return{...u,path:c,message:g}},uf=[];function N(s,r){const i=Kr(),o=Jr({issueData:r,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,i,i===yn?void 0:yn].filter(u=>!!u)});s.common.issues.push(o)}class Pe{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(r,i){const o=[];for(const u of i){if(u.status==="aborted")return Y;u.status==="dirty"&&r.dirty(),o.push(u.value)}return{status:r.value,value:o}}static async mergeObjectAsync(r,i){const o=[];for(const u of i){const c=await u.key,h=await u.value;o.push({key:c,value:h})}return Pe.mergeObjectSync(r,o)}static mergeObjectSync(r,i){const o={};for(const u of i){const{key:c,value:h}=u;if(c.status==="aborted"||h.status==="aborted")return Y;c.status==="dirty"&&r.dirty(),h.status==="dirty"&&r.dirty(),c.value!=="__proto__"&&(typeof h.value<"u"||u.alwaysSet)&&(o[c.value]=h.value)}return{status:r.value,value:o}}}const Y=Object.freeze({status:"aborted"}),xn=s=>({status:"dirty",value:s}),Fe=s=>({status:"valid",value:s}),gs=s=>s.status==="aborted",ms=s=>s.status==="dirty",tn=s=>s.status==="valid",tr=s=>typeof Promise<"u"&&s instanceof Promise;var G;(function(s){s.errToObj=r=>typeof r=="string"?{message:r}:r||{},s.toString=r=>typeof r=="string"?r:r?.message})(G||(G={}));class xt{constructor(r,i,o,u){this._cachedPath=[],this.parent=r,this.data=i,this._path=o,this._key=u}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const fo=(s,r)=>{if(tn(r))return{success:!0,data:r.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new Ye(s.common.issues);return this._error=i,this._error}}};function te(s){if(!s)return{};const{errorMap:r,invalid_type_error:i,required_error:o,description:u}=s;if(r&&(i||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return r?{errorMap:r,description:u}:{errorMap:(h,g)=>{const{message:m}=s;return h.code==="invalid_enum_value"?{message:m??g.defaultError}:typeof g.data>"u"?{message:m??o??g.defaultError}:h.code!=="invalid_type"?{message:g.defaultError}:{message:m??i??g.defaultError}},description:u}}class ie{get description(){return this._def.description}_getType(r){return Tt(r.data)}_getOrReturnCtx(r,i){return i||{common:r.parent.common,data:r.data,parsedType:Tt(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new Pe,ctx:{common:r.parent.common,data:r.data,parsedType:Tt(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const i=this._parse(r);if(tr(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(r){const i=this._parse(r);return Promise.resolve(i)}parse(r,i){const o=this.safeParse(r,i);if(o.success)return o.data;throw o.error}safeParse(r,i){const o={common:{issues:[],async:i?.async??!1,contextualErrorMap:i?.errorMap},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:Tt(r)},u=this._parseSync({data:r,path:o.path,parent:o});return fo(o,u)}"~validate"(r){const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:Tt(r)};if(!this["~standard"].async)try{const o=this._parseSync({data:r,path:[],parent:i});return tn(o)?{value:o.value}:{issues:i.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:r,path:[],parent:i}).then(o=>tn(o)?{value:o.value}:{issues:i.common.issues})}async parseAsync(r,i){const o=await this.safeParseAsync(r,i);if(o.success)return o.data;throw o.error}async safeParseAsync(r,i){const o={common:{issues:[],contextualErrorMap:i?.errorMap,async:!0},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:Tt(r)},u=this._parse({data:r,path:o.path,parent:o}),c=await(tr(u)?u:Promise.resolve(u));return fo(o,c)}refine(r,i){const o=u=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(u):i;return this._refinement((u,c)=>{const h=r(u),g=()=>c.addIssue({code:k.custom,...o(u)});return typeof Promise<"u"&&h instanceof Promise?h.then(m=>m?!0:(g(),!1)):h?!0:(g(),!1)})}refinement(r,i){return this._refinement((o,u)=>r(o)?!0:(u.addIssue(typeof i=="function"?i(o,u):i),!1))}_refinement(r){return new ht({schema:this,typeName:J.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}constructor(r){this.spa=this.safeParseAsync,this._def=r,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:i=>this["~validate"](i)}}optional(){return bt.create(this,this._def)}nullable(){return $t.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return dt.create(this)}promise(){return In.create(this,this._def)}or(r){return sr.create([this,r],this._def)}and(r){return ar.create(this,r,this._def)}transform(r){return new ht({...te(this._def),schema:this,typeName:J.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const i=typeof r=="function"?r:()=>r;return new fr({...te(this._def),innerType:this,defaultValue:i,typeName:J.ZodDefault})}brand(){return new ys({typeName:J.ZodBranded,type:this,...te(this._def)})}catch(r){const i=typeof r=="function"?r:()=>r;return new dr({...te(this._def),innerType:this,catchValue:i,typeName:J.ZodCatch})}describe(r){const i=this.constructor;return new i({...this._def,description:r})}pipe(r){return hr.create(this,r)}readonly(){return pr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cf=/^c[^\s-]{8,}$/i,lf=/^[0-9a-z]+$/,ff=/^[0-9A-HJKMNP-TV-Z]{26}$/i,df=/^[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,hf=/^[a-z0-9_-]{21}$/i,pf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gf=/^[-+]?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)?)??$/,mf=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_f="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let _s;const vf=/^(?:(?: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])$/,yf=/^(?:(?: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])$/,xf=/^(([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]))$/,wf=/^(([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])$/,bf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Sf=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ho="((\\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])))",If=new RegExp(`^${ho}$`);function po(s){let r="[0-5]\\d";s.precision?r=`${r}\\.\\d{${s.precision}}`:s.precision==null&&(r=`${r}(\\.\\d+)?`);const i=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${i}`}function Cf(s){return new RegExp(`^${po(s)}$`)}function go(s){let r=`${ho}T${po(s)}`;const i=[];return i.push(s.local?"Z?":"Z"),s.offset&&i.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${i.join("|")})`,new RegExp(`^${r}$`)}function Af(s,r){return!!((r==="v4"||!r)&&vf.test(s)||(r==="v6"||!r)&&xf.test(s))}function Tf(s,r){if(!pf.test(s))return!1;try{const[i]=s.split(".");if(!i)return!1;const o=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),u=JSON.parse(atob(o));return!(typeof u!="object"||u===null||"typ"in u&&u?.typ!=="JWT"||!u.alg||r&&u.alg!==r)}catch{return!1}}function Rf(s,r){return!!((r==="v4"||!r)&&yf.test(s)||(r==="v6"||!r)&&wf.test(s))}class ft extends ie{_parse(r){if(this._def.coerce&&(r.data=String(r.data)),this._getType(r)!==F.string){const c=this._getOrReturnCtx(r);return N(c,{code:k.invalid_type,expected:F.string,received:c.parsedType}),Y}const o=new Pe;let u;for(const c of this._def.checks)if(c.kind==="min")r.data.length<c.value&&(u=this._getOrReturnCtx(r,u),N(u,{code:k.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),o.dirty());else if(c.kind==="max")r.data.length>c.value&&(u=this._getOrReturnCtx(r,u),N(u,{code:k.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!1,message:c.message}),o.dirty());else if(c.kind==="length"){const h=r.data.length>c.value,g=r.data.length<c.value;(h||g)&&(u=this._getOrReturnCtx(r,u),h?N(u,{code:k.too_big,maximum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}):g&&N(u,{code:k.too_small,minimum:c.value,type:"string",inclusive:!0,exact:!0,message:c.message}),o.dirty())}else if(c.kind==="email")mf.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"email",code:k.invalid_string,message:c.message}),o.dirty());else if(c.kind==="emoji")_s||(_s=new RegExp(_f,"u")),_s.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"emoji",code:k.invalid_string,message:c.message}),o.dirty());else if(c.kind==="uuid")df.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"uuid",code:k.invalid_string,message:c.message}),o.dirty());else if(c.kind==="nanoid")hf.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"nanoid",code:k.invalid_string,message:c.message}),o.dirty());else if(c.kind==="cuid")cf.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"cuid",code:k.invalid_string,message:c.message}),o.dirty());else if(c.kind==="cuid2")lf.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"cuid2",code:k.invalid_string,message:c.message}),o.dirty());else if(c.kind==="ulid")ff.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"ulid",code:k.invalid_string,message:c.message}),o.dirty());else if(c.kind==="url")try{new URL(r.data)}catch{u=this._getOrReturnCtx(r,u),N(u,{validation:"url",code:k.invalid_string,message:c.message}),o.dirty()}else c.kind==="regex"?(c.regex.lastIndex=0,c.regex.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"regex",code:k.invalid_string,message:c.message}),o.dirty())):c.kind==="trim"?r.data=r.data.trim():c.kind==="includes"?r.data.includes(c.value,c.position)||(u=this._getOrReturnCtx(r,u),N(u,{code:k.invalid_string,validation:{includes:c.value,position:c.position},message:c.message}),o.dirty()):c.kind==="toLowerCase"?r.data=r.data.toLowerCase():c.kind==="toUpperCase"?r.data=r.data.toUpperCase():c.kind==="startsWith"?r.data.startsWith(c.value)||(u=this._getOrReturnCtx(r,u),N(u,{code:k.invalid_string,validation:{startsWith:c.value},message:c.message}),o.dirty()):c.kind==="endsWith"?r.data.endsWith(c.value)||(u=this._getOrReturnCtx(r,u),N(u,{code:k.invalid_string,validation:{endsWith:c.value},message:c.message}),o.dirty()):c.kind==="datetime"?go(c).test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{code:k.invalid_string,validation:"datetime",message:c.message}),o.dirty()):c.kind==="date"?If.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{code:k.invalid_string,validation:"date",message:c.message}),o.dirty()):c.kind==="time"?Cf(c).test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{code:k.invalid_string,validation:"time",message:c.message}),o.dirty()):c.kind==="duration"?gf.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"duration",code:k.invalid_string,message:c.message}),o.dirty()):c.kind==="ip"?Af(r.data,c.version)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"ip",code:k.invalid_string,message:c.message}),o.dirty()):c.kind==="jwt"?Tf(r.data,c.alg)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"jwt",code:k.invalid_string,message:c.message}),o.dirty()):c.kind==="cidr"?Rf(r.data,c.version)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"cidr",code:k.invalid_string,message:c.message}),o.dirty()):c.kind==="base64"?bf.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"base64",code:k.invalid_string,message:c.message}),o.dirty()):c.kind==="base64url"?Sf.test(r.data)||(u=this._getOrReturnCtx(r,u),N(u,{validation:"base64url",code:k.invalid_string,message:c.message}),o.dirty()):fe.assertNever(c);return{status:o.value,value:r.data}}_regex(r,i,o){return this.refinement(u=>r.test(u),{validation:i,code:k.invalid_string,...G.errToObj(o)})}_addCheck(r){return new ft({...this._def,checks:[...this._def.checks,r]})}email(r){return this._addCheck({kind:"email",...G.errToObj(r)})}url(r){return this._addCheck({kind:"url",...G.errToObj(r)})}emoji(r){return this._addCheck({kind:"emoji",...G.errToObj(r)})}uuid(r){return this._addCheck({kind:"uuid",...G.errToObj(r)})}nanoid(r){return this._addCheck({kind:"nanoid",...G.errToObj(r)})}cuid(r){return this._addCheck({kind:"cuid",...G.errToObj(r)})}cuid2(r){return this._addCheck({kind:"cuid2",...G.errToObj(r)})}ulid(r){return this._addCheck({kind:"ulid",...G.errToObj(r)})}base64(r){return this._addCheck({kind:"base64",...G.errToObj(r)})}base64url(r){return this._addCheck({kind:"base64url",...G.errToObj(r)})}jwt(r){return this._addCheck({kind:"jwt",...G.errToObj(r)})}ip(r){return this._addCheck({kind:"ip",...G.errToObj(r)})}cidr(r){return this._addCheck({kind:"cidr",...G.errToObj(r)})}datetime(r){return typeof r=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck({kind:"datetime",precision:typeof r?.precision>"u"?null:r?.precision,offset:r?.offset??!1,local:r?.local??!1,...G.errToObj(r?.message)})}date(r){return this._addCheck({kind:"date",message:r})}time(r){return typeof r=="string"?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck({kind:"time",precision:typeof r?.precision>"u"?null:r?.precision,...G.errToObj(r?.message)})}duration(r){return this._addCheck({kind:"duration",...G.errToObj(r)})}regex(r,i){return this._addCheck({kind:"regex",regex:r,...G.errToObj(i)})}includes(r,i){return this._addCheck({kind:"includes",value:r,position:i?.position,...G.errToObj(i?.message)})}startsWith(r,i){return this._addCheck({kind:"startsWith",value:r,...G.errToObj(i)})}endsWith(r,i){return this._addCheck({kind:"endsWith",value:r,...G.errToObj(i)})}min(r,i){return this._addCheck({kind:"min",value:r,...G.errToObj(i)})}max(r,i){return this._addCheck({kind:"max",value:r,...G.errToObj(i)})}length(r,i){return this._addCheck({kind:"length",value:r,...G.errToObj(i)})}nonempty(r){return this.min(1,G.errToObj(r))}trim(){return new ft({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ft({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ft({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(r=>r.kind==="datetime")}get isDate(){return!!this._def.checks.find(r=>r.kind==="date")}get isTime(){return!!this._def.checks.find(r=>r.kind==="time")}get isDuration(){return!!this._def.checks.find(r=>r.kind==="duration")}get isEmail(){return!!this._def.checks.find(r=>r.kind==="email")}get isURL(){return!!this._def.checks.find(r=>r.kind==="url")}get isEmoji(){return!!this._def.checks.find(r=>r.kind==="emoji")}get isUUID(){return!!this._def.checks.find(r=>r.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(r=>r.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(r=>r.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(r=>r.kind==="cuid2")}get isULID(){return!!this._def.checks.find(r=>r.kind==="ulid")}get isIP(){return!!this._def.checks.find(r=>r.kind==="ip")}get isCIDR(){return!!this._def.checks.find(r=>r.kind==="cidr")}get isBase64(){return!!this._def.checks.find(r=>r.kind==="base64")}get isBase64url(){return!!this._def.checks.find(r=>r.kind==="base64url")}get minLength(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxLength(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}}ft.create=s=>new ft({checks:[],typeName:J.ZodString,coerce:s?.coerce??!1,...te(s)});function kf(s,r){const i=(s.toString().split(".")[1]||"").length,o=(r.toString().split(".")[1]||"").length,u=i>o?i:o,c=Number.parseInt(s.toFixed(u).replace(".","")),h=Number.parseInt(r.toFixed(u).replace(".",""));return c%h/10**u}class Zt extends ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){if(this._def.coerce&&(r.data=Number(r.data)),this._getType(r)!==F.number){const c=this._getOrReturnCtx(r);return N(c,{code:k.invalid_type,expected:F.number,received:c.parsedType}),Y}let o;const u=new Pe;for(const c of this._def.checks)c.kind==="int"?fe.isInteger(r.data)||(o=this._getOrReturnCtx(r,o),N(o,{code:k.invalid_type,expected:"integer",received:"float",message:c.message}),u.dirty()):c.kind==="min"?(c.inclusive?r.data<c.value:r.data<=c.value)&&(o=this._getOrReturnCtx(r,o),N(o,{code:k.too_small,minimum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),u.dirty()):c.kind==="max"?(c.inclusive?r.data>c.value:r.data>=c.value)&&(o=this._getOrReturnCtx(r,o),N(o,{code:k.too_big,maximum:c.value,type:"number",inclusive:c.inclusive,exact:!1,message:c.message}),u.dirty()):c.kind==="multipleOf"?kf(r.data,c.value)!==0&&(o=this._getOrReturnCtx(r,o),N(o,{code:k.not_multiple_of,multipleOf:c.value,message:c.message}),u.dirty()):c.kind==="finite"?Number.isFinite(r.data)||(o=this._getOrReturnCtx(r,o),N(o,{code:k.not_finite,message:c.message}),u.dirty()):fe.assertNever(c);return{status:u.value,value:r.data}}gte(r,i){return this.setLimit("min",r,!0,G.toString(i))}gt(r,i){return this.setLimit("min",r,!1,G.toString(i))}lte(r,i){return this.setLimit("max",r,!0,G.toString(i))}lt(r,i){return this.setLimit("max",r,!1,G.toString(i))}setLimit(r,i,o,u){return new Zt({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:o,message:G.toString(u)}]})}_addCheck(r){return new Zt({...this._def,checks:[...this._def.checks,r]})}int(r){return this._addCheck({kind:"int",message:G.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:G.toString(i)})}finite(r){return this._addCheck({kind:"finite",message:G.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(r)})}get minValue(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}get isInt(){return!!this._def.checks.find(r=>r.kind==="int"||r.kind==="multipleOf"&&fe.isInteger(r.value))}get isFinite(){let r=null,i=null;for(const o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(i===null||o.value>i)&&(i=o.value):o.kind==="max"&&(r===null||o.value<r)&&(r=o.value)}return Number.isFinite(i)&&Number.isFinite(r)}}Zt.create=s=>new Zt({checks:[],typeName:J.ZodNumber,coerce:s?.coerce||!1,...te(s)});class Gt extends ie{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){if(this._def.coerce)try{r.data=BigInt(r.data)}catch{return this._getInvalidInput(r)}if(this._getType(r)!==F.bigint)return this._getInvalidInput(r);let o;const u=new Pe;for(const c of this._def.checks)c.kind==="min"?(c.inclusive?r.data<c.value:r.data<=c.value)&&(o=this._getOrReturnCtx(r,o),N(o,{code:k.too_small,type:"bigint",minimum:c.value,inclusive:c.inclusive,message:c.message}),u.dirty()):c.kind==="max"?(c.inclusive?r.data>c.value:r.data>=c.value)&&(o=this._getOrReturnCtx(r,o),N(o,{code:k.too_big,type:"bigint",maximum:c.value,inclusive:c.inclusive,message:c.message}),u.dirty()):c.kind==="multipleOf"?r.data%c.value!==BigInt(0)&&(o=this._getOrReturnCtx(r,o),N(o,{code:k.not_multiple_of,multipleOf:c.value,message:c.message}),u.dirty()):fe.assertNever(c);return{status:u.value,value:r.data}}_getInvalidInput(r){const i=this._getOrReturnCtx(r);return N(i,{code:k.invalid_type,expected:F.bigint,received:i.parsedType}),Y}gte(r,i){return this.setLimit("min",r,!0,G.toString(i))}gt(r,i){return this.setLimit("min",r,!1,G.toString(i))}lte(r,i){return this.setLimit("max",r,!0,G.toString(i))}lt(r,i){return this.setLimit("max",r,!1,G.toString(i))}setLimit(r,i,o,u){return new Gt({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:o,message:G.toString(u)}]})}_addCheck(r){return new Gt({...this._def,checks:[...this._def.checks,r]})}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:G.toString(i)})}get minValue(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}}Gt.create=s=>new Gt({checks:[],typeName:J.ZodBigInt,coerce:s?.coerce??!1,...te(s)});class nr extends ie{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==F.boolean){const o=this._getOrReturnCtx(r);return N(o,{code:k.invalid_type,expected:F.boolean,received:o.parsedType}),Y}return Fe(r.data)}}nr.create=s=>new nr({typeName:J.ZodBoolean,coerce:s?.coerce||!1,...te(s)});class nn extends ie{_parse(r){if(this._def.coerce&&(r.data=new Date(r.data)),this._getType(r)!==F.date){const c=this._getOrReturnCtx(r);return N(c,{code:k.invalid_type,expected:F.date,received:c.parsedType}),Y}if(Number.isNaN(r.data.getTime())){const c=this._getOrReturnCtx(r);return N(c,{code:k.invalid_date}),Y}const o=new Pe;let u;for(const c of this._def.checks)c.kind==="min"?r.data.getTime()<c.value&&(u=this._getOrReturnCtx(r,u),N(u,{code:k.too_small,message:c.message,inclusive:!0,exact:!1,minimum:c.value,type:"date"}),o.dirty()):c.kind==="max"?r.data.getTime()>c.value&&(u=this._getOrReturnCtx(r,u),N(u,{code:k.too_big,message:c.message,inclusive:!0,exact:!1,maximum:c.value,type:"date"}),o.dirty()):fe.assertNever(c);return{status:o.value,value:new Date(r.data.getTime())}}_addCheck(r){return new nn({...this._def,checks:[...this._def.checks,r]})}min(r,i){return this._addCheck({kind:"min",value:r.getTime(),message:G.toString(i)})}max(r,i){return this._addCheck({kind:"max",value:r.getTime(),message:G.toString(i)})}get minDate(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r!=null?new Date(r):null}get maxDate(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r!=null?new Date(r):null}}nn.create=s=>new nn({checks:[],coerce:s?.coerce||!1,typeName:J.ZodDate,...te(s)});class jr extends ie{_parse(r){if(this._getType(r)!==F.symbol){const o=this._getOrReturnCtx(r);return N(o,{code:k.invalid_type,expected:F.symbol,received:o.parsedType}),Y}return Fe(r.data)}}jr.create=s=>new jr({typeName:J.ZodSymbol,...te(s)});class rr extends ie{_parse(r){if(this._getType(r)!==F.undefined){const o=this._getOrReturnCtx(r);return N(o,{code:k.invalid_type,expected:F.undefined,received:o.parsedType}),Y}return Fe(r.data)}}rr.create=s=>new rr({typeName:J.ZodUndefined,...te(s)});class ir extends ie{_parse(r){if(this._getType(r)!==F.null){const o=this._getOrReturnCtx(r);return N(o,{code:k.invalid_type,expected:F.null,received:o.parsedType}),Y}return Fe(r.data)}}ir.create=s=>new ir({typeName:J.ZodNull,...te(s)});class wn extends ie{constructor(){super(...arguments),this._any=!0}_parse(r){return Fe(r.data)}}wn.create=s=>new wn({typeName:J.ZodAny,...te(s)});class rn extends ie{constructor(){super(...arguments),this._unknown=!0}_parse(r){return Fe(r.data)}}rn.create=s=>new rn({typeName:J.ZodUnknown,...te(s)});class Rt extends ie{_parse(r){const i=this._getOrReturnCtx(r);return N(i,{code:k.invalid_type,expected:F.never,received:i.parsedType}),Y}}Rt.create=s=>new Rt({typeName:J.ZodNever,...te(s)});class Qr extends ie{_parse(r){if(this._getType(r)!==F.undefined){const o=this._getOrReturnCtx(r);return N(o,{code:k.invalid_type,expected:F.void,received:o.parsedType}),Y}return Fe(r.data)}}Qr.create=s=>new Qr({typeName:J.ZodVoid,...te(s)});class dt extends ie{_parse(r){const{ctx:i,status:o}=this._processInputParams(r),u=this._def;if(i.parsedType!==F.array)return N(i,{code:k.invalid_type,expected:F.array,received:i.parsedType}),Y;if(u.exactLength!==null){const h=i.data.length>u.exactLength.value,g=i.data.length<u.exactLength.value;(h||g)&&(N(i,{code:h?k.too_big:k.too_small,minimum:g?u.exactLength.value:void 0,maximum:h?u.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:u.exactLength.message}),o.dirty())}if(u.minLength!==null&&i.data.length<u.minLength.value&&(N(i,{code:k.too_small,minimum:u.minLength.value,type:"array",inclusive:!0,exact:!1,message:u.minLength.message}),o.dirty()),u.maxLength!==null&&i.data.length>u.maxLength.value&&(N(i,{code:k.too_big,maximum:u.maxLength.value,type:"array",inclusive:!0,exact:!1,message:u.maxLength.message}),o.dirty()),i.common.async)return Promise.all([...i.data].map((h,g)=>u.type._parseAsync(new xt(i,h,i.path,g)))).then(h=>Pe.mergeArray(o,h));const c=[...i.data].map((h,g)=>u.type._parseSync(new xt(i,h,i.path,g)));return Pe.mergeArray(o,c)}get element(){return this._def.type}min(r,i){return new dt({...this._def,minLength:{value:r,message:G.toString(i)}})}max(r,i){return new dt({...this._def,maxLength:{value:r,message:G.toString(i)}})}length(r,i){return new dt({...this._def,exactLength:{value:r,message:G.toString(i)}})}nonempty(r){return this.min(1,r)}}dt.create=(s,r)=>new dt({type:s,minLength:null,maxLength:null,exactLength:null,typeName:J.ZodArray,...te(r)});function bn(s){if(s instanceof be){const r={};for(const i in s.shape){const o=s.shape[i];r[i]=bt.create(bn(o))}return new be({...s._def,shape:()=>r})}else return s instanceof dt?new dt({...s._def,type:bn(s.element)}):s instanceof bt?bt.create(bn(s.unwrap())):s instanceof $t?$t.create(bn(s.unwrap())):s instanceof wt?wt.create(s.items.map(r=>bn(r))):s}class be extends ie{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const r=this._def.shape(),i=fe.objectKeys(r);return this._cached={shape:r,keys:i},this._cached}_parse(r){if(this._getType(r)!==F.object){const v=this._getOrReturnCtx(r);return N(v,{code:k.invalid_type,expected:F.object,received:v.parsedType}),Y}const{status:o,ctx:u}=this._processInputParams(r),{shape:c,keys:h}=this._getCached(),g=[];if(!(this._def.catchall instanceof Rt&&this._def.unknownKeys==="strip"))for(const v in u.data)h.includes(v)||g.push(v);const m=[];for(const v of h){const w=c[v],O=u.data[v];m.push({key:{status:"valid",value:v},value:w._parse(new xt(u,O,u.path,v)),alwaysSet:v in u.data})}if(this._def.catchall instanceof Rt){const v=this._def.unknownKeys;if(v==="passthrough")for(const w of g)m.push({key:{status:"valid",value:w},value:{status:"valid",value:u.data[w]}});else if(v==="strict")g.length>0&&(N(u,{code:k.unrecognized_keys,keys:g}),o.dirty());else if(v!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const v=this._def.catchall;for(const w of g){const O=u.data[w];m.push({key:{status:"valid",value:w},value:v._parse(new xt(u,O,u.path,w)),alwaysSet:w in u.data})}}return u.common.async?Promise.resolve().then(async()=>{const v=[];for(const w of m){const O=await w.key,q=await w.value;v.push({key:O,value:q,alwaysSet:w.alwaysSet})}return v}).then(v=>Pe.mergeObjectSync(o,v)):Pe.mergeObjectSync(o,m)}get shape(){return this._def.shape()}strict(r){return G.errToObj,new be({...this._def,unknownKeys:"strict",...r!==void 0?{errorMap:(i,o)=>{const u=this._def.errorMap?.(i,o).message??o.defaultError;return i.code==="unrecognized_keys"?{message:G.errToObj(r).message??u}:{message:u}}}:{}})}strip(){return new be({...this._def,unknownKeys:"strip"})}passthrough(){return new be({...this._def,unknownKeys:"passthrough"})}extend(r){return new be({...this._def,shape:()=>({...this._def.shape(),...r})})}merge(r){return new be({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>({...this._def.shape(),...r._def.shape()}),typeName:J.ZodObject})}setKey(r,i){return this.augment({[r]:i})}catchall(r){return new be({...this._def,catchall:r})}pick(r){const i={};for(const o of fe.objectKeys(r))r[o]&&this.shape[o]&&(i[o]=this.shape[o]);return new be({...this._def,shape:()=>i})}omit(r){const i={};for(const o of fe.objectKeys(this.shape))r[o]||(i[o]=this.shape[o]);return new be({...this._def,shape:()=>i})}deepPartial(){return bn(this)}partial(r){const i={};for(const o of fe.objectKeys(this.shape)){const u=this.shape[o];r&&!r[o]?i[o]=u:i[o]=u.optional()}return new be({...this._def,shape:()=>i})}required(r){const i={};for(const o of fe.objectKeys(this.shape))if(r&&!r[o])i[o]=this.shape[o];else{let c=this.shape[o];for(;c instanceof bt;)c=c._def.innerType;i[o]=c}return new be({...this._def,shape:()=>i})}keyof(){return mo(fe.objectKeys(this.shape))}}be.create=(s,r)=>new be({shape:()=>s,unknownKeys:"strip",catchall:Rt.create(),typeName:J.ZodObject,...te(r)}),be.strictCreate=(s,r)=>new be({shape:()=>s,unknownKeys:"strict",catchall:Rt.create(),typeName:J.ZodObject,...te(r)}),be.lazycreate=(s,r)=>new be({shape:s,unknownKeys:"strip",catchall:Rt.create(),typeName:J.ZodObject,...te(r)});class sr extends ie{_parse(r){const{ctx:i}=this._processInputParams(r),o=this._def.options;function u(c){for(const g of c)if(g.result.status==="valid")return g.result;for(const g of c)if(g.result.status==="dirty")return i.common.issues.push(...g.ctx.common.issues),g.result;const h=c.map(g=>new Ye(g.ctx.common.issues));return N(i,{code:k.invalid_union,unionErrors:h}),Y}if(i.common.async)return Promise.all(o.map(async c=>{const h={...i,common:{...i.common,issues:[]},parent:null};return{result:await c._parseAsync({data:i.data,path:i.path,parent:h}),ctx:h}})).then(u);{let c;const h=[];for(const m of o){const v={...i,common:{...i.common,issues:[]},parent:null},w=m._parseSync({data:i.data,path:i.path,parent:v});if(w.status==="valid")return w;w.status==="dirty"&&!c&&(c={result:w,ctx:v}),v.common.issues.length&&h.push(v.common.issues)}if(c)return i.common.issues.push(...c.ctx.common.issues),c.result;const g=h.map(m=>new Ye(m));return N(i,{code:k.invalid_union,unionErrors:g}),Y}}get options(){return this._def.options}}sr.create=(s,r)=>new sr({options:s,typeName:J.ZodUnion,...te(r)});const kt=s=>s instanceof ur?kt(s.schema):s instanceof ht?kt(s.innerType()):s instanceof cr?[s.value]:s instanceof Ut?s.options:s instanceof lr?fe.objectValues(s.enum):s instanceof fr?kt(s._def.innerType):s instanceof rr?[void 0]:s instanceof ir?[null]:s instanceof bt?[void 0,...kt(s.unwrap())]:s instanceof $t?[null,...kt(s.unwrap())]:s instanceof ys||s instanceof pr?kt(s.unwrap()):s instanceof dr?kt(s._def.innerType):[];class ei extends ie{_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==F.object)return N(i,{code:k.invalid_type,expected:F.object,received:i.parsedType}),Y;const o=this.discriminator,u=i.data[o],c=this.optionsMap.get(u);return c?i.common.async?c._parseAsync({data:i.data,path:i.path,parent:i}):c._parseSync({data:i.data,path:i.path,parent:i}):(N(i,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),Y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(r,i,o){const u=new Map;for(const c of i){const h=kt(c.shape[r]);if(!h.length)throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);for(const g of h){if(u.has(g))throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(g)}`);u.set(g,c)}}return new ei({typeName:J.ZodDiscriminatedUnion,discriminator:r,options:i,optionsMap:u,...te(o)})}}function vs(s,r){const i=Tt(s),o=Tt(r);if(s===r)return{valid:!0,data:s};if(i===F.object&&o===F.object){const u=fe.objectKeys(r),c=fe.objectKeys(s).filter(g=>u.indexOf(g)!==-1),h={...s,...r};for(const g of c){const m=vs(s[g],r[g]);if(!m.valid)return{valid:!1};h[g]=m.data}return{valid:!0,data:h}}else if(i===F.array&&o===F.array){if(s.length!==r.length)return{valid:!1};const u=[];for(let c=0;c<s.length;c++){const h=s[c],g=r[c],m=vs(h,g);if(!m.valid)return{valid:!1};u.push(m.data)}return{valid:!0,data:u}}else return i===F.date&&o===F.date&&+s==+r?{valid:!0,data:s}:{valid:!1}}class ar extends ie{_parse(r){const{status:i,ctx:o}=this._processInputParams(r),u=(c,h)=>{if(gs(c)||gs(h))return Y;const g=vs(c.value,h.value);return g.valid?((ms(c)||ms(h))&&i.dirty(),{status:i.value,value:g.data}):(N(o,{code:k.invalid_intersection_types}),Y)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([c,h])=>u(c,h)):u(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}ar.create=(s,r,i)=>new ar({left:s,right:r,typeName:J.ZodIntersection,...te(i)});class wt extends ie{_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==F.array)return N(o,{code:k.invalid_type,expected:F.array,received:o.parsedType}),Y;if(o.data.length<this._def.items.length)return N(o,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y;!this._def.rest&&o.data.length>this._def.items.length&&(N(o,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const c=[...o.data].map((h,g)=>{const m=this._def.items[g]||this._def.rest;return m?m._parse(new xt(o,h,o.path,g)):null}).filter(h=>!!h);return o.common.async?Promise.all(c).then(h=>Pe.mergeArray(i,h)):Pe.mergeArray(i,c)}get items(){return this._def.items}rest(r){return new wt({...this._def,rest:r})}}wt.create=(s,r)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wt({items:s,typeName:J.ZodTuple,rest:null,...te(r)})};class or extends ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==F.object)return N(o,{code:k.invalid_type,expected:F.object,received:o.parsedType}),Y;const u=[],c=this._def.keyType,h=this._def.valueType;for(const g in o.data)u.push({key:c._parse(new xt(o,g,o.path,g)),value:h._parse(new xt(o,o.data[g],o.path,g)),alwaysSet:g in o.data});return o.common.async?Pe.mergeObjectAsync(i,u):Pe.mergeObjectSync(i,u)}get element(){return this._def.valueType}static create(r,i,o){return i instanceof ie?new or({keyType:r,valueType:i,typeName:J.ZodRecord,...te(o)}):new or({keyType:ft.create(),valueType:r,typeName:J.ZodRecord,...te(i)})}}class ti extends ie{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==F.map)return N(o,{code:k.invalid_type,expected:F.map,received:o.parsedType}),Y;const u=this._def.keyType,c=this._def.valueType,h=[...o.data.entries()].map(([g,m],v)=>({key:u._parse(new xt(o,g,o.path,[v,"key"])),value:c._parse(new xt(o,m,o.path,[v,"value"]))}));if(o.common.async){const g=new Map;return Promise.resolve().then(async()=>{for(const m of h){const v=await m.key,w=await m.value;if(v.status==="aborted"||w.status==="aborted")return Y;(v.status==="dirty"||w.status==="dirty")&&i.dirty(),g.set(v.value,w.value)}return{status:i.value,value:g}})}else{const g=new Map;for(const m of h){const v=m.key,w=m.value;if(v.status==="aborted"||w.status==="aborted")return Y;(v.status==="dirty"||w.status==="dirty")&&i.dirty(),g.set(v.value,w.value)}return{status:i.value,value:g}}}}ti.create=(s,r,i)=>new ti({valueType:r,keyType:s,typeName:J.ZodMap,...te(i)});class sn extends ie{_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==F.set)return N(o,{code:k.invalid_type,expected:F.set,received:o.parsedType}),Y;const u=this._def;u.minSize!==null&&o.data.size<u.minSize.value&&(N(o,{code:k.too_small,minimum:u.minSize.value,type:"set",inclusive:!0,exact:!1,message:u.minSize.message}),i.dirty()),u.maxSize!==null&&o.data.size>u.maxSize.value&&(N(o,{code:k.too_big,maximum:u.maxSize.value,type:"set",inclusive:!0,exact:!1,message:u.maxSize.message}),i.dirty());const c=this._def.valueType;function h(m){const v=new Set;for(const w of m){if(w.status==="aborted")return Y;w.status==="dirty"&&i.dirty(),v.add(w.value)}return{status:i.value,value:v}}const g=[...o.data.values()].map((m,v)=>c._parse(new xt(o,m,o.path,v)));return o.common.async?Promise.all(g).then(m=>h(m)):h(g)}min(r,i){return new sn({...this._def,minSize:{value:r,message:G.toString(i)}})}max(r,i){return new sn({...this._def,maxSize:{value:r,message:G.toString(i)}})}size(r,i){return this.min(r,i).max(r,i)}nonempty(r){return this.min(1,r)}}sn.create=(s,r)=>new sn({valueType:s,minSize:null,maxSize:null,typeName:J.ZodSet,...te(r)});class Sn extends ie{constructor(){super(...arguments),this.validate=this.implement}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==F.function)return N(i,{code:k.invalid_type,expected:F.function,received:i.parsedType}),Y;function o(g,m){return Jr({data:g,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Kr(),yn].filter(v=>!!v),issueData:{code:k.invalid_arguments,argumentsError:m}})}function u(g,m){return Jr({data:g,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Kr(),yn].filter(v=>!!v),issueData:{code:k.invalid_return_type,returnTypeError:m}})}const c={errorMap:i.common.contextualErrorMap},h=i.data;if(this._def.returns instanceof In){const g=this;return Fe(async function(...m){const v=new Ye([]),w=await g._def.args.parseAsync(m,c).catch(Z=>{throw v.addIssue(o(m,Z)),v}),O=await Reflect.apply(h,this,w);return await g._def.returns._def.type.parseAsync(O,c).catch(Z=>{throw v.addIssue(u(O,Z)),v})})}else{const g=this;return Fe(function(...m){const v=g._def.args.safeParse(m,c);if(!v.success)throw new Ye([o(m,v.error)]);const w=Reflect.apply(h,this,v.data),O=g._def.returns.safeParse(w,c);if(!O.success)throw new Ye([u(w,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...r){return new Sn({...this._def,args:wt.create(r).rest(rn.create())})}returns(r){return new Sn({...this._def,returns:r})}implement(r){return this.parse(r)}strictImplement(r){return this.parse(r)}static create(r,i,o){return new Sn({args:r||wt.create([]).rest(rn.create()),returns:i||rn.create(),typeName:J.ZodFunction,...te(o)})}}class ur extends ie{get schema(){return this._def.getter()}_parse(r){const{ctx:i}=this._processInputParams(r);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}ur.create=(s,r)=>new ur({getter:s,typeName:J.ZodLazy,...te(r)});class cr extends ie{_parse(r){if(r.data!==this._def.value){const i=this._getOrReturnCtx(r);return N(i,{received:i.data,code:k.invalid_literal,expected:this._def.value}),Y}return{status:"valid",value:r.data}}get value(){return this._def.value}}cr.create=(s,r)=>new cr({value:s,typeName:J.ZodLiteral,...te(r)});function mo(s,r){return new Ut({values:s,typeName:J.ZodEnum,...te(r)})}class Ut extends ie{_parse(r){if(typeof r.data!="string"){const i=this._getOrReturnCtx(r),o=this._def.values;return N(i,{expected:fe.joinValues(o),received:i.parsedType,code:k.invalid_type}),Y}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(r.data)){const i=this._getOrReturnCtx(r),o=this._def.values;return N(i,{received:i.data,code:k.invalid_enum_value,options:o}),Y}return Fe(r.data)}get options(){return this._def.values}get enum(){const r={};for(const i of this._def.values)r[i]=i;return r}get Values(){const r={};for(const i of this._def.values)r[i]=i;return r}get Enum(){const r={};for(const i of this._def.values)r[i]=i;return r}extract(r,i=this._def){return Ut.create(r,{...this._def,...i})}exclude(r,i=this._def){return Ut.create(this.options.filter(o=>!r.includes(o)),{...this._def,...i})}}Ut.create=mo;class lr extends ie{_parse(r){const i=fe.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(r);if(o.parsedType!==F.string&&o.parsedType!==F.number){const u=fe.objectValues(i);return N(o,{expected:fe.joinValues(u),received:o.parsedType,code:k.invalid_type}),Y}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(r.data)){const u=fe.objectValues(i);return N(o,{received:o.data,code:k.invalid_enum_value,options:u}),Y}return Fe(r.data)}get enum(){return this._def.values}}lr.create=(s,r)=>new lr({values:s,typeName:J.ZodNativeEnum,...te(r)});class In extends ie{unwrap(){return this._def.type}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==F.promise&&i.common.async===!1)return N(i,{code:k.invalid_type,expected:F.promise,received:i.parsedType}),Y;const o=i.parsedType===F.promise?i.data:Promise.resolve(i.data);return Fe(o.then(u=>this._def.type.parseAsync(u,{path:i.path,errorMap:i.common.contextualErrorMap})))}}In.create=(s,r)=>new In({type:s,typeName:J.ZodPromise,...te(r)});class ht extends ie{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===J.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:i,ctx:o}=this._processInputParams(r),u=this._def.effect||null,c={addIssue:h=>{N(o,h),h.fatal?i.abort():i.dirty()},get path(){return o.path}};if(c.addIssue=c.addIssue.bind(c),u.type==="preprocess"){const h=u.transform(o.data,c);if(o.common.async)return Promise.resolve(h).then(async g=>{if(i.value==="aborted")return Y;const m=await this._def.schema._parseAsync({data:g,path:o.path,parent:o});return m.status==="aborted"?Y:m.status==="dirty"||i.value==="dirty"?xn(m.value):m});{if(i.value==="aborted")return Y;const g=this._def.schema._parseSync({data:h,path:o.path,parent:o});return g.status==="aborted"?Y:g.status==="dirty"||i.value==="dirty"?xn(g.value):g}}if(u.type==="refinement"){const h=g=>{const m=u.refinement(g,c);if(o.common.async)return Promise.resolve(m);if(m instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return g};if(o.common.async===!1){const g=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return g.status==="aborted"?Y:(g.status==="dirty"&&i.dirty(),h(g.value),{status:i.value,value:g.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(g=>g.status==="aborted"?Y:(g.status==="dirty"&&i.dirty(),h(g.value).then(()=>({status:i.value,value:g.value}))))}if(u.type==="transform")if(o.common.async===!1){const h=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!tn(h))return Y;const g=u.transform(h.value,c);if(g instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:g}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(h=>tn(h)?Promise.resolve(u.transform(h.value,c)).then(g=>({status:i.value,value:g})):Y);fe.assertNever(u)}}ht.create=(s,r,i)=>new ht({schema:s,typeName:J.ZodEffects,effect:r,...te(i)}),ht.createWithPreprocess=(s,r,i)=>new ht({schema:r,effect:{type:"preprocess",transform:s},typeName:J.ZodEffects,...te(i)});class bt extends ie{_parse(r){return this._getType(r)===F.undefined?Fe(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}bt.create=(s,r)=>new bt({innerType:s,typeName:J.ZodOptional,...te(r)});class $t extends ie{_parse(r){return this._getType(r)===F.null?Fe(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}$t.create=(s,r)=>new $t({innerType:s,typeName:J.ZodNullable,...te(r)});class fr extends ie{_parse(r){const{ctx:i}=this._processInputParams(r);let o=i.data;return i.parsedType===F.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}fr.create=(s,r)=>new fr({innerType:s,typeName:J.ZodDefault,defaultValue:typeof r.default=="function"?r.default:()=>r.default,...te(r)});class dr extends ie{_parse(r){const{ctx:i}=this._processInputParams(r),o={...i,common:{...i.common,issues:[]}},u=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return tr(u)?u.then(c=>({status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Ye(o.common.issues)},input:o.data})})):{status:"valid",value:u.status==="valid"?u.value:this._def.catchValue({get error(){return new Ye(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}dr.create=(s,r)=>new dr({innerType:s,typeName:J.ZodCatch,catchValue:typeof r.catch=="function"?r.catch:()=>r.catch,...te(r)});class ni extends ie{_parse(r){if(this._getType(r)!==F.nan){const o=this._getOrReturnCtx(r);return N(o,{code:k.invalid_type,expected:F.nan,received:o.parsedType}),Y}return{status:"valid",value:r.data}}}ni.create=s=>new ni({typeName:J.ZodNaN,...te(s)});const Of=Symbol("zod_brand");class ys extends ie{_parse(r){const{ctx:i}=this._processInputParams(r),o=i.data;return this._def.type._parse({data:o,path:i.path,parent:i})}unwrap(){return this._def.type}}class hr extends ie{_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.common.async)return(async()=>{const c=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return c.status==="aborted"?Y:c.status==="dirty"?(i.dirty(),xn(c.value)):this._def.out._parseAsync({data:c.value,path:o.path,parent:o})})();{const u=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return u.status==="aborted"?Y:u.status==="dirty"?(i.dirty(),{status:"dirty",value:u.value}):this._def.out._parseSync({data:u.value,path:o.path,parent:o})}}static create(r,i){return new hr({in:r,out:i,typeName:J.ZodPipeline})}}class pr extends ie{_parse(r){const i=this._def.innerType._parse(r),o=u=>(tn(u)&&(u.value=Object.freeze(u.value)),u);return tr(i)?i.then(u=>o(u)):o(i)}unwrap(){return this._def.innerType}}pr.create=(s,r)=>new pr({innerType:s,typeName:J.ZodReadonly,...te(r)});function _o(s,r){const i=typeof s=="function"?s(r):typeof s=="string"?{message:s}:s;return typeof i=="string"?{message:i}:i}function vo(s,r={},i){return s?wn.create().superRefine((o,u)=>{const c=s(o);if(c instanceof Promise)return c.then(h=>{if(!h){const g=_o(r,o),m=g.fatal??i??!0;u.addIssue({code:"custom",...g,fatal:m})}});if(!c){const h=_o(r,o),g=h.fatal??i??!0;u.addIssue({code:"custom",...h,fatal:g})}}):wn.create()}const Ef={object:be.lazycreate};var J;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(J||(J={}));const Mf=(s,r={message:`Input not instance of ${s.name}`})=>vo(i=>i instanceof s,r),A=ft.create,U=Zt.create,Lf=ni.create,Nf=Gt.create,_e=nr.create,Pf=nn.create,Df=jr.create,yo=rr.create,Bf=ir.create,Ff=wn.create,qf=rn.create,Wf=Rt.create,Zf=Qr.create,qe=dt.create,B=be.create,Gf=be.strictCreate,an=sr.create,Uf=ei.create,$f=ar.create,ri=wt.create,Ot=or.create,Vf=ti.create,Hf=sn.create,zf=Sn.create,Yf=ur.create,ge=cr.create,nt=Ut.create,Xf=lr.create,Kf=In.create,xo=ht.create,j=bt.create,Jf=$t.create,jf=ht.createWithPreprocess,Qf=hr.create,ed=()=>A().optional(),td=()=>U().optional(),xs=()=>_e().optional(),ws=Object.freeze(Object.defineProperty({__proto__:null,BRAND:Of,DIRTY:xn,EMPTY_PATH:uf,INVALID:Y,NEVER:Y,OK:Fe,ParseStatus:Pe,Schema:ie,ZodAny:wn,ZodArray:dt,ZodBigInt:Gt,ZodBoolean:nr,ZodBranded:ys,ZodCatch:dr,ZodDate:nn,ZodDefault:fr,ZodDiscriminatedUnion:ei,ZodEffects:ht,ZodEnum:Ut,ZodError:Ye,get ZodFirstPartyTypeKind(){return J},ZodFunction:Sn,ZodIntersection:ar,ZodIssueCode:k,ZodLazy:ur,ZodLiteral:cr,ZodMap:ti,ZodNaN:ni,ZodNativeEnum:lr,ZodNever:Rt,ZodNull:ir,ZodNullable:$t,ZodNumber:Zt,ZodObject:be,ZodOptional:bt,ZodParsedType:F,ZodPipeline:hr,ZodPromise:In,ZodReadonly:pr,ZodRecord:or,ZodSchema:ie,ZodSet:sn,ZodString:ft,ZodSymbol:jr,ZodTransformer:ht,ZodTuple:wt,ZodType:ie,ZodUndefined:rr,ZodUnion:sr,ZodUnknown:rn,ZodVoid:Qr,addIssueToContext:N,any:Ff,array:qe,bigint:Nf,boolean:_e,coerce:{string:(s=>ft.create({...s,coerce:!0})),number:(s=>Zt.create({...s,coerce:!0})),boolean:(s=>nr.create({...s,coerce:!0})),bigint:(s=>Gt.create({...s,coerce:!0})),date:(s=>nn.create({...s,coerce:!0}))},custom:vo,date:Pf,datetimeRegex:go,defaultErrorMap:yn,discriminatedUnion:Uf,effect:xo,enum:nt,function:zf,getErrorMap:Kr,getParsedType:Tt,instanceof:Mf,intersection:$f,isAborted:gs,isAsync:tr,isDirty:ms,isValid:tn,late:Ef,lazy:Yf,literal:ge,makeIssue:Jr,map:Vf,nan:Lf,nativeEnum:Xf,never:Wf,null:Bf,nullable:Jf,number:U,object:B,get objectUtil(){return ps},oboolean:xs,onumber:td,optional:j,ostring:ed,pipeline:Qf,preprocess:jf,promise:Kf,quotelessJson:af,record:Ot,set:Hf,setErrorMap:of,strictObject:Gf,string:A,symbol:Df,transformer:xo,tuple:ri,undefined:yo,union:an,unknown:qf,get util(){return fe},void:Zf},Symbol.toStringTag,{value:"Module"})),Cn=nt(["left","right","up","down"]),nd=Cn.options,ii=B({type:A(),id:A(),name:j(A()),status:j(A())}),wo=B({height:U(),width:U(),sprite:A().optional(),direction:j(Cn),filter:j(A())}),bo=B({room:j(A()),x:U(),y:U()}),gr=B({imageId:A(),col:U().optional(),row:U().optional()}),Ie=B({text:A().array()}),So=B({x:U(),y:U()}),si=B({soundId:A(),volume:U().optional()}),ai={_started:xs(),narrative:Ie.optional(),startDirection:Cn.optional(),endDirection:Cn.optional(),endStatus:A().optional()},rd={_started:!0,narrative:!0,startDirection:!0,endDirection:!0,endStatus:!0,type:!0},id=B({animation:j(A()),x:U(),y:U(),speed:j(U())}),Io=B({type:ge("move"),roomId:A().optional(),pathIsSet:j(_e()),doPendingInteractionWhenFinished:j(_e()),steps:qe(id)}).extend(ai),Co=B({type:ge("goTo"),animation:j(A()),speed:j(U()),targetId:A()}).extend(ai),Ao=B({type:ge("say"),animation:j(A()),text:A(),time:U()}).extend(ai),sd=B({animation:j(A()),duration:U(),timeElapsed:j(U()),reverse:j(_e())}),To=B({type:ge("act"),steps:qe(sd)}).extend(ai),mr=an([Io,To,Ao,Co]),ad=mr.options.map(s=>s.shape.type.value),oi=B({type:ge("order"),actorId:A().optional(),orders:qe(mr),replaceCurrentOrders:j(_e()),narrative:Ie.optional()}),An=B({type:ge("changeRoom"),roomId:A(),takePlayer:_e(),x:j(U()),y:j(U()),narrative:Ie.optional()}),Tn=B({type:ge("inventory"),itemId:A(),actorId:A().optional(),addOrRemove:nt(["ADD","REMOVE"]),narrative:Ie.optional()}),Rn=B({type:ge("removeActor"),actorId:A(),narrative:Ie.optional()}),kn=B({type:ge("changeStatus"),targetId:A(),targetType:nt(["actor","item","hotspot"]),status:A(),narrative:Ie.optional()}),ui=B({type:ge("sequence"),sequence:A(),narrative:Ie.optional()}),On=B({type:ge("conversation"),conversationId:A(),end:j(_e()),narrative:Ie.optional()}),En=B({type:ge("conversationChoice"),on:_e(),conversationId:A(),branchId:A(),choiceRef:A(),narrative:Ie.optional()}),Mn=B({type:ge("teleportActor"),actorId:A(),roomId:j(A()),x:U(),y:U(),narrative:Ie.optional()}),on=B({type:ge("toggleZone"),roomId:j(A()),on:_e(),ref:A(),zoneType:nt(["hotspot","obstacle","walkable"]),narrative:Ie.optional()}),Ln=B({type:ge("soundEffect"),sound:A(),volume:U().optional(),narrative:Ie.optional()}),Nn=B({type:ge("backgroundMusic"),sound:A().optional(),roomId:A().optional(),volume:U().optional(),narrative:Ie.optional()}),Pn=B({type:ge("ambientNoise"),sound:A().optional(),roomId:A().optional(),volume:U().optional(),narrative:Ie.optional()}),Dn=B({type:ge("flag"),on:_e(),flag:A(),narrative:Ie.optional()}),Bn=B({type:ge("storyBoardConsequence"),storyBoardId:A(),narrative:Ie.optional()}),Fn=B({type:ge("changePlayerCharacter"),actorId:A(),narrative:Ie.optional()}),od=on.shape.zoneType.options,Ro=an([oi,An,Tn,Rn,kn,ui,On,Mn,on,Ln,Nn,Pn,Dn,En,Bn,Fn]),ud=nt(["conversation","sequence","changeStatus","backgroundMusic","ambientNoise","removeActor","inventory","changeRoom","order","teleportActor","toggleZone","soundEffect","flag","conversationChoice","storyBoardConsequence","changePlayerCharacter"]).options,cd={conversation:On,sequence:ui,changeStatus:kn,removeActor:Rn,inventory:Tn,changeRoom:An,order:oi,teleportActor:Mn,toggleZone:on,soundEffect:Ln,flag:Dn,conversationChoice:En,backgroundMusic:Nn,ambientNoise:Pn,storyBoardConsequence:Bn,changePlayerCharacter:Fn},bs=an([Rn,kn,Tn,On,Mn,on,Ln,Dn,An,En,Nn,Pn,Bn,Fn]),ld=bs.options.map(s=>s.shape.type.value),ci=B({verbId:A(),targetId:A(),roomId:A().optional(),itemId:A().optional(),targetStatus:A().optional(),mustReachFirst:_e().optional(),consequences:qe(Ro),flagsThatMustBeFalse:qe(A()).optional(),flagsThatMustBeTrue:qe(A()).optional(),requiredInventory:qe(A()).optional()}),Ss=B({actorOrders:j(Ot(A(),mr.array())),immediateConsequences:j(bs.array()),narrative:Ie.optional(),_started:xs()}),_r=B({id:A(),description:A().optional(),stages:Ss.array()}),ko=B({conversationId:A().optional(),branchId:A().optional(),choiceRef:A().optional()}),Is=B({ref:A().optional(),text:A(),sequence:A().optional(),nextBranch:j(A()),once:j(_e()),disabled:j(_e()),enablesChoices:qe(ko).optional(),disablesChoices:qe(ko).optional(),end:j(_e()),choiceSequence:_r.optional()}),Oo=B({choices:qe(Is)}),Cs=B({id:A(),branches:Ot(A(),j(Oo)),currentBranch:j(A()),defaultBranch:A()}),As=B({id:A(),message:A(),imageId:A().optional(),imageWidth:U().optional()}),Ts=B({type:ge("ending"),endingId:A(),narrative:Ie.optional()}),fd=an([oi,An,Tn,Rn,kn,ui,On,Mn,on,Ln,Nn,Pn,Dn,En,Bn,Fn,Ts]),Eo=an([Rn,kn,Tn,On,Mn,on,Ln,Dn,An,En,Nn,Pn,Bn,Fn,Ts]),Rs=ci.merge(B({consequences:qe(fd)})),li=_r.merge(B({stages:Ss.merge(B({immediateConsequences:j(Eo.array())})).array()})),dd=Is.merge(B({choiceSequence:li.optional()})),hd=B({choices:qe(dd)}),ks=Cs.merge(B({branches:Ot(A(),j(hd))})),Os=B({soundId:A(),frameIndex:U().optional(),volume:U().optional()}),pd=Ot(A(),Os.or(Os.array()).or(yo())),fi=ii.merge(bo).merge(wo).merge(B({type:ge("actor"),isPlayer:j(_e()),noInteraction:j(_e()),speed:j(U()),baseline:j(U()),dialogueColor:j(A()),soundEffectMap:pd.optional(),walkToX:U().optional(),walkToY:U().optional(),defaultFrame:gr.optional(),statusFrames:Ot(gr).optional()})),Mo=B({value:_e(),default:_e(),description:A().optional()}),Es=Ot(A(),Mo.optional()),vr=ii.extend({type:ge("item"),actorId:A().optional()}).and(gr.partial());nt(["rect","circle","polygon"]);const gd=qe(ri([U(),U()])),Lo=B({type:A().optional(),x:U(),y:U(),path:j(A()),polygon:j(gd),circle:j(U()),rect:j(ri([U(),U()]))}),Ms=Lo.merge(B({ref:A().optional(),disabled:_e().optional()})),Ls=Lo.merge(ii).merge(B({type:ge("hotspot"),parallax:U(),walkToX:U().optional(),walkToY:U().optional()})),md=B({parallax:U(),imageId:A(),placement:B({x:U(),y:U(),width:U(),height:U()}).optional()}),_d=qe(ri([U(),U()])),Ns=B({id:A(),frameWidth:U(),frameHeight:U().optional(),width:U(),height:U(),background:md.array(),hotspots:Ls.array().optional(),obstacleAreas:j(Ms.array()),walkableAreas:j(Ms.array()),scaling:j(_d),backgroundColor:A().optional(),name:A().optional(),narrative:Ie.optional(),backgroundMusic:si.optional(),ambientNoise:si.optional()}),yr=B({imageId:A(),row:U(),col:U()}),vd=B({left:yr.array().optional(),right:yr.array().optional(),up:yr.array().optional(),down:yr.array().optional()}),Ps=B({id:A(),defaultDirection:Cn,animations:Ot(A(),vd)}),No=nt(["center","left","right"]),Po=nt(["center","top","bottom"]),yd=B({x:No,y:Po,width:U().optional(),height:U().optional(),aspectRatio:So.optional()}).merge(B({image:gr})),Do=B({title:A(),narrative:Ie,pictures:yd.array(),backgroundColor:A(),color:A()}),Bo=nt(["sound","buttons"]),Fo=nt(["serif","sans-serif","monospace","cursive","fantasy","math"]),Ds=B({id:A(),isEndOfGame:_e().optional(),pages:Do.array(),font:Fo.optional(),sound:si.optional(),progression:Bo.optional()}),di=B({id:A(),label:A(),preposition:A().optional(),isMoveVerb:_e().optional(),isNotForItems:_e().optional(),isLookVerb:_e().optional(),requiresItem:_e().optional(),defaultResponseNoItem:A().optional(),defaultResponseWithItem:A().optional(),defaultResponseCannotReach:A().optional()}),xd=B({schemaVersion:U().optional(),rooms:Ns.array(),items:vr.array(),actors:fi.array(),interactions:Rs.array(),conversations:ks.array(),flagMap:Es,currentRoomId:A(),id:A(),description:A().optional().describe("a short description of your game"),thumbnailAssetId:A().optional()}),wd=B({verbs:di.array(),sequences:li.array(),sprites:Ps.array(),endings:As.array(),openingSequenceId:A().optional(),openingStoryboardId:A().optional(),storyBoards:Ds.array().optional()}),qo=xd.and(wd).describe("The game schema"),Wo=ws.union([ws.literal(0),ws.literal(1)]).array().array(),hi=4,Zo=B({sequenceRunning:_r.optional(),currentStoryBoardId:A().optional(),actorOrders:Ot(A(),mr.array()),currentConversationId:A().optional(),pendingInteraction:ci.optional(),gameNotBegun:_e(),cellMatrix:Wo.optional(),viewAngleX:U(),viewAngleY:U()}),pi=B({schemaVersion:ge(hi),rooms:Ns.array(),items:vr.array(),actors:fi.array(),interactions:ci.array(),conversations:Cs.array(),flagMap:Es,currentRoomId:A(),id:A(),description:A().optional().describe("a short description of your game"),thumbnailAssetId:A().optional()}),Bs=B({verbs:di.array(),sequences:_r.array(),sprites:Ps.array(),openingSequenceId:A().optional(),openingStoryboardId:A().optional(),storyBoards:Ds.array()}),bd=pi.and(Zo),Go=pi.and(Bs).describe("The game schema"),Sd=nt(["rooms","items","actors","conversations","sprites","sequences","verbs","storyBoards"]),Id=pi.merge(B({schemaVersion:ge(3),interactions:Rs.array(),conversations:ks.array()})),Cd=Bs.merge(B({endings:As.array(),sequences:li.array()})),Uo=Id.and(Cd).describe("The game schema"),$o=an([fi,vr,Ls]),Ad=B({verb:di,target:$o,item:j(vr)});var gi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},un={},Xe={},Vo;function Fs(){return Vo||(Vo=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe._extreme=Xe._DEG=Xe._360_DEG=Xe._90_DEG_RIGHT=Xe._90_DEG_LEFT=void 0,Xe._90_DEG_LEFT=Math.PI*.5,Xe._90_DEG_RIGHT=Math.PI*-.5,Xe._360_DEG=Math.PI*2,Xe._DEG=Math.PI/180,Xe._extreme=Math.pow(10,30)),Xe}var qs={},Ho;function zo(){return Ho||(Ho=1,(function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.expandRect=s.findRotationBetweenHeadings=s.findClosestAndDistance=s.doCircleIntersect=s.doRectsIntersect=s.isPointInsideRect=s.getDistance=s.translate=s.getHeadingFrom=s.getVectorFrom=s.normaliseHeading=s.getHeading=s.getXYVector=s.xy=void 0;const r=Fs();function i(M,E){return M*Math.sin(E)}function o(M,E){return M*Math.cos(E)}const u=(M,E)=>({x:M,y:E});s.xy=u;function c(M,E){return{x:i(M,E),y:o(M,E)}}s.getXYVector=c;const h=M=>{const{x:E,y:ve}=M;return E==0&&ve==0?0:ve==0&&E!=0?E<0?Math.PI*1.5:Math.PI*.5:E==0&&ve!=0?ve>0?0:Math.PI*1:ve>0?Math.atan(E/ve):Math.PI+Math.atan(E/ve)};s.getHeading=h;const g=M=>{const E=M%r._360_DEG;return E>0?E:r._360_DEG+E};s.normaliseHeading=g;const m=(M,E)=>({x:E.x-M.x,y:E.y-M.y});s.getVectorFrom=m;const v=(M,E)=>(0,s.getHeading)((0,s.getVectorFrom)(M,E));s.getHeadingFrom=v;const w=(M,E)=>({x:M.x+E.x,y:M.y+E.y});s.translate=w;const O=(M,E)=>Math.sqrt(Math.pow(M.x-E.x,2)+Math.pow(M.y-E.y,2));s.getDistance=O;const q=(M,E)=>{const{top:ve,left:Ae,bottom:Me,right:Tr}=E;return!(M.y<=ve||M.y>=Me||M.x<=Ae||M.x>=Tr)};s.isPointInsideRect=q;const Z=(M,E)=>M.bottom<=E.bottom&&M.top>=E.top||E.bottom<=M.bottom&&E.top>=M.top,L=(M,E)=>M.right<=E.right&&M.left>=E.left||E.right<=M.right&&E.left>=M.left,P=(M,E)=>(0,s.isPointInsideRect)({x:M.left,y:M.top},E)||(0,s.isPointInsideRect)({x:M.left,y:M.bottom},E)||(0,s.isPointInsideRect)({x:M.right,y:M.top},E)||(0,s.isPointInsideRect)({x:M.right,y:M.bottom},E)||(0,s.isPointInsideRect)({x:E.left,y:E.top},M)||(0,s.isPointInsideRect)({x:E.left,y:E.bottom},M)||(0,s.isPointInsideRect)({x:E.right,y:E.top},M)||(0,s.isPointInsideRect)({x:E.right,y:E.bottom},M)||L(M,E)&&Z(M,E)||L(M,E)&&(M.top>=E.top&&M.top<=E.bottom||E.top>=M.top&&E.top<=M.bottom)||Z(M,E)&&(M.left>=E.left&&M.left<=E.right||E.left>=M.left&&E.left<=M.right);s.doRectsIntersect=P;const H=(M,E)=>(0,s.getDistance)(M,E)<M.r+E.r;s.doCircleIntersect=H;const V=(M,E)=>{if(M.length===0)return{distance:1/0};const ve=M.map(Me=>({item:Me,distance:(0,s.getDistance)(E,Me)}));let[Ae]=ve;return ve.forEach(Me=>{Ae.distance>Me.distance&&(Ae=Me)}),Ae};s.findClosestAndDistance=V;const ne=(M,E)=>{const ve=(0,s.normaliseHeading)(M),Ae=(0,s.normaliseHeading)(E);let Me=Ae;return ve-Ae>r._360_DEG/2?Me=Ae+r._360_DEG:ve-Ae<-r._360_DEG/2&&(Me=Ae-r._360_DEG),Me-ve};s.findRotationBetweenHeadings=ne;const se=(M,E)=>({top:M.top-E,bottom:M.bottom+E,left:M.left-E,right:M.right+E});s.expandRect=se})(qs)),qs}var xr={},Yo;function Td(){if(Yo)return xr;Yo=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.doesLineSegmentCrossCircleEdge=void 0;const s=zo();function r(h,g){return(0,s.getDistance)(h,g)<=h.r}function i(h,g,m,v){return{x:(1-h)*m.x+h*v.x-g.x,y:(1-h)*m.y+h*v.y-g.y}}function o(h){return Math.pow(h.x,2)+Math.pow(h.y,2)}function u(h,g,m){const v={x:g.x-h.x,y:g.y-h.y},w={x:h.x-m.x,y:h.y-m.y},O=v.x*w.x+v.y*w.y,q=Math.pow(v.x,2)+Math.pow(v.y,2),Z=-O/q;if(Z>=0&&Z<=1)return i(Z,{x:0,y:0},h,g);const L=o(i(0,m,h,g)),P=o(i(1,m,h,g));return L<=P?h:g}function c(h,g){const m=r(g,h[0]),v=r(g,h[1]);return m&&v?!1:v!=m?!0:r(g,u(...h,g))}return xr.doesLineSegmentCrossCircleEdge=c,xr}var Ws={},Xo;function Rd(){return Xo||(Xo=1,(function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.isPointInsidePolygon=s.isPointOnLineSegment=void 0;const r=Fs();function i(m,v,w){return v.x<=Math.max(m.x,w.x)&&v.x>=Math.min(m.x,w.x)&&v.y<=Math.max(m.y,w.y)&&v.y>=Math.min(m.y,w.y)}var o;(function(m){m[m.Colinear=0]="Colinear",m[m.Clockwise=1]="Clockwise",m[m.Counterclockwise=2]="Counterclockwise"})(o||(o={}));function u(m,v,w){const O=(v.y-m.y)*(w.x-v.x)-(v.x-m.x)*(w.y-v.y);return O==0?o.Colinear:O>0?o.Clockwise:o.Counterclockwise}const c=(m,v)=>u(m,...v)===o.Colinear?i(v[0],m,v[1]):!1;s.isPointOnLineSegment=c;function h(m,v){const w=u(m[0],m[1],v[0]),O=u(m[0],m[1],v[1]),q=u(v[0],v[1],m[0]),Z=u(v[0],v[1],m[1]);return!!(w!=O&&q!=Z||w==0&&i(m[0],v[0],m[1])||O==0&&i(m[0],v[1],m[1])||q==0&&i(v[0],m[0],v[1])||Z==0&&i(v[0],m[1],v[1]))}function g(m,v){if(v.length<3)return!1;const O={y:m.y,x:r._extreme},q=[m,O];let Z=0,L,P;for(let V=0;V<v.length;V++)L=v[V],P=V+1>=v.length?v[0]:v[V+1],h(q,[L,P])&&Z++;let H=0;return v.forEach(V=>{(0,s.isPointOnLineSegment)(V,q)&&H++}),(Z-H)%2!==0}s.isPointInsidePolygon=g})(Ws)),Ws}var Ko;function kd(){return Ko||(Ko=1,(function(s){var r=un&&un.__createBinding||(Object.create?(function(o,u,c,h){h===void 0&&(h=c);var g=Object.getOwnPropertyDescriptor(u,c);(!g||("get"in g?!u.__esModule:g.writable||g.configurable))&&(g={enumerable:!0,get:function(){return u[c]}}),Object.defineProperty(o,h,g)}):(function(o,u,c,h){h===void 0&&(h=c),o[h]=u[c]})),i=un&&un.__exportStar||function(o,u){for(var c in o)c!=="default"&&!Object.prototype.hasOwnProperty.call(u,c)&&r(u,o,c)};Object.defineProperty(s,"__esModule",{value:!0}),i(Fs(),s),i(zo(),s),i(Td(),s),i(Rd(),s)})(un)),un}var Od=kd();function Ed(s,r){const{x:i,y:o,width:u,height:c}=r;return s.x>=i&&s.x<=i+u&&s.y>=o&&s.y<=o+c}function Md(s,r){const{x:i,y:o,radius:u}=r;return Math.sqrt((s.x-i)**2+(s.y-o)**2)<=u}function Ld(s,r,i,o,u){const c={x:(r+.5)*i,y:(s-.5)*i},h=Jo(c,o);if(u){const g=Jo(c,u);return h||!g}return h}function Jo(s,r){const{polygons:i,rectangles:o,circles:u}=r;return i.some(c=>Od.isPointInsidePolygon(s,c))||o.some(c=>Ed(s,c))||u.some(c=>Md(s,c))}function jo(s){return s.filter(r=>r.polygon).map(r=>{const{x:i,y:o,polygon:u=[]}=r;return u.map(c=>({x:i+c[0],y:o+c[1]}))})}function Qo(s){return s.filter(r=>r.rect).map(r=>{const{x:i,y:o,rect:u}=r,[c,h]=u;return{x:i,y:o-h,width:c,height:h}})}function eu(s){return s.filter(r=>r.circle).map(r=>{const{x:i,y:o,circle:u}=r;return{x:i,y:o,radius:u}})}function Zs(s,r){const{width:i,height:o,obstacleAreas:u=[],walkableAreas:c=[]}=s,h=c.length>0?{polygons:jo(c.filter(O=>!O.disabled)),rectangles:Qo(c.filter(O=>!O.disabled)),circles:eu(c.filter(O=>!O.disabled))}:null,g={polygons:jo(u.filter(O=>!O.disabled)),rectangles:Qo(u.filter(O=>!O.disabled)),circles:eu(u.filter(O=>!O.disabled))},m=Math.ceil(o/r),v=Math.ceil(i/r),w=[];for(let O=0;O<m;O++){const q=[];for(let Z=0;Z<v;Z++)q.push(Ld(m-O,Z,r,g,h)?1:0);w.push(q)}return w}var Gs={},wr={},br={exports:{}};var Nd=br.exports,tu;function Pd(){return tu||(tu=1,(function(s,r){(function(){var i,o="4.17.21",u=200,c="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",h="Expected a function",g="Invalid `variable` option passed into `_.template`",m="__lodash_hash_undefined__",v=500,w="__lodash_placeholder__",O=1,q=2,Z=4,L=1,P=2,H=1,V=2,ne=4,se=8,M=16,E=32,ve=64,Ae=128,Me=256,Tr=512,yh=30,xh="...",wh=800,bh=16,Au=1,Sh=2,Ih=3,cn=1/0,Vt=9007199254740991,Ch=17976931348623157e292,wi=NaN,St=4294967295,Ah=St-1,Th=St>>>1,Rh=[["ary",Ae],["bind",H],["bindKey",V],["curry",se],["curryRight",M],["flip",Tr],["partial",E],["partialRight",ve],["rearg",Me]],qn="[object Arguments]",bi="[object Array]",kh="[object AsyncFunction]",Rr="[object Boolean]",kr="[object Date]",Oh="[object DOMException]",Si="[object Error]",Ii="[object Function]",Tu="[object GeneratorFunction]",pt="[object Map]",Or="[object Number]",Eh="[object Null]",Et="[object Object]",Ru="[object Promise]",Mh="[object Proxy]",Er="[object RegExp]",gt="[object Set]",Mr="[object String]",Ci="[object Symbol]",Lh="[object Undefined]",Lr="[object WeakMap]",Nh="[object WeakSet]",Nr="[object ArrayBuffer]",Wn="[object DataView]",Us="[object Float32Array]",$s="[object Float64Array]",Vs="[object Int8Array]",Hs="[object Int16Array]",zs="[object Int32Array]",Ys="[object Uint8Array]",Xs="[object Uint8ClampedArray]",Ks="[object Uint16Array]",Js="[object Uint32Array]",Ph=/\b__p \+= '';/g,Dh=/\b(__p \+=) '' \+/g,Bh=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ku=/&(?:amp|lt|gt|quot|#39);/g,Ou=/[&<>"']/g,Fh=RegExp(ku.source),qh=RegExp(Ou.source),Wh=/<%-([\s\S]+?)%>/g,Zh=/<%([\s\S]+?)%>/g,Eu=/<%=([\s\S]+?)%>/g,Gh=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Uh=/^\w*$/,$h=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,js=/[\\^$.*+?()[\]{}|]/g,Vh=RegExp(js.source),Qs=/^\s+/,Hh=/\s/,zh=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yh=/\{\n\/\* \[wrapped with (.+)\] \*/,Xh=/,? & /,Kh=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Jh=/[()=,{}\[\]\/\s]/,jh=/\\(\\)?/g,Qh=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Mu=/\w*$/,ep=/^[-+]0x[0-9a-f]+$/i,tp=/^0b[01]+$/i,np=/^\[object .+?Constructor\]$/,rp=/^0o[0-7]+$/i,ip=/^(?:0|[1-9]\d*)$/,sp=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ai=/($^)/,ap=/['\n\r\u2028\u2029\\]/g,Ti="\\ud800-\\udfff",op="\\u0300-\\u036f",up="\\ufe20-\\ufe2f",cp="\\u20d0-\\u20ff",Lu=op+up+cp,Nu="\\u2700-\\u27bf",Pu="a-z\\xdf-\\xf6\\xf8-\\xff",lp="\\xac\\xb1\\xd7\\xf7",fp="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",dp="\\u2000-\\u206f",hp=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Du="A-Z\\xc0-\\xd6\\xd8-\\xde",Bu="\\ufe0e\\ufe0f",Fu=lp+fp+dp+hp,ea="['’]",pp="["+Ti+"]",qu="["+Fu+"]",Ri="["+Lu+"]",Wu="\\d+",gp="["+Nu+"]",Zu="["+Pu+"]",Gu="[^"+Ti+Fu+Wu+Nu+Pu+Du+"]",ta="\\ud83c[\\udffb-\\udfff]",mp="(?:"+Ri+"|"+ta+")",Uu="[^"+Ti+"]",na="(?:\\ud83c[\\udde6-\\uddff]){2}",ra="[\\ud800-\\udbff][\\udc00-\\udfff]",Zn="["+Du+"]",$u="\\u200d",Vu="(?:"+Zu+"|"+Gu+")",_p="(?:"+Zn+"|"+Gu+")",Hu="(?:"+ea+"(?:d|ll|m|re|s|t|ve))?",zu="(?:"+ea+"(?:D|LL|M|RE|S|T|VE))?",Yu=mp+"?",Xu="["+Bu+"]?",vp="(?:"+$u+"(?:"+[Uu,na,ra].join("|")+")"+Xu+Yu+")*",yp="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xp="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ku=Xu+Yu+vp,wp="(?:"+[gp,na,ra].join("|")+")"+Ku,bp="(?:"+[Uu+Ri+"?",Ri,na,ra,pp].join("|")+")",Sp=RegExp(ea,"g"),Ip=RegExp(Ri,"g"),ia=RegExp(ta+"(?="+ta+")|"+bp+Ku,"g"),Cp=RegExp([Zn+"?"+Zu+"+"+Hu+"(?="+[qu,Zn,"$"].join("|")+")",_p+"+"+zu+"(?="+[qu,Zn+Vu,"$"].join("|")+")",Zn+"?"+Vu+"+"+Hu,Zn+"+"+zu,xp,yp,Wu,wp].join("|"),"g"),Ap=RegExp("["+$u+Ti+Lu+Bu+"]"),Tp=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Rp=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],kp=-1,xe={};xe[Us]=xe[$s]=xe[Vs]=xe[Hs]=xe[zs]=xe[Ys]=xe[Xs]=xe[Ks]=xe[Js]=!0,xe[qn]=xe[bi]=xe[Nr]=xe[Rr]=xe[Wn]=xe[kr]=xe[Si]=xe[Ii]=xe[pt]=xe[Or]=xe[Et]=xe[Er]=xe[gt]=xe[Mr]=xe[Lr]=!1;var ye={};ye[qn]=ye[bi]=ye[Nr]=ye[Wn]=ye[Rr]=ye[kr]=ye[Us]=ye[$s]=ye[Vs]=ye[Hs]=ye[zs]=ye[pt]=ye[Or]=ye[Et]=ye[Er]=ye[gt]=ye[Mr]=ye[Ci]=ye[Ys]=ye[Xs]=ye[Ks]=ye[Js]=!0,ye[Si]=ye[Ii]=ye[Lr]=!1;var Op={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Ep={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Mp={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Lp={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Np=parseFloat,Pp=parseInt,Ju=typeof gi=="object"&&gi&&gi.Object===Object&&gi,Dp=typeof self=="object"&&self&&self.Object===Object&&self,Le=Ju||Dp||Function("return this")(),sa=r&&!r.nodeType&&r,ln=sa&&!0&&s&&!s.nodeType&&s,ju=ln&&ln.exports===sa,aa=ju&&Ju.process,rt=(function(){try{var y=ln&&ln.require&&ln.require("util").types;return y||aa&&aa.binding&&aa.binding("util")}catch{}})(),Qu=rt&&rt.isArrayBuffer,ec=rt&&rt.isDate,tc=rt&&rt.isMap,nc=rt&&rt.isRegExp,rc=rt&&rt.isSet,ic=rt&&rt.isTypedArray;function Ke(y,S,b){switch(b.length){case 0:return y.call(S);case 1:return y.call(S,b[0]);case 2:return y.call(S,b[0],b[1]);case 3:return y.call(S,b[0],b[1],b[2])}return y.apply(S,b)}function Bp(y,S,b,W){for(var Q=-1,de=y==null?0:y.length;++Q<de;){var ke=y[Q];S(W,ke,b(ke),y)}return W}function it(y,S){for(var b=-1,W=y==null?0:y.length;++b<W&&S(y[b],b,y)!==!1;);return y}function Fp(y,S){for(var b=y==null?0:y.length;b--&&S(y[b],b,y)!==!1;);return y}function sc(y,S){for(var b=-1,W=y==null?0:y.length;++b<W;)if(!S(y[b],b,y))return!1;return!0}function Ht(y,S){for(var b=-1,W=y==null?0:y.length,Q=0,de=[];++b<W;){var ke=y[b];S(ke,b,y)&&(de[Q++]=ke)}return de}function ki(y,S){var b=y==null?0:y.length;return!!b&&Gn(y,S,0)>-1}function oa(y,S,b){for(var W=-1,Q=y==null?0:y.length;++W<Q;)if(b(S,y[W]))return!0;return!1}function we(y,S){for(var b=-1,W=y==null?0:y.length,Q=Array(W);++b<W;)Q[b]=S(y[b],b,y);return Q}function zt(y,S){for(var b=-1,W=S.length,Q=y.length;++b<W;)y[Q+b]=S[b];return y}function ua(y,S,b,W){var Q=-1,de=y==null?0:y.length;for(W&&de&&(b=y[++Q]);++Q<de;)b=S(b,y[Q],Q,y);return b}function qp(y,S,b,W){var Q=y==null?0:y.length;for(W&&Q&&(b=y[--Q]);Q--;)b=S(b,y[Q],Q,y);return b}function ca(y,S){for(var b=-1,W=y==null?0:y.length;++b<W;)if(S(y[b],b,y))return!0;return!1}var Wp=la("length");function Zp(y){return y.split("")}function Gp(y){return y.match(Kh)||[]}function ac(y,S,b){var W;return b(y,function(Q,de,ke){if(S(Q,de,ke))return W=de,!1}),W}function Oi(y,S,b,W){for(var Q=y.length,de=b+(W?1:-1);W?de--:++de<Q;)if(S(y[de],de,y))return de;return-1}function Gn(y,S,b){return S===S?eg(y,S,b):Oi(y,oc,b)}function Up(y,S,b,W){for(var Q=b-1,de=y.length;++Q<de;)if(W(y[Q],S))return Q;return-1}function oc(y){return y!==y}function uc(y,S){var b=y==null?0:y.length;return b?da(y,S)/b:wi}function la(y){return function(S){return S==null?i:S[y]}}function fa(y){return function(S){return y==null?i:y[S]}}function cc(y,S,b,W,Q){return Q(y,function(de,ke,me){b=W?(W=!1,de):S(b,de,ke,me)}),b}function $p(y,S){var b=y.length;for(y.sort(S);b--;)y[b]=y[b].value;return y}function da(y,S){for(var b,W=-1,Q=y.length;++W<Q;){var de=S(y[W]);de!==i&&(b=b===i?de:b+de)}return b}function ha(y,S){for(var b=-1,W=Array(y);++b<y;)W[b]=S(b);return W}function Vp(y,S){return we(S,function(b){return[b,y[b]]})}function lc(y){return y&&y.slice(0,pc(y)+1).replace(Qs,"")}function Je(y){return function(S){return y(S)}}function pa(y,S){return we(S,function(b){return y[b]})}function Pr(y,S){return y.has(S)}function fc(y,S){for(var b=-1,W=y.length;++b<W&&Gn(S,y[b],0)>-1;);return b}function dc(y,S){for(var b=y.length;b--&&Gn(S,y[b],0)>-1;);return b}function Hp(y,S){for(var b=y.length,W=0;b--;)y[b]===S&&++W;return W}var zp=fa(Op),Yp=fa(Ep);function Xp(y){return"\\"+Lp[y]}function Kp(y,S){return y==null?i:y[S]}function Un(y){return Ap.test(y)}function Jp(y){return Tp.test(y)}function jp(y){for(var S,b=[];!(S=y.next()).done;)b.push(S.value);return b}function ga(y){var S=-1,b=Array(y.size);return y.forEach(function(W,Q){b[++S]=[Q,W]}),b}function hc(y,S){return function(b){return y(S(b))}}function Yt(y,S){for(var b=-1,W=y.length,Q=0,de=[];++b<W;){var ke=y[b];(ke===S||ke===w)&&(y[b]=w,de[Q++]=b)}return de}function Ei(y){var S=-1,b=Array(y.size);return y.forEach(function(W){b[++S]=W}),b}function Qp(y){var S=-1,b=Array(y.size);return y.forEach(function(W){b[++S]=[W,W]}),b}function eg(y,S,b){for(var W=b-1,Q=y.length;++W<Q;)if(y[W]===S)return W;return-1}function tg(y,S,b){for(var W=b+1;W--;)if(y[W]===S)return W;return W}function $n(y){return Un(y)?rg(y):Wp(y)}function mt(y){return Un(y)?ig(y):Zp(y)}function pc(y){for(var S=y.length;S--&&Hh.test(y.charAt(S)););return S}var ng=fa(Mp);function rg(y){for(var S=ia.lastIndex=0;ia.test(y);)++S;return S}function ig(y){return y.match(ia)||[]}function sg(y){return y.match(Cp)||[]}var ag=(function y(S){S=S==null?Le:Vn.defaults(Le.Object(),S,Vn.pick(Le,Rp));var b=S.Array,W=S.Date,Q=S.Error,de=S.Function,ke=S.Math,me=S.Object,ma=S.RegExp,og=S.String,st=S.TypeError,Mi=b.prototype,ug=de.prototype,Hn=me.prototype,Li=S["__core-js_shared__"],Ni=ug.toString,pe=Hn.hasOwnProperty,cg=0,gc=(function(){var e=/[^.]+$/.exec(Li&&Li.keys&&Li.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),Pi=Hn.toString,lg=Ni.call(me),fg=Le._,dg=ma("^"+Ni.call(pe).replace(js,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Di=ju?S.Buffer:i,Xt=S.Symbol,Bi=S.Uint8Array,mc=Di?Di.allocUnsafe:i,Fi=hc(me.getPrototypeOf,me),_c=me.create,vc=Hn.propertyIsEnumerable,qi=Mi.splice,yc=Xt?Xt.isConcatSpreadable:i,Dr=Xt?Xt.iterator:i,fn=Xt?Xt.toStringTag:i,Wi=(function(){try{var e=mn(me,"defineProperty");return e({},"",{}),e}catch{}})(),hg=S.clearTimeout!==Le.clearTimeout&&S.clearTimeout,pg=W&&W.now!==Le.Date.now&&W.now,gg=S.setTimeout!==Le.setTimeout&&S.setTimeout,Zi=ke.ceil,Gi=ke.floor,_a=me.getOwnPropertySymbols,mg=Di?Di.isBuffer:i,xc=S.isFinite,_g=Mi.join,vg=hc(me.keys,me),Oe=ke.max,De=ke.min,yg=W.now,xg=S.parseInt,wc=ke.random,wg=Mi.reverse,va=mn(S,"DataView"),Br=mn(S,"Map"),ya=mn(S,"Promise"),zn=mn(S,"Set"),Fr=mn(S,"WeakMap"),qr=mn(me,"create"),Ui=Fr&&new Fr,Yn={},bg=_n(va),Sg=_n(Br),Ig=_n(ya),Cg=_n(zn),Ag=_n(Fr),$i=Xt?Xt.prototype:i,Wr=$i?$i.valueOf:i,bc=$i?$i.toString:i;function f(e){if(Ce(e)&&!ee(e)&&!(e instanceof ce)){if(e instanceof at)return e;if(pe.call(e,"__wrapped__"))return Sl(e)}return new at(e)}var Xn=(function(){function e(){}return function(t){if(!Se(t))return{};if(_c)return _c(t);e.prototype=t;var n=new e;return e.prototype=i,n}})();function Vi(){}function at(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}f.templateSettings={escape:Wh,evaluate:Zh,interpolate:Eu,variable:"",imports:{_:f}},f.prototype=Vi.prototype,f.prototype.constructor=f,at.prototype=Xn(Vi.prototype),at.prototype.constructor=at;function ce(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=St,this.__views__=[]}function Tg(){var e=new ce(this.__wrapped__);return e.__actions__=$e(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=$e(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=$e(this.__views__),e}function Rg(){if(this.__filtered__){var e=new ce(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function kg(){var e=this.__wrapped__.value(),t=this.__dir__,n=ee(e),a=t<0,l=n?e.length:0,d=Zm(0,l,this.__views__),p=d.start,_=d.end,x=_-p,I=a?_:p-1,C=this.__iteratees__,T=C.length,D=0,$=De(x,this.__takeCount__);if(!n||!a&&l==x&&$==x)return Hc(e,this.__actions__);var X=[];e:for(;x--&&D<$;){I+=t;for(var ae=-1,K=e[I];++ae<T;){var ue=C[ae],le=ue.iteratee,et=ue.type,Ue=le(K);if(et==Sh)K=Ue;else if(!Ue){if(et==Au)continue e;break e}}X[D++]=K}return X}ce.prototype=Xn(Vi.prototype),ce.prototype.constructor=ce;function dn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}function Og(){this.__data__=qr?qr(null):{},this.size=0}function Eg(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Mg(e){var t=this.__data__;if(qr){var n=t[e];return n===m?i:n}return pe.call(t,e)?t[e]:i}function Lg(e){var t=this.__data__;return qr?t[e]!==i:pe.call(t,e)}function Ng(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=qr&&t===i?m:t,this}dn.prototype.clear=Og,dn.prototype.delete=Eg,dn.prototype.get=Mg,dn.prototype.has=Lg,dn.prototype.set=Ng;function Mt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}function Pg(){this.__data__=[],this.size=0}function Dg(e){var t=this.__data__,n=Hi(t,e);if(n<0)return!1;var a=t.length-1;return n==a?t.pop():qi.call(t,n,1),--this.size,!0}function Bg(e){var t=this.__data__,n=Hi(t,e);return n<0?i:t[n][1]}function Fg(e){return Hi(this.__data__,e)>-1}function qg(e,t){var n=this.__data__,a=Hi(n,e);return a<0?(++this.size,n.push([e,t])):n[a][1]=t,this}Mt.prototype.clear=Pg,Mt.prototype.delete=Dg,Mt.prototype.get=Bg,Mt.prototype.has=Fg,Mt.prototype.set=qg;function Lt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var a=e[t];this.set(a[0],a[1])}}function Wg(){this.size=0,this.__data__={hash:new dn,map:new(Br||Mt),string:new dn}}function Zg(e){var t=is(this,e).delete(e);return this.size-=t?1:0,t}function Gg(e){return is(this,e).get(e)}function Ug(e){return is(this,e).has(e)}function $g(e,t){var n=is(this,e),a=n.size;return n.set(e,t),this.size+=n.size==a?0:1,this}Lt.prototype.clear=Wg,Lt.prototype.delete=Zg,Lt.prototype.get=Gg,Lt.prototype.has=Ug,Lt.prototype.set=$g;function hn(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Lt;++t<n;)this.add(e[t])}function Vg(e){return this.__data__.set(e,m),this}function Hg(e){return this.__data__.has(e)}hn.prototype.add=hn.prototype.push=Vg,hn.prototype.has=Hg;function _t(e){var t=this.__data__=new Mt(e);this.size=t.size}function zg(){this.__data__=new Mt,this.size=0}function Yg(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Xg(e){return this.__data__.get(e)}function Kg(e){return this.__data__.has(e)}function Jg(e,t){var n=this.__data__;if(n instanceof Mt){var a=n.__data__;if(!Br||a.length<u-1)return a.push([e,t]),this.size=++n.size,this;n=this.__data__=new Lt(a)}return n.set(e,t),this.size=n.size,this}_t.prototype.clear=zg,_t.prototype.delete=Yg,_t.prototype.get=Xg,_t.prototype.has=Kg,_t.prototype.set=Jg;function Sc(e,t){var n=ee(e),a=!n&&vn(e),l=!n&&!a&&en(e),d=!n&&!a&&!l&&Qn(e),p=n||a||l||d,_=p?ha(e.length,og):[],x=_.length;for(var I in e)(t||pe.call(e,I))&&!(p&&(I=="length"||l&&(I=="offset"||I=="parent")||d&&(I=="buffer"||I=="byteLength"||I=="byteOffset")||Bt(I,x)))&&_.push(I);return _}function Ic(e){var t=e.length;return t?e[Oa(0,t-1)]:i}function jg(e,t){return ss($e(e),pn(t,0,e.length))}function Qg(e){return ss($e(e))}function xa(e,t,n){(n!==i&&!vt(e[t],n)||n===i&&!(t in e))&&Nt(e,t,n)}function Zr(e,t,n){var a=e[t];(!(pe.call(e,t)&&vt(a,n))||n===i&&!(t in e))&&Nt(e,t,n)}function Hi(e,t){for(var n=e.length;n--;)if(vt(e[n][0],t))return n;return-1}function em(e,t,n,a){return Kt(e,function(l,d,p){t(a,l,n(l),p)}),a}function Cc(e,t){return e&&Ct(t,Ee(t),e)}function tm(e,t){return e&&Ct(t,He(t),e)}function Nt(e,t,n){t=="__proto__"&&Wi?Wi(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function wa(e,t){for(var n=-1,a=t.length,l=b(a),d=e==null;++n<a;)l[n]=d?i:to(e,t[n]);return l}function pn(e,t,n){return e===e&&(n!==i&&(e=e<=n?e:n),t!==i&&(e=e>=t?e:t)),e}function ot(e,t,n,a,l,d){var p,_=t&O,x=t&q,I=t&Z;if(n&&(p=l?n(e,a,l,d):n(e)),p!==i)return p;if(!Se(e))return e;var C=ee(e);if(C){if(p=Um(e),!_)return $e(e,p)}else{var T=Be(e),D=T==Ii||T==Tu;if(en(e))return Xc(e,_);if(T==Et||T==qn||D&&!l){if(p=x||D?{}:pl(e),!_)return x?Mm(e,tm(p,e)):Em(e,Cc(p,e))}else{if(!ye[T])return l?e:{};p=$m(e,T,_)}}d||(d=new _t);var $=d.get(e);if($)return $;d.set(e,p),Ul(e)?e.forEach(function(K){p.add(ot(K,t,n,K,e,d))}):Zl(e)&&e.forEach(function(K,ue){p.set(ue,ot(K,t,n,ue,e,d))});var X=I?x?Za:Wa:x?He:Ee,ae=C?i:X(e);return it(ae||e,function(K,ue){ae&&(ue=K,K=e[ue]),Zr(p,ue,ot(K,t,n,ue,e,d))}),p}function nm(e){var t=Ee(e);return function(n){return Ac(n,e,t)}}function Ac(e,t,n){var a=n.length;if(e==null)return!a;for(e=me(e);a--;){var l=n[a],d=t[l],p=e[l];if(p===i&&!(l in e)||!d(p))return!1}return!0}function Tc(e,t,n){if(typeof e!="function")throw new st(h);return Yr(function(){e.apply(i,n)},t)}function Gr(e,t,n,a){var l=-1,d=ki,p=!0,_=e.length,x=[],I=t.length;if(!_)return x;n&&(t=we(t,Je(n))),a?(d=oa,p=!1):t.length>=u&&(d=Pr,p=!1,t=new hn(t));e:for(;++l<_;){var C=e[l],T=n==null?C:n(C);if(C=a||C!==0?C:0,p&&T===T){for(var D=I;D--;)if(t[D]===T)continue e;x.push(C)}else d(t,T,a)||x.push(C)}return x}var Kt=el(It),Rc=el(Sa,!0);function rm(e,t){var n=!0;return Kt(e,function(a,l,d){return n=!!t(a,l,d),n}),n}function zi(e,t,n){for(var a=-1,l=e.length;++a<l;){var d=e[a],p=t(d);if(p!=null&&(_===i?p===p&&!Qe(p):n(p,_)))var _=p,x=d}return x}function im(e,t,n,a){var l=e.length;for(n=re(n),n<0&&(n=-n>l?0:l+n),a=a===i||a>l?l:re(a),a<0&&(a+=l),a=n>a?0:Vl(a);n<a;)e[n++]=t;return e}function kc(e,t){var n=[];return Kt(e,function(a,l,d){t(a,l,d)&&n.push(a)}),n}function Ne(e,t,n,a,l){var d=-1,p=e.length;for(n||(n=Hm),l||(l=[]);++d<p;){var _=e[d];t>0&&n(_)?t>1?Ne(_,t-1,n,a,l):zt(l,_):a||(l[l.length]=_)}return l}var ba=tl(),Oc=tl(!0);function It(e,t){return e&&ba(e,t,Ee)}function Sa(e,t){return e&&Oc(e,t,Ee)}function Yi(e,t){return Ht(t,function(n){return Ft(e[n])})}function gn(e,t){t=jt(t,e);for(var n=0,a=t.length;e!=null&&n<a;)e=e[At(t[n++])];return n&&n==a?e:i}function Ec(e,t,n){var a=t(e);return ee(e)?a:zt(a,n(e))}function Ze(e){return e==null?e===i?Lh:Eh:fn&&fn in me(e)?Wm(e):Qm(e)}function Ia(e,t){return e>t}function sm(e,t){return e!=null&&pe.call(e,t)}function am(e,t){return e!=null&&t in me(e)}function om(e,t,n){return e>=De(t,n)&&e<Oe(t,n)}function Ca(e,t,n){for(var a=n?oa:ki,l=e[0].length,d=e.length,p=d,_=b(d),x=1/0,I=[];p--;){var C=e[p];p&&t&&(C=we(C,Je(t))),x=De(C.length,x),_[p]=!n&&(t||l>=120&&C.length>=120)?new hn(p&&C):i}C=e[0];var T=-1,D=_[0];e:for(;++T<l&&I.length<x;){var $=C[T],X=t?t($):$;if($=n||$!==0?$:0,!(D?Pr(D,X):a(I,X,n))){for(p=d;--p;){var ae=_[p];if(!(ae?Pr(ae,X):a(e[p],X,n)))continue e}D&&D.push(X),I.push($)}}return I}function um(e,t,n,a){return It(e,function(l,d,p){t(a,n(l),d,p)}),a}function Ur(e,t,n){t=jt(t,e),e=vl(e,t);var a=e==null?e:e[At(ct(t))];return a==null?i:Ke(a,e,n)}function Mc(e){return Ce(e)&&Ze(e)==qn}function cm(e){return Ce(e)&&Ze(e)==Nr}function lm(e){return Ce(e)&&Ze(e)==kr}function $r(e,t,n,a,l){return e===t?!0:e==null||t==null||!Ce(e)&&!Ce(t)?e!==e&&t!==t:fm(e,t,n,a,$r,l)}function fm(e,t,n,a,l,d){var p=ee(e),_=ee(t),x=p?bi:Be(e),I=_?bi:Be(t);x=x==qn?Et:x,I=I==qn?Et:I;var C=x==Et,T=I==Et,D=x==I;if(D&&en(e)){if(!en(t))return!1;p=!0,C=!1}if(D&&!C)return d||(d=new _t),p||Qn(e)?fl(e,t,n,a,l,d):Fm(e,t,x,n,a,l,d);if(!(n&L)){var $=C&&pe.call(e,"__wrapped__"),X=T&&pe.call(t,"__wrapped__");if($||X){var ae=$?e.value():e,K=X?t.value():t;return d||(d=new _t),l(ae,K,n,a,d)}}return D?(d||(d=new _t),qm(e,t,n,a,l,d)):!1}function dm(e){return Ce(e)&&Be(e)==pt}function Aa(e,t,n,a){var l=n.length,d=l,p=!a;if(e==null)return!d;for(e=me(e);l--;){var _=n[l];if(p&&_[2]?_[1]!==e[_[0]]:!(_[0]in e))return!1}for(;++l<d;){_=n[l];var x=_[0],I=e[x],C=_[1];if(p&&_[2]){if(I===i&&!(x in e))return!1}else{var T=new _t;if(a)var D=a(I,C,x,e,t,T);if(!(D===i?$r(C,I,L|P,a,T):D))return!1}}return!0}function Lc(e){if(!Se(e)||Ym(e))return!1;var t=Ft(e)?dg:np;return t.test(_n(e))}function hm(e){return Ce(e)&&Ze(e)==Er}function pm(e){return Ce(e)&&Be(e)==gt}function gm(e){return Ce(e)&&fs(e.length)&&!!xe[Ze(e)]}function Nc(e){return typeof e=="function"?e:e==null?ze:typeof e=="object"?ee(e)?Bc(e[0],e[1]):Dc(e):nf(e)}function Ta(e){if(!zr(e))return vg(e);var t=[];for(var n in me(e))pe.call(e,n)&&n!="constructor"&&t.push(n);return t}function mm(e){if(!Se(e))return jm(e);var t=zr(e),n=[];for(var a in e)a=="constructor"&&(t||!pe.call(e,a))||n.push(a);return n}function Ra(e,t){return e<t}function Pc(e,t){var n=-1,a=Ve(e)?b(e.length):[];return Kt(e,function(l,d,p){a[++n]=t(l,d,p)}),a}function Dc(e){var t=Ua(e);return t.length==1&&t[0][2]?ml(t[0][0],t[0][1]):function(n){return n===e||Aa(n,e,t)}}function Bc(e,t){return Va(e)&&gl(t)?ml(At(e),t):function(n){var a=to(n,e);return a===i&&a===t?no(n,e):$r(t,a,L|P)}}function Xi(e,t,n,a,l){e!==t&&ba(t,function(d,p){if(l||(l=new _t),Se(d))_m(e,t,p,n,Xi,a,l);else{var _=a?a(za(e,p),d,p+"",e,t,l):i;_===i&&(_=d),xa(e,p,_)}},He)}function _m(e,t,n,a,l,d,p){var _=za(e,n),x=za(t,n),I=p.get(x);if(I){xa(e,n,I);return}var C=d?d(_,x,n+"",e,t,p):i,T=C===i;if(T){var D=ee(x),$=!D&&en(x),X=!D&&!$&&Qn(x);C=x,D||$||X?ee(_)?C=_:Te(_)?C=$e(_):$?(T=!1,C=Xc(x,!0)):X?(T=!1,C=Kc(x,!0)):C=[]:Xr(x)||vn(x)?(C=_,vn(_)?C=Hl(_):(!Se(_)||Ft(_))&&(C=pl(x))):T=!1}T&&(p.set(x,C),l(C,x,a,d,p),p.delete(x)),xa(e,n,C)}function Fc(e,t){var n=e.length;if(n)return t+=t<0?n:0,Bt(t,n)?e[t]:i}function qc(e,t,n){t.length?t=we(t,function(d){return ee(d)?function(p){return gn(p,d.length===1?d[0]:d)}:d}):t=[ze];var a=-1;t=we(t,Je(z()));var l=Pc(e,function(d,p,_){var x=we(t,function(I){return I(d)});return{criteria:x,index:++a,value:d}});return $p(l,function(d,p){return Om(d,p,n)})}function vm(e,t){return Wc(e,t,function(n,a){return no(e,a)})}function Wc(e,t,n){for(var a=-1,l=t.length,d={};++a<l;){var p=t[a],_=gn(e,p);n(_,p)&&Vr(d,jt(p,e),_)}return d}function ym(e){return function(t){return gn(t,e)}}function ka(e,t,n,a){var l=a?Up:Gn,d=-1,p=t.length,_=e;for(e===t&&(t=$e(t)),n&&(_=we(e,Je(n)));++d<p;)for(var x=0,I=t[d],C=n?n(I):I;(x=l(_,C,x,a))>-1;)_!==e&&qi.call(_,x,1),qi.call(e,x,1);return e}function Zc(e,t){for(var n=e?t.length:0,a=n-1;n--;){var l=t[n];if(n==a||l!==d){var d=l;Bt(l)?qi.call(e,l,1):La(e,l)}}return e}function Oa(e,t){return e+Gi(wc()*(t-e+1))}function xm(e,t,n,a){for(var l=-1,d=Oe(Zi((t-e)/(n||1)),0),p=b(d);d--;)p[a?d:++l]=e,e+=n;return p}function Ea(e,t){var n="";if(!e||t<1||t>Vt)return n;do t%2&&(n+=e),t=Gi(t/2),t&&(e+=e);while(t);return n}function oe(e,t){return Ya(_l(e,t,ze),e+"")}function wm(e){return Ic(er(e))}function bm(e,t){var n=er(e);return ss(n,pn(t,0,n.length))}function Vr(e,t,n,a){if(!Se(e))return e;t=jt(t,e);for(var l=-1,d=t.length,p=d-1,_=e;_!=null&&++l<d;){var x=At(t[l]),I=n;if(x==="__proto__"||x==="constructor"||x==="prototype")return e;if(l!=p){var C=_[x];I=a?a(C,x,_):i,I===i&&(I=Se(C)?C:Bt(t[l+1])?[]:{})}Zr(_,x,I),_=_[x]}return e}var Gc=Ui?function(e,t){return Ui.set(e,t),e}:ze,Sm=Wi?function(e,t){return Wi(e,"toString",{configurable:!0,enumerable:!1,value:io(t),writable:!0})}:ze;function Im(e){return ss(er(e))}function ut(e,t,n){var a=-1,l=e.length;t<0&&(t=-t>l?0:l+t),n=n>l?l:n,n<0&&(n+=l),l=t>n?0:n-t>>>0,t>>>=0;for(var d=b(l);++a<l;)d[a]=e[a+t];return d}function Cm(e,t){var n;return Kt(e,function(a,l,d){return n=t(a,l,d),!n}),!!n}function Ki(e,t,n){var a=0,l=e==null?a:e.length;if(typeof t=="number"&&t===t&&l<=Th){for(;a<l;){var d=a+l>>>1,p=e[d];p!==null&&!Qe(p)&&(n?p<=t:p<t)?a=d+1:l=d}return l}return Ma(e,t,ze,n)}function Ma(e,t,n,a){var l=0,d=e==null?0:e.length;if(d===0)return 0;t=n(t);for(var p=t!==t,_=t===null,x=Qe(t),I=t===i;l<d;){var C=Gi((l+d)/2),T=n(e[C]),D=T!==i,$=T===null,X=T===T,ae=Qe(T);if(p)var K=a||X;else I?K=X&&(a||D):_?K=X&&D&&(a||!$):x?K=X&&D&&!$&&(a||!ae):$||ae?K=!1:K=a?T<=t:T<t;K?l=C+1:d=C}return De(d,Ah)}function Uc(e,t){for(var n=-1,a=e.length,l=0,d=[];++n<a;){var p=e[n],_=t?t(p):p;if(!n||!vt(_,x)){var x=_;d[l++]=p===0?0:p}}return d}function $c(e){return typeof e=="number"?e:Qe(e)?wi:+e}function je(e){if(typeof e=="string")return e;if(ee(e))return we(e,je)+"";if(Qe(e))return bc?bc.call(e):"";var t=e+"";return t=="0"&&1/e==-cn?"-0":t}function Jt(e,t,n){var a=-1,l=ki,d=e.length,p=!0,_=[],x=_;if(n)p=!1,l=oa;else if(d>=u){var I=t?null:Dm(e);if(I)return Ei(I);p=!1,l=Pr,x=new hn}else x=t?[]:_;e:for(;++a<d;){var C=e[a],T=t?t(C):C;if(C=n||C!==0?C:0,p&&T===T){for(var D=x.length;D--;)if(x[D]===T)continue e;t&&x.push(T),_.push(C)}else l(x,T,n)||(x!==_&&x.push(T),_.push(C))}return _}function La(e,t){return t=jt(t,e),e=vl(e,t),e==null||delete e[At(ct(t))]}function Vc(e,t,n,a){return Vr(e,t,n(gn(e,t)),a)}function Ji(e,t,n,a){for(var l=e.length,d=a?l:-1;(a?d--:++d<l)&&t(e[d],d,e););return n?ut(e,a?0:d,a?d+1:l):ut(e,a?d+1:0,a?l:d)}function Hc(e,t){var n=e;return n instanceof ce&&(n=n.value()),ua(t,function(a,l){return l.func.apply(l.thisArg,zt([a],l.args))},n)}function Na(e,t,n){var a=e.length;if(a<2)return a?Jt(e[0]):[];for(var l=-1,d=b(a);++l<a;)for(var p=e[l],_=-1;++_<a;)_!=l&&(d[l]=Gr(d[l]||p,e[_],t,n));return Jt(Ne(d,1),t,n)}function zc(e,t,n){for(var a=-1,l=e.length,d=t.length,p={};++a<l;){var _=a<d?t[a]:i;n(p,e[a],_)}return p}function Pa(e){return Te(e)?e:[]}function Da(e){return typeof e=="function"?e:ze}function jt(e,t){return ee(e)?e:Va(e,t)?[e]:bl(he(e))}var Am=oe;function Qt(e,t,n){var a=e.length;return n=n===i?a:n,!t&&n>=a?e:ut(e,t,n)}var Yc=hg||function(e){return Le.clearTimeout(e)};function Xc(e,t){if(t)return e.slice();var n=e.length,a=mc?mc(n):new e.constructor(n);return e.copy(a),a}function Ba(e){var t=new e.constructor(e.byteLength);return new Bi(t).set(new Bi(e)),t}function Tm(e,t){var n=t?Ba(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Rm(e){var t=new e.constructor(e.source,Mu.exec(e));return t.lastIndex=e.lastIndex,t}function km(e){return Wr?me(Wr.call(e)):{}}function Kc(e,t){var n=t?Ba(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Jc(e,t){if(e!==t){var n=e!==i,a=e===null,l=e===e,d=Qe(e),p=t!==i,_=t===null,x=t===t,I=Qe(t);if(!_&&!I&&!d&&e>t||d&&p&&x&&!_&&!I||a&&p&&x||!n&&x||!l)return 1;if(!a&&!d&&!I&&e<t||I&&n&&l&&!a&&!d||_&&n&&l||!p&&l||!x)return-1}return 0}function Om(e,t,n){for(var a=-1,l=e.criteria,d=t.criteria,p=l.length,_=n.length;++a<p;){var x=Jc(l[a],d[a]);if(x){if(a>=_)return x;var I=n[a];return x*(I=="desc"?-1:1)}}return e.index-t.index}function jc(e,t,n,a){for(var l=-1,d=e.length,p=n.length,_=-1,x=t.length,I=Oe(d-p,0),C=b(x+I),T=!a;++_<x;)C[_]=t[_];for(;++l<p;)(T||l<d)&&(C[n[l]]=e[l]);for(;I--;)C[_++]=e[l++];return C}function Qc(e,t,n,a){for(var l=-1,d=e.length,p=-1,_=n.length,x=-1,I=t.length,C=Oe(d-_,0),T=b(C+I),D=!a;++l<C;)T[l]=e[l];for(var $=l;++x<I;)T[$+x]=t[x];for(;++p<_;)(D||l<d)&&(T[$+n[p]]=e[l++]);return T}function $e(e,t){var n=-1,a=e.length;for(t||(t=b(a));++n<a;)t[n]=e[n];return t}function Ct(e,t,n,a){var l=!n;n||(n={});for(var d=-1,p=t.length;++d<p;){var _=t[d],x=a?a(n[_],e[_],_,n,e):i;x===i&&(x=e[_]),l?Nt(n,_,x):Zr(n,_,x)}return n}function Em(e,t){return Ct(e,$a(e),t)}function Mm(e,t){return Ct(e,dl(e),t)}function ji(e,t){return function(n,a){var l=ee(n)?Bp:em,d=t?t():{};return l(n,e,z(a,2),d)}}function Kn(e){return oe(function(t,n){var a=-1,l=n.length,d=l>1?n[l-1]:i,p=l>2?n[2]:i;for(d=e.length>3&&typeof d=="function"?(l--,d):i,p&&Ge(n[0],n[1],p)&&(d=l<3?i:d,l=1),t=me(t);++a<l;){var _=n[a];_&&e(t,_,a,d)}return t})}function el(e,t){return function(n,a){if(n==null)return n;if(!Ve(n))return e(n,a);for(var l=n.length,d=t?l:-1,p=me(n);(t?d--:++d<l)&&a(p[d],d,p)!==!1;);return n}}function tl(e){return function(t,n,a){for(var l=-1,d=me(t),p=a(t),_=p.length;_--;){var x=p[e?_:++l];if(n(d[x],x,d)===!1)break}return t}}function Lm(e,t,n){var a=t&H,l=Hr(e);function d(){var p=this&&this!==Le&&this instanceof d?l:e;return p.apply(a?n:this,arguments)}return d}function nl(e){return function(t){t=he(t);var n=Un(t)?mt(t):i,a=n?n[0]:t.charAt(0),l=n?Qt(n,1).join(""):t.slice(1);return a[e]()+l}}function Jn(e){return function(t){return ua(ef(Ql(t).replace(Sp,"")),e,"")}}function Hr(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Xn(e.prototype),a=e.apply(n,t);return Se(a)?a:n}}function Nm(e,t,n){var a=Hr(e);function l(){for(var d=arguments.length,p=b(d),_=d,x=jn(l);_--;)p[_]=arguments[_];var I=d<3&&p[0]!==x&&p[d-1]!==x?[]:Yt(p,x);if(d-=I.length,d<n)return ol(e,t,Qi,l.placeholder,i,p,I,i,i,n-d);var C=this&&this!==Le&&this instanceof l?a:e;return Ke(C,this,p)}return l}function rl(e){return function(t,n,a){var l=me(t);if(!Ve(t)){var d=z(n,3);t=Ee(t),n=function(_){return d(l[_],_,l)}}var p=e(t,n,a);return p>-1?l[d?t[p]:p]:i}}function il(e){return Dt(function(t){var n=t.length,a=n,l=at.prototype.thru;for(e&&t.reverse();a--;){var d=t[a];if(typeof d!="function")throw new st(h);if(l&&!p&&rs(d)=="wrapper")var p=new at([],!0)}for(a=p?a:n;++a<n;){d=t[a];var _=rs(d),x=_=="wrapper"?Ga(d):i;x&&Ha(x[0])&&x[1]==(Ae|se|E|Me)&&!x[4].length&&x[9]==1?p=p[rs(x[0])].apply(p,x[3]):p=d.length==1&&Ha(d)?p[_]():p.thru(d)}return function(){var I=arguments,C=I[0];if(p&&I.length==1&&ee(C))return p.plant(C).value();for(var T=0,D=n?t[T].apply(this,I):C;++T<n;)D=t[T].call(this,D);return D}})}function Qi(e,t,n,a,l,d,p,_,x,I){var C=t&Ae,T=t&H,D=t&V,$=t&(se|M),X=t&Tr,ae=D?i:Hr(e);function K(){for(var ue=arguments.length,le=b(ue),et=ue;et--;)le[et]=arguments[et];if($)var Ue=jn(K),tt=Hp(le,Ue);if(a&&(le=jc(le,a,l,$)),d&&(le=Qc(le,d,p,$)),ue-=tt,$&&ue<I){var Re=Yt(le,Ue);return ol(e,t,Qi,K.placeholder,n,le,Re,_,x,I-ue)}var yt=T?n:this,Wt=D?yt[e]:e;return ue=le.length,_?le=e_(le,_):X&&ue>1&&le.reverse(),C&&x<ue&&(le.length=x),this&&this!==Le&&this instanceof K&&(Wt=ae||Hr(Wt)),Wt.apply(yt,le)}return K}function sl(e,t){return function(n,a){return um(n,e,t(a),{})}}function es(e,t){return function(n,a){var l;if(n===i&&a===i)return t;if(n!==i&&(l=n),a!==i){if(l===i)return a;typeof n=="string"||typeof a=="string"?(n=je(n),a=je(a)):(n=$c(n),a=$c(a)),l=e(n,a)}return l}}function Fa(e){return Dt(function(t){return t=we(t,Je(z())),oe(function(n){var a=this;return e(t,function(l){return Ke(l,a,n)})})})}function ts(e,t){t=t===i?" ":je(t);var n=t.length;if(n<2)return n?Ea(t,e):t;var a=Ea(t,Zi(e/$n(t)));return Un(t)?Qt(mt(a),0,e).join(""):a.slice(0,e)}function Pm(e,t,n,a){var l=t&H,d=Hr(e);function p(){for(var _=-1,x=arguments.length,I=-1,C=a.length,T=b(C+x),D=this&&this!==Le&&this instanceof p?d:e;++I<C;)T[I]=a[I];for(;x--;)T[I++]=arguments[++_];return Ke(D,l?n:this,T)}return p}function al(e){return function(t,n,a){return a&&typeof a!="number"&&Ge(t,n,a)&&(n=a=i),t=qt(t),n===i?(n=t,t=0):n=qt(n),a=a===i?t<n?1:-1:qt(a),xm(t,n,a,e)}}function ns(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=lt(t),n=lt(n)),e(t,n)}}function ol(e,t,n,a,l,d,p,_,x,I){var C=t&se,T=C?p:i,D=C?i:p,$=C?d:i,X=C?i:d;t|=C?E:ve,t&=~(C?ve:E),t&ne||(t&=-4);var ae=[e,t,l,$,T,X,D,_,x,I],K=n.apply(i,ae);return Ha(e)&&yl(K,ae),K.placeholder=a,xl(K,e,t)}function qa(e){var t=ke[e];return function(n,a){if(n=lt(n),a=a==null?0:De(re(a),292),a&&xc(n)){var l=(he(n)+"e").split("e"),d=t(l[0]+"e"+(+l[1]+a));return l=(he(d)+"e").split("e"),+(l[0]+"e"+(+l[1]-a))}return t(n)}}var Dm=zn&&1/Ei(new zn([,-0]))[1]==cn?function(e){return new zn(e)}:oo;function ul(e){return function(t){var n=Be(t);return n==pt?ga(t):n==gt?Qp(t):Vp(t,e(t))}}function Pt(e,t,n,a,l,d,p,_){var x=t&V;if(!x&&typeof e!="function")throw new st(h);var I=a?a.length:0;if(I||(t&=-97,a=l=i),p=p===i?p:Oe(re(p),0),_=_===i?_:re(_),I-=l?l.length:0,t&ve){var C=a,T=l;a=l=i}var D=x?i:Ga(e),$=[e,t,n,a,l,C,T,d,p,_];if(D&&Jm($,D),e=$[0],t=$[1],n=$[2],a=$[3],l=$[4],_=$[9]=$[9]===i?x?0:e.length:Oe($[9]-I,0),!_&&t&(se|M)&&(t&=-25),!t||t==H)var X=Lm(e,t,n);else t==se||t==M?X=Nm(e,t,_):(t==E||t==(H|E))&&!l.length?X=Pm(e,t,n,a):X=Qi.apply(i,$);var ae=D?Gc:yl;return xl(ae(X,$),e,t)}function cl(e,t,n,a){return e===i||vt(e,Hn[n])&&!pe.call(a,n)?t:e}function ll(e,t,n,a,l,d){return Se(e)&&Se(t)&&(d.set(t,e),Xi(e,t,i,ll,d),d.delete(t)),e}function Bm(e){return Xr(e)?i:e}function fl(e,t,n,a,l,d){var p=n&L,_=e.length,x=t.length;if(_!=x&&!(p&&x>_))return!1;var I=d.get(e),C=d.get(t);if(I&&C)return I==t&&C==e;var T=-1,D=!0,$=n&P?new hn:i;for(d.set(e,t),d.set(t,e);++T<_;){var X=e[T],ae=t[T];if(a)var K=p?a(ae,X,T,t,e,d):a(X,ae,T,e,t,d);if(K!==i){if(K)continue;D=!1;break}if($){if(!ca(t,function(ue,le){if(!Pr($,le)&&(X===ue||l(X,ue,n,a,d)))return $.push(le)})){D=!1;break}}else if(!(X===ae||l(X,ae,n,a,d))){D=!1;break}}return d.delete(e),d.delete(t),D}function Fm(e,t,n,a,l,d,p){switch(n){case Wn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Nr:return!(e.byteLength!=t.byteLength||!d(new Bi(e),new Bi(t)));case Rr:case kr:case Or:return vt(+e,+t);case Si:return e.name==t.name&&e.message==t.message;case Er:case Mr:return e==t+"";case pt:var _=ga;case gt:var x=a&L;if(_||(_=Ei),e.size!=t.size&&!x)return!1;var I=p.get(e);if(I)return I==t;a|=P,p.set(e,t);var C=fl(_(e),_(t),a,l,d,p);return p.delete(e),C;case Ci:if(Wr)return Wr.call(e)==Wr.call(t)}return!1}function qm(e,t,n,a,l,d){var p=n&L,_=Wa(e),x=_.length,I=Wa(t),C=I.length;if(x!=C&&!p)return!1;for(var T=x;T--;){var D=_[T];if(!(p?D in t:pe.call(t,D)))return!1}var $=d.get(e),X=d.get(t);if($&&X)return $==t&&X==e;var ae=!0;d.set(e,t),d.set(t,e);for(var K=p;++T<x;){D=_[T];var ue=e[D],le=t[D];if(a)var et=p?a(le,ue,D,t,e,d):a(ue,le,D,e,t,d);if(!(et===i?ue===le||l(ue,le,n,a,d):et)){ae=!1;break}K||(K=D=="constructor")}if(ae&&!K){var Ue=e.constructor,tt=t.constructor;Ue!=tt&&"constructor"in e&&"constructor"in t&&!(typeof Ue=="function"&&Ue instanceof Ue&&typeof tt=="function"&&tt instanceof tt)&&(ae=!1)}return d.delete(e),d.delete(t),ae}function Dt(e){return Ya(_l(e,i,Al),e+"")}function Wa(e){return Ec(e,Ee,$a)}function Za(e){return Ec(e,He,dl)}var Ga=Ui?function(e){return Ui.get(e)}:oo;function rs(e){for(var t=e.name+"",n=Yn[t],a=pe.call(Yn,t)?n.length:0;a--;){var l=n[a],d=l.func;if(d==null||d==e)return l.name}return t}function jn(e){var t=pe.call(f,"placeholder")?f:e;return t.placeholder}function z(){var e=f.iteratee||so;return e=e===so?Nc:e,arguments.length?e(arguments[0],arguments[1]):e}function is(e,t){var n=e.__data__;return zm(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Ua(e){for(var t=Ee(e),n=t.length;n--;){var a=t[n],l=e[a];t[n]=[a,l,gl(l)]}return t}function mn(e,t){var n=Kp(e,t);return Lc(n)?n:i}function Wm(e){var t=pe.call(e,fn),n=e[fn];try{e[fn]=i;var a=!0}catch{}var l=Pi.call(e);return a&&(t?e[fn]=n:delete e[fn]),l}var $a=_a?function(e){return e==null?[]:(e=me(e),Ht(_a(e),function(t){return vc.call(e,t)}))}:uo,dl=_a?function(e){for(var t=[];e;)zt(t,$a(e)),e=Fi(e);return t}:uo,Be=Ze;(va&&Be(new va(new ArrayBuffer(1)))!=Wn||Br&&Be(new Br)!=pt||ya&&Be(ya.resolve())!=Ru||zn&&Be(new zn)!=gt||Fr&&Be(new Fr)!=Lr)&&(Be=function(e){var t=Ze(e),n=t==Et?e.constructor:i,a=n?_n(n):"";if(a)switch(a){case bg:return Wn;case Sg:return pt;case Ig:return Ru;case Cg:return gt;case Ag:return Lr}return t});function Zm(e,t,n){for(var a=-1,l=n.length;++a<l;){var d=n[a],p=d.size;switch(d.type){case"drop":e+=p;break;case"dropRight":t-=p;break;case"take":t=De(t,e+p);break;case"takeRight":e=Oe(e,t-p);break}}return{start:e,end:t}}function Gm(e){var t=e.match(Yh);return t?t[1].split(Xh):[]}function hl(e,t,n){t=jt(t,e);for(var a=-1,l=t.length,d=!1;++a<l;){var p=At(t[a]);if(!(d=e!=null&&n(e,p)))break;e=e[p]}return d||++a!=l?d:(l=e==null?0:e.length,!!l&&fs(l)&&Bt(p,l)&&(ee(e)||vn(e)))}function Um(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&pe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function pl(e){return typeof e.constructor=="function"&&!zr(e)?Xn(Fi(e)):{}}function $m(e,t,n){var a=e.constructor;switch(t){case Nr:return Ba(e);case Rr:case kr:return new a(+e);case Wn:return Tm(e,n);case Us:case $s:case Vs:case Hs:case zs:case Ys:case Xs:case Ks:case Js:return Kc(e,n);case pt:return new a;case Or:case Mr:return new a(e);case Er:return Rm(e);case gt:return new a;case Ci:return km(e)}}function Vm(e,t){var n=t.length;if(!n)return e;var a=n-1;return t[a]=(n>1?"& ":"")+t[a],t=t.join(n>2?", ":" "),e.replace(zh,`{
2
+ /* [wrapped with `+t+`] */
3
+ `)}function Hm(e){return ee(e)||vn(e)||!!(yc&&e&&e[yc])}function Bt(e,t){var n=typeof e;return t=t??Vt,!!t&&(n=="number"||n!="symbol"&&ip.test(e))&&e>-1&&e%1==0&&e<t}function Ge(e,t,n){if(!Se(n))return!1;var a=typeof t;return(a=="number"?Ve(n)&&Bt(t,n.length):a=="string"&&t in n)?vt(n[t],e):!1}function Va(e,t){if(ee(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Qe(e)?!0:Uh.test(e)||!Gh.test(e)||t!=null&&e in me(t)}function zm(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ha(e){var t=rs(e),n=f[t];if(typeof n!="function"||!(t in ce.prototype))return!1;if(e===n)return!0;var a=Ga(n);return!!a&&e===a[0]}function Ym(e){return!!gc&&gc in e}var Xm=Li?Ft:co;function zr(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Hn;return e===n}function gl(e){return e===e&&!Se(e)}function ml(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==i||e in me(n))}}function Km(e){var t=cs(e,function(a){return n.size===v&&n.clear(),a}),n=t.cache;return t}function Jm(e,t){var n=e[1],a=t[1],l=n|a,d=l<(H|V|Ae),p=a==Ae&&n==se||a==Ae&&n==Me&&e[7].length<=t[8]||a==(Ae|Me)&&t[7].length<=t[8]&&n==se;if(!(d||p))return e;a&H&&(e[2]=t[2],l|=n&H?0:ne);var _=t[3];if(_){var x=e[3];e[3]=x?jc(x,_,t[4]):_,e[4]=x?Yt(e[3],w):t[4]}return _=t[5],_&&(x=e[5],e[5]=x?Qc(x,_,t[6]):_,e[6]=x?Yt(e[5],w):t[6]),_=t[7],_&&(e[7]=_),a&Ae&&(e[8]=e[8]==null?t[8]:De(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=l,e}function jm(e){var t=[];if(e!=null)for(var n in me(e))t.push(n);return t}function Qm(e){return Pi.call(e)}function _l(e,t,n){return t=Oe(t===i?e.length-1:t,0),function(){for(var a=arguments,l=-1,d=Oe(a.length-t,0),p=b(d);++l<d;)p[l]=a[t+l];l=-1;for(var _=b(t+1);++l<t;)_[l]=a[l];return _[t]=n(p),Ke(e,this,_)}}function vl(e,t){return t.length<2?e:gn(e,ut(t,0,-1))}function e_(e,t){for(var n=e.length,a=De(t.length,n),l=$e(e);a--;){var d=t[a];e[a]=Bt(d,n)?l[d]:i}return e}function za(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var yl=wl(Gc),Yr=gg||function(e,t){return Le.setTimeout(e,t)},Ya=wl(Sm);function xl(e,t,n){var a=t+"";return Ya(e,Vm(a,t_(Gm(a),n)))}function wl(e){var t=0,n=0;return function(){var a=yg(),l=bh-(a-n);if(n=a,l>0){if(++t>=wh)return arguments[0]}else t=0;return e.apply(i,arguments)}}function ss(e,t){var n=-1,a=e.length,l=a-1;for(t=t===i?a:t;++n<t;){var d=Oa(n,l),p=e[d];e[d]=e[n],e[n]=p}return e.length=t,e}var bl=Km(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace($h,function(n,a,l,d){t.push(l?d.replace(jh,"$1"):a||n)}),t});function At(e){if(typeof e=="string"||Qe(e))return e;var t=e+"";return t=="0"&&1/e==-cn?"-0":t}function _n(e){if(e!=null){try{return Ni.call(e)}catch{}try{return e+""}catch{}}return""}function t_(e,t){return it(Rh,function(n){var a="_."+n[0];t&n[1]&&!ki(e,a)&&e.push(a)}),e.sort()}function Sl(e){if(e instanceof ce)return e.clone();var t=new at(e.__wrapped__,e.__chain__);return t.__actions__=$e(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function n_(e,t,n){(n?Ge(e,t,n):t===i)?t=1:t=Oe(re(t),0);var a=e==null?0:e.length;if(!a||t<1)return[];for(var l=0,d=0,p=b(Zi(a/t));l<a;)p[d++]=ut(e,l,l+=t);return p}function r_(e){for(var t=-1,n=e==null?0:e.length,a=0,l=[];++t<n;){var d=e[t];d&&(l[a++]=d)}return l}function i_(){var e=arguments.length;if(!e)return[];for(var t=b(e-1),n=arguments[0],a=e;a--;)t[a-1]=arguments[a];return zt(ee(n)?$e(n):[n],Ne(t,1))}var s_=oe(function(e,t){return Te(e)?Gr(e,Ne(t,1,Te,!0)):[]}),a_=oe(function(e,t){var n=ct(t);return Te(n)&&(n=i),Te(e)?Gr(e,Ne(t,1,Te,!0),z(n,2)):[]}),o_=oe(function(e,t){var n=ct(t);return Te(n)&&(n=i),Te(e)?Gr(e,Ne(t,1,Te,!0),i,n):[]});function u_(e,t,n){var a=e==null?0:e.length;return a?(t=n||t===i?1:re(t),ut(e,t<0?0:t,a)):[]}function c_(e,t,n){var a=e==null?0:e.length;return a?(t=n||t===i?1:re(t),t=a-t,ut(e,0,t<0?0:t)):[]}function l_(e,t){return e&&e.length?Ji(e,z(t,3),!0,!0):[]}function f_(e,t){return e&&e.length?Ji(e,z(t,3),!0):[]}function d_(e,t,n,a){var l=e==null?0:e.length;return l?(n&&typeof n!="number"&&Ge(e,t,n)&&(n=0,a=l),im(e,t,n,a)):[]}function Il(e,t,n){var a=e==null?0:e.length;if(!a)return-1;var l=n==null?0:re(n);return l<0&&(l=Oe(a+l,0)),Oi(e,z(t,3),l)}function Cl(e,t,n){var a=e==null?0:e.length;if(!a)return-1;var l=a-1;return n!==i&&(l=re(n),l=n<0?Oe(a+l,0):De(l,a-1)),Oi(e,z(t,3),l,!0)}function Al(e){var t=e==null?0:e.length;return t?Ne(e,1):[]}function h_(e){var t=e==null?0:e.length;return t?Ne(e,cn):[]}function p_(e,t){var n=e==null?0:e.length;return n?(t=t===i?1:re(t),Ne(e,t)):[]}function g_(e){for(var t=-1,n=e==null?0:e.length,a={};++t<n;){var l=e[t];a[l[0]]=l[1]}return a}function Tl(e){return e&&e.length?e[0]:i}function m_(e,t,n){var a=e==null?0:e.length;if(!a)return-1;var l=n==null?0:re(n);return l<0&&(l=Oe(a+l,0)),Gn(e,t,l)}function __(e){var t=e==null?0:e.length;return t?ut(e,0,-1):[]}var v_=oe(function(e){var t=we(e,Pa);return t.length&&t[0]===e[0]?Ca(t):[]}),y_=oe(function(e){var t=ct(e),n=we(e,Pa);return t===ct(n)?t=i:n.pop(),n.length&&n[0]===e[0]?Ca(n,z(t,2)):[]}),x_=oe(function(e){var t=ct(e),n=we(e,Pa);return t=typeof t=="function"?t:i,t&&n.pop(),n.length&&n[0]===e[0]?Ca(n,i,t):[]});function w_(e,t){return e==null?"":_g.call(e,t)}function ct(e){var t=e==null?0:e.length;return t?e[t-1]:i}function b_(e,t,n){var a=e==null?0:e.length;if(!a)return-1;var l=a;return n!==i&&(l=re(n),l=l<0?Oe(a+l,0):De(l,a-1)),t===t?tg(e,t,l):Oi(e,oc,l,!0)}function S_(e,t){return e&&e.length?Fc(e,re(t)):i}var I_=oe(Rl);function Rl(e,t){return e&&e.length&&t&&t.length?ka(e,t):e}function C_(e,t,n){return e&&e.length&&t&&t.length?ka(e,t,z(n,2)):e}function A_(e,t,n){return e&&e.length&&t&&t.length?ka(e,t,i,n):e}var T_=Dt(function(e,t){var n=e==null?0:e.length,a=wa(e,t);return Zc(e,we(t,function(l){return Bt(l,n)?+l:l}).sort(Jc)),a});function R_(e,t){var n=[];if(!(e&&e.length))return n;var a=-1,l=[],d=e.length;for(t=z(t,3);++a<d;){var p=e[a];t(p,a,e)&&(n.push(p),l.push(a))}return Zc(e,l),n}function Xa(e){return e==null?e:wg.call(e)}function k_(e,t,n){var a=e==null?0:e.length;return a?(n&&typeof n!="number"&&Ge(e,t,n)?(t=0,n=a):(t=t==null?0:re(t),n=n===i?a:re(n)),ut(e,t,n)):[]}function O_(e,t){return Ki(e,t)}function E_(e,t,n){return Ma(e,t,z(n,2))}function M_(e,t){var n=e==null?0:e.length;if(n){var a=Ki(e,t);if(a<n&&vt(e[a],t))return a}return-1}function L_(e,t){return Ki(e,t,!0)}function N_(e,t,n){return Ma(e,t,z(n,2),!0)}function P_(e,t){var n=e==null?0:e.length;if(n){var a=Ki(e,t,!0)-1;if(vt(e[a],t))return a}return-1}function D_(e){return e&&e.length?Uc(e):[]}function B_(e,t){return e&&e.length?Uc(e,z(t,2)):[]}function F_(e){var t=e==null?0:e.length;return t?ut(e,1,t):[]}function q_(e,t,n){return e&&e.length?(t=n||t===i?1:re(t),ut(e,0,t<0?0:t)):[]}function W_(e,t,n){var a=e==null?0:e.length;return a?(t=n||t===i?1:re(t),t=a-t,ut(e,t<0?0:t,a)):[]}function Z_(e,t){return e&&e.length?Ji(e,z(t,3),!1,!0):[]}function G_(e,t){return e&&e.length?Ji(e,z(t,3)):[]}var U_=oe(function(e){return Jt(Ne(e,1,Te,!0))}),$_=oe(function(e){var t=ct(e);return Te(t)&&(t=i),Jt(Ne(e,1,Te,!0),z(t,2))}),V_=oe(function(e){var t=ct(e);return t=typeof t=="function"?t:i,Jt(Ne(e,1,Te,!0),i,t)});function H_(e){return e&&e.length?Jt(e):[]}function z_(e,t){return e&&e.length?Jt(e,z(t,2)):[]}function Y_(e,t){return t=typeof t=="function"?t:i,e&&e.length?Jt(e,i,t):[]}function Ka(e){if(!(e&&e.length))return[];var t=0;return e=Ht(e,function(n){if(Te(n))return t=Oe(n.length,t),!0}),ha(t,function(n){return we(e,la(n))})}function kl(e,t){if(!(e&&e.length))return[];var n=Ka(e);return t==null?n:we(n,function(a){return Ke(t,i,a)})}var X_=oe(function(e,t){return Te(e)?Gr(e,t):[]}),K_=oe(function(e){return Na(Ht(e,Te))}),J_=oe(function(e){var t=ct(e);return Te(t)&&(t=i),Na(Ht(e,Te),z(t,2))}),j_=oe(function(e){var t=ct(e);return t=typeof t=="function"?t:i,Na(Ht(e,Te),i,t)}),Q_=oe(Ka);function ev(e,t){return zc(e||[],t||[],Zr)}function tv(e,t){return zc(e||[],t||[],Vr)}var nv=oe(function(e){var t=e.length,n=t>1?e[t-1]:i;return n=typeof n=="function"?(e.pop(),n):i,kl(e,n)});function Ol(e){var t=f(e);return t.__chain__=!0,t}function rv(e,t){return t(e),e}function as(e,t){return t(e)}var iv=Dt(function(e){var t=e.length,n=t?e[0]:0,a=this.__wrapped__,l=function(d){return wa(d,e)};return t>1||this.__actions__.length||!(a instanceof ce)||!Bt(n)?this.thru(l):(a=a.slice(n,+n+(t?1:0)),a.__actions__.push({func:as,args:[l],thisArg:i}),new at(a,this.__chain__).thru(function(d){return t&&!d.length&&d.push(i),d}))});function sv(){return Ol(this)}function av(){return new at(this.value(),this.__chain__)}function ov(){this.__values__===i&&(this.__values__=$l(this.value()));var e=this.__index__>=this.__values__.length,t=e?i:this.__values__[this.__index__++];return{done:e,value:t}}function uv(){return this}function cv(e){for(var t,n=this;n instanceof Vi;){var a=Sl(n);a.__index__=0,a.__values__=i,t?l.__wrapped__=a:t=a;var l=a;n=n.__wrapped__}return l.__wrapped__=e,t}function lv(){var e=this.__wrapped__;if(e instanceof ce){var t=e;return this.__actions__.length&&(t=new ce(this)),t=t.reverse(),t.__actions__.push({func:as,args:[Xa],thisArg:i}),new at(t,this.__chain__)}return this.thru(Xa)}function fv(){return Hc(this.__wrapped__,this.__actions__)}var dv=ji(function(e,t,n){pe.call(e,n)?++e[n]:Nt(e,n,1)});function hv(e,t,n){var a=ee(e)?sc:rm;return n&&Ge(e,t,n)&&(t=i),a(e,z(t,3))}function pv(e,t){var n=ee(e)?Ht:kc;return n(e,z(t,3))}var gv=rl(Il),mv=rl(Cl);function _v(e,t){return Ne(os(e,t),1)}function vv(e,t){return Ne(os(e,t),cn)}function yv(e,t,n){return n=n===i?1:re(n),Ne(os(e,t),n)}function El(e,t){var n=ee(e)?it:Kt;return n(e,z(t,3))}function Ml(e,t){var n=ee(e)?Fp:Rc;return n(e,z(t,3))}var xv=ji(function(e,t,n){pe.call(e,n)?e[n].push(t):Nt(e,n,[t])});function wv(e,t,n,a){e=Ve(e)?e:er(e),n=n&&!a?re(n):0;var l=e.length;return n<0&&(n=Oe(l+n,0)),ds(e)?n<=l&&e.indexOf(t,n)>-1:!!l&&Gn(e,t,n)>-1}var bv=oe(function(e,t,n){var a=-1,l=typeof t=="function",d=Ve(e)?b(e.length):[];return Kt(e,function(p){d[++a]=l?Ke(t,p,n):Ur(p,t,n)}),d}),Sv=ji(function(e,t,n){Nt(e,n,t)});function os(e,t){var n=ee(e)?we:Pc;return n(e,z(t,3))}function Iv(e,t,n,a){return e==null?[]:(ee(t)||(t=t==null?[]:[t]),n=a?i:n,ee(n)||(n=n==null?[]:[n]),qc(e,t,n))}var Cv=ji(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Av(e,t,n){var a=ee(e)?ua:cc,l=arguments.length<3;return a(e,z(t,4),n,l,Kt)}function Tv(e,t,n){var a=ee(e)?qp:cc,l=arguments.length<3;return a(e,z(t,4),n,l,Rc)}function Rv(e,t){var n=ee(e)?Ht:kc;return n(e,ls(z(t,3)))}function kv(e){var t=ee(e)?Ic:wm;return t(e)}function Ov(e,t,n){(n?Ge(e,t,n):t===i)?t=1:t=re(t);var a=ee(e)?jg:bm;return a(e,t)}function Ev(e){var t=ee(e)?Qg:Im;return t(e)}function Mv(e){if(e==null)return 0;if(Ve(e))return ds(e)?$n(e):e.length;var t=Be(e);return t==pt||t==gt?e.size:Ta(e).length}function Lv(e,t,n){var a=ee(e)?ca:Cm;return n&&Ge(e,t,n)&&(t=i),a(e,z(t,3))}var Nv=oe(function(e,t){if(e==null)return[];var n=t.length;return n>1&&Ge(e,t[0],t[1])?t=[]:n>2&&Ge(t[0],t[1],t[2])&&(t=[t[0]]),qc(e,Ne(t,1),[])}),us=pg||function(){return Le.Date.now()};function Pv(e,t){if(typeof t!="function")throw new st(h);return e=re(e),function(){if(--e<1)return t.apply(this,arguments)}}function Ll(e,t,n){return t=n?i:t,t=e&&t==null?e.length:t,Pt(e,Ae,i,i,i,i,t)}function Nl(e,t){var n;if(typeof t!="function")throw new st(h);return e=re(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var Ja=oe(function(e,t,n){var a=H;if(n.length){var l=Yt(n,jn(Ja));a|=E}return Pt(e,a,t,n,l)}),Pl=oe(function(e,t,n){var a=H|V;if(n.length){var l=Yt(n,jn(Pl));a|=E}return Pt(t,a,e,n,l)});function Dl(e,t,n){t=n?i:t;var a=Pt(e,se,i,i,i,i,i,t);return a.placeholder=Dl.placeholder,a}function Bl(e,t,n){t=n?i:t;var a=Pt(e,M,i,i,i,i,i,t);return a.placeholder=Bl.placeholder,a}function Fl(e,t,n){var a,l,d,p,_,x,I=0,C=!1,T=!1,D=!0;if(typeof e!="function")throw new st(h);t=lt(t)||0,Se(n)&&(C=!!n.leading,T="maxWait"in n,d=T?Oe(lt(n.maxWait)||0,t):d,D="trailing"in n?!!n.trailing:D);function $(Re){var yt=a,Wt=l;return a=l=i,I=Re,p=e.apply(Wt,yt),p}function X(Re){return I=Re,_=Yr(ue,t),C?$(Re):p}function ae(Re){var yt=Re-x,Wt=Re-I,rf=t-yt;return T?De(rf,d-Wt):rf}function K(Re){var yt=Re-x,Wt=Re-I;return x===i||yt>=t||yt<0||T&&Wt>=d}function ue(){var Re=us();if(K(Re))return le(Re);_=Yr(ue,ae(Re))}function le(Re){return _=i,D&&a?$(Re):(a=l=i,p)}function et(){_!==i&&Yc(_),I=0,a=x=l=_=i}function Ue(){return _===i?p:le(us())}function tt(){var Re=us(),yt=K(Re);if(a=arguments,l=this,x=Re,yt){if(_===i)return X(x);if(T)return Yc(_),_=Yr(ue,t),$(x)}return _===i&&(_=Yr(ue,t)),p}return tt.cancel=et,tt.flush=Ue,tt}var Dv=oe(function(e,t){return Tc(e,1,t)}),Bv=oe(function(e,t,n){return Tc(e,lt(t)||0,n)});function Fv(e){return Pt(e,Tr)}function cs(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new st(h);var n=function(){var a=arguments,l=t?t.apply(this,a):a[0],d=n.cache;if(d.has(l))return d.get(l);var p=e.apply(this,a);return n.cache=d.set(l,p)||d,p};return n.cache=new(cs.Cache||Lt),n}cs.Cache=Lt;function ls(e){if(typeof e!="function")throw new st(h);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function qv(e){return Nl(2,e)}var Wv=Am(function(e,t){t=t.length==1&&ee(t[0])?we(t[0],Je(z())):we(Ne(t,1),Je(z()));var n=t.length;return oe(function(a){for(var l=-1,d=De(a.length,n);++l<d;)a[l]=t[l].call(this,a[l]);return Ke(e,this,a)})}),ja=oe(function(e,t){var n=Yt(t,jn(ja));return Pt(e,E,i,t,n)}),ql=oe(function(e,t){var n=Yt(t,jn(ql));return Pt(e,ve,i,t,n)}),Zv=Dt(function(e,t){return Pt(e,Me,i,i,i,t)});function Gv(e,t){if(typeof e!="function")throw new st(h);return t=t===i?t:re(t),oe(e,t)}function Uv(e,t){if(typeof e!="function")throw new st(h);return t=t==null?0:Oe(re(t),0),oe(function(n){var a=n[t],l=Qt(n,0,t);return a&&zt(l,a),Ke(e,this,l)})}function $v(e,t,n){var a=!0,l=!0;if(typeof e!="function")throw new st(h);return Se(n)&&(a="leading"in n?!!n.leading:a,l="trailing"in n?!!n.trailing:l),Fl(e,t,{leading:a,maxWait:t,trailing:l})}function Vv(e){return Ll(e,1)}function Hv(e,t){return ja(Da(t),e)}function zv(){if(!arguments.length)return[];var e=arguments[0];return ee(e)?e:[e]}function Yv(e){return ot(e,Z)}function Xv(e,t){return t=typeof t=="function"?t:i,ot(e,Z,t)}function Kv(e){return ot(e,O|Z)}function Jv(e,t){return t=typeof t=="function"?t:i,ot(e,O|Z,t)}function jv(e,t){return t==null||Ac(e,t,Ee(t))}function vt(e,t){return e===t||e!==e&&t!==t}var Qv=ns(Ia),ey=ns(function(e,t){return e>=t}),vn=Mc((function(){return arguments})())?Mc:function(e){return Ce(e)&&pe.call(e,"callee")&&!vc.call(e,"callee")},ee=b.isArray,ty=Qu?Je(Qu):cm;function Ve(e){return e!=null&&fs(e.length)&&!Ft(e)}function Te(e){return Ce(e)&&Ve(e)}function ny(e){return e===!0||e===!1||Ce(e)&&Ze(e)==Rr}var en=mg||co,ry=ec?Je(ec):lm;function iy(e){return Ce(e)&&e.nodeType===1&&!Xr(e)}function sy(e){if(e==null)return!0;if(Ve(e)&&(ee(e)||typeof e=="string"||typeof e.splice=="function"||en(e)||Qn(e)||vn(e)))return!e.length;var t=Be(e);if(t==pt||t==gt)return!e.size;if(zr(e))return!Ta(e).length;for(var n in e)if(pe.call(e,n))return!1;return!0}function ay(e,t){return $r(e,t)}function oy(e,t,n){n=typeof n=="function"?n:i;var a=n?n(e,t):i;return a===i?$r(e,t,i,n):!!a}function Qa(e){if(!Ce(e))return!1;var t=Ze(e);return t==Si||t==Oh||typeof e.message=="string"&&typeof e.name=="string"&&!Xr(e)}function uy(e){return typeof e=="number"&&xc(e)}function Ft(e){if(!Se(e))return!1;var t=Ze(e);return t==Ii||t==Tu||t==kh||t==Mh}function Wl(e){return typeof e=="number"&&e==re(e)}function fs(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Vt}function Se(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Ce(e){return e!=null&&typeof e=="object"}var Zl=tc?Je(tc):dm;function cy(e,t){return e===t||Aa(e,t,Ua(t))}function ly(e,t,n){return n=typeof n=="function"?n:i,Aa(e,t,Ua(t),n)}function fy(e){return Gl(e)&&e!=+e}function dy(e){if(Xm(e))throw new Q(c);return Lc(e)}function hy(e){return e===null}function py(e){return e==null}function Gl(e){return typeof e=="number"||Ce(e)&&Ze(e)==Or}function Xr(e){if(!Ce(e)||Ze(e)!=Et)return!1;var t=Fi(e);if(t===null)return!0;var n=pe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Ni.call(n)==lg}var eo=nc?Je(nc):hm;function gy(e){return Wl(e)&&e>=-Vt&&e<=Vt}var Ul=rc?Je(rc):pm;function ds(e){return typeof e=="string"||!ee(e)&&Ce(e)&&Ze(e)==Mr}function Qe(e){return typeof e=="symbol"||Ce(e)&&Ze(e)==Ci}var Qn=ic?Je(ic):gm;function my(e){return e===i}function _y(e){return Ce(e)&&Be(e)==Lr}function vy(e){return Ce(e)&&Ze(e)==Nh}var yy=ns(Ra),xy=ns(function(e,t){return e<=t});function $l(e){if(!e)return[];if(Ve(e))return ds(e)?mt(e):$e(e);if(Dr&&e[Dr])return jp(e[Dr]());var t=Be(e),n=t==pt?ga:t==gt?Ei:er;return n(e)}function qt(e){if(!e)return e===0?e:0;if(e=lt(e),e===cn||e===-cn){var t=e<0?-1:1;return t*Ch}return e===e?e:0}function re(e){var t=qt(e),n=t%1;return t===t?n?t-n:t:0}function Vl(e){return e?pn(re(e),0,St):0}function lt(e){if(typeof e=="number")return e;if(Qe(e))return wi;if(Se(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Se(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=lc(e);var n=tp.test(e);return n||rp.test(e)?Pp(e.slice(2),n?2:8):ep.test(e)?wi:+e}function Hl(e){return Ct(e,He(e))}function wy(e){return e?pn(re(e),-Vt,Vt):e===0?e:0}function he(e){return e==null?"":je(e)}var by=Kn(function(e,t){if(zr(t)||Ve(t)){Ct(t,Ee(t),e);return}for(var n in t)pe.call(t,n)&&Zr(e,n,t[n])}),zl=Kn(function(e,t){Ct(t,He(t),e)}),hs=Kn(function(e,t,n,a){Ct(t,He(t),e,a)}),Sy=Kn(function(e,t,n,a){Ct(t,Ee(t),e,a)}),Iy=Dt(wa);function Cy(e,t){var n=Xn(e);return t==null?n:Cc(n,t)}var Ay=oe(function(e,t){e=me(e);var n=-1,a=t.length,l=a>2?t[2]:i;for(l&&Ge(t[0],t[1],l)&&(a=1);++n<a;)for(var d=t[n],p=He(d),_=-1,x=p.length;++_<x;){var I=p[_],C=e[I];(C===i||vt(C,Hn[I])&&!pe.call(e,I))&&(e[I]=d[I])}return e}),Ty=oe(function(e){return e.push(i,ll),Ke(Yl,i,e)});function Ry(e,t){return ac(e,z(t,3),It)}function ky(e,t){return ac(e,z(t,3),Sa)}function Oy(e,t){return e==null?e:ba(e,z(t,3),He)}function Ey(e,t){return e==null?e:Oc(e,z(t,3),He)}function My(e,t){return e&&It(e,z(t,3))}function Ly(e,t){return e&&Sa(e,z(t,3))}function Ny(e){return e==null?[]:Yi(e,Ee(e))}function Py(e){return e==null?[]:Yi(e,He(e))}function to(e,t,n){var a=e==null?i:gn(e,t);return a===i?n:a}function Dy(e,t){return e!=null&&hl(e,t,sm)}function no(e,t){return e!=null&&hl(e,t,am)}var By=sl(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=Pi.call(t)),e[t]=n},io(ze)),Fy=sl(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=Pi.call(t)),pe.call(e,t)?e[t].push(n):e[t]=[n]},z),qy=oe(Ur);function Ee(e){return Ve(e)?Sc(e):Ta(e)}function He(e){return Ve(e)?Sc(e,!0):mm(e)}function Wy(e,t){var n={};return t=z(t,3),It(e,function(a,l,d){Nt(n,t(a,l,d),a)}),n}function Zy(e,t){var n={};return t=z(t,3),It(e,function(a,l,d){Nt(n,l,t(a,l,d))}),n}var Gy=Kn(function(e,t,n){Xi(e,t,n)}),Yl=Kn(function(e,t,n,a){Xi(e,t,n,a)}),Uy=Dt(function(e,t){var n={};if(e==null)return n;var a=!1;t=we(t,function(d){return d=jt(d,e),a||(a=d.length>1),d}),Ct(e,Za(e),n),a&&(n=ot(n,O|q|Z,Bm));for(var l=t.length;l--;)La(n,t[l]);return n});function $y(e,t){return Xl(e,ls(z(t)))}var Vy=Dt(function(e,t){return e==null?{}:vm(e,t)});function Xl(e,t){if(e==null)return{};var n=we(Za(e),function(a){return[a]});return t=z(t),Wc(e,n,function(a,l){return t(a,l[0])})}function Hy(e,t,n){t=jt(t,e);var a=-1,l=t.length;for(l||(l=1,e=i);++a<l;){var d=e==null?i:e[At(t[a])];d===i&&(a=l,d=n),e=Ft(d)?d.call(e):d}return e}function zy(e,t,n){return e==null?e:Vr(e,t,n)}function Yy(e,t,n,a){return a=typeof a=="function"?a:i,e==null?e:Vr(e,t,n,a)}var Kl=ul(Ee),Jl=ul(He);function Xy(e,t,n){var a=ee(e),l=a||en(e)||Qn(e);if(t=z(t,4),n==null){var d=e&&e.constructor;l?n=a?new d:[]:Se(e)?n=Ft(d)?Xn(Fi(e)):{}:n={}}return(l?it:It)(e,function(p,_,x){return t(n,p,_,x)}),n}function Ky(e,t){return e==null?!0:La(e,t)}function Jy(e,t,n){return e==null?e:Vc(e,t,Da(n))}function jy(e,t,n,a){return a=typeof a=="function"?a:i,e==null?e:Vc(e,t,Da(n),a)}function er(e){return e==null?[]:pa(e,Ee(e))}function Qy(e){return e==null?[]:pa(e,He(e))}function e0(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=lt(n),n=n===n?n:0),t!==i&&(t=lt(t),t=t===t?t:0),pn(lt(e),t,n)}function t0(e,t,n){return t=qt(t),n===i?(n=t,t=0):n=qt(n),e=lt(e),om(e,t,n)}function n0(e,t,n){if(n&&typeof n!="boolean"&&Ge(e,t,n)&&(t=n=i),n===i&&(typeof t=="boolean"?(n=t,t=i):typeof e=="boolean"&&(n=e,e=i)),e===i&&t===i?(e=0,t=1):(e=qt(e),t===i?(t=e,e=0):t=qt(t)),e>t){var a=e;e=t,t=a}if(n||e%1||t%1){var l=wc();return De(e+l*(t-e+Np("1e-"+((l+"").length-1))),t)}return Oa(e,t)}var r0=Jn(function(e,t,n){return t=t.toLowerCase(),e+(n?jl(t):t)});function jl(e){return ro(he(e).toLowerCase())}function Ql(e){return e=he(e),e&&e.replace(sp,zp).replace(Ip,"")}function i0(e,t,n){e=he(e),t=je(t);var a=e.length;n=n===i?a:pn(re(n),0,a);var l=n;return n-=t.length,n>=0&&e.slice(n,l)==t}function s0(e){return e=he(e),e&&qh.test(e)?e.replace(Ou,Yp):e}function a0(e){return e=he(e),e&&Vh.test(e)?e.replace(js,"\\$&"):e}var o0=Jn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),u0=Jn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),c0=nl("toLowerCase");function l0(e,t,n){e=he(e),t=re(t);var a=t?$n(e):0;if(!t||a>=t)return e;var l=(t-a)/2;return ts(Gi(l),n)+e+ts(Zi(l),n)}function f0(e,t,n){e=he(e),t=re(t);var a=t?$n(e):0;return t&&a<t?e+ts(t-a,n):e}function d0(e,t,n){e=he(e),t=re(t);var a=t?$n(e):0;return t&&a<t?ts(t-a,n)+e:e}function h0(e,t,n){return n||t==null?t=0:t&&(t=+t),xg(he(e).replace(Qs,""),t||0)}function p0(e,t,n){return(n?Ge(e,t,n):t===i)?t=1:t=re(t),Ea(he(e),t)}function g0(){var e=arguments,t=he(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var m0=Jn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function _0(e,t,n){return n&&typeof n!="number"&&Ge(e,t,n)&&(t=n=i),n=n===i?St:n>>>0,n?(e=he(e),e&&(typeof t=="string"||t!=null&&!eo(t))&&(t=je(t),!t&&Un(e))?Qt(mt(e),0,n):e.split(t,n)):[]}var v0=Jn(function(e,t,n){return e+(n?" ":"")+ro(t)});function y0(e,t,n){return e=he(e),n=n==null?0:pn(re(n),0,e.length),t=je(t),e.slice(n,n+t.length)==t}function x0(e,t,n){var a=f.templateSettings;n&&Ge(e,t,n)&&(t=i),e=he(e),t=hs({},t,a,cl);var l=hs({},t.imports,a.imports,cl),d=Ee(l),p=pa(l,d),_,x,I=0,C=t.interpolate||Ai,T="__p += '",D=ma((t.escape||Ai).source+"|"+C.source+"|"+(C===Eu?Qh:Ai).source+"|"+(t.evaluate||Ai).source+"|$","g"),$="//# sourceURL="+(pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++kp+"]")+`
4
+ `;e.replace(D,function(K,ue,le,et,Ue,tt){return le||(le=et),T+=e.slice(I,tt).replace(ap,Xp),ue&&(_=!0,T+=`' +
5
+ __e(`+ue+`) +
6
+ '`),Ue&&(x=!0,T+=`';
7
+ `+Ue+`;
8
+ __p += '`),le&&(T+=`' +
9
+ ((__t = (`+le+`)) == null ? '' : __t) +
10
+ '`),I=tt+K.length,K}),T+=`';
11
+ `;var X=pe.call(t,"variable")&&t.variable;if(!X)T=`with (obj) {
12
+ `+T+`
13
+ }
14
+ `;else if(Jh.test(X))throw new Q(g);T=(x?T.replace(Ph,""):T).replace(Dh,"$1").replace(Bh,"$1;"),T="function("+(X||"obj")+`) {
15
+ `+(X?"":`obj || (obj = {});
16
+ `)+"var __t, __p = ''"+(_?", __e = _.escape":"")+(x?`, __j = Array.prototype.join;
17
+ function print() { __p += __j.call(arguments, '') }
18
+ `:`;
19
+ `)+T+`return __p
20
+ }`;var ae=tf(function(){return de(d,$+"return "+T).apply(i,p)});if(ae.source=T,Qa(ae))throw ae;return ae}function w0(e){return he(e).toLowerCase()}function b0(e){return he(e).toUpperCase()}function S0(e,t,n){if(e=he(e),e&&(n||t===i))return lc(e);if(!e||!(t=je(t)))return e;var a=mt(e),l=mt(t),d=fc(a,l),p=dc(a,l)+1;return Qt(a,d,p).join("")}function I0(e,t,n){if(e=he(e),e&&(n||t===i))return e.slice(0,pc(e)+1);if(!e||!(t=je(t)))return e;var a=mt(e),l=dc(a,mt(t))+1;return Qt(a,0,l).join("")}function C0(e,t,n){if(e=he(e),e&&(n||t===i))return e.replace(Qs,"");if(!e||!(t=je(t)))return e;var a=mt(e),l=fc(a,mt(t));return Qt(a,l).join("")}function A0(e,t){var n=yh,a=xh;if(Se(t)){var l="separator"in t?t.separator:l;n="length"in t?re(t.length):n,a="omission"in t?je(t.omission):a}e=he(e);var d=e.length;if(Un(e)){var p=mt(e);d=p.length}if(n>=d)return e;var _=n-$n(a);if(_<1)return a;var x=p?Qt(p,0,_).join(""):e.slice(0,_);if(l===i)return x+a;if(p&&(_+=x.length-_),eo(l)){if(e.slice(_).search(l)){var I,C=x;for(l.global||(l=ma(l.source,he(Mu.exec(l))+"g")),l.lastIndex=0;I=l.exec(C);)var T=I.index;x=x.slice(0,T===i?_:T)}}else if(e.indexOf(je(l),_)!=_){var D=x.lastIndexOf(l);D>-1&&(x=x.slice(0,D))}return x+a}function T0(e){return e=he(e),e&&Fh.test(e)?e.replace(ku,ng):e}var R0=Jn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),ro=nl("toUpperCase");function ef(e,t,n){return e=he(e),t=n?i:t,t===i?Jp(e)?sg(e):Gp(e):e.match(t)||[]}var tf=oe(function(e,t){try{return Ke(e,i,t)}catch(n){return Qa(n)?n:new Q(n)}}),k0=Dt(function(e,t){return it(t,function(n){n=At(n),Nt(e,n,Ja(e[n],e))}),e});function O0(e){var t=e==null?0:e.length,n=z();return e=t?we(e,function(a){if(typeof a[1]!="function")throw new st(h);return[n(a[0]),a[1]]}):[],oe(function(a){for(var l=-1;++l<t;){var d=e[l];if(Ke(d[0],this,a))return Ke(d[1],this,a)}})}function E0(e){return nm(ot(e,O))}function io(e){return function(){return e}}function M0(e,t){return e==null||e!==e?t:e}var L0=il(),N0=il(!0);function ze(e){return e}function so(e){return Nc(typeof e=="function"?e:ot(e,O))}function P0(e){return Dc(ot(e,O))}function D0(e,t){return Bc(e,ot(t,O))}var B0=oe(function(e,t){return function(n){return Ur(n,e,t)}}),F0=oe(function(e,t){return function(n){return Ur(e,n,t)}});function ao(e,t,n){var a=Ee(t),l=Yi(t,a);n==null&&!(Se(t)&&(l.length||!a.length))&&(n=t,t=e,e=this,l=Yi(t,Ee(t)));var d=!(Se(n)&&"chain"in n)||!!n.chain,p=Ft(e);return it(l,function(_){var x=t[_];e[_]=x,p&&(e.prototype[_]=function(){var I=this.__chain__;if(d||I){var C=e(this.__wrapped__),T=C.__actions__=$e(this.__actions__);return T.push({func:x,args:arguments,thisArg:e}),C.__chain__=I,C}return x.apply(e,zt([this.value()],arguments))})}),e}function q0(){return Le._===this&&(Le._=fg),this}function oo(){}function W0(e){return e=re(e),oe(function(t){return Fc(t,e)})}var Z0=Fa(we),G0=Fa(sc),U0=Fa(ca);function nf(e){return Va(e)?la(At(e)):ym(e)}function $0(e){return function(t){return e==null?i:gn(e,t)}}var V0=al(),H0=al(!0);function uo(){return[]}function co(){return!1}function z0(){return{}}function Y0(){return""}function X0(){return!0}function K0(e,t){if(e=re(e),e<1||e>Vt)return[];var n=St,a=De(e,St);t=z(t),e-=St;for(var l=ha(a,t);++n<e;)t(n);return l}function J0(e){return ee(e)?we(e,At):Qe(e)?[e]:$e(bl(he(e)))}function j0(e){var t=++cg;return he(e)+t}var Q0=es(function(e,t){return e+t},0),ex=qa("ceil"),tx=es(function(e,t){return e/t},1),nx=qa("floor");function rx(e){return e&&e.length?zi(e,ze,Ia):i}function ix(e,t){return e&&e.length?zi(e,z(t,2),Ia):i}function sx(e){return uc(e,ze)}function ax(e,t){return uc(e,z(t,2))}function ox(e){return e&&e.length?zi(e,ze,Ra):i}function ux(e,t){return e&&e.length?zi(e,z(t,2),Ra):i}var cx=es(function(e,t){return e*t},1),lx=qa("round"),fx=es(function(e,t){return e-t},0);function dx(e){return e&&e.length?da(e,ze):0}function hx(e,t){return e&&e.length?da(e,z(t,2)):0}return f.after=Pv,f.ary=Ll,f.assign=by,f.assignIn=zl,f.assignInWith=hs,f.assignWith=Sy,f.at=Iy,f.before=Nl,f.bind=Ja,f.bindAll=k0,f.bindKey=Pl,f.castArray=zv,f.chain=Ol,f.chunk=n_,f.compact=r_,f.concat=i_,f.cond=O0,f.conforms=E0,f.constant=io,f.countBy=dv,f.create=Cy,f.curry=Dl,f.curryRight=Bl,f.debounce=Fl,f.defaults=Ay,f.defaultsDeep=Ty,f.defer=Dv,f.delay=Bv,f.difference=s_,f.differenceBy=a_,f.differenceWith=o_,f.drop=u_,f.dropRight=c_,f.dropRightWhile=l_,f.dropWhile=f_,f.fill=d_,f.filter=pv,f.flatMap=_v,f.flatMapDeep=vv,f.flatMapDepth=yv,f.flatten=Al,f.flattenDeep=h_,f.flattenDepth=p_,f.flip=Fv,f.flow=L0,f.flowRight=N0,f.fromPairs=g_,f.functions=Ny,f.functionsIn=Py,f.groupBy=xv,f.initial=__,f.intersection=v_,f.intersectionBy=y_,f.intersectionWith=x_,f.invert=By,f.invertBy=Fy,f.invokeMap=bv,f.iteratee=so,f.keyBy=Sv,f.keys=Ee,f.keysIn=He,f.map=os,f.mapKeys=Wy,f.mapValues=Zy,f.matches=P0,f.matchesProperty=D0,f.memoize=cs,f.merge=Gy,f.mergeWith=Yl,f.method=B0,f.methodOf=F0,f.mixin=ao,f.negate=ls,f.nthArg=W0,f.omit=Uy,f.omitBy=$y,f.once=qv,f.orderBy=Iv,f.over=Z0,f.overArgs=Wv,f.overEvery=G0,f.overSome=U0,f.partial=ja,f.partialRight=ql,f.partition=Cv,f.pick=Vy,f.pickBy=Xl,f.property=nf,f.propertyOf=$0,f.pull=I_,f.pullAll=Rl,f.pullAllBy=C_,f.pullAllWith=A_,f.pullAt=T_,f.range=V0,f.rangeRight=H0,f.rearg=Zv,f.reject=Rv,f.remove=R_,f.rest=Gv,f.reverse=Xa,f.sampleSize=Ov,f.set=zy,f.setWith=Yy,f.shuffle=Ev,f.slice=k_,f.sortBy=Nv,f.sortedUniq=D_,f.sortedUniqBy=B_,f.split=_0,f.spread=Uv,f.tail=F_,f.take=q_,f.takeRight=W_,f.takeRightWhile=Z_,f.takeWhile=G_,f.tap=rv,f.throttle=$v,f.thru=as,f.toArray=$l,f.toPairs=Kl,f.toPairsIn=Jl,f.toPath=J0,f.toPlainObject=Hl,f.transform=Xy,f.unary=Vv,f.union=U_,f.unionBy=$_,f.unionWith=V_,f.uniq=H_,f.uniqBy=z_,f.uniqWith=Y_,f.unset=Ky,f.unzip=Ka,f.unzipWith=kl,f.update=Jy,f.updateWith=jy,f.values=er,f.valuesIn=Qy,f.without=X_,f.words=ef,f.wrap=Hv,f.xor=K_,f.xorBy=J_,f.xorWith=j_,f.zip=Q_,f.zipObject=ev,f.zipObjectDeep=tv,f.zipWith=nv,f.entries=Kl,f.entriesIn=Jl,f.extend=zl,f.extendWith=hs,ao(f,f),f.add=Q0,f.attempt=tf,f.camelCase=r0,f.capitalize=jl,f.ceil=ex,f.clamp=e0,f.clone=Yv,f.cloneDeep=Kv,f.cloneDeepWith=Jv,f.cloneWith=Xv,f.conformsTo=jv,f.deburr=Ql,f.defaultTo=M0,f.divide=tx,f.endsWith=i0,f.eq=vt,f.escape=s0,f.escapeRegExp=a0,f.every=hv,f.find=gv,f.findIndex=Il,f.findKey=Ry,f.findLast=mv,f.findLastIndex=Cl,f.findLastKey=ky,f.floor=nx,f.forEach=El,f.forEachRight=Ml,f.forIn=Oy,f.forInRight=Ey,f.forOwn=My,f.forOwnRight=Ly,f.get=to,f.gt=Qv,f.gte=ey,f.has=Dy,f.hasIn=no,f.head=Tl,f.identity=ze,f.includes=wv,f.indexOf=m_,f.inRange=t0,f.invoke=qy,f.isArguments=vn,f.isArray=ee,f.isArrayBuffer=ty,f.isArrayLike=Ve,f.isArrayLikeObject=Te,f.isBoolean=ny,f.isBuffer=en,f.isDate=ry,f.isElement=iy,f.isEmpty=sy,f.isEqual=ay,f.isEqualWith=oy,f.isError=Qa,f.isFinite=uy,f.isFunction=Ft,f.isInteger=Wl,f.isLength=fs,f.isMap=Zl,f.isMatch=cy,f.isMatchWith=ly,f.isNaN=fy,f.isNative=dy,f.isNil=py,f.isNull=hy,f.isNumber=Gl,f.isObject=Se,f.isObjectLike=Ce,f.isPlainObject=Xr,f.isRegExp=eo,f.isSafeInteger=gy,f.isSet=Ul,f.isString=ds,f.isSymbol=Qe,f.isTypedArray=Qn,f.isUndefined=my,f.isWeakMap=_y,f.isWeakSet=vy,f.join=w_,f.kebabCase=o0,f.last=ct,f.lastIndexOf=b_,f.lowerCase=u0,f.lowerFirst=c0,f.lt=yy,f.lte=xy,f.max=rx,f.maxBy=ix,f.mean=sx,f.meanBy=ax,f.min=ox,f.minBy=ux,f.stubArray=uo,f.stubFalse=co,f.stubObject=z0,f.stubString=Y0,f.stubTrue=X0,f.multiply=cx,f.nth=S_,f.noConflict=q0,f.noop=oo,f.now=us,f.pad=l0,f.padEnd=f0,f.padStart=d0,f.parseInt=h0,f.random=n0,f.reduce=Av,f.reduceRight=Tv,f.repeat=p0,f.replace=g0,f.result=Hy,f.round=lx,f.runInContext=y,f.sample=kv,f.size=Mv,f.snakeCase=m0,f.some=Lv,f.sortedIndex=O_,f.sortedIndexBy=E_,f.sortedIndexOf=M_,f.sortedLastIndex=L_,f.sortedLastIndexBy=N_,f.sortedLastIndexOf=P_,f.startCase=v0,f.startsWith=y0,f.subtract=fx,f.sum=dx,f.sumBy=hx,f.template=x0,f.times=K0,f.toFinite=qt,f.toInteger=re,f.toLength=Vl,f.toLower=w0,f.toNumber=lt,f.toSafeInteger=wy,f.toString=he,f.toUpper=b0,f.trim=S0,f.trimEnd=I0,f.trimStart=C0,f.truncate=A0,f.unescape=T0,f.uniqueId=j0,f.upperCase=R0,f.upperFirst=ro,f.each=El,f.eachRight=Ml,f.first=Tl,ao(f,(function(){var e={};return It(f,function(t,n){pe.call(f.prototype,n)||(e[n]=t)}),e})(),{chain:!1}),f.VERSION=o,it(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){f[e].placeholder=f}),it(["drop","take"],function(e,t){ce.prototype[e]=function(n){n=n===i?1:Oe(re(n),0);var a=this.__filtered__&&!t?new ce(this):this.clone();return a.__filtered__?a.__takeCount__=De(n,a.__takeCount__):a.__views__.push({size:De(n,St),type:e+(a.__dir__<0?"Right":"")}),a},ce.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),it(["filter","map","takeWhile"],function(e,t){var n=t+1,a=n==Au||n==Ih;ce.prototype[e]=function(l){var d=this.clone();return d.__iteratees__.push({iteratee:z(l,3),type:n}),d.__filtered__=d.__filtered__||a,d}}),it(["head","last"],function(e,t){var n="take"+(t?"Right":"");ce.prototype[e]=function(){return this[n](1).value()[0]}}),it(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");ce.prototype[e]=function(){return this.__filtered__?new ce(this):this[n](1)}}),ce.prototype.compact=function(){return this.filter(ze)},ce.prototype.find=function(e){return this.filter(e).head()},ce.prototype.findLast=function(e){return this.reverse().find(e)},ce.prototype.invokeMap=oe(function(e,t){return typeof e=="function"?new ce(this):this.map(function(n){return Ur(n,e,t)})}),ce.prototype.reject=function(e){return this.filter(ls(z(e)))},ce.prototype.slice=function(e,t){e=re(e);var n=this;return n.__filtered__&&(e>0||t<0)?new ce(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(t=re(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},ce.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ce.prototype.toArray=function(){return this.take(St)},It(ce.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),a=/^(?:head|last)$/.test(t),l=f[a?"take"+(t=="last"?"Right":""):t],d=a||/^find/.test(t);l&&(f.prototype[t]=function(){var p=this.__wrapped__,_=a?[1]:arguments,x=p instanceof ce,I=_[0],C=x||ee(p),T=function(ue){var le=l.apply(f,zt([ue],_));return a&&D?le[0]:le};C&&n&&typeof I=="function"&&I.length!=1&&(x=C=!1);var D=this.__chain__,$=!!this.__actions__.length,X=d&&!D,ae=x&&!$;if(!d&&C){p=ae?p:new ce(this);var K=e.apply(p,_);return K.__actions__.push({func:as,args:[T],thisArg:i}),new at(K,D)}return X&&ae?e.apply(this,_):(K=this.thru(T),X?a?K.value()[0]:K.value():K)})}),it(["pop","push","shift","sort","splice","unshift"],function(e){var t=Mi[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",a=/^(?:pop|shift)$/.test(e);f.prototype[e]=function(){var l=arguments;if(a&&!this.__chain__){var d=this.value();return t.apply(ee(d)?d:[],l)}return this[n](function(p){return t.apply(ee(p)?p:[],l)})}}),It(ce.prototype,function(e,t){var n=f[t];if(n){var a=n.name+"";pe.call(Yn,a)||(Yn[a]=[]),Yn[a].push({name:t,func:n})}}),Yn[Qi(i,V).name]=[{name:"wrapper",func:i}],ce.prototype.clone=Tg,ce.prototype.reverse=Rg,ce.prototype.value=kg,f.prototype.at=iv,f.prototype.chain=sv,f.prototype.commit=av,f.prototype.next=ov,f.prototype.plant=cv,f.prototype.reverse=lv,f.prototype.toJSON=f.prototype.valueOf=f.prototype.value=fv,f.prototype.first=f.prototype.head,Dr&&(f.prototype[Dr]=uv),f}),Vn=ag();ln?((ln.exports=Vn)._=Vn,sa._=Vn):Le._=Vn}).call(Nd)})(br,br.exports)),br.exports}var Sr={},nu;function Dd(){if(nu)return Sr;nu=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.backtrace=void 0;function s(r,i,o){const u=[];let c=o?r:r.getParent();for(;c.getParent();)u.push([c.position.x,c.position.y]),c=c.getParent();return i&&u.push([c.position.x,c.position.y]),u.reverse()}return Sr.backtrace=s,Sr}var Ir={},ru;function Bd(){if(ru)return Ir;ru=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.calculateHeuristic=void 0;function s(r,i,o,u){const c=Math.abs(o.x-i.x),h=Math.abs(o.y-i.y);switch(r){case"Manhatten":case"Manhattan":return(c+h)*u;case"Euclidean":return Math.sqrt(c*c+h*h)*u;case"Chebyshev":return Math.max(c,h)*u;case"Octile":return(c+h-.58*Math.min(c,h))*u}}return Ir.calculateHeuristic=s,Ir}var Cr={},Ar={},iu;function Fd(){if(iu)return Ar;iu=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.Node=void 0;class s{constructor(i){this.id=i.id,this.position=i.position,this.hValue=0,this.gValue=0,this.fValue=0,this.parentNode=void 0,this.isOnClosedList=!1,this.isOnOpenList=!1,this.isWalkable=i.walkable||!0}calculateFValue(){this.fValue=this.gValue+this.hValue}setGValue(i){this.gValue=i,this.calculateFValue()}setHValue(i){this.hValue=i,this.calculateFValue()}setFGHValuesToZero(){this.fValue=this.gValue=this.hValue=0}getFValue(){return this.fValue}getGValue(){return this.gValue}getHValue(){return this.hValue}getParent(){return this.parentNode}getIsOnClosedList(){return this.isOnClosedList}getIsOnOpenList(){return this.isOnOpenList}getIsWalkable(){return this.isWalkable}setParent(i){this.parentNode=i}setIsOnClosedList(i){this.isOnClosedList=i}setIsOnOpenList(i){this.isOnOpenList=i}setIsWalkable(i){this.isWalkable=i}}return Ar.Node=s,Ar}var su;function au(){if(su)return Cr;su=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.Grid=void 0;const s=Fd();class r{constructor(o){o.width&&o.height?(this.width=o.width,this.height=o.height,this.numberOfFields=this.width*this.height):o.matrix&&(this.width=o.matrix[0].length,this.height=o.matrix.length,this.numberOfFields=this.width*this.height),this.gridNodes=this.buildGridWithNodes(o.matrix||void 0,this.width,this.height,o.densityOfObstacles||0)}buildGridWithNodes(o,u,c,h){const g=[];let m=0;for(let v=0;v<c;v++){g[v]=[];for(let w=0;w<u;w++)g[v][w]=new s.Node({id:m,position:{x:w,y:v}}),m++}if(o===void 0){for(let v=0;v<c;v++)for(let w=0;w<u;w++)Math.floor(Math.random()*10)+1>10-h?g[v][w].setIsWalkable(!1):g[v][w].setIsWalkable(!0);return g}for(let v=0;v<c;v++)for(let w=0;w<u;w++)g[v][w].setIsWalkable(!o[v][w]);return g}getNodeAt(o){return this.gridNodes[o.y][o.x]}isWalkableAt(o){return this.gridNodes[o.y][o.x].getIsWalkable()}isOnTheGrid(o){return o.x>=0&&o.x<this.width&&o.y>=0&&o.y<this.height}getSurroundingNodes(o,u){const c=[],h=o.x-1,g=o.x+1,m=o.y-1,v=o.y+1;for(let w=m;w<=v;w++)for(let O=h;O<=g;O++)(O!==o.x||w!==o.y)&&this.isOnTheGrid({x:O,y:w})&&this.isWalkableAt({x:O,y:w})&&(u||O==o.x||w==o.y)&&c.push(this.getNodeAt({x:O,y:w}));return c}setGrid(o){this.gridNodes=o}resetGrid(){for(let o=0;o<this.gridNodes.length;o++)for(let u=0;u<this.gridNodes[o].length;u++)this.gridNodes[o][u].setIsOnClosedList(!1),this.gridNodes[o][u].setIsOnOpenList(!1),this.gridNodes[o][u].setParent(void 0),this.gridNodes[o][u].setFGHValuesToZero()}getGridNodes(){return this.gridNodes}clone(){const o=[];let u=0;for(let c=0;c<this.height;c++){o[c]=[];for(let h=0;h<this.width;h++)o[c][h]=new s.Node({id:u,position:{x:h,y:c},walkable:this.gridNodes[c][h].getIsWalkable()}),u++}return o}}return Cr.Grid=r,Cr}var ou;function qd(){if(ou)return wr;ou=1,Object.defineProperty(wr,"__esModule",{value:!0}),wr.AStarFinder=void 0;const s=Pd(),r=Dd(),i=Bd(),o=au();class u{constructor(h){this.grid=new o.Grid({width:h.grid.width,height:h.grid.height,matrix:h.grid.matrix||void 0,densityOfObstacles:h.grid.densityOfObstacles||0}),this.closedList=[],this.openList=[],this.diagonalAllowed=h.diagonalAllowed!==void 0?h.diagonalAllowed:!0,this.heuristic=h.heuristic?h.heuristic:"Manhattan",this.includeStartNode=h.includeStartNode!==void 0?h.includeStartNode:!0,this.includeEndNode=h.includeEndNode!==void 0?h.includeEndNode:!0,this.allowPathAsCloseAsPossible=h.allowPathAsCloseAsPossible||!1,this.weight=h.weight||1}findPath(h,g){this.closedList=[],this.openList=[],this.grid.resetGrid();const m=this.grid.getNodeAt(h),v=this.grid.getNodeAt(g);if(!this.grid.isWalkableAt(g)||!this.grid.isWalkableAt(h))return[];m.setIsOnOpenList(!0),this.openList.push(m);for(let w=0;w<this.grid.height;w++)for(let O=0;O<this.grid.width;O++){let q=this.grid.getNodeAt({x:O,y:w});this.grid.isWalkableAt({x:O,y:w})?q.setHValue((0,i.calculateHeuristic)(this.heuristic,q.position,v.position,this.weight)):(q.setFGHValuesToZero(),q.setIsOnClosedList(!0),this.closedList.push(q))}for(;this.openList.length!==0;){const w=(0,s.minBy)(this.openList,q=>q.getFValue());if(w.setIsOnOpenList(!1),(0,s.remove)(this.openList,w),w.setIsOnClosedList(!0),this.closedList.push(w),w===v)return(0,r.backtrace)(v,this.includeStartNode,this.includeEndNode);const O=this.grid.getSurroundingNodes(w.position,this.diagonalAllowed);for(let q in O){const Z=O[q];if(Z.getIsOnClosedList())continue;const L=w.getGValue()+(Z.position.x!==w.position.x||Z.position.y==w.position.y?this.weight:this.weight*1.41421);(!Z.getIsOnOpenList()||L<Z.getGValue())&&(Z.setGValue(L),Z.setParent(w),Z.getIsOnOpenList()?Z.setParent(w):(Z.setIsOnOpenList(!0),this.openList.push(Z)))}}return this.allowPathAsCloseAsPossible?(0,r.backtrace)(this.closedList[this.closedList.length-1],this.includeStartNode,!1):[]}setHeuristic(h){this.heuristic=h}setWeight(h){this.weight=h}getGridClone(){return this.grid.clone()}getGrid(){return this.grid}}return wr.AStarFinder=u,wr}var uu;function Wd(){return uu||(uu=1,(function(s){Object.defineProperty(s,"__esModule",{value:!0}),s.Grid=s.AStarFinder=void 0;var r=qd();Object.defineProperty(s,"AStarFinder",{enumerable:!0,get:function(){return r.AStarFinder}});var i=au();Object.defineProperty(s,"Grid",{enumerable:!0,get:function(){return i.Grid}})})(Gs)),Gs}var Zd=Wd();const Gd=s=>s.map(r=>r.map(i=>i)).reverse(),cu=(s,r)=>s.x>=r[0].length||s.y>=r.length||s.x<0||s.y<0;function mi(s,r,i,o){const u=q=>({x:Math.floor(q.x/o),y:Math.floor(q.y/o)}),c=q=>({x:(q[0]+.5)*o,y:(q[1]+.5)*o}),h=Gd(i),g=u(s),m=u(r);if(cu(g,h))return[];if(cu(m,h))return[];const w=new Zd.AStarFinder({grid:{matrix:h}}).findPath(g,m);return w.length===0?[]:w.map(c)}const Ud=200,$d=5,lu={say:"talk",move:"walk",goTo:"walk",wait:"default",act:"default"};function We(s,r){if(s)return r.find(i=>i.id===s)}function fu(s,r=1,i=0){return Math.max(Math.min(s,r),i)}const Vd=s=>(r,i,o,u)=>{const{rooms:c,actors:h}=r,g=c.find(w=>w.id===i);if(!g)return;const m=h.find(w=>w.isPlayer),v=Zs(g,s.cellSize);return o&&m&&(m.room=g.id,u&&(m.x=u.x,m.y=u.y)),{currentRoomId:g.id,cellMatrix:v,actors:h}},_i=(s,r,i,o)=>{const{actorOrders:u}=s,c=structuredClone(i);o?u[r]=c:u[r]?u[r].push(...c):u[r]=c},vi=(s,r,i)=>{const{reportCurrentConversation:o,reportConsequence:u}=i,{actors:c,items:h,rooms:g,currentRoomId:m}=s,v=c.find(L=>L.isPlayer),w=L=>L?c.find(P=>P.id===L):v,O=g.find(L=>L.id===m);let q=!1,Z=!1;return L=>{switch(L.type){case"order":{const{actorId:P,orders:H}=L,V=w(P);if(!V)break;_i(s,V.id,H,L.replaceCurrentOrders),q=!0,Z=V.room!==m;break}case"changeRoom":{const{roomId:P,takePlayer:H,x:V,y:ne}=L,se=typeof V=="number"&&typeof ne=="number"?{x:V,y:ne}:void 0,M=Vd(r)(s,P,H,se);if(!M)break;Object.assign(s,M),q=!0;break}case"inventory":{const{actorId:P,itemId:H,addOrRemove:V}=L,ne=w(P),se=h.find(M=>M.id===H);if(!ne||!se)break;V==="ADD"?(se.actorId=ne.id,q=!0):se.actorId===ne.id&&(se.actorId=void 0,q=!0),Z=ne&&ne.room!==m;break}case"removeActor":{const{actorId:P}=L,H=c.find(V=>V.id===P);if(!H)break;q=!0,Z=H.room!==m,H.room=void 0;break}case"teleportActor":{const{actorId:P,roomId:H,x:V,y:ne}=L,se=c.find(M=>M.id===P);if(!se)break;Z=!se.isPlayer&&se.room!==m&&H!==m,se.room=H||se.room,se.x=V,se.y=ne,q=!0;break}case"changeStatus":{const{targetId:P,targetType:H,status:V}=L;let ne;switch(H){case"actor":ne=c.find(se=>se.id===P),Z=ne?.room!==m;break;case"item":ne=h.find(se=>se.id===P);break;case"hotspot":ne=O?.hotspots?.find(se=>se.id===P);break}if(!ne)break;ne.status=V,q=!0;break}case"sequence":{const{sequence:P}=L,H=We(P,r.sequences);if(!H){console.warn(`No such sequence ${P}`);break}const V=structuredClone(H);s.sequenceRunning?(s.sequenceRunning.id=[s.sequenceRunning.id,V.id].join(),s.sequenceRunning.stages.push(...V.stages)):s.sequenceRunning=V,q=!0;break}case"conversation":{const{conversationId:P,end:H}=L;if(!s.conversations.find(ne=>ne.id===P)){console.warn(`No such conversation ${P}`);break}s.currentConversationId=H?void 0:P,q=!0,o?.();break}case"toggleZone":{const{roomId:P,ref:H,on:V,zoneType:ne}=L,se=We(P,s.rooms);if(!se)break;Z=se.id!==m;const M=ne==="obstacle"?se.obstacleAreas:ne==="walkable"?se.walkableAreas:void 0;if(!M)break;const E=M.find(ve=>ve.ref===H);if(!E)break;E.disabled=!V,O?.id===se.id&&(s.cellMatrix=Zs(se,r.cellSize)),q=!0;break}case"soundEffect":{const{sound:P,volume:H}=L;q=!!r.playSound?.(P,H);break}case"flag":{const{flag:P,on:H}=L,V=s.flagMap[P];if(!V){console.warn(`No such flag ${P}`);break}V.value=H,q=!0;break}case"conversationChoice":{const{conversationId:P,choiceRef:H,branchId:V,on:ne}=L,E=We(P,s.conversations)?.branches[V]?.choices.find(ve=>ve.ref===H);if(!E){console.warn("no such conversation choice:",P,V,H);break}q=!0,E.disabled=!ne;break}case"backgroundMusic":{const{sound:P,volume:H,roomId:V}=L,ne=We(V,s.rooms);if(!ne){console.warn("no such room",V);break}ne.backgroundMusic=P?{soundId:P,volume:H}:void 0;break}case"ambientNoise":{const{sound:P,volume:H,roomId:V}=L,ne=We(V,s.rooms);if(!ne){console.warn("no such room",V);break}ne.ambientNoise=P?{soundId:P,volume:H}:void 0;break}case"storyBoardConsequence":{const{storyBoardId:P}=L;We(P,r.storyBoards)?s.currentStoryBoardId=P:console.warn("no such storyBoard",P);break}case"changePlayerCharacter":{const{actorId:P}=L,H=We(P,s.actors);if(!H){console.warn(console.warn("no such actor",P));break}const V=s.actors.find(ne=>ne.isPlayer);V&&(V.isPlayer=!1),H.isPlayer=!0}default:{console.warn("unsupported conseqeunce!",L);break}}u?.(L,q,Z)}};function Hd(s,r=!1,i=1){if(r){s.steps.splice(0,s.steps.length);return}const[o]=s.steps;o&&(typeof o.timeElapsed>"u"&&(o.timeElapsed=0),o.timeElapsed+=i,o.timeElapsed>=o.duration&&s.steps.shift())}function zd(s,r){if(!s)return[];const i=r?s.animations[r]:s.animations[lu.move]??{};return Object.keys(i)}function Yd(s,r,i){const o=r.x-s.x,u=r.y-s.y,c=o<0?"left":"right",h=u<0?"down":"up",g=Math.abs(o)<Math.abs(u),m=g?h:c;return i.includes(m)?m:g?c:h}function Xd(s,r,i,o,u=1){if(s.roomId&&s.roomId!==r.room&&(console.warn(`${r.id} is in ${r.room??"[NOWHERE]"}, not ${s.roomId} - cancelling order`),s.steps.splice(0,s.steps.length)),o){const L=s.steps[s.steps.length-1];L&&(r.x=L.x,r.y=L.y,s.steps.splice(0,s.steps.length));return}const{x:c,y:h,speed:g=1}=r,[m]=s.steps;if(!m)return;const{speed:v=1}=m,w=g*v*u;let O=c,q=h;if(c!==m.x){const L=Math.min(w,Math.abs(c-m.x)),P=c<m.x?1:-1;O=c+L*P}if(h!==m.y){const L=Math.min(w,Math.abs(h-m.y)),P=h<m.y?1:-1;q=h+L*P}m.x==O&&m.y==q&&s.steps.shift();const Z=zd(i,m.animation);r.x=O,r.y=q,r.direction=Yd({x:c,y:h},{x:O,y:q},Z)}function Kd(s,r=!1,i=1){if(r){s.time=0;return}s.time-=i}const yi={ITEM:"$ITEM",TARGET:"$TARGET",VERB:"$VERB"},du=(s,r=!1)=>{const{verb:i,target:o,item:u}=s;return r?u?`${i.label} ${u.name??u.id} ${i.preposition??"with"} ${o.name??o.id}`:`${i.label} ${o.name??o.id}`:u?`${i.id} ${u.id} ${i.preposition} ${o.id}`:`${i.id} ${o.id}`};function hu(s,r){const{verb:i,item:o,target:u}=s,{defaultResponseCannotReach:c,defaultResponseNoItem:h,defaultResponseWithItem:g}=i,m=r?c:o?g:h;if(m){let w=m;return w=w.replace(yi.TARGET,u.name||u.id),w=w.replace(yi.ITEM,o?.name||o?.id||""),w=w.replace(yi.VERB,i.label),w}return r?`I can't reach the ${u.name||u.id}`:o?`I can't ${i.label} the ${o.name||o.id} ${i.preposition} the ${u.name||u.id}`:`Nothing happens when I ${i.label} the ${u.name||u.id}`}function pu(s,r,i){return r.map(u=>{const c=i[u];if(!c){console.warn(`Invalid flag id: "${u}"`);return}return c.value===s}).includes(!1)}function Jd(s,r){const i=r.actors.find(o=>o.isPlayer);return r.items.some(o=>o.actorId!==i?.id&&s.includes(o.id))}function gu(s,r,i,o){const{verb:u,item:c,target:h}=s,{flagMap:g}=o;return i.find(m=>{const v=m.verbId===u.id&&m.targetId===h.id&&(!m.roomId||m?.roomId===r?.id)&&(!m.itemId&&!c||m?.itemId==c?.id)&&(!m.targetStatus||m.targetStatus==h.status);return!v||m.flagsThatMustBeTrue&&pu(!0,m.flagsThatMustBeTrue,g)||m.flagsThatMustBeFalse&&pu(!1,m.flagsThatMustBeFalse,g)||m.requiredInventory&&Jd(m.requiredInventory,o)?!1:v})}function mu(s,r,i=!1){const{targetId:o,roomId:u}=s;if(!o)return;const{rooms:c,actors:h,items:g}=r,m=u?We(u,c):void 0,w=(m?[m]:u?[]:c).flatMap(O=>O.hotspots||[]);return We(o,i?[...h,...w]:[...h,...g,...w])}function jd(s,r){const{frameWidth:i,width:o}=r;return i+s*(o-i)}function Qd(s,r){const{height:i,frameHeight:o=i}=r;return o+s*(i-o)}function xi(s,r){switch(s.type){case"actor":{const{x:i,y:o,walkToX:u=0,walkToY:c=0}=s;return{x:i+u,y:o+c}}case"hotspot":{const{x:i,y:o,walkToX:u,walkToY:c,parallax:h}=s,{frameWidth:g,frameHeight:m,height:v}=r;let w;if(typeof u>"u"){const Z=(jd(h,r)-g)/2;w=i+Z}else w=u;let O;if(typeof c>"u"){const Z=(Qd(h,r)-(m??v))/2;O=o+Z}else O=c;return{x:w,y:O}}}}function _u(s,r){const{width:i}=r,o=2*(s-i/2)/i;return fu(-o*2,1,-1)}function vu(s,r){const{height:i}=r,o=2*(s-i/2)/i;return fu(o*2,1,-1)}const yu=()=>({type:"move",pathIsSet:!1,steps:[]});function eh(s,r){const{targetId:i,speed:o,animation:u}=s,{currentRoomId:c,rooms:h}=r,g=We(c,h);if(!g)return console.warn("failed to room for makeMoveOrderFromGoto ",s),yu();const m=mu({targetId:i,roomId:c},r,!0);return!m||m?.type==="item"?(console.warn("failed to find target to makeMoveOrderFromGoto ",s),yu()):{type:"move",pathIsSet:!1,steps:[{...xi(m,g),speed:o,animation:u}],narrative:{text:[]}}}function th(s,r,i,o){const{steps:u}=o;let c={x:s.x,y:s.y};const h=u.flatMap(g=>{const m=mi(c,g,r,i);return m.forEach(v=>{v.animation=g.animation,v.speed=g.speed}),m.length===0?(console.warn("failed to findPathBetweenSteps"),c={x:g.x,y:g.y}):c=m[m.length-1],m});o.pathIsSet=!0,o.steps=h}function nh(s,r,i,o,u,c,h,g=!1,m=1){switch(s.type){case"move":s.pathIsSet||th(r,i,o,s),Xd(s,r,h,g,m);break;case"say":Kd(s,g,m);break;case"act":Hd(s,g,m);break;case"goTo":{const v=eh(s,u);c.shift(),c.unshift(v);break}}}const rh=s=>{switch(s.type){case"move":case"act":return s.steps.length===0;case"say":return s.time<=0;case"goTo":return!1}},xu=(s,r)=>(i,o,u,c)=>{const{orderSpeed:h=1,instantMode:g=!1}=s,{cellMatrix:m=[]}=i,v=We(o.sprite,s.sprites);if(!u||u.length===0)return;const[w]=u;w._started||(r.reportOrder(w,o),w.startDirection&&(o.direction=w.startDirection),w._started=!0),nh(w,o,m,s.cellSize,i,u,v,g,h),rh(w)&&(w.endDirection&&(o.direction=w.endDirection),w.endStatus&&(o.status=w.endStatus),u.shift(),w.type==="move"&&w.doPendingInteractionWhenFinished&&c?.())};function ih(s,r){const i=r.map(c=>c.id);Object.keys(s).filter(c=>!i.includes(c)).forEach(c=>{console.warn(`invalid id in stage: ${c}`),delete s[c]}),Object.keys(s).filter(c=>s[c].length===0).forEach(c=>{delete s[c]})}const wu=(s,r,i)=>o=>{const{reportStage:u,reportCurrentConversation:c}=r,{actors:h,sequenceRunning:g}=o;if(!g)return{};const[m]=g.stages;if(!m)return{};m._started||(m._started=!0,i(`starting next stage in sequence ${g.id}`),u?.(m));const{actorOrders:v={}}=m;if(ih(v,h),h.forEach(q=>xu(s,r)(o,q,v[q.id])),m.immediateConsequences){const q=vi(o,s,r);m.immediateConsequences.forEach(Z=>{console.log(`executing: ${Z.type}`),q(Z)}),delete m.immediateConsequences}Object.keys(v).length===0&&g.stages.shift();const[O]=g.stages;return!O&&o.currentConversationId&&c(),o.sequenceRunning=g.stages.length===0?void 0:g,o};function bu(s,r,i,o,u){const{actors:c,rooms:h,currentRoomId:g}=s,m=c.find(w=>w.isPlayer),v=We(g,h);if(!m||!v)return s;if(i.verb.isMoveVerb&&(i.target.type==="actor"||i.target.type==="hotspot")){const w=xi(i.target,v);u?.(`walk to point is ${w.x}, ${w.y}`,"pathfinding"),_i(s,m.id,[{type:"move",steps:[{...w}]}])}else{const w=hu(i,o);_i(s,m.id,[{type:"say",text:w,time:r}])}return s}const Su=s=>`(${s.consequences?.map(r=>r.type).join()})`;function sh(s,r,i){return{type:"order",actorId:s.id,replaceCurrentOrders:!0,orders:[{type:"move",doPendingInteractionWhenFinished:!0,steps:[{x:r.x,y:r.y}],narrative:i?{text:[`making your way to ${i}...`]}:void 0}]}}const ah=(s,r,i)=>(o,u)=>{const{currentRoomId:c,rooms:h,actors:g,cellMatrix:m=[]}=o,v=We(c,h);if(!v)return o;const w=g.find(L=>L.isPlayer),O=gu(u,v,o.interactions,o),q=O&&(u.verb.isMoveVerb||O.mustReachFirst),Z=du(u);if(r.reportCommand?.(u),O&&q&&u.target.type!=="item"){i?.(`[${Z}]: (pending interaction at [${u.target.x}, ${u.target.y}])`,"command");const L=xi(u.target,v);w&&(mi(w,L,m,s.cellSize).length>0?(o.pendingInteraction=O,vi(o,s,r)(sh(w,L,s.instantMode?void 0:u.target.name??u.target.id))):(i?.(`cannot reach [${L.x}, ${L.y}] from [${w.x},${w.y}]`,"pathfinding"),bu(o,s.defaultTalkTime,u,!0,i)))}else if(O){i?.(`[${Z}]: ${Su(O)}`,"command");const L=vi(o,s,r);O.consequences.forEach(L)}else i?.(`[${Z}]: (no match)`,"command"),bu(o,s.defaultTalkTime,u,!1,i);return o},oh=(s,r,i)=>o=>{const u=vi(o,s,r);return o.pendingInteraction?.consequences.forEach(u),o.pendingInteraction&&i?.(`Pending interaction: ${Su(o.pendingInteraction)}`,"command"),o.pendingInteraction=void 0,o};function uh(s,r,i){let{choiceRef:o,branchId:u,conversationId:c}=s;if(!o){console.warn(`missing choiceRef for findChoiceFromRefSet in conversation ${i.id}`);return}c||(c=i.id),u||(u=i.currentBranch||i.defaultBranch);const h=r.find(v=>v.id===c);if(!h){console.warn(`invalid conversationId "${c}" for findChoiceFromRefSet in conversation ${i.id}`);return}const g=h.branches[u];if(!g){console.warn(`invalid branchId "${c}/${u}" for findChoiceFromRefSet in conversation ${i.id}`);return}const m=g.choices.find(v=>v.ref===o);if(!m){console.warn(`invalid choiceRef "${c}/${u}/${o}" for findChoiceFromRefSet in conversation ${i.id}`);return}return m}function Iu(s,r,i,o){return r.forEach(u=>{const c=uh(u,i,o);c&&(c.disabled=s)}),i}function ch(s,r,i){const o={id:"",stages:[{actorOrders:{}}]},u=i.actors.find(h=>h.isPlayer);if(!u)return o;const{actorOrders:c}=o.stages[0];return c&&(c[u.id]=[{type:"say",text:s.text,time:r}]),o}const lh=({sequences:s,defaultTalkTime:r},i)=>(o,u)=>{const{conversations:c,currentConversationId:h=""}=o,g=c.find(w=>w.id===h);if(!g)return o;u.once&&(u.disabled=!0),u.enablesChoices&&Iu(!1,u.enablesChoices,c,g),u.disablesChoices&&Iu(!0,u.disablesChoices,c,g),u.nextBranch&&g?.branches[u.nextBranch]&&(g.currentBranch=u.nextBranch);const m=We(u.sequence,s)??u.choiceSequence;u.sequence&&!m&&i(`invalid sequenceId "${u.sequence}" in conversation "${h}"`);const v=m?structuredClone(m):ch(u,r,o);return u.end&&v.stages.push({immediateConsequences:[{type:"conversation",end:!0,conversationId:h}]}),o.sequenceRunning=v,o},fh=(s,r)=>(i,o,u,c=!1,h=!1)=>{const{cellMatrix:g,actors:m}=i,v=m.find(q=>q.id===u);if(!v||!g)return{};const w=h?[o]:mi({x:v.x,y:v.y},o,g,s.cellSize),O={type:"move",steps:w,pathIsSet:!0};return r?.(`move: [${v.x}, ${v.y}] -> [${o.x},${o.y}], steps:${w.length}`,"order"),_i(i,v.id,[O],!c),{actors:m}},dh=(s,r,i)=>o=>{let u=!1;return o.actors.forEach(c=>{xu(s,r)(o,c,o.actorOrders[c.id],()=>{u=!0})}),u&&oh(s,r,i)(o),o},hh=(s,r,i)=>o=>{o.sequenceRunning?wu(s,r,i)(o):dh(s,r,i)(o);const u=o.actors.find(h=>h.isPlayer),c=We(o.currentRoomId,o.rooms);u&&c&&(o.viewAngleX=_u(u.x,c),o.viewAngleY=vu(u.y,c))},ph=s=>({...s,storyBoards:s.storyBoards??[],schemaVersion:3}),gh=s=>Cu(ph(s)),mh=(s,r)=>{const i=s.imageId?{x:"center",y:"center",width:s.imageWidth?s.imageWidth/16:20,height:s.imageWidth?s.imageWidth/16:20,image:{imageId:s.imageId}}:void 0;return{id:r??s.id,isEndOfGame:!0,pages:[{title:s.message,narrative:{text:[]},color:"#FFFFFF",backgroundColor:"#000000",pictures:i?[i]:[]}]}},_h=(s,r)=>{const i=r.filter(u=>u.startsWith(s)),o=(u=1)=>{const c=`${s}_${u}`;return i.includes(c)?o(u+1):c};return o()},Cu=s=>{const{storyBoards:r,interactions:i,sequences:o,conversations:u}=s,c=r.map(L=>L.id),h={},g=s.endings.map(L=>{const P=c.includes(L.id)?_h(L.id,c):void 0;return P&&c.push(P),h[L.id]=P??L.id,mh(L,P)}),m=L=>L.type!=="ending"?L:{type:"storyBoardConsequence",storyBoardId:h[L.endingId]??L.endingId,narrative:L.narrative},v=L=>({...L,stages:L.stages.map(P=>({...P,immediateConsequences:P.immediateConsequences?.map(m)}))}),w=L=>{const{branches:P}=L;for(let H in P){const V=P[H];V&&(V.choices=V.choices.map(ne=>({...ne,choiceSequence:ne.choiceSequence?v(ne.choiceSequence):void 0})))}return{...L,branches:P}},O=i.map(L=>({...L,consequences:L.consequences.map(m)})),q=o.map(v),Z=u.map(w);return{...s,storyBoards:[...r,...g],interactions:O,sequences:q,conversations:Z,schemaVersion:hi}},vh=s=>{const r=Go.safeParse(s);if(r.success)return{success:!0,gameDesign:r.data,sourceVersion:hi,updated:!1};const i=Uo.safeParse(s);if(i.success)return{success:!0,gameDesign:Cu(i.data),sourceVersion:3,updated:!0};const o=qo.safeParse(s);return o.success?{success:!0,gameDesign:gh(o.data),sourceVersion:2,updated:!0}:{success:!1,failureMessage:o.error.message}};return R.ActOrderSchema=To,R.ActorDataSchema=fi,R.AmbientNoiseConsequenceSchema=Pn,R.AspectRatioSchema=So,R.BackgroundMusicConsequenceSchema=Nn,R.BoardFontSchema=Fo,R.BoardProgressionSchema=Bo,R.CELL_SIZE=$d,R.ChangePlayerCharacterConsequenceSchema=Fn,R.ChangeRoomConsequenceSchema=An,R.ChangeStatusConsequenceSchema=kn,R.CommandSchema=Ad,R.CommandTargetSchema=$o,R.ConsequenceSchema=Ro,R.ConversationBranchSchema=Oo,R.ConversationChoiceConsequenceSchema=En,R.ConversationChoiceSchema=Is,R.ConversationConsequenceSchema=On,R.ConversationSchema=Cs,R.ConversationSchemaWithDeprecatedConsequences=ks,R.DB_VERSION=hi,R.DEFAULT_ANIMATION=lu,R.DEFAULT_TALK_TIME=Ud,R.DirectionEnum=Cn,R.EndingConsequenceSchema=Ts,R.EndingSchema=As,R.FixedGameInfoSchema=Bs,R.FlagConsequenceSchema=Dn,R.FlagMapSchema=Es,R.FlagSchema=Mo,R.GameContentsDataSchema=pi,R.GameDataItemTypeEnum=Sd,R.GameDataSchema=bd,R.GameDesignSchema=Go,R.GameHappeningsSchema=Zo,R.GotoOrderSchema=Co,R.HotspotZoneSchema=Ls,R.IdentSchema=ii,R.ImmediateConsequenceSchema=bs,R.ImmediateConsequenceSchemaWithDeprecated=Eo,R.InteractionSchema=ci,R.InteractionSchemaWithDeprecatedConsequences=Rs,R.InventoryConsequenceSchema=Tn,R.ItemDataSchema=vr,R.MoveOrderSchema=Io,R.NarrativeSchema=Ie,R.OrderConsequenceSchema=oi,R.PositionSchema=bo,R.RemoveActorConsequenceSchema=Rn,R.RoomDataSchema=Ns,R.SayOrderSchema=Ao,R.SequenceConsequenceSchema=ui,R.SequenceSchema=_r,R.SequenceSchemaWithDeprecatedConsequences=li,R.SoundEffectConsequenceSchema=Ln,R.SoundValueSchema=Os,R.SpriteDataSchema=Ps,R.SpriteFrameSchema=yr,R.SpriteParamsSchema=wo,R.StageSchema=Ss,R.StaticFrameParamsSchema=gr,R.StoryBoardConsequenceSchema=Bn,R.StoryBoardPageSchema=Do,R.StoryBoardSchema=Ds,R.TeleportActorConsequenceSchema=Mn,R.ToggleZoneConsequenceSchema=on,R.VerbSchema=di,R.ZoneSchema=Ms,R.advanceTimeOneStep=hh,R.cellMatrixSchema=Wo,R.changeHistory=sf,R.consequenceMap=cd,R.consequenceTypes=ud,R.continueSequence=wu,R.describeCommand=du,R.directions=nd,R.findPath=mi,R.findTarget=mu,R.generateCellMatrix=Zs,R.getDefaultResponseText=hu,R.getTargetPoint=xi,R.getViewAngleXCenteredOn=_u,R.getViewAngleYCenteredOn=vu,R.handleConversationChoice=lh,R.immediateConsequenceTypes=ld,R.issueMoveOrder=fh,R.makeCommandHandler=ah,R.matchInteraction=gu,R.orderBaseOmits=rd,R.orderSchema=mr,R.orderTypes=ad,R.parseAndUpgrade=vh,R.soundInstanceSchema=si,R.v2GameDesignSchema=qo,R.v3GameDesignSchema=Uo,R.wildCard=yi,R.xPlacement=No,R.yPlacement=Po,R.zoneTypes=od,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"}),R})({});