@reservamos/browser-analytics 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/LICENSE.md +9 -0
- package/README.md +51 -0
- package/dist/browser-analytics.cjs +30 -0
- package/dist/browser-analytics.d.ts +40 -0
- package/dist/browser-analytics.esm.js +9150 -0
- package/dist/browser-analytics.iife.js +30 -0
- package/package.json +91 -0
- package/src/events/trackTest.ts +10 -0
- package/src/fingerprint.ts +131 -0
- package/src/index.ts +12 -0
- package/src/init.ts +68 -0
- package/src/mixpanel.ts +36 -0
- package/src/track.ts +43 -0
- package/src/utils/validateConfig.ts +16 -0
- package/src/vite-env.d.ts +1 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var browserAnalytics=function(e){"use strict";var t,n;function isShadowRoot(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function isNativeShadowDom(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function stringifyStylesheet(e){try{const t=e.rules||e.cssRules;return t?function fixBrowserCompatibilityIssuesInCSS(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}(Array.from(t,stringifyRule).join("")):null}catch(ee){return null}}function stringifyRule(e){let t;if(function isCSSImportRule(e){return"styleSheet"in e}(e))try{t=stringifyStylesheet(e.styleSheet)||function escapeImportStatement(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(ee){}else if(function isCSSStyleRule(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function fixSafariColons(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}(n=t||(t={}))[n.Document=0]="Document",n[n.DocumentType=1]="DocumentType",n[n.Element=2]="Element",n[n.Text=3]="Text",n[n.CDATA=4]="CDATA",n[n.Comment=5]="Comment";class Mirror{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:e,maskInputOptions:t,tagName:n,type:i,value:s,maskInputFn:a}){let c=s||"";const l=i&&toLowerCase(i);return(t[n.toLowerCase()]||l&&t[l])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const i="__rrweb_original__";function getInputType(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?toLowerCase(t):null}function extractFileExtension(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(a){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==s?void 0:s[1])&&void 0!==n?n:null}let s=1;const a=new RegExp("[^a-z0-9-_:]"),c=-2;function genId(){return s++}let l,u;const p=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,d=/^(?:[a-z+]+:)?\/\//i,h=/^www\..*/i,f=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(p,((e,n,i,s,a,c)=>{const l=i||a||c,u=n||s||"";if(!l)return e;if(d.test(l)||h.test(l))return`url(${u}${l}${u})`;if(f.test(l))return`url(${u}${l}${u})`;if("/"===l[0])return`url(${u}${function extractOrigin(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+l}${u})`;const p=t.split("/"),_=l.split("/");p.pop();for(const t of _)"."!==t&&(".."===t?p.pop():p.push(t));return`url(${u}${p.join("/")}${u})`}))}const _=/^[^ \t\n\r\u000c]+/,m=/^[, \t\n\r\u000c]+/;function absoluteToDoc(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function getHref(){const e=document.createElement("a");return e.href="",e.href}function transformAttribute(e,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?absoluteToDoc(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function getAbsoluteSrcsetString(e,t){if(""===t.trim())return t;let n=0;function collectCharacters(e){let i;const s=e.exec(t.substring(n));return s?(i=s[0],n+=i.length,i):""}const i=[];for(;collectCharacters(m),!(n>=t.length);){let s=collectCharacters(_);if(","===s.slice(-1))s=absoluteToDoc(e,s.substring(0,s.length-1)),i.push(s);else{let a="";s=absoluteToDoc(e,s);let c=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((s+a).trim());break}if(c)")"===e&&(c=!1);else{if(","===e){n+=1,i.push((s+a).trim());break}"("===e&&(c=!0)}a+=e,n+=1}}}return i.join(", ")}(e,i):"style"===n?absoluteToStylesheet(i,getHref()):"object"===t&&"data"===n?absoluteToDoc(e,i):i:absoluteToDoc(e,i):i}function ignoreAttribute(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function classMatchesRegex(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&classMatchesRegex(e.parentNode,t,n);for(let i=e.classList.length;i--;){const n=e.classList[i];if(t.test(n))return!0}return!!n&&classMatchesRegex(e.parentNode,t,n)}function needMaskingText(e,t,n,i){try{const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===s)return!1;if("string"==typeof t){if(i){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(classMatchesRegex(s,t,i))return!0;if(n)if(i){if(s.closest(n))return!0}else if(s.matches(n))return!0}catch(s){}return!1}function serializeNode(e,n){const{doc:s,mirror:c,blockClass:p,blockSelector:d,needsMask:h,inlineStylesheet:f,maskInputOptions:_={},maskTextFn:m,maskInputFn:g,dataURLOptions:y={},inlineImages:v,recordCanvas:b,keepIframeSrcFn:S,newlyAddedElement:w=!1}=n,I=function getRootId(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(s,c);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:t.Document,childNodes:[],compatMode:e.compatMode}:{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:I};case e.ELEMENT_NODE:return function serializeElementNode(e,n){const{doc:s,blockClass:c,blockSelector:p,inlineStylesheet:d,maskInputOptions:h={},maskInputFn:f,dataURLOptions:_={},inlineImages:m,recordCanvas:g,keepIframeSrcFn:y,newlyAddedElement:v=!1,rootId:b}=n,S=function _isBlockedElement(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(i){}return!1}(e,c,p),w=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const t=toLowerCase(e.tagName);return a.test(t)?"div":t}(e);let I={};const O=e.attributes.length;for(let t=0;t<O;t++){const n=e.attributes[t];ignoreAttribute(w,n.name,n.value)||(I[n.name]=transformAttribute(s,w,toLowerCase(n.name),n.value))}if("link"===w&&d){const t=Array.from(s.styleSheets).find((t=>t.href===e.href));let n=null;t&&(n=stringifyStylesheet(t)),n&&(delete I.rel,delete I.href,I._cssText=absoluteToStylesheet(n,t.href))}if("style"===w&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=stringifyStylesheet(e.sheet);t&&(I._cssText=absoluteToStylesheet(t,getHref()))}if("input"===w||"textarea"===w||"select"===w){const t=e.value,n=e.checked;"radio"!==I.type&&"checkbox"!==I.type&&"submit"!==I.type&&"button"!==I.type&&t?I.value=maskInputValue({element:e,type:getInputType(e),tagName:w,value:t,maskInputOptions:h,maskInputFn:f}):n&&(I.checked=n)}"option"===w&&(e.selected&&!h.select?I.selected=!0:delete I.selected);if("canvas"===w&&g)if("2d"===e.__context)(function is2DCanvasBlank(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let s=0;s<e.height;s+=50){const a=t.getImageData,c=i in a?a[i]:a;if(new Uint32Array(c.call(t,n,s,Math.min(50,e.width-n),Math.min(50,e.height-s)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(I.rr_dataURL=e.toDataURL(_.type,_.quality));else if(!("__context"in e)){const t=e.toDataURL(_.type,_.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(_.type,_.quality)&&(I.rr_dataURL=t)}if("img"===w&&m){l||(l=s.createElement("canvas"),u=l.getContext("2d"));const t=e,n=t.crossOrigin;t.crossOrigin="anonymous";const recordInlineImage=()=>{t.removeEventListener("load",recordInlineImage);try{l.width=t.naturalWidth,l.height=t.naturalHeight,u.drawImage(t,0,0),I.rr_dataURL=l.toDataURL(_.type,_.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}n?I.crossOrigin=n:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?recordInlineImage():t.addEventListener("load",recordInlineImage)}if("audio"===w||"video"===w){const t=I;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}v||(e.scrollLeft&&(I.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(I.rr_scrollTop=e.scrollTop));if(S){const{width:t,height:n}=e.getBoundingClientRect();I={class:I.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==w||y(I.src)||(e.contentDocument||(I.rr_src=I.src),delete I.src);let C;try{customElements.get(w)&&(C=!0)}catch(R){}return{type:t.Element,tagName:w,attributes:I,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:S,rootId:b,isCustom:C}}(e,{doc:s,blockClass:p,blockSelector:d,inlineStylesheet:f,maskInputOptions:_,maskInputFn:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,keepIframeSrcFn:S,newlyAddedElement:w,rootId:I});case e.TEXT_NODE:return function serializeTextNode(e,n){var i;const{needsMask:s,maskTextFn:a,rootId:c}=n,l=e.parentNode&&e.parentNode.tagName;let u=e.textContent;const p="STYLE"===l||void 0,d="SCRIPT"===l||void 0;if(p&&u){try{e.nextSibling||e.previousSibling||(null===(i=e.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(u=stringifyStylesheet(e.parentNode.sheet))}catch(h){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${h}`,e)}u=absoluteToStylesheet(u,getHref())}d&&(u="SCRIPT_PLACEHOLDER");!p&&!d&&u&&s&&(u=a?a(u,e.parentElement):u.replace(/[\S]/g,"*"));return{type:t.Text,textContent:u||"",isStyle:p,rootId:c}}(e,{needsMask:h,maskTextFn:m,rootId:I});case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:"",rootId:I};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||"",rootId:I};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,n){const{doc:i,mirror:s,blockClass:a,blockSelector:l,maskTextClass:u,maskTextSelector:p,skipChild:d=!1,inlineStylesheet:h=!0,maskInputOptions:f={},maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y={},inlineImages:v=!1,recordCanvas:b=!1,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I=5e3,onStylesheetLoad:O,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:R=()=>!1,newlyAddedElement:x=!1}=n;let{needsMask:T}=n,{preserveWhiteSpace:N=!0}=n;if(!T&&e.childNodes){T=needMaskingText(e,u,p,void 0===T)}const D=serializeNode(e,{doc:i,mirror:s,blockClass:a,blockSelector:l,needsMask:T,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,dataURLOptions:y,inlineImages:v,recordCanvas:b,keepIframeSrcFn:R,newlyAddedElement:x});if(!D)return console.warn(e,"not serialized"),null;let A;A=s.hasNode(e)?s.getId(e):!function slimDOMExcluded(e,n){if(n.comment&&e.type===t.Comment)return!0;if(e.type===t.Element){if(n.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===extractFileExtension(e.attributes.href)))return!0;if(n.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(lowerIfExists(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(e.attributes.name)||"icon"===lowerIfExists(e.attributes.rel)||"apple-touch-icon"===lowerIfExists(e.attributes.rel)||"shortcut icon"===lowerIfExists(e.attributes.rel))))return!0;if("meta"===e.tagName){if(n.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===lowerIfExists(e.attributes.name)||"generator"===lowerIfExists(e.attributes.name)||"framework"===lowerIfExists(e.attributes.name)||"publisher"===lowerIfExists(e.attributes.name)||"progid"===lowerIfExists(e.attributes.name)||lowerIfExists(e.attributes.property).match(/^article:/)||lowerIfExists(e.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===lowerIfExists(e.attributes.name)||"yandex-verification"===lowerIfExists(e.attributes.name)||"csrf-token"===lowerIfExists(e.attributes.name)||"p:domain_verify"===lowerIfExists(e.attributes.name)||"verify-v1"===lowerIfExists(e.attributes.name)||"verification"===lowerIfExists(e.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(e.attributes.name)))return!0}}return!1}(D,g)&&(N||D.type!==t.Text||D.isStyle||D.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():c;const L=Object.assign(D,{id:A});if(s.add(e,L),A===c)return null;S&&S(e);let P=!d;if(L.type===t.Element){P=P&&!L.needBlock,delete L.needBlock;const t=e.shadowRoot;t&&isNativeShadowDom(t)&&(L.isShadowHost=!0)}if((L.type===t.Document||L.type===t.Element)&&P){g.headWhitespace&&L.type===t.Element&&"head"===L.tagName&&(N=!1);const n={doc:i,mirror:s,blockClass:a,blockSelector:l,needsMask:T,maskTextClass:u,maskTextSelector:p,skipChild:d,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:O,stylesheetLoadTimeout:C,keepIframeSrcFn:R};if(L.type===t.Element&&"textarea"===L.tagName&&void 0!==L.attributes.value);else for(const t of Array.from(e.childNodes)){const e=serializeNodeWithId(t,n);e&&L.childNodes.push(e)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const t of Array.from(e.shadowRoot.childNodes)){const i=serializeNodeWithId(t,n);i&&(isNativeShadowDom(e.shadowRoot)&&(i.isShadow=!0),L.childNodes.push(i))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(L.isShadow=!0),L.type===t.Element&&"iframe"===L.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(ee){return}if("complete"!==s){const i=setTimeout((()=>{a||(t(),a=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),a=!0,t()}))}const c="about:blank";if(i.location.href!==c||e.src===c||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&w){const n=serializeNodeWithId(t,{doc:t,mirror:s,blockClass:a,blockSelector:l,needsMask:T,maskTextClass:u,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:O,stylesheetLoadTimeout:C,keepIframeSrcFn:R});n&&w(e,n)}}),I),L.type===t.Element&&"link"===L.tagName&&"string"==typeof L.attributes.rel&&("stylesheet"===L.attributes.rel||"preload"===L.attributes.rel&&"string"==typeof L.attributes.href&&"css"===extractFileExtension(L.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(ee){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(e,(()=>{if(O){const t=serializeNodeWithId(e,{doc:i,mirror:s,blockClass:a,blockSelector:l,needsMask:T,maskTextClass:u,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:O,stylesheetLoadTimeout:C,keepIframeSrcFn:R});t&&O(e,t)}}),C),L}function on(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const g="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let y={map:{},getId:()=>(console.error(g),-1),getNode:()=>(console.error(g),null),removeNodeFromMap(){console.error(g)},has:()=>(console.error(g),!1),reset(){console.error(g)}};function throttle(e,t,n={}){let i=null,s=0;return function(...a){const c=Date.now();s||!1!==n.leading||(s=c);const l=t-(c-s),u=this;l<=0||l>t?(i&&(clearTimeout(i),i=null),s=c,e.apply(u,a)):i||!1===n.trailing||(i=setTimeout((()=>{s=!1===n.leading?0:Date.now(),i=null,e.apply(u,a)}),l))}}function hookSetter(e,t,n,i,s=window){const a=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,t,a||{},!0)}function patch(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],s=n(i);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=s,()=>{e[t]=i}}catch(i){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(y=new Proxy(y,{get:(e,t,n)=>("map"===t&&console.error(g),Reflect.get(e,t,n))}));let v=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const l=e.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==l?void 0:l.documentElement.scrollLeft)||(null===(n=null===(t=null==l?void 0:l.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==l?void 0:l.body)||void 0===i?void 0:i.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==l?void 0:l.documentElement.scrollTop)||(null===(a=null===(s=null==l?void 0:l.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==l?void 0:l.body)||void 0===c?void 0:c.scrollTop)||0}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function isBlocked(e,t,n,i){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(classMatchesRegex(s,t,i))return!0}catch(a){}if(n){if(s.matches(n))return!0;if(i&&null!==s.closest(n))return!0}return!1}function isIgnored(e,t){return t.getId(e)===c}function isAncestorRemoved(e,t){if(isShadowRoot(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||isAncestorRemoved(e.parentNode,t))}function legacy_isTouchEvent(e){return Boolean(e.changedTouches)}function isSerializedIframe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function isSerializedStylesheet(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function hasShadowRoot(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(v=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function getShadowHost(e){var t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function shadowHostInDom(e){const t=e.ownerDocument;if(!t)return!1;const n=function getRootShadowHost(e){let t,n=e;for(;t=getShadowHost(n);)n=t;return n}(e);return t.contains(n)}function inDom(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||shadowHostInDom(e))}var b=(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))(b||{}),S=(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))(S||{}),w=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(w||{}),I=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(I||{}),O=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(O||{});function isNodeInLinkedList(e){return"__ln"in e}class DoubleLinkedList{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&isNodeInLinkedList(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&isNodeInLinkedList(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const moveKey=(e,t)=>`${e}@${t}`;class MutationBuffer{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new DoubleLinkedList,getNextId=e=>{let t=e,n=c;for(;n===c;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},pushAdd=i=>{if(!i.parentNode||!inDom(i)||"TEXTAREA"===i.parentNode.tagName)return;const s=isShadowRoot(i.parentNode)?this.mirror.getId(getShadowHost(i)):this.mirror.getId(i.parentNode),a=getNextId(i);if(-1===s||-1===a)return n.addNode(i);const c=serializeNodeWithId(i,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{isSerializedIframe(e,this.mirror)&&this.iframeManager.addIframe(e),isSerializedStylesheet(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),hasShadowRoot(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)isParentRemoved(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||pushAdd(a);for(const a of this.addedSet)isAncestorInSet(this.droppedSet,a)||isParentRemoved(this.removes,a,this.mirror)?isAncestorInSet(this.movedSet,a)?pushAdd(a):this.droppedSet.add(a):pushAdd(a);let i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=getNextId(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===getNextId(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),pushAdd(e.value)}const s={texts:this.texts.map((e=>{const t=e.node;return t.parentNode&&"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(s.texts.length||s.attributes.length||s.removes.length||s.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(s))},this.genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!isIgnored(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;isBlocked(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:needMaskingText(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,closestElementOfNode(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let i=e.attributeName,s=e.target.getAttribute(i);if("value"===i){const e=getInputType(n);s=maskInputValue({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:s,maskInputFn:this.maskInputFn})}if(isBlocked(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let a=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===i&&!this.keepIframeSrcFn(s)){if(n.contentDocument)return;i="rr_src"}if(a||(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(e.target,a)),"type"===i&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!ignoreAttribute(n.tagName,i)&&(a.attributes[i]=transformAttribute(this.doc,toLowerCase(n.tagName),toLowerCase(i),s),"style"===i)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),s=n.style.getPropertyPriority(e);t!==i.style.getPropertyValue(e)||s!==i.style.getPropertyPriority(e)?a.styleDiff[e]=""===s?t:[t,s]:a._unchangedStyles[e]=[t,s]}for(const e of Array.from(i.style))""===n.style.getPropertyValue(e)&&(a.styleDiff[e]=!1)}break}case"childList":if(isBlocked(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),i=isShadowRoot(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);isBlocked(e.target,this.blockClass,this.blockSelector,!1)||isIgnored(t,this.mirror)||!function isSerialized(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(deepDelete(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||isAncestorRemoved(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[moveKey(n,i)]?deepDelete(this.movedSet,t):this.removes.push({parentId:i,id:n,isShadow:!(!isShadowRoot(e.target)||!isNativeShadowDom(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(isIgnored(e,this.mirror))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[moveKey(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);isBlocked(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),hasShadowRoot(e)&&e.shadowRoot.childNodes.forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function deepDelete(e,t){e.delete(t),t.childNodes.forEach((t=>deepDelete(e,t)))}function isParentRemoved(e,t,n){return 0!==e.length&&_isParentRemoved(e,t,n)}function _isParentRemoved(e,t,n){const{parentNode:i}=t;if(!i)return!1;const s=n.getId(i);return!!e.some((e=>e.id===s))||_isParentRemoved(e,i,n)}function isAncestorInSet(e,t){return 0!==e.size&&_isAncestorInSet(e,t)}function _isAncestorInSet(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||_isAncestorInSet(e,n))}let C;const callbackWrapper=e=>{if(!C)return e;return(...t)=>{try{return e(...t)}catch(ee){if(C&&!0===C(ee))return;throw ee}}},R=[];function getEventTarget(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function initMutationObserver(e,t){var n,i;const s=new MutationBuffer;R.push(s),s.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const c=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");c&&window[c]&&(a=window[c]);const l=new a(callbackWrapper(s.processMutations.bind(s)));return l.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}function initMouseInteractionObserver({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const c=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,l=[];let u=null;return Object.keys(w).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const p=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let l=null,p=t;if("pointerType"in a){switch(a.pointerType){case"mouse":l=I.Mouse;break;case"touch":l=I.Touch;break;case"pen":l=I.Pen}l===I.Touch?w[t]===w.MouseDown?p="TouchStart":w[t]===w.MouseUp&&(p="TouchEnd"):I.Pen}else legacy_isTouchEvent(a)&&(l=I.Touch);null!==l?(u=l,(p.startsWith("Touch")&&l===I.Touch||p.startsWith("Mouse")&&l===I.Mouse)&&(l=null)):w[t]===w.Click&&(l=u,u=null);const d=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!d)return;const h=n.getId(c),{clientX:f,clientY:_}=d;callbackWrapper(e)(Object.assign({type:w[p],id:h,x:f,y:_},null!==l&&{pointerType:l}))})(a);if(window.PointerEvent)switch(w[a]){case w.MouseDown:case w.MouseUp:c=c.replace("mouse","pointer");break;case w.TouchStart:case w.TouchEnd:return}l.push(on(c,p,t))})),callbackWrapper((()=>{l.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const c=getEventTarget(a);if(!c||isBlocked(c,i,s,!0))return;const l=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:l,x:n.left,y:n.top})}else e({id:l,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const x=["INPUT","TEXTAREA","SELECT"],T=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,t){if(hasNestedCSSRule("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function getIdAndStyleId(e,t,n){let i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:i}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:t},n){var i,s,a;let c=null;c="#document"===n.nodeName?e.getId(n):e.getId(n.host);const l="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(a=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,u=(null==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&l&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==c&&-1!==c)try{t.adoptStyleSheets(e,c)}catch(s){}return i}}),callbackWrapper((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function initObservers(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function mergeHooks(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:c,inputCb:l,mediaInteractionCb:u,styleSheetRuleCb:p,styleDeclarationCb:d,canvasMutationCb:h,fontCb:f,selectionCb:_,customElementCb:m}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),c(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),l(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),p(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),h(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),_(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),m(...e)}}(e,t),e.recordDOM&&(i=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let c,l=[];const u=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(l.map((e=>(e.timeOffset-=n,e))),t),l=[],c=null})),a),p=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=v()),l.push({x:n,y:s,id:i.getId(t),timeOffset:v()-c}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?S.Drag:e instanceof MouseEvent?S.MouseMove:S.TouchMove)})),s,{trailing:!1})),d=[on("mousemove",p,n),on("touchmove",p,n),on("drag",p,n)];return callbackWrapper((()=>{d.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),l=function initViewportResizeObserver({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const t=getWindowHeight(),s=getWindowWidth();n===t&&i===s||(e({width:Number(s),height:Number(t)}),n=t,i=s)})),200)),t)}(e,{win:n}),u=function initInputObserver({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,ignoreClass:a,ignoreSelector:c,maskInputOptions:l,maskInputFn:u,sampling:p,userTriggeredOnInput:d}){function eventHandler(e){let n=getEventTarget(e);const p=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||x.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,_=!1;const m=getInputType(n)||"";"radio"===m||"checkbox"===m?_=n.checked:(l[h.toLowerCase()]||l[m])&&(f=maskInputValue({element:n,maskInputOptions:l,tagName:h,type:m,value:f,maskInputFn:u})),cbWithDedup(n,d?{text:f,isChecked:_,userTriggered:p}:{text:f,isChecked:_});const g=n.name;"radio"===m&&g&&_&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,d?{text:t,isChecked:!_,userTriggered:!1}:{text:t,isChecked:!_})}}))}function cbWithDedup(t,i){const s=T.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){T.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===p.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const _=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),m=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return _&&_.set&&h.push(...m.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),p=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:s,doc:a}){const c=callbackWrapper((a=>throttle(callbackWrapper((s=>{const c=getEventTarget(s);if(!c||isBlocked(c,t,n,!0))return;const{currentTime:l,volume:u,muted:p,playbackRate:d,loop:h}=c;e({type:a,id:i.getId(c),currentTime:l,volume:u,muted:p,playbackRate:d,loop:h})})),s.media||500))),l=[on("play",c(0),a),on("pause",c(1),a),on("seeked",c(2),a),on("volumechange",c(3),a),on("ratechange",c(4),a)];return callbackWrapper((()=>{l.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((i,s,a)=>{const[c,l]=a,{id:u,styleId:p}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||p&&-1!==p)&&e({id:u,styleId:p,adds:[{rule:c,index:l}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,l;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:l,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,removes:[{index:c}]}),i.apply(s,a)}))}),i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:l,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(l=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:l,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,replaceSync:c}),i.apply(s,a)}))}));const u={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));const p={};return Object.entries(u).forEach((([i,s])=>{p[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(p[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,l]=a,{id:u,styleId:p}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||p&&-1!==p)&&e({id:u,styleId:p,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),l||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(p[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:l,styleId:u}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,removes:[{index:[...getNestedCSSRulePositions(s),c]}]}),i.apply(s,a)}))})})),callbackWrapper((()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=a,c&&(i.CSSStyleSheet.prototype.replace=c),l&&(i.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=p[e].insertRule,t.prototype.deleteRule=p[e].deleteRule}))}))}(e,{win:n}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,c,l)=>{var u;const[p,d,h]=l;if(n.has(p))return a.apply(c,[p,d,h]);const{id:f,styleId:_}=getIdAndStyleId(null===(u=c.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||_&&-1!==_)&&e({id:f,styleId:_,set:{property:p,value:d,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,l)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,l)=>{var u;const[p]=l;if(n.has(p))return c.apply(a,[p]);const{id:d,styleId:h}=getIdAndStyleId(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(d&&-1!==d||h&&-1!==h)&&e({id:d,styleId:h,remove:{property:p},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,l)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function FontFace(e,t,n){const i=new a(e,t,n);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const c=patch(t.fonts,"add",(function(t){return function(n){return setTimeout(callbackWrapper((()=>{const t=s.get(n);t&&(e(t),s.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=a})),i.push(c),callbackWrapper((()=>{i.forEach((e=>e()))}))}(e)));const d=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const l=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const l=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:u,endContainer:p,endOffset:d}=a;isBlocked(c,i,s,!0)||isBlocked(p,i,s,!0)||l.push({start:n.getId(c),startOffset:u,end:n.getId(p),endOffset:d})}a({ranges:l})}));return l(),on("selectionchange",l)}(e),h=function initCustomElementObserver({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?patch(n.customElements,"define",(function(e){return function(n,i,s){try{t({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,s])}})):()=>{}}(e),f=[];for(const _ of e.plugins)f.push(_.observer(_.callback,n,_.options));return callbackWrapper((()=>{R.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),l(),u(),p(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),d(),h(),f.forEach((e=>e()))}))}function hasNestedCSSRule(e){return void 0!==window[e]}function canMonkeyPatchNestedCSSRule(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class CrossOriginIframeMirror{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,n,i){const s=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let c=s.get(t);return c||(c=this.generateIdFn(),s.set(t,c),a.set(c,t)),c}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class IframeManager{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case b.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:b.IncrementalSnapshot,data:{source:S.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case b.Meta:case b.Load:case b.DomContentLoaded:return!1;case b.Plugin:return t;case b.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case b.IncrementalSnapshot:switch(t.data.source){case S.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case S.Drag:case S.TouchMove:case S.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case S.ViewportResize:return!1;case S.MediaInteraction:case S.MouseInteraction:case S.Scroll:case S.CanvasMutation:case S.Input:return this.replaceIds(t.data,e,["id"]),t;case S.StyleSheetRule:case S.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case S.Font:return t;case S.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case S.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(n,t[s]):t[s]=e.getId(n,t[s]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,n){e.type===t.Document||e.rootId||(e.rootId=n),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,n)}))}}class ShadowDomManager{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!isNativeShadowDom(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(initAdoptedStyleSheetObserver({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(patch(e.prototype,"attachShadow",(function(e){return function(i){const s=e.call(this,i);return this.shadowRoot&&inDom(this)&&n.addShadowRoot(this.shadowRoot,t),s}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function __awaiter$1(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",D="undefined"==typeof Uint8Array?[]:new Uint8Array(256),A=0;A<64;A++)D[N.charCodeAt(A)]=A;const L=new Map;const saveWebGLVar=(e,t,n)=>{if(!e||!isInstanceOfWebGLObject(e,t)&&"object"!=typeof e)return;const i=function variableListFor(e,t){let n=L.get(e);return n||(n=new Map,L.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let s=i.indexOf(e);return-1===s&&(s=i.length,i.push(e)),s};function serializeArg(e,t,n){if(e instanceof Array)return e.map((e=>serializeArg(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){return{rr_type:e.constructor.name,base64:function(e){var t,n=new Uint8Array(e),i=n.length,s="";for(t=0;t<i;t+=3)s+=N[n[t]>>2],s+=N[(3&n[t])<<4|n[t+1]>>4],s+=N[(15&n[t+1])<<2|n[t+2]>>6],s+=N[63&n[t+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[serializeArg(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[serializeArg(e.data,t,n),e.width,e.height]}}if(isInstanceOfWebGLObject(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:saveWebGLVar(e,t,n)}}return e}const serializeArgs=(e,t,n)=>e.map((e=>serializeArg(e,t,n))),isInstanceOfWebGLObject=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function initCanvasContextObserver(e,t,n,i){const s=[];try{const a=patch(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(s,...a){if(!isBlocked(this,t,n,!0)){const e=function getNormalizedContextName(e){return"experimental-webgl"===e?"webgl":e}(s);if("__context"in this||(this.__context=e),i&&["webgl","webgl2"].includes(e))if(a[0]&&"object"==typeof a[0]){const e=a[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[s,...a])}}));s.push(a)}catch(a){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((e=>e()))}}function patchGLPrototype(e,t,n,i,s,a,c){const l=[],u=Object.getOwnPropertyNames(e);for(const d of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if("function"!=typeof e[d])continue;const a=patch(e,d,(function(e){return function(...a){const l=e.apply(this,a);if(saveWebGLVar(l,c,this),"tagName"in this.canvas&&!isBlocked(this.canvas,i,s,!0)){const e=serializeArgs(a,c,this),i={type:t,property:d,args:e};n(this.canvas,i)}return l}}));l.push(a)}catch(p){const i=hookSetter(e,d,{set(e){n(this.canvas,{type:t,property:d,args:[e],setter:!0})}});l.push(i)}return l}var P=function createInlineWorkerFactory(e,t){var n;return function WorkerFactory2(t){return n=n||function createURL(e,t){var n=function funcToSource(e){var t=e.toString().split("\n");t.pop(),t.shift();for(var n=t[0].search(/\S/),i=/(['"])__worker_loader_strict__(['"])/g,s=0,a=t.length;s<a;++s)t[s]=t[s].substring(n).replace(i,"$1use strict$2")+"\n";return t}(e),i=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(i)}(e),new Worker(n,t)}}((function(){!function(){
|
|
16
|
+
/*! *****************************************************************************
|
|
17
|
+
Copyright (c) Microsoft Corporation.
|
|
18
|
+
|
|
19
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
+
purpose with or without fee is hereby granted.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
+
***************************************************************************** */
|
|
30
|
+
function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:t,bitmap:n,width:c,height:l,dataURLOptions:u}=e.data,p=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),l=yield c.arrayBuffer(),u=encode2(l);return s.set(i,u),u}return""}))}(c,l,u),d=new OffscreenCanvas(c,l);d.getContext("2d").drawImage(n,0,0),n.close();const h=yield d.convertToBlob(u),f=h.type,_=yield h.arrayBuffer(),m=encode2(_);if(!i.has(t)&&(yield p)===m)return i.set(t,m),a.postMessage({id:t});if(i.get(t)===m)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:m,width:c,height:l}),i.set(t,m)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,l=new P;l.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:O["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const u=1e3/e;let p,d=0;const takeCanvasSnapshots=e=>{d&&e-d<u||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter$1(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(c.get(n))return;if(0===e.width||0===e.height)return;if(c.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);l.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),p=requestAnimationFrame(takeCanvasSnapshots)};p=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(p)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const l of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[l])continue;const a=patch(t.CanvasRenderingContext2D.prototype,l,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:O["2D"],property:l,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,l,{set(t){e(this.canvas,{type:O["2D"],property:l,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,O.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,O.WebGL2,e,n,i,0,t)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>function __rest$1(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["type"]))),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:i}),this.pendingCanvasMutations.delete(e)}}class StylesheetManager{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),i.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,t)=>({rule:stringifyRule(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:v()})}let q,U,j,B=!1;const $=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:l=null,maskTextClass:u="rr-mask",maskTextSelector:p=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:_,maskInputFn:m,maskTextFn:g,hooks:y,packFn:v,sampling:w={},dataURLOptions:I={},mousemoveWait:O,recordDOM:x=!0,recordCanvas:T=!1,recordCrossOriginIframes:N=!1,recordAfter:D=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:A=!1,collectFonts:L=!1,inlineImages:P=!1,plugins:W,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:H=new Set([]),errorHandler:K}=e;!function registerErrorHandler(e){C=e}(K);const G=!N||window.parent===window;let J=!1;if(!G)try{window.parent.document&&(J=!1)}catch(ie){J=!0}if(G&&!t)throw new Error("emit function is required");void 0!==O&&void 0===w.mousemove&&(w.mousemove=O),$.reset();const X=!0===h?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},Q=!0===_||"all"===_?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===_,headMetaDescKeywords:"all"===_}:_||{};let Y;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let Z=0;const eventProcessor=e=>{for(const t of W||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!J&&(e=v(e)),e};q=(e,s)=>{var a;if(!(null===(a=R[0])||void 0===a?void 0:a.isFrozen())||e.type===b.FullSnapshot||e.type===b.IncrementalSnapshot&&e.data.source===S.Mutation||R.forEach((e=>e.unfreeze())),G)null==t||t(eventProcessor(e),s);else if(J){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===b.FullSnapshot)Y=e,Z=0;else if(e.type===b.IncrementalSnapshot){if(e.data.source===S.Mutation&&e.data.isAttachIframe)return;Z++;const t=i&&Z>=i,s=n&&e.timestamp-Y.timestamp>n;(t||s)&&U(!0)}};const wrappedMutationEmit=e=>{q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.Mutation},e)}))},wrappedScrollEmit=e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.Scroll},e)})),wrappedCanvasMutationEmit=e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.CanvasMutation},e)})),te=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.AdoptedStyleSheet},e)}))}),re=new IframeManager({mirror:$,mutationCb:wrappedMutationEmit,stylesheetManager:te,recordCrossOriginIframes:N,wrappedEmit:q});for(const b of W||[])b.getMirror&&b.getMirror({nodeMirror:$,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});const ne=new ProcessedNodeManager;j=new CanvasManager({recordCanvas:T,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:$,sampling:w.canvas,dataURLOptions:I});const oe=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:p,inlineStylesheet:d,maskInputOptions:X,dataURLOptions:I,maskTextFn:g,maskInputFn:m,recordCanvas:T,inlineImages:P,sampling:w,slimDOMOptions:Q,iframeManager:re,stylesheetManager:te,canvasManager:j,keepIframeSrcFn:z,processedNodeManager:ne},mirror:$});U=(e=!1)=>{if(!x)return;q(wrapEvent({type:b.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),te.reset(),oe.init(),R.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=!0,inlineImages:u=!1,recordCanvas:p=!1,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:f,slimDOM:_=!1,dataURLOptions:m,preserveWhiteSpace:g,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:l,maskInputOptions:!0===d?{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===d?{password:!0}:d,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===_||"all"===_?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===_,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===_?{}:_,dataURLOptions:m,inlineImages:u,recordCanvas:p,preserveWhiteSpace:g,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:$,blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:p,inlineStylesheet:d,maskAllInputs:X,maskTextFn:g,slimDOM:Q,dataURLOptions:I,recordCanvas:T,inlineImages:P,onSerialize:e=>{isSerializedIframe(e,$)&&re.addIframe(e),isSerializedStylesheet(e,$)&&te.trackLinkElement(e),hasShadowRoot(e)&&oe.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{re.attachIframe(e,t),oe.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{te.attachLinkElement(e,t)},keepIframeSrcFn:z});if(!t)return console.warn("Failed to snapshot the document");q(wrapEvent({type:b.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),R.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&te.adoptStyleSheets(document.adoptedStyleSheets,$.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>q(wrapEvent({type:b.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.ViewportResize},e)})),inputCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.Input},e)})),mediaInteractionCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.MediaInteraction},e)})),styleSheetRuleCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.StyleSheetRule},e)})),styleDeclarationCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.Font},e)})),selectionCb:e=>{q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.Selection},e)}))},customElementCb:e=>{q(wrapEvent({type:b.IncrementalSnapshot,data:Object.assign({source:S.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:l,maskTextClass:u,maskTextSelector:p,maskInputOptions:X,inlineStylesheet:d,sampling:w,recordDOM:x,recordCanvas:T,inlineImages:P,userTriggeredOnInput:A,collectFonts:L,doc:e,maskInputFn:m,maskTextFn:g,keepIframeSrcFn:z,blockSelector:a,slimDOMOptions:Q,dataURLOptions:I,mirror:$,iframeManager:re,stylesheetManager:te,shadowDomManager:oe,processedNodeManager:ne,canvasManager:j,ignoreCSSAttributes:H,plugins:(null===(t=null==W?void 0:W.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>q(wrapEvent({type:b.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};re.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(ee){console.warn(ee)}}));const init2=()=>{U(),e.push(observe(document)),B=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{q(wrapEvent({type:b.DomContentLoaded,data:{}})),"DOMContentLoaded"===D&&init2()}))),e.push(on("load",(()=>{q(wrapEvent({type:b.Load,data:{}})),"load"===D&&init2()}),window))),()=>{e.forEach((e=>e())),ne.destroy(),B=!1,function unregisterErrorHandler(){C=void 0}()}}catch(ee){console.warn(ee)}}record.addCustomEvent=(e,t)=>{if(!B)throw new Error("please add custom event after start recording");q(wrapEvent({type:b.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{R.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!B)throw new Error("please take full snapshot after start recording");U(e)},record.mirror=$;var W,z=(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))(z||{}),H=(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))(H||{}),K={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var G={hostname:""};W={navigator:{userAgent:"",onLine:!0},document:{location:G,referrer:""},screen:{width:0,height:0},location:G}}else W=window;var J,X,Q,Y,Z,ee,te,re,ne,oe,ie=864e5,se=8e3,ae=Array.prototype,ce=Function.prototype,le=Object.prototype,ue=ae.slice,pe=le.toString,de=le.hasOwnProperty,he=W.console,fe=W.navigator,_e=W.document,me=W.opera,ge=W.screen,ye=fe.userAgent,ve=ce.bind,be=ae.forEach,Se=ae.indexOf,ke=ae.map,we=Array.isArray,Ie={},Ee={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Oe={log:function(){if(K.DEBUG&&!Ee.isUndefined(he)&&he)try{he.log.apply(he,arguments)}catch(e){Ee.each(arguments,(function(e){he.log(e)}))}},warn:function(){if(K.DEBUG&&!Ee.isUndefined(he)&&he){var e=["Mixpanel warning:"].concat(Ee.toArray(arguments));try{he.warn.apply(he,e)}catch(t){Ee.each(e,(function(e){he.warn(e)}))}}},error:function(){if(K.DEBUG&&!Ee.isUndefined(he)&&he){var e=["Mixpanel error:"].concat(Ee.toArray(arguments));try{he.error.apply(he,e)}catch(t){Ee.each(e,(function(e){he.error(e)}))}}},critical:function(){if(!Ee.isUndefined(he)&&he){var e=["Mixpanel error:"].concat(Ee.toArray(arguments));try{he.error.apply(he,e)}catch(t){Ee.each(e,(function(e){he.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(Oe,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Oe.log,e),error:log_func_with_prefix(Oe.error,e),critical:log_func_with_prefix(Oe.critical,e)}};Ee.bind=function(e,t){var n,i;if(ve&&e.bind===ve)return ve.apply(e,ue.call(arguments,1));if(!Ee.isFunction(e))throw new TypeError;return n=ue.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(ue.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(ue.call(arguments)));return Object(c)===c?c:a},i},Ee.each=function(e,t,n){if(null!=e)if(be&&e.forEach===be)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===Ie)return}else for(var a in e)if(de.call(e,a)&&t.call(n,e[a],a,e)===Ie)return},Ee.extend=function(e){return Ee.each(ue.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},Ee.isArray=we||function(e){return"[object Array]"===pe.call(e)},Ee.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},Ee.isArguments=function(e){return!(!e||!de.call(e,"callee"))},Ee.toArray=function(e){return e?e.toArray?e.toArray():Ee.isArray(e)||Ee.isArguments(e)?ue.call(e):Ee.values(e):[]},Ee.map=function(e,t,n){if(ke&&e.map===ke)return e.map(t,n);var i=[];return Ee.each(e,(function(e){i.push(t.call(n,e))})),i},Ee.keys=function(e){var t=[];return null===e||Ee.each(e,(function(e,n){t[t.length]=n})),t},Ee.values=function(e){var t=[];return null===e||Ee.each(e,(function(e){t[t.length]=e})),t},Ee.include=function(e,t){var n=!1;return null===e?n:Se&&e.indexOf===Se?-1!=e.indexOf(t):(Ee.each(e,(function(e){if(n||(n=e===t))return Ie})),n)},Ee.includes=function(e,t){return-1!==e.indexOf(t)},Ee.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},Ee.isObject=function(e){return e===Object(e)&&!Ee.isArray(e)},Ee.isEmptyObject=function(e){if(Ee.isObject(e)){for(var t in e)if(de.call(e,t))return!1;return!0}return!1},Ee.isUndefined=function(e){return void 0===e},Ee.isString=function(e){return"[object String]"==pe.call(e)},Ee.isDate=function(e){return"[object Date]"==pe.call(e)},Ee.isNumber=function(e){return"[object Number]"==pe.call(e)},Ee.isElement=function(e){return!(!e||1!==e.nodeType)},Ee.encodeDates=function(e){return Ee.each(e,(function(t,n){Ee.isDate(t)?e[n]=Ee.formatDate(t):Ee.isObject(t)&&(e[n]=Ee.encodeDates(t))})),e},Ee.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Ee.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())},Ee.strip_empty_properties=function(e){var t={};return Ee.each(e,(function(e,n){Ee.isString(e)&&e.length>0&&(t[n]=e)})),t},Ee.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):Ee.isArray(e)?(n=[],Ee.each(e,(function(e){n.push(Ee.truncate(e,t))}))):Ee.isObject(e)?(n={},Ee.each(e,(function(e,i){n[i]=Ee.truncate(e,t)}))):n=e,n},Ee.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,l=n,u=[],p=t[e];switch(p&&"object"==typeof p&&"function"==typeof p.toJSON&&(p=p.toJSON(e)),typeof p){case"string":return quote(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";if(n+=" ",u=[],"[object Array]"===pe.apply(p)){for(c=p.length,i=0;i<c;i+=1)u[i]=str(i,p)||"null";return a=0===u.length?"[]":n?"[\n"+n+u.join(",\n"+n)+"\n"+l+"]":"["+u.join(",")+"]",n=l,a}for(s in p)de.call(p,s)&&(a=str(s,p))&&u.push(quote(s)+(n?": ":":")+a);return a=0===u.length?"{}":n?"{"+u.join(",")+l+"}":"{"+u.join(",")+"}",n=l,a}};return str("",{"":e})}}(),Ee.JSONDecode=(Z={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},ee=function(e){var t=new SyntaxError(e);throw t.at=J,t.text=Q,t},te=function(e){return e&&e!==X&&ee("Expected '"+e+"' instead of '"+X+"'"),X=Q.charAt(J),J+=1,X},re=function(){var e,t="";for("-"===X&&(t="-",te("-"));X>="0"&&X<="9";)t+=X,te();if("."===X)for(t+=".";te()&&X>="0"&&X<="9";)t+=X;if("e"===X||"E"===X)for(t+=X,te(),"-"!==X&&"+"!==X||(t+=X,te());X>="0"&&X<="9";)t+=X,te();if(e=+t,isFinite(e))return e;ee("Bad number")},ne=function(){var e,t,n,i="";if('"'===X)for(;te();){if('"'===X)return te(),i;if("\\"===X)if(te(),"u"===X){for(n=0,t=0;t<4&&(e=parseInt(te(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof Z[X])break;i+=Z[X]}else i+=X}ee("Bad string")},oe=function(){for(;X&&X<=" ";)te()},Y=function(){switch(oe(),X){case"{":return function(){var e,t={};if("{"===X){if(te("{"),oe(),"}"===X)return te("}"),t;for(;X;){if(e=ne(),oe(),te(":"),Object.hasOwnProperty.call(t,e)&&ee('Duplicate key "'+e+'"'),t[e]=Y(),oe(),"}"===X)return te("}"),t;te(","),oe()}}ee("Bad object")}();case"[":return function(){var e=[];if("["===X){if(te("["),oe(),"]"===X)return te("]"),e;for(;X;){if(e.push(Y()),oe(),"]"===X)return te("]"),e;te(","),oe()}}ee("Bad array")}();case'"':return ne();case"-":return re();default:return X>="0"&&X<="9"?re():function(){switch(X){case"t":return te("t"),te("r"),te("u"),te("e"),!0;case"f":return te("f"),te("a"),te("l"),te("s"),te("e"),!1;case"n":return te("n"),te("u"),te("l"),te("l"),null}ee('Unexpected "'+X+'"')}()}},function(e){var t;return Q=e,J=0,X=" ",t=Y(),oe(),X&&ee("Syntax error"),t}),Ee.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=0,u=0,p="",d=[];if(!e)return e;e=Ee.utf8Encode(e);do{t=(a=e.charCodeAt(l++)<<16|e.charCodeAt(l++)<<8|e.charCodeAt(l++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,d[u++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(l<e.length);switch(p=d.join(""),e.length%3){case 1:p=p.slice(0,-2)+"==";break;case 2:p=p.slice(0,-1)+"="}return p},Ee.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),l=null;c<128?n++:l=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==l&&(n>t&&(a+=e.substring(t,n)),a+=l,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},Ee.UUID=function(){var T2=function(){var e,t=1*new Date;if(W.performance&&W.performance.now)e=W.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(ge.height*ge.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=ye,i=[],s=0;function xor(e,t){var n,s=0;for(n=0;n<t.length;n++)s|=i[n]<<8*n;return e^s}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(s=xor(s,i),i=[]);return i.length>0&&(s=xor(s,i)),s.toString(16)}()+"-"+e+"-"+T2()}}();var Ce=["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"];Ee.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Ce.length;t++)if(-1!==e.indexOf(Ce[t]))return!0;return!1},Ee.HTTPBuildQuery=function(e,t){var n,i,s=[];return Ee.isUndefined(t)&&(t="&"),Ee.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},Ee.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(s){Oe.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},Ee.cookie={get:function(e){for(var t=e+"=",n=_e.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}return null},parse:function(e){var t;try{t=Ee.JSONDecode(Ee.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var l="",u="",p="";if(c)l="; domain="+c;else if(i){var d=extract_domain(_e.location.hostname);l=d?"; domain=."+d:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),u="; expires="+h.toGMTString()}a&&(s=!0,p="; SameSite=None"),s&&(p+="; secure"),_e.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+l+p},set:function(e,t,n,i,s,a,c){var l="",u="",p="";if(c)l="; domain="+c;else if(i){var d=extract_domain(_e.location.hostname);l=d?"; domain=."+d:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),u="; expires="+h.toGMTString()}a&&(s=!0,p="; SameSite=None"),s&&(p+="; secure");var f=e+"="+encodeURIComponent(t)+u+"; path=/"+l+p;return _e.cookie=f,f},remove:function(e,t,n){Ee.cookie.set(e,"",-1,t,!1,!1,n)}};var Me=null,localStorageSupported=function(e,t){if(null!==Me&&!t)return Me;var n=!0;try{e=e||window.localStorage;var i="__mplss_"+cheap_guid(8);e.setItem(i,"xyz"),"xyz"!==e.getItem(i)&&(n=!1),e.removeItem(i)}catch(s){n=!1}return Me=n,n};Ee.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||Oe.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){Oe.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){Ee.localStorage.error(t)}return null},parse:function(e){try{return Ee.JSONDecode(Ee.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){Ee.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){Ee.localStorage.error(t)}}},Ee.register_event=function(){function fixEvent(e){return e&&(e.preventDefault=fixEvent.preventDefault,e.stopPropagation=fixEvent.stopPropagation),e}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(e,t,n,i,s){if(e)if(e.addEventListener&&!i)e.addEventListener(t,n,!!s);else{var a="on"+t,c=e[a];e[a]=function makeHandler(e,t,n){var handler=function(i){if(i=i||fixEvent(window.event)){var s,a,c=!0;return Ee.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else Oe.error("No valid element provided to register_event")}}();var Re=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Ee.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(t,n){var i=" "+n+" ";return(" "+t.className+" ").replace(e," ").indexOf(i)>=0}function getElementsBySelector(e){if(!_e.getElementsByTagName)return[];var t,n,i,s,a,c,l,u,p,d,h=e.split(" "),f=[_e];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var _=n[1],m=_e.getElementById(_);if(!m||i&&m.nodeName.toLowerCase()!=i)return[];f=[m]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var g=n[1];for(i||(i="*"),s=[],a=0,l=0;l<f.length;l++)for(p="*"==i?getAllChildren(f[l]):f[l].getElementsByTagName(i),u=0;u<p.length;u++)s[a++]=p[u];for(f=[],d=0,l=0;l<s.length;l++)s[l].className&&Ee.isString(s[l].className)&&hasClass(s[l],g)&&(f[d++]=s[l])}else{var y=t.match(Re);if(y){i=y[1];var v,b=y[2],S=y[3],w=y[4];for(i||(i="*"),s=[],a=0,l=0;l<f.length;l++)for(p="*"==i?getAllChildren(f[l]):f[l].getElementsByTagName(i),u=0;u<p.length;u++)s[a++]=p[u];switch(f=[],d=0,S){case"=":v=function(e){return e.getAttribute(b)==w};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+w+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+w+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(w)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(w)==e.getAttribute(b).length-w.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(w)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],d=0,l=0;l<s.length;l++)v(s[l])&&(f[d++]=s[l])}else{for(i=t,s=[],a=0,l=0;l<f.length;l++)for(p=f[l].getElementsByTagName(i),u=0;u<p.length;u++)s[a++]=p[u];f=s}}return f}return function(e){return Ee.isElement(e)?[e]:Ee.isObject(e)&&!Ee.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var xe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Te=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Ee.info={campaignParams:function(e){var t="",n={};return Ee.each(xe,(function(i){(t=Ee.getQueryParam(_e.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return Ee.each(Te,(function(n){(e=Ee.getQueryParam(_e.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return Ee.extend(Ee.info.campaignParams(),Ee.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var t=Ee.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=Ee.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||Ee.includes(e," OPR/")?Ee.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Ee.includes(e,"IEMobile")||Ee.includes(e,"WPDesktop")?"Internet Explorer Mobile":Ee.includes(e,"SamsungBrowser/")?"Samsung Internet":Ee.includes(e,"Edge")||Ee.includes(e,"Edg/")?"Microsoft Edge":Ee.includes(e,"FBIOS")?"Facebook Mobile":Ee.includes(e,"Chrome")?"Chrome":Ee.includes(e,"CriOS")?"Chrome iOS":Ee.includes(e,"UCWEB")||Ee.includes(e,"UCBrowser")?"UC Browser":Ee.includes(e,"FxiOS")?"Firefox iOS":Ee.includes(t,"Apple")?Ee.includes(e,"Mobile")?"Mobile Safari":"Safari":Ee.includes(e,"Android")?"Android Mobile":Ee.includes(e,"Konqueror")?"Konqueror":Ee.includes(e,"Firefox")?"Firefox":Ee.includes(e,"MSIE")||Ee.includes(e,"Trident/")?"Internet Explorer":Ee.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[Ee.info.browser(e,t,n)];if(void 0===i)return null;var s=e.match(i);return s?parseFloat(s[s.length-2]):null},os:function(){var e=ye;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return W.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Ee.extend(Ee.strip_empty_properties({$os:Ee.info.os(),$browser:Ee.info.browser(ye,fe.vendor,me),$referrer:_e.referrer,$referring_domain:Ee.info.referringDomain(_e.referrer),$device:Ee.info.device(ye)}),{$current_url:Ee.info.currentUrl(),$browser_version:Ee.info.browserVersion(ye,fe.vendor,me),$screen_height:ge.height,$screen_width:ge.width,mp_lib:"web",$lib_version:K.LIB_VERSION,$insert_id:cheap_guid(),time:Ee.timestamp()/1e3},Ee.strip_empty_properties(e))},people_properties:function(){return Ee.extend(Ee.strip_empty_properties({$os:Ee.info.os(),$browser:Ee.info.browser(ye,fe.vendor,me)}),{$browser_version:Ee.info.browserVersion(ye,fe.vendor,me)})},mpPageViewProperties:function(){return Ee.strip_empty_properties({current_page_title:_e.title,current_domain:W.location.hostname,current_url_path:W.location.pathname,current_url_protocol:W.location.protocol,current_url_search:W.location.search})}};var cheap_guid=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},Ne=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,De=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=De,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Ne);var s=e.match(t);return s?s[0]:""},Ae=null,Le=null;"undefined"!=typeof JSON&&(Ae=JSON.stringify,Le=JSON.parse),Ae=Ae||Ee.JSONEncode,Le=Le||Ee.JSONDecode,Ee.toArray=Ee.toArray,Ee.isObject=Ee.isObject,Ee.JSONEncode=Ee.JSONEncode,Ee.JSONDecode=Ee.JSONDecode,Ee.isBlockedUA=Ee.isBlockedUA,Ee.isEmptyObject=Ee.isEmptyObject,Ee.info=Ee.info,Ee.info.device=Ee.info.device,Ee.info.browser=Ee.info.browser,Ee.info.browserVersion=Ee.info.browserVersion,Ee.info.properties=Ee.info.properties;var Pe="__mp_opt_in_out_";function optIn(e,t){_optInOut(!0,e,t)}function optOut(e,t){_optInOut(!1,e,t)}function hasOptedIn(e,t){return"1"===_getStorageValue(e,t)}function hasOptedOut(e,t){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||W,n=t.navigator||{},i=!1;return Ee.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){Ee.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return Oe.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n="0"===_getStorageValue(e,t);return n&&Oe.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function addOptOutCheckMixpanelLib(e){return _addOptOutCheck(e,(function(e){return this.get_config(e)}))}function addOptOutCheckMixpanelPeople(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function addOptOutCheckMixpanelGroup(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function clearOptInOut(e,t){_getStorage(t=t||{}).remove(_getStorageKey(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?Ee.localStorage:Ee.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Pe)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){Ee.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,Ee.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})):Oe.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),l=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:l}))}catch(p){Oe.error("Unexpected error when checking tracking opt-out status: "+p)}if(!n)return e.apply(this,arguments);var u=arguments[arguments.length-1];"function"==typeof u&&u(0)}}var Fe=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,l=this.timeoutMS,u=this.storage,p=a+":X",d=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>l)return Fe.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),u.removeItem(h),u.removeItem(d),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=u.getItem(d);if(e&&e!==i)return!1;if(u.setItem(d,i),u.getItem(d)===i)return!0;if(!localStorageSupported(u,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){u.setItem(p,i),waitFor(getSetY,(function(){u.getItem(p)!==i?delay((function(){u.getItem(d)===i?waitFor((function(){return!u.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){u.setItem(h,"1");try{e()}finally{u.removeItem(h),u.getItem(d)===i&&u.removeItem(d),u.getItem(p)===i&&u.removeItem(p)}};try{if(!localStorageSupported(u,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var qe=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||Ee.bind(qe.error,qe),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=t.usePersistence,this.pid=t.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,t,n){var i={id:cheap_guid(),flushAfter:(new Date).getTime()+2*t,payload:e};this.usePersistence?this.lock.withLock(Ee.bind((function lockAcquired(){var t;try{var s=this.readFromStorage();s.push(i),(t=this.saveToStorage(s))&&this.memQueue.push(i)}catch(a){this.reportError("Error enqueueing item",e),t=!1}n&&n(t)}),this),Ee.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),n&&n(!1)}),this),this.pid):(this.memQueue.push(i),n&&n(!0))},RequestQueue.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);if(this.usePersistence&&t.length<e){var n=this.readFromStorage();if(n.length){var i={};Ee.each(t,(function(e){i[e.id]=!0}));for(var s=0;s<n.length;s++){var a=n[s];if((new Date).getTime()>a.flushAfter&&!i[a.id]&&(a.orphaned=!0,t.push(a),t.length>=e))break}}}return t};var filterOutIDsAndInvalid=function(e,t){var n=[];return Ee.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(Ee.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=Ee.bind((function(){var t;try{var i=this.readFromStorage();if(i=filterOutIDsAndInvalid(i,n),t=this.saveToStorage(i)){i=this.readFromStorage();for(var s=0;s<i.length;s++){var a=i[s];if(a.id&&n[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(c){this.reportError("Error removing items",e),t=!1}return t}),this);this.lock.withLock((function lockAcquired(){var e=i();t&&t(e)}),Ee.bind((function lockFailure(e){var n=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(n=i()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}t&&t(n)}),this),this.pid)}else t&&t(!0)};var updatePayloads=function(e,t){var n=[];return Ee.each(e,(function(e){var i=e.id;if(i in t){var s=t[i];null!==s&&(e.payload=s,n.push(e))}else n.push(e)})),n};RequestQueue.prototype.updatePayloads=function(e,t){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(Ee.bind((function lockAcquired(){var n;try{var i=this.readFromStorage();i=updatePayloads(i,e),n=this.saveToStorage(i)}catch(s){this.reportError("Error updating items",e),n=!1}t&&t(n)}),this),Ee.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),t&&t(!1)}),this),this.pid):t&&t(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=Le(e),Ee.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(t){this.reportError("Error retrieving queue",t),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,Ae(e)),!0}catch(t){return this.reportError("Error saving queue",t),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Ue=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:Ee.bind(this.reportError,this),storage:t.storage,usePersistence:t.usePersistence}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,t){this.queue.enqueue(e,this.flushInterval,t)},RequestBatcher.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},RequestBatcher.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},RequestBatcher.prototype.clear=function(){this.queue.clear()},RequestBatcher.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},RequestBatcher.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},RequestBatcher.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(Ee.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void Ue.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],l={};if(Ee.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=Ee.extend({},t.properties,{mp_sent_by_lib_version:K.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}l[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var u=Ee.bind((function(c){this.requestInProgress=!1;try{var u=!1;if(e.unloading)this.queue.updatePayloads(l);else if(Ee.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(Ee.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=W.navigator.onLine,!Ee.isUndefined(h)&&!h)||"timeout"===c.error)){var p=2*this.flushInterval;c.retryAfter&&(p=1e3*parseInt(c.retryAfter,10)||p),p=Math.min(6e5,p),this.reportError("Error; retry in "+p+" ms"),this.scheduleFlush(p)}else if(Ee.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var d=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,d,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),u=!0;else u=!0;u&&(this.queue.removeItemsByID(Ee.map(s,(function(e){return e.id})),Ee.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!a?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())}),this)),Ee.each(s,Ee.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(p.transport="sendBeacon"),Ue.log("MIXPANEL REQUEST:",c),this.sendRequest(c,p,u)}catch(d){this.reportError("Error flushing request queue",d),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(Ue.error.apply(Ue.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Ue.error(n)}};var je=console_with_prefix("recorder"),Be=W.CompressionStream,$e={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},We=new Set([H.MouseMove,H.MouseInteraction,H.Scroll,H.ViewportResize,H.Input,H.TouchMove,H.MediaInteraction,H.Drag,H.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=ie,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:$e,sendRequestFunc:Ee.bind(this.flushEventsWithOptOut,this),errorReporter:Ee.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>ie&&(this.recordMaxMs=ie,je.critical("record_max_ms cannot be greater than "+ie+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>se&&(this.recordMinMs=se,je.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=Ee.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=Ee.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(Ee.bind((function(){je.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),n=this.get_config("record_block_selector");""!==n&&null!==n||(n=void 0),this._stopRecording=record({emit:Ee.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===z.IncrementalSnapshot&&We.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())}),this),blockClass:this.get_config("record_block_class"),blockSelector:n,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),t(),this.maxTimeoutId=setTimeout(Ee.bind(this.resetRecording,this),this.recordMaxMs)}else je.log("Recording already in progress, skipping startRecording.")},MixpanelRecorder.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},MixpanelRecorder.prototype.stopRecording=function(){null!==this._stopRecording&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},MixpanelRecorder.prototype.flushEventsWithOptOut=function(e,t,n){this._flushEvents(e,t,n,Ee.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,t,n,i){var s=Ee.bind((function(t,n){200===t.status&&this.replayId===e&&this.seqNo++,i({status:0,httpStatusCode:t.status,responseBody:n,retryAfter:t.headers.get("Retry-After")})}),this);W.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>0){var s=this.replayId,a=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=a);var c=e[i-1].timestamp-this.replayStartTime,l={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},u=Ee.JSONEncode(e),p=this._mixpanel.get_property("$device_id");p&&(l.$device_id=p);var d=this._mixpanel.get_property("$user_id");if(d&&(l.$user_id=d),Be){var h=new Blob([u],{type:"application/json"}).stream().pipeThrough(new Be("gzip"));new Response(h).blob().then(Ee.bind((function(e){l.format="gzip",this._sendRequest(s,l,e,n)}),this))}else l.format="body",this._sendRequest(s,l,u,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){je.error.apply(je.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){je.error(n)}},W.__mp_recorder=MixpanelRecorder;var DomTracker=function(){};DomTracker.prototype.create_properties=function(){},DomTracker.prototype.event_handler=function(){},DomTracker.prototype.after_track_handler=function(){},DomTracker.prototype.init=function(e){return this.mp=e,this},DomTracker.prototype.track=function(e,t,n,i){var s=this,a=Ee.dom_query(e);if(0!==a.length)return Ee.each(a,(function(e){Ee.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),l=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),l),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;Oe.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,t,n,i){i=i||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,e&&!1===e(i,t)||s.after_track_handler(t,n,i))}},DomTracker.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):Ee.extend({},e)};var LinkTracker=function(){this.override_event="click"};Ee.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,t){var n=LinkTracker.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},LinkTracker.prototype.event_handler=function(e,t,n){n.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,n.href=t.href,n.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout((function(){window.location=t.href}),0)};var FormTracker=function(){this.override_event="submit"};Ee.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,t){setTimeout((function(){t.element.submit()}),0)};var ze="$set",Ve="$set_once",He="$unset",Ke="$add",Ge="$append",Je="$union",Xe="$remove",Qe={set_action:function(e,t){var n={},i={};return Ee.isObject(e)?Ee.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[ze]=i,n},unset_action:function(e){var t={},n=[];return Ee.isArray(e)||(e=[e]),Ee.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[He]=n,t},set_once_action:function(e,t){var n={},i={};return Ee.isObject(e)?Ee.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Ve]=i,n},union_action:function(e,t){var n={},i={};return Ee.isObject(e)?Ee.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=Ee.isArray(e)?e:[e])}),this):i[e]=Ee.isArray(t)?t:[t],n[Je]=i,n},append_action:function(e,t){var n={},i={};return Ee.isObject(e)?Ee.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Ge]=i,n},remove_action:function(e,t){var n={},i={};return Ee.isObject(e)?Ee.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Xe]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Ee.extend(MixpanelGroup.prototype,Qe),MixpanelGroup.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_action(e,t);return Ee.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_once_action(e,t);return Ee.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,t,n){Ee.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var t=this.delete_action();return this._send_request(t,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=Ee.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},MixpanelGroup.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},MixpanelGroup.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelGroup.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},MixpanelGroup.prototype.remove=MixpanelGroup.prototype.remove,MixpanelGroup.prototype.set=MixpanelGroup.prototype.set,MixpanelGroup.prototype.set_once=MixpanelGroup.prototype.set_once,MixpanelGroup.prototype.union=MixpanelGroup.prototype.union,MixpanelGroup.prototype.unset=MixpanelGroup.prototype.unset,MixpanelGroup.prototype.toString=MixpanelGroup.prototype.toString;var MixpanelPeople=function(){};Ee.extend(MixpanelPeople.prototype,Qe),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return Ee.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[ze]=Ee.extend({},Ee.info.people_properties(),i[ze]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return Ee.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,t,n){var i={},s={};return Ee.isObject(e)?(Ee.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void Oe.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(Ee.isUndefined(t)&&(t=1),s[e]=t),i[Ke]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){Ee.isObject(e)&&(n=t);var i=this.append_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,t,n){Ee.isObject(e)&&(n=t);var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,t,n){Ee.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,t,n){if(Ee.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",Ee.extend({$amount:e},t),n);Oe.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)}Oe.error("mixpanel.people.delete_user() requires you to call identify() first")},MixpanelPeople.prototype.toString=function(){return this._mixpanel.toString()+".people"},MixpanelPeople.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),i&&(e.$user_id=i),s&&(e.$had_persisted_distinct_id=s);var a=Ee.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:a,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),Ee.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),Ee.truncate(a,255))},MixpanelPeople.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(e){ze in e?this._mixpanel.persistence._add_to_people_queue(ze,e):Ve in e?this._mixpanel.persistence._add_to_people_queue(Ve,e):He in e?this._mixpanel.persistence._add_to_people_queue(He,e):Ke in e?this._mixpanel.persistence._add_to_people_queue(Ke,e):Ge in e?this._mixpanel.persistence._add_to_people_queue(Ge,e):Xe in e?this._mixpanel.persistence._add_to_people_queue(Xe,e):Je in e?this._mixpanel.persistence._add_to_people_queue(Je,e):Oe.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=Ee.extend({},this._mixpanel.persistence.load_queue(e)),c=a;Ee.isUndefined(a)||!Ee.isObject(a)||Ee.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),i&&(c=i(a)),t.call(s,c,(function(t,i){0===t&&s._mixpanel.persistence._add_to_people_queue(e,a),Ee.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var l=this;this._flush_one_queue(ze,this.set,e),this._flush_one_queue(Ve,this.set_once,i),this._flush_one_queue(He,this.unset,a,(function(e){return Ee.keys(e)})),this._flush_one_queue(Ke,this.increment,t),this._flush_one_queue(Je,this.union,s);var u=this._mixpanel.persistence.load_queue(Ge);if(!Ee.isUndefined(u)&&Ee.isArray(u)&&u.length)for(var p,append_callback=function(e,t){0===e&&l._mixpanel.persistence._add_to_people_queue(Ge,p),Ee.isUndefined(n)||n(e,t)},d=u.length-1;d>=0;d--)u=this._mixpanel.persistence.load_queue(Ge),p=u.pop(),l._mixpanel.persistence.save(),Ee.isEmptyObject(p)||l.append(p,append_callback);var h=this._mixpanel.persistence.load_queue(Xe);if(!Ee.isUndefined(h)&&Ee.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&l._mixpanel.persistence._add_to_people_queue(Xe,f),Ee.isUndefined(c)||c(e,t)},_=h.length-1;_>=0;_--)h=this._mixpanel.persistence.load_queue(Xe),f=h.pop(),l._mixpanel.persistence.save(),Ee.isEmptyObject(f)||l.remove(f,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var Ye,Ze="__mps",et="__mpso",tt="__mpus",rt="__mpa",nt="__mpap",ot="__mpr",it="__mpu",st="$people_distinct_id",at="__alias",ct="__timers",lt=[Ze,et,tt,rt,nt,ot,it,st,at,ct],MixpanelPersistence=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(Oe.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&Ee.localStorage.is_supported()?this.storage=Ee.localStorage:this.storage=Ee.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),Ee.each(this.props,(function(t,n){Ee.include(lt,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Ee.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===Ee.localStorage?(e=Ee.cookie.parse(this.name),Ee.cookie.remove(this.name),Ee.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Ee.cookie&&(t=Ee.localStorage.parse(this.name),Ee.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,Ee.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(e){return this.load(),this.props[e]},MixpanelPersistence.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},MixpanelPersistence.prototype.clear=function(){this.remove(),this.props={}},MixpanelPersistence.prototype.register_once=function(e,t,n){return!!Ee.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),Ee.each(e,(function(e,n){this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,t){return!!Ee.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),Ee.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(Ee.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Ee.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return Ee.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},MixpanelPersistence.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),i=t[e],s=this._get_or_create_queue(ze),a=this._get_or_create_queue(Ve),c=this._get_or_create_queue(He),l=this._get_or_create_queue(Ke),u=this._get_or_create_queue(Je),p=this._get_or_create_queue(Xe,[]),d=this._get_or_create_queue(Ge,[]);n===Ze?(Ee.extend(s,i),this._pop_from_people_queue(Ke,i),this._pop_from_people_queue(Je,i),this._pop_from_people_queue(He,i)):n===et?(Ee.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(He,i)):n===tt?Ee.each(i,(function(e){Ee.each([s,a,l,u],(function(t){e in t&&delete t[e]})),Ee.each(d,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===rt?(Ee.each(i,(function(e,t){t in s?s[t]+=e:(t in l||(l[t]=0),l[t]+=e)}),this),this._pop_from_people_queue(He,i)):n===it?(Ee.each(i,(function(e,t){Ee.isArray(e)&&(t in u||(u[t]=[]),u[t]=u[t].concat(e))})),this._pop_from_people_queue(He,i)):n===ot?(p.push(i),this._pop_from_people_queue(Ge,i)):n===nt&&(d.push(i),this._pop_from_people_queue(He,i)),Oe.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Oe.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];Ee.isUndefined(n)||Ee.each(t,(function(t,i){e===Ge||e===Xe?Ee.each(n,(function(e){e[i]===t&&delete e[i]})):delete n[i]}),this)},MixpanelPersistence.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},MixpanelPersistence.prototype._get_queue_key=function(e){return e===ze?Ze:e===Ve?et:e===He?tt:e===Ke?rt:e===Ge?nt:e===Xe?ot:e===Je?it:void Oe.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=Ee.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(ct)||{};n[e]=t,this.props[ct]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(ct)||{})[e];return Ee.isUndefined(t)||(delete this.props[ct][e],this.save()),t};var ut,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},pt="mixpanel",dt="base64",ht="$device:",ft=W.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,_t=!ft&&-1===ye.indexOf("MSIE")&&-1===ye.indexOf("Mozilla"),mt=null;fe.sendBeacon&&(mt=function(){return fe.sendBeacon.apply(fe,arguments)});var gt={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},yt={api_host:"https://api-js.mixpanel.com",api_routes:gt,api_method:"POST",api_transport:"XHR",api_payload_format:dt,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:ie,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},vt=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===pt?ut:ut[n];if(s&&0===Ye)i=s;else{if(s&&!Ee.isArray(s))return void Oe.error("You have already initialized "+n);i=new MixpanelLib}if(i._cached_groups={},i._init(e,t,n),i.people=new MixpanelPeople,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var a=Ee.info.campaignParams(null),c={},l=!1;Ee.each(a,(function(e,t){c["initial_"+t]=e,e&&(l=!0)})),l&&i.people.set_once(c)}return K.DEBUG=K.DEBUG||i.get_config("debug"),!Ee.isUndefined(s)&&Ee.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(Ee.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==pt){var i=create_mplib(e,t,n);return ut[n]=i,i._loaded(),i}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var i={};"api_payload_format"in t||(t.api_host||yt.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(Ee.extend({},yt,i,t,{name:n,token:e,callback_fn:(n===pt?n:pt+"."+n)+"._jsc"})),this._jsc=NOOP_FUNC,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(Ee.localStorage.is_supported(!0)&&ft){if(this.init_batchers(),mt&&W.addEventListener){var s=Ee.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);W.addEventListener("pagehide",(function(e){e.persisted&&s()})),W.addEventListener("visibilitychange",(function(){"hidden"===_e.visibilityState&&s()}))}}else this._batch_requests=!1,Oe.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Ee.each(this.get_batcher_configs(),(function(e){Oe.log("Clearing batch queue "+e.queue_key),Ee.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=Ee.UUID();this.get_distinct_id()||this.register_once({distinct_id:ht+a,$device_id:a},"");var c=this.get_config("track_pageview");c&&this._init_url_change_tracking(c),this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent")&&this.start_session_recording()},MixpanelLib.prototype.start_session_recording=addOptOutCheckMixpanelLib((function(){if(W.MutationObserver){var e=Ee.bind((function(){this._recorder=this._recorder||new W.__mp_recorder(this),this._recorder.startRecording()}),this);Ee.isUndefined(W.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Oe.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Oe.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var t=this._recorder.replayId;t&&(e.$mp_replay_id=t)}return e},MixpanelLib.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=Ee.info.campaignParams(null);Ee.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(_e.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Ee.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(_e.referrer)},MixpanelLib.prototype._dom_loaded=function(){Ee.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||Ee.each(this.__request_queue,(function(e){this._send_request.apply(this,e)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!vt)return this.__dom_loaded_queue.push([e,t]),!1;var n=(new e).init(this);return n.track.apply(n,t)},MixpanelLib.prototype._init_url_change_tracking=function(e){var t="";if(this.track_pageview()&&(t=Ee.info.currentUrl()),Ee.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){W.addEventListener("popstate",(function(){W.dispatchEvent(new Event("mp_locationchange"))})),W.addEventListener("hashchange",(function(){W.dispatchEvent(new Event("mp_locationchange"))}));var n=W.history.pushState;"function"==typeof n&&(W.history.pushState=function(e,t,i){n.call(W.history,e,t,i),W.dispatchEvent(new Event("mp_locationchange"))});var i=W.history.replaceState;"function"==typeof i&&(W.history.replaceState=function(e,t,n){i.call(W.history,e,t,n),W.dispatchEvent(new Event("mp_locationchange"))}),W.addEventListener("mp_locationchange",function(){var n=Ee.info.currentUrl(),i=!1;("full-url"===e?i=n!==t:"url-with-path-and-query-string"===e?i=n.split("#")[0]!==t.split("#")[0]:"url-with-path"===e&&(i=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0]),i)&&(this.track_pageview()&&(t=n))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,t){if(Ee.isUndefined(e))return null;if(ft){return function(n){e(n,t)}}var n=this._jsc,i=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(s){delete n[i],e(s,t)},s},MixpanelLib.prototype._send_request=function(e,t,n,i){var s=!0;if(_t)return this.__request_queue.push(arguments),s;var a={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},c=null;i||!Ee.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=Ee.extend(a,n||{}),ft||(n.method="GET");var l="POST"===n.method,u=mt&&l&&"sendbeacon"===n.transport.toLowerCase(),p=n.verbose;t.verbose&&(p=!0),this.get_config("test")&&(t.test=1),p&&(t.verbose=1),this.get_config("img")&&(t.img=1),ft||(i?t.callback=i:(p||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),l&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+Ee.HTTPBuildQuery(t);var d=this;if("img"in t){var h=_e.createElement("img");h.src=e,_e.body.appendChild(h)}else if(u){try{s=mt(e,c)}catch(v){d.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){d.report_error(v)}}else if(ft)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var _=this.get_config("xhr_headers");if(l&&(_["Content-Type"]="application/x-www-form-urlencoded"),Ee.each(_,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var m=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(p){var t;try{t=Ee.JSONDecode(f.responseText)}catch(v){if(d.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-m>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,d.report_error(e),i)if(p){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){d.report_error(v),s=!1}else{var g=_e.createElement("script");g.type="text/javascript",g.async=!0,g.defer=!0,g.src=e;var y=_e.getElementsByTagName("script")[0];y.parentNode.insertBefore(g,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];Ee.each(e,(function(e){e&&(t=e[0],Ee.isArray(t)?s.push(e):"function"==typeof e?e.call(this):Ee.isArray(e)&&"alias"===t?n.push(e):Ee.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){Ee.each(e,(function(e){if(Ee.isArray(e[0])){var n=t;Ee.each(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};execute(n,this),execute(i,this),execute(s,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=Ee.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Ee.bind((function(t,n,i){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(t),n,this._prepare_callback(i,t))}),this),beforeSendHook:Ee.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:Ee.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},MixpanelLib.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,Ee.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,Ee.each(this.request_batchers,(function(e){e.stop(),e.clear()}))},MixpanelLib.prototype.push=function(e){this._execute_array([e])},MixpanelLib.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},MixpanelLib.prototype._encode_data_for_request=function(e){var t=Ee.JSONEncode(e);return this.get_config("api_payload_format")===dt&&(t=Ee.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=Ee.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var l=!0,u=Ee.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Oe.log("MIXPANEL REQUEST:"),Oe.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):u()})):l=u(),l&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),Ee.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=Ee.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!Ee.isUndefined(c)){var l=(new Date).getTime()-c;t.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var u=this.get_config("track_marketing")?Ee.info.marketingParams():{};t=Ee.extend({},Ee.info.properties({mp_loader:this.get_config("mp_loader")}),u,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var p=this.get_config("property_blacklist");Ee.isArray(p)?Ee.each(p,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+p);var d={event:e,properties:t};return this._track_or_batch({type:"events",data:d,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){Ee.isArray(t)||(t=[t]);var i={};return i[e]=t,this.register(i),this.people.set(e,t,n)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e),s={};return void 0===i?(s[e]=[t],this.register(s)):-1===i.indexOf(t)&&(i.push(t),s[e]=i,this.register(s)),this.people.union(e,t,n)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e);if(void 0!==i){var s=i.indexOf(t);s>-1&&(i.splice(s,1),this.register({group_key:i})),0===i.length&&this.unregister(e)}return this.people.remove(e,t,n)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,t,n,i){var s=Ee.extend({},t||{});return Ee.each(n,(function(e,t){null!=e&&(s[t]=e)})),this.track(e,s,i)})),MixpanelLib.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},MixpanelLib.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},MixpanelLib.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),i=this._cached_groups[n];return void 0!==i&&i._group_key===e&&i._group_id===t||((i=new MixpanelGroup)._init(this,e,t),this._cached_groups[n]=i),i},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,t){"object"!=typeof e&&(e={});var n=(t=t||{}).event_name||"$mp_web_page_view",i=Ee.extend(Ee.info.mpPageViewProperties(),Ee.info.campaignParams(),Ee.info.clickParams()),s=Ee.extend({},i,e);return this.track(n,s)})),MixpanelLib.prototype.track_links=function(){return this._track_dom.call(this,LinkTracker,arguments)},MixpanelLib.prototype.track_forms=function(){return this._track_dom.call(this,FormTracker,arguments)},MixpanelLib.prototype.time_event=function(e){Ee.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 bt={persistent:!0},options_for_register=function(e){var t;return t=Ee.isObject(e)?e:Ee.isUndefined(e)?{}:{days:e},Ee.extend({},bt,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):Ee.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,t,n){var i=options_for_register(n);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),Ee.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,l){var u=this.get_distinct_id();if(e&&u!==e){if("string"==typeof e&&0===e.indexOf(ht))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var p=u;this.register_once({$had_persisted_distinct_id:!0,$device_id:p},"")}e!==u&&e!==this.get_property(at)&&(this.unregister(at),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,l),e!==u&&this.track("$identify",{distinct_id:e,$anon_distinct_id:u},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=Ee.UUID();this.register_once({distinct_id:ht+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,t){if(e===this.get_property(st))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return Ee.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(at,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},(function(){n.identify(e)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},MixpanelLib.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},MixpanelLib.prototype.set_config=function(e){Ee.isObject(e)&&(Ee.extend(this.config,e),e.batch_size&&Ee.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),K.DEBUG=K.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var t=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,ue.call(arguments,1));return void 0===t&&(this.report_error(e+" hook did not return a value"),t=null),t},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==pt&&(e=pt+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return Ee.isBlockedUA(ye)||this._flags.disable_all_events||Ee.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Ee.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")&&!Ee.cookie.get("mp_optout")||(Ee.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,t){return t=Ee.extend({track:Ee.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),Ee.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=Ee.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=Ee.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=Ee.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){Oe.error.apply(Oe.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Oe.error(n)}},MixpanelLib.prototype.init=MixpanelLib.prototype.init,MixpanelLib.prototype.reset=MixpanelLib.prototype.reset,MixpanelLib.prototype.disable=MixpanelLib.prototype.disable,MixpanelLib.prototype.time_event=MixpanelLib.prototype.time_event,MixpanelLib.prototype.track=MixpanelLib.prototype.track,MixpanelLib.prototype.track_links=MixpanelLib.prototype.track_links,MixpanelLib.prototype.track_forms=MixpanelLib.prototype.track_forms,MixpanelLib.prototype.track_pageview=MixpanelLib.prototype.track_pageview,MixpanelLib.prototype.register=MixpanelLib.prototype.register,MixpanelLib.prototype.register_once=MixpanelLib.prototype.register_once,MixpanelLib.prototype.unregister=MixpanelLib.prototype.unregister,MixpanelLib.prototype.identify=MixpanelLib.prototype.identify,MixpanelLib.prototype.alias=MixpanelLib.prototype.alias,MixpanelLib.prototype.name_tag=MixpanelLib.prototype.name_tag,MixpanelLib.prototype.set_config=MixpanelLib.prototype.set_config,MixpanelLib.prototype.get_config=MixpanelLib.prototype.get_config,MixpanelLib.prototype.get_property=MixpanelLib.prototype.get_property,MixpanelLib.prototype.get_distinct_id=MixpanelLib.prototype.get_distinct_id,MixpanelLib.prototype.toString=MixpanelLib.prototype.toString,MixpanelLib.prototype.opt_out_tracking=MixpanelLib.prototype.opt_out_tracking,MixpanelLib.prototype.opt_in_tracking=MixpanelLib.prototype.opt_in_tracking,MixpanelLib.prototype.has_opted_out_tracking=MixpanelLib.prototype.has_opted_out_tracking,MixpanelLib.prototype.has_opted_in_tracking=MixpanelLib.prototype.has_opted_in_tracking,MixpanelLib.prototype.clear_opt_in_out_tracking=MixpanelLib.prototype.clear_opt_in_out_tracking,MixpanelLib.prototype.get_group=MixpanelLib.prototype.get_group,MixpanelLib.prototype.set_group=MixpanelLib.prototype.set_group,MixpanelLib.prototype.add_group=MixpanelLib.prototype.add_group,MixpanelLib.prototype.remove_group=MixpanelLib.prototype.remove_group,MixpanelLib.prototype.track_with_groups=MixpanelLib.prototype.track_with_groups,MixpanelLib.prototype.start_batch_senders=MixpanelLib.prototype.start_batch_senders,MixpanelLib.prototype.stop_batch_senders=MixpanelLib.prototype.stop_batch_senders,MixpanelLib.prototype.start_session_recording=MixpanelLib.prototype.start_session_recording,MixpanelLib.prototype.stop_session_recording=MixpanelLib.prototype.stop_session_recording,MixpanelLib.prototype.get_session_recording_properties=MixpanelLib.prototype.get_session_recording_properties,MixpanelLib.prototype.DEFAULT_API_ROUTES=gt,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 St={},override_mp_init_func=function(){ut.init=function(e,t,n){if(n)return ut[n]||(ut[n]=St[n]=create_mplib(e,t,n),ut[n]._loaded()),ut[n];var i=ut;St[pt]?i=St[pt]:e&&((i=create_mplib(e,t,pt))._loaded(),St[pt]=i),ut=i,1===Ye&&(W[pt]=ut),Ee.each(St,(function(e,t){t!==pt&&(ut[t]=e)})),ut._=Ee}};var kt=function init_as_module(e){return load_extra_bundle=e,Ye=0,ut=new MixpanelLib,override_mp_init_func(),ut.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,vt=!0,_t=!1,Ee.each(St,(function(e){e._dom_loaded()})))}if(_e.addEventListener)"complete"===_e.readyState?dom_loaded_handler():_e.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(_e.attachEvent){_e.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===W.frameElement}catch(t){}_e.documentElement.doScroll&&e&&function do_scroll_check(){try{_e.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}Ee.register_event(W,"load",dom_loaded_handler,!0)}(),ut}((function loadNoop(e,t){t()})),__assign=function(){return __assign=Object.assign||function __assign2(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)};function __awaiter(e,t,n,i){return new(n||(n=Promise))((function(s,a){function fulfilled(e){try{step(i.next(e))}catch(t){a(t)}}function rejected(e){try{step(i.throw(e))}catch(t){a(t)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var wt={default:"endpoint"},It={default:"tlsEndpoint"},Et="Client timeout",Ot="Network connection error",Ct="Network request aborted",Mt="Response cannot be parsed",Rt="Blocked by CSP",xt="The endpoint parameter is not a valid URL";function E(e){for(var t="",n=0;n<e.length;++n)if(n>0){var i=e[n].toLowerCase();i!==e[n]?t+=" ".concat(i):t+=e[n]}else t+=e[n].toUpperCase();return t}var Tt=E("WrongRegion"),Nt=E("SubscriptionNotActive"),Dt=E("UnsupportedVersion"),At=E("InstallationMethodRestricted"),Lt=E("HostnameRestricted"),Pt=E("IntegrationFailed"),Ft="API key required",qt="API key not found",Ut="API key expired",jt="Request cannot be parsed",Bt="Request failed",$t="Request failed to process",Wt="Too many requests, rate limit exceeded",zt="Not available for this origin",Vt="Not available with restricted header",Ht=Ft,Kt=qt,Gt=Ut,Jt="Failed to load the JS script of the agent",Xt="9319";function M(e,t){var n,i,s,a,c,l=[],u=(c=function __spreadArray(e,t,n){if(n||2===arguments.length)for(var i,s=0,a=t.length;s<a;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}([],e,!0),n={current:function(){return c[0]},postpone:function(){var e=c.shift();void 0!==e&&c.push(e)},exclude:function(){c.shift()}},a=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[n.current(),function(e,t){var a,c=t instanceof Error?t.message:"";if(c===Rt||c===xt)n.exclude(),a=0;else if(c===Xt)n.exclude();else if(c===Jt){var l=Date.now()-e.getTime()<50,u=n.current();u&&l&&!s.has(u)&&(s.add(u),a=0),n.postpone()}else n.postpone();var p=n.current();return void 0===p?void 0:[p,null!=a?a:e.getTime()+i()-Date.now()]}]),p=u[0],d=u[1];if(void 0===p)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var n=new Date,r3=function(t){return l.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r3()}),r3),i.catch((function(e){if(l.length>=5)throw e;var t=d(n,e);if(!t)throw e;var i,s=t[0],a=t[1];return(i=a,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return p2(s)}))}))};return p2(p).then((function(e){return[e,l]}))}var Qt="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Yt=Qt;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,l,u,p=e.token,d=e.apiKey,h=void 0===d?p:d,f=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["scriptUrlPattern","token","apiKey"]),_=null!==(t=function r(e,t){return n=e,i=t,Object.prototype.hasOwnProperty.call(n,i)?e[t]:void 0;var n,i}(e,"scriptUrlPattern"))&&void 0!==t?t:Qt,m=(c=[],l=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=l,n.addEventListener(i,s,a),u=function(){return n.removeEventListener(i,s,a)},l(),[c,u]),g=m[0],y=m[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(Ft);var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.1"):e}))}(String(e),t)}))}(_,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===Xt?new Error(Jt):e}(e)})).then((function(e){var t=e[0],n=e[1];return y(),t.load(__assign(__assign({},f),{ldi:{attempts:n,visibilityStates:g}}))}))}function V(e){return function o(e,t,n,i){var s,a=document,c="securitypolicyviolation",u2=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(s=t,R2())};a.addEventListener(c,u2);var R2=function(){return a.removeEventListener(c,u2)};return Promise.resolve().then(t).then((function(e){return R2(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(R2(),s)return n(s);throw e}))}))}(e,(function(){return t=e,new Promise((function(e,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(t){if(t instanceof Error&&"TypeError"===t.name)return!0;throw t}}(t))throw new Error(xt);var i=document.createElement("script"),o2=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},s=document.head||document.getElementsByTagName("head")[0];i.onload=function(){o2(),e()},i.onerror=function(){o2(),n(new Error(Jt))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error(Rt)})).then(k)}function k(){var e,t,n,i,s=window,a="__fpjs_p_l_b",c=s[a];if(e=s,t=a,(null==(i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t))?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0),"function"!=typeof(null==c?void 0:c.load))throw new Error(Xt);return c}var Zt={load:F,defaultScriptUrlPattern:Yt,ERROR_SCRIPT_LOAD_FAIL:Jt,ERROR_API_KEY_EXPIRED:Ut,ERROR_API_KEY_INVALID:qt,ERROR_API_KEY_MISSING:Ft,ERROR_BAD_REQUEST_FORMAT:jt,ERROR_BAD_RESPONSE_FORMAT:Mt,ERROR_CLIENT_TIMEOUT:Et,ERROR_CSP_BLOCK:Rt,ERROR_FORBIDDEN_ENDPOINT:Lt,ERROR_FORBIDDEN_HEADER:Vt,ERROR_FORBIDDEN_ORIGIN:zt,ERROR_GENERAL_SERVER_FAILURE:Bt,ERROR_INSTALLATION_METHOD_RESTRICTED:At,ERROR_INTEGRATION_FAILURE:Pt,ERROR_INVALID_ENDPOINT:xt,ERROR_NETWORK_ABORT:Ct,ERROR_NETWORK_CONNECTION:Ot,ERROR_RATE_LIMIT:Wt,ERROR_SERVER_TIMEOUT:$t,ERROR_SUBSCRIPTION_NOT_ACTIVE:Nt,ERROR_TOKEN_EXPIRED:Gt,ERROR_TOKEN_INVALID:Kt,ERROR_TOKEN_MISSING:Ht,ERROR_UNSUPPORTED_VERSION:Dt,ERROR_WRONG_REGION:Tt,defaultEndpoint:wt,defaultTlsEndpoint:It};const er=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:Ut,ERROR_API_KEY_INVALID:qt,ERROR_API_KEY_MISSING:Ft,ERROR_BAD_REQUEST_FORMAT:jt,ERROR_BAD_RESPONSE_FORMAT:Mt,ERROR_CLIENT_TIMEOUT:Et,ERROR_CSP_BLOCK:Rt,ERROR_FORBIDDEN_ENDPOINT:Lt,ERROR_FORBIDDEN_HEADER:Vt,ERROR_FORBIDDEN_ORIGIN:zt,ERROR_GENERAL_SERVER_FAILURE:Bt,ERROR_INSTALLATION_METHOD_RESTRICTED:At,ERROR_INTEGRATION_FAILURE:Pt,ERROR_INVALID_ENDPOINT:xt,ERROR_NETWORK_ABORT:Ct,ERROR_NETWORK_CONNECTION:Ot,ERROR_RATE_LIMIT:Wt,ERROR_SCRIPT_LOAD_FAIL:Jt,ERROR_SERVER_TIMEOUT:$t,ERROR_SUBSCRIPTION_NOT_ACTIVE:Nt,ERROR_TOKEN_EXPIRED:Gt,ERROR_TOKEN_INVALID:Kt,ERROR_TOKEN_MISSING:Ht,ERROR_UNSUPPORTED_VERSION:Dt,ERROR_WRONG_REGION:Tt,default:Zt,defaultEndpoint:wt,defaultScriptUrlPattern:Yt,defaultTlsEndpoint:It,load:F},Symbol.toStringTag,{value:"Module"})),tr="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(e){var t;this.tag=e.tag||null,this.linkedId=e.linkedId||null,this.extendedResult=null!==(t=e.extendedResult)&&void 0!==t&&t}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(e,t){return`${t}__${e}`}function removePrefixFromKey(e,t){return e.replace(`${t}__`,"")}class LocalStorageCache{constructor(e=tr){this.prefix=e}set(e,t){window.localStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.localStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){return}}remove(e){window.localStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class SessionStorageCache{constructor(e=tr){this.prefix=e}set(e,t){window.sessionStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.sessionStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){return}}remove(e){window.sessionStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.sessionStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class CacheManager{constructor(e,t=3600,n){this.cache=e,this.cacheTime=t,this.nowProvider=n||DEFAULT_NOW_PROVIDER}get(e){return __awaiter(this,void 0,void 0,(function*(){const t=yield this.cache.get(e.toKey());if(!t)return;const n=yield this.nowProvider(),i=Math.floor(n/1e3);if(!(t.expiresAt<i))return t.body;yield this.cache.remove(e.toKey())}))}set(e,t){return __awaiter(this,void 0,void 0,(function*(){const n=yield this.wrapCacheEntry(t);yield this.cache.set(e.toKey(),n)}))}clearCache(){return __awaiter(this,void 0,void 0,(function*(){const e=yield this.cache.allKeys();yield Promise.all(e.map((e=>this.cache.remove(e))))}))}wrapCacheEntry(e){return __awaiter(this,void 0,void 0,(function*(){const t=yield this.nowProvider(),n=Math.floor(t/1e3)+this.cacheTime;return{body:e,expiresAt:n}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var rr,nr;(nr=rr||(rr={})).Memory="memory",nr.LocalStorage="localstorage",nr.SessionStorage="sessionstorage",nr.NoCache="nocache";const or={[rr.Memory]:()=>(new InMemoryCache).enclosedCache,[rr.LocalStorage]:e=>new LocalStorageCache(e),[rr.SessionStorage]:e=>new SessionStorageCache(e),[rr.NoCache]:()=>new CacheStub},cacheFactory=e=>or[e];class FpjsClient{constructor(e){var t;let n;if(this.inFlightRequests=new Map,this.agentPromise=null,this.customAgent=null==e?void 0:e.customAgent,this.agent={get:()=>{throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.")}},this.loadOptions=null==e?void 0:e.loadOptions,(null==e?void 0:e.cache)&&(null==e?void 0:e.cacheLocation)&&console.warn("Both `cache` and `cacheLocation` options have been specified in the FpjsClient configuration; ignoring `cacheLocation` and using `cache`."),null==e?void 0:e.cache)n=e.cache;else{if(this.cacheLocation=(null==e?void 0:e.cacheLocation)||rr.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case rr.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case rr.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=rr.Memory),n=cacheFactory(this.cacheLocation)(null==e?void 0:e.cachePrefix)}if((null==e?void 0:e.cacheTimeInSeconds)&&e.cacheTimeInSeconds>86400)throw new Error("Cache time cannot exceed 86400 seconds (24 hours)");const i=null!==(t=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==t?t:3600;this.cacheManager=new CacheManager(n,i)}init(e){return __awaiter(this,void 0,void 0,(function*(){var t,n;if(!this.loadOptions&&!e)throw new TypeError("No load options provided");const i=Object.assign(Object.assign(Object.assign({},this.loadOptions),e),{integrationInfo:[...(null===(t=this.loadOptions)||void 0===t?void 0:t.integrationInfo)||[],...(null==e?void 0:e.integrationInfo)||[],"fingerprintjs-pro-spa/1.3.2"]});if(!this.agentPromise){const e=null!==(n=this.customAgent)&&void 0!==n?n:er;this.agentPromise=e.load(i).then((e=>(this.agent=e,e))).catch((e=>{throw this.agentPromise=null,e}))}return this.agentPromise}))}getVisitorData(){return __awaiter(this,arguments,void 0,(function*(e={},t=!1){const n=FpjsClient.makeCacheKey(e).toKey();if(!this.inFlightRequests.has(n)){const i=this._identify(e,t).finally((()=>{this.inFlightRequests.delete(n)}));this.inFlightRequests.set(n,i)}return yield this.inFlightRequests.get(n)}))}getVisitorDataFromCache(){return __awaiter(this,arguments,void 0,(function*(e={}){const t=FpjsClient.makeCacheKey(e),n=yield this.cacheManager.get(t);return n?Object.assign(Object.assign({},n),{cacheHit:!0}):void 0}))}isInCache(){return __awaiter(this,arguments,void 0,(function*(e={}){return Boolean(yield this.getVisitorDataFromCache(e))}))}clearCache(){return __awaiter(this,void 0,void 0,(function*(){yield this.cacheManager.clearCache()}))}static makeCacheKey(e){return new CacheKey(e)}_identify(e){return __awaiter(this,arguments,void 0,(function*(e,t=!1){const n=FpjsClient.makeCacheKey(e);if(!t){const e=yield this.cacheManager.get(n);if(e)return Object.assign(Object.assign({},e),{cacheHit:!0})}const i=yield this.agent.get(e);return yield this.cacheManager.set(n,i),Object.assign(Object.assign({},i),{cacheHit:!1})}))}}const ir="default_fingerprint_cache",sr=7,getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=ir}=window.fingerprintConfig;try{const t=JSON.parse(localStorage.getItem(e)||"null");return t&&t.expiresAt>Date.now()?t.fingerprint:(localStorage.removeItem(e),null)}catch{return null}},setCachedFingerprint=e=>{const{cacheName:t=ir,cacheTimeInDays:n=sr}=window.fingerprintConfig,i={fingerprint:e,expiresAt:getExpirationDate(n)};localStorage.setItem(t,JSON.stringify(i))};async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const t=getCachedFingerprint();if(t)return t;if(e)return"";if(!function isFingerprintReady(){return void 0!==window.fpClient}())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:t}=await e.getVisitorData();return setCachedFingerprint(t),t}catch(ee){throw console.error("Error retrieving fingerprint:",ee),ee}}const ar=["Track Test"];async function trackEvent(e,t){if(!function isMixpanelReady(){return void 0!==window.mixpanel}())throw new Error("Mixpanel is not initialized.");try{const n=!ar.includes(e),i=await getFingerprint(n),s={...{"User Fingerprint":i},...t};kt.track(e,s)}catch(ee){throw console.error("Error tracking event:",ee),ee}}function trackTest(){trackEvent("Track Test",{})}async function init(e){!function validateConfig(e){if(!e.mixpanelToken)throw new Error("mixpanelToken is required");if(!e.identificationKey)throw new Error("identificationKey is required")}(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i}=e;await function initMixpanel(e,t=!1){return new Promise((n=>{kt.init(e,{debug:t,loaded:()=>{window.mixpanel=kt,n()}})}))}(t,n);try{await async function initFingerprint(e){window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e}});try{await window.fpClient.init()}catch(ee){throw console.error("Error initializing identification service:",ee),ee}}(i)}catch(ee){console.error("Error initializing identification service:",ee)}!function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()}const cr={init:init,trackTest:trackTest};return e.default=cr,e.init=init,e.trackTest=trackTest,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),e}({});
|
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reservamos/browser-analytics",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/reservamos/reservamos-browser-analytics.git"
|
|
7
|
+
},
|
|
8
|
+
"main": "./dist/reservamos-browser-analytics.cjs",
|
|
9
|
+
"module": "./dist/reservamos-browser-analytics.esm.js",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@eslint/js": "^9.9.1",
|
|
12
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
|
13
|
+
"@types/eslint__js": "^8.42.3",
|
|
14
|
+
"@types/jsdom": "^21.1.6",
|
|
15
|
+
"@types/mixpanel-browser": "^2.50.0",
|
|
16
|
+
"@types/node": "^20.11.5",
|
|
17
|
+
"@vitest/coverage-v8": "^1.2.1",
|
|
18
|
+
"dts-bundle-generator": "^9.2.4",
|
|
19
|
+
"eslint": "^9.9.1",
|
|
20
|
+
"eslint-config-prettier": "^9.1.0",
|
|
21
|
+
"eslint-plugin-jsdoc": "^50.2.3",
|
|
22
|
+
"jsdom": "^24.1.0",
|
|
23
|
+
"lint-staged": "^15.2.0",
|
|
24
|
+
"np": "^10.0.6",
|
|
25
|
+
"prettier": "^3.2.4",
|
|
26
|
+
"terser": "^5.31.1",
|
|
27
|
+
"ts-node": "^10.9.2",
|
|
28
|
+
"typescript": "^5.5.4",
|
|
29
|
+
"typescript-eslint": "^8.4.0",
|
|
30
|
+
"upgradeps": "^2.0.6",
|
|
31
|
+
"vite": "^5.0.12",
|
|
32
|
+
"vitest": "^1.2.1"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"require": "./dist/browser-analytics.cjs",
|
|
37
|
+
"import": "./dist/browser-analytics.esm.js",
|
|
38
|
+
"types": "./dist/browser-analytics.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./dist/": {
|
|
41
|
+
"import": "./dist/",
|
|
42
|
+
"require": "./dist/",
|
|
43
|
+
"types": "./dist/"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/reservamos/reservamos-browser-analytics/issues"
|
|
48
|
+
},
|
|
49
|
+
"description": "Library to track user interactions in the browser using Reservamos event taxonomy",
|
|
50
|
+
"files": [
|
|
51
|
+
"dist",
|
|
52
|
+
"README.md",
|
|
53
|
+
"LICENSE.md",
|
|
54
|
+
"CHANGELOG.md",
|
|
55
|
+
"src",
|
|
56
|
+
"package.json"
|
|
57
|
+
],
|
|
58
|
+
"homepage": "https://github.com/reservamos/reservamos-browser-analytics#readme",
|
|
59
|
+
"jsdelivr": "./dist/reservamos-browser-analytics.iife.js",
|
|
60
|
+
"keywords": [
|
|
61
|
+
"analytics",
|
|
62
|
+
"browser"
|
|
63
|
+
],
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"private": false,
|
|
66
|
+
"scripts": {
|
|
67
|
+
"dev": "vite --host",
|
|
68
|
+
"prebuild": "rm -rf dist/*",
|
|
69
|
+
"build": "tsc && vite build",
|
|
70
|
+
"postbuild": "dts-bundle-generator --config ./dts-bundle-generator.config.ts",
|
|
71
|
+
"test": "vitest",
|
|
72
|
+
"test:coverage": "vitest --coverage",
|
|
73
|
+
"format": "prettier . --write",
|
|
74
|
+
"upgrade": "upgradeps",
|
|
75
|
+
"release": "npm run build && np"
|
|
76
|
+
},
|
|
77
|
+
"type": "module",
|
|
78
|
+
"types": "./dist/reservamos-browser-analytics.d.ts",
|
|
79
|
+
"typesVersions": {
|
|
80
|
+
"*": {
|
|
81
|
+
"*": [
|
|
82
|
+
"./dist/reservamos-browser-analytics.d.ts"
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"typings": "./dist/reservamos-browser-analytics.d.ts",
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"@fingerprintjs/fingerprintjs-pro-spa": "^1.3.2",
|
|
89
|
+
"mixpanel-browser": "^2.55.1"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { trackEvent } from '../track';
|
|
2
|
+
|
|
3
|
+
const EVENT_NAME = 'Track Test';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
First test event to track, it purpose is to test the tracking library and the identification service.ws
|
|
7
|
+
*/
|
|
8
|
+
export function trackTest() {
|
|
9
|
+
trackEvent(EVENT_NAME, {});
|
|
10
|
+
}
|