@reservamos/browser-analytics 1.0.10 → 1.0.11

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.
@@ -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,i,o,s){return new(o||(o=Promise))((function(i,a){function fulfilled(e){try{step(s.next(e))}catch(i){a(i)}}function rejected(e){try{step(s.throw(e))}catch(i){a(i)}}function step(e){e.done?i(e.value):function adopt(e){return e instanceof o?e:new o((function(i){i(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="undefined"==typeof Uint8Array?[]:new Uint8Array(256),o=0;o<64;o++)i[e.charCodeAt(o)]=o;var encode2=function(i){var o,s=new Uint8Array(i),a=s.length,h="";for(o=0;o<a;o+=3)h+=e[s[o]>>2],h+=e[(3&s[o])<<4|s[o+1]>>4],h+=e[(15&s[o+1])<<2|s[o+2]>>6],h+=e[63&s[o+2]];return a%3==2?h=h.substring(0,h.length-1)+"=":a%3==1&&(h=h.substring(0,h.length-2)+"=="),h};const s=new Map,a=new Map;const h=self;h.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return h.postMessage({id:e.data.id});{const{id:i,bitmap:o,width:f,height:g,dataURLOptions:_}=e.data,v=function getTransparentBlobFor(e,i,o){return __awaiter2(this,0,void 0,(function*(){const s=`${e}-${i}`;if("OffscreenCanvas"in globalThis){if(a.has(s))return a.get(s);const h=new OffscreenCanvas(e,i);h.getContext("2d");const f=yield h.convertToBlob(o),g=yield f.arrayBuffer(),_=encode2(g);return a.set(s,_),_}return""}))}(f,g,_),b=new OffscreenCanvas(f,g);b.getContext("2d").drawImage(o,0,0),o.close();const S=yield b.convertToBlob(_),I=S.type,x=yield S.arrayBuffer(),T=encode2(x);if(!s.has(i)&&(yield v)===T)return s.set(i,T),h.postMessage({id:i});if(s.get(i)===T)return h.postMessage({id:i});h.postMessage({id:i,type:I,base64:T,width:f,height:g}),s.set(i,T)}}))}}()}));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,i)=>{!(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(i)};const{sampling:i="all",win:o,blockClass:s,blockSelector:a,recordCanvas:h,dataURLOptions:f}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,h&&"all"===i&&this.initCanvasMutationObserver(o,s,a),h&&"number"==typeof i&&this.initCanvasFPSObserver(i,o,s,a,{dataURLOptions:f})}initCanvasFPSObserver(e,i,o,s,a){const h=initCanvasContextObserver(i,o,s,!0),f=new Map,g=new hr;g.onmessage=e=>{const{id:i}=e.data;if(f.set(i,!1),!("base64"in e.data))return;const{base64:o,type:s,width:a,height:h}=e.data;this.mutationCb({id:i,type:ir["2D"],commands:[{property:"clearRect",args:[0,0,a,h]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:o}],type:s}]},0,0]}]})};const _=1e3/e;let v,b=0;const takeCanvasSnapshots=e=>{b&&e-b<_||(b=e,(()=>{const e=[];return i.document.querySelectorAll("canvas").forEach((i=>{isBlocked(i,o,s,!0)||e.push(i)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var i;const o=this.mirror.getId(e);if(f.get(o))return;if(0===e.width||0===e.height)return;if(f.set(o,!0),["webgl","webgl2"].includes(e.__context)){const o=e.getContext(e.__context);!1===(null===(i=null==o?void 0:o.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&o.clear(o.COLOR_BUFFER_BIT)}const s=yield createImageBitmap(e);g.postMessage({id:o,bitmap:s,width:e.width,height:e.height,dataURLOptions:a.dataURLOptions},[s])}))))),v=requestAnimationFrame(takeCanvasSnapshots)};v=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{h(),cancelAnimationFrame(v)}}initCanvasMutationObserver(e,i,o){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=initCanvasContextObserver(e,i,o,!1),a=function initCanvas2DMutationObserver(e,i,o,s){const a=[],h=Object.getOwnPropertyNames(i.CanvasRenderingContext2D.prototype);for(const g of h)try{if("function"!=typeof i.CanvasRenderingContext2D.prototype[g])continue;const h=patch(i.CanvasRenderingContext2D.prototype,g,(function(a){return function(...h){return isBlocked(this.canvas,o,s,!0)||setTimeout((()=>{const o=serializeArgs(h,i,this);e(this.canvas,{type:ir["2D"],property:g,args:o})}),0),a.apply(this,h)}}));a.push(h)}catch(f){const o=hookSetter(i.CanvasRenderingContext2D.prototype,g,{set(i){e(this.canvas,{type:ir["2D"],property:g,args:[i],setter:!0})}});a.push(o)}return()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,i,o),h=function initCanvasWebGLMutationObserver(e,i,o,s,a){const h=[];return h.push(...patchGLPrototype(i.WebGLRenderingContext.prototype,ir.WebGL,e,o,s,0,i)),void 0!==i.WebGL2RenderingContext&&h.push(...patchGLPrototype(i.WebGL2RenderingContext.prototype,ir.WebGL2,e,o,s,0,i)),()=>{h.forEach((e=>e()))}}(this.processMutation.bind(this),e,i,o,this.mirror);this.resetObservers=()=>{s(),a(),h()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,i)=>{const o=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,o)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const o=this.pendingCanvasMutations.get(e);if(!o||-1===i)return;const s=o.map((e=>{const i=function __rest(e,i){var o={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.indexOf(s)<0&&(o[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)i.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(o[s[a]]=e[s[a]])}return o}(e,["type"]);return i})),{type:a}=o[0];this.mutationCb({id:i,type:a,commands:s}),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,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(0===e.length)return;const o={id:i,styleIds:[]},s=[];for(const a of e){let e;this.styleMirror.has(a)?e=this.styleMirror.getId(a):(e=this.styleMirror.add(a),s.push({styleId:e,rules:Array.from(a.rules||CSSRule,((e,i)=>({rule:stringifyRule(e),index:i})))})),o.styleIds.push(e)}s.length>0&&(o.styles=s),this.adoptedStyleSheetCb(o)}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,i){const o=this.nodeMap.get(e);return o&&Array.from(o).some((e=>e!==i))}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:Qt()})}let fr,mr,gr,_r=!1;const yr=function createMirror(){return new Mirror}();function record(e={}){const{emit:i,checkoutEveryNms:o,checkoutEveryNth:s,blockClass:a="rr-block",blockSelector:h=null,ignoreClass:f="rr-ignore",ignoreSelector:g=null,maskTextClass:_="rr-mask",maskTextSelector:v=null,inlineStylesheet:b=!0,maskAllInputs:S,maskInputOptions:I,slimDOMOptions:x,maskInputFn:T,maskTextFn:O,hooks:R,packFn:N,sampling:P={},dataURLOptions:D={},mousemoveWait:Z,recordDOM:A=!0,recordCanvas:L=!1,recordCrossOriginIframes:j=!1,recordAfter:q=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:U=!1,collectFonts:B=!1,inlineImages:z=!1,plugins:W,keepIframeSrcFn:K=()=>!1,ignoreCSSAttributes:H=new Set([]),errorHandler:G}=e;!function registerErrorHandler(e){or=e}(G);const J=!j||window.parent===window;let Y=!1;if(!J)try{window.parent.document&&(Y=!1)}catch(se){Y=!0}if(J&&!i)throw new Error("emit function is required");void 0!==Z&&void 0===P.mousemove&&(P.mousemove=Z),yr.reset();const X=!0===S?{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!==I?I:{password:!0},Q=!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===x,headMetaDescKeywords:"all"===x}:x||{};let ee;!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 i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===i)return!0}while(i=i&&i.parentNode);return!1})}();let te=0;const eventProcessor=e=>{for(const i of W||[])i.eventProcessor&&(e=i.eventProcessor(e));return N&&!Y&&(e=N(e)),e};fr=(e,a)=>{var h;if(!(null===(h=sr[0])||void 0===h?void 0:h.isFrozen())||e.type===er.FullSnapshot||e.type===er.IncrementalSnapshot&&e.data.source===tr.Mutation||sr.forEach((e=>e.unfreeze())),J)null==i||i(eventProcessor(e),a);else if(Y){const i={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:a};window.parent.postMessage(i,"*")}if(e.type===er.FullSnapshot)ee=e,te=0;else if(e.type===er.IncrementalSnapshot){if(e.data.source===tr.Mutation&&e.data.isAttachIframe)return;te++;const i=s&&te>=s,a=o&&e.timestamp-ee.timestamp>o;(i||a)&&mr(!0)}};const wrappedMutationEmit=e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Mutation},e)}))},wrappedScrollEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Scroll},e)})),wrappedCanvasMutationEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CanvasMutation},e)})),re=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.AdoptedStyleSheet},e)}))}),ne=new IframeManager({mirror:yr,mutationCb:wrappedMutationEmit,stylesheetManager:re,recordCrossOriginIframes:j,wrappedEmit:fr});for(const ae of W||[])ae.getMirror&&ae.getMirror({nodeMirror:yr,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});const ie=new ProcessedNodeManager;gr=new CanvasManager({recordCanvas:L,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:a,blockSelector:h,mirror:yr,sampling:P.canvas,dataURLOptions:D});const oe=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:a,blockSelector:h,maskTextClass:_,maskTextSelector:v,inlineStylesheet:b,maskInputOptions:X,dataURLOptions:D,maskTextFn:O,maskInputFn:T,recordCanvas:L,inlineImages:z,sampling:P,slimDOMOptions:Q,iframeManager:ne,stylesheetManager:re,canvasManager:gr,keepIframeSrcFn:K,processedNodeManager:ie},mirror:yr});mr=(e=!1)=>{if(!A)return;fr(wrapEvent({type:er.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),re.reset(),oe.init(),sr.forEach((e=>e.lock()));const i=function snapshot(e,i){const{mirror:o=new Mirror,blockClass:s="rr-block",blockSelector:a=null,maskTextClass:h="rr-mask",maskTextSelector:f=null,inlineStylesheet:g=!0,inlineImages:_=!1,recordCanvas:v=!1,maskAllInputs:b=!1,maskTextFn:S,maskInputFn:I,slimDOM:x=!1,dataURLOptions:T,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A=()=>!1}=i||{};return serializeNodeWithId(e,{doc:e,mirror:o,blockClass:s,blockSelector:a,maskTextClass:h,maskTextSelector:f,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===b?{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===b?{password:!0}:b,maskTextFn:S,maskInputFn:I,slimDOMOptions:!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===x,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===x?{}:x,dataURLOptions:T,inlineImages:_,recordCanvas:v,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A,newlyAddedElement:!1})}(document,{mirror:yr,blockClass:a,blockSelector:h,maskTextClass:_,maskTextSelector:v,inlineStylesheet:b,maskAllInputs:X,maskTextFn:O,slimDOM:Q,dataURLOptions:D,recordCanvas:L,inlineImages:z,onSerialize:e=>{isSerializedIframe(e,yr)&&ne.addIframe(e),isSerializedStylesheet(e,yr)&&re.trackLinkElement(e),hasShadowRoot(e)&&oe.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,i)=>{ne.attachIframe(e,i),oe.observeAttachShadow(e)},onStylesheetLoad:(e,i)=>{re.attachLinkElement(e,i)},keepIframeSrcFn:K});if(!i)return console.warn("Failed to snapshot the document");fr(wrapEvent({type:er.FullSnapshot,data:{node:i,initialOffset:getWindowScroll(window)}}),e),sr.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&re.adoptStyleSheets(document.adoptedStyleSheets,yr.getId(document))};try{const e=[],observe=e=>{var i;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,i)=>fr(wrapEvent({type:er.IncrementalSnapshot,data:{source:i,positions:e}})),mouseInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.ViewportResize},e)})),inputCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Input},e)})),mediaInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MediaInteraction},e)})),styleSheetRuleCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleSheetRule},e)})),styleDeclarationCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Font},e)})),selectionCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Selection},e)}))},customElementCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CustomElement},e)}))},blockClass:a,ignoreClass:f,ignoreSelector:g,maskTextClass:_,maskTextSelector:v,maskInputOptions:X,inlineStylesheet:b,sampling:P,recordDOM:A,recordCanvas:L,inlineImages:z,userTriggeredOnInput:U,collectFonts:B,doc:e,maskInputFn:T,maskTextFn:O,keepIframeSrcFn:K,blockSelector:h,slimDOMOptions:Q,dataURLOptions:D,mirror:yr,iframeManager:ne,stylesheetManager:re,shadowDomManager:oe,processedNodeManager:ie,canvasManager:gr,ignoreCSSAttributes:H,plugins:(null===(i=null==W?void 0:W.filter((e=>e.observer)))||void 0===i?void 0:i.map((e=>({observer:e.observer,options:e.options,callback:i=>fr(wrapEvent({type:er.Plugin,data:{plugin:e.name,payload:i}}))}))))||[]},R)};ne.addLoadListener((i=>{try{e.push(observe(i.contentDocument))}catch(Or){console.warn(Or)}}));const init2=()=>{mr(),e.push(observe(document)),_r=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{fr(wrapEvent({type:er.DomContentLoaded,data:{}})),"DOMContentLoaded"===q&&init2()}))),e.push(on("load",(()=>{fr(wrapEvent({type:er.Load,data:{}})),"load"===q&&init2()}),window))),()=>{e.forEach((e=>e())),ie.destroy(),_r=!1,function unregisterErrorHandler(){or=void 0}()}}catch(Or){console.warn(Or)}}record.addCustomEvent=(e,i)=>{if(!_r)throw new Error("please add custom event after start recording");fr(wrapEvent({type:er.Custom,data:{tag:e,payload:i}}))},record.freezePage=()=>{sr.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!_r)throw new Error("please take full snapshot after start recording");mr(e)},record.mirror=yr;var vr,br=(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))(br||{}),Sr=(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))(Sr||{}),kr={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var wr={hostname:""};vr={navigator:{userAgent:"",onLine:!0},document:{location:wr,referrer:""},screen:{width:0,height:0},location:wr}}else vr=window;var Ir,xr,Er,Cr,Tr,Or,Rr,Mr,Nr,Pr,Dr=864e5,Zr=8e3,Ar=Array.prototype,Lr=Function.prototype,jr=Object.prototype,Fr=Ar.slice,$r=jr.toString,qr=jr.hasOwnProperty,Ur=vr.console,Br=vr.navigator,zr=vr.document,Vr=vr.opera,Wr=vr.screen,Kr=Br.userAgent,Hr=Lr.bind,Gr=Ar.forEach,Jr=Ar.indexOf,Yr=Ar.map,Xr=Array.isArray,Qr={},en={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},tn={log:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur)try{Ur.log.apply(Ur,arguments)}catch(e){en.each(arguments,(function(e){Ur.log(e)}))}},warn:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel warning:"].concat(en.toArray(arguments));try{Ur.warn.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.warn(e)}))}}},error:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.error(e)}))}}},critical:function(){if(!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.error(e)}))}}}},log_func_with_prefix=function(e,i){return function(){return arguments[0]="["+i+"] "+arguments[0],e.apply(tn,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(tn.log,e),error:log_func_with_prefix(tn.error,e),critical:log_func_with_prefix(tn.critical,e)}};en.bind=function(e,i){var o,s;if(Hr&&e.bind===Hr)return Hr.apply(e,Fr.call(arguments,1));if(!en.isFunction(e))throw new TypeError;return o=Fr.call(arguments,2),s=function(){if(!(this instanceof s))return e.apply(i,o.concat(Fr.call(arguments)));var a={};a.prototype=e.prototype;var h=new a;a.prototype=null;var f=e.apply(h,o.concat(Fr.call(arguments)));return Object(f)===f?f:h},s},en.each=function(e,i,o){if(null!=e)if(Gr&&e.forEach===Gr)e.forEach(i,o);else if(e.length===+e.length){for(var s=0,a=e.length;s<a;s++)if(s in e&&i.call(o,e[s],s,e)===Qr)return}else for(var h in e)if(qr.call(e,h)&&i.call(o,e[h],h,e)===Qr)return},en.extend=function(e){return en.each(Fr.call(arguments,1),(function(i){for(var o in i)void 0!==i[o]&&(e[o]=i[o])})),e},en.isArray=Xr||function(e){return"[object Array]"===$r.call(e)},en.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(i){return!1}},en.isArguments=function(e){return!(!e||!qr.call(e,"callee"))},en.toArray=function(e){return e?e.toArray?e.toArray():en.isArray(e)||en.isArguments(e)?Fr.call(e):en.values(e):[]},en.map=function(e,i,o){if(Yr&&e.map===Yr)return e.map(i,o);var s=[];return en.each(e,(function(e){s.push(i.call(o,e))})),s},en.keys=function(e){var i=[];return null===e||en.each(e,(function(e,o){i[i.length]=o})),i},en.values=function(e){var i=[];return null===e||en.each(e,(function(e){i[i.length]=e})),i},en.include=function(e,i){var o=!1;return null===e?o:Jr&&e.indexOf===Jr?-1!=e.indexOf(i):(en.each(e,(function(e){if(o||(o=e===i))return Qr})),o)},en.includes=function(e,i){return-1!==e.indexOf(i)},en.inherit=function(e,i){return e.prototype=new i,e.prototype.constructor=e,e.superclass=i.prototype,e},en.isObject=function(e){return e===Object(e)&&!en.isArray(e)},en.isEmptyObject=function(e){if(en.isObject(e)){for(var i in e)if(qr.call(e,i))return!1;return!0}return!1},en.isUndefined=function(e){return void 0===e},en.isString=function(e){return"[object String]"==$r.call(e)},en.isDate=function(e){return"[object Date]"==$r.call(e)},en.isNumber=function(e){return"[object Number]"==$r.call(e)},en.isElement=function(e){return!(!e||1!==e.nodeType)},en.encodeDates=function(e){return en.each(e,(function(i,o){en.isDate(i)?e[o]=en.formatDate(i):en.isObject(i)&&(e[o]=en.encodeDates(i))})),e},en.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},en.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())},en.strip_empty_properties=function(e){var i={};return en.each(e,(function(e,o){en.isString(e)&&e.length>0&&(i[o]=e)})),i},en.truncate=function(e,i){var o;return"string"==typeof e?o=e.slice(0,i):en.isArray(e)?(o=[],en.each(e,(function(e){o.push(en.truncate(e,i))}))):en.isObject(e)?(o={},en.each(e,(function(e,s){o[s]=en.truncate(e,i)}))):o=e,o},en.JSONEncode=function(){return function(e){var quote=function(e){var i=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return i.lastIndex=0,i.test(e)?'"'+e.replace(i,(function(e){var i=o[e];return"string"==typeof i?i:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,i){var o="",s=0,a="",h="",f=0,g=o,_=[],v=i[e];switch(v&&"object"==typeof v&&"function"==typeof v.toJSON&&(v=v.toJSON(e)),typeof v){case"string":return quote(v);case"number":return isFinite(v)?String(v):"null";case"boolean":case"null":return String(v);case"object":if(!v)return"null";if(o+=" ",_=[],"[object Array]"===$r.apply(v)){for(f=v.length,s=0;s<f;s+=1)_[s]=str(s,v)||"null";return h=0===_.length?"[]":o?"[\n"+o+_.join(",\n"+o)+"\n"+g+"]":"["+_.join(",")+"]",o=g,h}for(a in v)qr.call(v,a)&&(h=str(a,v))&&_.push(quote(a)+(o?": ":":")+h);return h=0===_.length?"{}":o?"{"+_.join(",")+g+"}":"{"+_.join(",")+"}",o=g,h}};return str("",{"":e})}}(),en.JSONDecode=(Tr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Or=function(e){var i=new SyntaxError(e);throw i.at=Ir,i.text=Er,i},Rr=function(e){return e&&e!==xr&&Or("Expected '"+e+"' instead of '"+xr+"'"),xr=Er.charAt(Ir),Ir+=1,xr},Mr=function(){var e,i="";for("-"===xr&&(i="-",Rr("-"));xr>="0"&&xr<="9";)i+=xr,Rr();if("."===xr)for(i+=".";Rr()&&xr>="0"&&xr<="9";)i+=xr;if("e"===xr||"E"===xr)for(i+=xr,Rr(),"-"!==xr&&"+"!==xr||(i+=xr,Rr());xr>="0"&&xr<="9";)i+=xr,Rr();if(e=+i,isFinite(e))return e;Or("Bad number")},Nr=function(){var e,i,o,s="";if('"'===xr)for(;Rr();){if('"'===xr)return Rr(),s;if("\\"===xr)if(Rr(),"u"===xr){for(o=0,i=0;i<4&&(e=parseInt(Rr(),16),isFinite(e));i+=1)o=16*o+e;s+=String.fromCharCode(o)}else{if("string"!=typeof Tr[xr])break;s+=Tr[xr]}else s+=xr}Or("Bad string")},Pr=function(){for(;xr&&xr<=" ";)Rr()},Cr=function(){switch(Pr(),xr){case"{":return function(){var e,i={};if("{"===xr){if(Rr("{"),Pr(),"}"===xr)return Rr("}"),i;for(;xr;){if(e=Nr(),Pr(),Rr(":"),Object.hasOwnProperty.call(i,e)&&Or('Duplicate key "'+e+'"'),i[e]=Cr(),Pr(),"}"===xr)return Rr("}"),i;Rr(","),Pr()}}Or("Bad object")}();case"[":return function(){var e=[];if("["===xr){if(Rr("["),Pr(),"]"===xr)return Rr("]"),e;for(;xr;){if(e.push(Cr()),Pr(),"]"===xr)return Rr("]"),e;Rr(","),Pr()}}Or("Bad array")}();case'"':return Nr();case"-":return Mr();default:return xr>="0"&&xr<="9"?Mr():function(){switch(xr){case"t":return Rr("t"),Rr("r"),Rr("u"),Rr("e"),!0;case"f":return Rr("f"),Rr("a"),Rr("l"),Rr("s"),Rr("e"),!1;case"n":return Rr("n"),Rr("u"),Rr("l"),Rr("l"),null}Or('Unexpected "'+xr+'"')}()}},function(e){var i;return Er=e,Ir=0,xr=" ",i=Cr(),Pr(),xr&&Or("Syntax error"),i}),en.base64Encode=function(e){var i,o,s,a,h,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,_=0,v="",b=[];if(!e)return e;e=en.utf8Encode(e);do{i=(h=e.charCodeAt(g++)<<16|e.charCodeAt(g++)<<8|e.charCodeAt(g++))>>18&63,o=h>>12&63,s=h>>6&63,a=63&h,b[_++]=f.charAt(i)+f.charAt(o)+f.charAt(s)+f.charAt(a)}while(g<e.length);switch(v=b.join(""),e.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v},en.utf8Encode=function(e){var i,o,s,a,h="";for(i=o=0,s=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,a=0;a<s;a++){var f=e.charCodeAt(a),g=null;f<128?o++:g=f>127&&f<2048?String.fromCharCode(f>>6|192,63&f|128):String.fromCharCode(f>>12|224,f>>6&63|128,63&f|128),null!==g&&(o>i&&(h+=e.substring(i,o)),h+=g,i=o=a+1)}return o>i&&(h+=e.substring(i,e.length)),h},en.UUID=function(){var T2=function(){var e,i=1*new Date;if(vr.performance&&vr.performance.now)e=vr.performance.now();else for(e=0;i==1*new Date;)e++;return i.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,i,o=Kr,s=[],a=0;function xor(e,i){var o,a=0;for(o=0;o<i.length;o++)a|=s[o]<<8*o;return e^a}for(e=0;e<o.length;e++)i=o.charCodeAt(e),s.unshift(255&i),s.length>=4&&(a=xor(a,s),s=[]);return s.length>0&&(a=xor(a,s)),a.toString(16)}()+"-"+e+"-"+T2()}}();var rn=["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"];en.isBlockedUA=function(e){var i;for(e=e.toLowerCase(),i=0;i<rn.length;i++)if(-1!==e.indexOf(rn[i]))return!0;return!1},en.HTTPBuildQuery=function(e,i){var o,s,a=[];return en.isUndefined(i)&&(i="&"),en.each(e,(function(e,i){o=encodeURIComponent(e.toString()),s=encodeURIComponent(i),a[a.length]=s+"="+o})),a.join(i)},en.getQueryParam=function(e,i){i=i.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var o=new RegExp("[\\?&]"+i+"=([^&#]*)").exec(e);if(null===o||o&&"string"!=typeof o[1]&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch(a){tn.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},en.cookie={get:function(e){for(var i=e+"=",o=zr.cookie.split(";"),s=0;s<o.length;s++){for(var a=o[s];" "==a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(i))return decodeURIComponent(a.substring(i.length,a.length))}return null},parse:function(e){var i;try{i=en.JSONDecode(en.cookie.get(e))||{}}catch(o){}return i},set_seconds:function(e,i,o,s,a,h,f){var g="",_="",v="";if(f)g="; domain="+f;else if(s){var b=extract_domain(zr.location.hostname);g=b?"; domain=."+b:""}if(o){var S=new Date;S.setTime(S.getTime()+1e3*o),_="; expires="+S.toGMTString()}h&&(a=!0,v="; SameSite=None"),a&&(v+="; secure"),zr.cookie=e+"="+encodeURIComponent(i)+_+"; path=/"+g+v},set:function(e,i,o,s,a,h,f){var g="",_="",v="";if(f)g="; domain="+f;else if(s){var b=extract_domain(zr.location.hostname);g=b?"; domain=."+b:""}if(o){var S=new Date;S.setTime(S.getTime()+24*o*60*60*1e3),_="; expires="+S.toGMTString()}h&&(a=!0,v="; SameSite=None"),a&&(v+="; secure");var I=e+"="+encodeURIComponent(i)+_+"; path=/"+g+v;return zr.cookie=I,I},remove:function(e,i,o){en.cookie.set(e,"",-1,i,!1,!1,o)}};var nn=null,localStorageSupported=function(e,i){if(null!==nn&&!i)return nn;var o=!0;try{e=e||window.localStorage;var s="__mplss_"+cheap_guid(8);e.setItem(s,"xyz"),"xyz"!==e.getItem(s)&&(o=!1),e.removeItem(s)}catch(a){o=!1}return nn=o,o};en.localStorage={is_supported:function(e){var i=localStorageSupported(null,e);return i||tn.error("localStorage unsupported; falling back to cookie store"),i},error:function(e){tn.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(i){en.localStorage.error(i)}return null},parse:function(e){try{return en.JSONDecode(en.localStorage.get(e))||{}}catch(i){}return null},set:function(e,i){try{window.localStorage.setItem(e,i)}catch(o){en.localStorage.error(o)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(i){en.localStorage.error(i)}}},en.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,i,o,s,a){if(e)if(e.addEventListener&&!s)e.addEventListener(i,o,!!a);else{var h="on"+i,f=e[h];e[h]=function makeHandler(e,i,o){var handler=function(s){if(s=s||fixEvent(window.event)){var a,h,f=!0;return en.isFunction(o)&&(a=o(s)),h=i.call(e,s),!1!==a&&!1!==h||(f=!1),f}};return handler}(e,o,f)}else tn.error("No valid element provided to register_event")}}();var sn=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');en.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(i,o){var s=" "+o+" ";return(" "+i.className+" ").replace(e," ").indexOf(s)>=0}function getElementsBySelector(e){if(!zr.getElementsByTagName)return[];var i,o,s,a,h,f,g,_,v,b,S=e.split(" "),I=[zr];for(f=0;f<S.length;f++)if((i=S[f].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){s=(o=i.split("#"))[0];var x=o[1],T=zr.getElementById(x);if(!T||s&&T.nodeName.toLowerCase()!=s)return[];I=[T]}else if(i.indexOf(".")>-1){s=(o=i.split("."))[0];var O=o[1];for(s||(s="*"),a=[],h=0,g=0;g<I.length;g++)for(v="*"==s?getAllChildren(I[g]):I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];for(I=[],b=0,g=0;g<a.length;g++)a[g].className&&en.isString(a[g].className)&&hasClass(a[g],O)&&(I[b++]=a[g])}else{var R=i.match(sn);if(R){s=R[1];var N,P=R[2],D=R[3],Z=R[4];for(s||(s="*"),a=[],h=0,g=0;g<I.length;g++)for(v="*"==s?getAllChildren(I[g]):I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];switch(I=[],b=0,D){case"=":N=function(e){return e.getAttribute(P)==Z};break;case"~":N=function(e){return e.getAttribute(P).match(new RegExp("\\b"+Z+"\\b"))};break;case"|":N=function(e){return e.getAttribute(P).match(new RegExp("^"+Z+"-?"))};break;case"^":N=function(e){return 0===e.getAttribute(P).indexOf(Z)};break;case"$":N=function(e){return e.getAttribute(P).lastIndexOf(Z)==e.getAttribute(P).length-Z.length};break;case"*":N=function(e){return e.getAttribute(P).indexOf(Z)>-1};break;default:N=function(e){return e.getAttribute(P)}}for(I=[],b=0,g=0;g<a.length;g++)N(a[g])&&(I[b++]=a[g])}else{for(s=i,a=[],h=0,g=0;g<I.length;g++)for(v=I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];I=a}}return I}return function(e){return en.isElement(e)?[e]:en.isObject(e)&&!en.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var an=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],cn=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];en.info={campaignParams:function(e){var i="",o={};return en.each(an,(function(s){(i=en.getQueryParam(zr.URL,s)).length?o[s]=i:void 0!==e&&(o[s]=e)})),o},clickParams:function(){var e="",i={};return en.each(cn,(function(o){(e=en.getQueryParam(zr.URL,o)).length&&(i[o]=e)})),i},marketingParams:function(){return en.extend(en.info.campaignParams(),en.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 i=en.info.searchEngine(e),o="yahoo"!=i?"q":"p",s={};if(null!==i){s.$search_engine=i;var a=en.getQueryParam(e,o);a.length&&(s.mp_keyword=a)}return s},browser:function(e,i,o){return i=i||"",o||en.includes(e," OPR/")?en.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":en.includes(e,"IEMobile")||en.includes(e,"WPDesktop")?"Internet Explorer Mobile":en.includes(e,"SamsungBrowser/")?"Samsung Internet":en.includes(e,"Edge")||en.includes(e,"Edg/")?"Microsoft Edge":en.includes(e,"FBIOS")?"Facebook Mobile":en.includes(e,"Chrome")?"Chrome":en.includes(e,"CriOS")?"Chrome iOS":en.includes(e,"UCWEB")||en.includes(e,"UCBrowser")?"UC Browser":en.includes(e,"FxiOS")?"Firefox iOS":en.includes(i,"Apple")?en.includes(e,"Mobile")?"Mobile Safari":"Safari":en.includes(e,"Android")?"Android Mobile":en.includes(e,"Konqueror")?"Konqueror":en.includes(e,"Firefox")?"Firefox":en.includes(e,"MSIE")||en.includes(e,"Trident/")?"Internet Explorer":en.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,i,o){var s={"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+)?)/}[en.info.browser(e,i,o)];if(void 0===s)return null;var a=e.match(s);return a?parseFloat(a[a.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 i=e.split("/");return i.length>=3?i[2]:""},currentUrl:function(){return vr.location.href},properties:function(e){return"object"!=typeof e&&(e={}),en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr),$referrer:zr.referrer,$referring_domain:en.info.referringDomain(zr.referrer),$device:en.info.device(Kr)}),{$current_url:en.info.currentUrl(),$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr),$screen_height:Wr.height,$screen_width:Wr.width,mp_lib:"web",$lib_version:kr.LIB_VERSION,$insert_id:cheap_guid(),time:en.timestamp()/1e3},en.strip_empty_properties(e))},people_properties:function(){return en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr)}),{$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr)})},mpPageViewProperties:function(){return en.strip_empty_properties({current_page_title:zr.title,current_domain:vr.location.hostname,current_url_path:vr.location.pathname,current_url_protocol:vr.location.protocol,current_url_search:vr.location.search})}};var cheap_guid=function(e){var i=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?i.substring(0,e):i},dn=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,un=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var i=un,o=e.split("."),s=o[o.length-1];(s.length>4||"com"===s||"org"===s)&&(i=dn);var a=e.match(i);return a?a[0]:""},ln=null,pn=null;"undefined"!=typeof JSON&&(ln=JSON.stringify,pn=JSON.parse),ln=ln||en.JSONEncode,pn=pn||en.JSONDecode,en.toArray=en.toArray,en.isObject=en.isObject,en.JSONEncode=en.JSONEncode,en.JSONDecode=en.JSONDecode,en.isBlockedUA=en.isBlockedUA,en.isEmptyObject=en.isEmptyObject,en.info=en.info,en.info.device=en.info.device,en.info.browser=en.info.browser,en.info.browserVersion=en.info.browserVersion,en.info.properties=en.info.properties;var hn="__mp_opt_in_out_";function optIn(e,i){_optInOut(!0,e,i)}function optOut(e,i){_optInOut(!1,e,i)}function hasOptedIn(e,i){return"1"===_getStorageValue(e,i)}function hasOptedOut(e,i){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var i=e&&e.window||vr,o=i.navigator||{},s=!1;return en.each([o.doNotTrack,o.msDoNotTrack,i.doNotTrack],(function(e){en.includes([!0,1,"1","yes"],e)&&(s=!0)})),s}(i))return tn.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 o="0"===_getStorageValue(e,i);return o&&tn.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),o}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,i){_getStorage(i=i||{}).remove(_getStorageKey(e,i),!!i.crossSubdomainCookie,i.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?en.localStorage:en.cookie}function _getStorageKey(e,i){return((i=i||{}).persistencePrefix||hn)+e}function _getStorageValue(e,i){return _getStorage(i).get(_getStorageKey(e,i))}function _optInOut(e,i,o){en.isString(i)&&i.length?(_getStorage(o=o||{}).set(_getStorageKey(i,o),e?1:0,en.isNumber(o.cookieExpiration)?o.cookieExpiration:null,!!o.crossSubdomainCookie,!!o.secureCookie,!!o.crossSiteCookie,o.cookieDomain),o.track&&e&&o.track(o.trackEventName||"$opt_in",o.trackProperties,{send_immediately:!0})):tn.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,i){return function(){var o=!1;try{var s=i.call(this,"token"),a=i.call(this,"ignore_dnt"),h=i.call(this,"opt_out_tracking_persistence_type"),f=i.call(this,"opt_out_tracking_cookie_prefix"),g=i.call(this,"window");s&&(o=hasOptedOut(s,{ignoreDnt:a,persistenceType:h,persistencePrefix:f,window:g}))}catch(v){tn.error("Unexpected error when checking tracking opt-out status: "+v)}if(!o)return e.apply(this,arguments);var _=arguments[arguments.length-1];"function"==typeof _&&_(0)}}var fn=console_with_prefix("lock"),SharedLock=function(e,i){i=i||{},this.storageKey=e,this.storage=i.storage||window.localStorage,this.pollIntervalMS=i.pollIntervalMS||100,this.timeoutMS=i.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,i,o){o||"function"==typeof i||(o=i,i=null);var s=o||(new Date).getTime()+"|"+Math.random(),a=(new Date).getTime(),h=this.storageKey,f=this.pollIntervalMS,g=this.timeoutMS,_=this.storage,v=h+":X",b=h+":Y",S=h+":Z",reportError=function(e){i&&i(e)},delay=function(e){if((new Date).getTime()-a>g)return fn.error("Timeout waiting for mutex on "+h+"; clearing lock. ["+s+"]"),_.removeItem(S),_.removeItem(b),void loop();setTimeout((function(){try{e()}catch(i){reportError(i)}}),f*(Math.random()+.1))},waitFor=function(e,i){e()?i():delay((function(){waitFor(e,i)}))},getSetY=function(){var e=_.getItem(b);if(e&&e!==s)return!1;if(_.setItem(b,s),_.getItem(b)===s)return!0;if(!localStorageSupported(_,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){_.setItem(v,s),waitFor(getSetY,(function(){_.getItem(v)!==s?delay((function(){_.getItem(b)===s?waitFor((function(){return!_.getItem(S)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){_.setItem(S,"1");try{e()}finally{_.removeItem(S),_.getItem(b)===s&&_.removeItem(b),_.getItem(v)===s&&_.removeItem(v)}};try{if(!localStorageSupported(_,!0))throw new Error("localStorage support check failed");loop()}catch(I){reportError(I)}};var mn=console_with_prefix("batch"),RequestQueue=function(e,i){i=i||{},this.storageKey=e,this.storage=i.storage||window.localStorage,this.reportError=i.errorReporter||en.bind(mn.error,mn),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=i.usePersistence,this.pid=i.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,i,o){var s={id:cheap_guid(),flushAfter:(new Date).getTime()+2*i,payload:e};this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var i;try{var a=this.readFromStorage();a.push(s),(i=this.saveToStorage(a))&&this.memQueue.push(s)}catch(h){this.reportError("Error enqueueing item",e),i=!1}o&&o(i)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),o&&o(!1)}),this),this.pid):(this.memQueue.push(s),o&&o(!0))},RequestQueue.prototype.fillBatch=function(e){var i=this.memQueue.slice(0,e);if(this.usePersistence&&i.length<e){var o=this.readFromStorage();if(o.length){var s={};en.each(i,(function(e){s[e.id]=!0}));for(var a=0;a<o.length;a++){var h=o[a];if((new Date).getTime()>h.flushAfter&&!s[h.id]&&(h.orphaned=!0,i.push(h),i.length>=e))break}}}return i};var filterOutIDsAndInvalid=function(e,i){var o=[];return en.each(e,(function(e){e.id&&!i[e.id]&&o.push(e)})),o};RequestQueue.prototype.removeItemsByID=function(e,i){var o={};if(en.each(e,(function(e){o[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,o),this.usePersistence){var s=en.bind((function(){var i;try{var s=this.readFromStorage();if(s=filterOutIDsAndInvalid(s,o),i=this.saveToStorage(s)){s=this.readFromStorage();for(var a=0;a<s.length;a++){var h=s[a];if(h.id&&o[h.id])return this.reportError("Item not removed from storage"),!1}}}catch(f){this.reportError("Error removing items",e),i=!1}return i}),this);this.lock.withLock((function lockAcquired(){var e=s();i&&i(e)}),en.bind((function lockFailure(e){var o=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(o=s()))try{this.storage.removeItem(this.storageKey)}catch(a){this.reportError("Error clearing queue",a)}i&&i(o)}),this),this.pid)}else i&&i(!0)};var updatePayloads=function(e,i){var o=[];return en.each(e,(function(e){var s=e.id;if(s in i){var a=i[s];null!==a&&(e.payload=a,o.push(e))}else o.push(e)})),o};RequestQueue.prototype.updatePayloads=function(e,i){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var o;try{var s=this.readFromStorage();s=updatePayloads(s,e),o=this.saveToStorage(s)}catch(a){this.reportError("Error updating items",e),o=!1}i&&i(o)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),i&&i(!1)}),this),this.pid):i&&i(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=pn(e),en.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(i){this.reportError("Error retrieving queue",i),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,ln(e)),!0}catch(i){return this.reportError("Error saving queue",i),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var gn=console_with_prefix("batch"),RequestBatcher=function(e,i){this.errorReporter=i.errorReporter,this.queue=new RequestQueue(e,{errorReporter:en.bind(this.reportError,this),storage:i.storage,usePersistence:i.usePersistence}),this.libConfig=i.libConfig,this.sendRequest=i.sendRequestFunc,this.beforeSendHook=i.beforeSendHook,this.stopAllBatching=i.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=i.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,i){this.queue.enqueue(e,this.flushInterval,i)},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(en.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void gn.log("Flush: Request already in progress");e=e||{};var i=this.libConfig.batch_request_timeout_ms,o=(new Date).getTime(),s=this.batchSize,a=this.queue.fillBatch(s),h=a.length===s,f=[],g={};if(en.each(a,(function(e){var i=e.payload;if(this.beforeSendHook&&!e.orphaned&&(i=this.beforeSendHook(i)),i){i.event&&i.properties&&(i.properties=en.extend({},i.properties,{mp_sent_by_lib_version:kr.LIB_VERSION}));var o=!0,s=e.id;s?(this.itemIdsSentSuccessfully[s]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[s]}),o=!1):this.reportError("[dupe] found item with no ID",{item:e}),o&&f.push(i)}g[e.id]=i}),this),f.length<1)return void this.resetFlush();this.requestInProgress=!0;var _=en.bind((function(f){this.requestInProgress=!1;try{var _=!1;if(e.unloading)this.queue.updatePayloads(g);else if(en.isObject(f)&&"timeout"===f.error&&(new Date).getTime()-o>=i)this.reportError("Network timeout; retrying"),this.flush();else if(en.isObject(f)&&(f.httpStatusCode>=500||429===f.httpStatusCode||f.httpStatusCode<=0&&(S=vr.navigator.onLine,!en.isUndefined(S)&&!S)||"timeout"===f.error)){var v=2*this.flushInterval;f.retryAfter&&(v=1e3*parseInt(f.retryAfter,10)||v),v=Math.min(6e5,v),this.reportError("Error; retry in "+v+" ms"),this.scheduleFlush(v)}else if(en.isObject(f)&&413===f.httpStatusCode)if(a.length>1){var b=Math.max(1,Math.floor(s/2));this.batchSize=Math.min(this.batchSize,b,a.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",a),this.resetBatchSize(),_=!0;else _=!0;_&&(this.queue.removeItemsByID(en.map(a,(function(e){return e.id})),en.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!h?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)),en.each(a,en.bind((function(e){var i=e.id;i?(this.itemIdsSentSuccessfully[i]=this.itemIdsSentSuccessfully[i]||0,this.itemIdsSentSuccessfully[i]++,this.itemIdsSentSuccessfully[i]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[i]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(I){this.reportError("Error handling API response",I),this.resetFlush()}var S}),this),v={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:i};e.unloading&&(v.transport="sendBeacon"),gn.log("MIXPANEL REQUEST:",f),this.sendRequest(f,v,_)}catch(b){this.reportError("Error flushing request queue",b),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,i){if(gn.error.apply(gn.error,arguments),this.errorReporter)try{i instanceof Error||(i=new Error(e)),this.errorReporter(e,i)}catch(o){gn.error(o)}};var _n=console_with_prefix("recorder"),yn=vr.CompressionStream,vn={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},bn=new Set([Sr.MouseMove,Sr.MouseInteraction,Sr.Scroll,Sr.ViewportResize,Sr.Input,Sr.TouchMove,Sr.MediaInteraction,Sr.Drag,Sr.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=Dr,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:vn,sendRequestFunc:en.bind(this.flushEventsWithOptOut,this),errorReporter:en.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>Dr&&(this.recordMaxMs=Dr,_n.critical("record_max_ms cannot be greater than "+Dr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Zr&&(this.recordMinMs=Zr,_n.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=en.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var i=en.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(en.bind((function(){_n.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),o=this.get_config("record_block_selector");""!==o&&null!==o||(o=void 0),this._stopRecording=record({emit:en.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===br.IncrementalSnapshot&&bn.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),i())}),this),blockClass:this.get_config("record_block_class"),blockSelector:o,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")}),i(),this.maxTimeoutId=setTimeout(en.bind(this.resetRecording,this),this.recordMaxMs)}else _n.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,i,o){this._flushEvents(e,i,o,en.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,i,o,s){var a=en.bind((function(i,o){200===i.status&&this.replayId===e&&this.seqNo++,s({status:0,httpStatusCode:i.status,responseBody:o,retryAfter:i.headers.get("Retry-After")})}),this);vr.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(i),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:o}).then((function(e){e.json().then((function(i){a(e,i)})).catch((function(e){s({error:e})}))})).catch((function(e){s({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,i,o){const s=e.length;if(s>0){var a=this.replayId,h=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=h);var f=e[s-1].timestamp-this.replayStartTime,g={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:h/1e3,replay_id:a,replay_length_ms:f,replay_start_time:this.replayStartTime/1e3},_=en.JSONEncode(e),v=this._mixpanel.get_property("$device_id");v&&(g.$device_id=v);var b=this._mixpanel.get_property("$user_id");if(b&&(g.$user_id=b),yn){var S=new Blob([_],{type:"application/json"}).stream().pipeThrough(new yn("gzip"));new Response(S).blob().then(en.bind((function(e){g.format="gzip",this._sendRequest(a,g,e,o)}),this))}else g.format="body",this._sendRequest(a,g,_,o)}})),MixpanelRecorder.prototype.reportError=function(e,i){_n.error.apply(_n.error,arguments);try{i||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,i)}catch(o){_n.error(o)}},vr.__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,i,o,s){var a=this,h=en.dom_query(e);if(0!==h.length)return en.each(h,(function(e){en.register_event(e,this.override_event,(function(e){var h={},f=a.create_properties(o,this),g=a.mp.get_config("track_links_timeout");a.event_handler(e,this,h),window.setTimeout(a.track_callback(s,f,h,!0),g),a.mp.track(i,f,a.track_callback(s,f,h))}))}),this),!0;tn.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,i,o,s){s=s||!1;var a=this;return function(){o.callback_fired||(o.callback_fired=!0,e&&!1===e(s,i)||a.after_track_handler(i,o,s))}},DomTracker.prototype.create_properties=function(e,i){return"function"==typeof e?e(i):en.extend({},e)};var LinkTracker=function(){this.override_event="click"};en.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,i){var o=LinkTracker.superclass.create_properties.apply(this,arguments);return i.href&&(o.url=i.href),o},LinkTracker.prototype.event_handler=function(e,i,o){o.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===i.target,o.href=i.href,o.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,i){i.new_tab||setTimeout((function(){window.location=i.href}),0)};var FormTracker=function(){this.override_event="submit"};en.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,i,o){o.element=i,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,i){setTimeout((function(){i.element.submit()}),0)};var Sn="$set",kn="$set_once",wn="$unset",In="$add",xn="$append",En="$union",Cn="$remove",Tn={set_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[Sn]=s,o},unset_action:function(e){var i={},o=[];return en.isArray(e)||(e=[e]),en.each(e,(function(e){this._is_reserved_property(e)||o.push(e)}),this),i[wn]=o,i},set_once_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[kn]=s,o},union_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=en.isArray(e)?e:[e])}),this):s[e]=en.isArray(i)?i:[i],o[En]=s,o},append_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[xn]=s,o},remove_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[Cn]=s,o},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};en.extend(MixpanelGroup.prototype,Tn),MixpanelGroup.prototype._init=function(e,i,o){this._mixpanel=e,this._group_key=i,this._group_id=o},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.set_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.set_once_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,i){var o=this.unset_action(e);return this._send_request(o,i)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,i,o){en.isObject(e)&&(o=i);var s=this.union_action(e,i);return this._send_request(s,o)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var i=this.delete_action();return this._send_request(i,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.remove_action(e,i);return this._send_request(s,o)})),MixpanelGroup.prototype._send_request=function(e,i){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var o=en.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},i)},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(){};en.extend(MixpanelPeople.prototype,Tn),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,i,o){var s=this.set_action(e,i);return en.isObject(e)&&(o=i),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),s[Sn]=en.extend({},en.info.people_properties(),s[Sn]),this._send_request(s,o)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,i,o){var s=this.set_once_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,i){var o=this.unset_action(e);return this._send_request(o,i)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,i,o){var s={},a={};return en.isObject(e)?(en.each(e,(function(e,i){if(!this._is_reserved_property(i)){if(isNaN(parseFloat(e)))return void tn.error("Invalid increment value passed to mixpanel.people.increment - must be a number");a[i]=e}}),this),o=i):(en.isUndefined(i)&&(i=1),a[e]=i),s[In]=a,this._send_request(s,o)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.append_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.remove_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.union_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,i,o){if(en.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",en.extend({$amount:e},i),o);tn.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)}tn.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,i){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var o=this._mixpanel.get_property("$device_id"),s=this._mixpanel.get_property("$user_id"),a=this._mixpanel.get_property("$had_persisted_distinct_id");o&&(e.$device_id=o),s&&(e.$user_id=s),a&&(e.$had_persisted_distinct_id=a);var h=en.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:h,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},i):(this._enqueue(e),en.isUndefined(i)||(this._get_config("verbose")?i({status:-1,error:null}):i(-1)),en.truncate(h,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){Sn in e?this._mixpanel.persistence._add_to_people_queue(Sn,e):kn in e?this._mixpanel.persistence._add_to_people_queue(kn,e):wn in e?this._mixpanel.persistence._add_to_people_queue(wn,e):In in e?this._mixpanel.persistence._add_to_people_queue(In,e):xn in e?this._mixpanel.persistence._add_to_people_queue(xn,e):Cn in e?this._mixpanel.persistence._add_to_people_queue(Cn,e):En in e?this._mixpanel.persistence._add_to_people_queue(En,e):tn.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,i,o,s){var a=this,h=en.extend({},this._mixpanel.persistence.load_queue(e)),f=h;en.isUndefined(h)||!en.isObject(h)||en.isEmptyObject(h)||(a._mixpanel.persistence._pop_from_people_queue(e,h),a._mixpanel.persistence.save(),s&&(f=s(h)),i.call(a,f,(function(i,s){0===i&&a._mixpanel.persistence._add_to_people_queue(e,h),en.isUndefined(o)||o(i,s)})))},MixpanelPeople.prototype._flush=function(e,i,o,s,a,h,f){var g=this;this._flush_one_queue(Sn,this.set,e),this._flush_one_queue(kn,this.set_once,s),this._flush_one_queue(wn,this.unset,h,(function(e){return en.keys(e)})),this._flush_one_queue(In,this.increment,i),this._flush_one_queue(En,this.union,a);var _=this._mixpanel.persistence.load_queue(xn);if(!en.isUndefined(_)&&en.isArray(_)&&_.length)for(var v,append_callback=function(e,i){0===e&&g._mixpanel.persistence._add_to_people_queue(xn,v),en.isUndefined(o)||o(e,i)},b=_.length-1;b>=0;b--)_=this._mixpanel.persistence.load_queue(xn),v=_.pop(),g._mixpanel.persistence.save(),en.isEmptyObject(v)||g.append(v,append_callback);var S=this._mixpanel.persistence.load_queue(Cn);if(!en.isUndefined(S)&&en.isArray(S)&&S.length)for(var I,remove_callback=function(e,i){0===e&&g._mixpanel.persistence._add_to_people_queue(Cn,I),en.isUndefined(f)||f(e,i)},x=S.length-1;x>=0;x--)S=this._mixpanel.persistence.load_queue(Cn),I=S.pop(),g._mixpanel.persistence.save(),en.isEmptyObject(I)||g.remove(I,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 On,Rn="__mps",Mn="__mpso",Nn="__mpus",Pn="__mpa",Dn="__mpap",Zn="__mpr",An="__mpu",Ln="$people_distinct_id",jn="__alias",Fn="__timers",$n=[Rn,Mn,Nn,Pn,Dn,Zn,An,Ln,jn,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 i=e.persistence;"cookie"!==i&&"localStorage"!==i&&(tn.critical("Unknown persistence type "+i+"; falling back to cookie"),i=e.persistence="cookie"),"localStorage"===i&&en.localStorage.is_supported()?this.storage=en.localStorage:this.storage=en.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),en.each(this.props,(function(i,o){en.include($n,o)||(e[o]=i)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=en.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,i;this.storage===en.localStorage?(e=en.cookie.parse(this.name),en.cookie.remove(this.name),en.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===en.cookie&&(i=en.localStorage.parse(this.name),en.localStorage.remove(this.name),i&&this.register_once(i))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,en.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,i,o){return!!en.isObject(e)&&(void 0===i&&(i="None"),this.expire_days=void 0===o?this.default_expiry:o,this.load(),en.each(e,(function(e,o){this.props.hasOwnProperty(o)&&this.props[o]!==i||(this.props[o]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,i){return!!en.isObject(e)&&(this.expire_days=void 0===i?this.default_expiry:i,this.load(),en.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(en.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:en.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return en.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,i){var o=this._get_queue_key(e),s=i[e],a=this._get_or_create_queue(Sn),h=this._get_or_create_queue(kn),f=this._get_or_create_queue(wn),g=this._get_or_create_queue(In),_=this._get_or_create_queue(En),v=this._get_or_create_queue(Cn,[]),b=this._get_or_create_queue(xn,[]);o===Rn?(en.extend(a,s),this._pop_from_people_queue(In,s),this._pop_from_people_queue(En,s),this._pop_from_people_queue(wn,s)):o===Mn?(en.each(s,(function(e,i){i in h||(h[i]=e)})),this._pop_from_people_queue(wn,s)):o===Nn?en.each(s,(function(e){en.each([a,h,g,_],(function(i){e in i&&delete i[e]})),en.each(b,(function(i){e in i&&delete i[e]})),f[e]=!0})):o===Pn?(en.each(s,(function(e,i){i in a?a[i]+=e:(i in g||(g[i]=0),g[i]+=e)}),this),this._pop_from_people_queue(wn,s)):o===An?(en.each(s,(function(e,i){en.isArray(e)&&(i in _||(_[i]=[]),_[i]=_[i].concat(e))})),this._pop_from_people_queue(wn,s)):o===Zn?(v.push(s),this._pop_from_people_queue(xn,s)):o===Dn&&(b.push(s),this._pop_from_people_queue(wn,s)),tn.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),tn.log(i),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,i){var o=this.props[this._get_queue_key(e)];en.isUndefined(o)||en.each(i,(function(i,s){e===xn||e===Cn?en.each(o,(function(e){e[s]===i&&delete e[s]})):delete o[s]}),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===Sn?Rn:e===kn?Mn:e===wn?Nn:e===In?Pn:e===xn?Dn:e===Cn?Zn:e===En?An:void tn.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,i){var o=this._get_queue_key(e);return i=en.isUndefined(i)?{}:i,this.props[o]||(this.props[o]=i)},MixpanelPersistence.prototype.set_event_timer=function(e,i){var o=this.load_prop(Fn)||{};o[e]=i,this.props[Fn]=o,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var i=(this.load_prop(Fn)||{})[e];return en.isUndefined(i)||(delete this.props[Fn][e],this.save()),i};var qn,load_extra_bundle=function(e,i){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},Un="mixpanel",Bn="base64",zn="$device:",Vn=vr.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Wn=!Vn&&-1===Kr.indexOf("MSIE")&&-1===Kr.indexOf("Mozilla"),Kn=null;Br.sendBeacon&&(Kn=function(){return Br.sendBeacon.apply(Br,arguments)});var Hn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Gn={api_host:"https://api-js.mixpanel.com",api_routes:Hn,api_method:"POST",api_transport:"XHR",api_payload_format:Bn,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:Dr,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Jn=!1,MixpanelLib=function(){},create_mplib=function(e,i,o){var s,a=o===Un?qn:qn[o];if(a&&0===On)s=a;else{if(a&&!en.isArray(a))return void tn.error("You have already initialized "+o);s=new MixpanelLib}if(s._cached_groups={},s._init(e,i,o),s.people=new MixpanelPeople,s.people._init(s),!s.get_config("skip_first_touch_marketing")){var h=en.info.campaignParams(null),f={},g=!1;en.each(h,(function(e,i){f["initial_"+i]=e,e&&(g=!0)})),g&&s.people.set_once(f)}return kr.DEBUG=kr.DEBUG||s.get_config("debug"),!en.isUndefined(a)&&en.isArray(a)&&(s._execute_array.call(s.people,a.people),s._execute_array(a)),s};MixpanelLib.prototype.init=function(e,i,o){if(en.isUndefined(o))this.report_error("You must name your new library: init(token, config, name)");else{if(o!==Un){var s=create_mplib(e,i,o);return qn[o]=s,s._loaded(),s}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,i,o){i=i||{},this.__loaded=!0,this.config={};var s={};"api_payload_format"in i||(i.api_host||Gn.api_host).match(/\.mixpanel\.com/)&&(s.api_payload_format="json");if(this.set_config(en.extend({},Gn,s,i,{name:o,token:e,callback_fn:(o===Un?o:Un+"."+o)+"._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(en.localStorage.is_supported(!0)&&Vn){if(this.init_batchers(),Kn&&vr.addEventListener){var a=en.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);vr.addEventListener("pagehide",(function(e){e.persisted&&a()})),vr.addEventListener("visibilitychange",(function(){"hidden"===zr.visibilityState&&a()}))}}else this._batch_requests=!1,tn.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),en.each(this.get_batcher_configs(),(function(e){tn.log("Clearing batch queue "+e.queue_key),en.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var h=en.UUID();this.get_distinct_id()||this.register_once({distinct_id:zn+h,$device_id:h},"");var f=this.get_config("track_pageview");f&&this._init_url_change_tracking(f),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(vr.MutationObserver){var e=en.bind((function(){this._recorder=this._recorder||new vr.__mp_recorder(this),this._recorder.startRecording()}),this);en.isUndefined(vr.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else tn.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():tn.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var i=this._recorder.replayId;i&&(e.$mp_replay_id=i)}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=en.info.campaignParams(null);en.each(e,function(e,i){this.unregister(i)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(zr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(en.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(zr.referrer)},MixpanelLib.prototype._dom_loaded=function(){en.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||en.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,i){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Jn)return this.__dom_loaded_queue.push([e,i]),!1;var o=(new e).init(this);return o.track.apply(o,i)},MixpanelLib.prototype._init_url_change_tracking=function(e){var i="";if(this.track_pageview()&&(i=en.info.currentUrl()),en.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){vr.addEventListener("popstate",(function(){vr.dispatchEvent(new Event("mp_locationchange"))})),vr.addEventListener("hashchange",(function(){vr.dispatchEvent(new Event("mp_locationchange"))}));var o=vr.history.pushState;"function"==typeof o&&(vr.history.pushState=function(e,i,s){o.call(vr.history,e,i,s),vr.dispatchEvent(new Event("mp_locationchange"))});var s=vr.history.replaceState;"function"==typeof s&&(vr.history.replaceState=function(e,i,o){s.call(vr.history,e,i,o),vr.dispatchEvent(new Event("mp_locationchange"))}),vr.addEventListener("mp_locationchange",function(){var o=en.info.currentUrl(),s=!1;("full-url"===e?s=o!==i:"url-with-path-and-query-string"===e?s=o.split("#")[0]!==i.split("#")[0]:"url-with-path"===e&&(s=o.split("#")[0].split("?")[0]!==i.split("#")[0].split("?")[0]),s)&&(this.track_pageview()&&(i=o))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,i){if(en.isUndefined(e))return null;if(Vn){return function(o){e(o,i)}}var o=this._jsc,s=""+Math.floor(1e8*Math.random()),a=this.get_config("callback_fn")+"["+s+"]";return o[s]=function(a){delete o[s],e(a,i)},a},MixpanelLib.prototype._send_request=function(e,i,o,s){var a=!0;if(Wn)return this.__request_queue.push(arguments),a;var h={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},f=null;s||!en.isFunction(o)&&"string"!=typeof o||(s=o,o=null),o=en.extend(h,o||{}),Vn||(o.method="GET");var g="POST"===o.method,_=Kn&&g&&"sendbeacon"===o.transport.toLowerCase(),v=o.verbose;i.verbose&&(v=!0),this.get_config("test")&&(i.test=1),v&&(i.verbose=1),this.get_config("img")&&(i.img=1),Vn||(s?i.callback=s:(v||this.get_config("test"))&&(i.callback="(function(){})")),i.ip=this.get_config("ip")?1:0,i._=(new Date).getTime().toString(),g&&(f="data="+encodeURIComponent(i.data),delete i.data),e+="?"+en.HTTPBuildQuery(i);var b=this;if("img"in i){var S=zr.createElement("img");S.src=e,zr.body.appendChild(S)}else if(_){try{a=Kn(e,f)}catch(N){b.report_error(N),a=!1}try{s&&s(a?1:0)}catch(N){b.report_error(N)}}else if(Vn)try{var I=new XMLHttpRequest;I.open(o.method,e,!0);var x=this.get_config("xhr_headers");if(g&&(x["Content-Type"]="application/x-www-form-urlencoded"),en.each(x,(function(e,i){I.setRequestHeader(i,e)})),o.timeout_ms&&void 0!==I.timeout){I.timeout=o.timeout_ms;var T=(new Date).getTime()}I.withCredentials=!0,I.onreadystatechange=function(){var e;if(4===I.readyState)if(200===I.status){if(s)if(v){var i;try{i=en.JSONDecode(I.responseText)}catch(N){if(b.report_error(N),!o.ignore_json_errors)return;i=I.responseText}s(i)}else s(Number(I.responseText))}else if(e=I.timeout&&!I.status&&(new Date).getTime()-T>=I.timeout?"timeout":"Bad HTTP status: "+I.status+" "+I.statusText,b.report_error(e),s)if(v){var a=I.responseHeaders||{};s({status:0,httpStatusCode:I.status,error:e,retryAfter:a["Retry-After"]})}else s(0)},I.send(f)}catch(N){b.report_error(N),a=!1}else{var O=zr.createElement("script");O.type="text/javascript",O.async=!0,O.defer=!0,O.src=e;var R=zr.getElementsByTagName("script")[0];R.parentNode.insertBefore(O,R)}return a},MixpanelLib.prototype._execute_array=function(e){var i,o=[],s=[],a=[];en.each(e,(function(e){e&&(i=e[0],en.isArray(i)?a.push(e):"function"==typeof e?e.call(this):en.isArray(e)&&"alias"===i?o.push(e):en.isArray(e)&&-1!==i.indexOf("track")&&"function"==typeof this[i]?a.push(e):s.push(e))}),this);var execute=function(e,i){en.each(e,(function(e){if(en.isArray(e[0])){var o=i;en.each(e,(function(e){o=o[e[0]].apply(o,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),i)};execute(o,this),execute(s,this),execute(a,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"),i=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+i.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+i.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+i.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=en.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:en.bind((function(i,o,s){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(i),o,this._prepare_callback(s,i))}),this),beforeSendHook:en.bind((function(i){return this._run_hook("before_send_"+e.type,i)}),this),stopAllBatchingFunc:en.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),i=this.get_batcher_configs();this.request_batchers={events:e(i.events),people:e(i.people),groups:e(i.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,en.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,en.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 i=en.JSONEncode(e);return this.get_config("api_payload_format")===Bn&&(i=en.base64Encode(i)),{data:i}},MixpanelLib.prototype._track_or_batch=function(e,i){var o=en.truncate(e.data,255),s=e.endpoint,a=e.batcher,h=e.should_send_immediately,f=e.send_request_options||{};i=i||NOOP_FUNC;var g=!0,_=en.bind((function(){return f.skip_hooks||(o=this._run_hook("before_send_"+e.type,o)),o?(tn.log("MIXPANEL REQUEST:"),tn.log(o),this._send_request(s,this._encode_data_for_request(o),f,this._prepare_callback(i,o))):null}),this);return this._batch_requests&&!h?a.enqueue(o,(function(e){e?i(1,o):_()})):g=_(),g&&o},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,i,o,s){s||"function"!=typeof o||(s=o,o=null);var a=(o=o||{}).transport;a&&(o.transport=a);var h=o.send_immediately;if("function"!=typeof s&&(s=NOOP_FUNC),en.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(i=en.extend({},i)).token=this.get_config("token");var f=this.persistence.remove_event_timer(e);if(!en.isUndefined(f)){var g=(new Date).getTime()-f;i.$duration=parseFloat((g/1e3).toFixed(3))}this._set_default_superprops();var _=this.get_config("track_marketing")?en.info.marketingParams():{};i=en.extend({},en.info.properties({mp_loader:this.get_config("mp_loader")}),_,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),i);var v=this.get_config("property_blacklist");en.isArray(v)?en.each(v,(function(e){delete i[e]})):this.report_error("Invalid value for property_blacklist config: "+v);var b={event:e,properties:i};return this._track_or_batch({type:"events",data:b,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:h,send_request_options:o},s)}s(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,i,o){en.isArray(i)||(i=[i]);var s={};return s[e]=i,this.register(s),this.people.set(e,i,o)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,i,o){var s=this.get_property(e),a={};return void 0===s?(a[e]=[i],this.register(a)):-1===s.indexOf(i)&&(s.push(i),a[e]=s,this.register(a)),this.people.union(e,i,o)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,i,o){var s=this.get_property(e);if(void 0!==s){var a=s.indexOf(i);a>-1&&(s.splice(a,1),this.register({group_key:s})),0===s.length&&this.unregister(e)}return this.people.remove(e,i,o)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,i,o,s){var a=en.extend({},i||{});return en.each(o,(function(e,i){null!=e&&(a[i]=e)})),this.track(e,a,s)})),MixpanelLib.prototype._create_map_key=function(e,i){return e+"_"+JSON.stringify(i)},MixpanelLib.prototype._remove_group_from_cache=function(e,i){delete this._cached_groups[this._create_map_key(e,i)]},MixpanelLib.prototype.get_group=function(e,i){var o=this._create_map_key(e,i),s=this._cached_groups[o];return void 0!==s&&s._group_key===e&&s._group_id===i||((s=new MixpanelGroup)._init(this,e,i),this._cached_groups[o]=s),s},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,i){"object"!=typeof e&&(e={});var o=(i=i||{}).event_name||"$mp_web_page_view",s=en.extend(en.info.mpPageViewProperties(),en.info.campaignParams(),en.info.clickParams()),a=en.extend({},s,e);return this.track(o,a)})),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){en.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 Yn={persistent:!0},options_for_register=function(e){var i;return i=en.isObject(e)?e:en.isUndefined(e)?{}:{days:e},en.extend({},Yn,i)};MixpanelLib.prototype.register=function(e,i){var o=options_for_register(i);o.persistent?this.persistence.register(e,o.days):en.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,i,o){var s=options_for_register(o);s.persistent?this.persistence.register_once(e,i,s.days):(void 0===i&&(i="None"),en.each(e,(function(e,o){this.unpersisted_superprops.hasOwnProperty(o)&&this.unpersisted_superprops[o]!==i||(this.unpersisted_superprops[o]=e)}),this))},MixpanelLib.prototype.unregister=function(e,i){(i=options_for_register(i)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,i){var o={};o[e]=i,this.register(o)},MixpanelLib.prototype.identify=function(e,i,o,s,a,h,f,g){var _=this.get_distinct_id();if(e&&_!==e){if("string"==typeof e&&0===e.indexOf(zn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var v=_;this.register_once({$had_persisted_distinct_id:!0,$device_id:v},"")}e!==_&&e!==this.get_property(jn)&&(this.unregister(jn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(i,o,s,a,h,f,g),e!==_&&this.track("$identify",{distinct_id:e,$anon_distinct_id:_},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=en.UUID();this.register_once({distinct_id:zn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,i){if(e===this.get_property(Ln))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var o=this;return en.isUndefined(i)&&(i=this.get_distinct_id()),e!==i?(this._register_single(jn,e),this.track("$create_alias",{alias:e,distinct_id:i},{skip_hooks:!0},(function(){o.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){en.isObject(e)&&(en.extend(this.config,e),e.batch_size&&en.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),kr.DEBUG=kr.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var i=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,Fr.call(arguments,1));return void 0===i&&(this.report_error(e+" hook did not return a value"),i=null),i},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==Un&&(e=Un+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return en.isBlockedUA(Kr)||this._flags.disable_all_events||en.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&en.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")&&!en.cookie.get("mp_optout")||(en.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 i;if(e&&e.clear_persistence)i=!0;else{if(!e||!e.enable_persistence)return;i=!1}this.get_config("disable_persistence")||this.persistence.disabled===i||this.persistence.set_disabled(i),i?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,i){return i=en.extend({track:en.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")},i),en.localStorage.is_supported()||(i.persistence_type="cookie"),e(this.get_config("token"),{track:i.track,trackEventName:i.track_event_name,trackProperties:i.track_properties,persistenceType:i.persistence_type,persistencePrefix:i.cookie_prefix,cookieDomain:i.cookie_domain,cookieExpiration:i.cookie_expiration,crossSiteCookie:i.cross_site_cookie,crossSubdomainCookie:i.cross_subdomain_cookie,secureCookie:i.secure_cookie,ignoreDnt:i.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=en.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=en.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=en.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,i){tn.error.apply(tn.error,arguments);try{i||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,i)}catch(o){tn.error(o)}},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=Hn,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 Xn={},override_mp_init_func=function(){qn.init=function(e,i,o){if(o)return qn[o]||(qn[o]=Xn[o]=create_mplib(e,i,o),qn[o]._loaded()),qn[o];var s=qn;Xn[Un]?s=Xn[Un]:e&&((s=create_mplib(e,i,Un))._loaded(),Xn[Un]=s),qn=s,1===On&&(vr[Un]=qn),en.each(Xn,(function(e,i){i!==Un&&(qn[i]=e)})),qn._=en}};var Qn=function init_as_module(e){return load_extra_bundle=e,On=0,qn=new MixpanelLib,override_mp_init_func(),qn.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,Jn=!0,Wn=!1,en.each(Xn,(function(e){e._dom_loaded()})))}if(zr.addEventListener)"complete"===zr.readyState?dom_loaded_handler():zr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(zr.attachEvent){zr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===vr.frameElement}catch(i){}zr.documentElement.doScroll&&e&&function do_scroll_check(){try{zr.documentElement.doScroll("left")}catch(i){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}en.register_event(vr,"load",dom_loaded_handler,!0)}(),qn}((function loadNoop(e,i){i()}));const ei="mp_distinct_id";function isReady(){return void 0!==window.mixpanel}function updateCachedDistinctId(e){localStorage.setItem(ei,e)}const ti={init:function init$2(e,i=!1,o){return new Promise((s=>{Qn.init(e,{debug:i,loaded:()=>{window.mixpanel=Qn,s()},...o&&{api_host:o}})}))},isReady:isReady,track:function track(e,i){isReady()&&Qn.track(e,{...i,"Reservamos Version":"1.0.10"})},identify:function identify$1(e,i){Qn.identify(e),updateCachedDistinctId(e),Qn.people.set(i)},attachProperty:function attachProperty(e,i){isReady()&&Qn.people.union(e,[i])},getMixpanelDistinctId:()=>{const e=localStorage.getItem(ei);if(Qn&&Qn.get_distinct_id){const e=Qn.get_distinct_id();return updateCachedDistinctId(e),e}return e||null}},ri=Te.object({firstName:Te.string().optional(),lastName:Te.string().optional(),email:Te.string().email().optional(),phone:Te.string().optional()}),ni=["web","web-mobile","ios","android","app"],ii=Te.enum(ni).refine((e=>ni.includes(e)),{message:`Product must be one of: ${ni.join(", ")}`}),oi=Te.object({product:ii});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=>Te.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>Te.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>Te.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>Te.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,i,o)=>Te.array(e).min(o,`${i} must have at least ${o} items`),si=Te.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:ii});const ai=Te.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(),ci=Te.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":Te.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),di=Te.object({Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const ui=Te.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":Te.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional(),Insurance:(li="Insurance",Te.boolean({required_error:`${li} is required`,invalid_type_error:`${li} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var li;const pi=Te.object({Arrival:Te.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:Te.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination terminal is required"),Line:Te.string().min(1,"Line is required").optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Price:Te.number().positive("Price must be a positive number"),"Result Position":Te.number().int("Result Position must be an integer"),Route:Te.string().min(1,"Route is required"),Stops:Te.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":Te.string().min(1,"Transport Type is required"),Transporter:Te.string().min(1,"Transporter is required"),product:ii,"Recommended Trip":Te.boolean(),"Recommended Trip Type":Te.string().optional(),"Trip Type":Te.string().min(1,"Trip Type is required"),"Bus Type":Te.string().min(1,"Bus Type is required")});const hi=Te.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const fi=Te.object({Departure:Te.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":Te.number().int("Departure Delta must be an integer"),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination terminal is required"),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Passengers:Te.number().int("Passenger count must be an integer"),Return:Te.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:Te.string().min(1,"Route is required"),"Trip Length":Te.number().positive().optional(),Categories:Te.array(Te.string()).optional(),product:ii});const mi=Te.object({Arrival:Te.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:Te.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination Terminal is required"),Line:Te.string().min(1,"Line is required").optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin Terminal is required"),Price:Te.number().positive("Price must be a positive number"),Route:Te.string().min(1,"Route is required"),Stops:Te.number().int("Stops must be an integer").nonnegative().optional(),Tickets:Te.number().int("Tickets must be an integer").positive(),Transporter:Te.string().min(1,"Transporter is required"),Way:Te.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:ii});const gi=Te.object({"Bus count":Te.number().int("Bus count must be an integer"),Departure:Te.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":Te.number().int("Departure Delta must be an integer").optional(),Destination:Te.string().min(1,"Destination is required").optional(),"Destination Terminal":Te.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":Te.boolean().default(!1).optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Route:Te.string().min(1,"Route is required"),product:ii}),_i=Te.object({mixpanelToken:Te.string().min(1,"Mixpanel token is required"),debug:Te.boolean().optional(),identificationKey:Te.string().min(1,"Identification key is required"),isSandbox:Te.boolean().optional(),mixpanelProxyUrl:Te.string().optional(),identifyProxyUrl:Te.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let i="INVALID_FIELD",o="",s="",a="";return"invalid_type"===e.code?(i="TYPE_MISMATCH",o=e.expected,s=e.received,a=`Expected ${o} but received ${s}. Please provide a value of type ${o}.`):"too_small"===e.code?(i="VALUE_TOO_SMALL",a=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(i="VALUE_TOO_BIG",a=`Reduce the value to no more than ${e.maximum}.`):(i="INVALID_FIELD",a="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:i,expected:o,received:s,message:e.message,suggestion:a}})),yi={Search:fi,"Seat Change":mi,"Interest In Home":oi,"Passengers Created":di,"Payment Attempt":ui,"Interest In Search":si,"View Results":gi,"Purchase Attempt":hi,"Picked Departure":pi};function validateProps(e,i){try{i.parse(e)}catch(Or){if(Or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Or)}}throw{message:"Unknown validation error"}}}const vi={parseEventProps:function parseEventProps(e,i){const o=yi[e]||Re;try{o.parse(i)}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,_i)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,ri)},validateProps:validateProps};function isTrackerReady(){return ti.isReady()}let bi=null;const Si="geolocationPermissionTimestamp",ki=6048e5;function updatePermissionTimestamp(e){localStorage.setItem(Si,e.toString())}const wi={init:function init(){return new Promise((e=>{if(function isPermissionTimestampValid(e){return!!e&&Date.now()-parseInt(e,10)<ki}(localStorage.getItem(Si)))return void e(bi);const i="Geolocation Requested",o=Date.now();navigator.geolocation.getCurrentPosition((s=>{const{latitude:a,longitude:h}=s.coords;bi={lat:a,long:h},updatePermissionTimestamp(o),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!0}),e(bi)}),(()=>{updatePermissionTimestamp(o),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!1}),e(null)}))}))},getCoordinates:function getCoordinates(){return bi}},Ii=["Search","View Results"],xi={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(e,i,o){tryTrackEvent((async()=>{try{ti.track("Track Event Error",{"Failed Event Name":e,"Error Message":(null==i?void 0:i.message)??"Failed to track event","Validation Errors":(null==i?void 0:i.errors)||[],"Event Payload":o})}catch(s){console.error("Failed to track error event:",s)}}))}async function tryTrackEvent(e){ti.isReady()?await e():window.addEventListener("Tracker Ready",(async()=>{await e()}))}async function trackEvent(e,i,o={}){if(!ti.isReady())throw new Error("Mixpanel is not initialized.");try{vi.parseEventProps(e,i);const s=!Ii.includes(e),a=await _t.getFingerprint(s),h={},f=wi.getCoordinates();f&&(h.$latitude=f.lat,h.$longitude=f.long);const g={"User Fingerprint":a},_=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),i={};return Object.entries(xi).forEach((([o,s])=>{const a=e.get(o);a&&(i[s]=a)})),i}catch(Or){return console.error("Error extracting tracking parameters:",Or),{}}}(),v=function flattenEventData(e){return Object.entries(e).reduce(((e,[i,o])=>Array.isArray(o)?Array.isArray(o)&&o.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[i]=o,e):(o.forEach((i=>{"object"==typeof i&&null!==i&&Object.entries(i).forEach((([i,o])=>{e[i]?e[i].push(o):e[i]=[o]}))})),e):(e[i]=o,e)),{})}(i),b={...g,...v,..._,...h,...o};ti.track(e,b)}catch(Or){console.error(`Error tracking event '${e}':`,Or),trackEventError(e,Or,i)}}function trackCustomEvent(e,i={},o={}){try{Me.parse(e),trackEvent(e,i,o)}catch(Or){console.error("Error trackCustomEvent:",Or),trackEventError(e,Or,i)}}const Ei=Te.object({email:Te.string().email().optional(),phone:Te.string().optional(),cpf:Te.string().optional(),passport:Te.string().optional(),rg:Te.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{vi.validateProps(e,Ei);const i=[],o=_t.getCachedFingerprint(),s=ti.getMixpanelDistinctId();o&&i.push({key:"fingerprint",value:o}),s&&i.push({key:"distinct_id",value:s});const a=function getAnonymousProfilePayload(e,i){let o="phone",s=e.phone||"";const a=[];e.email&&(o="email",s=e.email);const h=["cpf","passport","rg","email","phone","salesforceid"];return Object.entries(e).forEach((([e,i])=>{h.includes(e.toLowerCase())&&i&&e!==o&&a.push({key:e,value:i})})),i.length&&i.forEach((e=>a.push(e))),{identifier_key:o,identifier_value:s,details:{},identifiers:a}}(e,i);return await Nt.profiles.createAnonymousProfile(a)}catch(Or){return void console.error("Could not create anonymous profile:",Or)}}const Ci=["firstName","lastName","email","phone"];Te.object({"Operation Id":stringField("Operation Id"),Trips:arrayField(ci,"Trips",1).optional(),"Passenger Count":numberField("Passenger Count").optional(),Total:numberField("Total").optional(),"Trip Count":numberField("Trip Count").optional(),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()});const Ti=Te.object({category:Te.string(),number:Te.string().optional(),occupied:Te.boolean().optional(),adjacent_seats:Te.null().optional()}),Oi=Te.object({bus:Te.array(Te.array(Te.array(Ti)))}),Ri=Te.object({bus_type:Te.string(),selected_seats:Te.string(),bus_scheme:Oi});const Mi=Te.object({category:Te.string(),number:Te.string().optional(),occupied:Te.boolean().optional(),adjacent_seats:Te.null().optional()}),Ni=Te.object({bus:Te.array(Te.array(Te.array(Mi)))}),Pi=Te.object({bus_scheme:Ni,total_seats:Te.number()});const Di=Te.object({searchId:Te.number().min(1,"SearchId is required")});const Zi={init:async function init$1(e){vi.parseInitProps(e);const{mixpanelToken:i,debug:o=!1,identificationKey:s,isSandbox:a=!1,mixpanelProxyUrl:h,identifyProxyUrl:f}=e;wi.init(),await ti.init(i,o,h);try{await _t.initFingerprint(s,f)}catch(Or){console.error("Error initializing identification service:",Or)}At.setEnvironment(a?"sandbox":"prod"),Nt.setConfig(At.getCoreAPIConfig()),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(e,i={}){tryTrackEvent((async()=>{try{if(vi.parseIdentifyProps(i),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const o=await createAnonymousProfile(i);o&&(i.reservamos_one_id=o.id);const s=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(((i,o)=>(Ci.includes(o)||(i[o]=e[o]),i)),{})}}(i);ti.identify(e,s);const a=await _t.getFingerprint();a&&ti.attachProperty("Known Fingerprints",a)}catch(Or){console.error("Error identifying user",Or),trackEventError("Identify",Or,{userId:e,properties:i})}finally{(async(e,i)=>{var o,s;try{const a=wi.getCoordinates();if(!a)return;i.first_name=i.firstName,i.last_name=i.lastName,i.latitude=a.lat,i.longitude=a.long,i.ip="0",i.name=`${i.firstName} ${i.lastName}`,delete i.firstName,delete i.lastName;const h=At.getCoreAPIConfig();fetch(`${h.baseUrl}/v1/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==(o=h.defaultHeaders)?void 0:o.Authorization)||"",Origin:(null==(s=h.defaultHeaders)?void 0:s.Origin)||""},body:JSON.stringify({profile_params:{...i,distinct_id:e}})})}catch(Or){console.error("Error identifying user-service",Or)}})(e,i)}}))},identifiers:{getFingerprintId:_t.getCachedFingerprint,getDistinctId:ti.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},recommendations:{getRecommendedPlaces:async function getRecommendedPlaces(){const e=ti.getMixpanelDistinctId();if(!e)throw new Error("No distinct ID found");const i=await Nt.recommendations.createRecommendedPlaces({distinct_id:e});if(!i)throw new Error("No response received");return await(async e=>new Promise(((i,o)=>{const{state:s,polling_id:a}=e;"finished"!==s?Nt.recommendations.pollRecommendedPlaces(a,{start:!0,watch:"state",expect:"finished",onEachResponse:e=>{"finished"!==e.status?"failed"!==e.status||o(e):i(e)}}):i(e)})))(i)},createRecommendedSeats:async function createRecommendedSeats$1(e){try{vi.validateProps(e,Ri);const i=ti.getMixpanelDistinctId(),o=_t.getCachedFingerprint();if(!i)throw new Error("No distinct ID found");return await Nt.recommendations.createRecommendedSeats({...e,distinct_id:i,device_fingerprint:o||""})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedSeats:async function createRecommendedSeats(e){try{vi.validateProps(e,Pi);const i=ti.getMixpanelDistinctId();if(!i)throw new Error("No distinct ID found");return await Nt.recommendations.getRecommendedSeats({...e,distinct_id:i})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedTrips:async function getRecommendedTrips({searchId:e}){try{vi.validateProps({searchId:e},Di);const i=_t.getCachedFingerprint()||ti.getMixpanelDistinctId();if(!i)throw new Error("No identifier id");return await Nt.recommendations.getRecommendedTrips({searchId:e,userIdentifier:String(i)})}catch(Or){throw console.error("Could not get recommended trips:",Or),new Error(Or instanceof Error?Or.message:String(Or))}}},track:{search:function trackSearch(e,i={}){trackEvent("Search",e,i)},seatChange:function trackSeatChange(e,i={}){trackEvent("Seat Change",e,i)},interestInHome:function trackInterestInHome(e,i={}){trackEvent("Interest In Home",e,i)},interestInSearch:function trackInterestInSearch(e,i={}){trackEvent("Interest In Search",e,i)},viewResults:function trackViewResults(e,i={}){trackEvent("View Results",e,i)},passengersCreated:function trackPassengersCreated(e,i={}){trackEvent("Passengers Created",e,i)},paymentAttempt:async(e,i={})=>{trackEvent("Payment Attempt",e,i)},purchaseAttempt:function trackPurchaseAttempt(e,i={}){trackEvent("Purchase Attempt",e,i)},pickedDeparture:function trackSearch$1(e,i={}){trackEvent("Picked Departure",e,i)},customEvent:trackCustomEvent,purchaseCanceled:function trackPurchaseCanceled(e,i={}){trackEvent("Purchase Canceled",e,i)}}};module.exports=Zi;
30
+ function __awaiter2(e,i,o,s){return new(o||(o=Promise))((function(i,a){function fulfilled(e){try{step(s.next(e))}catch(i){a(i)}}function rejected(e){try{step(s.throw(e))}catch(i){a(i)}}function step(e){e.done?i(e.value):function adopt(e){return e instanceof o?e:new o((function(i){i(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="undefined"==typeof Uint8Array?[]:new Uint8Array(256),o=0;o<64;o++)i[e.charCodeAt(o)]=o;var encode2=function(i){var o,s=new Uint8Array(i),a=s.length,h="";for(o=0;o<a;o+=3)h+=e[s[o]>>2],h+=e[(3&s[o])<<4|s[o+1]>>4],h+=e[(15&s[o+1])<<2|s[o+2]>>6],h+=e[63&s[o+2]];return a%3==2?h=h.substring(0,h.length-1)+"=":a%3==1&&(h=h.substring(0,h.length-2)+"=="),h};const s=new Map,a=new Map;const h=self;h.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return h.postMessage({id:e.data.id});{const{id:i,bitmap:o,width:f,height:g,dataURLOptions:_}=e.data,v=function getTransparentBlobFor(e,i,o){return __awaiter2(this,0,void 0,(function*(){const s=`${e}-${i}`;if("OffscreenCanvas"in globalThis){if(a.has(s))return a.get(s);const h=new OffscreenCanvas(e,i);h.getContext("2d");const f=yield h.convertToBlob(o),g=yield f.arrayBuffer(),_=encode2(g);return a.set(s,_),_}return""}))}(f,g,_),b=new OffscreenCanvas(f,g);b.getContext("2d").drawImage(o,0,0),o.close();const S=yield b.convertToBlob(_),I=S.type,x=yield S.arrayBuffer(),T=encode2(x);if(!s.has(i)&&(yield v)===T)return s.set(i,T),h.postMessage({id:i});if(s.get(i)===T)return h.postMessage({id:i});h.postMessage({id:i,type:I,base64:T,width:f,height:g}),s.set(i,T)}}))}}()}));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,i)=>{!(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(i)};const{sampling:i="all",win:o,blockClass:s,blockSelector:a,recordCanvas:h,dataURLOptions:f}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,h&&"all"===i&&this.initCanvasMutationObserver(o,s,a),h&&"number"==typeof i&&this.initCanvasFPSObserver(i,o,s,a,{dataURLOptions:f})}initCanvasFPSObserver(e,i,o,s,a){const h=initCanvasContextObserver(i,o,s,!0),f=new Map,g=new hr;g.onmessage=e=>{const{id:i}=e.data;if(f.set(i,!1),!("base64"in e.data))return;const{base64:o,type:s,width:a,height:h}=e.data;this.mutationCb({id:i,type:ir["2D"],commands:[{property:"clearRect",args:[0,0,a,h]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:o}],type:s}]},0,0]}]})};const _=1e3/e;let v,b=0;const takeCanvasSnapshots=e=>{b&&e-b<_||(b=e,(()=>{const e=[];return i.document.querySelectorAll("canvas").forEach((i=>{isBlocked(i,o,s,!0)||e.push(i)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var i;const o=this.mirror.getId(e);if(f.get(o))return;if(0===e.width||0===e.height)return;if(f.set(o,!0),["webgl","webgl2"].includes(e.__context)){const o=e.getContext(e.__context);!1===(null===(i=null==o?void 0:o.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&o.clear(o.COLOR_BUFFER_BIT)}const s=yield createImageBitmap(e);g.postMessage({id:o,bitmap:s,width:e.width,height:e.height,dataURLOptions:a.dataURLOptions},[s])}))))),v=requestAnimationFrame(takeCanvasSnapshots)};v=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{h(),cancelAnimationFrame(v)}}initCanvasMutationObserver(e,i,o){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=initCanvasContextObserver(e,i,o,!1),a=function initCanvas2DMutationObserver(e,i,o,s){const a=[],h=Object.getOwnPropertyNames(i.CanvasRenderingContext2D.prototype);for(const g of h)try{if("function"!=typeof i.CanvasRenderingContext2D.prototype[g])continue;const h=patch(i.CanvasRenderingContext2D.prototype,g,(function(a){return function(...h){return isBlocked(this.canvas,o,s,!0)||setTimeout((()=>{const o=serializeArgs(h,i,this);e(this.canvas,{type:ir["2D"],property:g,args:o})}),0),a.apply(this,h)}}));a.push(h)}catch(f){const o=hookSetter(i.CanvasRenderingContext2D.prototype,g,{set(i){e(this.canvas,{type:ir["2D"],property:g,args:[i],setter:!0})}});a.push(o)}return()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,i,o),h=function initCanvasWebGLMutationObserver(e,i,o,s,a){const h=[];return h.push(...patchGLPrototype(i.WebGLRenderingContext.prototype,ir.WebGL,e,o,s,0,i)),void 0!==i.WebGL2RenderingContext&&h.push(...patchGLPrototype(i.WebGL2RenderingContext.prototype,ir.WebGL2,e,o,s,0,i)),()=>{h.forEach((e=>e()))}}(this.processMutation.bind(this),e,i,o,this.mirror);this.resetObservers=()=>{s(),a(),h()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,i)=>{const o=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,o)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const o=this.pendingCanvasMutations.get(e);if(!o||-1===i)return;const s=o.map((e=>{const i=function __rest(e,i){var o={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.indexOf(s)<0&&(o[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)i.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(o[s[a]]=e[s[a]])}return o}(e,["type"]);return i})),{type:a}=o[0];this.mutationCb({id:i,type:a,commands:s}),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,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(0===e.length)return;const o={id:i,styleIds:[]},s=[];for(const a of e){let e;this.styleMirror.has(a)?e=this.styleMirror.getId(a):(e=this.styleMirror.add(a),s.push({styleId:e,rules:Array.from(a.rules||CSSRule,((e,i)=>({rule:stringifyRule(e),index:i})))})),o.styleIds.push(e)}s.length>0&&(o.styles=s),this.adoptedStyleSheetCb(o)}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,i){const o=this.nodeMap.get(e);return o&&Array.from(o).some((e=>e!==i))}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:Qt()})}let fr,mr,gr,_r=!1;const yr=function createMirror(){return new Mirror}();function record(e={}){const{emit:i,checkoutEveryNms:o,checkoutEveryNth:s,blockClass:a="rr-block",blockSelector:h=null,ignoreClass:f="rr-ignore",ignoreSelector:g=null,maskTextClass:_="rr-mask",maskTextSelector:v=null,inlineStylesheet:b=!0,maskAllInputs:S,maskInputOptions:I,slimDOMOptions:x,maskInputFn:T,maskTextFn:O,hooks:R,packFn:N,sampling:P={},dataURLOptions:D={},mousemoveWait:Z,recordDOM:A=!0,recordCanvas:L=!1,recordCrossOriginIframes:j=!1,recordAfter:q=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:U=!1,collectFonts:B=!1,inlineImages:z=!1,plugins:W,keepIframeSrcFn:K=()=>!1,ignoreCSSAttributes:H=new Set([]),errorHandler:G}=e;!function registerErrorHandler(e){or=e}(G);const J=!j||window.parent===window;let Y=!1;if(!J)try{window.parent.document&&(Y=!1)}catch(se){Y=!0}if(J&&!i)throw new Error("emit function is required");void 0!==Z&&void 0===P.mousemove&&(P.mousemove=Z),yr.reset();const X=!0===S?{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!==I?I:{password:!0},Q=!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===x,headMetaDescKeywords:"all"===x}:x||{};let ee;!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 i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===i)return!0}while(i=i&&i.parentNode);return!1})}();let te=0;const eventProcessor=e=>{for(const i of W||[])i.eventProcessor&&(e=i.eventProcessor(e));return N&&!Y&&(e=N(e)),e};fr=(e,a)=>{var h;if(!(null===(h=sr[0])||void 0===h?void 0:h.isFrozen())||e.type===er.FullSnapshot||e.type===er.IncrementalSnapshot&&e.data.source===tr.Mutation||sr.forEach((e=>e.unfreeze())),J)null==i||i(eventProcessor(e),a);else if(Y){const i={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:a};window.parent.postMessage(i,"*")}if(e.type===er.FullSnapshot)ee=e,te=0;else if(e.type===er.IncrementalSnapshot){if(e.data.source===tr.Mutation&&e.data.isAttachIframe)return;te++;const i=s&&te>=s,a=o&&e.timestamp-ee.timestamp>o;(i||a)&&mr(!0)}};const wrappedMutationEmit=e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Mutation},e)}))},wrappedScrollEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Scroll},e)})),wrappedCanvasMutationEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CanvasMutation},e)})),re=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.AdoptedStyleSheet},e)}))}),ne=new IframeManager({mirror:yr,mutationCb:wrappedMutationEmit,stylesheetManager:re,recordCrossOriginIframes:j,wrappedEmit:fr});for(const ae of W||[])ae.getMirror&&ae.getMirror({nodeMirror:yr,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});const ie=new ProcessedNodeManager;gr=new CanvasManager({recordCanvas:L,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:a,blockSelector:h,mirror:yr,sampling:P.canvas,dataURLOptions:D});const oe=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:a,blockSelector:h,maskTextClass:_,maskTextSelector:v,inlineStylesheet:b,maskInputOptions:X,dataURLOptions:D,maskTextFn:O,maskInputFn:T,recordCanvas:L,inlineImages:z,sampling:P,slimDOMOptions:Q,iframeManager:ne,stylesheetManager:re,canvasManager:gr,keepIframeSrcFn:K,processedNodeManager:ie},mirror:yr});mr=(e=!1)=>{if(!A)return;fr(wrapEvent({type:er.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),re.reset(),oe.init(),sr.forEach((e=>e.lock()));const i=function snapshot(e,i){const{mirror:o=new Mirror,blockClass:s="rr-block",blockSelector:a=null,maskTextClass:h="rr-mask",maskTextSelector:f=null,inlineStylesheet:g=!0,inlineImages:_=!1,recordCanvas:v=!1,maskAllInputs:b=!1,maskTextFn:S,maskInputFn:I,slimDOM:x=!1,dataURLOptions:T,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A=()=>!1}=i||{};return serializeNodeWithId(e,{doc:e,mirror:o,blockClass:s,blockSelector:a,maskTextClass:h,maskTextSelector:f,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===b?{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===b?{password:!0}:b,maskTextFn:S,maskInputFn:I,slimDOMOptions:!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===x,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===x?{}:x,dataURLOptions:T,inlineImages:_,recordCanvas:v,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A,newlyAddedElement:!1})}(document,{mirror:yr,blockClass:a,blockSelector:h,maskTextClass:_,maskTextSelector:v,inlineStylesheet:b,maskAllInputs:X,maskTextFn:O,slimDOM:Q,dataURLOptions:D,recordCanvas:L,inlineImages:z,onSerialize:e=>{isSerializedIframe(e,yr)&&ne.addIframe(e),isSerializedStylesheet(e,yr)&&re.trackLinkElement(e),hasShadowRoot(e)&&oe.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,i)=>{ne.attachIframe(e,i),oe.observeAttachShadow(e)},onStylesheetLoad:(e,i)=>{re.attachLinkElement(e,i)},keepIframeSrcFn:K});if(!i)return console.warn("Failed to snapshot the document");fr(wrapEvent({type:er.FullSnapshot,data:{node:i,initialOffset:getWindowScroll(window)}}),e),sr.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&re.adoptStyleSheets(document.adoptedStyleSheets,yr.getId(document))};try{const e=[],observe=e=>{var i;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,i)=>fr(wrapEvent({type:er.IncrementalSnapshot,data:{source:i,positions:e}})),mouseInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.ViewportResize},e)})),inputCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Input},e)})),mediaInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MediaInteraction},e)})),styleSheetRuleCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleSheetRule},e)})),styleDeclarationCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Font},e)})),selectionCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Selection},e)}))},customElementCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CustomElement},e)}))},blockClass:a,ignoreClass:f,ignoreSelector:g,maskTextClass:_,maskTextSelector:v,maskInputOptions:X,inlineStylesheet:b,sampling:P,recordDOM:A,recordCanvas:L,inlineImages:z,userTriggeredOnInput:U,collectFonts:B,doc:e,maskInputFn:T,maskTextFn:O,keepIframeSrcFn:K,blockSelector:h,slimDOMOptions:Q,dataURLOptions:D,mirror:yr,iframeManager:ne,stylesheetManager:re,shadowDomManager:oe,processedNodeManager:ie,canvasManager:gr,ignoreCSSAttributes:H,plugins:(null===(i=null==W?void 0:W.filter((e=>e.observer)))||void 0===i?void 0:i.map((e=>({observer:e.observer,options:e.options,callback:i=>fr(wrapEvent({type:er.Plugin,data:{plugin:e.name,payload:i}}))}))))||[]},R)};ne.addLoadListener((i=>{try{e.push(observe(i.contentDocument))}catch(Or){console.warn(Or)}}));const init2=()=>{mr(),e.push(observe(document)),_r=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{fr(wrapEvent({type:er.DomContentLoaded,data:{}})),"DOMContentLoaded"===q&&init2()}))),e.push(on("load",(()=>{fr(wrapEvent({type:er.Load,data:{}})),"load"===q&&init2()}),window))),()=>{e.forEach((e=>e())),ie.destroy(),_r=!1,function unregisterErrorHandler(){or=void 0}()}}catch(Or){console.warn(Or)}}record.addCustomEvent=(e,i)=>{if(!_r)throw new Error("please add custom event after start recording");fr(wrapEvent({type:er.Custom,data:{tag:e,payload:i}}))},record.freezePage=()=>{sr.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!_r)throw new Error("please take full snapshot after start recording");mr(e)},record.mirror=yr;var vr,br=(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))(br||{}),Sr=(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))(Sr||{}),kr={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var wr={hostname:""};vr={navigator:{userAgent:"",onLine:!0},document:{location:wr,referrer:""},screen:{width:0,height:0},location:wr}}else vr=window;var Ir,xr,Er,Cr,Tr,Or,Rr,Mr,Nr,Pr,Dr=864e5,Zr=8e3,Ar=Array.prototype,Lr=Function.prototype,jr=Object.prototype,Fr=Ar.slice,$r=jr.toString,qr=jr.hasOwnProperty,Ur=vr.console,Br=vr.navigator,zr=vr.document,Vr=vr.opera,Wr=vr.screen,Kr=Br.userAgent,Hr=Lr.bind,Gr=Ar.forEach,Jr=Ar.indexOf,Yr=Ar.map,Xr=Array.isArray,Qr={},en={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},tn={log:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur)try{Ur.log.apply(Ur,arguments)}catch(e){en.each(arguments,(function(e){Ur.log(e)}))}},warn:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel warning:"].concat(en.toArray(arguments));try{Ur.warn.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.warn(e)}))}}},error:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.error(e)}))}}},critical:function(){if(!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.error(e)}))}}}},log_func_with_prefix=function(e,i){return function(){return arguments[0]="["+i+"] "+arguments[0],e.apply(tn,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(tn.log,e),error:log_func_with_prefix(tn.error,e),critical:log_func_with_prefix(tn.critical,e)}};en.bind=function(e,i){var o,s;if(Hr&&e.bind===Hr)return Hr.apply(e,Fr.call(arguments,1));if(!en.isFunction(e))throw new TypeError;return o=Fr.call(arguments,2),s=function(){if(!(this instanceof s))return e.apply(i,o.concat(Fr.call(arguments)));var a={};a.prototype=e.prototype;var h=new a;a.prototype=null;var f=e.apply(h,o.concat(Fr.call(arguments)));return Object(f)===f?f:h},s},en.each=function(e,i,o){if(null!=e)if(Gr&&e.forEach===Gr)e.forEach(i,o);else if(e.length===+e.length){for(var s=0,a=e.length;s<a;s++)if(s in e&&i.call(o,e[s],s,e)===Qr)return}else for(var h in e)if(qr.call(e,h)&&i.call(o,e[h],h,e)===Qr)return},en.extend=function(e){return en.each(Fr.call(arguments,1),(function(i){for(var o in i)void 0!==i[o]&&(e[o]=i[o])})),e},en.isArray=Xr||function(e){return"[object Array]"===$r.call(e)},en.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(i){return!1}},en.isArguments=function(e){return!(!e||!qr.call(e,"callee"))},en.toArray=function(e){return e?e.toArray?e.toArray():en.isArray(e)||en.isArguments(e)?Fr.call(e):en.values(e):[]},en.map=function(e,i,o){if(Yr&&e.map===Yr)return e.map(i,o);var s=[];return en.each(e,(function(e){s.push(i.call(o,e))})),s},en.keys=function(e){var i=[];return null===e||en.each(e,(function(e,o){i[i.length]=o})),i},en.values=function(e){var i=[];return null===e||en.each(e,(function(e){i[i.length]=e})),i},en.include=function(e,i){var o=!1;return null===e?o:Jr&&e.indexOf===Jr?-1!=e.indexOf(i):(en.each(e,(function(e){if(o||(o=e===i))return Qr})),o)},en.includes=function(e,i){return-1!==e.indexOf(i)},en.inherit=function(e,i){return e.prototype=new i,e.prototype.constructor=e,e.superclass=i.prototype,e},en.isObject=function(e){return e===Object(e)&&!en.isArray(e)},en.isEmptyObject=function(e){if(en.isObject(e)){for(var i in e)if(qr.call(e,i))return!1;return!0}return!1},en.isUndefined=function(e){return void 0===e},en.isString=function(e){return"[object String]"==$r.call(e)},en.isDate=function(e){return"[object Date]"==$r.call(e)},en.isNumber=function(e){return"[object Number]"==$r.call(e)},en.isElement=function(e){return!(!e||1!==e.nodeType)},en.encodeDates=function(e){return en.each(e,(function(i,o){en.isDate(i)?e[o]=en.formatDate(i):en.isObject(i)&&(e[o]=en.encodeDates(i))})),e},en.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},en.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())},en.strip_empty_properties=function(e){var i={};return en.each(e,(function(e,o){en.isString(e)&&e.length>0&&(i[o]=e)})),i},en.truncate=function(e,i){var o;return"string"==typeof e?o=e.slice(0,i):en.isArray(e)?(o=[],en.each(e,(function(e){o.push(en.truncate(e,i))}))):en.isObject(e)?(o={},en.each(e,(function(e,s){o[s]=en.truncate(e,i)}))):o=e,o},en.JSONEncode=function(){return function(e){var quote=function(e){var i=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return i.lastIndex=0,i.test(e)?'"'+e.replace(i,(function(e){var i=o[e];return"string"==typeof i?i:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,i){var o="",s=0,a="",h="",f=0,g=o,_=[],v=i[e];switch(v&&"object"==typeof v&&"function"==typeof v.toJSON&&(v=v.toJSON(e)),typeof v){case"string":return quote(v);case"number":return isFinite(v)?String(v):"null";case"boolean":case"null":return String(v);case"object":if(!v)return"null";if(o+=" ",_=[],"[object Array]"===$r.apply(v)){for(f=v.length,s=0;s<f;s+=1)_[s]=str(s,v)||"null";return h=0===_.length?"[]":o?"[\n"+o+_.join(",\n"+o)+"\n"+g+"]":"["+_.join(",")+"]",o=g,h}for(a in v)qr.call(v,a)&&(h=str(a,v))&&_.push(quote(a)+(o?": ":":")+h);return h=0===_.length?"{}":o?"{"+_.join(",")+g+"}":"{"+_.join(",")+"}",o=g,h}};return str("",{"":e})}}(),en.JSONDecode=(Tr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Or=function(e){var i=new SyntaxError(e);throw i.at=Ir,i.text=Er,i},Rr=function(e){return e&&e!==xr&&Or("Expected '"+e+"' instead of '"+xr+"'"),xr=Er.charAt(Ir),Ir+=1,xr},Mr=function(){var e,i="";for("-"===xr&&(i="-",Rr("-"));xr>="0"&&xr<="9";)i+=xr,Rr();if("."===xr)for(i+=".";Rr()&&xr>="0"&&xr<="9";)i+=xr;if("e"===xr||"E"===xr)for(i+=xr,Rr(),"-"!==xr&&"+"!==xr||(i+=xr,Rr());xr>="0"&&xr<="9";)i+=xr,Rr();if(e=+i,isFinite(e))return e;Or("Bad number")},Nr=function(){var e,i,o,s="";if('"'===xr)for(;Rr();){if('"'===xr)return Rr(),s;if("\\"===xr)if(Rr(),"u"===xr){for(o=0,i=0;i<4&&(e=parseInt(Rr(),16),isFinite(e));i+=1)o=16*o+e;s+=String.fromCharCode(o)}else{if("string"!=typeof Tr[xr])break;s+=Tr[xr]}else s+=xr}Or("Bad string")},Pr=function(){for(;xr&&xr<=" ";)Rr()},Cr=function(){switch(Pr(),xr){case"{":return function(){var e,i={};if("{"===xr){if(Rr("{"),Pr(),"}"===xr)return Rr("}"),i;for(;xr;){if(e=Nr(),Pr(),Rr(":"),Object.hasOwnProperty.call(i,e)&&Or('Duplicate key "'+e+'"'),i[e]=Cr(),Pr(),"}"===xr)return Rr("}"),i;Rr(","),Pr()}}Or("Bad object")}();case"[":return function(){var e=[];if("["===xr){if(Rr("["),Pr(),"]"===xr)return Rr("]"),e;for(;xr;){if(e.push(Cr()),Pr(),"]"===xr)return Rr("]"),e;Rr(","),Pr()}}Or("Bad array")}();case'"':return Nr();case"-":return Mr();default:return xr>="0"&&xr<="9"?Mr():function(){switch(xr){case"t":return Rr("t"),Rr("r"),Rr("u"),Rr("e"),!0;case"f":return Rr("f"),Rr("a"),Rr("l"),Rr("s"),Rr("e"),!1;case"n":return Rr("n"),Rr("u"),Rr("l"),Rr("l"),null}Or('Unexpected "'+xr+'"')}()}},function(e){var i;return Er=e,Ir=0,xr=" ",i=Cr(),Pr(),xr&&Or("Syntax error"),i}),en.base64Encode=function(e){var i,o,s,a,h,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,_=0,v="",b=[];if(!e)return e;e=en.utf8Encode(e);do{i=(h=e.charCodeAt(g++)<<16|e.charCodeAt(g++)<<8|e.charCodeAt(g++))>>18&63,o=h>>12&63,s=h>>6&63,a=63&h,b[_++]=f.charAt(i)+f.charAt(o)+f.charAt(s)+f.charAt(a)}while(g<e.length);switch(v=b.join(""),e.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v},en.utf8Encode=function(e){var i,o,s,a,h="";for(i=o=0,s=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,a=0;a<s;a++){var f=e.charCodeAt(a),g=null;f<128?o++:g=f>127&&f<2048?String.fromCharCode(f>>6|192,63&f|128):String.fromCharCode(f>>12|224,f>>6&63|128,63&f|128),null!==g&&(o>i&&(h+=e.substring(i,o)),h+=g,i=o=a+1)}return o>i&&(h+=e.substring(i,e.length)),h},en.UUID=function(){var T2=function(){var e,i=1*new Date;if(vr.performance&&vr.performance.now)e=vr.performance.now();else for(e=0;i==1*new Date;)e++;return i.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,i,o=Kr,s=[],a=0;function xor(e,i){var o,a=0;for(o=0;o<i.length;o++)a|=s[o]<<8*o;return e^a}for(e=0;e<o.length;e++)i=o.charCodeAt(e),s.unshift(255&i),s.length>=4&&(a=xor(a,s),s=[]);return s.length>0&&(a=xor(a,s)),a.toString(16)}()+"-"+e+"-"+T2()}}();var rn=["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"];en.isBlockedUA=function(e){var i;for(e=e.toLowerCase(),i=0;i<rn.length;i++)if(-1!==e.indexOf(rn[i]))return!0;return!1},en.HTTPBuildQuery=function(e,i){var o,s,a=[];return en.isUndefined(i)&&(i="&"),en.each(e,(function(e,i){o=encodeURIComponent(e.toString()),s=encodeURIComponent(i),a[a.length]=s+"="+o})),a.join(i)},en.getQueryParam=function(e,i){i=i.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var o=new RegExp("[\\?&]"+i+"=([^&#]*)").exec(e);if(null===o||o&&"string"!=typeof o[1]&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch(a){tn.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},en.cookie={get:function(e){for(var i=e+"=",o=zr.cookie.split(";"),s=0;s<o.length;s++){for(var a=o[s];" "==a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(i))return decodeURIComponent(a.substring(i.length,a.length))}return null},parse:function(e){var i;try{i=en.JSONDecode(en.cookie.get(e))||{}}catch(o){}return i},set_seconds:function(e,i,o,s,a,h,f){var g="",_="",v="";if(f)g="; domain="+f;else if(s){var b=extract_domain(zr.location.hostname);g=b?"; domain=."+b:""}if(o){var S=new Date;S.setTime(S.getTime()+1e3*o),_="; expires="+S.toGMTString()}h&&(a=!0,v="; SameSite=None"),a&&(v+="; secure"),zr.cookie=e+"="+encodeURIComponent(i)+_+"; path=/"+g+v},set:function(e,i,o,s,a,h,f){var g="",_="",v="";if(f)g="; domain="+f;else if(s){var b=extract_domain(zr.location.hostname);g=b?"; domain=."+b:""}if(o){var S=new Date;S.setTime(S.getTime()+24*o*60*60*1e3),_="; expires="+S.toGMTString()}h&&(a=!0,v="; SameSite=None"),a&&(v+="; secure");var I=e+"="+encodeURIComponent(i)+_+"; path=/"+g+v;return zr.cookie=I,I},remove:function(e,i,o){en.cookie.set(e,"",-1,i,!1,!1,o)}};var nn=null,localStorageSupported=function(e,i){if(null!==nn&&!i)return nn;var o=!0;try{e=e||window.localStorage;var s="__mplss_"+cheap_guid(8);e.setItem(s,"xyz"),"xyz"!==e.getItem(s)&&(o=!1),e.removeItem(s)}catch(a){o=!1}return nn=o,o};en.localStorage={is_supported:function(e){var i=localStorageSupported(null,e);return i||tn.error("localStorage unsupported; falling back to cookie store"),i},error:function(e){tn.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(i){en.localStorage.error(i)}return null},parse:function(e){try{return en.JSONDecode(en.localStorage.get(e))||{}}catch(i){}return null},set:function(e,i){try{window.localStorage.setItem(e,i)}catch(o){en.localStorage.error(o)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(i){en.localStorage.error(i)}}},en.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,i,o,s,a){if(e)if(e.addEventListener&&!s)e.addEventListener(i,o,!!a);else{var h="on"+i,f=e[h];e[h]=function makeHandler(e,i,o){var handler=function(s){if(s=s||fixEvent(window.event)){var a,h,f=!0;return en.isFunction(o)&&(a=o(s)),h=i.call(e,s),!1!==a&&!1!==h||(f=!1),f}};return handler}(e,o,f)}else tn.error("No valid element provided to register_event")}}();var sn=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');en.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(i,o){var s=" "+o+" ";return(" "+i.className+" ").replace(e," ").indexOf(s)>=0}function getElementsBySelector(e){if(!zr.getElementsByTagName)return[];var i,o,s,a,h,f,g,_,v,b,S=e.split(" "),I=[zr];for(f=0;f<S.length;f++)if((i=S[f].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){s=(o=i.split("#"))[0];var x=o[1],T=zr.getElementById(x);if(!T||s&&T.nodeName.toLowerCase()!=s)return[];I=[T]}else if(i.indexOf(".")>-1){s=(o=i.split("."))[0];var O=o[1];for(s||(s="*"),a=[],h=0,g=0;g<I.length;g++)for(v="*"==s?getAllChildren(I[g]):I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];for(I=[],b=0,g=0;g<a.length;g++)a[g].className&&en.isString(a[g].className)&&hasClass(a[g],O)&&(I[b++]=a[g])}else{var R=i.match(sn);if(R){s=R[1];var N,P=R[2],D=R[3],Z=R[4];for(s||(s="*"),a=[],h=0,g=0;g<I.length;g++)for(v="*"==s?getAllChildren(I[g]):I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];switch(I=[],b=0,D){case"=":N=function(e){return e.getAttribute(P)==Z};break;case"~":N=function(e){return e.getAttribute(P).match(new RegExp("\\b"+Z+"\\b"))};break;case"|":N=function(e){return e.getAttribute(P).match(new RegExp("^"+Z+"-?"))};break;case"^":N=function(e){return 0===e.getAttribute(P).indexOf(Z)};break;case"$":N=function(e){return e.getAttribute(P).lastIndexOf(Z)==e.getAttribute(P).length-Z.length};break;case"*":N=function(e){return e.getAttribute(P).indexOf(Z)>-1};break;default:N=function(e){return e.getAttribute(P)}}for(I=[],b=0,g=0;g<a.length;g++)N(a[g])&&(I[b++]=a[g])}else{for(s=i,a=[],h=0,g=0;g<I.length;g++)for(v=I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];I=a}}return I}return function(e){return en.isElement(e)?[e]:en.isObject(e)&&!en.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var an=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],cn=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];en.info={campaignParams:function(e){var i="",o={};return en.each(an,(function(s){(i=en.getQueryParam(zr.URL,s)).length?o[s]=i:void 0!==e&&(o[s]=e)})),o},clickParams:function(){var e="",i={};return en.each(cn,(function(o){(e=en.getQueryParam(zr.URL,o)).length&&(i[o]=e)})),i},marketingParams:function(){return en.extend(en.info.campaignParams(),en.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 i=en.info.searchEngine(e),o="yahoo"!=i?"q":"p",s={};if(null!==i){s.$search_engine=i;var a=en.getQueryParam(e,o);a.length&&(s.mp_keyword=a)}return s},browser:function(e,i,o){return i=i||"",o||en.includes(e," OPR/")?en.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":en.includes(e,"IEMobile")||en.includes(e,"WPDesktop")?"Internet Explorer Mobile":en.includes(e,"SamsungBrowser/")?"Samsung Internet":en.includes(e,"Edge")||en.includes(e,"Edg/")?"Microsoft Edge":en.includes(e,"FBIOS")?"Facebook Mobile":en.includes(e,"Chrome")?"Chrome":en.includes(e,"CriOS")?"Chrome iOS":en.includes(e,"UCWEB")||en.includes(e,"UCBrowser")?"UC Browser":en.includes(e,"FxiOS")?"Firefox iOS":en.includes(i,"Apple")?en.includes(e,"Mobile")?"Mobile Safari":"Safari":en.includes(e,"Android")?"Android Mobile":en.includes(e,"Konqueror")?"Konqueror":en.includes(e,"Firefox")?"Firefox":en.includes(e,"MSIE")||en.includes(e,"Trident/")?"Internet Explorer":en.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,i,o){var s={"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+)?)/}[en.info.browser(e,i,o)];if(void 0===s)return null;var a=e.match(s);return a?parseFloat(a[a.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 i=e.split("/");return i.length>=3?i[2]:""},currentUrl:function(){return vr.location.href},properties:function(e){return"object"!=typeof e&&(e={}),en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr),$referrer:zr.referrer,$referring_domain:en.info.referringDomain(zr.referrer),$device:en.info.device(Kr)}),{$current_url:en.info.currentUrl(),$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr),$screen_height:Wr.height,$screen_width:Wr.width,mp_lib:"web",$lib_version:kr.LIB_VERSION,$insert_id:cheap_guid(),time:en.timestamp()/1e3},en.strip_empty_properties(e))},people_properties:function(){return en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr)}),{$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr)})},mpPageViewProperties:function(){return en.strip_empty_properties({current_page_title:zr.title,current_domain:vr.location.hostname,current_url_path:vr.location.pathname,current_url_protocol:vr.location.protocol,current_url_search:vr.location.search})}};var cheap_guid=function(e){var i=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?i.substring(0,e):i},dn=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,un=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var i=un,o=e.split("."),s=o[o.length-1];(s.length>4||"com"===s||"org"===s)&&(i=dn);var a=e.match(i);return a?a[0]:""},ln=null,pn=null;"undefined"!=typeof JSON&&(ln=JSON.stringify,pn=JSON.parse),ln=ln||en.JSONEncode,pn=pn||en.JSONDecode,en.toArray=en.toArray,en.isObject=en.isObject,en.JSONEncode=en.JSONEncode,en.JSONDecode=en.JSONDecode,en.isBlockedUA=en.isBlockedUA,en.isEmptyObject=en.isEmptyObject,en.info=en.info,en.info.device=en.info.device,en.info.browser=en.info.browser,en.info.browserVersion=en.info.browserVersion,en.info.properties=en.info.properties;var hn="__mp_opt_in_out_";function optIn(e,i){_optInOut(!0,e,i)}function optOut(e,i){_optInOut(!1,e,i)}function hasOptedIn(e,i){return"1"===_getStorageValue(e,i)}function hasOptedOut(e,i){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var i=e&&e.window||vr,o=i.navigator||{},s=!1;return en.each([o.doNotTrack,o.msDoNotTrack,i.doNotTrack],(function(e){en.includes([!0,1,"1","yes"],e)&&(s=!0)})),s}(i))return tn.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 o="0"===_getStorageValue(e,i);return o&&tn.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),o}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,i){_getStorage(i=i||{}).remove(_getStorageKey(e,i),!!i.crossSubdomainCookie,i.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?en.localStorage:en.cookie}function _getStorageKey(e,i){return((i=i||{}).persistencePrefix||hn)+e}function _getStorageValue(e,i){return _getStorage(i).get(_getStorageKey(e,i))}function _optInOut(e,i,o){en.isString(i)&&i.length?(_getStorage(o=o||{}).set(_getStorageKey(i,o),e?1:0,en.isNumber(o.cookieExpiration)?o.cookieExpiration:null,!!o.crossSubdomainCookie,!!o.secureCookie,!!o.crossSiteCookie,o.cookieDomain),o.track&&e&&o.track(o.trackEventName||"$opt_in",o.trackProperties,{send_immediately:!0})):tn.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,i){return function(){var o=!1;try{var s=i.call(this,"token"),a=i.call(this,"ignore_dnt"),h=i.call(this,"opt_out_tracking_persistence_type"),f=i.call(this,"opt_out_tracking_cookie_prefix"),g=i.call(this,"window");s&&(o=hasOptedOut(s,{ignoreDnt:a,persistenceType:h,persistencePrefix:f,window:g}))}catch(v){tn.error("Unexpected error when checking tracking opt-out status: "+v)}if(!o)return e.apply(this,arguments);var _=arguments[arguments.length-1];"function"==typeof _&&_(0)}}var fn=console_with_prefix("lock"),SharedLock=function(e,i){i=i||{},this.storageKey=e,this.storage=i.storage||window.localStorage,this.pollIntervalMS=i.pollIntervalMS||100,this.timeoutMS=i.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,i,o){o||"function"==typeof i||(o=i,i=null);var s=o||(new Date).getTime()+"|"+Math.random(),a=(new Date).getTime(),h=this.storageKey,f=this.pollIntervalMS,g=this.timeoutMS,_=this.storage,v=h+":X",b=h+":Y",S=h+":Z",reportError=function(e){i&&i(e)},delay=function(e){if((new Date).getTime()-a>g)return fn.error("Timeout waiting for mutex on "+h+"; clearing lock. ["+s+"]"),_.removeItem(S),_.removeItem(b),void loop();setTimeout((function(){try{e()}catch(i){reportError(i)}}),f*(Math.random()+.1))},waitFor=function(e,i){e()?i():delay((function(){waitFor(e,i)}))},getSetY=function(){var e=_.getItem(b);if(e&&e!==s)return!1;if(_.setItem(b,s),_.getItem(b)===s)return!0;if(!localStorageSupported(_,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){_.setItem(v,s),waitFor(getSetY,(function(){_.getItem(v)!==s?delay((function(){_.getItem(b)===s?waitFor((function(){return!_.getItem(S)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){_.setItem(S,"1");try{e()}finally{_.removeItem(S),_.getItem(b)===s&&_.removeItem(b),_.getItem(v)===s&&_.removeItem(v)}};try{if(!localStorageSupported(_,!0))throw new Error("localStorage support check failed");loop()}catch(I){reportError(I)}};var mn=console_with_prefix("batch"),RequestQueue=function(e,i){i=i||{},this.storageKey=e,this.storage=i.storage||window.localStorage,this.reportError=i.errorReporter||en.bind(mn.error,mn),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=i.usePersistence,this.pid=i.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,i,o){var s={id:cheap_guid(),flushAfter:(new Date).getTime()+2*i,payload:e};this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var i;try{var a=this.readFromStorage();a.push(s),(i=this.saveToStorage(a))&&this.memQueue.push(s)}catch(h){this.reportError("Error enqueueing item",e),i=!1}o&&o(i)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),o&&o(!1)}),this),this.pid):(this.memQueue.push(s),o&&o(!0))},RequestQueue.prototype.fillBatch=function(e){var i=this.memQueue.slice(0,e);if(this.usePersistence&&i.length<e){var o=this.readFromStorage();if(o.length){var s={};en.each(i,(function(e){s[e.id]=!0}));for(var a=0;a<o.length;a++){var h=o[a];if((new Date).getTime()>h.flushAfter&&!s[h.id]&&(h.orphaned=!0,i.push(h),i.length>=e))break}}}return i};var filterOutIDsAndInvalid=function(e,i){var o=[];return en.each(e,(function(e){e.id&&!i[e.id]&&o.push(e)})),o};RequestQueue.prototype.removeItemsByID=function(e,i){var o={};if(en.each(e,(function(e){o[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,o),this.usePersistence){var s=en.bind((function(){var i;try{var s=this.readFromStorage();if(s=filterOutIDsAndInvalid(s,o),i=this.saveToStorage(s)){s=this.readFromStorage();for(var a=0;a<s.length;a++){var h=s[a];if(h.id&&o[h.id])return this.reportError("Item not removed from storage"),!1}}}catch(f){this.reportError("Error removing items",e),i=!1}return i}),this);this.lock.withLock((function lockAcquired(){var e=s();i&&i(e)}),en.bind((function lockFailure(e){var o=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(o=s()))try{this.storage.removeItem(this.storageKey)}catch(a){this.reportError("Error clearing queue",a)}i&&i(o)}),this),this.pid)}else i&&i(!0)};var updatePayloads=function(e,i){var o=[];return en.each(e,(function(e){var s=e.id;if(s in i){var a=i[s];null!==a&&(e.payload=a,o.push(e))}else o.push(e)})),o};RequestQueue.prototype.updatePayloads=function(e,i){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var o;try{var s=this.readFromStorage();s=updatePayloads(s,e),o=this.saveToStorage(s)}catch(a){this.reportError("Error updating items",e),o=!1}i&&i(o)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),i&&i(!1)}),this),this.pid):i&&i(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=pn(e),en.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(i){this.reportError("Error retrieving queue",i),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,ln(e)),!0}catch(i){return this.reportError("Error saving queue",i),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var gn=console_with_prefix("batch"),RequestBatcher=function(e,i){this.errorReporter=i.errorReporter,this.queue=new RequestQueue(e,{errorReporter:en.bind(this.reportError,this),storage:i.storage,usePersistence:i.usePersistence}),this.libConfig=i.libConfig,this.sendRequest=i.sendRequestFunc,this.beforeSendHook=i.beforeSendHook,this.stopAllBatching=i.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=i.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,i){this.queue.enqueue(e,this.flushInterval,i)},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(en.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void gn.log("Flush: Request already in progress");e=e||{};var i=this.libConfig.batch_request_timeout_ms,o=(new Date).getTime(),s=this.batchSize,a=this.queue.fillBatch(s),h=a.length===s,f=[],g={};if(en.each(a,(function(e){var i=e.payload;if(this.beforeSendHook&&!e.orphaned&&(i=this.beforeSendHook(i)),i){i.event&&i.properties&&(i.properties=en.extend({},i.properties,{mp_sent_by_lib_version:kr.LIB_VERSION}));var o=!0,s=e.id;s?(this.itemIdsSentSuccessfully[s]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[s]}),o=!1):this.reportError("[dupe] found item with no ID",{item:e}),o&&f.push(i)}g[e.id]=i}),this),f.length<1)return void this.resetFlush();this.requestInProgress=!0;var _=en.bind((function(f){this.requestInProgress=!1;try{var _=!1;if(e.unloading)this.queue.updatePayloads(g);else if(en.isObject(f)&&"timeout"===f.error&&(new Date).getTime()-o>=i)this.reportError("Network timeout; retrying"),this.flush();else if(en.isObject(f)&&(f.httpStatusCode>=500||429===f.httpStatusCode||f.httpStatusCode<=0&&(S=vr.navigator.onLine,!en.isUndefined(S)&&!S)||"timeout"===f.error)){var v=2*this.flushInterval;f.retryAfter&&(v=1e3*parseInt(f.retryAfter,10)||v),v=Math.min(6e5,v),this.reportError("Error; retry in "+v+" ms"),this.scheduleFlush(v)}else if(en.isObject(f)&&413===f.httpStatusCode)if(a.length>1){var b=Math.max(1,Math.floor(s/2));this.batchSize=Math.min(this.batchSize,b,a.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",a),this.resetBatchSize(),_=!0;else _=!0;_&&(this.queue.removeItemsByID(en.map(a,(function(e){return e.id})),en.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!h?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)),en.each(a,en.bind((function(e){var i=e.id;i?(this.itemIdsSentSuccessfully[i]=this.itemIdsSentSuccessfully[i]||0,this.itemIdsSentSuccessfully[i]++,this.itemIdsSentSuccessfully[i]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[i]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(I){this.reportError("Error handling API response",I),this.resetFlush()}var S}),this),v={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:i};e.unloading&&(v.transport="sendBeacon"),gn.log("MIXPANEL REQUEST:",f),this.sendRequest(f,v,_)}catch(b){this.reportError("Error flushing request queue",b),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,i){if(gn.error.apply(gn.error,arguments),this.errorReporter)try{i instanceof Error||(i=new Error(e)),this.errorReporter(e,i)}catch(o){gn.error(o)}};var _n=console_with_prefix("recorder"),yn=vr.CompressionStream,vn={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},bn=new Set([Sr.MouseMove,Sr.MouseInteraction,Sr.Scroll,Sr.ViewportResize,Sr.Input,Sr.TouchMove,Sr.MediaInteraction,Sr.Drag,Sr.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=Dr,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:vn,sendRequestFunc:en.bind(this.flushEventsWithOptOut,this),errorReporter:en.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>Dr&&(this.recordMaxMs=Dr,_n.critical("record_max_ms cannot be greater than "+Dr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Zr&&(this.recordMinMs=Zr,_n.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=en.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var i=en.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(en.bind((function(){_n.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),o=this.get_config("record_block_selector");""!==o&&null!==o||(o=void 0),this._stopRecording=record({emit:en.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===br.IncrementalSnapshot&&bn.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),i())}),this),blockClass:this.get_config("record_block_class"),blockSelector:o,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")}),i(),this.maxTimeoutId=setTimeout(en.bind(this.resetRecording,this),this.recordMaxMs)}else _n.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,i,o){this._flushEvents(e,i,o,en.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,i,o,s){var a=en.bind((function(i,o){200===i.status&&this.replayId===e&&this.seqNo++,s({status:0,httpStatusCode:i.status,responseBody:o,retryAfter:i.headers.get("Retry-After")})}),this);vr.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(i),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:o}).then((function(e){e.json().then((function(i){a(e,i)})).catch((function(e){s({error:e})}))})).catch((function(e){s({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,i,o){const s=e.length;if(s>0){var a=this.replayId,h=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=h);var f=e[s-1].timestamp-this.replayStartTime,g={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:h/1e3,replay_id:a,replay_length_ms:f,replay_start_time:this.replayStartTime/1e3},_=en.JSONEncode(e),v=this._mixpanel.get_property("$device_id");v&&(g.$device_id=v);var b=this._mixpanel.get_property("$user_id");if(b&&(g.$user_id=b),yn){var S=new Blob([_],{type:"application/json"}).stream().pipeThrough(new yn("gzip"));new Response(S).blob().then(en.bind((function(e){g.format="gzip",this._sendRequest(a,g,e,o)}),this))}else g.format="body",this._sendRequest(a,g,_,o)}})),MixpanelRecorder.prototype.reportError=function(e,i){_n.error.apply(_n.error,arguments);try{i||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,i)}catch(o){_n.error(o)}},vr.__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,i,o,s){var a=this,h=en.dom_query(e);if(0!==h.length)return en.each(h,(function(e){en.register_event(e,this.override_event,(function(e){var h={},f=a.create_properties(o,this),g=a.mp.get_config("track_links_timeout");a.event_handler(e,this,h),window.setTimeout(a.track_callback(s,f,h,!0),g),a.mp.track(i,f,a.track_callback(s,f,h))}))}),this),!0;tn.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,i,o,s){s=s||!1;var a=this;return function(){o.callback_fired||(o.callback_fired=!0,e&&!1===e(s,i)||a.after_track_handler(i,o,s))}},DomTracker.prototype.create_properties=function(e,i){return"function"==typeof e?e(i):en.extend({},e)};var LinkTracker=function(){this.override_event="click"};en.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,i){var o=LinkTracker.superclass.create_properties.apply(this,arguments);return i.href&&(o.url=i.href),o},LinkTracker.prototype.event_handler=function(e,i,o){o.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===i.target,o.href=i.href,o.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,i){i.new_tab||setTimeout((function(){window.location=i.href}),0)};var FormTracker=function(){this.override_event="submit"};en.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,i,o){o.element=i,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,i){setTimeout((function(){i.element.submit()}),0)};var Sn="$set",kn="$set_once",wn="$unset",In="$add",xn="$append",En="$union",Cn="$remove",Tn={set_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[Sn]=s,o},unset_action:function(e){var i={},o=[];return en.isArray(e)||(e=[e]),en.each(e,(function(e){this._is_reserved_property(e)||o.push(e)}),this),i[wn]=o,i},set_once_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[kn]=s,o},union_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=en.isArray(e)?e:[e])}),this):s[e]=en.isArray(i)?i:[i],o[En]=s,o},append_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[xn]=s,o},remove_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[Cn]=s,o},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};en.extend(MixpanelGroup.prototype,Tn),MixpanelGroup.prototype._init=function(e,i,o){this._mixpanel=e,this._group_key=i,this._group_id=o},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.set_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.set_once_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,i){var o=this.unset_action(e);return this._send_request(o,i)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,i,o){en.isObject(e)&&(o=i);var s=this.union_action(e,i);return this._send_request(s,o)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var i=this.delete_action();return this._send_request(i,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.remove_action(e,i);return this._send_request(s,o)})),MixpanelGroup.prototype._send_request=function(e,i){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var o=en.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},i)},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(){};en.extend(MixpanelPeople.prototype,Tn),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,i,o){var s=this.set_action(e,i);return en.isObject(e)&&(o=i),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),s[Sn]=en.extend({},en.info.people_properties(),s[Sn]),this._send_request(s,o)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,i,o){var s=this.set_once_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,i){var o=this.unset_action(e);return this._send_request(o,i)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,i,o){var s={},a={};return en.isObject(e)?(en.each(e,(function(e,i){if(!this._is_reserved_property(i)){if(isNaN(parseFloat(e)))return void tn.error("Invalid increment value passed to mixpanel.people.increment - must be a number");a[i]=e}}),this),o=i):(en.isUndefined(i)&&(i=1),a[e]=i),s[In]=a,this._send_request(s,o)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.append_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.remove_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.union_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,i,o){if(en.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",en.extend({$amount:e},i),o);tn.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)}tn.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,i){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var o=this._mixpanel.get_property("$device_id"),s=this._mixpanel.get_property("$user_id"),a=this._mixpanel.get_property("$had_persisted_distinct_id");o&&(e.$device_id=o),s&&(e.$user_id=s),a&&(e.$had_persisted_distinct_id=a);var h=en.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:h,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},i):(this._enqueue(e),en.isUndefined(i)||(this._get_config("verbose")?i({status:-1,error:null}):i(-1)),en.truncate(h,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){Sn in e?this._mixpanel.persistence._add_to_people_queue(Sn,e):kn in e?this._mixpanel.persistence._add_to_people_queue(kn,e):wn in e?this._mixpanel.persistence._add_to_people_queue(wn,e):In in e?this._mixpanel.persistence._add_to_people_queue(In,e):xn in e?this._mixpanel.persistence._add_to_people_queue(xn,e):Cn in e?this._mixpanel.persistence._add_to_people_queue(Cn,e):En in e?this._mixpanel.persistence._add_to_people_queue(En,e):tn.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,i,o,s){var a=this,h=en.extend({},this._mixpanel.persistence.load_queue(e)),f=h;en.isUndefined(h)||!en.isObject(h)||en.isEmptyObject(h)||(a._mixpanel.persistence._pop_from_people_queue(e,h),a._mixpanel.persistence.save(),s&&(f=s(h)),i.call(a,f,(function(i,s){0===i&&a._mixpanel.persistence._add_to_people_queue(e,h),en.isUndefined(o)||o(i,s)})))},MixpanelPeople.prototype._flush=function(e,i,o,s,a,h,f){var g=this;this._flush_one_queue(Sn,this.set,e),this._flush_one_queue(kn,this.set_once,s),this._flush_one_queue(wn,this.unset,h,(function(e){return en.keys(e)})),this._flush_one_queue(In,this.increment,i),this._flush_one_queue(En,this.union,a);var _=this._mixpanel.persistence.load_queue(xn);if(!en.isUndefined(_)&&en.isArray(_)&&_.length)for(var v,append_callback=function(e,i){0===e&&g._mixpanel.persistence._add_to_people_queue(xn,v),en.isUndefined(o)||o(e,i)},b=_.length-1;b>=0;b--)_=this._mixpanel.persistence.load_queue(xn),v=_.pop(),g._mixpanel.persistence.save(),en.isEmptyObject(v)||g.append(v,append_callback);var S=this._mixpanel.persistence.load_queue(Cn);if(!en.isUndefined(S)&&en.isArray(S)&&S.length)for(var I,remove_callback=function(e,i){0===e&&g._mixpanel.persistence._add_to_people_queue(Cn,I),en.isUndefined(f)||f(e,i)},x=S.length-1;x>=0;x--)S=this._mixpanel.persistence.load_queue(Cn),I=S.pop(),g._mixpanel.persistence.save(),en.isEmptyObject(I)||g.remove(I,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 On,Rn="__mps",Mn="__mpso",Nn="__mpus",Pn="__mpa",Dn="__mpap",Zn="__mpr",An="__mpu",Ln="$people_distinct_id",jn="__alias",Fn="__timers",$n=[Rn,Mn,Nn,Pn,Dn,Zn,An,Ln,jn,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 i=e.persistence;"cookie"!==i&&"localStorage"!==i&&(tn.critical("Unknown persistence type "+i+"; falling back to cookie"),i=e.persistence="cookie"),"localStorage"===i&&en.localStorage.is_supported()?this.storage=en.localStorage:this.storage=en.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),en.each(this.props,(function(i,o){en.include($n,o)||(e[o]=i)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=en.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,i;this.storage===en.localStorage?(e=en.cookie.parse(this.name),en.cookie.remove(this.name),en.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===en.cookie&&(i=en.localStorage.parse(this.name),en.localStorage.remove(this.name),i&&this.register_once(i))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,en.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,i,o){return!!en.isObject(e)&&(void 0===i&&(i="None"),this.expire_days=void 0===o?this.default_expiry:o,this.load(),en.each(e,(function(e,o){this.props.hasOwnProperty(o)&&this.props[o]!==i||(this.props[o]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,i){return!!en.isObject(e)&&(this.expire_days=void 0===i?this.default_expiry:i,this.load(),en.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(en.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:en.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return en.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,i){var o=this._get_queue_key(e),s=i[e],a=this._get_or_create_queue(Sn),h=this._get_or_create_queue(kn),f=this._get_or_create_queue(wn),g=this._get_or_create_queue(In),_=this._get_or_create_queue(En),v=this._get_or_create_queue(Cn,[]),b=this._get_or_create_queue(xn,[]);o===Rn?(en.extend(a,s),this._pop_from_people_queue(In,s),this._pop_from_people_queue(En,s),this._pop_from_people_queue(wn,s)):o===Mn?(en.each(s,(function(e,i){i in h||(h[i]=e)})),this._pop_from_people_queue(wn,s)):o===Nn?en.each(s,(function(e){en.each([a,h,g,_],(function(i){e in i&&delete i[e]})),en.each(b,(function(i){e in i&&delete i[e]})),f[e]=!0})):o===Pn?(en.each(s,(function(e,i){i in a?a[i]+=e:(i in g||(g[i]=0),g[i]+=e)}),this),this._pop_from_people_queue(wn,s)):o===An?(en.each(s,(function(e,i){en.isArray(e)&&(i in _||(_[i]=[]),_[i]=_[i].concat(e))})),this._pop_from_people_queue(wn,s)):o===Zn?(v.push(s),this._pop_from_people_queue(xn,s)):o===Dn&&(b.push(s),this._pop_from_people_queue(wn,s)),tn.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),tn.log(i),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,i){var o=this.props[this._get_queue_key(e)];en.isUndefined(o)||en.each(i,(function(i,s){e===xn||e===Cn?en.each(o,(function(e){e[s]===i&&delete e[s]})):delete o[s]}),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===Sn?Rn:e===kn?Mn:e===wn?Nn:e===In?Pn:e===xn?Dn:e===Cn?Zn:e===En?An:void tn.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,i){var o=this._get_queue_key(e);return i=en.isUndefined(i)?{}:i,this.props[o]||(this.props[o]=i)},MixpanelPersistence.prototype.set_event_timer=function(e,i){var o=this.load_prop(Fn)||{};o[e]=i,this.props[Fn]=o,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var i=(this.load_prop(Fn)||{})[e];return en.isUndefined(i)||(delete this.props[Fn][e],this.save()),i};var qn,load_extra_bundle=function(e,i){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},Un="mixpanel",Bn="base64",zn="$device:",Vn=vr.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Wn=!Vn&&-1===Kr.indexOf("MSIE")&&-1===Kr.indexOf("Mozilla"),Kn=null;Br.sendBeacon&&(Kn=function(){return Br.sendBeacon.apply(Br,arguments)});var Hn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Gn={api_host:"https://api-js.mixpanel.com",api_routes:Hn,api_method:"POST",api_transport:"XHR",api_payload_format:Bn,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:Dr,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Jn=!1,MixpanelLib=function(){},create_mplib=function(e,i,o){var s,a=o===Un?qn:qn[o];if(a&&0===On)s=a;else{if(a&&!en.isArray(a))return void tn.error("You have already initialized "+o);s=new MixpanelLib}if(s._cached_groups={},s._init(e,i,o),s.people=new MixpanelPeople,s.people._init(s),!s.get_config("skip_first_touch_marketing")){var h=en.info.campaignParams(null),f={},g=!1;en.each(h,(function(e,i){f["initial_"+i]=e,e&&(g=!0)})),g&&s.people.set_once(f)}return kr.DEBUG=kr.DEBUG||s.get_config("debug"),!en.isUndefined(a)&&en.isArray(a)&&(s._execute_array.call(s.people,a.people),s._execute_array(a)),s};MixpanelLib.prototype.init=function(e,i,o){if(en.isUndefined(o))this.report_error("You must name your new library: init(token, config, name)");else{if(o!==Un){var s=create_mplib(e,i,o);return qn[o]=s,s._loaded(),s}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,i,o){i=i||{},this.__loaded=!0,this.config={};var s={};"api_payload_format"in i||(i.api_host||Gn.api_host).match(/\.mixpanel\.com/)&&(s.api_payload_format="json");if(this.set_config(en.extend({},Gn,s,i,{name:o,token:e,callback_fn:(o===Un?o:Un+"."+o)+"._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(en.localStorage.is_supported(!0)&&Vn){if(this.init_batchers(),Kn&&vr.addEventListener){var a=en.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);vr.addEventListener("pagehide",(function(e){e.persisted&&a()})),vr.addEventListener("visibilitychange",(function(){"hidden"===zr.visibilityState&&a()}))}}else this._batch_requests=!1,tn.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),en.each(this.get_batcher_configs(),(function(e){tn.log("Clearing batch queue "+e.queue_key),en.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var h=en.UUID();this.get_distinct_id()||this.register_once({distinct_id:zn+h,$device_id:h},"");var f=this.get_config("track_pageview");f&&this._init_url_change_tracking(f),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(vr.MutationObserver){var e=en.bind((function(){this._recorder=this._recorder||new vr.__mp_recorder(this),this._recorder.startRecording()}),this);en.isUndefined(vr.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else tn.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():tn.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var i=this._recorder.replayId;i&&(e.$mp_replay_id=i)}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=en.info.campaignParams(null);en.each(e,function(e,i){this.unregister(i)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(zr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(en.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(zr.referrer)},MixpanelLib.prototype._dom_loaded=function(){en.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||en.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,i){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Jn)return this.__dom_loaded_queue.push([e,i]),!1;var o=(new e).init(this);return o.track.apply(o,i)},MixpanelLib.prototype._init_url_change_tracking=function(e){var i="";if(this.track_pageview()&&(i=en.info.currentUrl()),en.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){vr.addEventListener("popstate",(function(){vr.dispatchEvent(new Event("mp_locationchange"))})),vr.addEventListener("hashchange",(function(){vr.dispatchEvent(new Event("mp_locationchange"))}));var o=vr.history.pushState;"function"==typeof o&&(vr.history.pushState=function(e,i,s){o.call(vr.history,e,i,s),vr.dispatchEvent(new Event("mp_locationchange"))});var s=vr.history.replaceState;"function"==typeof s&&(vr.history.replaceState=function(e,i,o){s.call(vr.history,e,i,o),vr.dispatchEvent(new Event("mp_locationchange"))}),vr.addEventListener("mp_locationchange",function(){var o=en.info.currentUrl(),s=!1;("full-url"===e?s=o!==i:"url-with-path-and-query-string"===e?s=o.split("#")[0]!==i.split("#")[0]:"url-with-path"===e&&(s=o.split("#")[0].split("?")[0]!==i.split("#")[0].split("?")[0]),s)&&(this.track_pageview()&&(i=o))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,i){if(en.isUndefined(e))return null;if(Vn){return function(o){e(o,i)}}var o=this._jsc,s=""+Math.floor(1e8*Math.random()),a=this.get_config("callback_fn")+"["+s+"]";return o[s]=function(a){delete o[s],e(a,i)},a},MixpanelLib.prototype._send_request=function(e,i,o,s){var a=!0;if(Wn)return this.__request_queue.push(arguments),a;var h={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},f=null;s||!en.isFunction(o)&&"string"!=typeof o||(s=o,o=null),o=en.extend(h,o||{}),Vn||(o.method="GET");var g="POST"===o.method,_=Kn&&g&&"sendbeacon"===o.transport.toLowerCase(),v=o.verbose;i.verbose&&(v=!0),this.get_config("test")&&(i.test=1),v&&(i.verbose=1),this.get_config("img")&&(i.img=1),Vn||(s?i.callback=s:(v||this.get_config("test"))&&(i.callback="(function(){})")),i.ip=this.get_config("ip")?1:0,i._=(new Date).getTime().toString(),g&&(f="data="+encodeURIComponent(i.data),delete i.data),e+="?"+en.HTTPBuildQuery(i);var b=this;if("img"in i){var S=zr.createElement("img");S.src=e,zr.body.appendChild(S)}else if(_){try{a=Kn(e,f)}catch(N){b.report_error(N),a=!1}try{s&&s(a?1:0)}catch(N){b.report_error(N)}}else if(Vn)try{var I=new XMLHttpRequest;I.open(o.method,e,!0);var x=this.get_config("xhr_headers");if(g&&(x["Content-Type"]="application/x-www-form-urlencoded"),en.each(x,(function(e,i){I.setRequestHeader(i,e)})),o.timeout_ms&&void 0!==I.timeout){I.timeout=o.timeout_ms;var T=(new Date).getTime()}I.withCredentials=!0,I.onreadystatechange=function(){var e;if(4===I.readyState)if(200===I.status){if(s)if(v){var i;try{i=en.JSONDecode(I.responseText)}catch(N){if(b.report_error(N),!o.ignore_json_errors)return;i=I.responseText}s(i)}else s(Number(I.responseText))}else if(e=I.timeout&&!I.status&&(new Date).getTime()-T>=I.timeout?"timeout":"Bad HTTP status: "+I.status+" "+I.statusText,b.report_error(e),s)if(v){var a=I.responseHeaders||{};s({status:0,httpStatusCode:I.status,error:e,retryAfter:a["Retry-After"]})}else s(0)},I.send(f)}catch(N){b.report_error(N),a=!1}else{var O=zr.createElement("script");O.type="text/javascript",O.async=!0,O.defer=!0,O.src=e;var R=zr.getElementsByTagName("script")[0];R.parentNode.insertBefore(O,R)}return a},MixpanelLib.prototype._execute_array=function(e){var i,o=[],s=[],a=[];en.each(e,(function(e){e&&(i=e[0],en.isArray(i)?a.push(e):"function"==typeof e?e.call(this):en.isArray(e)&&"alias"===i?o.push(e):en.isArray(e)&&-1!==i.indexOf("track")&&"function"==typeof this[i]?a.push(e):s.push(e))}),this);var execute=function(e,i){en.each(e,(function(e){if(en.isArray(e[0])){var o=i;en.each(e,(function(e){o=o[e[0]].apply(o,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),i)};execute(o,this),execute(s,this),execute(a,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"),i=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+i.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+i.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+i.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=en.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:en.bind((function(i,o,s){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(i),o,this._prepare_callback(s,i))}),this),beforeSendHook:en.bind((function(i){return this._run_hook("before_send_"+e.type,i)}),this),stopAllBatchingFunc:en.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),i=this.get_batcher_configs();this.request_batchers={events:e(i.events),people:e(i.people),groups:e(i.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,en.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,en.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 i=en.JSONEncode(e);return this.get_config("api_payload_format")===Bn&&(i=en.base64Encode(i)),{data:i}},MixpanelLib.prototype._track_or_batch=function(e,i){var o=en.truncate(e.data,255),s=e.endpoint,a=e.batcher,h=e.should_send_immediately,f=e.send_request_options||{};i=i||NOOP_FUNC;var g=!0,_=en.bind((function(){return f.skip_hooks||(o=this._run_hook("before_send_"+e.type,o)),o?(tn.log("MIXPANEL REQUEST:"),tn.log(o),this._send_request(s,this._encode_data_for_request(o),f,this._prepare_callback(i,o))):null}),this);return this._batch_requests&&!h?a.enqueue(o,(function(e){e?i(1,o):_()})):g=_(),g&&o},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,i,o,s){s||"function"!=typeof o||(s=o,o=null);var a=(o=o||{}).transport;a&&(o.transport=a);var h=o.send_immediately;if("function"!=typeof s&&(s=NOOP_FUNC),en.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(i=en.extend({},i)).token=this.get_config("token");var f=this.persistence.remove_event_timer(e);if(!en.isUndefined(f)){var g=(new Date).getTime()-f;i.$duration=parseFloat((g/1e3).toFixed(3))}this._set_default_superprops();var _=this.get_config("track_marketing")?en.info.marketingParams():{};i=en.extend({},en.info.properties({mp_loader:this.get_config("mp_loader")}),_,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),i);var v=this.get_config("property_blacklist");en.isArray(v)?en.each(v,(function(e){delete i[e]})):this.report_error("Invalid value for property_blacklist config: "+v);var b={event:e,properties:i};return this._track_or_batch({type:"events",data:b,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:h,send_request_options:o},s)}s(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,i,o){en.isArray(i)||(i=[i]);var s={};return s[e]=i,this.register(s),this.people.set(e,i,o)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,i,o){var s=this.get_property(e),a={};return void 0===s?(a[e]=[i],this.register(a)):-1===s.indexOf(i)&&(s.push(i),a[e]=s,this.register(a)),this.people.union(e,i,o)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,i,o){var s=this.get_property(e);if(void 0!==s){var a=s.indexOf(i);a>-1&&(s.splice(a,1),this.register({group_key:s})),0===s.length&&this.unregister(e)}return this.people.remove(e,i,o)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,i,o,s){var a=en.extend({},i||{});return en.each(o,(function(e,i){null!=e&&(a[i]=e)})),this.track(e,a,s)})),MixpanelLib.prototype._create_map_key=function(e,i){return e+"_"+JSON.stringify(i)},MixpanelLib.prototype._remove_group_from_cache=function(e,i){delete this._cached_groups[this._create_map_key(e,i)]},MixpanelLib.prototype.get_group=function(e,i){var o=this._create_map_key(e,i),s=this._cached_groups[o];return void 0!==s&&s._group_key===e&&s._group_id===i||((s=new MixpanelGroup)._init(this,e,i),this._cached_groups[o]=s),s},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,i){"object"!=typeof e&&(e={});var o=(i=i||{}).event_name||"$mp_web_page_view",s=en.extend(en.info.mpPageViewProperties(),en.info.campaignParams(),en.info.clickParams()),a=en.extend({},s,e);return this.track(o,a)})),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){en.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 Yn={persistent:!0},options_for_register=function(e){var i;return i=en.isObject(e)?e:en.isUndefined(e)?{}:{days:e},en.extend({},Yn,i)};MixpanelLib.prototype.register=function(e,i){var o=options_for_register(i);o.persistent?this.persistence.register(e,o.days):en.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,i,o){var s=options_for_register(o);s.persistent?this.persistence.register_once(e,i,s.days):(void 0===i&&(i="None"),en.each(e,(function(e,o){this.unpersisted_superprops.hasOwnProperty(o)&&this.unpersisted_superprops[o]!==i||(this.unpersisted_superprops[o]=e)}),this))},MixpanelLib.prototype.unregister=function(e,i){(i=options_for_register(i)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,i){var o={};o[e]=i,this.register(o)},MixpanelLib.prototype.identify=function(e,i,o,s,a,h,f,g){var _=this.get_distinct_id();if(e&&_!==e){if("string"==typeof e&&0===e.indexOf(zn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var v=_;this.register_once({$had_persisted_distinct_id:!0,$device_id:v},"")}e!==_&&e!==this.get_property(jn)&&(this.unregister(jn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(i,o,s,a,h,f,g),e!==_&&this.track("$identify",{distinct_id:e,$anon_distinct_id:_},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=en.UUID();this.register_once({distinct_id:zn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,i){if(e===this.get_property(Ln))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var o=this;return en.isUndefined(i)&&(i=this.get_distinct_id()),e!==i?(this._register_single(jn,e),this.track("$create_alias",{alias:e,distinct_id:i},{skip_hooks:!0},(function(){o.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){en.isObject(e)&&(en.extend(this.config,e),e.batch_size&&en.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),kr.DEBUG=kr.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var i=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,Fr.call(arguments,1));return void 0===i&&(this.report_error(e+" hook did not return a value"),i=null),i},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==Un&&(e=Un+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return en.isBlockedUA(Kr)||this._flags.disable_all_events||en.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&en.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")&&!en.cookie.get("mp_optout")||(en.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 i;if(e&&e.clear_persistence)i=!0;else{if(!e||!e.enable_persistence)return;i=!1}this.get_config("disable_persistence")||this.persistence.disabled===i||this.persistence.set_disabled(i),i?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,i){return i=en.extend({track:en.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")},i),en.localStorage.is_supported()||(i.persistence_type="cookie"),e(this.get_config("token"),{track:i.track,trackEventName:i.track_event_name,trackProperties:i.track_properties,persistenceType:i.persistence_type,persistencePrefix:i.cookie_prefix,cookieDomain:i.cookie_domain,cookieExpiration:i.cookie_expiration,crossSiteCookie:i.cross_site_cookie,crossSubdomainCookie:i.cross_subdomain_cookie,secureCookie:i.secure_cookie,ignoreDnt:i.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=en.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=en.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=en.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,i){tn.error.apply(tn.error,arguments);try{i||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,i)}catch(o){tn.error(o)}},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=Hn,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 Xn={},override_mp_init_func=function(){qn.init=function(e,i,o){if(o)return qn[o]||(qn[o]=Xn[o]=create_mplib(e,i,o),qn[o]._loaded()),qn[o];var s=qn;Xn[Un]?s=Xn[Un]:e&&((s=create_mplib(e,i,Un))._loaded(),Xn[Un]=s),qn=s,1===On&&(vr[Un]=qn),en.each(Xn,(function(e,i){i!==Un&&(qn[i]=e)})),qn._=en}};var Qn=function init_as_module(e){return load_extra_bundle=e,On=0,qn=new MixpanelLib,override_mp_init_func(),qn.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,Jn=!0,Wn=!1,en.each(Xn,(function(e){e._dom_loaded()})))}if(zr.addEventListener)"complete"===zr.readyState?dom_loaded_handler():zr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(zr.attachEvent){zr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===vr.frameElement}catch(i){}zr.documentElement.doScroll&&e&&function do_scroll_check(){try{zr.documentElement.doScroll("left")}catch(i){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}en.register_event(vr,"load",dom_loaded_handler,!0)}(),qn}((function loadNoop(e,i){i()}));const ei="mp_distinct_id";function isReady(){return void 0!==window.mixpanel}function updateCachedDistinctId(e){localStorage.setItem(ei,e)}const ti={init:function init$2(e,i=!1,o){return new Promise((s=>{Qn.init(e,{debug:i,loaded:()=>{window.mixpanel=Qn,s()},...o&&{api_host:o}})}))},isReady:isReady,track:function track(e,i){isReady()&&Qn.track(e,{...i,"Reservamos Version":"1.0.11"})},identify:function identify$1(e,i){Qn.identify(e),updateCachedDistinctId(e),Qn.people.set(i)},attachProperty:function attachProperty(e,i){isReady()&&Qn.people.union(e,[i])},getMixpanelDistinctId:()=>{const e=localStorage.getItem(ei);if(Qn&&Qn.get_distinct_id){const e=Qn.get_distinct_id();return updateCachedDistinctId(e),e}return e||null}},ri=Te.object({firstName:Te.string().optional(),lastName:Te.string().optional(),email:Te.string().email().optional(),phone:Te.string().optional()}),ni=["web","web-mobile","ios","android","app"],ii=Te.enum(ni).refine((e=>ni.includes(e)),{message:`Product must be one of: ${ni.join(", ")}`}),oi=Te.object({product:ii});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=>Te.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>Te.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>Te.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>Te.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,i,o)=>Te.array(e).min(o,`${i} must have at least ${o} items`),si=Te.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:ii});const ai=Te.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(),ci=Te.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":Te.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),di=Te.object({Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const ui=Te.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":Te.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional(),Insurance:(li="Insurance",Te.boolean({required_error:`${li} is required`,invalid_type_error:`${li} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var li;const pi=Te.object({Arrival:Te.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:Te.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination terminal is required"),Line:Te.string().min(1,"Line is required").optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Price:Te.number().positive("Price must be a positive number"),"Result Position":Te.number().int("Result Position must be an integer"),Route:Te.string().min(1,"Route is required"),Stops:Te.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":Te.string().min(1,"Transport Type is required"),Transporter:Te.string().min(1,"Transporter is required"),product:ii,"Recommended Trip":Te.boolean(),"Recommended Trip Type":Te.string().optional(),"Trip Type":Te.string().min(1,"Trip Type is required"),"Bus Type":Te.string().min(1,"Bus Type is required")});const hi=Te.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const fi=Te.object({Departure:Te.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":Te.number().int("Departure Delta must be an integer"),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination terminal is required"),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Passengers:Te.number().int("Passenger count must be an integer"),Return:Te.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:Te.string().min(1,"Route is required"),"Trip Length":Te.number().positive().optional(),Categories:Te.array(Te.string()).optional(),product:ii});const mi=Te.object({Arrival:Te.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:Te.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination Terminal is required"),Line:Te.string().min(1,"Line is required").optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin Terminal is required"),Price:Te.number().positive("Price must be a positive number"),Route:Te.string().min(1,"Route is required"),Stops:Te.number().int("Stops must be an integer").nonnegative().optional(),Tickets:Te.number().int("Tickets must be an integer").positive(),Transporter:Te.string().min(1,"Transporter is required"),Way:Te.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:ii});const gi=Te.object({"Bus count":Te.number().int("Bus count must be an integer"),Departure:Te.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":Te.number().int("Departure Delta must be an integer").optional(),Destination:Te.string().min(1,"Destination is required").optional(),"Destination Terminal":Te.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":Te.boolean().default(!1).optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Route:Te.string().min(1,"Route is required"),product:ii}),_i=Te.object({mixpanelToken:Te.string().min(1,"Mixpanel token is required"),debug:Te.boolean().optional(),identificationKey:Te.string().min(1,"Identification key is required"),isSandbox:Te.boolean().optional(),mixpanelProxyUrl:Te.string().optional(),identifyProxyUrl:Te.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let i="INVALID_FIELD",o="",s="",a="";return"invalid_type"===e.code?(i="TYPE_MISMATCH",o=e.expected,s=e.received,a=`Expected ${o} but received ${s}. Please provide a value of type ${o}.`):"too_small"===e.code?(i="VALUE_TOO_SMALL",a=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(i="VALUE_TOO_BIG",a=`Reduce the value to no more than ${e.maximum}.`):(i="INVALID_FIELD",a="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:i,expected:o,received:s,message:e.message,suggestion:a}})),yi={Search:fi,"Seat Change":mi,"Interest In Home":oi,"Passengers Created":di,"Payment Attempt":ui,"Interest In Search":si,"View Results":gi,"Purchase Attempt":hi,"Picked Departure":pi};function validateProps(e,i){try{i.parse(e)}catch(Or){if(Or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Or)}}throw{message:"Unknown validation error"}}}const vi={parseEventProps:function parseEventProps(e,i){const o=yi[e]||Re;try{o.parse(i)}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,_i)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,ri)},validateProps:validateProps};function isTrackerReady(){return ti.isReady()}let bi=null;const Si="geolocationPermissionTimestamp",ki=6048e5;function updatePermissionTimestamp(e){localStorage.setItem(Si,e.toString())}const wi={init:function init(){return new Promise((e=>{if(function isPermissionTimestampValid(e){return!!e&&Date.now()-parseInt(e,10)<ki}(localStorage.getItem(Si)))return void e(bi);const i="Geolocation Requested",o=Date.now();navigator.geolocation.getCurrentPosition((s=>{const{latitude:a,longitude:h}=s.coords;bi={lat:a,long:h},updatePermissionTimestamp(o),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!0}),e(bi)}),(()=>{updatePermissionTimestamp(o),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!1}),e(null)}))}))},getCoordinates:function getCoordinates(){return bi}},Ii=["Search","View Results"],xi={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(e,i,o){tryTrackEvent((async()=>{try{ti.track("Track Event Error",{"Failed Event Name":e,"Error Message":(null==i?void 0:i.message)??"Failed to track event","Validation Errors":(null==i?void 0:i.errors)||[],"Event Payload":o})}catch(s){console.error("Failed to track error event:",s)}}))}async function tryTrackEvent(e){ti.isReady()?await e():window.addEventListener("Tracker Ready",(async()=>{await e()}))}async function trackEvent(e,i,o={}){if(!ti.isReady())throw new Error("Mixpanel is not initialized.");try{vi.parseEventProps(e,i);const s=!Ii.includes(e);ti.getMixpanelDistinctId();const a=await _t.getFingerprint(s),h={},f=wi.getCoordinates();f&&(h.$latitude=f.lat,h.$longitude=f.long);const g={"User Fingerprint":a},_=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),i={};return Object.entries(xi).forEach((([o,s])=>{const a=e.get(o);a&&(i[s]=a)})),i}catch(Or){return console.error("Error extracting tracking parameters:",Or),{}}}(),v=function flattenEventData(e){return Object.entries(e).reduce(((e,[i,o])=>Array.isArray(o)?Array.isArray(o)&&o.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[i]=o,e):(o.forEach((i=>{"object"==typeof i&&null!==i&&Object.entries(i).forEach((([i,o])=>{e[i]?e[i].push(o):e[i]=[o]}))})),e):(e[i]=o,e)),{})}(i),b={...g,...v,..._,...h,...o};ti.track(e,b)}catch(Or){console.error(`Error tracking event '${e}':`,Or),trackEventError(e,Or,i)}}function trackCustomEvent(e,i={},o={}){try{Me.parse(e),trackEvent(e,i,o)}catch(Or){console.error("Error trackCustomEvent:",Or),trackEventError(e,Or,i)}}const Ei=Te.object({email:Te.string().email().optional(),phone:Te.string().optional(),cpf:Te.string().optional(),passport:Te.string().optional(),rg:Te.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{vi.validateProps(e,Ei);const i=[],o=_t.getCachedFingerprint(),s=ti.getMixpanelDistinctId();o&&i.push({key:"fingerprint",value:o}),s&&i.push({key:"distinct_id",value:s});const a=function getAnonymousProfilePayload(e,i){let o="phone",s=e.phone||"";const a=[];e.email&&(o="email",s=e.email);const h=["cpf","passport","rg","email","phone","salesforceid"];return Object.entries(e).forEach((([e,i])=>{h.includes(e.toLowerCase())&&i&&e!==o&&a.push({key:e,value:i})})),i.length&&i.forEach((e=>a.push(e))),{identifier_key:o,identifier_value:s,details:{},identifiers:a}}(e,i);return await Nt.profiles.createAnonymousProfile(a)}catch(Or){return void console.error("Could not create anonymous profile:",Or)}}const Ci=["firstName","lastName","email","phone"];Te.object({"Operation Id":stringField("Operation Id"),Trips:arrayField(ci,"Trips",1).optional(),"Passenger Count":numberField("Passenger Count").optional(),Total:numberField("Total").optional(),"Trip Count":numberField("Trip Count").optional(),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()});const Ti=Te.object({category:Te.string(),number:Te.string().optional(),occupied:Te.boolean().optional(),adjacent_seats:Te.null().optional()}),Oi=Te.object({bus:Te.array(Te.array(Te.array(Ti)))}),Ri=Te.object({bus_type:Te.string(),selected_seats:Te.string(),bus_scheme:Oi});const Mi=Te.object({category:Te.string(),number:Te.string().optional(),occupied:Te.boolean().optional(),adjacent_seats:Te.null().optional()}),Ni=Te.object({bus:Te.array(Te.array(Te.array(Mi)))}),Pi=Te.object({bus_scheme:Ni,total_seats:Te.number()});const Di=Te.object({searchId:Te.number().min(1,"SearchId is required")});const Zi={init:async function init$1(e){vi.parseInitProps(e);const{mixpanelToken:i,debug:o=!1,identificationKey:s,isSandbox:a=!1,mixpanelProxyUrl:h,identifyProxyUrl:f}=e;wi.init(),await ti.init(i,o,h);try{await _t.initFingerprint(s,f)}catch(Or){console.error("Error initializing identification service:",Or)}At.setEnvironment(a?"sandbox":"prod"),Nt.setConfig(At.getCoreAPIConfig()),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(e,i={}){tryTrackEvent((async()=>{try{if(vi.parseIdentifyProps(i),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const o=await createAnonymousProfile(i);o&&(i.reservamos_one_id=o.id);const s=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(((i,o)=>(Ci.includes(o)||(i[o]=e[o]),i)),{})}}(i);ti.identify(e,s);const a=await _t.getFingerprint();a&&ti.attachProperty("Known Fingerprints",a)}catch(Or){console.error("Error identifying user",Or),trackEventError("Identify",Or,{userId:e,properties:i})}finally{(async(e,i)=>{var o,s;try{const a=wi.getCoordinates();if(!a)return;i.first_name=i.firstName,i.last_name=i.lastName,i.latitude=a.lat,i.longitude=a.long,i.ip="0",i.name=`${i.firstName} ${i.lastName}`,delete i.firstName,delete i.lastName;const h=At.getCoreAPIConfig();fetch(`${h.baseUrl}/v1/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==(o=h.defaultHeaders)?void 0:o.Authorization)||"",Origin:(null==(s=h.defaultHeaders)?void 0:s.Origin)||""},body:JSON.stringify({profile_params:{...i,distinct_id:e}})})}catch(Or){console.error("Error identifying user-service",Or)}})(e,i)}}))},identifiers:{getFingerprintId:_t.getCachedFingerprint,getDistinctId:ti.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},recommendations:{getRecommendedPlaces:async function getRecommendedPlaces(){const e=ti.getMixpanelDistinctId();if(!e)throw new Error("No distinct ID found");const i=await Nt.recommendations.createRecommendedPlaces({distinct_id:e});if(!i)throw new Error("No response received");return await(async e=>new Promise(((i,o)=>{const{state:s,polling_id:a}=e;"finished"!==s?Nt.recommendations.pollRecommendedPlaces(a,{start:!0,watch:"state",expect:"finished",onEachResponse:e=>{"finished"!==e.status?"failed"!==e.status||o(e):i(e)}}):i(e)})))(i)},createRecommendedSeats:async function createRecommendedSeats$1(e){try{vi.validateProps(e,Ri);const i=ti.getMixpanelDistinctId(),o=_t.getCachedFingerprint();if(!i)throw new Error("No distinct ID found");return await Nt.recommendations.createRecommendedSeats({...e,distinct_id:i,device_fingerprint:o||""})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedSeats:async function createRecommendedSeats(e){try{vi.validateProps(e,Pi);const i=ti.getMixpanelDistinctId();if(!i)throw new Error("No distinct ID found");return await Nt.recommendations.getRecommendedSeats({...e,distinct_id:i})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedTrips:async function getRecommendedTrips({searchId:e}){try{vi.validateProps({searchId:e},Di);const i=_t.getCachedFingerprint()||ti.getMixpanelDistinctId();if(!i)throw new Error("No identifier id");return await Nt.recommendations.getRecommendedTrips({searchId:e,userIdentifier:String(i)})}catch(Or){throw console.error("Could not get recommended trips:",Or),new Error(Or instanceof Error?Or.message:String(Or))}}},track:{search:function trackSearch(e,i={}){trackEvent("Search",e,i)},seatChange:function trackSeatChange(e,i={}){trackEvent("Seat Change",e,i)},interestInHome:function trackInterestInHome(e,i={}){trackEvent("Interest In Home",e,i)},interestInSearch:function trackInterestInSearch(e,i={}){trackEvent("Interest In Search",e,i)},viewResults:function trackViewResults(e,i={}){trackEvent("View Results",e,i)},passengersCreated:function trackPassengersCreated(e,i={}){trackEvent("Passengers Created",e,i)},paymentAttempt:async(e,i={})=>{trackEvent("Payment Attempt",e,i)},purchaseAttempt:function trackPurchaseAttempt(e,i={}){trackEvent("Purchase Attempt",e,i)},pickedDeparture:function trackSearch$1(e,i={}){trackEvent("Picked Departure",e,i)},customEvent:trackCustomEvent,purchaseCanceled:function trackPurchaseCanceled(e,i={}){trackEvent("Purchase Canceled",e,i)}}};module.exports=Zi;
31
31
  //# sourceMappingURL=browser-analytics.cjs.map