@reservamos/browser-analytics 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-analytics.cjs +2 -2
- package/dist/browser-analytics.cjs.map +1 -1
- package/dist/browser-analytics.esm.js +56 -28
- package/dist/browser-analytics.esm.js.map +1 -1
- package/dist/browser-analytics.iife.js +2 -2
- package/dist/browser-analytics.iife.js.map +1 -1
- package/package.json +1 -1
- package/src/events/identify/identify.ts +18 -21
- package/src/events/identify/identifySchema.ts +0 -1
- package/src/services/mixpanel.ts +20 -5
- package/src/track.ts +36 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e,t,n;(t=e||(e={})).assertEqual=e=>e,t.assertIs=function assertIs(e){},t.assertNever=function assertNever(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),i={};for(const t of n)i[t]=e[t];return t.objectValues(i)},t.objectValues=e=>t.objectKeys(e).map((function(t){return e[t]})),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,t.joinValues=function joinValues(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});const i=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.unknown}},s=e.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 ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},processError=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(processError);else if("invalid_return_type"===i.code)processError(i.returnTypeError);else if("invalid_arguments"===i.code)processError(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,s=0;for(;s<i.path.length;){const n=i.path[s];s===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return processError(this),n}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(t,n)=>{let a;switch(t.code){case s.invalid_type:a=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case s.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case s.invalid_union:a="Invalid input";break;case s.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case s.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case s.invalid_arguments:a="Invalid function arguments";break;case s.invalid_return_type:a="Invalid function return type";break;case s.invalid_date:a="Invalid date";break;case s.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case s.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case s.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case s.custom:a="Invalid input";break;case s.invalid_intersection_types:a="Intersection results could not be merged";break;case s.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case s.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}};let a=errorMap;function getErrorMap(){return a}const makeIssue=e=>{const{data:t,path:n,errorMaps:i,issueData:s}=e,a=[...n,...s.path||[]],c={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let u="";const d=i.filter((e=>!!e)).slice().reverse();for(const l of d)u=l(c,{data:t,defaultError:u}).message;return{...s,path:a,message:u}};function addIssueToContext(e,t){const n=getErrorMap(),i=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(i)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if("aborted"===i.status)return c;"dirty"===i.status&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const e=await i.key,t=await i.value;n.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:t,value:s}=i;if("aborted"===t.status)return c;if("aborted"===s.status)return c;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!i.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const c=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,t,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,n,i,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var u,d,l,p;"function"==typeof SuppressedError&&SuppressedError,(d=u||(u={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},d.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.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 ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:i,description:s}=e;if(t&&(n||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{var a,c;const{message:u}=e;return"invalid_enum_value"===t.code?{message:null!=u?u:s.defaultError}:void 0===s.data?{message:null!==(a=null!=u?u:i)&&void 0!==a?a:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(c=null!=u?u:n)&&void 0!==c?c:s.defaultError}},description:s}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,s)}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:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(isAsync(i)?i:Promise.resolve(i));return handleResult(n,s)}refine(e,t){const getIssueProperties=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),setError=()=>n.addIssue({code:s.custom,...getIssueProperties(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(setError(),!1))):!!i||(setError(),!1)}))}refinement(e,t){return this._refinement(((n,i)=>!!e(n)||(i.addIssue("function"==typeof t?t(n,i):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new ZodBranded({typeName:R.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const h=/^c[^\s-]{8,}$/i,f=/^[0-9a-z]+$/,m=/^[0-9A-HJKMNP-TV-Z]{26}$/,g=/^[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,_=/^[a-z0-9_-]{21}$/i,y=/^[-+]?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)?)??$/,v=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let b;const w=/^(?:(?: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])$/,S=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x="((\\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])))",O=new RegExp(`^${x}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function datetimeRegex(e){let t=`${x}T${timeRegexSource(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}class ZodString extends ZodType{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.string,received:e.parsedType}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)if("min"===i.kind)t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("max"===i.kind)t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("length"===i.kind){const e=t.data.length>i.value,c=t.data.length<i.value;(e||c)&&(a=this._getOrReturnCtx(t,a),e?addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if("email"===i.kind)v.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"email",code:s.invalid_string,message:i.message}),n.dirty());else if("emoji"===i.kind)b||(b=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),b.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"emoji",code:s.invalid_string,message:i.message}),n.dirty());else if("uuid"===i.kind)g.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"uuid",code:s.invalid_string,message:i.message}),n.dirty());else if("nanoid"===i.kind)_.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"nanoid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid"===i.kind)h.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid2"===i.kind)f.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid2",code:s.invalid_string,message:i.message}),n.dirty());else if("ulid"===i.kind)m.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ulid",code:s.invalid_string,message:i.message}),n.dirty());else if("url"===i.kind)try{new URL(t.data)}catch(l){a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"url",code:s.invalid_string,message:i.message}),n.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"regex",code:s.invalid_string,message:i.message}),n.dirty())}else if("trim"===i.kind)t.data=t.data.trim();else if("includes"===i.kind)t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty());else if("toLowerCase"===i.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===i.kind)t.data=t.data.toUpperCase();else if("startsWith"===i.kind)t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty());else if("endsWith"===i.kind)t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty());else if("datetime"===i.kind){datetimeRegex(i).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"datetime",message:i.message}),n.dirty())}else if("date"===i.kind){O.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"date",message:i.message}),n.dirty())}else if("time"===i.kind){new RegExp(`^${timeRegexSource(i)}$`).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"time",message:i.message}),n.dirty())}else"duration"===i.kind?y.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"duration",code:s.invalid_string,message:i.message}),n.dirty()):"ip"===i.kind?(u=t.data,("v4"!==(d=i.version)&&d||!w.test(u))&&("v6"!==d&&d||!S.test(u))&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ip",code:s.invalid_string,message:i.message}),n.dirty())):"base64"===i.kind?I.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"base64",code:s.invalid_string,message:i.message}),n.dirty()):e.assertNever(i);var u,d;return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:s.invalid_string,...u.errToObj(n)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...u.errToObj(e)})}url(e){return this._addCheck({kind:"url",...u.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...u.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...u.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...u.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...u.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...u.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...u.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...u.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...u.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...u.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...u.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...u.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...u.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...u.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...u.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...u.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...u.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...u.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...u.errToObj(t)})}nonempty(e){return this.min(1,u.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,s=n>i?n:i;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:R.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==i.number){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.number,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("int"===i.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty());else if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else"multipleOf"===i.kind?0!==floatSafeRemainder(t.data,i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_finite,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,n,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:u.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:u.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:u.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:u.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:u.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:R.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==i.bigint){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.bigint,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,n,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:u.toString(i)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:R.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.boolean,received:t.parsedType}),c}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:R.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.date,received:e.parsedType}),c}if(isNaN(t.data.getTime())){return addIssueToContext(this._getOrReturnCtx(t),{code:s.invalid_date}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)"min"===i.kind?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):"max"===i.kind?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:u.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:u.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:R.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.symbol,received:t.parsedType}),c}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:R.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.undefined,received:t.parsedType}),c}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:R.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.null,received:t.parsedType}),c}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:R.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:R.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:R.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.never,received:t.parsedType}),c}}ZodNever.create=e=>new ZodNever({typeName:R.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.void,received:t.parsedType}),c}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:R.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==i.array)return addIssueToContext(t,{code:s.invalid_type,expected:i.array,received:t.parsedType}),c;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?s.too_big:s.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(addIssueToContext(t,{code:s.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(addIssueToContext(t,{code:s.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n))))).then((e=>ParseStatus.mergeArray(n,e)));const u=[...t.data].map(((e,n)=>a.type._parseSync(new ParseInputLazyPath(t,e,t.path,n))));return ParseStatus.mergeArray(n,u)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:u.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:u.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:u.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:u}=this._getCached(),d=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const i in n.data)u.includes(i)||d.push(i);const l=[];for(const i of u){const e=a[i],t=n.data[i];l.push({key:{status:"valid",value:i},value:e._parse(new ParseInputLazyPath(n,t,n.path,i)),alwaysSet:i in n.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of d)l.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)d.length>0&&(addIssueToContext(n,{code:s.unrecognized_keys,keys:d}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of d){const i=n.data[t];l.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(n,i,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of l){const n=await t.key,i=await t.value;e.push({key:n,value:i,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return u.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var i,s,a,c;const d=null!==(a=null===(s=(i=this._def).errorMap)||void 0===s?void 0:s.call(i,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(c=u.errToObj(e).message)&&void 0!==c?c:d}:{message:d}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(t){const n={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}omit(t){const n={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}deepPartial(){return deepPartialify(this)}partial(t){const n={};return e.objectKeys(this.shape).forEach((e=>{const i=this.shape[e];t&&!t[e]?n[e]=i:n[e]=i.optional()})),new ZodObject({...this._def,shape:()=>n})}required(t){const n={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ZodOptional;)t=t._def.innerType;n[e]=t}})),new ZodObject({...this._def,shape:()=>n})}keyof(){return createZodEnum(e.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function handleResults(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const n=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:n}),c}));{let e;const i=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&i.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=i.map((e=>new ZodError(e)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:a}),c}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:R.ZodUnion,...processCreateParams(t)});const getDiscriminator=t=>t instanceof ZodLazy?getDiscriminator(t.schema):t instanceof ZodEffects?getDiscriminator(t.innerType()):t instanceof ZodLiteral?[t.value]:t instanceof ZodEnum?t.options:t instanceof ZodNativeEnum?e.objectValues(t.enum):t instanceof ZodDefault?getDiscriminator(t._def.innerType):t instanceof ZodUndefined?[void 0]:t instanceof ZodNull?[null]:t instanceof ZodOptional?[void 0,...getDiscriminator(t.unwrap())]:t instanceof ZodNullable?[null,...getDiscriminator(t.unwrap())]:t instanceof ZodBranded||t instanceof ZodReadonly?getDiscriminator(t.unwrap()):t instanceof ZodCatch?getDiscriminator(t._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c;const n=this.discriminator,a=t.data[n],u=this.optionsMap.get(a);return u?t.common.async?u._parseAsync({data:t.data,path:t.path,parent:t}):u._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),c)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const t=getDiscriminator(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(i.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,s)}}return new ZodDiscriminatedUnion({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(n)})}}function mergeValues(t,n){const s=getParsedType(t),a=getParsedType(n);if(t===n)return{valid:!0,data:t};if(s===i.object&&a===i.object){const i=e.objectKeys(n),s=e.objectKeys(t).filter((e=>-1!==i.indexOf(e))),a={...t,...n};for(const e of s){const i=mergeValues(t[e],n[e]);if(!i.valid)return{valid:!1};a[e]=i.data}return{valid:!0,data:a}}if(s===i.array&&a===i.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let i=0;i<t.length;i++){const s=mergeValues(t[i],n[i]);if(!s.valid)return{valid:!1};e.push(s.data)}return{valid:!0,data:e}}return s===i.date&&a===i.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),handleParsed=(e,i)=>{if(isAborted(e)||isAborted(i))return c;const a=mergeValues(e.value,i.value);return a.valid?((isDirty(e)||isDirty(i))&&t.dirty(),{status:t.value,value:a.data}):(addIssueToContext(n,{code:s.invalid_intersection_types}),c)};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((([e,t])=>handleParsed(e,t))):handleParsed(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:R.ZodIntersection,...processCreateParams(n)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return addIssueToContext(n,{code:s.invalid_type,expected:i.array,received:n.parsedType}),c;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new ParseInputLazyPath(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:R.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{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!==i.object)return addIssueToContext(n,{code:s.invalid_type,expected:i.object,received:n.parsedType}),c;const a=[],u=this._def.keyType,d=this._def.valueType;for(const i in n.data)a.push({key:u._parse(new ParseInputLazyPath(n,i,n.path,i)),value:d._parse(new ParseInputLazyPath(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?ParseStatus.mergeObjectAsync(t,a):ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:R.ZodRecord,...processCreateParams(n)}:{keyType:ZodString.create(),valueType:e,typeName:R.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{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!==i.map)return addIssueToContext(n,{code:s.invalid_type,expected:i.map,received:n.parsedType}),c;const a=this._def.keyType,u=this._def.valueType,d=[...n.data.entries()].map((([e,t],i)=>({key:a._parse(new ParseInputLazyPath(n,e,n.path,[i,"key"])),value:u._parse(new ParseInputLazyPath(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of d){const i=await n.key,s=await n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of d){const i=n.key,s=n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:R.ZodMap,...processCreateParams(n)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return addIssueToContext(n,{code:s.invalid_type,expected:i.set,received:n.parsedType}),c;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(addIssueToContext(n,{code:s.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(addIssueToContext(n,{code:s.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const u=this._def.valueType;function finalizeSet(e){const n=new Set;for(const i of e){if("aborted"===i.status)return c;"dirty"===i.status&&t.dirty(),n.add(i.value)}return{status:t.value,value:n}}const d=[...n.data.values()].map(((e,t)=>u._parse(new ParseInputLazyPath(n,e,n.path,t))));return n.common.async?Promise.all(d).then((e=>finalizeSet(e))):finalizeSet(d)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:u.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:u.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return addIssueToContext(t,{code:s.invalid_type,expected:i.function,received:t.parsedType}),c;function makeArgsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_arguments,argumentsError:n}})}function makeReturnsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_return_type,returnTypeError:n}})}const n={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const i=new ZodError([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw i.addIssue(makeArgsIssue(t,e)),i})),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw i.addIssue(makeReturnsIssue(c,e)),i}))}))}{const e=this;return OK((function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new ZodError([makeArgsIssue(t,i.error)]);const s=Reflect.apply(a,this,i.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new ZodError([makeReturnsIssue(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:R.ZodFunction,...processCreateParams(n)})}}class ZodLazy extends ZodType{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})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:R.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),c}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:R.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:R.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),l.set(this,void 0)}_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),i=this._def.values;return addIssueToContext(n,{expected:e.joinValues(i),received:n.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,l)||__classPrivateFieldSet(this,l,new Set(this._def.values)),!__classPrivateFieldGet(this,l).has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return addIssueToContext(e,{received:e.data,code:s.invalid_enum_value,options:n}),c}return OK(t.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 ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}l=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),p.set(this,void 0)}_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==i.string&&a.parsedType!==i.number){const t=e.objectValues(n);return addIssueToContext(a,{expected:e.joinValues(t),received:a.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,p)||__classPrivateFieldSet(this,p,new Set(e.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,p).has(t.data)){const t=e.objectValues(n);return addIssueToContext(a,{received:a.data,code:s.invalid_enum_value,options:t}),c}return OK(t.data)}get enum(){return this._def.values}}p=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:R.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return addIssueToContext(t,{code:s.invalid_type,expected:i.promise,received:t.parsedType}),c;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return OK(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:R.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:i}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:e=>{addIssueToContext(i,e),e.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===s.type){const e=s.transform(i.data,a);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===n.value)return c;const t=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}));{if("aborted"===n.value)return c;const t=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}}if("refinement"===s.type){const executeRefinement=e=>{const t=s.refinement(e,a);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value),{status:n.value,value:e.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value).then((()=>({status:n.value,value:e.value}))))))}if("transform"===s.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!isValid(e))return e;const t=s.transform(e.value,a);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>isValid(e)?Promise.resolve(s.transform(e.value,a)).then((e=>({status:n.value,value:e}))):e))}e.assertNever(s)}}ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:R.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...processCreateParams(n)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===i.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:R.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===i.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:R.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:R.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(i)?i.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:R.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.nan,received:t.parsedType}),c}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:R.ZodNaN,...processCreateParams(e)});const C=Symbol("zod_brand");class ZodBranded extends ZodType{_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 ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:R.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>freeze(e))):freeze(t)}unwrap(){return this._def.innerType}}function custom(e,t={},n){return e?ZodAny.create().superRefine(((i,s)=>{var a,c;if(!e(i)){const e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,u=null===(c=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===c||c,d="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...d,fatal:u})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:R.ZodReadonly,...processCreateParams(t)});const T={object:ZodObject.lazycreate};var R,P;(P=R||(R={})).ZodString="ZodString",P.ZodNumber="ZodNumber",P.ZodNaN="ZodNaN",P.ZodBigInt="ZodBigInt",P.ZodBoolean="ZodBoolean",P.ZodDate="ZodDate",P.ZodSymbol="ZodSymbol",P.ZodUndefined="ZodUndefined",P.ZodNull="ZodNull",P.ZodAny="ZodAny",P.ZodUnknown="ZodUnknown",P.ZodNever="ZodNever",P.ZodVoid="ZodVoid",P.ZodArray="ZodArray",P.ZodObject="ZodObject",P.ZodUnion="ZodUnion",P.ZodDiscriminatedUnion="ZodDiscriminatedUnion",P.ZodIntersection="ZodIntersection",P.ZodTuple="ZodTuple",P.ZodRecord="ZodRecord",P.ZodMap="ZodMap",P.ZodSet="ZodSet",P.ZodFunction="ZodFunction",P.ZodLazy="ZodLazy",P.ZodLiteral="ZodLiteral",P.ZodEnum="ZodEnum",P.ZodEffects="ZodEffects",P.ZodNativeEnum="ZodNativeEnum",P.ZodOptional="ZodOptional",P.ZodNullable="ZodNullable",P.ZodDefault="ZodDefault",P.ZodCatch="ZodCatch",P.ZodPromise="ZodPromise",P.ZodBranded="ZodBranded",P.ZodPipeline="ZodPipeline",P.ZodReadonly="ZodReadonly";const N=ZodString.create,D=ZodNumber.create,A=ZodNaN.create,Z=ZodBigInt.create,j=ZodBoolean.create,L=ZodDate.create,q=ZodSymbol.create,U=ZodUndefined.create,B=ZodNull.create,$=ZodAny.create,z=ZodUnknown.create,W=ZodNever.create,H=ZodVoid.create,K=ZodArray.create,G=ZodObject.create,J=ZodObject.strictCreate,Y=ZodUnion.create,X=ZodDiscriminatedUnion.create,Q=ZodIntersection.create,ee=ZodTuple.create,te=ZodRecord.create,re=ZodMap.create,ne=ZodSet.create,oe=ZodFunction.create,ie=ZodLazy.create,se=ZodLiteral.create,ae=ZodEnum.create,ce=ZodNativeEnum.create,ue=ZodPromise.create,de=ZodEffects.create,le=ZodOptional.create,pe=ZodNullable.create,he=ZodEffects.createWithPreprocess,fe=ZodPipeline.create,me={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},ge=c;var _e=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){a=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:c,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return e},get objectUtil(){return n},ZodParsedType:i,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:C,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:T,get ZodFirstPartyTypeKind(){return R},coerce:me,any:$,array:K,bigint:Z,boolean:j,date:L,discriminatedUnion:X,effect:de,enum:ae,function:oe,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),intersection:Q,lazy:ie,literal:se,map:re,nan:A,nativeEnum:ce,never:W,null:B,nullable:pe,number:D,object:G,oboolean:()=>j().optional(),onumber:()=>D().optional(),optional:le,ostring:()=>N().optional(),pipeline:fe,preprocess:he,promise:ue,record:te,set:ne,strictObject:J,string:N,symbol:q,transformer:de,tuple:ee,undefined:U,union:Y,unknown:z,void:H,NEVER:ge,ZodIssueCode:s,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const ye=_e.union([_e.string(),_e.boolean(),_e.number(),_e.undefined()]),ve=_e.record(_e.string(),_e.union([ye,_e.array(ye)])),be=_e.string().min(1,"Event name is required");var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)};function __awaiter$1(e,t,n,i){return new(n||(n=Promise))((function(s,a){function fulfilled(e){try{step(i.next(e))}catch(t){a(t)}}function rejected(e){try{step(i.throw(e))}catch(t){a(t)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var we={default:"endpoint"},ke={default:"tlsEndpoint"},Se="Client timeout",Ie="Network connection error",xe="Network request aborted",Oe="Response cannot be parsed",Ee="Blocked by CSP",Ce="The endpoint parameter is not a valid URL";function E(e){for(var t="",n=0;n<e.length;++n)if(n>0){var i=e[n].toLowerCase();i!==e[n]?t+=" ".concat(i):t+=e[n]}else t+=e[n].toUpperCase();return t}var Te=E("WrongRegion"),Re=E("SubscriptionNotActive"),Pe=E("UnsupportedVersion"),Me=E("InstallationMethodRestricted"),Ne=E("HostnameRestricted"),De=E("IntegrationFailed"),Ae="API key required",Ze="API key not found",je="API key expired",Le="Request cannot be parsed",qe="Request failed",Ue="Request failed to process",Fe="Too many requests, rate limit exceeded",Be="Not available for this origin",$e="Not available with restricted header",ze=Ae,We=Ze,Ve=je,He="Failed to load the JS script of the agent",Ke="9319";function M(e,t){var n,i,s,a,c,u=[],d=(c=function __spreadArray(e,t,n){if(n||2===arguments.length)for(var i,s=0,a=t.length;s<a;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}([],e,!0),n={current:function(){return c[0]},postpone:function(){var e=c.shift();void 0!==e&&c.push(e)},exclude:function(){c.shift()}},a=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[n.current(),function(e,t){var a,c=t instanceof Error?t.message:"";if(c===Ee||c===Ce)n.exclude(),a=0;else if(c===Ke)n.exclude();else if(c===He){var u=Date.now()-e.getTime()<50,d=n.current();d&&u&&!s.has(d)&&(s.add(d),a=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=a?a:e.getTime()+i()-Date.now()]}]),l=d[0],p=d[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var n=new Date,r3=function(t){return u.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r3()}),r3),i.catch((function(e){if(u.length>=5)throw e;var t=p(n,e);if(!t)throw e;var i,s=t[0],a=t[1];return(i=a,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return p2(s)}))}))};return p2(l).then((function(e){return[e,u]}))}var Ge="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Je=Ge;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,u,d,l=e.token,p=e.apiKey,h=void 0===p?l:p,f=function __rest$1(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["scriptUrlPattern","token","apiKey"]),m=null!==(t=function r(e,t){return n=e,i=t,Object.prototype.hasOwnProperty.call(n,i)?e[t]:void 0;var n,i}(e,"scriptUrlPattern"))&&void 0!==t?t:Ge,g=(c=[],u=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=u,n.addEventListener(i,s,a),d=function(){return n.removeEventListener(i,s,a)},u(),[c,d]),_=g[0],y=g[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(Ae);var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.1"):e}))}(String(e),t)}))}(m,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===Ke?new Error(He):e}(e)})).then((function(e){var t=e[0],n=e[1];return y(),t.load(__assign(__assign({},f),{ldi:{attempts:n,visibilityStates:_}}))}))}function V(e){return function o(e,t,n,i){var s,a=document,c="securitypolicyviolation",u2=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(s=t,R2())};a.addEventListener(c,u2);var R2=function(){return a.removeEventListener(c,u2)};return Promise.resolve().then(t).then((function(e){return R2(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(R2(),s)return n(s);throw e}))}))}(e,(function(){return t=e,new Promise((function(e,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(t){if(t instanceof Error&&"TypeError"===t.name)return!0;throw t}}(t))throw new Error(Ce);var i=document.createElement("script"),o2=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},s=document.head||document.getElementsByTagName("head")[0];i.onload=function(){o2(),e()},i.onerror=function(){o2(),n(new Error(He))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error(Ee)})).then(k)}function k(){var e,t,n,i,s=window,a="__fpjs_p_l_b",c=s[a];if(e=s,t=a,(null==(i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t))?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0),"function"!=typeof(null==c?void 0:c.load))throw new Error(Ke);return c}var Ye={load:F,defaultScriptUrlPattern:Je,ERROR_SCRIPT_LOAD_FAIL:He,ERROR_API_KEY_EXPIRED:je,ERROR_API_KEY_INVALID:Ze,ERROR_API_KEY_MISSING:Ae,ERROR_BAD_REQUEST_FORMAT:Le,ERROR_BAD_RESPONSE_FORMAT:Oe,ERROR_CLIENT_TIMEOUT:Se,ERROR_CSP_BLOCK:Ee,ERROR_FORBIDDEN_ENDPOINT:Ne,ERROR_FORBIDDEN_HEADER:$e,ERROR_FORBIDDEN_ORIGIN:Be,ERROR_GENERAL_SERVER_FAILURE:qe,ERROR_INSTALLATION_METHOD_RESTRICTED:Me,ERROR_INTEGRATION_FAILURE:De,ERROR_INVALID_ENDPOINT:Ce,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:Fe,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Pe,ERROR_WRONG_REGION:Te,defaultEndpoint:we,defaultTlsEndpoint:ke};const Xe=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:je,ERROR_API_KEY_INVALID:Ze,ERROR_API_KEY_MISSING:Ae,ERROR_BAD_REQUEST_FORMAT:Le,ERROR_BAD_RESPONSE_FORMAT:Oe,ERROR_CLIENT_TIMEOUT:Se,ERROR_CSP_BLOCK:Ee,ERROR_FORBIDDEN_ENDPOINT:Ne,ERROR_FORBIDDEN_HEADER:$e,ERROR_FORBIDDEN_ORIGIN:Be,ERROR_GENERAL_SERVER_FAILURE:qe,ERROR_INSTALLATION_METHOD_RESTRICTED:Me,ERROR_INTEGRATION_FAILURE:De,ERROR_INVALID_ENDPOINT:Ce,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:Fe,ERROR_SCRIPT_LOAD_FAIL:He,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Pe,ERROR_WRONG_REGION:Te,default:Ye,defaultEndpoint:we,defaultScriptUrlPattern:Je,defaultTlsEndpoint:ke,load:F},Symbol.toStringTag,{value:"Module"})),Qe="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(e){var t;this.tag=e.tag||null,this.linkedId=e.linkedId||null,this.extendedResult=null!==(t=e.extendedResult)&&void 0!==t&&t}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(e,t){return`${t}__${e}`}function removePrefixFromKey(e,t){return e.replace(`${t}__`,"")}class LocalStorageCache{constructor(e=Qe){this.prefix=e}set(e,t){window.localStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.localStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){return}}remove(e){window.localStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class SessionStorageCache{constructor(e=Qe){this.prefix=e}set(e,t){window.sessionStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.sessionStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){return}}remove(e){window.sessionStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.sessionStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class CacheManager{constructor(e,t=3600,n){this.cache=e,this.cacheTime=t,this.nowProvider=n||DEFAULT_NOW_PROVIDER}get(e){return __awaiter$1(this,void 0,void 0,(function*(){const t=yield this.cache.get(e.toKey());if(!t)return;const n=yield this.nowProvider(),i=Math.floor(n/1e3);if(!(t.expiresAt<i))return t.body;yield this.cache.remove(e.toKey())}))}set(e,t){return __awaiter$1(this,void 0,void 0,(function*(){const n=yield this.wrapCacheEntry(t);yield this.cache.set(e.toKey(),n)}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){const e=yield this.cache.allKeys();yield Promise.all(e.map((e=>this.cache.remove(e))))}))}wrapCacheEntry(e){return __awaiter$1(this,void 0,void 0,(function*(){const t=yield this.nowProvider(),n=Math.floor(t/1e3)+this.cacheTime;return{body:e,expiresAt:n}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var et,tt;(tt=et||(et={})).Memory="memory",tt.LocalStorage="localstorage",tt.SessionStorage="sessionstorage",tt.NoCache="nocache";const rt={[et.Memory]:()=>(new InMemoryCache).enclosedCache,[et.LocalStorage]:e=>new LocalStorageCache(e),[et.SessionStorage]:e=>new SessionStorageCache(e),[et.NoCache]:()=>new CacheStub},cacheFactory=e=>rt[e];class FpjsClient{constructor(e){var t;let n;if(this.inFlightRequests=new Map,this.agentPromise=null,this.customAgent=null==e?void 0:e.customAgent,this.agent={get:()=>{throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.")}},this.loadOptions=null==e?void 0:e.loadOptions,(null==e?void 0:e.cache)&&(null==e?void 0:e.cacheLocation)&&console.warn("Both `cache` and `cacheLocation` options have been specified in the FpjsClient configuration; ignoring `cacheLocation` and using `cache`."),null==e?void 0:e.cache)n=e.cache;else{if(this.cacheLocation=(null==e?void 0:e.cacheLocation)||et.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case et.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case et.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=et.Memory),n=cacheFactory(this.cacheLocation)(null==e?void 0:e.cachePrefix)}if((null==e?void 0:e.cacheTimeInSeconds)&&e.cacheTimeInSeconds>86400)throw new Error("Cache time cannot exceed 86400 seconds (24 hours)");const i=null!==(t=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==t?t:3600;this.cacheManager=new CacheManager(n,i)}init(e){return __awaiter$1(this,void 0,void 0,(function*(){var t,n;if(!this.loadOptions&&!e)throw new TypeError("No load options provided");const i=Object.assign(Object.assign(Object.assign({},this.loadOptions),e),{integrationInfo:[...(null===(t=this.loadOptions)||void 0===t?void 0:t.integrationInfo)||[],...(null==e?void 0:e.integrationInfo)||[],"fingerprintjs-pro-spa/1.3.2"]});if(!this.agentPromise){const e=null!==(n=this.customAgent)&&void 0!==n?n:Xe;this.agentPromise=e.load(i).then((e=>(this.agent=e,e))).catch((e=>{throw this.agentPromise=null,e}))}return this.agentPromise}))}getVisitorData(){return __awaiter$1(this,arguments,void 0,(function*(e={},t=!1){const n=FpjsClient.makeCacheKey(e).toKey();if(!this.inFlightRequests.has(n)){const i=this._identify(e,t).finally((()=>{this.inFlightRequests.delete(n)}));this.inFlightRequests.set(n,i)}return yield this.inFlightRequests.get(n)}))}getVisitorDataFromCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){const t=FpjsClient.makeCacheKey(e),n=yield this.cacheManager.get(t);return n?Object.assign(Object.assign({},n),{cacheHit:!0}):void 0}))}isInCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){return Boolean(yield this.getVisitorDataFromCache(e))}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){yield this.cacheManager.clearCache()}))}static makeCacheKey(e){return new CacheKey(e)}_identify(e){return __awaiter$1(this,arguments,void 0,(function*(e,t=!1){const n=FpjsClient.makeCacheKey(e);if(!t){const e=yield this.cacheManager.get(n);if(e)return Object.assign(Object.assign({},e),{cacheHit:!0})}const i=yield this.agent.get(e);return yield this.cacheManager.set(n,i),Object.assign(Object.assign({},i),{cacheHit:!1})}))}}const nt="default_fingerprint_cache",ot=7,it="apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=nt}=window.fingerprintConfig;try{const t=JSON.parse(localStorage.getItem(e)||"null");return t&&t.expiresAt>Date.now()?t.fingerprint:(localStorage.removeItem(e),null)}catch{return null}};function isFingerprintReady(){return void 0!==window.fpClient}const st={initFingerprint:async function initFingerprint(e,t){const n=[we],i=[Je];t&&(n.unshift(t),i.unshift(function buildProxyUrl(e){return`${e}?${it}`}(t))),window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e,endpoint:n,scriptUrlPattern:i}});try{await window.fpClient.init()}catch(or){throw console.error("Error initializing identification service:",or),or}},getFingerprint:async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const t=getCachedFingerprint();if(t)return t;if(e)return"";if(!isFingerprintReady())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:t}=await e.getVisitorData();return(e=>{const{cacheName:t=nt,cacheTimeInDays:n=ot}=window.fingerprintConfig,i={fingerprint:e,expiresAt:getExpirationDate(n)};localStorage.setItem(t,JSON.stringify(i))})(t),t}catch(or){throw console.error("Error retrieving fingerprint:",or),or}},isFingerprintReady:isFingerprintReady,getCachedFingerprint:getCachedFingerprint};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var at,ct={exports:{}};at=ct,function webpackUniversalModuleDefinition(e,t){at.exports=t()}("undefined"!=typeof self&&self,(function(){return function(e){var t={};function __webpack_require__(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=3)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.post(c,t,u)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion,i=t.queryParams,s=t.apiType,c=buildUrl({endpoint:e,apiVersion:n,queryParams:i,apiType:s});return a.get(c,u)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.put(c,t,u)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion;t.queryParams;var i=t.apiType,s=buildUrl({endpoint:e,apiVersion:n,apiType:i});return a.deleteMethod(s,u)},t.poll=function poll(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments[3],a=arguments[4],u=buildUrl({endpoint:e,apiVersion:s,apiType:a}),d=i({url:u,eachCall:t},n);return new c.default(d)};var s=_interopRequireDefault(n(1)),a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),c=_interopRequireDefault(n(9));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var u={apiKey:s.default.apiKey};function serializeQueryParams(e){if(!e)return"";var t=[null,void 0,""].concat(function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])),n=[];return Object.keys(e).forEach((function(i){var s=e[i];t.includes(s)||n.push(i+"="+s)})),n.length?"?"+n.join("&"):""}function buildUrl(e){var t=e.endpoint,n=e.apiVersion,i=void 0===n?s.default.version:n,a=e.queryParams;return"core"===e.apiType?s.default.coreUrl+"/"+s.default.coreVersion+"/"+t+serializeQueryParams(a):(/search|redirect|places/.test(t)?s.default.searchUrl:s.default.purchaseUrl)+"/"+i+"/"+t+serializeQueryParams(a)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.setConfig=function setConfig(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0!==e.env&&(e.searchUrl=i[e.env].search,e.purchaseUrl=i[e.env].purchase,e.coreUrl=i[e.env].core,e.coreVersion=i[e.env].coreVersion),Object.assign(c,e)},t.setUserAuthToken=function setUserAuthToken(e){return Object.assign(c,{userAuthToken:e})};var i={sandbox:{search:"https://search.resertravel.com/api",purchase:"https://purchases.resertravel.com/api",core:""},production:{search:"https://search.reservamos.mx/api",purchase:"https://compras.reservamos.mx/api",core:""}},s="sandbox",a={env:s,headers:{},searchUrl:i[s].search,purchaseUrl:i[s].purchase,coreUrl:i[s].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1},c=t.config=Object.assign({},a);t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"POST",body:JSON.stringify(t)},n)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];return fetchJson(e,t,{},n)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"PUT",body:JSON.stringify(t)},n)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fetchJson(e,{method:"DELETE"},t)};var s=_interopRequireDefault(n(1)),a=_interopRequireDefault(n(7)),c=_interopRequireDefault(n(8));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function checkStatus(e){var t=e.json();if(e.ok)return t;if(![404,422,500].includes(e.status))throw new a.default(e.status,e.statusText);switch(e.status){case 404:throw new a.default(100,"Not found");case 422:return t;case 500:throw new a.default(101,"Server error");default:throw new a.default}}function handleErrors(e){if(e.errors instanceof Array){var t=e.errors[0]||{},n=t.code,i=void 0===n?-100:n,s=t.message,u=void 0===s?"Unknown error":s,d=(0,c.default)(u)[i];throw d?new a.default(d.code,d.message):new a.default(i,u)}return e}function buildHeaders(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=Object.keys(Object.assign.apply(Object,[{}].concat(t))).reduce((function(e,n){return i({},e,function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},n,t.map((function(e){return n in e&&e[n]})).filter(Boolean)))}),{});return new Headers(s)}function fetchJson(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=s.default.apiKey,c=s.default.withCredentials,u=s.default.userAuthToken,d=s.default.headers,l={Accept:"application/json",Authorization:"Token token="+(n.apiKey||a),"Content-Type":"application/json"};return u&&(l.Authorization="Token "+(n.apiKey||a)+", Bearer "+u),t.headers=buildHeaders(d,l),t.credentials=c?"include":"omit","string"!=typeof t.body&&(t.body=JSON.stringify(t.body)),fetch(e,t).then(checkStatus).then(handleErrors).catch(i)}},function(e,t,n){n(4),n(5),e.exports=n(6)},function(e,t){"function"!=typeof Object.assign&&(Object.assign=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])}return n})},function(e,t){!function(e){if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,a="ArrayBuffer"in e;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],isDataView=function(e){return e&&DataView.prototype.isPrototypeOf(e)},u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};Headers2.prototype.append=function(e,t){e=normalizeName(e),t=normalizeValue(t);var n=this.map[e];this.map[e]=n?n+","+t:t},Headers2.prototype.delete=function(e){delete this.map[normalizeName(e)]},Headers2.prototype.get=function(e){return e=normalizeName(e),this.has(e)?this.map[e]:null},Headers2.prototype.has=function(e){return this.map.hasOwnProperty(normalizeName(e))},Headers2.prototype.set=function(e,t){this.map[normalizeName(e)]=normalizeValue(t)},Headers2.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},Headers2.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),iteratorFor(e)},Headers2.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),iteratorFor(e)},Headers2.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),iteratorFor(e)},n&&(Headers2.prototype[Symbol.iterator]=Headers2.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response2.prototype),Response2.prototype.clone=function(){return new Response2(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers2(this.headers),url:this.url})},Response2.error=function(){var e=new Response2(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];Response2.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new Response2(null,{status:t,headers:{location:e}})},e.Headers=Headers2,e.Request=Request,e.Response=Response2,e.fetch=function(e,t){return new Promise((function(n,s){var a=new Request(e,t),c=new XMLHttpRequest;c.onload=function(){var e,t,i={status:c.status,statusText:c.statusText,headers:(e=c.getAllResponseHeaders()||"",t=new Headers2,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),i=n.shift().trim();if(i){var s=n.join(":").trim();t.append(i,s)}})),t)};i.url="responseURL"in c?c.responseURL:i.headers.get("X-Request-URL");var s="response"in c?c.response:c.responseText;n(new Response2(s,i))},c.onerror=function(){s(new TypeError("Network request failed"))},c.ontimeout=function(){s(new TypeError("Network request failed"))},c.open(a.method,a.url,!0),"include"===a.credentials?c.withCredentials=!0:"omit"===a.credentials&&(c.withCredentials=!1),"responseType"in c&&i&&(c.responseType="blob"),a.headers.forEach((function(e,t){c.setRequestHeader(t,e)})),c.send(void 0===a._bodyInit?null:a._bodyInit)}))},e.fetch.polyfill=!0}function normalizeName(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function normalizeValue(e){return"string"!=typeof e&&(e=String(e)),e}function iteratorFor(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function Headers2(e){this.map={},e instanceof Headers2?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function consumed(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function fileReaderReady(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function readBlobAsArrayBuffer(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsArrayBuffer(e),n}function bufferClone(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(i&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(s&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(a&&i&&isDataView(e))this._bodyArrayBuffer=bufferClone(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!a||!ArrayBuffer.prototype.isPrototypeOf(e)&&!u(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=bufferClone(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?consumed(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return function readBlobAsText(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function readArrayBufferAsText(e){for(var t=new Uint8Array(e),n=new Array(t.length),i=0;i<t.length;i++)n[i]=String.fromCharCode(t[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}function Request(e,t){var n=(t=t||{}).body;if(e instanceof Request){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Headers2(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new Headers2(t.headers)),this.method=function normalizeMethod(e){var t=e.toUpperCase();return d.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function decode(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),i=n.shift().replace(/\+/g," "),s=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(s))}})),t}function Response2(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new Headers2(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.core=t.adyen=t.exchange=t.priceAlert=t.users=t.quotes=t.redirect=t.utils=t.purchase=t.trip=t.search=t.collections=t.session=t.apiRequest=t.setUserAuthToken=t.setConfig=void 0;var i=n(1),s=_interopRequireWildcard(n(0)),a=_interopRequireWildcard(n(10)),c=_interopRequireWildcard(n(11)),u=_interopRequireWildcard(n(12)),d=_interopRequireWildcard(n(13)),l=_interopRequireWildcard(n(14)),p=_interopRequireWildcard(n(17)),h=_interopRequireWildcard(n(19)),f=_interopRequireWildcard(n(20)),m=_interopRequireWildcard(n(21)),g=_interopRequireWildcard(n(22)),_=_interopRequireWildcard(n(23)),y=_interopRequireWildcard(n(24)),v=_interopRequireWildcard(n(25));function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.setConfig=i.setConfig,t.setUserAuthToken=i.setUserAuthToken,t.apiRequest=s,t.session=a,t.collections=c,t.search=u,t.trip=d,t.purchase=l,t.utils=p,t.redirect=h,t.quotes=f,t.users=m,t.priceAlert=g,t.exchange=_,t.adyen=y,t.core=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function NetworkError2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-100,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unknown error";!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,NetworkError2);var n=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(NetworkError2.__proto__||Object.getPrototypeOf(NetworkError2)).call(this,t));return n.code=e,n.stack=(new Error).stack,n}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(NetworkError2,Error),NetworkError2}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s={1:{code:200,message:"Operación no autorizada"}},a={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},c={10:{code:400,message:"No existe el viaje"},20:{code:60,message:"No se encontró el viaje"},21:{code:60,message:"Tarifa no disponible"},22:{code:60,message:"Tarifa no disponible"}},u={23:{code:60,message:"Estudiante no disponible"},24:{code:60,message:"Profesor no disponible"},25:{code:60,message:"Menor no disponible"},26:{code:60,message:"Capacidades diferentes no disponible"},27:{code:60,message:"INSEN no disponible"},28:{code:60,message:"General no disponible"},29:{code:60,message:"Error desconocido"}},d={50:{code:50,message:"Unknow Error"}},l=t.apiErrors=function apiErrors2(e){return i({},s,a,c,function discountCodeErrors2(e){return{11:{code:500,message:e},12:{code:501,message:e}}}(e),u,d,function exchange2(e){return{30:{code:30,message:e}}}(e))};t.default=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),a=function(){function Poll2(e){var t=e.url,n=e.watch,i=e.expect,s=e.maxRetries,a=void 0===s?30:s,c=e.interval,u=void 0===c?2e3:c,d=e.eachCall,l=void 0===d?null:d;!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Poll2),this.url=t,this.watch=n,this.expect=i instanceof Array?i:[i],this.interval=u,this.maxRetries=a,this.eachCall=l&&l.bind(this),this.aborted=!1,this.timers=[],this.execute=this.execute.bind(this),this.executeEachCall=this.executeEachCall.bind(this)}return i(Poll2,[{key:"start",value:function start(){return this.execute(this.maxRetries)}},{key:"abort",value:function abort(){this.aborted=!0}},{key:"execute",value:function execute(e){var t=this;return s.get(this.url,{},(function onRequestError2(e){return t.executeEachCall("error",e)})).then((function onRequestSuccess2(n){if(t.expect.includes(n[t.watch])||1===e||t.aborted){var i=n[t.watch];1===e?i="retries_exceeded":t.aborted&&(i="aborted"),t.timers.forEach(clearInterval),t.executeEachCall(i,n)}else if("failed"===n[t.watch])t.timers.forEach(clearInterval),t.executeEachCall("failed",n);else{t.executeEachCall("pending",n);var s=window.setTimeout(t.execute,t.interval,e-1);t.timers.push(s)}}))}},{key:"executeEachCall",value:function executeEachCall(e,t){this.eachCall instanceof Function&&this.eachCall({status:e,payload:t})&&this.abort()}}]),Poll2}();t.default=a},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(){return new Promise((function(e,t){i.get("session",{apiVersion:"v1"}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.agency=function agency(){return new Promise((function(e,t){i.get("get_agency").then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getCountries=function getCountries(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.prefetch,n=void 0===t||t,s=e.q,a={prefetch:n,q:void 0===s?"":s};return new Promise((function(e,t){i.get("countries",{queryParams:a}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.getPlaces=function getPlaces(e,t){var n=e?{q:e,from:t}:{prefetch:!0};return new Promise((function(e,t){i.get("places",{queryParams:n}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.create=function create(e,t){return a.post("search",e).then((function onCreateSuccess2(e){return startPolls(e,t)}))},t.stopSearch=function stopSearch(e){return!!(c&&e&&c[e])&&(c[e].forEach((function(e){return e.abort()})),Reflect.deleteProperty(c,e),!0)},t.stopAllSearches=function stopAllSearches(){return!!c&&(Object.entries(c).forEach((function(e){var t=i(e,2);return t[0],t[1].forEach((function(e){return e.abort()}))})),c={},!0)},t.get=function get(e,t){return new Promise((function(n,i){a.get("search/"+e+"/info").then((function(e){return n(startPolls(e,t))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateExternalCoupon=function validateExternalCoupon(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get("search/discounts/validate_external_coupon/"+e+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.walletSearchDiscount=function walletSearchDiscount(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get(e+"/discounts"+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),c={};function startPolls(e,t){var n=e.search,i=n.id,u=n.type_of_transport,d=u.bus,l=u.flights,p=u.mix,h=t.initBuses,f=void 0===h||h,m=t.initFlights,g=void 0===m||m,_=t.initRides,y=void 0!==_&&_,v=t.initMix,b=void 0===v||v,w=t.onReceiveBuses,S=t.onReceiveFlights,I=t.onReceiveRides,x=t.onReceiveMixed,O=s({watch:"state",expect:"finished"},t.options||{}),C=[];if(d&&d.active&&f){var T=a.poll("search/"+i+"?type=bus",w,O);T.start(),C.push(T)}else w&&w({status:"deactivated"});if(l&&l.active&&g){var R=a.poll("search/"+i+"?type=plane",S,O);R.start(),C.push(R)}else S&&S({status:"deactivated"});if(p&&p.active&&b){var P=a.poll("search/"+i+"?type=mix",x,O);P.start(),C.push(P)}else x&&x({status:"deactivated"});if(y){var N=a.poll("search/"+i+"?type=car",I,O);N.start(),C.push(N)}return c[i]=C,e}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,i){s.get("trips/"+e+"?"+function encodePassengers(e){var t=[];return Object.keys(e).forEach((function(n){var i=e[n];i&&t.push(n+"="+i)})),t.join("&")}(t)).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getWithBus=function getWithBus(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i({with_pricing:!0},t);return new Promise((function(t,c){s.post("trips/"+e+"/details_requests",a).then((function(a){return t(function startPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.options,l=void 0===d?{}:d,p=n.onReceiveTrip,h=i({watch:"state",expect:"finished"},l),f=void 0,m=void 0;return u&&(m=(f=s.poll("trips/"+e+"/details_requests/"+a,p,h)).start()),{payload:t,polls:{trip:m,abort:function abort(){return f.abort()}}}}(e,a,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.startTicketsPoll=void 0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPurchasePoll=startPurchasePoll,t.create=function create(e){return new Promise((function(t,n){s.post(u,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.get=get,t.update=function update(e,t){return new Promise((function(n,i){s.put(u+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createPassengers=function createPassengers(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+p,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.updatePassengers=function updatePassengers(e,t){return new Promise((function(n,i){s.put(u+"/"+e+"/"+h,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.deletePassenger=function deletePassenger(e,t){return new Promise((function(n,i){s.deleteMethod(u+"/"+e+"/"+p+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createTickets=function createTickets(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,a){s.post(u+"/"+e+"/"+f,t).then((function(t){return i((0,c.startTicketsPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknown error":i})}))}))},t.applyDiscountCode=function applyDiscountCode(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+g,{code:t},{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.removeDiscountCode=function removeDiscountCode(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+g+"/"+_,{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.createPayment=function createPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.post(u+"/"+e+"/"+v,t).then((function(t){return i((0,a.startPaymentPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.getPayment=function getPayment(e,t,n){return n?(0,a.startPaymentPoll)(e,{id:t},n):new Promise((function(n,i){s.get(u+"/"+e+"/"+v+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.sendEmail=function sendEmail(e,t){var n={email:t};return new Promise((function(t,i){s.get(u+"/"+e+"/"+m,{queryParams:n}).then((function(){return t()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.confirmPaypalPayment=function confirmPaypalPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.put(u+"/"+e+"/"+v+"/"+t+"/confirm.json").then((function(s){i((0,a.startPaymentPoll)(e,{id:t},n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.updateWallet=function updateWallet(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=u+"/"+e+"/"+d,a=t?i:i+"/"+l;return s.post(a,n).then((function(){return get(e)}))},t.verifyPhoneNumber=function verifyPhoneNumber(e,t,n){return s.put(u+"/"+e+"/"+v+"/"+t+"/send_verification",n)},t.verifySmsCode=function verifySmsCode(e,t,n){return s.post(u+"/"+e+"/"+v+"/"+t+"/verify_code",{code:n})},t.unlockSeats=function unlockSeats(e){return new Promise((function(t,n){s.post(u+"/"+e+"/unlock_seats").then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.generateOTP=function generateOTP(e,t){return new Promise((function(n,i){s.post(e+"/otp-generate",t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateOTP=function validateOTP(e,t){return new Promise((function(n,i){var a={otp:t};s.post(e+"/otp-validate",a).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPayment=function membershipDiscountPayment(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+y,t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPaymentDelete=function membershipDiscountPaymentDelete(e){return new Promise((function(t,n){s.deleteMethod(u+"/"+e+"/"+y).then((function(){return t()})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadTickets=function downloadTickets(e){return new Promise((function(t,n){s.post("tickets/pdf",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadPurchasesHistory=function downloadPurchasesHistory(e){return new Promise((function(t,n){s.post(b,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.increaseExpiration=function increaseExpiration(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+w).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=n(15),c=n(16),u="purchases",d="wallet_movements",l="cancel",p="passenger_requests",h=p+"/update",f="ticket_requests",m="tickets/resend",g="discounts",_="cancel",y="payment_discounts",v="payments",b="purchase_history/search",w="session-extension";function startPurchasePoll(e,t){var n=t.init,a=void 0===n||n,c=t.onReceivePurchase,u="purchases/"+e,d=i({watch:"state",expect:["completed"]},t.options||{}),l=void 0,p=void 0;return a&&(p=(l=s.poll(u,c,d)).start()),{polls:{payment:p,abort:function abort(){return l.abort()}}}}function get(e,t,n){return n?startPurchasePoll(e,n):new Promise((function(n,i){s.get(u+"/"+e,{queryParams:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))}t.startTicketsPoll=c.startTicketsPoll},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPaymentPoll=function startPaymentPoll(e,t,n){var c=t.id,u=n.init,d=void 0===u||u,l=n.onReceivePayment,p="purchases/"+e+"/payments/"+c,h=i({watch:"purchase_state",expect:["completed","pending"]},n.options||{}),f=void 0,m=void 0;return d&&(f=s.poll(p,function checkPaymentPayload(e){return function(t){var n=t.payload,i=n.using_3d_secure,s=n.needs_verification;return e&&e(t),a(t)||i||s}}(l),h),m=f.start()),{payload:t,polls:{payment:m,abort:function abort(){return f.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=function paymentFailed2(e){var t=e.payload;return["suspicious","failed","rejected"].includes(t.status)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startTicketsPoll=function startTicketsPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.onReceiveTickets,l="purchases/"+e+"/ticket_requests/"+a,p=i({watch:"state",expect:"finished"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{tickets:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=n(18);Object.defineProperty(t,"findSeats",{enumerable:!0,get:function get(){return i.findSeats}})},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function findAvailableSeats(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments[3],s=t.length,a=n.length,c=t,u=void 0;if(void 0===i&&(i=e-a),!i)return n;for(var d=0;d<s;d++)if((u=findAvailableAdjecentSeats(i,t[d].filter((function(e){return["seat","seat_tv"].includes(e.category)})),n)).length===i){c=(c=t.slice(d)).concat(t.slice(0,d)),a=(n=n.concat(u)).length;break}return u.length?i=e-a:i-=1,findAvailableSeats(e,c,n,i)}function findAvailableAdjecentSeats(e,t){var n=[],i=!1;if(!function hasAvailableSeats(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return e.filter((function(e){return!(e.occupied||n.includes(e.number))})).length>=t}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]))return n;for(var s=t.length-1;s>=0;s--){var a=t[s];if(a.occupied?n=[]:n.push(a.number),n.length===e){i=!0;break}}return i?n:[]}t.findSeats=function findSeats(e,t){var n=i(t,2),s=n[0],a=n[1],c=findAvailableSeats(e,s),u=[];if(c.length<e&&a){var d=findAvailableSeats(e,a);u=d.length<e?c.concat(d).slice(0,e):d}else u=c;return u.length?u:null}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("redirect",{apiVersion:"v2",queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("quotes",{queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getUser=function getUser(){return s.default.userAuthToken?i.get(c):null},t.getCreditCards=function getCreditCards(){return s.default.userAuthToken?i.get(u):null};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n(1)),a="users",c=a+"/profile.json",u=a+"/list_cards.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.createPriceAlert=function createPriceAlert(e){return i.post(s+".json",e)},t.deletePriceAlert=function deletePriceAlert(e){return i.get(s+"/"+e+"/"+a)};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="price_alerts",a="cancel.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.validate=function validate(e,t,n,c,u,d,l){var p=i({},d&&{email:d},l&&{document:l},{operation_number:e},t&&{nit:t},n&&{origin:n},c&&{destination:c},u&&{recaptcha_token:u});return new Promise((function(e,t){s.post(a+"/validate",p).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.cancelTicket=function cancelTicket(e,t){var n={operation_number:t};return new Promise((function(t,i){s.post("purchases/"+e+"/cancellations",n).then((function(e){return t(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getCancelledTicketStatusPoll=function getCancelledTicketStatusPoll(e,t,n){var a=t,c=n.init,u=void 0===c||c,d=n.onGetCancelStatus,l="purchases/"+e+"/cancellations/"+a,p=i({watch:"status",expect:"success"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{data:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a="exchanges"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.paymentCards=function paymentCards(e){return new Promise((function(t,n){i.post("adyen/payment_cards",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.deleteCard=function deleteCard(e){return new Promise((function(t,n){i.post("adyen/delete_payment_card",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getRecommendedTrips=function getRecommendedTrips(e){var t=e.searchId,n=e.userIdentifier;return new Promise((function(e,s){i.get("trip_recommendations/"+t+"/"+n,{apiType:"core"}).then((function(t){return e(t)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return s({code:n,message:void 0===i?"Unknown error":i})}))}))},t.createTripPriceAlerts=function createTripPriceAlerts(e){return new Promise((function(t,n){i.post(""+s,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.updateTripPriceAlerts=function updateTripPriceAlerts(e,t){return new Promise((function(n,a){i.put(s+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknow error":i})}))}))},t.deleteTripPriceAlerts=function deleteTripPriceAlerts(e){return new Promise((function(t,n){i.deleteMethod(s+"/"+e).then((function(){return t({code:200,message:"Trip Price Alert deleted"})})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.createAnonymousProfile=function createAnonymousProfile2(e){return new Promise((function(t,n){i.post(a,e,{apiType:"core"}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="trip_price_alerts",a="anonymous_profiles/identify"}])}));var ut=ct.exports;const dt=window.location.origin,lt={coreAPIConfig:{sandbox:{coreUrl:"https://datalake-api-dev.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:dt},coreApiKey:"Bearer 753bf0710dc920a84236d42241d4f487"},prod:{coreUrl:"https://data-lake.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:dt},coreApiKey:"Bearer 753bf0710dc920a84236d42241d4f487"}}};var pt,ht;function isShadowRoot(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function isNativeShadowDom(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function stringifyStylesheet(e){try{const t=e.rules||e.cssRules;return t?function fixBrowserCompatibilityIssuesInCSS(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}(Array.from(t,stringifyRule).join("")):null}catch(or){return null}}function stringifyRule(e){let t;if(function isCSSImportRule(e){return"styleSheet"in e}(e))try{t=stringifyStylesheet(e.styleSheet)||function escapeImportStatement(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(or){}else if(function isCSSStyleRule(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function fixSafariColons(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}(ht=pt||(pt={}))[ht.Document=0]="Document",ht[ht.DocumentType=1]="DocumentType",ht[ht.Element=2]="Element",ht[ht.Text=3]="Text",ht[ht.CDATA=4]="CDATA",ht[ht.Comment=5]="Comment";class Mirror{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:e,maskInputOptions:t,tagName:n,type:i,value:s,maskInputFn:a}){let c=s||"";const u=i&&toLowerCase(i);return(t[n.toLowerCase()]||u&&t[u])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const ft="__rrweb_original__";function getInputType(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?toLowerCase(t):null}function extractFileExtension(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(a){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==s?void 0:s[1])&&void 0!==n?n:null}let mt=1;const gt=new RegExp("[^a-z0-9-_:]"),_t=-2;function genId(){return mt++}let yt,vt;const bt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,wt=/^(?:[a-z+]+:)?\/\//i,kt=/^www\..*/i,St=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(bt,((e,n,i,s,a,c)=>{const u=i||a||c,d=n||s||"";if(!u)return e;if(wt.test(u)||kt.test(u))return`url(${d}${u}${d})`;if(St.test(u))return`url(${d}${u}${d})`;if("/"===u[0])return`url(${d}${function extractOrigin(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+u}${d})`;const l=t.split("/"),p=u.split("/");l.pop();for(const t of p)"."!==t&&(".."===t?l.pop():l.push(t));return`url(${d}${l.join("/")}${d})`}))}const It=/^[^ \t\n\r\u000c]+/,xt=/^[, \t\n\r\u000c]+/;function absoluteToDoc(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function getHref(){const e=document.createElement("a");return e.href="",e.href}function transformAttribute(e,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?absoluteToDoc(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function getAbsoluteSrcsetString(e,t){if(""===t.trim())return t;let n=0;function collectCharacters(e){let i;const s=e.exec(t.substring(n));return s?(i=s[0],n+=i.length,i):""}const i=[];for(;collectCharacters(xt),!(n>=t.length);){let s=collectCharacters(It);if(","===s.slice(-1))s=absoluteToDoc(e,s.substring(0,s.length-1)),i.push(s);else{let a="";s=absoluteToDoc(e,s);let c=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((s+a).trim());break}if(c)")"===e&&(c=!1);else{if(","===e){n+=1,i.push((s+a).trim());break}"("===e&&(c=!0)}a+=e,n+=1}}}return i.join(", ")}(e,i):"style"===n?absoluteToStylesheet(i,getHref()):"object"===t&&"data"===n?absoluteToDoc(e,i):i:absoluteToDoc(e,i):i}function ignoreAttribute(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function classMatchesRegex(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&classMatchesRegex(e.parentNode,t,n);for(let i=e.classList.length;i--;){const n=e.classList[i];if(t.test(n))return!0}return!!n&&classMatchesRegex(e.parentNode,t,n)}function needMaskingText(e,t,n,i){try{const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===s)return!1;if("string"==typeof t){if(i){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(classMatchesRegex(s,t,i))return!0;if(n)if(i){if(s.closest(n))return!0}else if(s.matches(n))return!0}catch(s){}return!1}function serializeNode(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:c,inlineStylesheet:u,maskInputOptions:d={},maskTextFn:l,maskInputFn:p,dataURLOptions:h={},inlineImages:f,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:_=!1}=t,y=function getRootId(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,i);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:pt.Document,childNodes:[],compatMode:e.compatMode}:{type:pt.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:pt.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function serializeElementNode(e,t){const{doc:n,blockClass:i,blockSelector:s,inlineStylesheet:a,maskInputOptions:c={},maskInputFn:u,dataURLOptions:d={},inlineImages:l,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:m}=t,g=function _isBlockedElement(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(i){}return!1}(e,i,s),_=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const t=toLowerCase(e.tagName);return gt.test(t)?"div":t}(e);let y={};const v=e.attributes.length;for(let S=0;S<v;S++){const t=e.attributes[S];ignoreAttribute(_,t.name,t.value)||(y[t.name]=transformAttribute(n,_,toLowerCase(t.name),t.value))}if("link"===_&&a){const t=Array.from(n.styleSheets).find((t=>t.href===e.href));let i=null;t&&(i=stringifyStylesheet(t)),i&&(delete y.rel,delete y.href,y._cssText=absoluteToStylesheet(i,t.href))}if("style"===_&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=stringifyStylesheet(e.sheet);t&&(y._cssText=absoluteToStylesheet(t,getHref()))}if("input"===_||"textarea"===_||"select"===_){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=maskInputValue({element:e,type:getInputType(e),tagName:_,value:t,maskInputOptions:c,maskInputFn:u}):n&&(y.checked=n)}"option"===_&&(e.selected&&!c.select?y.selected=!0:delete y.selected);if("canvas"===_&&p)if("2d"===e.__context)(function is2DCanvasBlank(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const s=t.getImageData,a=ft in s?s[ft]:s;if(new Uint32Array(a.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){const t=e.toDataURL(d.type,d.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(d.type,d.quality)&&(y.rr_dataURL=t)}if("img"===_&&l){yt||(yt=n.createElement("canvas"),vt=yt.getContext("2d"));const t=e,i=t.crossOrigin;t.crossOrigin="anonymous";const recordInlineImage=()=>{t.removeEventListener("load",recordInlineImage);try{yt.width=t.naturalWidth,yt.height=t.naturalHeight,vt.drawImage(t,0,0),y.rr_dataURL=yt.toDataURL(d.type,d.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}i?y.crossOrigin=i:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?recordInlineImage():t.addEventListener("load",recordInlineImage)}if("audio"===_||"video"===_){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(g){const{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==_||h(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let b;try{customElements.get(_)&&(b=!0)}catch(w){}return{type:pt.Element,tagName:_,attributes:y,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:g,rootId:m,isCustom:b}}(e,{doc:n,blockClass:s,blockSelector:a,inlineStylesheet:u,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:f,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:_,rootId:y});case e.TEXT_NODE:return function serializeTextNode(e,t){var n;const{needsMask:i,maskTextFn:s,rootId:a}=t,c=e.parentNode&&e.parentNode.tagName;let u=e.textContent;const d="STYLE"===c||void 0,l="SCRIPT"===c||void 0;if(d&&u){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(u=stringifyStylesheet(e.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,e)}u=absoluteToStylesheet(u,getHref())}l&&(u="SCRIPT_PLACEHOLDER");!d&&!l&&u&&i&&(u=s?s(u,e.parentElement):u.replace(/[\S]/g,"*"));return{type:pt.Text,textContent:u||"",isStyle:d,rootId:a}}(e,{needsMask:c,maskTextFn:l,rootId:y});case e.CDATA_SECTION_NODE:return{type:pt.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:pt.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:u,skipChild:d=!1,inlineStylesheet:l=!0,maskInputOptions:p={},maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g={},inlineImages:_=!1,recordCanvas:y=!1,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w=5e3,onStylesheetLoad:S,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:O=!1}=t;let{needsMask:C}=t,{preserveWhiteSpace:T=!0}=t;if(!C&&e.childNodes){C=needMaskingText(e,c,u,void 0===C)}const R=serializeNode(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:C,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,dataURLOptions:g,inlineImages:_,recordCanvas:y,keepIframeSrcFn:x,newlyAddedElement:O});if(!R)return console.warn(e,"not serialized"),null;let P;P=i.hasNode(e)?i.getId(e):!function slimDOMExcluded(e,t){if(t.comment&&e.type===pt.Comment)return!0;if(e.type===pt.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===extractFileExtension(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(lowerIfExists(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(e.attributes.name)||"icon"===lowerIfExists(e.attributes.rel)||"apple-touch-icon"===lowerIfExists(e.attributes.rel)||"shortcut icon"===lowerIfExists(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===lowerIfExists(e.attributes.name)||"generator"===lowerIfExists(e.attributes.name)||"framework"===lowerIfExists(e.attributes.name)||"publisher"===lowerIfExists(e.attributes.name)||"progid"===lowerIfExists(e.attributes.name)||lowerIfExists(e.attributes.property).match(/^article:/)||lowerIfExists(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===lowerIfExists(e.attributes.name)||"yandex-verification"===lowerIfExists(e.attributes.name)||"csrf-token"===lowerIfExists(e.attributes.name)||"p:domain_verify"===lowerIfExists(e.attributes.name)||"verify-v1"===lowerIfExists(e.attributes.name)||"verification"===lowerIfExists(e.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(e.attributes.name)))return!0}}return!1}(R,m)&&(T||R.type!==pt.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():_t;const N=Object.assign(R,{id:P});if(i.add(e,N),P===_t)return null;v&&v(e);let D=!d;if(N.type===pt.Element){D=D&&!N.needBlock,delete N.needBlock;const t=e.shadowRoot;t&&isNativeShadowDom(t)&&(N.isShadowHost=!0)}if((N.type===pt.Document||N.type===pt.Element)&&D){m.headWhitespace&&N.type===pt.Element&&"head"===N.tagName&&(T=!1);const t={doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:C,maskTextClass:c,maskTextSelector:u,skipChild:d,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g,inlineImages:_,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x};if(N.type===pt.Element&&"textarea"===N.tagName&&void 0!==N.attributes.value);else for(const n of Array.from(e.childNodes)){const e=serializeNodeWithId(n,t);e&&N.childNodes.push(e)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const i=serializeNodeWithId(n,t);i&&(isNativeShadowDom(e.shadowRoot)&&(i.isShadow=!0),N.childNodes.push(i))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(N.isShadow=!0),N.type===pt.Element&&"iframe"===N.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(or){return}if("complete"!==s){const i=setTimeout((()=>{a||(t(),a=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),a=!0,t()}))}const c="about:blank";if(i.location.href!==c||e.src===c||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&b){const n=serializeNodeWithId(t,{doc:t,mirror:i,blockClass:s,blockSelector:a,needsMask:C,maskTextClass:c,maskTextSelector:u,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g,inlineImages:_,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x});n&&b(e,n)}}),w),N.type===pt.Element&&"link"===N.tagName&&"string"==typeof N.attributes.rel&&("stylesheet"===N.attributes.rel||"preload"===N.attributes.rel&&"string"==typeof N.attributes.href&&"css"===extractFileExtension(N.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(or){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(e,(()=>{if(S){const t=serializeNodeWithId(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:C,maskTextClass:c,maskTextSelector:u,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g,inlineImages:_,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x});t&&S(e,t)}}),I),N}function on(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const Ot="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Et={map:{},getId:()=>(console.error(Ot),-1),getNode:()=>(console.error(Ot),null),removeNodeFromMap(){console.error(Ot)},has:()=>(console.error(Ot),!1),reset(){console.error(Ot)}};function throttle(e,t,n={}){let i=null,s=0;return function(...a){const c=Date.now();s||!1!==n.leading||(s=c);const u=t-(c-s),d=this;u<=0||u>t?(i&&(clearTimeout(i),i=null),s=c,e.apply(d,a)):i||!1===n.trailing||(i=setTimeout((()=>{s=!1===n.leading?0:Date.now(),i=null,e.apply(d,a)}),u))}}function hookSetter(e,t,n,i,s=window){const a=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,t,a||{},!0)}function patch(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],s=n(i);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=s,()=>{e[t]=i}}catch(i){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Et=new Proxy(Et,{get:(e,t,n)=>("map"===t&&console.error(Ot),Reflect.get(e,t,n))}));let Ct=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const u=e.document;return{left:u.scrollingElement?u.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==u?void 0:u.documentElement.scrollLeft)||(null===(n=null===(t=null==u?void 0:u.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==u?void 0:u.body)||void 0===i?void 0:i.scrollLeft)||0,top:u.scrollingElement?u.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==u?void 0:u.documentElement.scrollTop)||(null===(a=null===(s=null==u?void 0:u.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==u?void 0:u.body)||void 0===c?void 0:c.scrollTop)||0}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function isBlocked(e,t,n,i){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(classMatchesRegex(s,t,i))return!0}catch(a){}if(n){if(s.matches(n))return!0;if(i&&null!==s.closest(n))return!0}return!1}function isIgnored(e,t){return t.getId(e)===_t}function isAncestorRemoved(e,t){if(isShadowRoot(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||isAncestorRemoved(e.parentNode,t))}function legacy_isTouchEvent(e){return Boolean(e.changedTouches)}function isSerializedIframe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function isSerializedStylesheet(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function hasShadowRoot(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Ct=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function getShadowHost(e){var t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function shadowHostInDom(e){const t=e.ownerDocument;if(!t)return!1;const n=function getRootShadowHost(e){let t,n=e;for(;t=getShadowHost(n);)n=t;return n}(e);return t.contains(n)}function inDom(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||shadowHostInDom(e))}var Tt=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Tt||{}),Rt=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Rt||{}),Pt=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Pt||{}),Mt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Mt||{}),Nt=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Nt||{});function isNodeInLinkedList(e){return"__ln"in e}class DoubleLinkedList{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&isNodeInLinkedList(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&isNodeInLinkedList(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const moveKey=(e,t)=>`${e}@${t}`;class MutationBuffer{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new DoubleLinkedList,getNextId=e=>{let t=e,n=_t;for(;n===_t;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},pushAdd=i=>{if(!i.parentNode||!inDom(i)||"TEXTAREA"===i.parentNode.tagName)return;const s=isShadowRoot(i.parentNode)?this.mirror.getId(getShadowHost(i)):this.mirror.getId(i.parentNode),a=getNextId(i);if(-1===s||-1===a)return n.addNode(i);const c=serializeNodeWithId(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{isSerializedIframe(e,this.mirror)&&this.iframeManager.addIframe(e),isSerializedStylesheet(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),hasShadowRoot(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)isParentRemoved(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||pushAdd(a);for(const a of this.addedSet)isAncestorInSet(this.droppedSet,a)||isParentRemoved(this.removes,a,this.mirror)?isAncestorInSet(this.movedSet,a)?pushAdd(a):this.droppedSet.add(a):pushAdd(a);let i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=getNextId(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===getNextId(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),pushAdd(e.value)}const s={texts:this.texts.map((e=>{const t=e.node;return t.parentNode&&"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!isIgnored(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;isBlocked(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:needMaskingText(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,closestElementOfNode(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let i=e.attributeName,s=e.target.getAttribute(i);if("value"===i){const e=getInputType(n);s=maskInputValue({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:s,maskInputFn:this.maskInputFn})}if(isBlocked(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let a=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===i&&!this.keepIframeSrcFn(s)){if(n.contentDocument)return;i="rr_src"}if(a||(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(e.target,a)),"type"===i&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!ignoreAttribute(n.tagName,i)&&(a.attributes[i]=transformAttribute(this.doc,toLowerCase(n.tagName),toLowerCase(i),s),"style"===i)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),s=n.style.getPropertyPriority(e);t!==i.style.getPropertyValue(e)||s!==i.style.getPropertyPriority(e)?a.styleDiff[e]=""===s?t:[t,s]:a._unchangedStyles[e]=[t,s]}for(const e of Array.from(i.style))""===n.style.getPropertyValue(e)&&(a.styleDiff[e]=!1)}break}case"childList":if(isBlocked(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),i=isShadowRoot(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);isBlocked(e.target,this.blockClass,this.blockSelector,!1)||isIgnored(t,this.mirror)||!function isSerialized(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(deepDelete(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||isAncestorRemoved(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[moveKey(n,i)]?deepDelete(this.movedSet,t):this.removes.push({parentId:i,id:n,isShadow:!(!isShadowRoot(e.target)||!isNativeShadowDom(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(isIgnored(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[moveKey(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);isBlocked(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),hasShadowRoot(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function deepDelete(e,t){e.delete(t),t.childNodes.forEach((t=>deepDelete(e,t)))}function isParentRemoved(e,t,n){return 0!==e.length&&_isParentRemoved(e,t,n)}function _isParentRemoved(e,t,n){const{parentNode:i}=t;if(!i)return!1;const s=n.getId(i);return!!e.some((e=>e.id===s))||_isParentRemoved(e,i,n)}function isAncestorInSet(e,t){return 0!==e.size&&_isAncestorInSet(e,t)}function _isAncestorInSet(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||_isAncestorInSet(e,n))}let Dt;const callbackWrapper=e=>{if(!Dt)return e;return(...t)=>{try{return e(...t)}catch(or){if(Dt&&!0===Dt(or))return;throw or}}},At=[];function getEventTarget(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function initMutationObserver(e,t){var n,i;const s=new MutationBuffer;At.push(s),s.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const c=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");c&&window[c]&&(a=window[c]);const u=new a(callbackWrapper(s.processMutations.bind(s)));return u.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),u}function initMouseInteractionObserver({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const c=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,u=[];let d=null;return Object.keys(Pt).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const l=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let u=null,l=t;if("pointerType"in a){switch(a.pointerType){case"mouse":u=Mt.Mouse;break;case"touch":u=Mt.Touch;break;case"pen":u=Mt.Pen}u===Mt.Touch?Pt[t]===Pt.MouseDown?l="TouchStart":Pt[t]===Pt.MouseUp&&(l="TouchEnd"):Mt.Pen}else legacy_isTouchEvent(a)&&(u=Mt.Touch);null!==u?(d=u,(l.startsWith("Touch")&&u===Mt.Touch||l.startsWith("Mouse")&&u===Mt.Mouse)&&(u=null)):Pt[t]===Pt.Click&&(u=d,d=null);const p=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!p)return;const h=n.getId(c),{clientX:f,clientY:m}=p;callbackWrapper(e)(Object.assign({type:Pt[l],id:h,x:f,y:m},null!==u&&{pointerType:u}))})(a);if(window.PointerEvent)switch(Pt[a]){case Pt.MouseDown:case Pt.MouseUp:c=c.replace("mouse","pointer");break;case Pt.TouchStart:case Pt.TouchEnd:return}u.push(on(c,l,t))})),callbackWrapper((()=>{u.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const c=getEventTarget(a);if(!c||isBlocked(c,i,s,!0))return;const u=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:u,x:n.left,y:n.top})}else e({id:u,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const Zt=["INPUT","TEXTAREA","SELECT"],jt=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,t){if(hasNestedCSSRule("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function getIdAndStyleId(e,t,n){let i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:i}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:t},n){var i,s,a;let c=null;c="#document"===n.nodeName?e.getId(n):e.getId(n.host);const u="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(a=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,d=(null==u?void 0:u.prototype)?Object.getOwnPropertyDescriptor(null==u?void 0:u.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&u&&d?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get(){var e;return null===(e=d.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=d.set)||void 0===n?void 0:n.call(this,e);if(null!==c&&-1!==c)try{t.adoptStyleSheets(e,c)}catch(s){}return i}}),callbackWrapper((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:d.get,set:d.set})}))):()=>{}}function initObservers(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function mergeHooks(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:c,inputCb:u,mediaInteractionCb:d,styleSheetRuleCb:l,styleDeclarationCb:p,canvasMutationCb:h,fontCb:f,selectionCb:m,customElementCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),c(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),u(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),d(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),p(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),h(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),m(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),g(...e)}}(e,t),e.recordDOM&&(i=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let c,u=[];const d=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(u.map((e=>(e.timeOffset-=n,e))),t),u=[],c=null})),a),l=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=Ct()),u.push({x:n,y:s,id:i.getId(t),timeOffset:Ct()-c}),d("undefined"!=typeof DragEvent&&e instanceof DragEvent?Rt.Drag:e instanceof MouseEvent?Rt.MouseMove:Rt.TouchMove)})),s,{trailing:!1})),p=[on("mousemove",l,n),on("touchmove",l,n),on("drag",l,n)];return callbackWrapper((()=>{p.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),u=function initViewportResizeObserver({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const t=getWindowHeight(),s=getWindowWidth();n===t&&i===s||(e({width:Number(s),height:Number(t)}),n=t,i=s)})),200)),t)}(e,{win:n}),d=function initInputObserver({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,ignoreClass:a,ignoreSelector:c,maskInputOptions:u,maskInputFn:d,sampling:l,userTriggeredOnInput:p}){function eventHandler(e){let n=getEventTarget(e);const l=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||Zt.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,m=!1;const g=getInputType(n)||"";"radio"===g||"checkbox"===g?m=n.checked:(u[h.toLowerCase()]||u[g])&&(f=maskInputValue({element:n,maskInputOptions:u,tagName:h,type:g,value:f,maskInputFn:d})),cbWithDedup(n,p?{text:f,isChecked:m,userTriggered:l}:{text:f,isChecked:m});const _=n.name;"radio"===g&&_&&m&&t.querySelectorAll(`input[type="radio"][name="${_}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,p?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}}))}function cbWithDedup(t,i){const s=jt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){jt.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===l.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),g=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...g.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),l=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:s,doc:a}){const c=callbackWrapper((a=>throttle(callbackWrapper((s=>{const c=getEventTarget(s);if(!c||isBlocked(c,t,n,!0))return;const{currentTime:u,volume:d,muted:l,playbackRate:p,loop:h}=c;e({type:a,id:i.getId(c),currentTime:u,volume:d,muted:l,playbackRate:p,loop:h})})),s.media||500))),u=[on("play",c(0),a),on("pause",c(1),a),on("seeked",c(2),a),on("volumechange",c(3),a),on("ratechange",c(4),a)];return callbackWrapper((()=>{u.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((i,s,a)=>{const[c,u]=a,{id:d,styleId:l}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||l&&-1!==l)&&e({id:d,styleId:l,adds:[{rule:c,index:u}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,u;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,removes:[{index:c}]}),i.apply(s,a)}))}),i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(u=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,replaceSync:c}),i.apply(s,a)}))}));const d={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?d.CSSGroupingRule=i.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(d.CSSMediaRule=i.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(d.CSSConditionRule=i.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(d.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(d).forEach((([i,s])=>{l[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(l[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,u]=a,{id:d,styleId:l}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(d&&-1!==d||l&&-1!==l)&&e({id:d,styleId:l,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),u||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,removes:[{index:[...getNestedCSSRulePositions(s),c]}]}),i.apply(s,a)}))})})),callbackWrapper((()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=a,c&&(i.CSSStyleSheet.prototype.replace=c),u&&(i.CSSStyleSheet.prototype.replaceSync=u),Object.entries(d).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,c,u)=>{var d;const[l,p,h]=u;if(n.has(l))return a.apply(c,[l,p,h]);const{id:f,styleId:m}=getIdAndStyleId(null===(d=c.parentRule)||void 0===d?void 0:d.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||m&&-1!==m)&&e({id:f,styleId:m,set:{property:l,value:p,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,u)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,u)=>{var d;const[l]=u;if(n.has(l))return c.apply(a,[l]);const{id:p,styleId:h}=getIdAndStyleId(null===(d=a.parentRule)||void 0===d?void 0:d.parentStyleSheet,t,i.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,remove:{property:l},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,u)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function FontFace(e,t,n){const i=new a(e,t,n);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const c=patch(t.fonts,"add",(function(t){return function(n){return setTimeout(callbackWrapper((()=>{const t=s.get(n);t&&(e(t),s.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=a})),i.push(c),callbackWrapper((()=>{i.forEach((e=>e()))}))}(e)));const p=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const u=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const u=[],d=e.rangeCount||0;for(let t=0;t<d;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:d,endContainer:l,endOffset:p}=a;isBlocked(c,i,s,!0)||isBlocked(l,i,s,!0)||u.push({start:n.getId(c),startOffset:d,end:n.getId(l),endOffset:p})}a({ranges:u})}));return u(),on("selectionchange",u)}(e),h=function initCustomElementObserver({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?patch(n.customElements,"define",(function(e){return function(n,i,s){try{t({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,s])}})):()=>{}}(e),f=[];for(const m of e.plugins)f.push(m.observer(m.callback,n,m.options));return callbackWrapper((()=>{At.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),u(),d(),l(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),p(),h(),f.forEach((e=>e()))}))}function hasNestedCSSRule(e){return void 0!==window[e]}function canMonkeyPatchNestedCSSRule(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class CrossOriginIframeMirror{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const s=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let c=s.get(t);return c||(c=this.generateIdFn(),s.set(t,c),a.set(c,t)),c}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class IframeManager{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case Tt.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:Tt.IncrementalSnapshot,data:{source:Rt.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Tt.Meta:case Tt.Load:case Tt.DomContentLoaded:return!1;case Tt.Plugin:return t;case Tt.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Tt.IncrementalSnapshot:switch(t.data.source){case Rt.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Rt.Drag:case Rt.TouchMove:case Rt.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Rt.ViewportResize:return!1;case Rt.MediaInteraction:case Rt.MouseInteraction:case Rt.Scroll:case Rt.CanvasMutation:case Rt.Input:return this.replaceIds(t.data,e,["id"]),t;case Rt.StyleSheetRule:case Rt.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Rt.Font:return t;case Rt.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Rt.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(n,t[s]):t[s]=e.getId(n,t[s]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===pt.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class ShadowDomManager{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!isNativeShadowDom(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(initAdoptedStyleSheetObserver({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(patch(e.prototype,"attachShadow",(function(e){return function(i){const s=e.call(this,i);return this.shadowRoot&&inDom(this)&&n.addShadowRoot(this.shadowRoot,t),s}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
|
|
1
|
+
"use strict";var e,t,n;(t=e||(e={})).assertEqual=e=>e,t.assertIs=function assertIs(e){},t.assertNever=function assertNever(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),i={};for(const t of n)i[t]=e[t];return t.objectValues(i)},t.objectValues=e=>t.objectKeys(e).map((function(t){return e[t]})),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,t.joinValues=function joinValues(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});const i=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.unknown}},s=e.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 ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},processError=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(processError);else if("invalid_return_type"===i.code)processError(i.returnTypeError);else if("invalid_arguments"===i.code)processError(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,s=0;for(;s<i.path.length;){const n=i.path[s];s===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return processError(this),n}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(t,n)=>{let a;switch(t.code){case s.invalid_type:a=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case s.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case s.invalid_union:a="Invalid input";break;case s.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case s.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case s.invalid_arguments:a="Invalid function arguments";break;case s.invalid_return_type:a="Invalid function return type";break;case s.invalid_date:a="Invalid date";break;case s.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case s.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case s.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case s.custom:a="Invalid input";break;case s.invalid_intersection_types:a="Intersection results could not be merged";break;case s.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case s.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}};let a=errorMap;function getErrorMap(){return a}const makeIssue=e=>{const{data:t,path:n,errorMaps:i,issueData:s}=e,a=[...n,...s.path||[]],c={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let u="";const d=i.filter((e=>!!e)).slice().reverse();for(const l of d)u=l(c,{data:t,defaultError:u}).message;return{...s,path:a,message:u}};function addIssueToContext(e,t){const n=getErrorMap(),i=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(i)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if("aborted"===i.status)return c;"dirty"===i.status&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const e=await i.key,t=await i.value;n.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:t,value:s}=i;if("aborted"===t.status)return c;if("aborted"===s.status)return c;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!i.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const c=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,t,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,n,i,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var u,d,l,p;"function"==typeof SuppressedError&&SuppressedError,(d=u||(u={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},d.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,t)=>{if(isValid(t))return{success:!0,data:t.value};if(!e.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 ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:i,description:s}=e;if(t&&(n||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{var a,c;const{message:u}=e;return"invalid_enum_value"===t.code?{message:null!=u?u:s.defaultError}:void 0===s.data?{message:null!==(a=null!=u?u:i)&&void 0!==a?a:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(c=null!=u?u:n)&&void 0!==c?c:s.defaultError}},description:s}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,s)}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:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(isAsync(i)?i:Promise.resolve(i));return handleResult(n,s)}refine(e,t){const getIssueProperties=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),setError=()=>n.addIssue({code:s.custom,...getIssueProperties(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(setError(),!1))):!!i||(setError(),!1)}))}refinement(e,t){return this._refinement(((n,i)=>!!e(n)||(i.addIssue("function"==typeof t?t(n,i):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new ZodBranded({typeName:R.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const h=/^c[^\s-]{8,}$/i,f=/^[0-9a-z]+$/,m=/^[0-9A-HJKMNP-TV-Z]{26}$/,g=/^[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,_=/^[a-z0-9_-]{21}$/i,y=/^[-+]?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)?)??$/,v=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let b;const w=/^(?:(?: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])$/,S=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x="((\\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])))",O=new RegExp(`^${x}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function datetimeRegex(e){let t=`${x}T${timeRegexSource(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}class ZodString extends ZodType{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.string,received:e.parsedType}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)if("min"===i.kind)t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("max"===i.kind)t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("length"===i.kind){const e=t.data.length>i.value,c=t.data.length<i.value;(e||c)&&(a=this._getOrReturnCtx(t,a),e?addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if("email"===i.kind)v.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"email",code:s.invalid_string,message:i.message}),n.dirty());else if("emoji"===i.kind)b||(b=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),b.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"emoji",code:s.invalid_string,message:i.message}),n.dirty());else if("uuid"===i.kind)g.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"uuid",code:s.invalid_string,message:i.message}),n.dirty());else if("nanoid"===i.kind)_.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"nanoid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid"===i.kind)h.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid2"===i.kind)f.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid2",code:s.invalid_string,message:i.message}),n.dirty());else if("ulid"===i.kind)m.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ulid",code:s.invalid_string,message:i.message}),n.dirty());else if("url"===i.kind)try{new URL(t.data)}catch(l){a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"url",code:s.invalid_string,message:i.message}),n.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"regex",code:s.invalid_string,message:i.message}),n.dirty())}else if("trim"===i.kind)t.data=t.data.trim();else if("includes"===i.kind)t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty());else if("toLowerCase"===i.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===i.kind)t.data=t.data.toUpperCase();else if("startsWith"===i.kind)t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty());else if("endsWith"===i.kind)t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty());else if("datetime"===i.kind){datetimeRegex(i).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"datetime",message:i.message}),n.dirty())}else if("date"===i.kind){O.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"date",message:i.message}),n.dirty())}else if("time"===i.kind){new RegExp(`^${timeRegexSource(i)}$`).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"time",message:i.message}),n.dirty())}else"duration"===i.kind?y.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"duration",code:s.invalid_string,message:i.message}),n.dirty()):"ip"===i.kind?(u=t.data,("v4"!==(d=i.version)&&d||!w.test(u))&&("v6"!==d&&d||!S.test(u))&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ip",code:s.invalid_string,message:i.message}),n.dirty())):"base64"===i.kind?I.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"base64",code:s.invalid_string,message:i.message}),n.dirty()):e.assertNever(i);var u,d;return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:s.invalid_string,...u.errToObj(n)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...u.errToObj(e)})}url(e){return this._addCheck({kind:"url",...u.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...u.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...u.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...u.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...u.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...u.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...u.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...u.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...u.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...u.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...u.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...u.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...u.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...u.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...u.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...u.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...u.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...u.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...u.errToObj(t)})}nonempty(e){return this.min(1,u.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,s=n>i?n:i;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:R.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==i.number){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.number,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("int"===i.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty());else if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else"multipleOf"===i.kind?0!==floatSafeRemainder(t.data,i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_finite,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,n,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:u.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:u.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:u.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:u.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:u.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:R.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==i.bigint){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.bigint,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,n,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:u.toString(i)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:R.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.boolean,received:t.parsedType}),c}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:R.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.date,received:e.parsedType}),c}if(isNaN(t.data.getTime())){return addIssueToContext(this._getOrReturnCtx(t),{code:s.invalid_date}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)"min"===i.kind?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):"max"===i.kind?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:u.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:u.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:R.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.symbol,received:t.parsedType}),c}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:R.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.undefined,received:t.parsedType}),c}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:R.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.null,received:t.parsedType}),c}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:R.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:R.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:R.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.never,received:t.parsedType}),c}}ZodNever.create=e=>new ZodNever({typeName:R.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.void,received:t.parsedType}),c}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:R.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==i.array)return addIssueToContext(t,{code:s.invalid_type,expected:i.array,received:t.parsedType}),c;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?s.too_big:s.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(addIssueToContext(t,{code:s.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(addIssueToContext(t,{code:s.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n))))).then((e=>ParseStatus.mergeArray(n,e)));const u=[...t.data].map(((e,n)=>a.type._parseSync(new ParseInputLazyPath(t,e,t.path,n))));return ParseStatus.mergeArray(n,u)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:u.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:u.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:u.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...processCreateParams(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:u}=this._getCached(),d=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const i in n.data)u.includes(i)||d.push(i);const l=[];for(const i of u){const e=a[i],t=n.data[i];l.push({key:{status:"valid",value:i},value:e._parse(new ParseInputLazyPath(n,t,n.path,i)),alwaysSet:i in n.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of d)l.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)d.length>0&&(addIssueToContext(n,{code:s.unrecognized_keys,keys:d}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of d){const i=n.data[t];l.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(n,i,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of l){const n=await t.key,i=await t.value;e.push({key:n,value:i,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return u.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var i,s,a,c;const d=null!==(a=null===(s=(i=this._def).errorMap)||void 0===s?void 0:s.call(i,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(c=u.errToObj(e).message)&&void 0!==c?c:d}:{message:d}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(t){const n={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}omit(t){const n={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}deepPartial(){return deepPartialify(this)}partial(t){const n={};return e.objectKeys(this.shape).forEach((e=>{const i=this.shape[e];t&&!t[e]?n[e]=i:n[e]=i.optional()})),new ZodObject({...this._def,shape:()=>n})}required(t){const n={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ZodOptional;)t=t._def.innerType;n[e]=t}})),new ZodObject({...this._def,shape:()=>n})}keyof(){return createZodEnum(e.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function handleResults(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const n=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:n}),c}));{let e;const i=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&i.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=i.map((e=>new ZodError(e)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:a}),c}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:R.ZodUnion,...processCreateParams(t)});const getDiscriminator=t=>t instanceof ZodLazy?getDiscriminator(t.schema):t instanceof ZodEffects?getDiscriminator(t.innerType()):t instanceof ZodLiteral?[t.value]:t instanceof ZodEnum?t.options:t instanceof ZodNativeEnum?e.objectValues(t.enum):t instanceof ZodDefault?getDiscriminator(t._def.innerType):t instanceof ZodUndefined?[void 0]:t instanceof ZodNull?[null]:t instanceof ZodOptional?[void 0,...getDiscriminator(t.unwrap())]:t instanceof ZodNullable?[null,...getDiscriminator(t.unwrap())]:t instanceof ZodBranded||t instanceof ZodReadonly?getDiscriminator(t.unwrap()):t instanceof ZodCatch?getDiscriminator(t._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c;const n=this.discriminator,a=t.data[n],u=this.optionsMap.get(a);return u?t.common.async?u._parseAsync({data:t.data,path:t.path,parent:t}):u._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),c)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const t=getDiscriminator(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(i.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,s)}}return new ZodDiscriminatedUnion({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(n)})}}function mergeValues(t,n){const s=getParsedType(t),a=getParsedType(n);if(t===n)return{valid:!0,data:t};if(s===i.object&&a===i.object){const i=e.objectKeys(n),s=e.objectKeys(t).filter((e=>-1!==i.indexOf(e))),a={...t,...n};for(const e of s){const i=mergeValues(t[e],n[e]);if(!i.valid)return{valid:!1};a[e]=i.data}return{valid:!0,data:a}}if(s===i.array&&a===i.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let i=0;i<t.length;i++){const s=mergeValues(t[i],n[i]);if(!s.valid)return{valid:!1};e.push(s.data)}return{valid:!0,data:e}}return s===i.date&&a===i.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),handleParsed=(e,i)=>{if(isAborted(e)||isAborted(i))return c;const a=mergeValues(e.value,i.value);return a.valid?((isDirty(e)||isDirty(i))&&t.dirty(),{status:t.value,value:a.data}):(addIssueToContext(n,{code:s.invalid_intersection_types}),c)};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((([e,t])=>handleParsed(e,t))):handleParsed(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:R.ZodIntersection,...processCreateParams(n)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return addIssueToContext(n,{code:s.invalid_type,expected:i.array,received:n.parsedType}),c;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new ParseInputLazyPath(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:R.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{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!==i.object)return addIssueToContext(n,{code:s.invalid_type,expected:i.object,received:n.parsedType}),c;const a=[],u=this._def.keyType,d=this._def.valueType;for(const i in n.data)a.push({key:u._parse(new ParseInputLazyPath(n,i,n.path,i)),value:d._parse(new ParseInputLazyPath(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?ParseStatus.mergeObjectAsync(t,a):ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:R.ZodRecord,...processCreateParams(n)}:{keyType:ZodString.create(),valueType:e,typeName:R.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{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!==i.map)return addIssueToContext(n,{code:s.invalid_type,expected:i.map,received:n.parsedType}),c;const a=this._def.keyType,u=this._def.valueType,d=[...n.data.entries()].map((([e,t],i)=>({key:a._parse(new ParseInputLazyPath(n,e,n.path,[i,"key"])),value:u._parse(new ParseInputLazyPath(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of d){const i=await n.key,s=await n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of d){const i=n.key,s=n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:R.ZodMap,...processCreateParams(n)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return addIssueToContext(n,{code:s.invalid_type,expected:i.set,received:n.parsedType}),c;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(addIssueToContext(n,{code:s.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(addIssueToContext(n,{code:s.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const u=this._def.valueType;function finalizeSet(e){const n=new Set;for(const i of e){if("aborted"===i.status)return c;"dirty"===i.status&&t.dirty(),n.add(i.value)}return{status:t.value,value:n}}const d=[...n.data.values()].map(((e,t)=>u._parse(new ParseInputLazyPath(n,e,n.path,t))));return n.common.async?Promise.all(d).then((e=>finalizeSet(e))):finalizeSet(d)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:u.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:u.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return addIssueToContext(t,{code:s.invalid_type,expected:i.function,received:t.parsedType}),c;function makeArgsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_arguments,argumentsError:n}})}function makeReturnsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_return_type,returnTypeError:n}})}const n={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const i=new ZodError([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw i.addIssue(makeArgsIssue(t,e)),i})),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw i.addIssue(makeReturnsIssue(c,e)),i}))}))}{const e=this;return OK((function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new ZodError([makeArgsIssue(t,i.error)]);const s=Reflect.apply(a,this,i.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new ZodError([makeReturnsIssue(s,c.error)]);return c.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:R.ZodFunction,...processCreateParams(n)})}}class ZodLazy extends ZodType{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})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:R.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),c}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:R.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:R.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),l.set(this,void 0)}_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),i=this._def.values;return addIssueToContext(n,{expected:e.joinValues(i),received:n.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,l)||__classPrivateFieldSet(this,l,new Set(this._def.values)),!__classPrivateFieldGet(this,l).has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return addIssueToContext(e,{received:e.data,code:s.invalid_enum_value,options:n}),c}return OK(t.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 ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}l=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),p.set(this,void 0)}_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==i.string&&a.parsedType!==i.number){const t=e.objectValues(n);return addIssueToContext(a,{expected:e.joinValues(t),received:a.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,p)||__classPrivateFieldSet(this,p,new Set(e.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,p).has(t.data)){const t=e.objectValues(n);return addIssueToContext(a,{received:a.data,code:s.invalid_enum_value,options:t}),c}return OK(t.data)}get enum(){return this._def.values}}p=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:R.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return addIssueToContext(t,{code:s.invalid_type,expected:i.promise,received:t.parsedType}),c;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return OK(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:R.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:i}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:e=>{addIssueToContext(i,e),e.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===s.type){const e=s.transform(i.data,a);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===n.value)return c;const t=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}));{if("aborted"===n.value)return c;const t=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}}if("refinement"===s.type){const executeRefinement=e=>{const t=s.refinement(e,a);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value),{status:n.value,value:e.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value).then((()=>({status:n.value,value:e.value}))))))}if("transform"===s.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!isValid(e))return e;const t=s.transform(e.value,a);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>isValid(e)?Promise.resolve(s.transform(e.value,a)).then((e=>({status:n.value,value:e}))):e))}e.assertNever(s)}}ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:R.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...processCreateParams(n)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===i.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:R.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===i.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:R.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:R.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(i)?i.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:R.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.nan,received:t.parsedType}),c}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:R.ZodNaN,...processCreateParams(e)});const T=Symbol("zod_brand");class ZodBranded extends ZodType{_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 ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:R.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>freeze(e))):freeze(t)}unwrap(){return this._def.innerType}}function custom(e,t={},n){return e?ZodAny.create().superRefine(((i,s)=>{var a,c;if(!e(i)){const e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,u=null===(c=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===c||c,d="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...d,fatal:u})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:R.ZodReadonly,...processCreateParams(t)});const C={object:ZodObject.lazycreate};var R,P;(P=R||(R={})).ZodString="ZodString",P.ZodNumber="ZodNumber",P.ZodNaN="ZodNaN",P.ZodBigInt="ZodBigInt",P.ZodBoolean="ZodBoolean",P.ZodDate="ZodDate",P.ZodSymbol="ZodSymbol",P.ZodUndefined="ZodUndefined",P.ZodNull="ZodNull",P.ZodAny="ZodAny",P.ZodUnknown="ZodUnknown",P.ZodNever="ZodNever",P.ZodVoid="ZodVoid",P.ZodArray="ZodArray",P.ZodObject="ZodObject",P.ZodUnion="ZodUnion",P.ZodDiscriminatedUnion="ZodDiscriminatedUnion",P.ZodIntersection="ZodIntersection",P.ZodTuple="ZodTuple",P.ZodRecord="ZodRecord",P.ZodMap="ZodMap",P.ZodSet="ZodSet",P.ZodFunction="ZodFunction",P.ZodLazy="ZodLazy",P.ZodLiteral="ZodLiteral",P.ZodEnum="ZodEnum",P.ZodEffects="ZodEffects",P.ZodNativeEnum="ZodNativeEnum",P.ZodOptional="ZodOptional",P.ZodNullable="ZodNullable",P.ZodDefault="ZodDefault",P.ZodCatch="ZodCatch",P.ZodPromise="ZodPromise",P.ZodBranded="ZodBranded",P.ZodPipeline="ZodPipeline",P.ZodReadonly="ZodReadonly";const N=ZodString.create,D=ZodNumber.create,A=ZodNaN.create,Z=ZodBigInt.create,j=ZodBoolean.create,L=ZodDate.create,q=ZodSymbol.create,U=ZodUndefined.create,B=ZodNull.create,$=ZodAny.create,z=ZodUnknown.create,W=ZodNever.create,H=ZodVoid.create,K=ZodArray.create,G=ZodObject.create,J=ZodObject.strictCreate,Y=ZodUnion.create,X=ZodDiscriminatedUnion.create,Q=ZodIntersection.create,ee=ZodTuple.create,te=ZodRecord.create,re=ZodMap.create,ne=ZodSet.create,oe=ZodFunction.create,ie=ZodLazy.create,se=ZodLiteral.create,ae=ZodEnum.create,ce=ZodNativeEnum.create,ue=ZodPromise.create,de=ZodEffects.create,le=ZodOptional.create,pe=ZodNullable.create,he=ZodEffects.createWithPreprocess,fe=ZodPipeline.create,me={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},ge=c;var _e=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){a=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:c,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return e},get objectUtil(){return n},ZodParsedType:i,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:T,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:C,get ZodFirstPartyTypeKind(){return R},coerce:me,any:$,array:K,bigint:Z,boolean:j,date:L,discriminatedUnion:X,effect:de,enum:ae,function:oe,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),intersection:Q,lazy:ie,literal:se,map:re,nan:A,nativeEnum:ce,never:W,null:B,nullable:pe,number:D,object:G,oboolean:()=>j().optional(),onumber:()=>D().optional(),optional:le,ostring:()=>N().optional(),pipeline:fe,preprocess:he,promise:ue,record:te,set:ne,strictObject:J,string:N,symbol:q,transformer:de,tuple:ee,undefined:U,union:Y,unknown:z,void:H,NEVER:ge,ZodIssueCode:s,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const ye=_e.union([_e.string(),_e.boolean(),_e.number(),_e.undefined()]),ve=_e.record(_e.string(),_e.union([ye,_e.array(ye)])),be=_e.string().min(1,"Event name is required");var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)};function __awaiter$1(e,t,n,i){return new(n||(n=Promise))((function(s,a){function fulfilled(e){try{step(i.next(e))}catch(t){a(t)}}function rejected(e){try{step(i.throw(e))}catch(t){a(t)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var ke={default:"endpoint"},we={default:"tlsEndpoint"},Se="Client timeout",Ie="Network connection error",xe="Network request aborted",Oe="Response cannot be parsed",Ee="Blocked by CSP",Te="The endpoint parameter is not a valid URL";function E(e){for(var t="",n=0;n<e.length;++n)if(n>0){var i=e[n].toLowerCase();i!==e[n]?t+=" ".concat(i):t+=e[n]}else t+=e[n].toUpperCase();return t}var Ce=E("WrongRegion"),Re=E("SubscriptionNotActive"),Pe=E("UnsupportedVersion"),Me=E("InstallationMethodRestricted"),Ne=E("HostnameRestricted"),De=E("IntegrationFailed"),Ae="API key required",Ze="API key not found",je="API key expired",Le="Request cannot be parsed",qe="Request failed",Ue="Request failed to process",Fe="Too many requests, rate limit exceeded",Be="Not available for this origin",$e="Not available with restricted header",ze=Ae,We=Ze,Ve=je,He="Failed to load the JS script of the agent",Ke="9319";function M(e,t){var n,i,s,a,c,u=[],d=(c=function __spreadArray(e,t,n){if(n||2===arguments.length)for(var i,s=0,a=t.length;s<a;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}([],e,!0),n={current:function(){return c[0]},postpone:function(){var e=c.shift();void 0!==e&&c.push(e)},exclude:function(){c.shift()}},a=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[n.current(),function(e,t){var a,c=t instanceof Error?t.message:"";if(c===Ee||c===Te)n.exclude(),a=0;else if(c===Ke)n.exclude();else if(c===He){var u=Date.now()-e.getTime()<50,d=n.current();d&&u&&!s.has(d)&&(s.add(d),a=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=a?a:e.getTime()+i()-Date.now()]}]),l=d[0],p=d[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var n=new Date,r3=function(t){return u.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r3()}),r3),i.catch((function(e){if(u.length>=5)throw e;var t=p(n,e);if(!t)throw e;var i,s=t[0],a=t[1];return(i=a,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return p2(s)}))}))};return p2(l).then((function(e){return[e,u]}))}var Ge="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Je=Ge;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,u,d,l=e.token,p=e.apiKey,h=void 0===p?l:p,f=function __rest$1(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["scriptUrlPattern","token","apiKey"]),m=null!==(t=function r(e,t){return n=e,i=t,Object.prototype.hasOwnProperty.call(n,i)?e[t]:void 0;var n,i}(e,"scriptUrlPattern"))&&void 0!==t?t:Ge,g=(c=[],u=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=u,n.addEventListener(i,s,a),d=function(){return n.removeEventListener(i,s,a)},u(),[c,d]),_=g[0],y=g[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(Ae);var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.1"):e}))}(String(e),t)}))}(m,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===Ke?new Error(He):e}(e)})).then((function(e){var t=e[0],n=e[1];return y(),t.load(__assign(__assign({},f),{ldi:{attempts:n,visibilityStates:_}}))}))}function V(e){return function o(e,t,n,i){var s,a=document,c="securitypolicyviolation",u2=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(s=t,R2())};a.addEventListener(c,u2);var R2=function(){return a.removeEventListener(c,u2)};return Promise.resolve().then(t).then((function(e){return R2(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(R2(),s)return n(s);throw e}))}))}(e,(function(){return t=e,new Promise((function(e,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(t){if(t instanceof Error&&"TypeError"===t.name)return!0;throw t}}(t))throw new Error(Te);var i=document.createElement("script"),o2=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},s=document.head||document.getElementsByTagName("head")[0];i.onload=function(){o2(),e()},i.onerror=function(){o2(),n(new Error(He))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error(Ee)})).then(k)}function k(){var e,t,n,i,s=window,a="__fpjs_p_l_b",c=s[a];if(e=s,t=a,(null==(i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t))?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0),"function"!=typeof(null==c?void 0:c.load))throw new Error(Ke);return c}var Ye={load:F,defaultScriptUrlPattern:Je,ERROR_SCRIPT_LOAD_FAIL:He,ERROR_API_KEY_EXPIRED:je,ERROR_API_KEY_INVALID:Ze,ERROR_API_KEY_MISSING:Ae,ERROR_BAD_REQUEST_FORMAT:Le,ERROR_BAD_RESPONSE_FORMAT:Oe,ERROR_CLIENT_TIMEOUT:Se,ERROR_CSP_BLOCK:Ee,ERROR_FORBIDDEN_ENDPOINT:Ne,ERROR_FORBIDDEN_HEADER:$e,ERROR_FORBIDDEN_ORIGIN:Be,ERROR_GENERAL_SERVER_FAILURE:qe,ERROR_INSTALLATION_METHOD_RESTRICTED:Me,ERROR_INTEGRATION_FAILURE:De,ERROR_INVALID_ENDPOINT:Te,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:Fe,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Pe,ERROR_WRONG_REGION:Ce,defaultEndpoint:ke,defaultTlsEndpoint:we};const Xe=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:je,ERROR_API_KEY_INVALID:Ze,ERROR_API_KEY_MISSING:Ae,ERROR_BAD_REQUEST_FORMAT:Le,ERROR_BAD_RESPONSE_FORMAT:Oe,ERROR_CLIENT_TIMEOUT:Se,ERROR_CSP_BLOCK:Ee,ERROR_FORBIDDEN_ENDPOINT:Ne,ERROR_FORBIDDEN_HEADER:$e,ERROR_FORBIDDEN_ORIGIN:Be,ERROR_GENERAL_SERVER_FAILURE:qe,ERROR_INSTALLATION_METHOD_RESTRICTED:Me,ERROR_INTEGRATION_FAILURE:De,ERROR_INVALID_ENDPOINT:Te,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:Fe,ERROR_SCRIPT_LOAD_FAIL:He,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Pe,ERROR_WRONG_REGION:Ce,default:Ye,defaultEndpoint:ke,defaultScriptUrlPattern:Je,defaultTlsEndpoint:we,load:F},Symbol.toStringTag,{value:"Module"})),Qe="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(e){var t;this.tag=e.tag||null,this.linkedId=e.linkedId||null,this.extendedResult=null!==(t=e.extendedResult)&&void 0!==t&&t}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(e,t){return`${t}__${e}`}function removePrefixFromKey(e,t){return e.replace(`${t}__`,"")}class LocalStorageCache{constructor(e=Qe){this.prefix=e}set(e,t){window.localStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.localStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){return}}remove(e){window.localStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class SessionStorageCache{constructor(e=Qe){this.prefix=e}set(e,t){window.sessionStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.sessionStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){return}}remove(e){window.sessionStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.sessionStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class CacheManager{constructor(e,t=3600,n){this.cache=e,this.cacheTime=t,this.nowProvider=n||DEFAULT_NOW_PROVIDER}get(e){return __awaiter$1(this,void 0,void 0,(function*(){const t=yield this.cache.get(e.toKey());if(!t)return;const n=yield this.nowProvider(),i=Math.floor(n/1e3);if(!(t.expiresAt<i))return t.body;yield this.cache.remove(e.toKey())}))}set(e,t){return __awaiter$1(this,void 0,void 0,(function*(){const n=yield this.wrapCacheEntry(t);yield this.cache.set(e.toKey(),n)}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){const e=yield this.cache.allKeys();yield Promise.all(e.map((e=>this.cache.remove(e))))}))}wrapCacheEntry(e){return __awaiter$1(this,void 0,void 0,(function*(){const t=yield this.nowProvider(),n=Math.floor(t/1e3)+this.cacheTime;return{body:e,expiresAt:n}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var et,tt;(tt=et||(et={})).Memory="memory",tt.LocalStorage="localstorage",tt.SessionStorage="sessionstorage",tt.NoCache="nocache";const rt={[et.Memory]:()=>(new InMemoryCache).enclosedCache,[et.LocalStorage]:e=>new LocalStorageCache(e),[et.SessionStorage]:e=>new SessionStorageCache(e),[et.NoCache]:()=>new CacheStub},cacheFactory=e=>rt[e];class FpjsClient{constructor(e){var t;let n;if(this.inFlightRequests=new Map,this.agentPromise=null,this.customAgent=null==e?void 0:e.customAgent,this.agent={get:()=>{throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.")}},this.loadOptions=null==e?void 0:e.loadOptions,(null==e?void 0:e.cache)&&(null==e?void 0:e.cacheLocation)&&console.warn("Both `cache` and `cacheLocation` options have been specified in the FpjsClient configuration; ignoring `cacheLocation` and using `cache`."),null==e?void 0:e.cache)n=e.cache;else{if(this.cacheLocation=(null==e?void 0:e.cacheLocation)||et.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case et.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case et.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=et.Memory),n=cacheFactory(this.cacheLocation)(null==e?void 0:e.cachePrefix)}if((null==e?void 0:e.cacheTimeInSeconds)&&e.cacheTimeInSeconds>86400)throw new Error("Cache time cannot exceed 86400 seconds (24 hours)");const i=null!==(t=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==t?t:3600;this.cacheManager=new CacheManager(n,i)}init(e){return __awaiter$1(this,void 0,void 0,(function*(){var t,n;if(!this.loadOptions&&!e)throw new TypeError("No load options provided");const i=Object.assign(Object.assign(Object.assign({},this.loadOptions),e),{integrationInfo:[...(null===(t=this.loadOptions)||void 0===t?void 0:t.integrationInfo)||[],...(null==e?void 0:e.integrationInfo)||[],"fingerprintjs-pro-spa/1.3.2"]});if(!this.agentPromise){const e=null!==(n=this.customAgent)&&void 0!==n?n:Xe;this.agentPromise=e.load(i).then((e=>(this.agent=e,e))).catch((e=>{throw this.agentPromise=null,e}))}return this.agentPromise}))}getVisitorData(){return __awaiter$1(this,arguments,void 0,(function*(e={},t=!1){const n=FpjsClient.makeCacheKey(e).toKey();if(!this.inFlightRequests.has(n)){const i=this._identify(e,t).finally((()=>{this.inFlightRequests.delete(n)}));this.inFlightRequests.set(n,i)}return yield this.inFlightRequests.get(n)}))}getVisitorDataFromCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){const t=FpjsClient.makeCacheKey(e),n=yield this.cacheManager.get(t);return n?Object.assign(Object.assign({},n),{cacheHit:!0}):void 0}))}isInCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){return Boolean(yield this.getVisitorDataFromCache(e))}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){yield this.cacheManager.clearCache()}))}static makeCacheKey(e){return new CacheKey(e)}_identify(e){return __awaiter$1(this,arguments,void 0,(function*(e,t=!1){const n=FpjsClient.makeCacheKey(e);if(!t){const e=yield this.cacheManager.get(n);if(e)return Object.assign(Object.assign({},e),{cacheHit:!0})}const i=yield this.agent.get(e);return yield this.cacheManager.set(n,i),Object.assign(Object.assign({},i),{cacheHit:!1})}))}}const nt="default_fingerprint_cache",ot=7,it="apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=nt}=window.fingerprintConfig;try{const t=JSON.parse(localStorage.getItem(e)||"null");return t&&t.expiresAt>Date.now()?t.fingerprint:(localStorage.removeItem(e),null)}catch{return null}};function isFingerprintReady(){return void 0!==window.fpClient}const st={initFingerprint:async function initFingerprint(e,t){const n=[ke],i=[Je];t&&(n.unshift(t),i.unshift(function buildProxyUrl(e){return`${e}?${it}`}(t))),window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e,endpoint:n,scriptUrlPattern:i}});try{await window.fpClient.init()}catch(or){throw console.error("Error initializing identification service:",or),or}},getFingerprint:async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const t=getCachedFingerprint();if(t)return t;if(e)return"";if(!isFingerprintReady())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:t}=await e.getVisitorData();return(e=>{const{cacheName:t=nt,cacheTimeInDays:n=ot}=window.fingerprintConfig,i={fingerprint:e,expiresAt:getExpirationDate(n)};localStorage.setItem(t,JSON.stringify(i))})(t),t}catch(or){throw console.error("Error retrieving fingerprint:",or),or}},isFingerprintReady:isFingerprintReady,getCachedFingerprint:getCachedFingerprint};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var at,ct={exports:{}};at=ct,function webpackUniversalModuleDefinition(e,t){at.exports=t()}("undefined"!=typeof self&&self,(function(){return function(e){var t={};function __webpack_require__(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,__webpack_require__),i.l=!0,i.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=3)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.post(c,t,u)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion,i=t.queryParams,s=t.apiType,c=buildUrl({endpoint:e,apiVersion:n,queryParams:i,apiType:s});return a.get(c,u)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.apiVersion,s=n.apiType,c=buildUrl({endpoint:e,apiVersion:i,apiType:s});return a.put(c,t,u)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.apiVersion;t.queryParams;var i=t.apiType,s=buildUrl({endpoint:e,apiVersion:n,apiType:i});return a.deleteMethod(s,u)},t.poll=function poll(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments[3],a=arguments[4],u=buildUrl({endpoint:e,apiVersion:s,apiType:a}),d=i({url:u,eachCall:t},n);return new c.default(d)};var s=_interopRequireDefault(n(1)),a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),c=_interopRequireDefault(n(9));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var u={apiKey:s.default.apiKey};function serializeQueryParams(e){if(!e)return"";var t=[null,void 0,""].concat(function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[])),n=[];return Object.keys(e).forEach((function(i){var s=e[i];t.includes(s)||n.push(i+"="+s)})),n.length?"?"+n.join("&"):""}function buildUrl(e){var t=e.endpoint,n=e.apiVersion,i=void 0===n?s.default.version:n,a=e.queryParams;return"core"===e.apiType?s.default.coreUrl+"/"+s.default.coreVersion+"/"+t+serializeQueryParams(a):(/search|redirect|places/.test(t)?s.default.searchUrl:s.default.purchaseUrl)+"/"+i+"/"+t+serializeQueryParams(a)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.setConfig=function setConfig(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return void 0!==e.env&&(e.searchUrl=i[e.env].search,e.purchaseUrl=i[e.env].purchase,e.coreUrl=i[e.env].core,e.coreVersion=i[e.env].coreVersion),Object.assign(c,e)},t.setUserAuthToken=function setUserAuthToken(e){return Object.assign(c,{userAuthToken:e})};var i={sandbox:{search:"https://search.resertravel.com/api",purchase:"https://purchases.resertravel.com/api",core:""},production:{search:"https://search.reservamos.mx/api",purchase:"https://compras.reservamos.mx/api",core:""}},s="sandbox",a={env:s,headers:{},searchUrl:i[s].search,purchaseUrl:i[s].purchase,coreUrl:i[s].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1},c=t.config=Object.assign({},a);t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.post=function post(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"POST",body:JSON.stringify(t)},n)},t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];return fetchJson(e,t,{},n)},t.put=function put(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return fetchJson(e,{method:"PUT",body:JSON.stringify(t)},n)},t.deleteMethod=function deleteMethod(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fetchJson(e,{method:"DELETE"},t)};var s=_interopRequireDefault(n(1)),a=_interopRequireDefault(n(7)),c=_interopRequireDefault(n(8));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function checkStatus(e){var t=e.json();if(e.ok)return t;if(![404,422,500].includes(e.status))throw new a.default(e.status,e.statusText);switch(e.status){case 404:throw new a.default(100,"Not found");case 422:return t;case 500:throw new a.default(101,"Server error");default:throw new a.default}}function handleErrors(e){if(e.errors instanceof Array){var t=e.errors[0]||{},n=t.code,i=void 0===n?-100:n,s=t.message,u=void 0===s?"Unknown error":s,d=(0,c.default)(u)[i];throw d?new a.default(d.code,d.message):new a.default(i,u)}return e}function buildHeaders(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=Object.keys(Object.assign.apply(Object,[{}].concat(t))).reduce((function(e,n){return i({},e,function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}({},n,t.map((function(e){return n in e&&e[n]})).filter(Boolean)))}),{});return new Headers(s)}function fetchJson(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments[3],a=s.default.apiKey,c=s.default.withCredentials,u=s.default.userAuthToken,d=s.default.headers,l={Accept:"application/json",Authorization:"Token token="+(n.apiKey||a),"Content-Type":"application/json"};return u&&(l.Authorization="Token "+(n.apiKey||a)+", Bearer "+u),t.headers=buildHeaders(d,l),t.credentials=c?"include":"omit","string"!=typeof t.body&&(t.body=JSON.stringify(t.body)),fetch(e,t).then(checkStatus).then(handleErrors).catch(i)}},function(e,t,n){n(4),n(5),e.exports=n(6)},function(e,t){"function"!=typeof Object.assign&&(Object.assign=function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var n=Object(e),i=1;i<arguments.length;i++){var s=arguments[i];if(null!=s)for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])}return n})},function(e,t){!function(e){if(!e.fetch){var t="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,a="ArrayBuffer"in e;if(a)var c=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],isDataView=function(e){return e&&DataView.prototype.isPrototypeOf(e)},u=ArrayBuffer.isView||function(e){return e&&c.indexOf(Object.prototype.toString.call(e))>-1};Headers2.prototype.append=function(e,t){e=normalizeName(e),t=normalizeValue(t);var n=this.map[e];this.map[e]=n?n+","+t:t},Headers2.prototype.delete=function(e){delete this.map[normalizeName(e)]},Headers2.prototype.get=function(e){return e=normalizeName(e),this.has(e)?this.map[e]:null},Headers2.prototype.has=function(e){return this.map.hasOwnProperty(normalizeName(e))},Headers2.prototype.set=function(e,t){this.map[normalizeName(e)]=normalizeValue(t)},Headers2.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},Headers2.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),iteratorFor(e)},Headers2.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),iteratorFor(e)},Headers2.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),iteratorFor(e)},n&&(Headers2.prototype[Symbol.iterator]=Headers2.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response2.prototype),Response2.prototype.clone=function(){return new Response2(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers2(this.headers),url:this.url})},Response2.error=function(){var e=new Response2(null,{status:0,statusText:""});return e.type="error",e};var l=[301,302,303,307,308];Response2.redirect=function(e,t){if(-1===l.indexOf(t))throw new RangeError("Invalid status code");return new Response2(null,{status:t,headers:{location:e}})},e.Headers=Headers2,e.Request=Request,e.Response=Response2,e.fetch=function(e,t){return new Promise((function(n,s){var a=new Request(e,t),c=new XMLHttpRequest;c.onload=function(){var e,t,i={status:c.status,statusText:c.statusText,headers:(e=c.getAllResponseHeaders()||"",t=new Headers2,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),i=n.shift().trim();if(i){var s=n.join(":").trim();t.append(i,s)}})),t)};i.url="responseURL"in c?c.responseURL:i.headers.get("X-Request-URL");var s="response"in c?c.response:c.responseText;n(new Response2(s,i))},c.onerror=function(){s(new TypeError("Network request failed"))},c.ontimeout=function(){s(new TypeError("Network request failed"))},c.open(a.method,a.url,!0),"include"===a.credentials?c.withCredentials=!0:"omit"===a.credentials&&(c.withCredentials=!1),"responseType"in c&&i&&(c.responseType="blob"),a.headers.forEach((function(e,t){c.setRequestHeader(t,e)})),c.send(void 0===a._bodyInit?null:a._bodyInit)}))},e.fetch.polyfill=!0}function normalizeName(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function normalizeValue(e){return"string"!=typeof e&&(e=String(e)),e}function iteratorFor(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function Headers2(e){this.map={},e instanceof Headers2?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function consumed(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function fileReaderReady(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function readBlobAsArrayBuffer(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsArrayBuffer(e),n}function bufferClone(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(i&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(s&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(a&&i&&isDataView(e))this._bodyArrayBuffer=bufferClone(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!a||!ArrayBuffer.prototype.isPrototypeOf(e)&&!u(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=bufferClone(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?consumed(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var e=consumed(this);if(e)return e;if(this._bodyBlob)return function readBlobAsText(e){var t=new FileReader,n=fileReaderReady(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function readArrayBufferAsText(e){for(var t=new Uint8Array(e),n=new Array(t.length),i=0;i<t.length;i++)n[i]=String.fromCharCode(t[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}function Request(e,t){var n=(t=t||{}).body;if(e instanceof Request){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new Headers2(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new Headers2(t.headers)),this.method=function normalizeMethod(e){var t=e.toUpperCase();return d.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function decode(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),i=n.shift().replace(/\+/g," "),s=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(s))}})),t}function Response2(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new Headers2(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.core=t.adyen=t.exchange=t.priceAlert=t.users=t.quotes=t.redirect=t.utils=t.purchase=t.trip=t.search=t.collections=t.session=t.apiRequest=t.setUserAuthToken=t.setConfig=void 0;var i=n(1),s=_interopRequireWildcard(n(0)),a=_interopRequireWildcard(n(10)),c=_interopRequireWildcard(n(11)),u=_interopRequireWildcard(n(12)),d=_interopRequireWildcard(n(13)),l=_interopRequireWildcard(n(14)),p=_interopRequireWildcard(n(17)),h=_interopRequireWildcard(n(19)),f=_interopRequireWildcard(n(20)),m=_interopRequireWildcard(n(21)),g=_interopRequireWildcard(n(22)),_=_interopRequireWildcard(n(23)),y=_interopRequireWildcard(n(24)),v=_interopRequireWildcard(n(25));function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}t.setConfig=i.setConfig,t.setUserAuthToken=i.setUserAuthToken,t.apiRequest=s,t.session=a,t.collections=c,t.search=u,t.trip=d,t.purchase=l,t.utils=p,t.redirect=h,t.quotes=f,t.users=m,t.priceAlert=g,t.exchange=_,t.adyen=y,t.core=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function NetworkError2(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-100,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Unknown error";!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,NetworkError2);var n=function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(NetworkError2.__proto__||Object.getPrototypeOf(NetworkError2)).call(this,t));return n.code=e,n.stack=(new Error).stack,n}return function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(NetworkError2,Error),NetworkError2}();t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s={1:{code:200,message:"Operación no autorizada"}},a={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},c={10:{code:400,message:"No existe el viaje"},20:{code:60,message:"No se encontró el viaje"},21:{code:60,message:"Tarifa no disponible"},22:{code:60,message:"Tarifa no disponible"}},u={23:{code:60,message:"Estudiante no disponible"},24:{code:60,message:"Profesor no disponible"},25:{code:60,message:"Menor no disponible"},26:{code:60,message:"Capacidades diferentes no disponible"},27:{code:60,message:"INSEN no disponible"},28:{code:60,message:"General no disponible"},29:{code:60,message:"Error desconocido"}},d={50:{code:50,message:"Unknow Error"}},l=t.apiErrors=function apiErrors2(e){return i({},s,a,c,function discountCodeErrors2(e){return{11:{code:500,message:e},12:{code:501,message:e}}}(e),u,d,function exchange2(e){return{30:{code:30,message:e}}}(e))};t.default=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&defineProperties(e.prototype,t),n&&defineProperties(e,n),e}}(),s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(2)),a=function(){function Poll2(e){var t=e.url,n=e.watch,i=e.expect,s=e.maxRetries,a=void 0===s?30:s,c=e.interval,u=void 0===c?2e3:c,d=e.eachCall,l=void 0===d?null:d;!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Poll2),this.url=t,this.watch=n,this.expect=i instanceof Array?i:[i],this.interval=u,this.maxRetries=a,this.eachCall=l&&l.bind(this),this.aborted=!1,this.timers=[],this.execute=this.execute.bind(this),this.executeEachCall=this.executeEachCall.bind(this)}return i(Poll2,[{key:"start",value:function start(){return this.execute(this.maxRetries)}},{key:"abort",value:function abort(){this.aborted=!0}},{key:"execute",value:function execute(e){var t=this;return s.get(this.url,{},(function onRequestError2(e){return t.executeEachCall("error",e)})).then((function onRequestSuccess2(n){if(t.expect.includes(n[t.watch])||1===e||t.aborted){var i=n[t.watch];1===e?i="retries_exceeded":t.aborted&&(i="aborted"),t.timers.forEach(clearInterval),t.executeEachCall(i,n)}else if("failed"===n[t.watch])t.timers.forEach(clearInterval),t.executeEachCall("failed",n);else{t.executeEachCall("pending",n);var s=window.setTimeout(t.execute,t.interval,e-1);t.timers.push(s)}}))}},{key:"executeEachCall",value:function executeEachCall(e,t){this.eachCall instanceof Function&&this.eachCall({status:e,payload:t})&&this.abort()}}]),Poll2}();t.default=a},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(){return new Promise((function(e,t){i.get("session",{apiVersion:"v1"}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.agency=function agency(){return new Promise((function(e,t){i.get("get_agency").then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getCountries=function getCountries(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.prefetch,n=void 0===t||t,s=e.q,a={prefetch:n,q:void 0===s?"":s};return new Promise((function(e,t){i.get("countries",{queryParams:a}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.getPlaces=function getPlaces(e,t){var n=e?{q:e,from:t}:{prefetch:!0};return new Promise((function(e,t){i.get("places",{queryParams:n}).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.create=function create(e,t){return a.post("search",e).then((function onCreateSuccess2(e){return startPolls(e,t)}))},t.stopSearch=function stopSearch(e){return!!(c&&e&&c[e])&&(c[e].forEach((function(e){return e.abort()})),Reflect.deleteProperty(c,e),!0)},t.stopAllSearches=function stopAllSearches(){return!!c&&(Object.entries(c).forEach((function(e){var t=i(e,2);return t[0],t[1].forEach((function(e){return e.abort()}))})),c={},!0)},t.get=function get(e,t){return new Promise((function(n,i){a.get("search/"+e+"/info").then((function(e){return n(startPolls(e,t))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateExternalCoupon=function validateExternalCoupon(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get("search/discounts/validate_external_coupon/"+e+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.walletSearchDiscount=function walletSearchDiscount(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams(t).toString(),i=n?"?"+n:"";return new Promise((function(t,n){a.get(e+"/discounts"+i).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),c={};function startPolls(e,t){var n=e.search,i=n.id,u=n.type_of_transport,d=u.bus,l=u.flights,p=u.mix,h=t.initBuses,f=void 0===h||h,m=t.initFlights,g=void 0===m||m,_=t.initRides,y=void 0!==_&&_,v=t.initMix,b=void 0===v||v,w=t.onReceiveBuses,S=t.onReceiveFlights,I=t.onReceiveRides,x=t.onReceiveMixed,O=s({watch:"state",expect:"finished"},t.options||{}),T=[];if(d&&d.active&&f){var C=a.poll("search/"+i+"?type=bus",w,O);C.start(),T.push(C)}else w&&w({status:"deactivated"});if(l&&l.active&&g){var R=a.poll("search/"+i+"?type=plane",S,O);R.start(),T.push(R)}else S&&S({status:"deactivated"});if(p&&p.active&&b){var P=a.poll("search/"+i+"?type=mix",x,O);P.start(),T.push(P)}else x&&x({status:"deactivated"});if(y){var N=a.poll("search/"+i+"?type=car",I,O);N.start(),T.push(N)}return c[i]=T,e}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.get=function get(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,i){s.get("trips/"+e+"?"+function encodePassengers(e){var t=[];return Object.keys(e).forEach((function(n){var i=e[n];i&&t.push(n+"="+i)})),t.join("&")}(t)).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getWithBus=function getWithBus(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i({with_pricing:!0},t);return new Promise((function(t,c){s.post("trips/"+e+"/details_requests",a).then((function(a){return t(function startPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.options,l=void 0===d?{}:d,p=n.onReceiveTrip,h=i({watch:"state",expect:"finished"},l),f=void 0,m=void 0;return u&&(m=(f=s.poll("trips/"+e+"/details_requests/"+a,p,h)).start()),{payload:t,polls:{trip:m,abort:function abort(){return f.abort()}}}}(e,a,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.startTicketsPoll=void 0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPurchasePoll=startPurchasePoll,t.create=function create(e){return new Promise((function(t,n){s.post(u,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.get=get,t.update=function update(e,t){return new Promise((function(n,i){s.put(u+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createPassengers=function createPassengers(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+p,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.updatePassengers=function updatePassengers(e,t){return new Promise((function(n,i){s.put(u+"/"+e+"/"+h,{passengers:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.deletePassenger=function deletePassenger(e,t){return new Promise((function(n,i){s.deleteMethod(u+"/"+e+"/"+p+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.createTickets=function createTickets(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,a){s.post(u+"/"+e+"/"+f,t).then((function(t){return i((0,c.startTicketsPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknown error":i})}))}))},t.applyDiscountCode=function applyDiscountCode(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+g,{code:t},{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.removeDiscountCode=function removeDiscountCode(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+g+"/"+_,{apiVersion:"v2"}).then((function(){return get(e)})).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.createPayment=function createPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.post(u+"/"+e+"/"+v,t).then((function(t){return i((0,a.startPaymentPoll)(e,t,n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.getPayment=function getPayment(e,t,n){return n?(0,a.startPaymentPoll)(e,{id:t},n):new Promise((function(n,i){s.get(u+"/"+e+"/"+v+"/"+t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.sendEmail=function sendEmail(e,t){var n={email:t};return new Promise((function(t,i){s.get(u+"/"+e+"/"+m,{queryParams:n}).then((function(){return t()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.confirmPaypalPayment=function confirmPaypalPayment(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(i,c){s.put(u+"/"+e+"/"+v+"/"+t+"/confirm.json").then((function(s){i((0,a.startPaymentPoll)(e,{id:t},n))})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;c({code:n,message:void 0===i?"Unknown error":i})}))}))},t.updateWallet=function updateWallet(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=u+"/"+e+"/"+d,a=t?i:i+"/"+l;return s.post(a,n).then((function(){return get(e)}))},t.verifyPhoneNumber=function verifyPhoneNumber(e,t,n){return s.put(u+"/"+e+"/"+v+"/"+t+"/send_verification",n)},t.verifySmsCode=function verifySmsCode(e,t,n){return s.post(u+"/"+e+"/"+v+"/"+t+"/verify_code",{code:n})},t.unlockSeats=function unlockSeats(e){return new Promise((function(t,n){s.post(u+"/"+e+"/unlock_seats").then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.generateOTP=function generateOTP(e,t){return new Promise((function(n,i){s.post(e+"/otp-generate",t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.validateOTP=function validateOTP(e,t){return new Promise((function(n,i){var a={otp:t};s.post(e+"/otp-validate",a).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPayment=function membershipDiscountPayment(e,t){return new Promise((function(n,i){s.post(u+"/"+e+"/"+y,t).then((function(){return n()})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.membershipDiscountPaymentDelete=function membershipDiscountPaymentDelete(e){return new Promise((function(t,n){s.deleteMethod(u+"/"+e+"/"+y).then((function(){return t()})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadTickets=function downloadTickets(e){return new Promise((function(t,n){s.post("tickets/pdf",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.downloadPurchasesHistory=function downloadPurchasesHistory(e){return new Promise((function(t,n){s.post(b,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.increaseExpiration=function increaseExpiration(e){return new Promise((function(t,n){s.post(u+"/"+e+"/"+w).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=n(15),c=n(16),u="purchases",d="wallet_movements",l="cancel",p="passenger_requests",h=p+"/update",f="ticket_requests",m="tickets/resend",g="discounts",_="cancel",y="payment_discounts",v="payments",b="purchase_history/search",w="session-extension";function startPurchasePoll(e,t){var n=t.init,a=void 0===n||n,c=t.onReceivePurchase,u="purchases/"+e,d=i({watch:"state",expect:["completed"]},t.options||{}),l=void 0,p=void 0;return a&&(p=(l=s.poll(u,c,d)).start()),{polls:{payment:p,abort:function abort(){return l.abort()}}}}function get(e,t,n){return n?startPurchasePoll(e,n):new Promise((function(n,i){s.get(u+"/"+e,{queryParams:t}).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))}t.startTicketsPoll=c.startTicketsPoll},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startPaymentPoll=function startPaymentPoll(e,t,n){var c=t.id,u=n.init,d=void 0===u||u,l=n.onReceivePayment,p="purchases/"+e+"/payments/"+c,h=i({watch:"purchase_state",expect:["completed","pending"]},n.options||{}),f=void 0,m=void 0;return d&&(f=s.poll(p,function checkPaymentPayload(e){return function(t){var n=t.payload,i=n.using_3d_secure,s=n.needs_verification;return e&&e(t),a(t)||i||s}}(l),h),m=f.start()),{payload:t,polls:{payment:m,abort:function abort(){return f.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a=function paymentFailed2(e){var t=e.payload;return["suspicious","failed","rejected"].includes(t.status)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.startTicketsPoll=function startTicketsPoll(e,t,n){var a=t.id,c=n.init,u=void 0===c||c,d=n.onReceiveTickets,l="purchases/"+e+"/ticket_requests/"+a,p=i({watch:"state",expect:"finished"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{tickets:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=n(18);Object.defineProperty(t,"findSeats",{enumerable:!0,get:function get(){return i.findSeats}})},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function sliceIterator(e,t){var n=[],i=!0,s=!1,a=void 0;try{for(var c,u=e[Symbol.iterator]();!(i=(c=u.next()).done)&&(n.push(c.value),!t||n.length!==t);i=!0);}catch(d){s=!0,a=d}finally{try{!i&&u.return&&u.return()}finally{if(s)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function findAvailableSeats(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments[3],s=t.length,a=n.length,c=t,u=void 0;if(void 0===i&&(i=e-a),!i)return n;for(var d=0;d<s;d++)if((u=findAvailableAdjecentSeats(i,t[d].filter((function(e){return["seat","seat_tv"].includes(e.category)})),n)).length===i){c=(c=t.slice(d)).concat(t.slice(0,d)),a=(n=n.concat(u)).length;break}return u.length?i=e-a:i-=1,findAvailableSeats(e,c,n,i)}function findAvailableAdjecentSeats(e,t){var n=[],i=!1;if(!function hasAvailableSeats(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return e.filter((function(e){return!(e.occupied||n.includes(e.number))})).length>=t}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[]))return n;for(var s=t.length-1;s>=0;s--){var a=t[s];if(a.occupied?n=[]:n.push(a.number),n.length===e){i=!0;break}}return i?n:[]}t.findSeats=function findSeats(e,t){var n=i(t,2),s=n[0],a=n[1],c=findAvailableSeats(e,s),u=[];if(c.length<e&&a){var d=findAvailableSeats(e,a);u=d.length<e?c.concat(d).slice(0,e):d}else u=c;return u.length?u:null}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("redirect",{apiVersion:"v2",queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.get=function get(e){return new Promise((function(t,n){i.get("quotes",{queryParams:e}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getUser=function getUser(){return s.default.userAuthToken?i.get(c):null},t.getCreditCards=function getCreditCards(){return s.default.userAuthToken?i.get(u):null};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n(1)),a="users",c=a+"/profile.json",u=a+"/list_cards.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.createPriceAlert=function createPriceAlert(e){return i.post(s+".json",e)},t.deletePriceAlert=function deletePriceAlert(e){return i.get(s+"/"+e+"/"+a)};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="price_alerts",a="cancel.json"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.validate=function validate(e,t,n,c,u,d,l){var p=i({},d&&{email:d},l&&{document:l},{operation_number:e},t&&{nit:t},n&&{origin:n},c&&{destination:c},u&&{recaptcha_token:u});return new Promise((function(e,t){s.post(a+"/validate",p).then((function(t){return e(t)})).catch((function(e){var n=e.code,i=void 0===n?-100:n,s=e.message;return t({code:i,message:void 0===s?"Unknown error":s})}))}))},t.cancelTicket=function cancelTicket(e,t){var n={operation_number:t};return new Promise((function(t,i){s.post("purchases/"+e+"/cancellations",n).then((function(e){return t(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,s=e.message;return i({code:n,message:void 0===s?"Unknown error":s})}))}))},t.getCancelledTicketStatusPoll=function getCancelledTicketStatusPoll(e,t,n){var a=t,c=n.init,u=void 0===c||c,d=n.onGetCancelStatus,l="purchases/"+e+"/cancellations/"+a,p=i({watch:"status",expect:"success"},n.options||{}),h=void 0,f=void 0;return u&&(f=(h=s.poll(l,d,p)).start()),{payload:t,polls:{data:f,abort:function abort(){return h.abort()}}}};var s=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),a="exchanges"},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.paymentCards=function paymentCards(e){return new Promise((function(t,n){i.post("adyen/payment_cards",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))},t.deleteCard=function deleteCard(e){return new Promise((function(t,n){i.post("adyen/delete_payment_card",e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknown error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getRecommendedTrips=function getRecommendedTrips(e){var t=e.searchId,n=e.userIdentifier;return new Promise((function(e,s){i.get("trip_recommendations/"+t+"/"+n,{apiType:"core"}).then((function(t){return e(t)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return s({code:n,message:void 0===i?"Unknown error":i})}))}))},t.createTripPriceAlerts=function createTripPriceAlerts(e){return new Promise((function(t,n){i.post(""+s,e).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.updateTripPriceAlerts=function updateTripPriceAlerts(e,t){return new Promise((function(n,a){i.put(s+"/"+e,t).then((function(e){return n(e)})).catch((function(e){var t=e.code,n=void 0===t?-100:t,i=e.message;return a({code:n,message:void 0===i?"Unknow error":i})}))}))},t.deleteTripPriceAlerts=function deleteTripPriceAlerts(e){return new Promise((function(t,n){i.deleteMethod(s+"/"+e).then((function(){return t({code:200,message:"Trip Price Alert deleted"})})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))},t.createAnonymousProfile=function createAnonymousProfile2(e){return new Promise((function(t,n){i.post(a,e,{apiType:"core"}).then((function(e){return t(e)})).catch((function(e){var t=e.code,i=void 0===t?-100:t,s=e.message;return n({code:i,message:void 0===s?"Unknow error":s})}))}))};var i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(0)),s="trip_price_alerts",a="anonymous_profiles/identify"}])}));var ut=ct.exports;const dt=window.location.origin,lt={coreAPIConfig:{sandbox:{coreUrl:"https://datalake-api-dev.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:dt},coreApiKey:"Bearer 753bf0710dc920a84236d42241d4f487"},prod:{coreUrl:"https://data-lake.reservamossaas.com/api",coreVersion:"v1",headers:{Origin:dt},coreApiKey:"Bearer 753bf0710dc920a84236d42241d4f487"}}};var pt,ht;function isShadowRoot(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function isNativeShadowDom(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function stringifyStylesheet(e){try{const t=e.rules||e.cssRules;return t?function fixBrowserCompatibilityIssuesInCSS(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}(Array.from(t,stringifyRule).join("")):null}catch(or){return null}}function stringifyRule(e){let t;if(function isCSSImportRule(e){return"styleSheet"in e}(e))try{t=stringifyStylesheet(e.styleSheet)||function escapeImportStatement(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(or){}else if(function isCSSStyleRule(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function fixSafariColons(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}(ht=pt||(pt={}))[ht.Document=0]="Document",ht[ht.DocumentType=1]="DocumentType",ht[ht.Element=2]="Element",ht[ht.Text=3]="Text",ht[ht.CDATA=4]="CDATA",ht[ht.Comment=5]="Comment";class Mirror{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:e,maskInputOptions:t,tagName:n,type:i,value:s,maskInputFn:a}){let c=s||"";const u=i&&toLowerCase(i);return(t[n.toLowerCase()]||u&&t[u])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const ft="__rrweb_original__";function getInputType(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?toLowerCase(t):null}function extractFileExtension(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(a){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==s?void 0:s[1])&&void 0!==n?n:null}let mt=1;const gt=new RegExp("[^a-z0-9-_:]"),_t=-2;function genId(){return mt++}let yt,vt;const bt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,kt=/^(?:[a-z+]+:)?\/\//i,wt=/^www\..*/i,St=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(bt,((e,n,i,s,a,c)=>{const u=i||a||c,d=n||s||"";if(!u)return e;if(kt.test(u)||wt.test(u))return`url(${d}${u}${d})`;if(St.test(u))return`url(${d}${u}${d})`;if("/"===u[0])return`url(${d}${function extractOrigin(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+u}${d})`;const l=t.split("/"),p=u.split("/");l.pop();for(const t of p)"."!==t&&(".."===t?l.pop():l.push(t));return`url(${d}${l.join("/")}${d})`}))}const It=/^[^ \t\n\r\u000c]+/,xt=/^[, \t\n\r\u000c]+/;function absoluteToDoc(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function getHref(){const e=document.createElement("a");return e.href="",e.href}function transformAttribute(e,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?absoluteToDoc(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function getAbsoluteSrcsetString(e,t){if(""===t.trim())return t;let n=0;function collectCharacters(e){let i;const s=e.exec(t.substring(n));return s?(i=s[0],n+=i.length,i):""}const i=[];for(;collectCharacters(xt),!(n>=t.length);){let s=collectCharacters(It);if(","===s.slice(-1))s=absoluteToDoc(e,s.substring(0,s.length-1)),i.push(s);else{let a="";s=absoluteToDoc(e,s);let c=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((s+a).trim());break}if(c)")"===e&&(c=!1);else{if(","===e){n+=1,i.push((s+a).trim());break}"("===e&&(c=!0)}a+=e,n+=1}}}return i.join(", ")}(e,i):"style"===n?absoluteToStylesheet(i,getHref()):"object"===t&&"data"===n?absoluteToDoc(e,i):i:absoluteToDoc(e,i):i}function ignoreAttribute(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function classMatchesRegex(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&classMatchesRegex(e.parentNode,t,n);for(let i=e.classList.length;i--;){const n=e.classList[i];if(t.test(n))return!0}return!!n&&classMatchesRegex(e.parentNode,t,n)}function needMaskingText(e,t,n,i){try{const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===s)return!1;if("string"==typeof t){if(i){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(classMatchesRegex(s,t,i))return!0;if(n)if(i){if(s.closest(n))return!0}else if(s.matches(n))return!0}catch(s){}return!1}function serializeNode(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:c,inlineStylesheet:u,maskInputOptions:d={},maskTextFn:l,maskInputFn:p,dataURLOptions:h={},inlineImages:f,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:_=!1}=t,y=function getRootId(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,i);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:pt.Document,childNodes:[],compatMode:e.compatMode}:{type:pt.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:pt.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function serializeElementNode(e,t){const{doc:n,blockClass:i,blockSelector:s,inlineStylesheet:a,maskInputOptions:c={},maskInputFn:u,dataURLOptions:d={},inlineImages:l,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:m}=t,g=function _isBlockedElement(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(i){}return!1}(e,i,s),_=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const t=toLowerCase(e.tagName);return gt.test(t)?"div":t}(e);let y={};const v=e.attributes.length;for(let S=0;S<v;S++){const t=e.attributes[S];ignoreAttribute(_,t.name,t.value)||(y[t.name]=transformAttribute(n,_,toLowerCase(t.name),t.value))}if("link"===_&&a){const t=Array.from(n.styleSheets).find((t=>t.href===e.href));let i=null;t&&(i=stringifyStylesheet(t)),i&&(delete y.rel,delete y.href,y._cssText=absoluteToStylesheet(i,t.href))}if("style"===_&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=stringifyStylesheet(e.sheet);t&&(y._cssText=absoluteToStylesheet(t,getHref()))}if("input"===_||"textarea"===_||"select"===_){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=maskInputValue({element:e,type:getInputType(e),tagName:_,value:t,maskInputOptions:c,maskInputFn:u}):n&&(y.checked=n)}"option"===_&&(e.selected&&!c.select?y.selected=!0:delete y.selected);if("canvas"===_&&p)if("2d"===e.__context)(function is2DCanvasBlank(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const s=t.getImageData,a=ft in s?s[ft]:s;if(new Uint32Array(a.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(d.type,d.quality));else if(!("__context"in e)){const t=e.toDataURL(d.type,d.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(d.type,d.quality)&&(y.rr_dataURL=t)}if("img"===_&&l){yt||(yt=n.createElement("canvas"),vt=yt.getContext("2d"));const t=e,i=t.crossOrigin;t.crossOrigin="anonymous";const recordInlineImage=()=>{t.removeEventListener("load",recordInlineImage);try{yt.width=t.naturalWidth,yt.height=t.naturalHeight,vt.drawImage(t,0,0),y.rr_dataURL=yt.toDataURL(d.type,d.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}i?y.crossOrigin=i:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?recordInlineImage():t.addEventListener("load",recordInlineImage)}if("audio"===_||"video"===_){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(g){const{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==_||h(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let b;try{customElements.get(_)&&(b=!0)}catch(w){}return{type:pt.Element,tagName:_,attributes:y,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:g,rootId:m,isCustom:b}}(e,{doc:n,blockClass:s,blockSelector:a,inlineStylesheet:u,maskInputOptions:d,maskInputFn:p,dataURLOptions:h,inlineImages:f,recordCanvas:m,keepIframeSrcFn:g,newlyAddedElement:_,rootId:y});case e.TEXT_NODE:return function serializeTextNode(e,t){var n;const{needsMask:i,maskTextFn:s,rootId:a}=t,c=e.parentNode&&e.parentNode.tagName;let u=e.textContent;const d="STYLE"===c||void 0,l="SCRIPT"===c||void 0;if(d&&u){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(u=stringifyStylesheet(e.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,e)}u=absoluteToStylesheet(u,getHref())}l&&(u="SCRIPT_PLACEHOLDER");!d&&!l&&u&&i&&(u=s?s(u,e.parentElement):u.replace(/[\S]/g,"*"));return{type:pt.Text,textContent:u||"",isStyle:d,rootId:a}}(e,{needsMask:c,maskTextFn:l,rootId:y});case e.CDATA_SECTION_NODE:return{type:pt.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:pt.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:u,skipChild:d=!1,inlineStylesheet:l=!0,maskInputOptions:p={},maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g={},inlineImages:_=!1,recordCanvas:y=!1,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w=5e3,onStylesheetLoad:S,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:O=!1}=t;let{needsMask:T}=t,{preserveWhiteSpace:C=!0}=t;if(!T&&e.childNodes){T=needMaskingText(e,c,u,void 0===T)}const R=serializeNode(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:T,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,dataURLOptions:g,inlineImages:_,recordCanvas:y,keepIframeSrcFn:x,newlyAddedElement:O});if(!R)return console.warn(e,"not serialized"),null;let P;P=i.hasNode(e)?i.getId(e):!function slimDOMExcluded(e,t){if(t.comment&&e.type===pt.Comment)return!0;if(e.type===pt.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===extractFileExtension(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(lowerIfExists(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(e.attributes.name)||"icon"===lowerIfExists(e.attributes.rel)||"apple-touch-icon"===lowerIfExists(e.attributes.rel)||"shortcut icon"===lowerIfExists(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===lowerIfExists(e.attributes.name)||"generator"===lowerIfExists(e.attributes.name)||"framework"===lowerIfExists(e.attributes.name)||"publisher"===lowerIfExists(e.attributes.name)||"progid"===lowerIfExists(e.attributes.name)||lowerIfExists(e.attributes.property).match(/^article:/)||lowerIfExists(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===lowerIfExists(e.attributes.name)||"yandex-verification"===lowerIfExists(e.attributes.name)||"csrf-token"===lowerIfExists(e.attributes.name)||"p:domain_verify"===lowerIfExists(e.attributes.name)||"verify-v1"===lowerIfExists(e.attributes.name)||"verification"===lowerIfExists(e.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(e.attributes.name)))return!0}}return!1}(R,m)&&(C||R.type!==pt.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():_t;const N=Object.assign(R,{id:P});if(i.add(e,N),P===_t)return null;v&&v(e);let D=!d;if(N.type===pt.Element){D=D&&!N.needBlock,delete N.needBlock;const t=e.shadowRoot;t&&isNativeShadowDom(t)&&(N.isShadowHost=!0)}if((N.type===pt.Document||N.type===pt.Element)&&D){m.headWhitespace&&N.type===pt.Element&&"head"===N.tagName&&(C=!1);const t={doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:T,maskTextClass:c,maskTextSelector:u,skipChild:d,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g,inlineImages:_,recordCanvas:y,preserveWhiteSpace:C,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x};if(N.type===pt.Element&&"textarea"===N.tagName&&void 0!==N.attributes.value);else for(const n of Array.from(e.childNodes)){const e=serializeNodeWithId(n,t);e&&N.childNodes.push(e)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const i=serializeNodeWithId(n,t);i&&(isNativeShadowDom(e.shadowRoot)&&(i.isShadow=!0),N.childNodes.push(i))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(N.isShadow=!0),N.type===pt.Element&&"iframe"===N.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(or){return}if("complete"!==s){const i=setTimeout((()=>{a||(t(),a=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),a=!0,t()}))}const c="about:blank";if(i.location.href!==c||e.src===c||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&b){const n=serializeNodeWithId(t,{doc:t,mirror:i,blockClass:s,blockSelector:a,needsMask:T,maskTextClass:c,maskTextSelector:u,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g,inlineImages:_,recordCanvas:y,preserveWhiteSpace:C,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x});n&&b(e,n)}}),w),N.type===pt.Element&&"link"===N.tagName&&"string"==typeof N.attributes.rel&&("stylesheet"===N.attributes.rel||"preload"===N.attributes.rel&&"string"==typeof N.attributes.href&&"css"===extractFileExtension(N.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(or){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(e,(()=>{if(S){const t=serializeNodeWithId(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:T,maskTextClass:c,maskTextSelector:u,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:g,inlineImages:_,recordCanvas:y,preserveWhiteSpace:C,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:x});t&&S(e,t)}}),I),N}function on(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const Ot="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Et={map:{},getId:()=>(console.error(Ot),-1),getNode:()=>(console.error(Ot),null),removeNodeFromMap(){console.error(Ot)},has:()=>(console.error(Ot),!1),reset(){console.error(Ot)}};function throttle(e,t,n={}){let i=null,s=0;return function(...a){const c=Date.now();s||!1!==n.leading||(s=c);const u=t-(c-s),d=this;u<=0||u>t?(i&&(clearTimeout(i),i=null),s=c,e.apply(d,a)):i||!1===n.trailing||(i=setTimeout((()=>{s=!1===n.leading?0:Date.now(),i=null,e.apply(d,a)}),u))}}function hookSetter(e,t,n,i,s=window){const a=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,t,a||{},!0)}function patch(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],s=n(i);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=s,()=>{e[t]=i}}catch(i){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Et=new Proxy(Et,{get:(e,t,n)=>("map"===t&&console.error(Ot),Reflect.get(e,t,n))}));let Tt=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const u=e.document;return{left:u.scrollingElement?u.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==u?void 0:u.documentElement.scrollLeft)||(null===(n=null===(t=null==u?void 0:u.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==u?void 0:u.body)||void 0===i?void 0:i.scrollLeft)||0,top:u.scrollingElement?u.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==u?void 0:u.documentElement.scrollTop)||(null===(a=null===(s=null==u?void 0:u.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==u?void 0:u.body)||void 0===c?void 0:c.scrollTop)||0}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function isBlocked(e,t,n,i){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(classMatchesRegex(s,t,i))return!0}catch(a){}if(n){if(s.matches(n))return!0;if(i&&null!==s.closest(n))return!0}return!1}function isIgnored(e,t){return t.getId(e)===_t}function isAncestorRemoved(e,t){if(isShadowRoot(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||isAncestorRemoved(e.parentNode,t))}function legacy_isTouchEvent(e){return Boolean(e.changedTouches)}function isSerializedIframe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function isSerializedStylesheet(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function hasShadowRoot(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Tt=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function getShadowHost(e){var t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function shadowHostInDom(e){const t=e.ownerDocument;if(!t)return!1;const n=function getRootShadowHost(e){let t,n=e;for(;t=getShadowHost(n);)n=t;return n}(e);return t.contains(n)}function inDom(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||shadowHostInDom(e))}var Ct=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Ct||{}),Rt=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Rt||{}),Pt=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Pt||{}),Mt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Mt||{}),Nt=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Nt||{});function isNodeInLinkedList(e){return"__ln"in e}class DoubleLinkedList{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&isNodeInLinkedList(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&isNodeInLinkedList(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const moveKey=(e,t)=>`${e}@${t}`;class MutationBuffer{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new DoubleLinkedList,getNextId=e=>{let t=e,n=_t;for(;n===_t;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},pushAdd=i=>{if(!i.parentNode||!inDom(i)||"TEXTAREA"===i.parentNode.tagName)return;const s=isShadowRoot(i.parentNode)?this.mirror.getId(getShadowHost(i)):this.mirror.getId(i.parentNode),a=getNextId(i);if(-1===s||-1===a)return n.addNode(i);const c=serializeNodeWithId(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{isSerializedIframe(e,this.mirror)&&this.iframeManager.addIframe(e),isSerializedStylesheet(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),hasShadowRoot(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)isParentRemoved(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||pushAdd(a);for(const a of this.addedSet)isAncestorInSet(this.droppedSet,a)||isParentRemoved(this.removes,a,this.mirror)?isAncestorInSet(this.movedSet,a)?pushAdd(a):this.droppedSet.add(a):pushAdd(a);let i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=getNextId(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===getNextId(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),pushAdd(e.value)}const s={texts:this.texts.map((e=>{const t=e.node;return t.parentNode&&"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!isIgnored(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;isBlocked(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:needMaskingText(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,closestElementOfNode(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let i=e.attributeName,s=e.target.getAttribute(i);if("value"===i){const e=getInputType(n);s=maskInputValue({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:s,maskInputFn:this.maskInputFn})}if(isBlocked(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let a=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===i&&!this.keepIframeSrcFn(s)){if(n.contentDocument)return;i="rr_src"}if(a||(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(e.target,a)),"type"===i&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!ignoreAttribute(n.tagName,i)&&(a.attributes[i]=transformAttribute(this.doc,toLowerCase(n.tagName),toLowerCase(i),s),"style"===i)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),s=n.style.getPropertyPriority(e);t!==i.style.getPropertyValue(e)||s!==i.style.getPropertyPriority(e)?a.styleDiff[e]=""===s?t:[t,s]:a._unchangedStyles[e]=[t,s]}for(const e of Array.from(i.style))""===n.style.getPropertyValue(e)&&(a.styleDiff[e]=!1)}break}case"childList":if(isBlocked(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),i=isShadowRoot(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);isBlocked(e.target,this.blockClass,this.blockSelector,!1)||isIgnored(t,this.mirror)||!function isSerialized(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(deepDelete(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||isAncestorRemoved(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[moveKey(n,i)]?deepDelete(this.movedSet,t):this.removes.push({parentId:i,id:n,isShadow:!(!isShadowRoot(e.target)||!isNativeShadowDom(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(isIgnored(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[moveKey(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);isBlocked(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),hasShadowRoot(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function deepDelete(e,t){e.delete(t),t.childNodes.forEach((t=>deepDelete(e,t)))}function isParentRemoved(e,t,n){return 0!==e.length&&_isParentRemoved(e,t,n)}function _isParentRemoved(e,t,n){const{parentNode:i}=t;if(!i)return!1;const s=n.getId(i);return!!e.some((e=>e.id===s))||_isParentRemoved(e,i,n)}function isAncestorInSet(e,t){return 0!==e.size&&_isAncestorInSet(e,t)}function _isAncestorInSet(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||_isAncestorInSet(e,n))}let Dt;const callbackWrapper=e=>{if(!Dt)return e;return(...t)=>{try{return e(...t)}catch(or){if(Dt&&!0===Dt(or))return;throw or}}},At=[];function getEventTarget(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function initMutationObserver(e,t){var n,i;const s=new MutationBuffer;At.push(s),s.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const c=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");c&&window[c]&&(a=window[c]);const u=new a(callbackWrapper(s.processMutations.bind(s)));return u.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),u}function initMouseInteractionObserver({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const c=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,u=[];let d=null;return Object.keys(Pt).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const l=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let u=null,l=t;if("pointerType"in a){switch(a.pointerType){case"mouse":u=Mt.Mouse;break;case"touch":u=Mt.Touch;break;case"pen":u=Mt.Pen}u===Mt.Touch?Pt[t]===Pt.MouseDown?l="TouchStart":Pt[t]===Pt.MouseUp&&(l="TouchEnd"):Mt.Pen}else legacy_isTouchEvent(a)&&(u=Mt.Touch);null!==u?(d=u,(l.startsWith("Touch")&&u===Mt.Touch||l.startsWith("Mouse")&&u===Mt.Mouse)&&(u=null)):Pt[t]===Pt.Click&&(u=d,d=null);const p=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!p)return;const h=n.getId(c),{clientX:f,clientY:m}=p;callbackWrapper(e)(Object.assign({type:Pt[l],id:h,x:f,y:m},null!==u&&{pointerType:u}))})(a);if(window.PointerEvent)switch(Pt[a]){case Pt.MouseDown:case Pt.MouseUp:c=c.replace("mouse","pointer");break;case Pt.TouchStart:case Pt.TouchEnd:return}u.push(on(c,l,t))})),callbackWrapper((()=>{u.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const c=getEventTarget(a);if(!c||isBlocked(c,i,s,!0))return;const u=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:u,x:n.left,y:n.top})}else e({id:u,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const Zt=["INPUT","TEXTAREA","SELECT"],jt=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,t){if(hasNestedCSSRule("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function getIdAndStyleId(e,t,n){let i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:i}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:t},n){var i,s,a;let c=null;c="#document"===n.nodeName?e.getId(n):e.getId(n.host);const u="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(a=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,d=(null==u?void 0:u.prototype)?Object.getOwnPropertyDescriptor(null==u?void 0:u.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&u&&d?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get(){var e;return null===(e=d.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=d.set)||void 0===n?void 0:n.call(this,e);if(null!==c&&-1!==c)try{t.adoptStyleSheets(e,c)}catch(s){}return i}}),callbackWrapper((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:d.get,set:d.set})}))):()=>{}}function initObservers(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function mergeHooks(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:c,inputCb:u,mediaInteractionCb:d,styleSheetRuleCb:l,styleDeclarationCb:p,canvasMutationCb:h,fontCb:f,selectionCb:m,customElementCb:g}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),c(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),u(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),d(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),p(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),h(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),m(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),g(...e)}}(e,t),e.recordDOM&&(i=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let c,u=[];const d=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(u.map((e=>(e.timeOffset-=n,e))),t),u=[],c=null})),a),l=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=Tt()),u.push({x:n,y:s,id:i.getId(t),timeOffset:Tt()-c}),d("undefined"!=typeof DragEvent&&e instanceof DragEvent?Rt.Drag:e instanceof MouseEvent?Rt.MouseMove:Rt.TouchMove)})),s,{trailing:!1})),p=[on("mousemove",l,n),on("touchmove",l,n),on("drag",l,n)];return callbackWrapper((()=>{p.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),u=function initViewportResizeObserver({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const t=getWindowHeight(),s=getWindowWidth();n===t&&i===s||(e({width:Number(s),height:Number(t)}),n=t,i=s)})),200)),t)}(e,{win:n}),d=function initInputObserver({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,ignoreClass:a,ignoreSelector:c,maskInputOptions:u,maskInputFn:d,sampling:l,userTriggeredOnInput:p}){function eventHandler(e){let n=getEventTarget(e);const l=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||Zt.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,m=!1;const g=getInputType(n)||"";"radio"===g||"checkbox"===g?m=n.checked:(u[h.toLowerCase()]||u[g])&&(f=maskInputValue({element:n,maskInputOptions:u,tagName:h,type:g,value:f,maskInputFn:d})),cbWithDedup(n,p?{text:f,isChecked:m,userTriggered:l}:{text:f,isChecked:m});const _=n.name;"radio"===g&&_&&m&&t.querySelectorAll(`input[type="radio"][name="${_}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,p?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}}))}function cbWithDedup(t,i){const s=jt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){jt.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===l.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),g=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...g.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),l=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:s,doc:a}){const c=callbackWrapper((a=>throttle(callbackWrapper((s=>{const c=getEventTarget(s);if(!c||isBlocked(c,t,n,!0))return;const{currentTime:u,volume:d,muted:l,playbackRate:p,loop:h}=c;e({type:a,id:i.getId(c),currentTime:u,volume:d,muted:l,playbackRate:p,loop:h})})),s.media||500))),u=[on("play",c(0),a),on("pause",c(1),a),on("seeked",c(2),a),on("volumechange",c(3),a),on("ratechange",c(4),a)];return callbackWrapper((()=>{u.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((i,s,a)=>{const[c,u]=a,{id:d,styleId:l}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||l&&-1!==l)&&e({id:d,styleId:l,adds:[{rule:c,index:u}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,u;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,removes:[{index:c}]}),i.apply(s,a)}))}),i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(u=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,replaceSync:c}),i.apply(s,a)}))}));const d={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?d.CSSGroupingRule=i.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(d.CSSMediaRule=i.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(d.CSSConditionRule=i.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(d.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(d).forEach((([i,s])=>{l[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(l[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,u]=a,{id:d,styleId:l}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(d&&-1!==d||l&&-1!==l)&&e({id:d,styleId:l,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),u||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:u,styleId:d}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||d&&-1!==d)&&e({id:u,styleId:d,removes:[{index:[...getNestedCSSRulePositions(s),c]}]}),i.apply(s,a)}))})})),callbackWrapper((()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=a,c&&(i.CSSStyleSheet.prototype.replace=c),u&&(i.CSSStyleSheet.prototype.replaceSync=u),Object.entries(d).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,c,u)=>{var d;const[l,p,h]=u;if(n.has(l))return a.apply(c,[l,p,h]);const{id:f,styleId:m}=getIdAndStyleId(null===(d=c.parentRule)||void 0===d?void 0:d.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||m&&-1!==m)&&e({id:f,styleId:m,set:{property:l,value:p,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,u)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,u)=>{var d;const[l]=u;if(n.has(l))return c.apply(a,[l]);const{id:p,styleId:h}=getIdAndStyleId(null===(d=a.parentRule)||void 0===d?void 0:d.parentStyleSheet,t,i.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,remove:{property:l},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,u)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function FontFace(e,t,n){const i=new a(e,t,n);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const c=patch(t.fonts,"add",(function(t){return function(n){return setTimeout(callbackWrapper((()=>{const t=s.get(n);t&&(e(t),s.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=a})),i.push(c),callbackWrapper((()=>{i.forEach((e=>e()))}))}(e)));const p=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const u=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const u=[],d=e.rangeCount||0;for(let t=0;t<d;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:d,endContainer:l,endOffset:p}=a;isBlocked(c,i,s,!0)||isBlocked(l,i,s,!0)||u.push({start:n.getId(c),startOffset:d,end:n.getId(l),endOffset:p})}a({ranges:u})}));return u(),on("selectionchange",u)}(e),h=function initCustomElementObserver({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?patch(n.customElements,"define",(function(e){return function(n,i,s){try{t({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,s])}})):()=>{}}(e),f=[];for(const m of e.plugins)f.push(m.observer(m.callback,n,m.options));return callbackWrapper((()=>{At.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),u(),d(),l(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),p(),h(),f.forEach((e=>e()))}))}function hasNestedCSSRule(e){return void 0!==window[e]}function canMonkeyPatchNestedCSSRule(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class CrossOriginIframeMirror{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const s=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let c=s.get(t);return c||(c=this.generateIdFn(),s.set(t,c),a.set(c,t)),c}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class IframeManager{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case Ct.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:Ct.IncrementalSnapshot,data:{source:Rt.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Ct.Meta:case Ct.Load:case Ct.DomContentLoaded:return!1;case Ct.Plugin:return t;case Ct.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Ct.IncrementalSnapshot:switch(t.data.source){case Rt.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Rt.Drag:case Rt.TouchMove:case Rt.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Rt.ViewportResize:return!1;case Rt.MediaInteraction:case Rt.MouseInteraction:case Rt.Scroll:case Rt.CanvasMutation:case Rt.Input:return this.replaceIds(t.data,e,["id"]),t;case Rt.StyleSheetRule:case Rt.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Rt.Font:return t;case Rt.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Rt.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(n,t[s]):t[s]=e.getId(n,t[s]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===pt.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class ShadowDomManager{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!isNativeShadowDom(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(initAdoptedStyleSheetObserver({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(patch(e.prototype,"attachShadow",(function(e){return function(i){const s=e.call(this,i);return this.shadowRoot&&inDom(this)&&n.addShadowRoot(this.shadowRoot,t),s}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -27,5 +27,5 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
27
27
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
28
|
PERFORMANCE OF THIS SOFTWARE.
|
|
29
29
|
***************************************************************************** */
|
|
30
|
-
function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:t,bitmap:n,width:c,height:u,dataURLOptions:d}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),u=yield c.arrayBuffer(),d=encode2(u);return s.set(i,d),d}return""}))}(c,u,d),p=new OffscreenCanvas(c,u);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(d),f=h.type,m=yield h.arrayBuffer(),g=encode2(m);if(!i.has(t)&&(yield l)===g)return i.set(t,g),a.postMessage({id:t});if(i.get(t)===g)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:g,width:c,height:u}),i.set(t,g)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,u=new Bt;u.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:Nt["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const d=1e3/e;let l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<d||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(c.get(n))return;if(0===e.width||0===e.height)return;if(c.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);u.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const u of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[u])continue;const a=patch(t.CanvasRenderingContext2D.prototype,u,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:Nt["2D"],property:u,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,u,{set(t){e(this.canvas,{type:Nt["2D"],property:u,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,Nt.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,Nt.WebGL2,e,n,i,0,t)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["type"]);return t})),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:i}),this.pendingCanvasMutations.delete(e)}}class StylesheetManager{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),i.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,t)=>({rule:stringifyRule(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:Ct()})}let $t,zt,Wt,Vt=!1;const Ht=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:u=null,maskTextClass:d="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:g,maskTextFn:_,hooks:y,packFn:v,sampling:b={},dataURLOptions:w={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:x=!1,recordCrossOriginIframes:O=!1,recordAfter:C=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:T=!1,collectFonts:R=!1,inlineImages:P=!1,plugins:N,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:Z}=e;!function registerErrorHandler(e){Dt=e}(Z);const j=!O||window.parent===window;let L=!1;if(!j)try{window.parent.document&&(L=!1)}catch(G){L=!0}if(j&&!t)throw new Error("emit function is required");void 0!==S&&void 0===b.mousemove&&(b.mousemove=S),Ht.reset();const q=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},U=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let B;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let $=0;const eventProcessor=e=>{for(const t of N||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!L&&(e=v(e)),e};$t=(e,s)=>{var a;if(!(null===(a=At[0])||void 0===a?void 0:a.isFrozen())||e.type===Tt.FullSnapshot||e.type===Tt.IncrementalSnapshot&&e.data.source===Rt.Mutation||At.forEach((e=>e.unfreeze())),j)null==t||t(eventProcessor(e),s);else if(L){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===Tt.FullSnapshot)B=e,$=0;else if(e.type===Tt.IncrementalSnapshot){if(e.data.source===Rt.Mutation&&e.data.isAttachIframe)return;$++;const t=i&&$>=i,s=n&&e.timestamp-B.timestamp>n;(t||s)&&zt(!0)}};const wrappedMutationEmit=e=>{$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.Mutation},e)}))},wrappedScrollEmit=e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.Scroll},e)})),wrappedCanvasMutationEmit=e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.CanvasMutation},e)})),z=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.AdoptedStyleSheet},e)}))}),W=new IframeManager({mirror:Ht,mutationCb:wrappedMutationEmit,stylesheetManager:z,recordCrossOriginIframes:O,wrappedEmit:$t});for(const J of N||[])J.getMirror&&J.getMirror({nodeMirror:Ht,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const H=new ProcessedNodeManager;Wt=new CanvasManager({recordCanvas:x,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:Ht,sampling:b.canvas,dataURLOptions:w});const K=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:q,dataURLOptions:w,maskTextFn:_,maskInputFn:g,recordCanvas:x,inlineImages:P,sampling:b,slimDOMOptions:U,iframeManager:W,stylesheetManager:z,canvasManager:Wt,keepIframeSrcFn:D,processedNodeManager:H},mirror:Ht});zt=(e=!1)=>{if(!I)return;$t(wrapEvent({type:Tt.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),z.reset(),K.init(),At.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,inlineImages:d=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:g,inlineImages:d,recordCanvas:l,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:Ht,blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:q,maskTextFn:_,slimDOM:U,dataURLOptions:w,recordCanvas:x,inlineImages:P,onSerialize:e=>{isSerializedIframe(e,Ht)&&W.addIframe(e),isSerializedStylesheet(e,Ht)&&z.trackLinkElement(e),hasShadowRoot(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:D});if(!t)return console.warn("Failed to snapshot the document");$t(wrapEvent({type:Tt.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),At.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,Ht.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.ViewportResize},e)})),inputCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.Input},e)})),mediaInteractionCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.MediaInteraction},e)})),styleSheetRuleCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.StyleSheetRule},e)})),styleDeclarationCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.Font},e)})),selectionCb:e=>{$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.Selection},e)}))},customElementCb:e=>{$t(wrapEvent({type:Tt.IncrementalSnapshot,data:Object.assign({source:Rt.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:u,maskTextClass:d,maskTextSelector:l,maskInputOptions:q,inlineStylesheet:p,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:P,userTriggeredOnInput:T,collectFonts:R,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:D,blockSelector:a,slimDOMOptions:U,dataURLOptions:w,mirror:Ht,iframeManager:W,stylesheetManager:z,shadowDomManager:K,processedNodeManager:H,canvasManager:Wt,ignoreCSSAttributes:A,plugins:(null===(t=null==N?void 0:N.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>$t(wrapEvent({type:Tt.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};W.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(or){console.warn(or)}}));const init2=()=>{zt(),e.push(observe(document)),Vt=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{$t(wrapEvent({type:Tt.DomContentLoaded,data:{}})),"DOMContentLoaded"===C&&init2()}))),e.push(on("load",(()=>{$t(wrapEvent({type:Tt.Load,data:{}})),"load"===C&&init2()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Vt=!1,function unregisterErrorHandler(){Dt=void 0}()}}catch(or){console.warn(or)}}record.addCustomEvent=(e,t)=>{if(!Vt)throw new Error("please add custom event after start recording");$t(wrapEvent({type:Tt.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{At.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!Vt)throw new Error("please take full snapshot after start recording");zt(e)},record.mirror=Ht;var Kt,Gt=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Gt||{}),Jt=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Jt||{}),Yt={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Xt={hostname:""};Kt={navigator:{userAgent:"",onLine:!0},document:{location:Xt,referrer:""},screen:{width:0,height:0},location:Xt}}else Kt=window;var Qt,er,tr,rr,nr,or,ir,sr,ar,cr,ur=864e5,dr=8e3,lr=Array.prototype,pr=Function.prototype,hr=Object.prototype,fr=lr.slice,mr=hr.toString,gr=hr.hasOwnProperty,_r=Kt.console,yr=Kt.navigator,vr=Kt.document,br=Kt.opera,wr=Kt.screen,kr=yr.userAgent,Sr=pr.bind,Ir=lr.forEach,xr=lr.indexOf,Or=lr.map,Er=Array.isArray,Cr={},Tr={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Rr={log:function(){if(Yt.DEBUG&&!Tr.isUndefined(_r)&&_r)try{_r.log.apply(_r,arguments)}catch(e){Tr.each(arguments,(function(e){_r.log(e)}))}},warn:function(){if(Yt.DEBUG&&!Tr.isUndefined(_r)&&_r){var e=["Mixpanel warning:"].concat(Tr.toArray(arguments));try{_r.warn.apply(_r,e)}catch(t){Tr.each(e,(function(e){_r.warn(e)}))}}},error:function(){if(Yt.DEBUG&&!Tr.isUndefined(_r)&&_r){var e=["Mixpanel error:"].concat(Tr.toArray(arguments));try{_r.error.apply(_r,e)}catch(t){Tr.each(e,(function(e){_r.error(e)}))}}},critical:function(){if(!Tr.isUndefined(_r)&&_r){var e=["Mixpanel error:"].concat(Tr.toArray(arguments));try{_r.error.apply(_r,e)}catch(t){Tr.each(e,(function(e){_r.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(Rr,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Rr.log,e),error:log_func_with_prefix(Rr.error,e),critical:log_func_with_prefix(Rr.critical,e)}};Tr.bind=function(e,t){var n,i;if(Sr&&e.bind===Sr)return Sr.apply(e,fr.call(arguments,1));if(!Tr.isFunction(e))throw new TypeError;return n=fr.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(fr.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(fr.call(arguments)));return Object(c)===c?c:a},i},Tr.each=function(e,t,n){if(null!=e)if(Ir&&e.forEach===Ir)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===Cr)return}else for(var a in e)if(gr.call(e,a)&&t.call(n,e[a],a,e)===Cr)return},Tr.extend=function(e){return Tr.each(fr.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},Tr.isArray=Er||function(e){return"[object Array]"===mr.call(e)},Tr.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},Tr.isArguments=function(e){return!(!e||!gr.call(e,"callee"))},Tr.toArray=function(e){return e?e.toArray?e.toArray():Tr.isArray(e)||Tr.isArguments(e)?fr.call(e):Tr.values(e):[]},Tr.map=function(e,t,n){if(Or&&e.map===Or)return e.map(t,n);var i=[];return Tr.each(e,(function(e){i.push(t.call(n,e))})),i},Tr.keys=function(e){var t=[];return null===e||Tr.each(e,(function(e,n){t[t.length]=n})),t},Tr.values=function(e){var t=[];return null===e||Tr.each(e,(function(e){t[t.length]=e})),t},Tr.include=function(e,t){var n=!1;return null===e?n:xr&&e.indexOf===xr?-1!=e.indexOf(t):(Tr.each(e,(function(e){if(n||(n=e===t))return Cr})),n)},Tr.includes=function(e,t){return-1!==e.indexOf(t)},Tr.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},Tr.isObject=function(e){return e===Object(e)&&!Tr.isArray(e)},Tr.isEmptyObject=function(e){if(Tr.isObject(e)){for(var t in e)if(gr.call(e,t))return!1;return!0}return!1},Tr.isUndefined=function(e){return void 0===e},Tr.isString=function(e){return"[object String]"==mr.call(e)},Tr.isDate=function(e){return"[object Date]"==mr.call(e)},Tr.isNumber=function(e){return"[object Number]"==mr.call(e)},Tr.isElement=function(e){return!(!e||1!==e.nodeType)},Tr.encodeDates=function(e){return Tr.each(e,(function(t,n){Tr.isDate(t)?e[n]=Tr.formatDate(t):Tr.isObject(t)&&(e[n]=Tr.encodeDates(t))})),e},Tr.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Tr.formatDate=function(e){function pad(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+pad(e.getUTCMonth()+1)+"-"+pad(e.getUTCDate())+"T"+pad(e.getUTCHours())+":"+pad(e.getUTCMinutes())+":"+pad(e.getUTCSeconds())},Tr.strip_empty_properties=function(e){var t={};return Tr.each(e,(function(e,n){Tr.isString(e)&&e.length>0&&(t[n]=e)})),t},Tr.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):Tr.isArray(e)?(n=[],Tr.each(e,(function(e){n.push(Tr.truncate(e,t))}))):Tr.isObject(e)?(n={},Tr.each(e,(function(e,i){n[i]=Tr.truncate(e,t)}))):n=e,n},Tr.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,u=n,d=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",d=[],"[object Array]"===mr.apply(l)){for(c=l.length,i=0;i<c;i+=1)d[i]=str(i,l)||"null";return a=0===d.length?"[]":n?"[\n"+n+d.join(",\n"+n)+"\n"+u+"]":"["+d.join(",")+"]",n=u,a}for(s in l)gr.call(l,s)&&(a=str(s,l))&&d.push(quote(s)+(n?": ":":")+a);return a=0===d.length?"{}":n?"{"+d.join(",")+u+"}":"{"+d.join(",")+"}",n=u,a}};return str("",{"":e})}}(),Tr.JSONDecode=(nr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},or=function(e){var t=new SyntaxError(e);throw t.at=Qt,t.text=tr,t},ir=function(e){return e&&e!==er&&or("Expected '"+e+"' instead of '"+er+"'"),er=tr.charAt(Qt),Qt+=1,er},sr=function(){var e,t="";for("-"===er&&(t="-",ir("-"));er>="0"&&er<="9";)t+=er,ir();if("."===er)for(t+=".";ir()&&er>="0"&&er<="9";)t+=er;if("e"===er||"E"===er)for(t+=er,ir(),"-"!==er&&"+"!==er||(t+=er,ir());er>="0"&&er<="9";)t+=er,ir();if(e=+t,isFinite(e))return e;or("Bad number")},ar=function(){var e,t,n,i="";if('"'===er)for(;ir();){if('"'===er)return ir(),i;if("\\"===er)if(ir(),"u"===er){for(n=0,t=0;t<4&&(e=parseInt(ir(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof nr[er])break;i+=nr[er]}else i+=er}or("Bad string")},cr=function(){for(;er&&er<=" ";)ir()},rr=function(){switch(cr(),er){case"{":return function(){var e,t={};if("{"===er){if(ir("{"),cr(),"}"===er)return ir("}"),t;for(;er;){if(e=ar(),cr(),ir(":"),Object.hasOwnProperty.call(t,e)&&or('Duplicate key "'+e+'"'),t[e]=rr(),cr(),"}"===er)return ir("}"),t;ir(","),cr()}}or("Bad object")}();case"[":return function(){var e=[];if("["===er){if(ir("["),cr(),"]"===er)return ir("]"),e;for(;er;){if(e.push(rr()),cr(),"]"===er)return ir("]"),e;ir(","),cr()}}or("Bad array")}();case'"':return ar();case"-":return sr();default:return er>="0"&&er<="9"?sr():function(){switch(er){case"t":return ir("t"),ir("r"),ir("u"),ir("e"),!0;case"f":return ir("f"),ir("a"),ir("l"),ir("s"),ir("e"),!1;case"n":return ir("n"),ir("u"),ir("l"),ir("l"),null}or('Unexpected "'+er+'"')}()}},function(e){var t;return tr=e,Qt=0,er=" ",t=rr(),cr(),er&&or("Syntax error"),t}),Tr.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,d=0,l="",p=[];if(!e)return e;e=Tr.utf8Encode(e);do{t=(a=e.charCodeAt(u++)<<16|e.charCodeAt(u++)<<8|e.charCodeAt(u++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[d++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(u<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},Tr.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),u=null;c<128?n++:u=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==u&&(n>t&&(a+=e.substring(t,n)),a+=u,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},Tr.UUID=function(){var T2=function(){var e,t=1*new Date;if(Kt.performance&&Kt.performance.now)e=Kt.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(wr.height*wr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=kr,i=[],s=0;function xor(e,t){var n,s=0;for(n=0;n<t.length;n++)s|=i[n]<<8*n;return e^s}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(s=xor(s,i),i=[]);return i.length>0&&(s=xor(s,i)),s.toString(16)}()+"-"+e+"-"+T2()}}();var Pr=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];Tr.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Pr.length;t++)if(-1!==e.indexOf(Pr[t]))return!0;return!1},Tr.HTTPBuildQuery=function(e,t){var n,i,s=[];return Tr.isUndefined(t)&&(t="&"),Tr.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},Tr.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(s){Rr.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},Tr.cookie={get:function(e){for(var t=e+"=",n=vr.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}return null},parse:function(e){var t;try{t=Tr.JSONDecode(Tr.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(vr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),vr.cookie=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l},set:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(vr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l;return vr.cookie=f,f},remove:function(e,t,n){Tr.cookie.set(e,"",-1,t,!1,!1,n)}};var Mr=null,localStorageSupported=function(e,t){if(null!==Mr&&!t)return Mr;var n=!0;try{e=e||window.localStorage;var i="__mplss_"+cheap_guid(8);e.setItem(i,"xyz"),"xyz"!==e.getItem(i)&&(n=!1),e.removeItem(i)}catch(s){n=!1}return Mr=n,n};Tr.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||Rr.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){Rr.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){Tr.localStorage.error(t)}return null},parse:function(e){try{return Tr.JSONDecode(Tr.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){Tr.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){Tr.localStorage.error(t)}}},Tr.register_event=function(){function fixEvent(e){return e&&(e.preventDefault=fixEvent.preventDefault,e.stopPropagation=fixEvent.stopPropagation),e}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(e,t,n,i,s){if(e)if(e.addEventListener&&!i)e.addEventListener(t,n,!!s);else{var a="on"+t,c=e[a];e[a]=function makeHandler(e,t,n){var handler=function(i){if(i=i||fixEvent(window.event)){var s,a,c=!0;return Tr.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else Rr.error("No valid element provided to register_event")}}();var Nr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Tr.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(t,n){var i=" "+n+" ";return(" "+t.className+" ").replace(e," ").indexOf(i)>=0}function getElementsBySelector(e){if(!vr.getElementsByTagName)return[];var t,n,i,s,a,c,u,d,l,p,h=e.split(" "),f=[vr];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var m=n[1],g=vr.getElementById(m);if(!g||i&&g.nodeName.toLowerCase()!=i)return[];f=[g]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var _=n[1];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];for(f=[],p=0,u=0;u<s.length;u++)s[u].className&&Tr.isString(s[u].className)&&hasClass(s[u],_)&&(f[p++]=s[u])}else{var y=t.match(Nr);if(y){i=y[1];var v,b=y[2],w=y[3],S=y[4];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];switch(f=[],p=0,w){case"=":v=function(e){return e.getAttribute(b)==S};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+S+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+S+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(S)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(S)==e.getAttribute(b).length-S.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(S)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,u=0;u<s.length;u++)v(s[u])&&(f[p++]=s[u])}else{for(i=t,s=[],a=0,u=0;u<f.length;u++)for(l=f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];f=s}}return f}return function(e){return Tr.isElement(e)?[e]:Tr.isObject(e)&&!Tr.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Dr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Ar=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Tr.info={campaignParams:function(e){var t="",n={};return Tr.each(Dr,(function(i){(t=Tr.getQueryParam(vr.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return Tr.each(Ar,(function(n){(e=Tr.getQueryParam(vr.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return Tr.extend(Tr.info.campaignParams(),Tr.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var t=Tr.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=Tr.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||Tr.includes(e," OPR/")?Tr.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Tr.includes(e,"IEMobile")||Tr.includes(e,"WPDesktop")?"Internet Explorer Mobile":Tr.includes(e,"SamsungBrowser/")?"Samsung Internet":Tr.includes(e,"Edge")||Tr.includes(e,"Edg/")?"Microsoft Edge":Tr.includes(e,"FBIOS")?"Facebook Mobile":Tr.includes(e,"Chrome")?"Chrome":Tr.includes(e,"CriOS")?"Chrome iOS":Tr.includes(e,"UCWEB")||Tr.includes(e,"UCBrowser")?"UC Browser":Tr.includes(e,"FxiOS")?"Firefox iOS":Tr.includes(t,"Apple")?Tr.includes(e,"Mobile")?"Mobile Safari":"Safari":Tr.includes(e,"Android")?"Android Mobile":Tr.includes(e,"Konqueror")?"Konqueror":Tr.includes(e,"Firefox")?"Firefox":Tr.includes(e,"MSIE")||Tr.includes(e,"Trident/")?"Internet Explorer":Tr.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[Tr.info.browser(e,t,n)];if(void 0===i)return null;var s=e.match(i);return s?parseFloat(s[s.length-2]):null},os:function(){var e=kr;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return Kt.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Tr.extend(Tr.strip_empty_properties({$os:Tr.info.os(),$browser:Tr.info.browser(kr,yr.vendor,br),$referrer:vr.referrer,$referring_domain:Tr.info.referringDomain(vr.referrer),$device:Tr.info.device(kr)}),{$current_url:Tr.info.currentUrl(),$browser_version:Tr.info.browserVersion(kr,yr.vendor,br),$screen_height:wr.height,$screen_width:wr.width,mp_lib:"web",$lib_version:Yt.LIB_VERSION,$insert_id:cheap_guid(),time:Tr.timestamp()/1e3},Tr.strip_empty_properties(e))},people_properties:function(){return Tr.extend(Tr.strip_empty_properties({$os:Tr.info.os(),$browser:Tr.info.browser(kr,yr.vendor,br)}),{$browser_version:Tr.info.browserVersion(kr,yr.vendor,br)})},mpPageViewProperties:function(){return Tr.strip_empty_properties({current_page_title:vr.title,current_domain:Kt.location.hostname,current_url_path:Kt.location.pathname,current_url_protocol:Kt.location.protocol,current_url_search:Kt.location.search})}};var cheap_guid=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},Zr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,jr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=jr,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Zr);var s=e.match(t);return s?s[0]:""},Lr=null,qr=null;"undefined"!=typeof JSON&&(Lr=JSON.stringify,qr=JSON.parse),Lr=Lr||Tr.JSONEncode,qr=qr||Tr.JSONDecode,Tr.toArray=Tr.toArray,Tr.isObject=Tr.isObject,Tr.JSONEncode=Tr.JSONEncode,Tr.JSONDecode=Tr.JSONDecode,Tr.isBlockedUA=Tr.isBlockedUA,Tr.isEmptyObject=Tr.isEmptyObject,Tr.info=Tr.info,Tr.info.device=Tr.info.device,Tr.info.browser=Tr.info.browser,Tr.info.browserVersion=Tr.info.browserVersion,Tr.info.properties=Tr.info.properties;var Ur="__mp_opt_in_out_";function optIn(e,t){_optInOut(!0,e,t)}function optOut(e,t){_optInOut(!1,e,t)}function hasOptedIn(e,t){return"1"===_getStorageValue(e,t)}function hasOptedOut(e,t){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||Kt,n=t.navigator||{},i=!1;return Tr.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){Tr.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return Rr.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n="0"===_getStorageValue(e,t);return n&&Rr.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function addOptOutCheckMixpanelLib(e){return _addOptOutCheck(e,(function(e){return this.get_config(e)}))}function addOptOutCheckMixpanelPeople(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function addOptOutCheckMixpanelGroup(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function clearOptInOut(e,t){_getStorage(t=t||{}).remove(_getStorageKey(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?Tr.localStorage:Tr.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Ur)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){Tr.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,Tr.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})):Rr.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:u}))}catch(l){Rr.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var d=arguments[arguments.length-1];"function"==typeof d&&d(0)}}var Fr=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,u=this.timeoutMS,d=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>u)return Fr.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),d.removeItem(h),d.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=d.getItem(p);if(e&&e!==i)return!1;if(d.setItem(p,i),d.getItem(p)===i)return!0;if(!localStorageSupported(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){d.setItem(l,i),waitFor(getSetY,(function(){d.getItem(l)!==i?delay((function(){d.getItem(p)===i?waitFor((function(){return!d.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){d.setItem(h,"1");try{e()}finally{d.removeItem(h),d.getItem(p)===i&&d.removeItem(p),d.getItem(l)===i&&d.removeItem(l)}};try{if(!localStorageSupported(d,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var Br=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||Tr.bind(Br.error,Br),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=t.usePersistence,this.pid=t.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,t,n){var i={id:cheap_guid(),flushAfter:(new Date).getTime()+2*t,payload:e};this.usePersistence?this.lock.withLock(Tr.bind((function lockAcquired(){var t;try{var s=this.readFromStorage();s.push(i),(t=this.saveToStorage(s))&&this.memQueue.push(i)}catch(a){this.reportError("Error enqueueing item",e),t=!1}n&&n(t)}),this),Tr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),n&&n(!1)}),this),this.pid):(this.memQueue.push(i),n&&n(!0))},RequestQueue.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);if(this.usePersistence&&t.length<e){var n=this.readFromStorage();if(n.length){var i={};Tr.each(t,(function(e){i[e.id]=!0}));for(var s=0;s<n.length;s++){var a=n[s];if((new Date).getTime()>a.flushAfter&&!i[a.id]&&(a.orphaned=!0,t.push(a),t.length>=e))break}}}return t};var filterOutIDsAndInvalid=function(e,t){var n=[];return Tr.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(Tr.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=Tr.bind((function(){var t;try{var i=this.readFromStorage();if(i=filterOutIDsAndInvalid(i,n),t=this.saveToStorage(i)){i=this.readFromStorage();for(var s=0;s<i.length;s++){var a=i[s];if(a.id&&n[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(c){this.reportError("Error removing items",e),t=!1}return t}),this);this.lock.withLock((function lockAcquired(){var e=i();t&&t(e)}),Tr.bind((function lockFailure(e){var n=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(n=i()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}t&&t(n)}),this),this.pid)}else t&&t(!0)};var updatePayloads=function(e,t){var n=[];return Tr.each(e,(function(e){var i=e.id;if(i in t){var s=t[i];null!==s&&(e.payload=s,n.push(e))}else n.push(e)})),n};RequestQueue.prototype.updatePayloads=function(e,t){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(Tr.bind((function lockAcquired(){var n;try{var i=this.readFromStorage();i=updatePayloads(i,e),n=this.saveToStorage(i)}catch(s){this.reportError("Error updating items",e),n=!1}t&&t(n)}),this),Tr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),t&&t(!1)}),this),this.pid):t&&t(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=qr(e),Tr.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(t){this.reportError("Error retrieving queue",t),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,Lr(e)),!0}catch(t){return this.reportError("Error saving queue",t),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var $r=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:Tr.bind(this.reportError,this),storage:t.storage,usePersistence:t.usePersistence}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,t){this.queue.enqueue(e,this.flushInterval,t)},RequestBatcher.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},RequestBatcher.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},RequestBatcher.prototype.clear=function(){this.queue.clear()},RequestBatcher.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},RequestBatcher.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},RequestBatcher.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(Tr.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void $r.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],u={};if(Tr.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=Tr.extend({},t.properties,{mp_sent_by_lib_version:Yt.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}u[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var d=Tr.bind((function(c){this.requestInProgress=!1;try{var d=!1;if(e.unloading)this.queue.updatePayloads(u);else if(Tr.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(Tr.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=Kt.navigator.onLine,!Tr.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(Tr.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),d=!0;else d=!0;d&&(this.queue.removeItemsByID(Tr.map(s,(function(e){return e.id})),Tr.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!a?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())}),this)),Tr.each(s,Tr.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),$r.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if($r.error.apply($r.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){$r.error(n)}};var zr=console_with_prefix("recorder"),Wr=Kt.CompressionStream,Vr={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},Hr=new Set([Jt.MouseMove,Jt.MouseInteraction,Jt.Scroll,Jt.ViewportResize,Jt.Input,Jt.TouchMove,Jt.MediaInteraction,Jt.Drag,Jt.Selection]);var MixpanelRecorder=function(e){this._mixpanel=e,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=ur,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:Vr,sendRequestFunc:Tr.bind(this.flushEventsWithOptOut,this),errorReporter:Tr.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},MixpanelRecorder.prototype.get_config=function(e){return this._mixpanel.get_config(e)},MixpanelRecorder.prototype.startRecording=function(e){if(null===this._stopRecording){this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>ur&&(this.recordMaxMs=ur,zr.critical("record_max_ms cannot be greater than "+ur+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>dr&&(this.recordMinMs=dr,zr.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=Tr.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=Tr.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(Tr.bind((function(){zr.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),n=this.get_config("record_block_selector");""!==n&&null!==n||(n=void 0),this._stopRecording=record({emit:Tr.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===Gt.IncrementalSnapshot&&Hr.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())}),this),blockClass:this.get_config("record_block_class"),blockSelector:n,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),t(),this.maxTimeoutId=setTimeout(Tr.bind(this.resetRecording,this),this.recordMaxMs)}else zr.log("Recording already in progress, skipping startRecording.")},MixpanelRecorder.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},MixpanelRecorder.prototype.stopRecording=function(){null!==this._stopRecording&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},MixpanelRecorder.prototype.flushEventsWithOptOut=function(e,t,n){this._flushEvents(e,t,n,Tr.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,t,n,i){var s=Tr.bind((function(t,n){200===t.status&&this.replayId===e&&this.seqNo++,i({status:0,httpStatusCode:t.status,responseBody:n,retryAfter:t.headers.get("Retry-After")})}),this);Kt.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>0){var s=this.replayId,a=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=a);var c=e[i-1].timestamp-this.replayStartTime,u={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},d=Tr.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(u.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(u.$user_id=p),Wr){var h=new Blob([d],{type:"application/json"}).stream().pipeThrough(new Wr("gzip"));new Response(h).blob().then(Tr.bind((function(e){u.format="gzip",this._sendRequest(s,u,e,n)}),this))}else u.format="body",this._sendRequest(s,u,d,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){zr.error.apply(zr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){zr.error(n)}},Kt.__mp_recorder=MixpanelRecorder;var DomTracker=function(){};DomTracker.prototype.create_properties=function(){},DomTracker.prototype.event_handler=function(){},DomTracker.prototype.after_track_handler=function(){},DomTracker.prototype.init=function(e){return this.mp=e,this},DomTracker.prototype.track=function(e,t,n,i){var s=this,a=Tr.dom_query(e);if(0!==a.length)return Tr.each(a,(function(e){Tr.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),u=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),u),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;Rr.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,t,n,i){i=i||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,e&&!1===e(i,t)||s.after_track_handler(t,n,i))}},DomTracker.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):Tr.extend({},e)};var LinkTracker=function(){this.override_event="click"};Tr.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,t){var n=LinkTracker.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},LinkTracker.prototype.event_handler=function(e,t,n){n.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,n.href=t.href,n.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout((function(){window.location=t.href}),0)};var FormTracker=function(){this.override_event="submit"};Tr.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,t){setTimeout((function(){t.element.submit()}),0)};var Kr="$set",Gr="$set_once",Jr="$unset",Yr="$add",Xr="$append",Qr="$union",en="$remove",tn={set_action:function(e,t){var n={},i={};return Tr.isObject(e)?Tr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Kr]=i,n},unset_action:function(e){var t={},n=[];return Tr.isArray(e)||(e=[e]),Tr.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[Jr]=n,t},set_once_action:function(e,t){var n={},i={};return Tr.isObject(e)?Tr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Gr]=i,n},union_action:function(e,t){var n={},i={};return Tr.isObject(e)?Tr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=Tr.isArray(e)?e:[e])}),this):i[e]=Tr.isArray(t)?t:[t],n[Qr]=i,n},append_action:function(e,t){var n={},i={};return Tr.isObject(e)?Tr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Xr]=i,n},remove_action:function(e,t){var n={},i={};return Tr.isObject(e)?Tr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[en]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Tr.extend(MixpanelGroup.prototype,tn),MixpanelGroup.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_action(e,t);return Tr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_once_action(e,t);return Tr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,t,n){Tr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var t=this.delete_action();return this._send_request(t,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=Tr.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},MixpanelGroup.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},MixpanelGroup.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelGroup.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},MixpanelGroup.prototype.remove=MixpanelGroup.prototype.remove,MixpanelGroup.prototype.set=MixpanelGroup.prototype.set,MixpanelGroup.prototype.set_once=MixpanelGroup.prototype.set_once,MixpanelGroup.prototype.union=MixpanelGroup.prototype.union,MixpanelGroup.prototype.unset=MixpanelGroup.prototype.unset,MixpanelGroup.prototype.toString=MixpanelGroup.prototype.toString;var MixpanelPeople=function(){};Tr.extend(MixpanelPeople.prototype,tn),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return Tr.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[Kr]=Tr.extend({},Tr.info.people_properties(),i[Kr]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return Tr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,t,n){var i={},s={};return Tr.isObject(e)?(Tr.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void Rr.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(Tr.isUndefined(t)&&(t=1),s[e]=t),i[Yr]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){Tr.isObject(e)&&(n=t);var i=this.append_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,t,n){Tr.isObject(e)&&(n=t);var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,t,n){Tr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,t,n){if(Tr.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",Tr.extend({$amount:e},t),n);Rr.error("Invalid value passed to mixpanel.people.track_charge - must be a number")})),MixpanelPeople.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},MixpanelPeople.prototype.delete_user=function(){if(this._identify_called()){var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)}Rr.error("mixpanel.people.delete_user() requires you to call identify() first")},MixpanelPeople.prototype.toString=function(){return this._mixpanel.toString()+".people"},MixpanelPeople.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),i&&(e.$user_id=i),s&&(e.$had_persisted_distinct_id=s);var a=Tr.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:a,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),Tr.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),Tr.truncate(a,255))},MixpanelPeople.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(e){Kr in e?this._mixpanel.persistence._add_to_people_queue(Kr,e):Gr in e?this._mixpanel.persistence._add_to_people_queue(Gr,e):Jr in e?this._mixpanel.persistence._add_to_people_queue(Jr,e):Yr in e?this._mixpanel.persistence._add_to_people_queue(Yr,e):Xr in e?this._mixpanel.persistence._add_to_people_queue(Xr,e):en in e?this._mixpanel.persistence._add_to_people_queue(en,e):Qr in e?this._mixpanel.persistence._add_to_people_queue(Qr,e):Rr.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=Tr.extend({},this._mixpanel.persistence.load_queue(e)),c=a;Tr.isUndefined(a)||!Tr.isObject(a)||Tr.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),i&&(c=i(a)),t.call(s,c,(function(t,i){0===t&&s._mixpanel.persistence._add_to_people_queue(e,a),Tr.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var u=this;this._flush_one_queue(Kr,this.set,e),this._flush_one_queue(Gr,this.set_once,i),this._flush_one_queue(Jr,this.unset,a,(function(e){return Tr.keys(e)})),this._flush_one_queue(Yr,this.increment,t),this._flush_one_queue(Qr,this.union,s);var d=this._mixpanel.persistence.load_queue(Xr);if(!Tr.isUndefined(d)&&Tr.isArray(d)&&d.length)for(var l,append_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(Xr,l),Tr.isUndefined(n)||n(e,t)},p=d.length-1;p>=0;p--)d=this._mixpanel.persistence.load_queue(Xr),l=d.pop(),u._mixpanel.persistence.save(),Tr.isEmptyObject(l)||u.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(en);if(!Tr.isUndefined(h)&&Tr.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(en,f),Tr.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(en),f=h.pop(),u._mixpanel.persistence.save(),Tr.isEmptyObject(f)||u.remove(f,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var rn,nn="__mps",sn="__mpso",an="__mpus",cn="__mpa",un="__mpap",dn="__mpr",ln="__mpu",pn="$people_distinct_id",hn="__alias",fn="__timers",mn=[nn,sn,an,cn,un,dn,ln,pn,hn,fn],MixpanelPersistence=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(Rr.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&Tr.localStorage.is_supported()?this.storage=Tr.localStorage:this.storage=Tr.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),Tr.each(this.props,(function(t,n){Tr.include(mn,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Tr.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===Tr.localStorage?(e=Tr.cookie.parse(this.name),Tr.cookie.remove(this.name),Tr.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Tr.cookie&&(t=Tr.localStorage.parse(this.name),Tr.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,Tr.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(e){return this.load(),this.props[e]},MixpanelPersistence.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},MixpanelPersistence.prototype.clear=function(){this.remove(),this.props={}},MixpanelPersistence.prototype.register_once=function(e,t,n){return!!Tr.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),Tr.each(e,(function(e,n){this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,t){return!!Tr.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),Tr.extend(this.props,e),this.save(),!0)},MixpanelPersistence.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},MixpanelPersistence.prototype.update_search_keyword=function(e){this.register(Tr.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Tr.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return Tr.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},MixpanelPersistence.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),i=t[e],s=this._get_or_create_queue(Kr),a=this._get_or_create_queue(Gr),c=this._get_or_create_queue(Jr),u=this._get_or_create_queue(Yr),d=this._get_or_create_queue(Qr),l=this._get_or_create_queue(en,[]),p=this._get_or_create_queue(Xr,[]);n===nn?(Tr.extend(s,i),this._pop_from_people_queue(Yr,i),this._pop_from_people_queue(Qr,i),this._pop_from_people_queue(Jr,i)):n===sn?(Tr.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(Jr,i)):n===an?Tr.each(i,(function(e){Tr.each([s,a,u,d],(function(t){e in t&&delete t[e]})),Tr.each(p,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===cn?(Tr.each(i,(function(e,t){t in s?s[t]+=e:(t in u||(u[t]=0),u[t]+=e)}),this),this._pop_from_people_queue(Jr,i)):n===ln?(Tr.each(i,(function(e,t){Tr.isArray(e)&&(t in d||(d[t]=[]),d[t]=d[t].concat(e))})),this._pop_from_people_queue(Jr,i)):n===dn?(l.push(i),this._pop_from_people_queue(Xr,i)):n===un&&(p.push(i),this._pop_from_people_queue(Jr,i)),Rr.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Rr.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];Tr.isUndefined(n)||Tr.each(t,(function(t,i){e===Xr||e===en?Tr.each(n,(function(e){e[i]===t&&delete e[i]})):delete n[i]}),this)},MixpanelPersistence.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},MixpanelPersistence.prototype._get_queue_key=function(e){return e===Kr?nn:e===Gr?sn:e===Jr?an:e===Yr?cn:e===Xr?un:e===en?dn:e===Qr?ln:void Rr.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=Tr.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(fn)||{};n[e]=t,this.props[fn]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(fn)||{})[e];return Tr.isUndefined(t)||(delete this.props[fn][e],this.save()),t};var gn,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},_n="mixpanel",yn="base64",vn="$device:",bn=Kt.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,wn=!bn&&-1===kr.indexOf("MSIE")&&-1===kr.indexOf("Mozilla"),kn=null;yr.sendBeacon&&(kn=function(){return yr.sendBeacon.apply(yr,arguments)});var Sn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},In={api_host:"https://api-js.mixpanel.com",api_routes:Sn,api_method:"POST",api_transport:"XHR",api_payload_format:yn,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:NOOP_FUNC,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:NOOP_FUNC,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:18e5,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:ur,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},xn=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===_n?gn:gn[n];if(s&&0===rn)i=s;else{if(s&&!Tr.isArray(s))return void Rr.error("You have already initialized "+n);i=new MixpanelLib}if(i._cached_groups={},i._init(e,t,n),i.people=new MixpanelPeople,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var a=Tr.info.campaignParams(null),c={},u=!1;Tr.each(a,(function(e,t){c["initial_"+t]=e,e&&(u=!0)})),u&&i.people.set_once(c)}return Yt.DEBUG=Yt.DEBUG||i.get_config("debug"),!Tr.isUndefined(s)&&Tr.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(Tr.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==_n){var i=create_mplib(e,t,n);return gn[n]=i,i._loaded(),i}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var i={};"api_payload_format"in t||(t.api_host||In.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(Tr.extend({},In,i,t,{name:n,token:e,callback_fn:(n===_n?n:_n+"."+n)+"._jsc"})),this._jsc=NOOP_FUNC,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(Tr.localStorage.is_supported(!0)&&bn){if(this.init_batchers(),kn&&Kt.addEventListener){var s=Tr.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);Kt.addEventListener("pagehide",(function(e){e.persisted&&s()})),Kt.addEventListener("visibilitychange",(function(){"hidden"===vr.visibilityState&&s()}))}}else this._batch_requests=!1,Rr.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Tr.each(this.get_batcher_configs(),(function(e){Rr.log("Clearing batch queue "+e.queue_key),Tr.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=Tr.UUID();this.get_distinct_id()||this.register_once({distinct_id:vn+a,$device_id:a},"");var c=this.get_config("track_pageview");c&&this._init_url_change_tracking(c),this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent")&&this.start_session_recording()},MixpanelLib.prototype.start_session_recording=addOptOutCheckMixpanelLib((function(){if(Kt.MutationObserver){var e=Tr.bind((function(){this._recorder=this._recorder||new Kt.__mp_recorder(this),this._recorder.startRecording()}),this);Tr.isUndefined(Kt.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Rr.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Rr.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var t=this._recorder.replayId;t&&(e.$mp_replay_id=t)}return e},MixpanelLib.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=Tr.info.campaignParams(null);Tr.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(vr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Tr.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(vr.referrer)},MixpanelLib.prototype._dom_loaded=function(){Tr.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||Tr.each(this.__request_queue,(function(e){this._send_request.apply(this,e)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!xn)return this.__dom_loaded_queue.push([e,t]),!1;var n=(new e).init(this);return n.track.apply(n,t)},MixpanelLib.prototype._init_url_change_tracking=function(e){var t="";if(this.track_pageview()&&(t=Tr.info.currentUrl()),Tr.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){Kt.addEventListener("popstate",(function(){Kt.dispatchEvent(new Event("mp_locationchange"))})),Kt.addEventListener("hashchange",(function(){Kt.dispatchEvent(new Event("mp_locationchange"))}));var n=Kt.history.pushState;"function"==typeof n&&(Kt.history.pushState=function(e,t,i){n.call(Kt.history,e,t,i),Kt.dispatchEvent(new Event("mp_locationchange"))});var i=Kt.history.replaceState;"function"==typeof i&&(Kt.history.replaceState=function(e,t,n){i.call(Kt.history,e,t,n),Kt.dispatchEvent(new Event("mp_locationchange"))}),Kt.addEventListener("mp_locationchange",function(){var n=Tr.info.currentUrl(),i=!1;("full-url"===e?i=n!==t:"url-with-path-and-query-string"===e?i=n.split("#")[0]!==t.split("#")[0]:"url-with-path"===e&&(i=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0]),i)&&(this.track_pageview()&&(t=n))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,t){if(Tr.isUndefined(e))return null;if(bn){return function(n){e(n,t)}}var n=this._jsc,i=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(s){delete n[i],e(s,t)},s},MixpanelLib.prototype._send_request=function(e,t,n,i){var s=!0;if(wn)return this.__request_queue.push(arguments),s;var a={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},c=null;i||!Tr.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=Tr.extend(a,n||{}),bn||(n.method="GET");var u="POST"===n.method,d=kn&&u&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),bn||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),u&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+Tr.HTTPBuildQuery(t);var p=this;if("img"in t){var h=vr.createElement("img");h.src=e,vr.body.appendChild(h)}else if(d){try{s=kn(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(bn)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(u&&(m["Content-Type"]="application/x-www-form-urlencoded"),Tr.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var g=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=Tr.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-g>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var _=vr.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var y=vr.getElementsByTagName("script")[0];y.parentNode.insertBefore(_,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];Tr.each(e,(function(e){e&&(t=e[0],Tr.isArray(t)?s.push(e):"function"==typeof e?e.call(this):Tr.isArray(e)&&"alias"===t?n.push(e):Tr.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){Tr.each(e,(function(e){if(Tr.isArray(e[0])){var n=t;Tr.each(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};execute(n,this),execute(i,this),execute(s,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=Tr.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Tr.bind((function(t,n,i){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(t),n,this._prepare_callback(i,t))}),this),beforeSendHook:Tr.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:Tr.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},MixpanelLib.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,Tr.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,Tr.each(this.request_batchers,(function(e){e.stop(),e.clear()}))},MixpanelLib.prototype.push=function(e){this._execute_array([e])},MixpanelLib.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},MixpanelLib.prototype._encode_data_for_request=function(e){var t=Tr.JSONEncode(e);return this.get_config("api_payload_format")===yn&&(t=Tr.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=Tr.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var u=!0,d=Tr.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Rr.log("MIXPANEL REQUEST:"),Rr.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):d()})):u=d(),u&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),Tr.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=Tr.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!Tr.isUndefined(c)){var u=(new Date).getTime()-c;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?Tr.info.marketingParams():{};t=Tr.extend({},Tr.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var l=this.get_config("property_blacklist");Tr.isArray(l)?Tr.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){Tr.isArray(t)||(t=[t]);var i={};return i[e]=t,this.register(i),this.people.set(e,t,n)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e),s={};return void 0===i?(s[e]=[t],this.register(s)):-1===i.indexOf(t)&&(i.push(t),s[e]=i,this.register(s)),this.people.union(e,t,n)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e);if(void 0!==i){var s=i.indexOf(t);s>-1&&(i.splice(s,1),this.register({group_key:i})),0===i.length&&this.unregister(e)}return this.people.remove(e,t,n)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,t,n,i){var s=Tr.extend({},t||{});return Tr.each(n,(function(e,t){null!=e&&(s[t]=e)})),this.track(e,s,i)})),MixpanelLib.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},MixpanelLib.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},MixpanelLib.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),i=this._cached_groups[n];return void 0!==i&&i._group_key===e&&i._group_id===t||((i=new MixpanelGroup)._init(this,e,t),this._cached_groups[n]=i),i},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,t){"object"!=typeof e&&(e={});var n=(t=t||{}).event_name||"$mp_web_page_view",i=Tr.extend(Tr.info.mpPageViewProperties(),Tr.info.campaignParams(),Tr.info.clickParams()),s=Tr.extend({},i,e);return this.track(n,s)})),MixpanelLib.prototype.track_links=function(){return this._track_dom.call(this,LinkTracker,arguments)},MixpanelLib.prototype.track_forms=function(){return this._track_dom.call(this,FormTracker,arguments)},MixpanelLib.prototype.time_event=function(e){Tr.isUndefined(e)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(e)||this.persistence.set_event_timer(e,(new Date).getTime())};var On={persistent:!0},options_for_register=function(e){var t;return t=Tr.isObject(e)?e:Tr.isUndefined(e)?{}:{days:e},Tr.extend({},On,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):Tr.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,t,n){var i=options_for_register(n);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),Tr.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,u){var d=this.get_distinct_id();if(e&&d!==e){if("string"==typeof e&&0===e.indexOf(vn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==d&&e!==this.get_property(hn)&&(this.unregister(hn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,u),e!==d&&this.track("$identify",{distinct_id:e,$anon_distinct_id:d},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=Tr.UUID();this.register_once({distinct_id:vn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,t){if(e===this.get_property(pn))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return Tr.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(hn,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},(function(){n.identify(e)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},MixpanelLib.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},MixpanelLib.prototype.set_config=function(e){Tr.isObject(e)&&(Tr.extend(this.config,e),e.batch_size&&Tr.each(this.request_batchers,(function(e){e.resetBatchSize()})),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),Yt.DEBUG=Yt.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var t=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,fr.call(arguments,1));return void 0===t&&(this.report_error(e+" hook did not return a value"),t=null),t},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==_n&&(e=_n+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return Tr.isBlockedUA(kr)||this._flags.disable_all_events||Tr.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Tr.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_tracking()||!this.get_config("opt_out_tracking_by_default")&&!Tr.cookie.get("mp_optout")||(Tr.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,t){return t=Tr.extend({track:Tr.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),Tr.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=Tr.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=Tr.extend({clear_persistence:!0,delete_user:!0},e)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(optOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(hasOptedIn,e)},MixpanelLib.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(hasOptedOut,e)},MixpanelLib.prototype.clear_opt_in_out_tracking=function(e){e=Tr.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){Rr.error.apply(Rr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Rr.error(n)}},MixpanelLib.prototype.init=MixpanelLib.prototype.init,MixpanelLib.prototype.reset=MixpanelLib.prototype.reset,MixpanelLib.prototype.disable=MixpanelLib.prototype.disable,MixpanelLib.prototype.time_event=MixpanelLib.prototype.time_event,MixpanelLib.prototype.track=MixpanelLib.prototype.track,MixpanelLib.prototype.track_links=MixpanelLib.prototype.track_links,MixpanelLib.prototype.track_forms=MixpanelLib.prototype.track_forms,MixpanelLib.prototype.track_pageview=MixpanelLib.prototype.track_pageview,MixpanelLib.prototype.register=MixpanelLib.prototype.register,MixpanelLib.prototype.register_once=MixpanelLib.prototype.register_once,MixpanelLib.prototype.unregister=MixpanelLib.prototype.unregister,MixpanelLib.prototype.identify=MixpanelLib.prototype.identify,MixpanelLib.prototype.alias=MixpanelLib.prototype.alias,MixpanelLib.prototype.name_tag=MixpanelLib.prototype.name_tag,MixpanelLib.prototype.set_config=MixpanelLib.prototype.set_config,MixpanelLib.prototype.get_config=MixpanelLib.prototype.get_config,MixpanelLib.prototype.get_property=MixpanelLib.prototype.get_property,MixpanelLib.prototype.get_distinct_id=MixpanelLib.prototype.get_distinct_id,MixpanelLib.prototype.toString=MixpanelLib.prototype.toString,MixpanelLib.prototype.opt_out_tracking=MixpanelLib.prototype.opt_out_tracking,MixpanelLib.prototype.opt_in_tracking=MixpanelLib.prototype.opt_in_tracking,MixpanelLib.prototype.has_opted_out_tracking=MixpanelLib.prototype.has_opted_out_tracking,MixpanelLib.prototype.has_opted_in_tracking=MixpanelLib.prototype.has_opted_in_tracking,MixpanelLib.prototype.clear_opt_in_out_tracking=MixpanelLib.prototype.clear_opt_in_out_tracking,MixpanelLib.prototype.get_group=MixpanelLib.prototype.get_group,MixpanelLib.prototype.set_group=MixpanelLib.prototype.set_group,MixpanelLib.prototype.add_group=MixpanelLib.prototype.add_group,MixpanelLib.prototype.remove_group=MixpanelLib.prototype.remove_group,MixpanelLib.prototype.track_with_groups=MixpanelLib.prototype.track_with_groups,MixpanelLib.prototype.start_batch_senders=MixpanelLib.prototype.start_batch_senders,MixpanelLib.prototype.stop_batch_senders=MixpanelLib.prototype.stop_batch_senders,MixpanelLib.prototype.start_session_recording=MixpanelLib.prototype.start_session_recording,MixpanelLib.prototype.stop_session_recording=MixpanelLib.prototype.stop_session_recording,MixpanelLib.prototype.get_session_recording_properties=MixpanelLib.prototype.get_session_recording_properties,MixpanelLib.prototype.DEFAULT_API_ROUTES=Sn,MixpanelPersistence.prototype.properties=MixpanelPersistence.prototype.properties,MixpanelPersistence.prototype.update_search_keyword=MixpanelPersistence.prototype.update_search_keyword,MixpanelPersistence.prototype.update_referrer_info=MixpanelPersistence.prototype.update_referrer_info,MixpanelPersistence.prototype.get_cross_subdomain=MixpanelPersistence.prototype.get_cross_subdomain,MixpanelPersistence.prototype.clear=MixpanelPersistence.prototype.clear;var En={},override_mp_init_func=function(){gn.init=function(e,t,n){if(n)return gn[n]||(gn[n]=En[n]=create_mplib(e,t,n),gn[n]._loaded()),gn[n];var i=gn;En[_n]?i=En[_n]:e&&((i=create_mplib(e,t,_n))._loaded(),En[_n]=i),gn=i,1===rn&&(Kt[_n]=gn),Tr.each(En,(function(e,t){t!==_n&&(gn[t]=e)})),gn._=Tr}};var Cn=function init_as_module(e){return load_extra_bundle=e,rn=0,gn=new MixpanelLib,override_mp_init_func(),gn.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,xn=!0,wn=!1,Tr.each(En,(function(e){e._dom_loaded()})))}if(vr.addEventListener)"complete"===vr.readyState?dom_loaded_handler():vr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(vr.attachEvent){vr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===Kt.frameElement}catch(t){}vr.documentElement.doScroll&&e&&function do_scroll_check(){try{vr.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}Tr.register_event(Kt,"load",dom_loaded_handler,!0)}(),gn}((function loadNoop(e,t){t()}));function isReady(){return void 0!==window.mixpanel}const Tn={init:function init$2(e,t=!1,n){return new Promise((i=>{Cn.init(e,{debug:t,loaded:()=>{window.mixpanel=Cn,i()},...n&&{api_host:n}})}))},isReady:isReady,track:function track(e,t){isReady()&&Cn.track(e,t)},identify:function identify$1(e,t){isReady()&&(Cn.identify(e),Cn.people.set(t))},attachProperty:function attachProperty(e,t){isReady()&&Cn.people.union(e,[t])},getMixpanelDistinctId:()=>Cn&&Cn.get_distinct_id?Cn.get_distinct_id():null},Rn=_e.object({firstName:_e.string().optional(),lastName:_e.string().optional(),email:_e.string().email().optional(),phone:_e.string().regex(/^(\+?[1-9]\d{1,14})?$/).optional()}),Pn=["web","web-mobile","ios","android","app"],Mn=_e.enum(Pn).refine((e=>Pn.includes(e)),{message:`Product must be one of: ${Pn.join(", ")}`}),Nn=_e.object({product:Mn});const dateValidation=e=>!(!/^\d{4}-\d{2}-\d{2}$/.test(e)&&!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))||!(!/^\d{4}-\d{2}-\d{2}/.test(e)||isNaN(Date.parse(e))),stringField=e=>_e.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>_e.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>_e.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>_e.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,t,n)=>_e.array(e).min(n,`${t} must have at least ${n} items`),Dn=_e.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:Mn});const An=_e.object({"Passenger Birthdate":dateField("Passenger Birthdate"),"Passenger Seat":stringField("Passenger Seat"),"Passenger Name":stringField("Passenger Name"),"Passenger Document Type":stringField("Document Type"),"Passenger Document Id":stringField("Document ID")}).strict(),Zn=_e.object({"Departure Arrival":dateField("Departure Arrival"),"Departure Destination":stringField("Departure Destination"),"Departure Destination Terminal":stringField("Departure Destination Terminal"),"Departure Line":stringField("Departure Line"),"Departure Origin":stringField("Departure Origin"),"Departure Origin Terminal":stringField("Departure Origin Terminal"),"Departure Price":numberField("Departure Price"),"Departure Route":stringField("Departure Route"),"Departure Stops":intField("Departure Stops"),"Departure Time":dateField("Departure Time"),"Departure Transport Type":stringField("Departure Transport Type"),"Departure Transporter":stringField("Departure Transporter"),"Return Arrival":dateField("Return Arrival").optional(),"Return Destination":stringField("Return Destination").optional(),"Return Destination Terminal":stringField("Return Destination Terminal").optional(),"Return Line":stringField("Return Line").optional(),"Return Origin":stringField("Return Origin").optional(),"Return Origin Terminal":stringField("Return Origin Terminal").optional(),"Return Price":numberField("Return Price").optional(),"Return Route":stringField("Return Route").optional(),"Return Stops":intField("Return Stops").optional(),"Return Time":dateField("Return Time").optional(),"Return Transport Type":stringField("Return Transport Type").optional(),"Return Transporter":stringField("Return Transporter").optional(),"Recommended Trip":_e.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),jn=_e.object({Trips:arrayField(Zn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:Mn,Passengers:arrayField(An,"Passengers",1).optional()}).strict();const Ln=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(Zn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":_e.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:Mn,Passengers:arrayField(An,"Passengers",1).optional(),Insurance:(qn="Insurance",_e.boolean({required_error:`${qn} is required`,invalid_type_error:`${qn} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var qn;const Un=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Price:_e.number().positive("Price must be a positive number"),"Result Position":_e.number().int("Result Position must be an integer"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":_e.string().min(1,"Transport Type is required"),Transporter:_e.string().min(1,"Transporter is required"),product:Mn,"Recommended Trip":_e.boolean(),"Recommended Trip Type":_e.string().optional(),"Trip Type":_e.string().min(1,"Trip Type is required"),"Bus Type":_e.string().min(1,"Bus Type is required")});const Fn=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(Zn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:Mn,Passengers:arrayField(An,"Passengers",1).optional()}).strict();const Bn=_e.object({Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":_e.number().int("Departure Delta must be an integer"),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Passengers:_e.number().int("Passenger count must be an integer"),Return:_e.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:_e.string().min(1,"Route is required"),"Trip Length":_e.number().positive().optional(),Categories:_e.array(_e.string()).optional(),product:Mn});const $n=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination Terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin Terminal is required"),Price:_e.number().positive("Price must be a positive number"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative().optional(),Tickets:_e.number().int("Tickets must be an integer").positive(),Transporter:_e.string().min(1,"Transporter is required"),Way:_e.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:Mn});const zn=_e.object({"Bus count":_e.number().int("Bus count must be an integer"),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":_e.number().int("Departure Delta must be an integer").optional(),Destination:_e.string().min(1,"Destination is required").optional(),"Destination Terminal":_e.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":_e.boolean().default(!1).optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Route:_e.string().min(1,"Route is required"),product:Mn}),Wn=_e.object({mixpanelToken:_e.string().min(1,"Mixpanel token is required"),debug:_e.boolean().optional(),identificationKey:_e.string().min(1,"Identification key is required"),isSandbox:_e.boolean().optional(),mixpanelProxyUrl:_e.string().optional(),identifyProxyUrl:_e.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),Vn={Search:Bn,"Seat Change":$n,"Interest In Home":Nn,"Passengers Created":jn,"Payment Attempt":Ln,"Interest In Search":Dn,"View Results":zn,"Purchase Attempt":Fn,"Picked Departure":Un};function validateProps(e,t){try{t.parse(e)}catch(or){if(or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(or)}}throw{message:"Unknown validation error"}}}const Hn={parseEventProps:function parseEventProps(e,t){const n=Vn[e]||ve;try{n.parse(t)}catch(or){if(or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(or)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,Wn)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,Rn)},validateProps:validateProps};let Kn=null;function isTrackerReady(){return Tn.isReady()}let Gn=null;const Jn={init:function init(){return new Promise((e=>{if(Gn)return void e(Gn);const t="Geolocation Requested";navigator.geolocation.getCurrentPosition((n=>{const{latitude:i,longitude:s}=n.coords;Gn={lat:i,long:s},isTrackerReady()&&trackCustomEvent(t,{geolocationAccepted:!0}),e(Gn)}),(()=>{isTrackerReady()&&trackCustomEvent(t,{geolocationAccepted:!1}),e(null)}))}))},getCoordinates:function getCoordinates(){return Gn}},Yn=["Search","View Results"],Xn={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(e,t){try{Tn.track("Track Event Error",{"Failed Event Name":e,"Error Message":(null==t?void 0:t.message)??"Failed to track event","Validation Errors":(null==t?void 0:t.errors)||[]})}catch(n){console.error("Failed to track error event:",n)}}async function trackEvent(e,t,n={}){if(!Tn.isReady())throw new Error("Mixpanel is not initialized.");try{Hn.parseEventProps(e,t);const i=!Yn.includes(e),s=await st.getFingerprint(i),a={},c=Jn.getCoordinates();c&&(a.$latitude=c.lat,a.$longitude=c.long);const u={"User Fingerprint":s},d=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),t={};return Object.entries(Xn).forEach((([n,i])=>{const s=e.get(n);s&&(t[i]=s)})),t}catch(or){return console.error("Error extracting tracking parameters:",or),{}}}(),l=function flattenEventData(e){return Object.entries(e).reduce(((e,[t,n])=>Array.isArray(n)?Array.isArray(n)&&n.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[t]=n,e):(n.forEach((t=>{"object"==typeof t&&null!==t&&Object.entries(t).forEach((([t,n])=>{e[t]?e[t].push(n):e[t]=[n]}))})),e):(e[t]=n,e)),{})}(t),p={...u,...l,...d,...a,...n};Tn.track(e,p)}catch(or){console.error(`Error tracking event '${e}':`,or),trackEventError(e,or)}}function trackCustomEvent(e,t={},n={}){try{be.parse(e),trackEvent(e,t,n)}catch(or){console.error("Error trackCustomEvent:",or),trackEventError(e,or)}}const Qn=_e.object({email:_e.string().email().optional(),phone:_e.string().optional(),cpf:_e.string().optional(),passport:_e.string().optional(),rg:_e.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{Hn.validateProps(e,Qn);const t=[],n=st.getCachedFingerprint(),i=Tn.getMixpanelDistinctId();n&&t.push({key:"fingerprint",value:n}),i&&t.push({key:"distinct_id",value:i});const s=function getAnonymousProfilePayload(e,t){let n="phone",i=e.phone||"";const s=[];e.email&&(n="email",i=e.email);const a=["cpf","passport","rg","email","phone","salesforceid"];return Object.entries(e).forEach((([e,t])=>{a.includes(e.toLowerCase())&&t&&e!==n&&s.push({key:e,value:t})})),t.length&&t.forEach((e=>s.push(e))),{identifier_key:n,identifier_value:i,details:{},identifiers:s}}(e,t);return(await ut.core.createAnonymousProfile(s)).data}catch(or){return void console.error("Could not create anonymous profile:",or)}}const eo=["firstName","lastName","email","phone"];const identifyWithLocation=async(e,t)=>{try{const n=function getApiConfig(){return Kn}(),i=Jn.getCoordinates();if(!i)return;t.first_name=t.firstName,t.last_name=t.lastName,t.latitude=i.lat,t.longitude=i.long,t.ip="0",t.name=`${t.firstName} ${t.lastName}`,delete t.firstName,delete t.lastName,fetch(`${null==n?void 0:n.coreUrl}/${null==n?void 0:n.coreVersion}/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==n?void 0:n.coreApiKey)||"",...(null==n?void 0:n.headers)||{}},body:JSON.stringify({profile_params:{...t,distinct_id:e}})})}catch(or){console.error("Error identifying user-service",or)}};const to={init:async function init$1(e){Hn.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i,isSandbox:s=!1,mixpanelProxyUrl:a,identifyProxyUrl:c}=e;Jn.init(),await Tn.init(t,n,a);try{await st.initFingerprint(i,c)}catch(or){console.error("Error initializing identification service:",or)}Kn=lt.coreAPIConfig[s?"sandbox":"prod"],ut.setConfig(Kn),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(e,t={}){try{if(!Tn.isReady())throw console.error("Mixpanel is not initialized."),new Error("Mixpanel is not initialized.");if(Hn.parseIdentifyProps(t),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const n=await createAnonymousProfile(t);n&&(t.reservamos_one_id=n.id);const i=function mapProperties(e){return{$first_name:null==e?void 0:e.firstName,$last_name:null==e?void 0:e.lastName,$email:null==e?void 0:e.email,$phone:null==e?void 0:e.phone,...Object.keys(e).reduce(((t,n)=>(eo.includes(n)||(t[n]=e[n]),t)),{})}}(t);Tn.identify(e,i);const s=await st.getFingerprint();s&&Tn.attachProperty("Known Fingerprints",s)}catch(or){console.error("Error identifying user",or),trackEventError("Identify",or)}finally{identifyWithLocation(e,t)}},identifiers:{getFingerprintId:st.getCachedFingerprint,getDistinctId:Tn.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},track:{search:function trackSearch(e,t={}){trackEvent("Search",e,t)},seatChange:function trackSeatChange(e,t={}){trackEvent("Seat Change",e,t)},interestInHome:function trackInterestInHome(e,t={}){trackEvent("Interest In Home",e,t)},interestInSearch:function trackInterestInSearch(e,t={}){trackEvent("Interest In Search",e,t)},viewResults:function trackViewResults(e,t={}){trackEvent("View Results",e,t)},passengersCreated:function trackPassengersCreated(e,t={}){trackEvent("Passengers Created",e,t)},paymentAttempt:async(e,t={})=>{trackEvent("Payment Attempt",e,t)},purchaseAttempt:function trackPurchaseAttempt(e,t={}){trackEvent("Purchase Attempt",e,t)},pickedDeparture:function trackSearch$1(e,t={}){trackEvent("Picked Departure",e,t)},customEvent:trackCustomEvent,purchaseCanceled:function trackPurchaseCanceled(e,t={}){trackEvent("Purchase Canceled",e,t)}}};module.exports=to;
|
|
30
|
+
function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:t,bitmap:n,width:c,height:u,dataURLOptions:d}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),u=yield c.arrayBuffer(),d=encode2(u);return s.set(i,d),d}return""}))}(c,u,d),p=new OffscreenCanvas(c,u);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(d),f=h.type,m=yield h.arrayBuffer(),g=encode2(m);if(!i.has(t)&&(yield l)===g)return i.set(t,g),a.postMessage({id:t});if(i.get(t)===g)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:g,width:c,height:u}),i.set(t,g)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,u=new Bt;u.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:Nt["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const d=1e3/e;let l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<d||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(c.get(n))return;if(0===e.width||0===e.height)return;if(c.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);u.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const u of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[u])continue;const a=patch(t.CanvasRenderingContext2D.prototype,u,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:Nt["2D"],property:u,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,u,{set(t){e(this.canvas,{type:Nt["2D"],property:u,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,Nt.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,Nt.WebGL2,e,n,i,0,t)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["type"]);return t})),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:i}),this.pendingCanvasMutations.delete(e)}}class StylesheetManager{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),i.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,t)=>({rule:stringifyRule(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:Tt()})}let $t,zt,Wt,Vt=!1;const Ht=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:u=null,maskTextClass:d="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:g,maskTextFn:_,hooks:y,packFn:v,sampling:b={},dataURLOptions:w={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:x=!1,recordCrossOriginIframes:O=!1,recordAfter:T=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:C=!1,collectFonts:R=!1,inlineImages:P=!1,plugins:N,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:A=new Set([]),errorHandler:Z}=e;!function registerErrorHandler(e){Dt=e}(Z);const j=!O||window.parent===window;let L=!1;if(!j)try{window.parent.document&&(L=!1)}catch(G){L=!0}if(j&&!t)throw new Error("emit function is required");void 0!==S&&void 0===b.mousemove&&(b.mousemove=S),Ht.reset();const q=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},U=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let B;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let $=0;const eventProcessor=e=>{for(const t of N||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!L&&(e=v(e)),e};$t=(e,s)=>{var a;if(!(null===(a=At[0])||void 0===a?void 0:a.isFrozen())||e.type===Ct.FullSnapshot||e.type===Ct.IncrementalSnapshot&&e.data.source===Rt.Mutation||At.forEach((e=>e.unfreeze())),j)null==t||t(eventProcessor(e),s);else if(L){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===Ct.FullSnapshot)B=e,$=0;else if(e.type===Ct.IncrementalSnapshot){if(e.data.source===Rt.Mutation&&e.data.isAttachIframe)return;$++;const t=i&&$>=i,s=n&&e.timestamp-B.timestamp>n;(t||s)&&zt(!0)}};const wrappedMutationEmit=e=>{$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.Mutation},e)}))},wrappedScrollEmit=e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.Scroll},e)})),wrappedCanvasMutationEmit=e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.CanvasMutation},e)})),z=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.AdoptedStyleSheet},e)}))}),W=new IframeManager({mirror:Ht,mutationCb:wrappedMutationEmit,stylesheetManager:z,recordCrossOriginIframes:O,wrappedEmit:$t});for(const J of N||[])J.getMirror&&J.getMirror({nodeMirror:Ht,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const H=new ProcessedNodeManager;Wt=new CanvasManager({recordCanvas:x,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:Ht,sampling:b.canvas,dataURLOptions:w});const K=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:q,dataURLOptions:w,maskTextFn:_,maskInputFn:g,recordCanvas:x,inlineImages:P,sampling:b,slimDOMOptions:U,iframeManager:W,stylesheetManager:z,canvasManager:Wt,keepIframeSrcFn:D,processedNodeManager:H},mirror:Ht});zt=(e=!1)=>{if(!I)return;$t(wrapEvent({type:Ct.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),z.reset(),K.init(),At.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,inlineImages:d=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:g,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:g,inlineImages:d,recordCanvas:l,preserveWhiteSpace:_,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:Ht,blockClass:s,blockSelector:a,maskTextClass:d,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:q,maskTextFn:_,slimDOM:U,dataURLOptions:w,recordCanvas:x,inlineImages:P,onSerialize:e=>{isSerializedIframe(e,Ht)&&W.addIframe(e),isSerializedStylesheet(e,Ht)&&z.trackLinkElement(e),hasShadowRoot(e)&&K.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),K.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:D});if(!t)return console.warn("Failed to snapshot the document");$t(wrapEvent({type:Ct.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),At.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,Ht.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.ViewportResize},e)})),inputCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.Input},e)})),mediaInteractionCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.MediaInteraction},e)})),styleSheetRuleCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.StyleSheetRule},e)})),styleDeclarationCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.Font},e)})),selectionCb:e=>{$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.Selection},e)}))},customElementCb:e=>{$t(wrapEvent({type:Ct.IncrementalSnapshot,data:Object.assign({source:Rt.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:u,maskTextClass:d,maskTextSelector:l,maskInputOptions:q,inlineStylesheet:p,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:P,userTriggeredOnInput:C,collectFonts:R,doc:e,maskInputFn:g,maskTextFn:_,keepIframeSrcFn:D,blockSelector:a,slimDOMOptions:U,dataURLOptions:w,mirror:Ht,iframeManager:W,stylesheetManager:z,shadowDomManager:K,processedNodeManager:H,canvasManager:Wt,ignoreCSSAttributes:A,plugins:(null===(t=null==N?void 0:N.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>$t(wrapEvent({type:Ct.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};W.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(or){console.warn(or)}}));const init2=()=>{zt(),e.push(observe(document)),Vt=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{$t(wrapEvent({type:Ct.DomContentLoaded,data:{}})),"DOMContentLoaded"===T&&init2()}))),e.push(on("load",(()=>{$t(wrapEvent({type:Ct.Load,data:{}})),"load"===T&&init2()}),window))),()=>{e.forEach((e=>e())),H.destroy(),Vt=!1,function unregisterErrorHandler(){Dt=void 0}()}}catch(or){console.warn(or)}}record.addCustomEvent=(e,t)=>{if(!Vt)throw new Error("please add custom event after start recording");$t(wrapEvent({type:Ct.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{At.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!Vt)throw new Error("please take full snapshot after start recording");zt(e)},record.mirror=Ht;var Kt,Gt=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Gt||{}),Jt=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Jt||{}),Yt={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Xt={hostname:""};Kt={navigator:{userAgent:"",onLine:!0},document:{location:Xt,referrer:""},screen:{width:0,height:0},location:Xt}}else Kt=window;var Qt,er,tr,rr,nr,or,ir,sr,ar,cr,ur=864e5,dr=8e3,lr=Array.prototype,pr=Function.prototype,hr=Object.prototype,fr=lr.slice,mr=hr.toString,gr=hr.hasOwnProperty,_r=Kt.console,yr=Kt.navigator,vr=Kt.document,br=Kt.opera,kr=Kt.screen,wr=yr.userAgent,Sr=pr.bind,Ir=lr.forEach,xr=lr.indexOf,Or=lr.map,Er=Array.isArray,Tr={},Cr={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Rr={log:function(){if(Yt.DEBUG&&!Cr.isUndefined(_r)&&_r)try{_r.log.apply(_r,arguments)}catch(e){Cr.each(arguments,(function(e){_r.log(e)}))}},warn:function(){if(Yt.DEBUG&&!Cr.isUndefined(_r)&&_r){var e=["Mixpanel warning:"].concat(Cr.toArray(arguments));try{_r.warn.apply(_r,e)}catch(t){Cr.each(e,(function(e){_r.warn(e)}))}}},error:function(){if(Yt.DEBUG&&!Cr.isUndefined(_r)&&_r){var e=["Mixpanel error:"].concat(Cr.toArray(arguments));try{_r.error.apply(_r,e)}catch(t){Cr.each(e,(function(e){_r.error(e)}))}}},critical:function(){if(!Cr.isUndefined(_r)&&_r){var e=["Mixpanel error:"].concat(Cr.toArray(arguments));try{_r.error.apply(_r,e)}catch(t){Cr.each(e,(function(e){_r.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(Rr,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Rr.log,e),error:log_func_with_prefix(Rr.error,e),critical:log_func_with_prefix(Rr.critical,e)}};Cr.bind=function(e,t){var n,i;if(Sr&&e.bind===Sr)return Sr.apply(e,fr.call(arguments,1));if(!Cr.isFunction(e))throw new TypeError;return n=fr.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(fr.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(fr.call(arguments)));return Object(c)===c?c:a},i},Cr.each=function(e,t,n){if(null!=e)if(Ir&&e.forEach===Ir)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===Tr)return}else for(var a in e)if(gr.call(e,a)&&t.call(n,e[a],a,e)===Tr)return},Cr.extend=function(e){return Cr.each(fr.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},Cr.isArray=Er||function(e){return"[object Array]"===mr.call(e)},Cr.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},Cr.isArguments=function(e){return!(!e||!gr.call(e,"callee"))},Cr.toArray=function(e){return e?e.toArray?e.toArray():Cr.isArray(e)||Cr.isArguments(e)?fr.call(e):Cr.values(e):[]},Cr.map=function(e,t,n){if(Or&&e.map===Or)return e.map(t,n);var i=[];return Cr.each(e,(function(e){i.push(t.call(n,e))})),i},Cr.keys=function(e){var t=[];return null===e||Cr.each(e,(function(e,n){t[t.length]=n})),t},Cr.values=function(e){var t=[];return null===e||Cr.each(e,(function(e){t[t.length]=e})),t},Cr.include=function(e,t){var n=!1;return null===e?n:xr&&e.indexOf===xr?-1!=e.indexOf(t):(Cr.each(e,(function(e){if(n||(n=e===t))return Tr})),n)},Cr.includes=function(e,t){return-1!==e.indexOf(t)},Cr.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},Cr.isObject=function(e){return e===Object(e)&&!Cr.isArray(e)},Cr.isEmptyObject=function(e){if(Cr.isObject(e)){for(var t in e)if(gr.call(e,t))return!1;return!0}return!1},Cr.isUndefined=function(e){return void 0===e},Cr.isString=function(e){return"[object String]"==mr.call(e)},Cr.isDate=function(e){return"[object Date]"==mr.call(e)},Cr.isNumber=function(e){return"[object Number]"==mr.call(e)},Cr.isElement=function(e){return!(!e||1!==e.nodeType)},Cr.encodeDates=function(e){return Cr.each(e,(function(t,n){Cr.isDate(t)?e[n]=Cr.formatDate(t):Cr.isObject(t)&&(e[n]=Cr.encodeDates(t))})),e},Cr.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Cr.formatDate=function(e){function pad(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+pad(e.getUTCMonth()+1)+"-"+pad(e.getUTCDate())+"T"+pad(e.getUTCHours())+":"+pad(e.getUTCMinutes())+":"+pad(e.getUTCSeconds())},Cr.strip_empty_properties=function(e){var t={};return Cr.each(e,(function(e,n){Cr.isString(e)&&e.length>0&&(t[n]=e)})),t},Cr.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):Cr.isArray(e)?(n=[],Cr.each(e,(function(e){n.push(Cr.truncate(e,t))}))):Cr.isObject(e)?(n={},Cr.each(e,(function(e,i){n[i]=Cr.truncate(e,t)}))):n=e,n},Cr.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,u=n,d=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",d=[],"[object Array]"===mr.apply(l)){for(c=l.length,i=0;i<c;i+=1)d[i]=str(i,l)||"null";return a=0===d.length?"[]":n?"[\n"+n+d.join(",\n"+n)+"\n"+u+"]":"["+d.join(",")+"]",n=u,a}for(s in l)gr.call(l,s)&&(a=str(s,l))&&d.push(quote(s)+(n?": ":":")+a);return a=0===d.length?"{}":n?"{"+d.join(",")+u+"}":"{"+d.join(",")+"}",n=u,a}};return str("",{"":e})}}(),Cr.JSONDecode=(nr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},or=function(e){var t=new SyntaxError(e);throw t.at=Qt,t.text=tr,t},ir=function(e){return e&&e!==er&&or("Expected '"+e+"' instead of '"+er+"'"),er=tr.charAt(Qt),Qt+=1,er},sr=function(){var e,t="";for("-"===er&&(t="-",ir("-"));er>="0"&&er<="9";)t+=er,ir();if("."===er)for(t+=".";ir()&&er>="0"&&er<="9";)t+=er;if("e"===er||"E"===er)for(t+=er,ir(),"-"!==er&&"+"!==er||(t+=er,ir());er>="0"&&er<="9";)t+=er,ir();if(e=+t,isFinite(e))return e;or("Bad number")},ar=function(){var e,t,n,i="";if('"'===er)for(;ir();){if('"'===er)return ir(),i;if("\\"===er)if(ir(),"u"===er){for(n=0,t=0;t<4&&(e=parseInt(ir(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof nr[er])break;i+=nr[er]}else i+=er}or("Bad string")},cr=function(){for(;er&&er<=" ";)ir()},rr=function(){switch(cr(),er){case"{":return function(){var e,t={};if("{"===er){if(ir("{"),cr(),"}"===er)return ir("}"),t;for(;er;){if(e=ar(),cr(),ir(":"),Object.hasOwnProperty.call(t,e)&&or('Duplicate key "'+e+'"'),t[e]=rr(),cr(),"}"===er)return ir("}"),t;ir(","),cr()}}or("Bad object")}();case"[":return function(){var e=[];if("["===er){if(ir("["),cr(),"]"===er)return ir("]"),e;for(;er;){if(e.push(rr()),cr(),"]"===er)return ir("]"),e;ir(","),cr()}}or("Bad array")}();case'"':return ar();case"-":return sr();default:return er>="0"&&er<="9"?sr():function(){switch(er){case"t":return ir("t"),ir("r"),ir("u"),ir("e"),!0;case"f":return ir("f"),ir("a"),ir("l"),ir("s"),ir("e"),!1;case"n":return ir("n"),ir("u"),ir("l"),ir("l"),null}or('Unexpected "'+er+'"')}()}},function(e){var t;return tr=e,Qt=0,er=" ",t=rr(),cr(),er&&or("Syntax error"),t}),Cr.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,d=0,l="",p=[];if(!e)return e;e=Cr.utf8Encode(e);do{t=(a=e.charCodeAt(u++)<<16|e.charCodeAt(u++)<<8|e.charCodeAt(u++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[d++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(u<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},Cr.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),u=null;c<128?n++:u=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==u&&(n>t&&(a+=e.substring(t,n)),a+=u,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},Cr.UUID=function(){var T2=function(){var e,t=1*new Date;if(Kt.performance&&Kt.performance.now)e=Kt.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(kr.height*kr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=wr,i=[],s=0;function xor(e,t){var n,s=0;for(n=0;n<t.length;n++)s|=i[n]<<8*n;return e^s}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(s=xor(s,i),i=[]);return i.length>0&&(s=xor(s,i)),s.toString(16)}()+"-"+e+"-"+T2()}}();var Pr=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];Cr.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Pr.length;t++)if(-1!==e.indexOf(Pr[t]))return!0;return!1},Cr.HTTPBuildQuery=function(e,t){var n,i,s=[];return Cr.isUndefined(t)&&(t="&"),Cr.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},Cr.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(s){Rr.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},Cr.cookie={get:function(e){for(var t=e+"=",n=vr.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}return null},parse:function(e){var t;try{t=Cr.JSONDecode(Cr.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(vr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),vr.cookie=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l},set:function(e,t,n,i,s,a,c){var u="",d="",l="";if(c)u="; domain="+c;else if(i){var p=extract_domain(vr.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),d="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+d+"; path=/"+u+l;return vr.cookie=f,f},remove:function(e,t,n){Cr.cookie.set(e,"",-1,t,!1,!1,n)}};var Mr=null,localStorageSupported=function(e,t){if(null!==Mr&&!t)return Mr;var n=!0;try{e=e||window.localStorage;var i="__mplss_"+cheap_guid(8);e.setItem(i,"xyz"),"xyz"!==e.getItem(i)&&(n=!1),e.removeItem(i)}catch(s){n=!1}return Mr=n,n};Cr.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||Rr.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){Rr.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){Cr.localStorage.error(t)}return null},parse:function(e){try{return Cr.JSONDecode(Cr.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){Cr.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){Cr.localStorage.error(t)}}},Cr.register_event=function(){function fixEvent(e){return e&&(e.preventDefault=fixEvent.preventDefault,e.stopPropagation=fixEvent.stopPropagation),e}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(e,t,n,i,s){if(e)if(e.addEventListener&&!i)e.addEventListener(t,n,!!s);else{var a="on"+t,c=e[a];e[a]=function makeHandler(e,t,n){var handler=function(i){if(i=i||fixEvent(window.event)){var s,a,c=!0;return Cr.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else Rr.error("No valid element provided to register_event")}}();var Nr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Cr.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(t,n){var i=" "+n+" ";return(" "+t.className+" ").replace(e," ").indexOf(i)>=0}function getElementsBySelector(e){if(!vr.getElementsByTagName)return[];var t,n,i,s,a,c,u,d,l,p,h=e.split(" "),f=[vr];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var m=n[1],g=vr.getElementById(m);if(!g||i&&g.nodeName.toLowerCase()!=i)return[];f=[g]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var _=n[1];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];for(f=[],p=0,u=0;u<s.length;u++)s[u].className&&Cr.isString(s[u].className)&&hasClass(s[u],_)&&(f[p++]=s[u])}else{var y=t.match(Nr);if(y){i=y[1];var v,b=y[2],w=y[3],S=y[4];for(i||(i="*"),s=[],a=0,u=0;u<f.length;u++)for(l="*"==i?getAllChildren(f[u]):f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];switch(f=[],p=0,w){case"=":v=function(e){return e.getAttribute(b)==S};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+S+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+S+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(S)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(S)==e.getAttribute(b).length-S.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(S)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,u=0;u<s.length;u++)v(s[u])&&(f[p++]=s[u])}else{for(i=t,s=[],a=0,u=0;u<f.length;u++)for(l=f[u].getElementsByTagName(i),d=0;d<l.length;d++)s[a++]=l[d];f=s}}return f}return function(e){return Cr.isElement(e)?[e]:Cr.isObject(e)&&!Cr.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Dr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Ar=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Cr.info={campaignParams:function(e){var t="",n={};return Cr.each(Dr,(function(i){(t=Cr.getQueryParam(vr.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return Cr.each(Ar,(function(n){(e=Cr.getQueryParam(vr.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return Cr.extend(Cr.info.campaignParams(),Cr.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var t=Cr.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=Cr.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||Cr.includes(e," OPR/")?Cr.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Cr.includes(e,"IEMobile")||Cr.includes(e,"WPDesktop")?"Internet Explorer Mobile":Cr.includes(e,"SamsungBrowser/")?"Samsung Internet":Cr.includes(e,"Edge")||Cr.includes(e,"Edg/")?"Microsoft Edge":Cr.includes(e,"FBIOS")?"Facebook Mobile":Cr.includes(e,"Chrome")?"Chrome":Cr.includes(e,"CriOS")?"Chrome iOS":Cr.includes(e,"UCWEB")||Cr.includes(e,"UCBrowser")?"UC Browser":Cr.includes(e,"FxiOS")?"Firefox iOS":Cr.includes(t,"Apple")?Cr.includes(e,"Mobile")?"Mobile Safari":"Safari":Cr.includes(e,"Android")?"Android Mobile":Cr.includes(e,"Konqueror")?"Konqueror":Cr.includes(e,"Firefox")?"Firefox":Cr.includes(e,"MSIE")||Cr.includes(e,"Trident/")?"Internet Explorer":Cr.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[Cr.info.browser(e,t,n)];if(void 0===i)return null;var s=e.match(i);return s?parseFloat(s[s.length-2]):null},os:function(){var e=wr;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return Kt.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Cr.extend(Cr.strip_empty_properties({$os:Cr.info.os(),$browser:Cr.info.browser(wr,yr.vendor,br),$referrer:vr.referrer,$referring_domain:Cr.info.referringDomain(vr.referrer),$device:Cr.info.device(wr)}),{$current_url:Cr.info.currentUrl(),$browser_version:Cr.info.browserVersion(wr,yr.vendor,br),$screen_height:kr.height,$screen_width:kr.width,mp_lib:"web",$lib_version:Yt.LIB_VERSION,$insert_id:cheap_guid(),time:Cr.timestamp()/1e3},Cr.strip_empty_properties(e))},people_properties:function(){return Cr.extend(Cr.strip_empty_properties({$os:Cr.info.os(),$browser:Cr.info.browser(wr,yr.vendor,br)}),{$browser_version:Cr.info.browserVersion(wr,yr.vendor,br)})},mpPageViewProperties:function(){return Cr.strip_empty_properties({current_page_title:vr.title,current_domain:Kt.location.hostname,current_url_path:Kt.location.pathname,current_url_protocol:Kt.location.protocol,current_url_search:Kt.location.search})}};var cheap_guid=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},Zr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,jr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=jr,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Zr);var s=e.match(t);return s?s[0]:""},Lr=null,qr=null;"undefined"!=typeof JSON&&(Lr=JSON.stringify,qr=JSON.parse),Lr=Lr||Cr.JSONEncode,qr=qr||Cr.JSONDecode,Cr.toArray=Cr.toArray,Cr.isObject=Cr.isObject,Cr.JSONEncode=Cr.JSONEncode,Cr.JSONDecode=Cr.JSONDecode,Cr.isBlockedUA=Cr.isBlockedUA,Cr.isEmptyObject=Cr.isEmptyObject,Cr.info=Cr.info,Cr.info.device=Cr.info.device,Cr.info.browser=Cr.info.browser,Cr.info.browserVersion=Cr.info.browserVersion,Cr.info.properties=Cr.info.properties;var Ur="__mp_opt_in_out_";function optIn(e,t){_optInOut(!0,e,t)}function optOut(e,t){_optInOut(!1,e,t)}function hasOptedIn(e,t){return"1"===_getStorageValue(e,t)}function hasOptedOut(e,t){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||Kt,n=t.navigator||{},i=!1;return Cr.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){Cr.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return Rr.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n="0"===_getStorageValue(e,t);return n&&Rr.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function addOptOutCheckMixpanelLib(e){return _addOptOutCheck(e,(function(e){return this.get_config(e)}))}function addOptOutCheckMixpanelPeople(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function addOptOutCheckMixpanelGroup(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function clearOptInOut(e,t){_getStorage(t=t||{}).remove(_getStorageKey(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?Cr.localStorage:Cr.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Ur)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){Cr.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,Cr.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})):Rr.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:u}))}catch(l){Rr.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var d=arguments[arguments.length-1];"function"==typeof d&&d(0)}}var Fr=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,u=this.timeoutMS,d=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>u)return Fr.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),d.removeItem(h),d.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=d.getItem(p);if(e&&e!==i)return!1;if(d.setItem(p,i),d.getItem(p)===i)return!0;if(!localStorageSupported(d,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){d.setItem(l,i),waitFor(getSetY,(function(){d.getItem(l)!==i?delay((function(){d.getItem(p)===i?waitFor((function(){return!d.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){d.setItem(h,"1");try{e()}finally{d.removeItem(h),d.getItem(p)===i&&d.removeItem(p),d.getItem(l)===i&&d.removeItem(l)}};try{if(!localStorageSupported(d,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var Br=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||Cr.bind(Br.error,Br),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=t.usePersistence,this.pid=t.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,t,n){var i={id:cheap_guid(),flushAfter:(new Date).getTime()+2*t,payload:e};this.usePersistence?this.lock.withLock(Cr.bind((function lockAcquired(){var t;try{var s=this.readFromStorage();s.push(i),(t=this.saveToStorage(s))&&this.memQueue.push(i)}catch(a){this.reportError("Error enqueueing item",e),t=!1}n&&n(t)}),this),Cr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),n&&n(!1)}),this),this.pid):(this.memQueue.push(i),n&&n(!0))},RequestQueue.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);if(this.usePersistence&&t.length<e){var n=this.readFromStorage();if(n.length){var i={};Cr.each(t,(function(e){i[e.id]=!0}));for(var s=0;s<n.length;s++){var a=n[s];if((new Date).getTime()>a.flushAfter&&!i[a.id]&&(a.orphaned=!0,t.push(a),t.length>=e))break}}}return t};var filterOutIDsAndInvalid=function(e,t){var n=[];return Cr.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(Cr.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=Cr.bind((function(){var t;try{var i=this.readFromStorage();if(i=filterOutIDsAndInvalid(i,n),t=this.saveToStorage(i)){i=this.readFromStorage();for(var s=0;s<i.length;s++){var a=i[s];if(a.id&&n[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(c){this.reportError("Error removing items",e),t=!1}return t}),this);this.lock.withLock((function lockAcquired(){var e=i();t&&t(e)}),Cr.bind((function lockFailure(e){var n=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(n=i()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}t&&t(n)}),this),this.pid)}else t&&t(!0)};var updatePayloads=function(e,t){var n=[];return Cr.each(e,(function(e){var i=e.id;if(i in t){var s=t[i];null!==s&&(e.payload=s,n.push(e))}else n.push(e)})),n};RequestQueue.prototype.updatePayloads=function(e,t){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(Cr.bind((function lockAcquired(){var n;try{var i=this.readFromStorage();i=updatePayloads(i,e),n=this.saveToStorage(i)}catch(s){this.reportError("Error updating items",e),n=!1}t&&t(n)}),this),Cr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),t&&t(!1)}),this),this.pid):t&&t(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=qr(e),Cr.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(t){this.reportError("Error retrieving queue",t),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,Lr(e)),!0}catch(t){return this.reportError("Error saving queue",t),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var $r=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:Cr.bind(this.reportError,this),storage:t.storage,usePersistence:t.usePersistence}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,t){this.queue.enqueue(e,this.flushInterval,t)},RequestBatcher.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},RequestBatcher.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},RequestBatcher.prototype.clear=function(){this.queue.clear()},RequestBatcher.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},RequestBatcher.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},RequestBatcher.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(Cr.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void $r.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],u={};if(Cr.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=Cr.extend({},t.properties,{mp_sent_by_lib_version:Yt.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}u[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var d=Cr.bind((function(c){this.requestInProgress=!1;try{var d=!1;if(e.unloading)this.queue.updatePayloads(u);else if(Cr.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(Cr.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=Kt.navigator.onLine,!Cr.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(Cr.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),d=!0;else d=!0;d&&(this.queue.removeItemsByID(Cr.map(s,(function(e){return e.id})),Cr.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!a?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())}),this)),Cr.each(s,Cr.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),$r.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,d)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if($r.error.apply($r.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){$r.error(n)}};var zr=console_with_prefix("recorder"),Wr=Kt.CompressionStream,Vr={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},Hr=new Set([Jt.MouseMove,Jt.MouseInteraction,Jt.Scroll,Jt.ViewportResize,Jt.Input,Jt.TouchMove,Jt.MediaInteraction,Jt.Drag,Jt.Selection]);var MixpanelRecorder=function(e){this._mixpanel=e,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=ur,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:Vr,sendRequestFunc:Cr.bind(this.flushEventsWithOptOut,this),errorReporter:Cr.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},MixpanelRecorder.prototype.get_config=function(e){return this._mixpanel.get_config(e)},MixpanelRecorder.prototype.startRecording=function(e){if(null===this._stopRecording){this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>ur&&(this.recordMaxMs=ur,zr.critical("record_max_ms cannot be greater than "+ur+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>dr&&(this.recordMinMs=dr,zr.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=Cr.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=Cr.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(Cr.bind((function(){zr.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),n=this.get_config("record_block_selector");""!==n&&null!==n||(n=void 0),this._stopRecording=record({emit:Cr.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===Gt.IncrementalSnapshot&&Hr.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())}),this),blockClass:this.get_config("record_block_class"),blockSelector:n,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),t(),this.maxTimeoutId=setTimeout(Cr.bind(this.resetRecording,this),this.recordMaxMs)}else zr.log("Recording already in progress, skipping startRecording.")},MixpanelRecorder.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},MixpanelRecorder.prototype.stopRecording=function(){null!==this._stopRecording&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},MixpanelRecorder.prototype.flushEventsWithOptOut=function(e,t,n){this._flushEvents(e,t,n,Cr.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,t,n,i){var s=Cr.bind((function(t,n){200===t.status&&this.replayId===e&&this.seqNo++,i({status:0,httpStatusCode:t.status,responseBody:n,retryAfter:t.headers.get("Retry-After")})}),this);Kt.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>0){var s=this.replayId,a=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=a);var c=e[i-1].timestamp-this.replayStartTime,u={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},d=Cr.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(u.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(u.$user_id=p),Wr){var h=new Blob([d],{type:"application/json"}).stream().pipeThrough(new Wr("gzip"));new Response(h).blob().then(Cr.bind((function(e){u.format="gzip",this._sendRequest(s,u,e,n)}),this))}else u.format="body",this._sendRequest(s,u,d,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){zr.error.apply(zr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){zr.error(n)}},Kt.__mp_recorder=MixpanelRecorder;var DomTracker=function(){};DomTracker.prototype.create_properties=function(){},DomTracker.prototype.event_handler=function(){},DomTracker.prototype.after_track_handler=function(){},DomTracker.prototype.init=function(e){return this.mp=e,this},DomTracker.prototype.track=function(e,t,n,i){var s=this,a=Cr.dom_query(e);if(0!==a.length)return Cr.each(a,(function(e){Cr.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),u=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),u),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;Rr.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,t,n,i){i=i||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,e&&!1===e(i,t)||s.after_track_handler(t,n,i))}},DomTracker.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):Cr.extend({},e)};var LinkTracker=function(){this.override_event="click"};Cr.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,t){var n=LinkTracker.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},LinkTracker.prototype.event_handler=function(e,t,n){n.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,n.href=t.href,n.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout((function(){window.location=t.href}),0)};var FormTracker=function(){this.override_event="submit"};Cr.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,t){setTimeout((function(){t.element.submit()}),0)};var Kr="$set",Gr="$set_once",Jr="$unset",Yr="$add",Xr="$append",Qr="$union",en="$remove",tn={set_action:function(e,t){var n={},i={};return Cr.isObject(e)?Cr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Kr]=i,n},unset_action:function(e){var t={},n=[];return Cr.isArray(e)||(e=[e]),Cr.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[Jr]=n,t},set_once_action:function(e,t){var n={},i={};return Cr.isObject(e)?Cr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Gr]=i,n},union_action:function(e,t){var n={},i={};return Cr.isObject(e)?Cr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=Cr.isArray(e)?e:[e])}),this):i[e]=Cr.isArray(t)?t:[t],n[Qr]=i,n},append_action:function(e,t){var n={},i={};return Cr.isObject(e)?Cr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Xr]=i,n},remove_action:function(e,t){var n={},i={};return Cr.isObject(e)?Cr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[en]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Cr.extend(MixpanelGroup.prototype,tn),MixpanelGroup.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_action(e,t);return Cr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_once_action(e,t);return Cr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,t,n){Cr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var t=this.delete_action();return this._send_request(t,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=Cr.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},MixpanelGroup.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},MixpanelGroup.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelGroup.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},MixpanelGroup.prototype.remove=MixpanelGroup.prototype.remove,MixpanelGroup.prototype.set=MixpanelGroup.prototype.set,MixpanelGroup.prototype.set_once=MixpanelGroup.prototype.set_once,MixpanelGroup.prototype.union=MixpanelGroup.prototype.union,MixpanelGroup.prototype.unset=MixpanelGroup.prototype.unset,MixpanelGroup.prototype.toString=MixpanelGroup.prototype.toString;var MixpanelPeople=function(){};Cr.extend(MixpanelPeople.prototype,tn),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return Cr.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[Kr]=Cr.extend({},Cr.info.people_properties(),i[Kr]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return Cr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,t,n){var i={},s={};return Cr.isObject(e)?(Cr.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void Rr.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(Cr.isUndefined(t)&&(t=1),s[e]=t),i[Yr]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){Cr.isObject(e)&&(n=t);var i=this.append_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,t,n){Cr.isObject(e)&&(n=t);var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,t,n){Cr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,t,n){if(Cr.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",Cr.extend({$amount:e},t),n);Rr.error("Invalid value passed to mixpanel.people.track_charge - must be a number")})),MixpanelPeople.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},MixpanelPeople.prototype.delete_user=function(){if(this._identify_called()){var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)}Rr.error("mixpanel.people.delete_user() requires you to call identify() first")},MixpanelPeople.prototype.toString=function(){return this._mixpanel.toString()+".people"},MixpanelPeople.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),i&&(e.$user_id=i),s&&(e.$had_persisted_distinct_id=s);var a=Cr.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:a,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),Cr.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),Cr.truncate(a,255))},MixpanelPeople.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(e){Kr in e?this._mixpanel.persistence._add_to_people_queue(Kr,e):Gr in e?this._mixpanel.persistence._add_to_people_queue(Gr,e):Jr in e?this._mixpanel.persistence._add_to_people_queue(Jr,e):Yr in e?this._mixpanel.persistence._add_to_people_queue(Yr,e):Xr in e?this._mixpanel.persistence._add_to_people_queue(Xr,e):en in e?this._mixpanel.persistence._add_to_people_queue(en,e):Qr in e?this._mixpanel.persistence._add_to_people_queue(Qr,e):Rr.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=Cr.extend({},this._mixpanel.persistence.load_queue(e)),c=a;Cr.isUndefined(a)||!Cr.isObject(a)||Cr.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),i&&(c=i(a)),t.call(s,c,(function(t,i){0===t&&s._mixpanel.persistence._add_to_people_queue(e,a),Cr.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var u=this;this._flush_one_queue(Kr,this.set,e),this._flush_one_queue(Gr,this.set_once,i),this._flush_one_queue(Jr,this.unset,a,(function(e){return Cr.keys(e)})),this._flush_one_queue(Yr,this.increment,t),this._flush_one_queue(Qr,this.union,s);var d=this._mixpanel.persistence.load_queue(Xr);if(!Cr.isUndefined(d)&&Cr.isArray(d)&&d.length)for(var l,append_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(Xr,l),Cr.isUndefined(n)||n(e,t)},p=d.length-1;p>=0;p--)d=this._mixpanel.persistence.load_queue(Xr),l=d.pop(),u._mixpanel.persistence.save(),Cr.isEmptyObject(l)||u.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(en);if(!Cr.isUndefined(h)&&Cr.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&u._mixpanel.persistence._add_to_people_queue(en,f),Cr.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(en),f=h.pop(),u._mixpanel.persistence.save(),Cr.isEmptyObject(f)||u.remove(f,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var rn,nn="__mps",sn="__mpso",an="__mpus",cn="__mpa",un="__mpap",dn="__mpr",ln="__mpu",pn="$people_distinct_id",hn="__alias",fn="__timers",mn=[nn,sn,an,cn,un,dn,ln,pn,hn,fn],MixpanelPersistence=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(Rr.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&Cr.localStorage.is_supported()?this.storage=Cr.localStorage:this.storage=Cr.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),Cr.each(this.props,(function(t,n){Cr.include(mn,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Cr.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===Cr.localStorage?(e=Cr.cookie.parse(this.name),Cr.cookie.remove(this.name),Cr.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Cr.cookie&&(t=Cr.localStorage.parse(this.name),Cr.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,Cr.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(e){return this.load(),this.props[e]},MixpanelPersistence.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},MixpanelPersistence.prototype.clear=function(){this.remove(),this.props={}},MixpanelPersistence.prototype.register_once=function(e,t,n){return!!Cr.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),Cr.each(e,(function(e,n){this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,t){return!!Cr.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),Cr.extend(this.props,e),this.save(),!0)},MixpanelPersistence.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},MixpanelPersistence.prototype.update_search_keyword=function(e){this.register(Cr.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Cr.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return Cr.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},MixpanelPersistence.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),i=t[e],s=this._get_or_create_queue(Kr),a=this._get_or_create_queue(Gr),c=this._get_or_create_queue(Jr),u=this._get_or_create_queue(Yr),d=this._get_or_create_queue(Qr),l=this._get_or_create_queue(en,[]),p=this._get_or_create_queue(Xr,[]);n===nn?(Cr.extend(s,i),this._pop_from_people_queue(Yr,i),this._pop_from_people_queue(Qr,i),this._pop_from_people_queue(Jr,i)):n===sn?(Cr.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(Jr,i)):n===an?Cr.each(i,(function(e){Cr.each([s,a,u,d],(function(t){e in t&&delete t[e]})),Cr.each(p,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===cn?(Cr.each(i,(function(e,t){t in s?s[t]+=e:(t in u||(u[t]=0),u[t]+=e)}),this),this._pop_from_people_queue(Jr,i)):n===ln?(Cr.each(i,(function(e,t){Cr.isArray(e)&&(t in d||(d[t]=[]),d[t]=d[t].concat(e))})),this._pop_from_people_queue(Jr,i)):n===dn?(l.push(i),this._pop_from_people_queue(Xr,i)):n===un&&(p.push(i),this._pop_from_people_queue(Jr,i)),Rr.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Rr.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];Cr.isUndefined(n)||Cr.each(t,(function(t,i){e===Xr||e===en?Cr.each(n,(function(e){e[i]===t&&delete e[i]})):delete n[i]}),this)},MixpanelPersistence.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},MixpanelPersistence.prototype._get_queue_key=function(e){return e===Kr?nn:e===Gr?sn:e===Jr?an:e===Yr?cn:e===Xr?un:e===en?dn:e===Qr?ln:void Rr.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=Cr.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(fn)||{};n[e]=t,this.props[fn]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(fn)||{})[e];return Cr.isUndefined(t)||(delete this.props[fn][e],this.save()),t};var gn,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},_n="mixpanel",yn="base64",vn="$device:",bn=Kt.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,kn=!bn&&-1===wr.indexOf("MSIE")&&-1===wr.indexOf("Mozilla"),wn=null;yr.sendBeacon&&(wn=function(){return yr.sendBeacon.apply(yr,arguments)});var Sn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},In={api_host:"https://api-js.mixpanel.com",api_routes:Sn,api_method:"POST",api_transport:"XHR",api_payload_format:yn,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:NOOP_FUNC,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:NOOP_FUNC,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:18e5,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:ur,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},xn=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===_n?gn:gn[n];if(s&&0===rn)i=s;else{if(s&&!Cr.isArray(s))return void Rr.error("You have already initialized "+n);i=new MixpanelLib}if(i._cached_groups={},i._init(e,t,n),i.people=new MixpanelPeople,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var a=Cr.info.campaignParams(null),c={},u=!1;Cr.each(a,(function(e,t){c["initial_"+t]=e,e&&(u=!0)})),u&&i.people.set_once(c)}return Yt.DEBUG=Yt.DEBUG||i.get_config("debug"),!Cr.isUndefined(s)&&Cr.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(Cr.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==_n){var i=create_mplib(e,t,n);return gn[n]=i,i._loaded(),i}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var i={};"api_payload_format"in t||(t.api_host||In.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(Cr.extend({},In,i,t,{name:n,token:e,callback_fn:(n===_n?n:_n+"."+n)+"._jsc"})),this._jsc=NOOP_FUNC,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(Cr.localStorage.is_supported(!0)&&bn){if(this.init_batchers(),wn&&Kt.addEventListener){var s=Cr.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);Kt.addEventListener("pagehide",(function(e){e.persisted&&s()})),Kt.addEventListener("visibilitychange",(function(){"hidden"===vr.visibilityState&&s()}))}}else this._batch_requests=!1,Rr.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Cr.each(this.get_batcher_configs(),(function(e){Rr.log("Clearing batch queue "+e.queue_key),Cr.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=Cr.UUID();this.get_distinct_id()||this.register_once({distinct_id:vn+a,$device_id:a},"");var c=this.get_config("track_pageview");c&&this._init_url_change_tracking(c),this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent")&&this.start_session_recording()},MixpanelLib.prototype.start_session_recording=addOptOutCheckMixpanelLib((function(){if(Kt.MutationObserver){var e=Cr.bind((function(){this._recorder=this._recorder||new Kt.__mp_recorder(this),this._recorder.startRecording()}),this);Cr.isUndefined(Kt.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Rr.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Rr.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var t=this._recorder.replayId;t&&(e.$mp_replay_id=t)}return e},MixpanelLib.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=Cr.info.campaignParams(null);Cr.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(vr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Cr.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(vr.referrer)},MixpanelLib.prototype._dom_loaded=function(){Cr.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||Cr.each(this.__request_queue,(function(e){this._send_request.apply(this,e)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!xn)return this.__dom_loaded_queue.push([e,t]),!1;var n=(new e).init(this);return n.track.apply(n,t)},MixpanelLib.prototype._init_url_change_tracking=function(e){var t="";if(this.track_pageview()&&(t=Cr.info.currentUrl()),Cr.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){Kt.addEventListener("popstate",(function(){Kt.dispatchEvent(new Event("mp_locationchange"))})),Kt.addEventListener("hashchange",(function(){Kt.dispatchEvent(new Event("mp_locationchange"))}));var n=Kt.history.pushState;"function"==typeof n&&(Kt.history.pushState=function(e,t,i){n.call(Kt.history,e,t,i),Kt.dispatchEvent(new Event("mp_locationchange"))});var i=Kt.history.replaceState;"function"==typeof i&&(Kt.history.replaceState=function(e,t,n){i.call(Kt.history,e,t,n),Kt.dispatchEvent(new Event("mp_locationchange"))}),Kt.addEventListener("mp_locationchange",function(){var n=Cr.info.currentUrl(),i=!1;("full-url"===e?i=n!==t:"url-with-path-and-query-string"===e?i=n.split("#")[0]!==t.split("#")[0]:"url-with-path"===e&&(i=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0]),i)&&(this.track_pageview()&&(t=n))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,t){if(Cr.isUndefined(e))return null;if(bn){return function(n){e(n,t)}}var n=this._jsc,i=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(s){delete n[i],e(s,t)},s},MixpanelLib.prototype._send_request=function(e,t,n,i){var s=!0;if(kn)return this.__request_queue.push(arguments),s;var a={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},c=null;i||!Cr.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=Cr.extend(a,n||{}),bn||(n.method="GET");var u="POST"===n.method,d=wn&&u&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),bn||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),u&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+Cr.HTTPBuildQuery(t);var p=this;if("img"in t){var h=vr.createElement("img");h.src=e,vr.body.appendChild(h)}else if(d){try{s=wn(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(bn)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(u&&(m["Content-Type"]="application/x-www-form-urlencoded"),Cr.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var g=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=Cr.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-g>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var _=vr.createElement("script");_.type="text/javascript",_.async=!0,_.defer=!0,_.src=e;var y=vr.getElementsByTagName("script")[0];y.parentNode.insertBefore(_,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];Cr.each(e,(function(e){e&&(t=e[0],Cr.isArray(t)?s.push(e):"function"==typeof e?e.call(this):Cr.isArray(e)&&"alias"===t?n.push(e):Cr.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){Cr.each(e,(function(e){if(Cr.isArray(e[0])){var n=t;Cr.each(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};execute(n,this),execute(i,this),execute(s,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=Cr.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Cr.bind((function(t,n,i){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(t),n,this._prepare_callback(i,t))}),this),beforeSendHook:Cr.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:Cr.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},MixpanelLib.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,Cr.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,Cr.each(this.request_batchers,(function(e){e.stop(),e.clear()}))},MixpanelLib.prototype.push=function(e){this._execute_array([e])},MixpanelLib.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},MixpanelLib.prototype._encode_data_for_request=function(e){var t=Cr.JSONEncode(e);return this.get_config("api_payload_format")===yn&&(t=Cr.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=Cr.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var u=!0,d=Cr.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Rr.log("MIXPANEL REQUEST:"),Rr.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):d()})):u=d(),u&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),Cr.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=Cr.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!Cr.isUndefined(c)){var u=(new Date).getTime()-c;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?Cr.info.marketingParams():{};t=Cr.extend({},Cr.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var l=this.get_config("property_blacklist");Cr.isArray(l)?Cr.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){Cr.isArray(t)||(t=[t]);var i={};return i[e]=t,this.register(i),this.people.set(e,t,n)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e),s={};return void 0===i?(s[e]=[t],this.register(s)):-1===i.indexOf(t)&&(i.push(t),s[e]=i,this.register(s)),this.people.union(e,t,n)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e);if(void 0!==i){var s=i.indexOf(t);s>-1&&(i.splice(s,1),this.register({group_key:i})),0===i.length&&this.unregister(e)}return this.people.remove(e,t,n)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,t,n,i){var s=Cr.extend({},t||{});return Cr.each(n,(function(e,t){null!=e&&(s[t]=e)})),this.track(e,s,i)})),MixpanelLib.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},MixpanelLib.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},MixpanelLib.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),i=this._cached_groups[n];return void 0!==i&&i._group_key===e&&i._group_id===t||((i=new MixpanelGroup)._init(this,e,t),this._cached_groups[n]=i),i},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,t){"object"!=typeof e&&(e={});var n=(t=t||{}).event_name||"$mp_web_page_view",i=Cr.extend(Cr.info.mpPageViewProperties(),Cr.info.campaignParams(),Cr.info.clickParams()),s=Cr.extend({},i,e);return this.track(n,s)})),MixpanelLib.prototype.track_links=function(){return this._track_dom.call(this,LinkTracker,arguments)},MixpanelLib.prototype.track_forms=function(){return this._track_dom.call(this,FormTracker,arguments)},MixpanelLib.prototype.time_event=function(e){Cr.isUndefined(e)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(e)||this.persistence.set_event_timer(e,(new Date).getTime())};var On={persistent:!0},options_for_register=function(e){var t;return t=Cr.isObject(e)?e:Cr.isUndefined(e)?{}:{days:e},Cr.extend({},On,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):Cr.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,t,n){var i=options_for_register(n);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),Cr.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,u){var d=this.get_distinct_id();if(e&&d!==e){if("string"==typeof e&&0===e.indexOf(vn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==d&&e!==this.get_property(hn)&&(this.unregister(hn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,u),e!==d&&this.track("$identify",{distinct_id:e,$anon_distinct_id:d},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=Cr.UUID();this.register_once({distinct_id:vn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,t){if(e===this.get_property(pn))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return Cr.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(hn,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},(function(){n.identify(e)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},MixpanelLib.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},MixpanelLib.prototype.set_config=function(e){Cr.isObject(e)&&(Cr.extend(this.config,e),e.batch_size&&Cr.each(this.request_batchers,(function(e){e.resetBatchSize()})),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),Yt.DEBUG=Yt.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var t=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,fr.call(arguments,1));return void 0===t&&(this.report_error(e+" hook did not return a value"),t=null),t},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==_n&&(e=_n+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return Cr.isBlockedUA(wr)||this._flags.disable_all_events||Cr.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Cr.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_tracking()||!this.get_config("opt_out_tracking_by_default")&&!Cr.cookie.get("mp_optout")||(Cr.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,t){return t=Cr.extend({track:Cr.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),Cr.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=Cr.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=Cr.extend({clear_persistence:!0,delete_user:!0},e)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(optOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(hasOptedIn,e)},MixpanelLib.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(hasOptedOut,e)},MixpanelLib.prototype.clear_opt_in_out_tracking=function(e){e=Cr.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){Rr.error.apply(Rr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Rr.error(n)}},MixpanelLib.prototype.init=MixpanelLib.prototype.init,MixpanelLib.prototype.reset=MixpanelLib.prototype.reset,MixpanelLib.prototype.disable=MixpanelLib.prototype.disable,MixpanelLib.prototype.time_event=MixpanelLib.prototype.time_event,MixpanelLib.prototype.track=MixpanelLib.prototype.track,MixpanelLib.prototype.track_links=MixpanelLib.prototype.track_links,MixpanelLib.prototype.track_forms=MixpanelLib.prototype.track_forms,MixpanelLib.prototype.track_pageview=MixpanelLib.prototype.track_pageview,MixpanelLib.prototype.register=MixpanelLib.prototype.register,MixpanelLib.prototype.register_once=MixpanelLib.prototype.register_once,MixpanelLib.prototype.unregister=MixpanelLib.prototype.unregister,MixpanelLib.prototype.identify=MixpanelLib.prototype.identify,MixpanelLib.prototype.alias=MixpanelLib.prototype.alias,MixpanelLib.prototype.name_tag=MixpanelLib.prototype.name_tag,MixpanelLib.prototype.set_config=MixpanelLib.prototype.set_config,MixpanelLib.prototype.get_config=MixpanelLib.prototype.get_config,MixpanelLib.prototype.get_property=MixpanelLib.prototype.get_property,MixpanelLib.prototype.get_distinct_id=MixpanelLib.prototype.get_distinct_id,MixpanelLib.prototype.toString=MixpanelLib.prototype.toString,MixpanelLib.prototype.opt_out_tracking=MixpanelLib.prototype.opt_out_tracking,MixpanelLib.prototype.opt_in_tracking=MixpanelLib.prototype.opt_in_tracking,MixpanelLib.prototype.has_opted_out_tracking=MixpanelLib.prototype.has_opted_out_tracking,MixpanelLib.prototype.has_opted_in_tracking=MixpanelLib.prototype.has_opted_in_tracking,MixpanelLib.prototype.clear_opt_in_out_tracking=MixpanelLib.prototype.clear_opt_in_out_tracking,MixpanelLib.prototype.get_group=MixpanelLib.prototype.get_group,MixpanelLib.prototype.set_group=MixpanelLib.prototype.set_group,MixpanelLib.prototype.add_group=MixpanelLib.prototype.add_group,MixpanelLib.prototype.remove_group=MixpanelLib.prototype.remove_group,MixpanelLib.prototype.track_with_groups=MixpanelLib.prototype.track_with_groups,MixpanelLib.prototype.start_batch_senders=MixpanelLib.prototype.start_batch_senders,MixpanelLib.prototype.stop_batch_senders=MixpanelLib.prototype.stop_batch_senders,MixpanelLib.prototype.start_session_recording=MixpanelLib.prototype.start_session_recording,MixpanelLib.prototype.stop_session_recording=MixpanelLib.prototype.stop_session_recording,MixpanelLib.prototype.get_session_recording_properties=MixpanelLib.prototype.get_session_recording_properties,MixpanelLib.prototype.DEFAULT_API_ROUTES=Sn,MixpanelPersistence.prototype.properties=MixpanelPersistence.prototype.properties,MixpanelPersistence.prototype.update_search_keyword=MixpanelPersistence.prototype.update_search_keyword,MixpanelPersistence.prototype.update_referrer_info=MixpanelPersistence.prototype.update_referrer_info,MixpanelPersistence.prototype.get_cross_subdomain=MixpanelPersistence.prototype.get_cross_subdomain,MixpanelPersistence.prototype.clear=MixpanelPersistence.prototype.clear;var En={},override_mp_init_func=function(){gn.init=function(e,t,n){if(n)return gn[n]||(gn[n]=En[n]=create_mplib(e,t,n),gn[n]._loaded()),gn[n];var i=gn;En[_n]?i=En[_n]:e&&((i=create_mplib(e,t,_n))._loaded(),En[_n]=i),gn=i,1===rn&&(Kt[_n]=gn),Cr.each(En,(function(e,t){t!==_n&&(gn[t]=e)})),gn._=Cr}};var Tn=function init_as_module(e){return load_extra_bundle=e,rn=0,gn=new MixpanelLib,override_mp_init_func(),gn.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,xn=!0,kn=!1,Cr.each(En,(function(e){e._dom_loaded()})))}if(vr.addEventListener)"complete"===vr.readyState?dom_loaded_handler():vr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(vr.attachEvent){vr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===Kt.frameElement}catch(t){}vr.documentElement.doScroll&&e&&function do_scroll_check(){try{vr.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}Cr.register_event(Kt,"load",dom_loaded_handler,!0)}(),gn}((function loadNoop(e,t){t()}));const Cn="mp_distinct_id";function isReady(){return void 0!==window.mixpanel}function updateCachedDistinctId(e){localStorage.setItem(Cn,e)}const Rn={init:function init$2(e,t=!1,n){return new Promise((i=>{Tn.init(e,{debug:t,loaded:()=>{window.mixpanel=Tn,i()},...n&&{api_host:n}})}))},isReady:isReady,track:function track(e,t){isReady()&&Tn.track(e,t)},identify:function identify$1(e,t){Tn.identify(e),updateCachedDistinctId(e),Tn.people.set(t)},attachProperty:function attachProperty(e,t){isReady()&&Tn.people.union(e,[t])},getMixpanelDistinctId:()=>{const e=localStorage.getItem(Cn);if(Tn&&Tn.get_distinct_id){const e=Tn.get_distinct_id();return updateCachedDistinctId(e),e}return e||null}},Pn=_e.object({firstName:_e.string().optional(),lastName:_e.string().optional(),email:_e.string().email().optional(),phone:_e.string().optional()}),Mn=["web","web-mobile","ios","android","app"],Nn=_e.enum(Mn).refine((e=>Mn.includes(e)),{message:`Product must be one of: ${Mn.join(", ")}`}),Dn=_e.object({product:Nn});const dateValidation=e=>!(!/^\d{4}-\d{2}-\d{2}$/.test(e)&&!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))||!(!/^\d{4}-\d{2}-\d{2}/.test(e)||isNaN(Date.parse(e))),stringField=e=>_e.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>_e.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>_e.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>_e.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,t,n)=>_e.array(e).min(n,`${t} must have at least ${n} items`),An=_e.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:Nn});const Zn=_e.object({"Passenger Birthdate":dateField("Passenger Birthdate"),"Passenger Seat":stringField("Passenger Seat"),"Passenger Name":stringField("Passenger Name"),"Passenger Document Type":stringField("Document Type"),"Passenger Document Id":stringField("Document ID")}).strict(),jn=_e.object({"Departure Arrival":dateField("Departure Arrival"),"Departure Destination":stringField("Departure Destination"),"Departure Destination Terminal":stringField("Departure Destination Terminal"),"Departure Line":stringField("Departure Line"),"Departure Origin":stringField("Departure Origin"),"Departure Origin Terminal":stringField("Departure Origin Terminal"),"Departure Price":numberField("Departure Price"),"Departure Route":stringField("Departure Route"),"Departure Stops":intField("Departure Stops"),"Departure Time":dateField("Departure Time"),"Departure Transport Type":stringField("Departure Transport Type"),"Departure Transporter":stringField("Departure Transporter"),"Return Arrival":dateField("Return Arrival").optional(),"Return Destination":stringField("Return Destination").optional(),"Return Destination Terminal":stringField("Return Destination Terminal").optional(),"Return Line":stringField("Return Line").optional(),"Return Origin":stringField("Return Origin").optional(),"Return Origin Terminal":stringField("Return Origin Terminal").optional(),"Return Price":numberField("Return Price").optional(),"Return Route":stringField("Return Route").optional(),"Return Stops":intField("Return Stops").optional(),"Return Time":dateField("Return Time").optional(),"Return Transport Type":stringField("Return Transport Type").optional(),"Return Transporter":stringField("Return Transporter").optional(),"Recommended Trip":_e.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),Ln=_e.object({Trips:arrayField(jn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:Nn,Passengers:arrayField(Zn,"Passengers",1).optional()}).strict();const qn=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(jn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":_e.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:Nn,Passengers:arrayField(Zn,"Passengers",1).optional(),Insurance:(Un="Insurance",_e.boolean({required_error:`${Un} is required`,invalid_type_error:`${Un} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var Un;const Fn=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Price:_e.number().positive("Price must be a positive number"),"Result Position":_e.number().int("Result Position must be an integer"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":_e.string().min(1,"Transport Type is required"),Transporter:_e.string().min(1,"Transporter is required"),product:Nn,"Recommended Trip":_e.boolean(),"Recommended Trip Type":_e.string().optional(),"Trip Type":_e.string().min(1,"Trip Type is required"),"Bus Type":_e.string().min(1,"Bus Type is required")});const Bn=_e.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(jn,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:Nn,Passengers:arrayField(Zn,"Passengers",1).optional()}).strict();const $n=_e.object({Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":_e.number().int("Departure Delta must be an integer"),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination terminal is required"),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Passengers:_e.number().int("Passenger count must be an integer"),Return:_e.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:_e.string().min(1,"Route is required"),"Trip Length":_e.number().positive().optional(),Categories:_e.array(_e.string()).optional(),product:Nn});const zn=_e.object({Arrival:_e.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:_e.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:_e.string().min(1,"Destination is required"),"Destination Terminal":_e.string().min(1,"Destination Terminal is required"),Line:_e.string().min(1,"Line is required").optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin Terminal is required"),Price:_e.number().positive("Price must be a positive number"),Route:_e.string().min(1,"Route is required"),Stops:_e.number().int("Stops must be an integer").nonnegative().optional(),Tickets:_e.number().int("Tickets must be an integer").positive(),Transporter:_e.string().min(1,"Transporter is required"),Way:_e.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:Nn});const Wn=_e.object({"Bus count":_e.number().int("Bus count must be an integer"),Departure:_e.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":_e.number().int("Departure Delta must be an integer").optional(),Destination:_e.string().min(1,"Destination is required").optional(),"Destination Terminal":_e.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":_e.boolean().default(!1).optional(),Origin:_e.string().min(1,"Origin is required"),"Origin Terminal":_e.string().min(1,"Origin terminal is required"),Route:_e.string().min(1,"Route is required"),product:Nn}),Vn=_e.object({mixpanelToken:_e.string().min(1,"Mixpanel token is required"),debug:_e.boolean().optional(),identificationKey:_e.string().min(1,"Identification key is required"),isSandbox:_e.boolean().optional(),mixpanelProxyUrl:_e.string().optional(),identifyProxyUrl:_e.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),Hn={Search:$n,"Seat Change":zn,"Interest In Home":Dn,"Passengers Created":Ln,"Payment Attempt":qn,"Interest In Search":An,"View Results":Wn,"Purchase Attempt":Bn,"Picked Departure":Fn};function validateProps(e,t){try{t.parse(e)}catch(or){if(or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(or)}}throw{message:"Unknown validation error"}}}const Kn={parseEventProps:function parseEventProps(e,t){const n=Hn[e]||ve;try{n.parse(t)}catch(or){if(or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(or)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,Vn)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,Pn)},validateProps:validateProps};let Gn=null;function isTrackerReady(){return Rn.isReady()}let Jn=null;const Yn={init:function init(){return new Promise((e=>{if(Jn)return void e(Jn);const t="Geolocation Requested";navigator.geolocation.getCurrentPosition((n=>{const{latitude:i,longitude:s}=n.coords;Jn={lat:i,long:s},isTrackerReady()&&trackCustomEvent(t,{geolocationAccepted:!0}),e(Jn)}),(()=>{isTrackerReady()&&trackCustomEvent(t,{geolocationAccepted:!1}),e(null)}))}))},getCoordinates:function getCoordinates(){return Jn}},Xn=["Search","View Results"],Qn={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventTracked(e,t){Rn.track("Event Tracked",{"Event Name":e,From:t})}function trackEventError(e,t){try{tryTrackEvent("Track Event Error",(async()=>{Rn.track("Track Event Error",{"Failed Event Name":e,"Error Message":(null==t?void 0:t.message)??"Failed to track event","Validation Errors":(null==t?void 0:t.errors)||[]})}))}catch(n){console.error("Failed to track error event:",n)}}async function tryTrackEvent(e,t){Rn.isReady()?(await t(),trackEventTracked(e,"Mixpanel Ready")):window.addEventListener("Tracker Ready",(async()=>{try{await t(),trackEventTracked(e,"Mixpanel Ready Listener")}catch(or){trackEventError(e,or)}}))}async function trackEvent(e,t,n={}){if(!Rn.isReady())throw new Error("Mixpanel is not initialized.");try{Kn.parseEventProps(e,t);const i=!Xn.includes(e),s=await st.getFingerprint(i),a={},c=Yn.getCoordinates();c&&(a.$latitude=c.lat,a.$longitude=c.long);const u={"User Fingerprint":s},d=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),t={};return Object.entries(Qn).forEach((([n,i])=>{const s=e.get(n);s&&(t[i]=s)})),t}catch(or){return console.error("Error extracting tracking parameters:",or),{}}}(),l=function flattenEventData(e){return Object.entries(e).reduce(((e,[t,n])=>Array.isArray(n)?Array.isArray(n)&&n.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[t]=n,e):(n.forEach((t=>{"object"==typeof t&&null!==t&&Object.entries(t).forEach((([t,n])=>{e[t]?e[t].push(n):e[t]=[n]}))})),e):(e[t]=n,e)),{})}(t),p={...u,...l,...d,...a,...n};Rn.track(e,p)}catch(or){console.error(`Error tracking event '${e}':`,or),trackEventError(e,or)}}function trackCustomEvent(e,t={},n={}){try{be.parse(e),trackEvent(e,t,n)}catch(or){console.error("Error trackCustomEvent:",or),trackEventError(e,or)}}const eo=_e.object({email:_e.string().email().optional(),phone:_e.string().optional(),cpf:_e.string().optional(),passport:_e.string().optional(),rg:_e.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{Kn.validateProps(e,eo);const t=[],n=st.getCachedFingerprint(),i=Rn.getMixpanelDistinctId();n&&t.push({key:"fingerprint",value:n}),i&&t.push({key:"distinct_id",value:i});const s=function getAnonymousProfilePayload(e,t){let n="phone",i=e.phone||"";const s=[];e.email&&(n="email",i=e.email);const a=["cpf","passport","rg","email","phone","salesforceid"];return Object.entries(e).forEach((([e,t])=>{a.includes(e.toLowerCase())&&t&&e!==n&&s.push({key:e,value:t})})),t.length&&t.forEach((e=>s.push(e))),{identifier_key:n,identifier_value:i,details:{},identifiers:s}}(e,t);return(await ut.core.createAnonymousProfile(s)).data}catch(or){return void console.error("Could not create anonymous profile:",or)}}const to=["firstName","lastName","email","phone"];const identifyWithLocation=async(e,t)=>{try{const n=function getApiConfig(){return Gn}(),i=Yn.getCoordinates();if(!i)return;t.first_name=t.firstName,t.last_name=t.lastName,t.latitude=i.lat,t.longitude=i.long,t.ip="0",t.name=`${t.firstName} ${t.lastName}`,delete t.firstName,delete t.lastName,fetch(`${null==n?void 0:n.coreUrl}/${null==n?void 0:n.coreVersion}/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==n?void 0:n.coreApiKey)||"",...(null==n?void 0:n.headers)||{}},body:JSON.stringify({profile_params:{...t,distinct_id:e}})})}catch(or){console.error("Error identifying user-service",or)}};const ro={init:async function init$1(e){Kn.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i,isSandbox:s=!1,mixpanelProxyUrl:a,identifyProxyUrl:c}=e;Yn.init(),await Rn.init(t,n,a);try{await st.initFingerprint(i,c)}catch(or){console.error("Error initializing identification service:",or)}Gn=lt.coreAPIConfig[s?"sandbox":"prod"],ut.setConfig(Gn),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(e,t={}){try{tryTrackEvent("Identify",(async()=>{if(Kn.parseIdentifyProps(t),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const n=await createAnonymousProfile(t);n&&(t.reservamos_one_id=n.id);const i=function mapProperties(e){return{$first_name:null==e?void 0:e.firstName,$last_name:null==e?void 0:e.lastName,$email:null==e?void 0:e.email,$phone:null==e?void 0:e.phone,...Object.keys(e).reduce(((t,n)=>(to.includes(n)||(t[n]=e[n]),t)),{})}}(t);Rn.identify(e,i);const s=await st.getFingerprint();s&&Rn.attachProperty("Known Fingerprints",s)}))}catch(or){console.error("Error identifying user",or),trackEventError("Identify",or)}finally{identifyWithLocation(e,t)}},identifiers:{getFingerprintId:st.getCachedFingerprint,getDistinctId:Rn.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},track:{search:function trackSearch(e,t={}){trackEvent("Search",e,t)},seatChange:function trackSeatChange(e,t={}){trackEvent("Seat Change",e,t)},interestInHome:function trackInterestInHome(e,t={}){trackEvent("Interest In Home",e,t)},interestInSearch:function trackInterestInSearch(e,t={}){trackEvent("Interest In Search",e,t)},viewResults:function trackViewResults(e,t={}){trackEvent("View Results",e,t)},passengersCreated:function trackPassengersCreated(e,t={}){trackEvent("Passengers Created",e,t)},paymentAttempt:async(e,t={})=>{trackEvent("Payment Attempt",e,t)},purchaseAttempt:function trackPurchaseAttempt(e,t={}){trackEvent("Purchase Attempt",e,t)},pickedDeparture:function trackSearch$1(e,t={}){trackEvent("Picked Departure",e,t)},customEvent:trackCustomEvent,purchaseCanceled:function trackPurchaseCanceled(e,t={}){trackEvent("Purchase Canceled",e,t)}}};module.exports=ro;
|
|
31
31
|
//# sourceMappingURL=browser-analytics.cjs.map
|