mixpanel-browser 2.61.0 → 2.61.2
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 +11 -0
- package/dist/mixpanel-core.cjs.js +2 -3
- package/dist/mixpanel-recorder.js +62 -42
- package/dist/mixpanel-recorder.min.js +6 -6
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +2 -3
- package/dist/mixpanel.amd.js +62 -43
- package/dist/mixpanel.cjs.js +62 -43
- package/dist/mixpanel.globals.js +2 -3
- package/dist/mixpanel.min.js +58 -58
- package/dist/mixpanel.module.js +62 -43
- package/dist/mixpanel.umd.js +62 -43
- package/package.json +1 -1
- package/src/config.js +1 -1
- package/src/mixpanel-core.js +0 -1
- package/src/recorder/session-recording.js +60 -40
- package/src/storage/indexed-db.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(){"use strict";var R;if(typeof window>"u"){var Pt={hostname:""};R={navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:Pt,referrer:""},screen:{width:0,height:0},location:Pt,addEventListener:function(){},removeEventListener:function(){}}}else R=window;var P;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(P||(P={}));function Jr(e){return e.nodeType===e.ELEMENT_NODE}function Ee(e){const t=e?.host;return t?.shadowRoot===e}function Re(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Xr(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}function Kr(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function ze(e){try{const t=e.rules||e.cssRules;return t?Xr(Array.from(t,Ft).join("")):null}catch{return null}}function Ft(e){let t;if(Yr(e))try{t=ze(e.styleSheet)||Kr(e)}catch{}else if(Zr(e)&&e.selectorText.includes(":"))return Qr(e.cssText);return t||e.cssText}function Qr(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Yr(e){return"styleSheet"in e}function Zr(e){return"selectorText"in e}class Bt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){var r;if(!t)return-1;const n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){const n=this.getNode(t);if(n){const i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function en(){return new Bt}function dt({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"";const u=n&&ce(n);return(t[r.toLowerCase()]||u&&t[u])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function ce(e){return e.toLowerCase()}const Ut="__rrweb_original__";function tn(e){const t=e.getContext("2d");if(!t)return!0;const r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){const o=t.getImageData,s=Ut in o?o[Ut]:o;if(new Uint32Array(s.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function ft(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ce(t):null}function Wt(e,t){var r;let n;try{n=new URL(e,t??window.location.href)}catch{return null}const i=/\.([0-9a-z]+)(?:$)/i,o=n.pathname.match(i);return(r=o?.[1])!==null&&r!==void 0?r:null}let rn=1;const nn=new RegExp("[^a-z0-9-_:]"),Oe=-2;function qt(){return rn++}function on(e){if(e instanceof HTMLFormElement)return"form";const t=ce(e.tagName);return nn.test(t)?"div":t}function sn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let ye,zt;const an=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,un=/^(?:[a-z+]+:)?\/\//i,cn=/^www\..*/i,ln=/^(data:)([^,]*),(.*)/i;function $e(e,t){return(e||"").replace(an,(r,n,i,o,s,u)=>{const a=i||s||u,d=n||o||"";if(!a)return r;if(un.test(a)||cn.test(a))return`url(${d}${a}${d})`;if(ln.test(a))return`url(${d}${a}${d})`;if(a[0]==="/")return`url(${d}${sn(t)+a}${d})`;const l=t.split("/"),f=a.split("/");l.pop();for(const p of f)p!=="."&&(p===".."?l.pop():l.push(p));return`url(${d}${l.join("/")}${d})`})}const dn=/^[^ \t\n\r\u000c]+/,fn=/^[, \t\n\r\u000c]+/;function hn(e,t){if(t.trim()==="")return t;let r=0;function n(o){let s;const u=o.exec(t.substring(r));return u?(s=u[0],r+=s.length,s):""}const i=[];for(;n(fn),!(r>=t.length);){let o=n(dn);if(o.slice(-1)===",")o=ve(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=ve(e,o);let u=!1;for(;;){const a=t.charAt(r);if(a===""){i.push((o+s).trim());break}else if(u)a===")"&&(u=!1);else if(a===","){r+=1,i.push((o+s).trim());break}else a==="("&&(u=!0);s+=a,r+=1}}}return i.join(", ")}function ve(e,t){if(!t||t.trim()==="")return t;const r=e.createElement("a");return r.href=t,r.href}function pn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function ht(){const e=document.createElement("a");return e.href="",e.href}function $t(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?ve(e,n):r==="srcset"?hn(e,n):r==="style"?$e(n,ht()):t==="object"&&r==="data"?ve(e,n):n)}function Ht(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function mn(e,t,r){try{if(typeof t=="string"){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(r)return e.matches(r)}catch{}return!1}function He(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?He(e.parentNode,t,r):!1;for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}return r?He(e.parentNode,t,r):!1}function jt(e,t,r,n){try{const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(i===null)return!1;if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(He(i,t,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function gn(e,t,r){const n=e.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){const u=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(u),i=!0,t()});return}const s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function yn(e,t,r){let n=!1,i;try{i=e.sheet}catch{return}if(i)return;const o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function vn(e,t){const{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:u,maskInputOptions:a={},maskTextFn:d,maskInputFn:l,dataURLOptions:f={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:g,newlyAddedElement:m=!1}=t,v=Sn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:P.Document,childNodes:[],compatMode:e.compatMode}:{type:P.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:P.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return wn(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:a,maskInputFn:l,dataURLOptions:f,inlineImages:p,recordCanvas:h,keepIframeSrcFn:g,newlyAddedElement:m,rootId:v});case e.TEXT_NODE:return bn(e,{needsMask:s,maskTextFn:d,rootId:v});case e.CDATA_SECTION_NODE:return{type:P.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:P.Comment,textContent:e.textContent||"",rootId:v};default:return!1}}function Sn(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return r===1?void 0:r}function bn(e,t){var r;const{needsMask:n,maskTextFn:i,rootId:o}=t,s=e.parentNode&&e.parentNode.tagName;let u=e.textContent;const a=s==="STYLE"?!0:void 0,d=s==="SCRIPT"?!0:void 0;if(a&&u){try{e.nextSibling||e.previousSibling||!((r=e.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(u=ze(e.parentNode.sheet))}catch(l){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${l}`,e)}u=$e(u,ht())}return d&&(u="SCRIPT_PLACEHOLDER"),!a&&!d&&u&&n&&(u=i?i(u,e.parentElement):u.replace(/[\S]/g,"*")),{type:P.Text,textContent:u||"",isStyle:a,rootId:o}}function wn(e,t){const{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:u,dataURLOptions:a={},inlineImages:d,recordCanvas:l,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:h}=t,g=mn(e,n,i),m=on(e);let v={};const w=e.attributes.length;for(let y=0;y<w;y++){const S=e.attributes[y];Ht(m,S.name,S.value)||(v[S.name]=$t(r,m,ce(S.name),S.value))}if(m==="link"&&o){const y=Array.from(r.styleSheets).find(I=>I.href===e.href);let S=null;y&&(S=ze(y)),S&&(delete v.rel,delete v.href,v._cssText=$e(S,y.href))}if(m==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const y=ze(e.sheet);y&&(v._cssText=$e(y,ht()))}if(m==="input"||m==="textarea"||m==="select"){const y=e.value,S=e.checked;v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&y?v.value=dt({element:e,type:ft(e),tagName:m,value:y,maskInputOptions:s,maskInputFn:u}):S&&(v.checked=S)}if(m==="option"&&(e.selected&&!s.select?v.selected=!0:delete v.selected),m==="canvas"&&l){if(e.__context==="2d")tn(e)||(v.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){const y=e.toDataURL(a.type,a.quality),S=document.createElement("canvas");S.width=e.width,S.height=e.height;const I=S.toDataURL(a.type,a.quality);y!==I&&(v.rr_dataURL=y)}}if(m==="img"&&d){ye||(ye=r.createElement("canvas"),zt=ye.getContext("2d"));const y=e,S=y.crossOrigin;y.crossOrigin="anonymous";const I=()=>{y.removeEventListener("load",I);try{ye.width=y.naturalWidth,ye.height=y.naturalHeight,zt.drawImage(y,0,0),v.rr_dataURL=ye.toDataURL(a.type,a.quality)}catch(U){console.warn(`Cannot inline img src=${y.currentSrc}! Error: ${U}`)}S?v.crossOrigin=S:y.removeAttribute("crossorigin")};y.complete&&y.naturalWidth!==0?I():y.addEventListener("load",I)}if(m==="audio"||m==="video"){const y=v;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),g){const{width:y,height:S}=e.getBoundingClientRect();v={class:v.class,rr_width:`${y}px`,rr_height:`${S}px`}}m==="iframe"&&!f(v.src)&&(e.contentDocument||(v.rr_src=v.src),delete v.src);let b;try{customElements.get(m)&&(b=!0)}catch{}return{type:P.Element,tagName:m,attributes:v,childNodes:[],isSVG:pn(e)||void 0,needBlock:g,rootId:h,isCustom:b}}function T(e){return e==null?"":e.toLowerCase()}function In(e,t){if(t.comment&&e.type===P.Comment)return!0;if(e.type===P.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Wt(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(T(e.attributes.name).match(/^msapplication-tile(image|color)$/)||T(e.attributes.name)==="application-name"||T(e.attributes.rel)==="icon"||T(e.attributes.rel)==="apple-touch-icon"||T(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&T(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(T(e.attributes.property).match(/^(og|twitter|fb):/)||T(e.attributes.name).match(/^(og|twitter):/)||T(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(T(e.attributes.name)==="robots"||T(e.attributes.name)==="googlebot"||T(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(T(e.attributes.name)==="author"||T(e.attributes.name)==="generator"||T(e.attributes.name)==="framework"||T(e.attributes.name)==="publisher"||T(e.attributes.name)==="progid"||T(e.attributes.property).match(/^article:/)||T(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(T(e.attributes.name)==="google-site-verification"||T(e.attributes.name)==="yandex-verification"||T(e.attributes.name)==="csrf-token"||T(e.attributes.name)==="p:domain_verify"||T(e.attributes.name)==="verify-v1"||T(e.attributes.name)==="verification"||T(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Se(e,t){const{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:u,skipChild:a=!1,inlineStylesheet:d=!0,maskInputOptions:l={},maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:v=!1,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y=5e3,onStylesheetLoad:S,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:U=()=>!1,newlyAddedElement:B=!1}=t;let{needsMask:k}=t,{preserveWhiteSpace:N=!0}=t;!k&&e.childNodes&&(k=jt(e,s,u,k===void 0));const V=vn(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:k,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,dataURLOptions:g,inlineImages:m,recordCanvas:v,keepIframeSrcFn:U,newlyAddedElement:B});if(!V)return console.warn(e,"not serialized"),null;let J;n.hasNode(e)?J=n.getId(e):In(V,h)||!N&&V.type===P.Text&&!V.isStyle&&!V.textContent.replace(/^\s+|\s+$/gm,"").length?J=Oe:J=qt();const x=Object.assign(V,{id:J});if(n.add(e,x),J===Oe)return null;w&&w(e);let he=!a;if(x.type===P.Element){he=he&&!x.needBlock,delete x.needBlock;const $=e.shadowRoot;$&&Re($)&&(x.isShadowHost=!0)}if((x.type===P.Document||x.type===P.Element)&&he){h.headWhitespace&&x.type===P.Element&&x.tagName==="head"&&(N=!1);const $={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:a,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g,inlineImages:m,recordCanvas:v,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:U};if(!(x.type===P.Element&&x.tagName==="textarea"&&x.attributes.value!==void 0))for(const ue of Array.from(e.childNodes)){const te=Se(ue,$);te&&x.childNodes.push(te)}if(Jr(e)&&e.shadowRoot)for(const ue of Array.from(e.shadowRoot.childNodes)){const te=Se(ue,$);te&&(Re(e.shadowRoot)&&(te.isShadow=!0),x.childNodes.push(te))}}return e.parentNode&&Ee(e.parentNode)&&Re(e.parentNode)&&(x.isShadow=!0),x.type===P.Element&&x.tagName==="iframe"&&gn(e,()=>{const $=e.contentDocument;if($&&b){const ue=Se($,{doc:$,mirror:n,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g,inlineImages:m,recordCanvas:v,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:U});ue&&b(e,ue)}},y),x.type===P.Element&&x.tagName==="link"&&typeof x.attributes.rel=="string"&&(x.attributes.rel==="stylesheet"||x.attributes.rel==="preload"&&typeof x.attributes.href=="string"&&Wt(x.attributes.href)==="css")&&yn(e,()=>{if(S){const $=Se(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g,inlineImages:m,recordCanvas:v,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:U});$&&S(e,$)}},I),x}function Mn(e,t){const{mirror:r=new Bt,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:u=!0,inlineImages:a=!1,recordCanvas:d=!1,maskAllInputs:l=!1,maskTextFn:f,maskInputFn:p,slimDOM:h=!1,dataURLOptions:g,preserveWhiteSpace:m,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:S,keepIframeSrcFn:I=()=>!1}=t||{};return Se(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:u,maskInputOptions:l===!0?{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}:l===!1?{password:!0}:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:h==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:h===!1?{}:h,dataURLOptions:g,inlineImages:a,recordCanvas:d,preserveWhiteSpace:m,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:S,keepIframeSrcFn:I,newlyAddedElement:!1})}function q(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const be=`Please stop import mirror directly. Instead of that,\r
|
|
1
|
+
(function(){"use strict";var R;if(typeof window>"u"){var Ft={hostname:""};R={navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:Ft,referrer:""},screen:{width:0,height:0},location:Ft,addEventListener:function(){},removeEventListener:function(){}}}else R=window;var P;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(P||(P={}));function Vr(e){return e.nodeType===e.ELEMENT_NODE}function Ee(e){const t=e?.host;return t?.shadowRoot===e}function Re(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Jr(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}function Xr(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function ze(e){try{const t=e.rules||e.cssRules;return t?Jr(Array.from(t,Bt).join("")):null}catch{return null}}function Bt(e){let t;if(Qr(e))try{t=ze(e.styleSheet)||Xr(e)}catch{}else if(Yr(e)&&e.selectorText.includes(":"))return Kr(e.cssText);return t||e.cssText}function Kr(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Qr(e){return"styleSheet"in e}function Yr(e){return"selectorText"in e}class Ut{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){var r;if(!t)return-1;const n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){const n=this.getNode(t);if(n){const i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(r,i)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Zr(){return new Ut}function dt({element:e,maskInputOptions:t,tagName:r,type:n,value:i,maskInputFn:o}){let s=i||"";const u=n&&ce(n);return(t[r.toLowerCase()]||u&&t[u])&&(o?s=o(s,e):s="*".repeat(s.length)),s}function ce(e){return e.toLowerCase()}const Wt="__rrweb_original__";function en(e){const t=e.getContext("2d");if(!t)return!0;const r=50;for(let n=0;n<e.width;n+=r)for(let i=0;i<e.height;i+=r){const o=t.getImageData,s=Wt in o?o[Wt]:o;if(new Uint32Array(s.call(t,n,i,Math.min(r,e.width-n),Math.min(r,e.height-i)).data.buffer).some(a=>a!==0))return!1}return!0}function ft(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ce(t):null}function qt(e,t){var r;let n;try{n=new URL(e,t??window.location.href)}catch{return null}const i=/\.([0-9a-z]+)(?:$)/i,o=n.pathname.match(i);return(r=o?.[1])!==null&&r!==void 0?r:null}let tn=1;const rn=new RegExp("[^a-z0-9-_:]"),Oe=-2;function zt(){return tn++}function nn(e){if(e instanceof HTMLFormElement)return"form";const t=ce(e.tagName);return rn.test(t)?"div":t}function on(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let ye,$t;const sn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,an=/^(?:[a-z+]+:)?\/\//i,un=/^www\..*/i,cn=/^(data:)([^,]*),(.*)/i;function $e(e,t){return(e||"").replace(sn,(r,n,i,o,s,u)=>{const a=i||s||u,d=n||o||"";if(!a)return r;if(an.test(a)||un.test(a))return`url(${d}${a}${d})`;if(cn.test(a))return`url(${d}${a}${d})`;if(a[0]==="/")return`url(${d}${on(t)+a}${d})`;const l=t.split("/"),f=a.split("/");l.pop();for(const p of f)p!=="."&&(p===".."?l.pop():l.push(p));return`url(${d}${l.join("/")}${d})`})}const ln=/^[^ \t\n\r\u000c]+/,dn=/^[, \t\n\r\u000c]+/;function fn(e,t){if(t.trim()==="")return t;let r=0;function n(o){let s;const u=o.exec(t.substring(r));return u?(s=u[0],r+=s.length,s):""}const i=[];for(;n(dn),!(r>=t.length);){let o=n(ln);if(o.slice(-1)===",")o=ve(e,o.substring(0,o.length-1)),i.push(o);else{let s="";o=ve(e,o);let u=!1;for(;;){const a=t.charAt(r);if(a===""){i.push((o+s).trim());break}else if(u)a===")"&&(u=!1);else if(a===","){r+=1,i.push((o+s).trim());break}else a==="("&&(u=!0);s+=a,r+=1}}}return i.join(", ")}function ve(e,t){if(!t||t.trim()==="")return t;const r=e.createElement("a");return r.href=t,r.href}function hn(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function ht(){const e=document.createElement("a");return e.href="",e.href}function Ht(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?ve(e,n):r==="srcset"?fn(e,n):r==="style"?$e(n,ht()):t==="object"&&r==="data"?ve(e,n):n)}function jt(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function pn(e,t,r){try{if(typeof t=="string"){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(r)return e.matches(r)}catch{}return!1}function He(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?He(e.parentNode,t,r):!1;for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}return r?He(e.parentNode,t,r):!1}function Gt(e,t,r,n){try{const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(i===null)return!1;if(typeof t=="string"){if(n){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(He(i,t,n))return!0;if(r){if(n){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function mn(e,t,r){const n=e.contentWindow;if(!n)return;let i=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){const u=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(u),i=!0,t()});return}const s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function gn(e,t,r){let n=!1,i;try{i=e.sheet}catch{return}if(i)return;const o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function yn(e,t){const{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:s,inlineStylesheet:u,maskInputOptions:a={},maskTextFn:d,maskInputFn:l,dataURLOptions:f={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:g,newlyAddedElement:m=!1}=t,v=vn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:P.Document,childNodes:[],compatMode:e.compatMode}:{type:P.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:P.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return bn(e,{doc:r,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:a,maskInputFn:l,dataURLOptions:f,inlineImages:p,recordCanvas:h,keepIframeSrcFn:g,newlyAddedElement:m,rootId:v});case e.TEXT_NODE:return Sn(e,{needsMask:s,maskTextFn:d,rootId:v});case e.CDATA_SECTION_NODE:return{type:P.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:P.Comment,textContent:e.textContent||"",rootId:v};default:return!1}}function vn(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return r===1?void 0:r}function Sn(e,t){var r;const{needsMask:n,maskTextFn:i,rootId:o}=t,s=e.parentNode&&e.parentNode.tagName;let u=e.textContent;const a=s==="STYLE"?!0:void 0,d=s==="SCRIPT"?!0:void 0;if(a&&u){try{e.nextSibling||e.previousSibling||!((r=e.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(u=ze(e.parentNode.sheet))}catch(l){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${l}`,e)}u=$e(u,ht())}return d&&(u="SCRIPT_PLACEHOLDER"),!a&&!d&&u&&n&&(u=i?i(u,e.parentElement):u.replace(/[\S]/g,"*")),{type:P.Text,textContent:u||"",isStyle:a,rootId:o}}function bn(e,t){const{doc:r,blockClass:n,blockSelector:i,inlineStylesheet:o,maskInputOptions:s={},maskInputFn:u,dataURLOptions:a={},inlineImages:d,recordCanvas:l,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:h}=t,g=pn(e,n,i),m=nn(e);let v={};const w=e.attributes.length;for(let y=0;y<w;y++){const S=e.attributes[y];jt(m,S.name,S.value)||(v[S.name]=Ht(r,m,ce(S.name),S.value))}if(m==="link"&&o){const y=Array.from(r.styleSheets).find(I=>I.href===e.href);let S=null;y&&(S=ze(y)),S&&(delete v.rel,delete v.href,v._cssText=$e(S,y.href))}if(m==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const y=ze(e.sheet);y&&(v._cssText=$e(y,ht()))}if(m==="input"||m==="textarea"||m==="select"){const y=e.value,S=e.checked;v.type!=="radio"&&v.type!=="checkbox"&&v.type!=="submit"&&v.type!=="button"&&y?v.value=dt({element:e,type:ft(e),tagName:m,value:y,maskInputOptions:s,maskInputFn:u}):S&&(v.checked=S)}if(m==="option"&&(e.selected&&!s.select?v.selected=!0:delete v.selected),m==="canvas"&&l){if(e.__context==="2d")en(e)||(v.rr_dataURL=e.toDataURL(a.type,a.quality));else if(!("__context"in e)){const y=e.toDataURL(a.type,a.quality),S=document.createElement("canvas");S.width=e.width,S.height=e.height;const I=S.toDataURL(a.type,a.quality);y!==I&&(v.rr_dataURL=y)}}if(m==="img"&&d){ye||(ye=r.createElement("canvas"),$t=ye.getContext("2d"));const y=e,S=y.crossOrigin;y.crossOrigin="anonymous";const I=()=>{y.removeEventListener("load",I);try{ye.width=y.naturalWidth,ye.height=y.naturalHeight,$t.drawImage(y,0,0),v.rr_dataURL=ye.toDataURL(a.type,a.quality)}catch(U){console.warn(`Cannot inline img src=${y.currentSrc}! Error: ${U}`)}S?v.crossOrigin=S:y.removeAttribute("crossorigin")};y.complete&&y.naturalWidth!==0?I():y.addEventListener("load",I)}if(m==="audio"||m==="video"){const y=v;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(v.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(v.rr_scrollTop=e.scrollTop)),g){const{width:y,height:S}=e.getBoundingClientRect();v={class:v.class,rr_width:`${y}px`,rr_height:`${S}px`}}m==="iframe"&&!f(v.src)&&(e.contentDocument||(v.rr_src=v.src),delete v.src);let b;try{customElements.get(m)&&(b=!0)}catch{}return{type:P.Element,tagName:m,attributes:v,childNodes:[],isSVG:hn(e)||void 0,needBlock:g,rootId:h,isCustom:b}}function T(e){return e==null?"":e.toLowerCase()}function wn(e,t){if(t.comment&&e.type===P.Comment)return!0;if(e.type===P.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&qt(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(T(e.attributes.name).match(/^msapplication-tile(image|color)$/)||T(e.attributes.name)==="application-name"||T(e.attributes.rel)==="icon"||T(e.attributes.rel)==="apple-touch-icon"||T(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&T(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(T(e.attributes.property).match(/^(og|twitter|fb):/)||T(e.attributes.name).match(/^(og|twitter):/)||T(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(T(e.attributes.name)==="robots"||T(e.attributes.name)==="googlebot"||T(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(T(e.attributes.name)==="author"||T(e.attributes.name)==="generator"||T(e.attributes.name)==="framework"||T(e.attributes.name)==="publisher"||T(e.attributes.name)==="progid"||T(e.attributes.property).match(/^article:/)||T(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(T(e.attributes.name)==="google-site-verification"||T(e.attributes.name)==="yandex-verification"||T(e.attributes.name)==="csrf-token"||T(e.attributes.name)==="p:domain_verify"||T(e.attributes.name)==="verify-v1"||T(e.attributes.name)==="verification"||T(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Se(e,t){const{doc:r,mirror:n,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:u,skipChild:a=!1,inlineStylesheet:d=!0,maskInputOptions:l={},maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:v=!1,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y=5e3,onStylesheetLoad:S,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:U=()=>!1,newlyAddedElement:B=!1}=t;let{needsMask:k}=t,{preserveWhiteSpace:N=!0}=t;!k&&e.childNodes&&(k=Gt(e,s,u,k===void 0));const V=yn(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:k,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,dataURLOptions:g,inlineImages:m,recordCanvas:v,keepIframeSrcFn:U,newlyAddedElement:B});if(!V)return console.warn(e,"not serialized"),null;let J;n.hasNode(e)?J=n.getId(e):wn(V,h)||!N&&V.type===P.Text&&!V.isStyle&&!V.textContent.replace(/^\s+|\s+$/gm,"").length?J=Oe:J=zt();const x=Object.assign(V,{id:J});if(n.add(e,x),J===Oe)return null;w&&w(e);let he=!a;if(x.type===P.Element){he=he&&!x.needBlock,delete x.needBlock;const $=e.shadowRoot;$&&Re($)&&(x.isShadowHost=!0)}if((x.type===P.Document||x.type===P.Element)&&he){h.headWhitespace&&x.type===P.Element&&x.tagName==="head"&&(N=!1);const $={doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:a,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g,inlineImages:m,recordCanvas:v,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:U};if(!(x.type===P.Element&&x.tagName==="textarea"&&x.attributes.value!==void 0))for(const ue of Array.from(e.childNodes)){const te=Se(ue,$);te&&x.childNodes.push(te)}if(Vr(e)&&e.shadowRoot)for(const ue of Array.from(e.shadowRoot.childNodes)){const te=Se(ue,$);te&&(Re(e.shadowRoot)&&(te.isShadow=!0),x.childNodes.push(te))}}return e.parentNode&&Ee(e.parentNode)&&Re(e.parentNode)&&(x.isShadow=!0),x.type===P.Element&&x.tagName==="iframe"&&mn(e,()=>{const $=e.contentDocument;if($&&b){const ue=Se($,{doc:$,mirror:n,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g,inlineImages:m,recordCanvas:v,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:U});ue&&b(e,ue)}},y),x.type===P.Element&&x.tagName==="link"&&typeof x.attributes.rel=="string"&&(x.attributes.rel==="stylesheet"||x.attributes.rel==="preload"&&typeof x.attributes.href=="string"&&qt(x.attributes.href)==="css")&&gn(e,()=>{if(S){const $=Se(e,{doc:r,mirror:n,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h,dataURLOptions:g,inlineImages:m,recordCanvas:v,preserveWhiteSpace:N,onSerialize:w,onIframeLoad:b,iframeLoadTimeout:y,onStylesheetLoad:S,stylesheetLoadTimeout:I,keepIframeSrcFn:U});$&&S(e,$)}},I),x}function In(e,t){const{mirror:r=new Ut,blockClass:n="rr-block",blockSelector:i=null,maskTextClass:o="rr-mask",maskTextSelector:s=null,inlineStylesheet:u=!0,inlineImages:a=!1,recordCanvas:d=!1,maskAllInputs:l=!1,maskTextFn:f,maskInputFn:p,slimDOM:h=!1,dataURLOptions:g,preserveWhiteSpace:m,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:S,keepIframeSrcFn:I=()=>!1}=t||{};return Se(e,{doc:e,mirror:r,blockClass:n,blockSelector:i,maskTextClass:o,maskTextSelector:s,skipChild:!1,inlineStylesheet:u,maskInputOptions:l===!0?{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}:l===!1?{password:!0}:l,maskTextFn:f,maskInputFn:p,slimDOMOptions:h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:h==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:h===!1?{}:h,dataURLOptions:g,inlineImages:a,recordCanvas:d,preserveWhiteSpace:m,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:y,stylesheetLoadTimeout:S,keepIframeSrcFn:I,newlyAddedElement:!1})}function q(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}const be=`Please stop import mirror directly. Instead of that,\r
|
|
2
2
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
3
|
-
or you can use record.mirror to access the mirror instance during recording.`;let Gt={map:{},getId(){return console.error(be),-1},getNode(){return console.error(be),null},removeNodeFromMap(){console.error(be)},has(){return console.error(be),!1},reset(){console.error(be)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Gt=new Proxy(Gt,{get(e,t,r){return t==="map"&&console.error(be),Reflect.get(e,t,r)}}));function xe(e,t,r={}){let n=null,i=0;return function(...o){const s=Date.now();!i&&r.leading===!1&&(i=s);const u=t-(s-i),a=this;u<=0||u>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(a,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,e.apply(a,o)},u))}}function je(e,t,r,n,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>je(e,t,o||{},!0)}function we(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}let Ge=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ge=()=>new Date().getTime());function Vt(e){var t,r,n,i,o,s;const u=e.document;return{left:u.scrollingElement?u.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:u?.documentElement.scrollLeft||((r=(t=u?.body)===null||t===void 0?void 0:t.parentElement)===null||r===void 0?void 0:r.scrollLeft)||((n=u?.body)===null||n===void 0?void 0:n.scrollLeft)||0,top:u.scrollingElement?u.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:u?.documentElement.scrollTop||((o=(i=u?.body)===null||i===void 0?void 0:i.parentElement)===null||o===void 0?void 0:o.scrollTop)||((s=u?.body)===null||s===void 0?void 0:s.scrollTop)||0}}function Jt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Xt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Kt(e){return e?e.nodeType===e.ELEMENT_NODE?e:e.parentElement:null}function z(e,t,r,n){if(!e)return!1;const i=Kt(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(He(i,t,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function _n(e,t){return t.getId(e)!==-1}function pt(e,t){return t.getId(e)===Oe}function Qt(e,t){if(Ee(e))return!1;const r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?Qt(e.parentNode,t):!0:!0}function mt(e){return!!e.changedTouches}function Cn(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=(...t)=>{let r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function Yt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Zt(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function gt(e){return!!e?.shadowRoot}class En{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var r;return(r=this.styleIDMap.get(t))!==null&&r!==void 0?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function er(e){var t,r;let n=null;return((r=(t=e.getRootNode)===null||t===void 0?void 0:t.call(e))===null||r===void 0?void 0:r.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(n=e.getRootNode().host),n}function Rn(e){let t=e,r;for(;r=er(t);)t=r;return t}function On(e){const t=e.ownerDocument;if(!t)return!1;const r=Rn(e);return t.contains(r)}function tr(e){const t=e.ownerDocument;return t?t.contains(e)||On(e):!1}var E=(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))(E||{}),_=(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))(_||{}),j=(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))(j||{}),re=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(re||{}),Ie=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ie||{});function rr(e){return"__ln"in e}class xn{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&rr(t.previousSibling)){const n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&rr(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){const r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const nr=(e,t)=>`${e}@${t}`;class Tn{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=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],r=new Set,n=new xn,i=a=>{let d=a,l=Oe;for(;l===Oe;)d=d&&d.nextSibling,l=d&&this.mirror.getId(d);return l},o=a=>{if(!a.parentNode||!tr(a)||a.parentNode.tagName==="TEXTAREA")return;const d=Ee(a.parentNode)?this.mirror.getId(er(a)):this.mirror.getId(a.parentNode),l=i(a);if(d===-1||l===-1)return n.addNode(a);const f=Se(a,{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:p=>{Yt(p,this.mirror)&&this.iframeManager.addIframe(p),Zt(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),gt(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc)},onIframeLoad:(p,h)=>{this.iframeManager.attachIframe(p,h),this.shadowDomManager.observeAttachShadow(p)},onStylesheetLoad:(p,h)=>{this.stylesheetManager.attachLinkElement(p,h)}});f&&(t.push({parentId:d,nextId:l,node:f}),r.add(f.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)ir(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||o(a);for(const a of this.addedSet)!sr(this.droppedSet,a)&&!ir(this.removes,a,this.mirror)||sr(this.movedSet,a)?o(a):this.droppedSet.add(a);let s=null;for(;n.length;){let a=null;if(s){const d=this.mirror.getId(s.value.parentNode),l=i(s.value);d!==-1&&l!==-1&&(a=s)}if(!a){let d=n.tail;for(;d;){const l=d;if(d=d.previous,l){const f=this.mirror.getId(l.value.parentNode);if(i(l.value)===-1)continue;if(f!==-1){a=l;break}else{const h=l.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const g=h.parentNode.host;if(this.mirror.getId(g)!==-1){a=l;break}}}}}}if(!a){for(;n.head;)n.removeNode(n.head.value);break}s=a.previous,n.removeNode(a.value),o(a.value)}const u={texts:this.texts.map(a=>{const d=a.node;return d.parentNode&&d.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(d.parentNode),{id:this.mirror.getId(d),value:a.value}}).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{const{attributes:d}=a;if(typeof d.style=="string"){const l=JSON.stringify(a.styleDiff),f=JSON.stringify(a._unchangedStyles);l.length<d.style.length&&(l+f).split("var(").length===d.style.split("var(").length&&(d.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:d}}).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:t};!u.texts.length&&!u.attributes.length&&!u.removes.length&&!u.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(u))},this.genTextAreaValueMutation=t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r)),r.attributes.value=Array.from(t.childNodes,n=>n.textContent||"").join("")},this.processMutation=t=>{if(!pt(t.target,this.mirror))switch(t.type){case"characterData":{const r=t.target.textContent;!z(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:jt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Kt(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let n=t.attributeName,i=t.target.getAttribute(n);if(n==="value"){const s=ft(r);i=dt({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(z(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)n="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Ht(r.tagName,n)&&(o.attributes[n]=$t(this.doc,ce(r.tagName),ce(n),i),n==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const s=this.unattachedDoc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(const u of Array.from(r.style)){const a=r.style.getPropertyValue(u),d=r.style.getPropertyPriority(u);a!==s.style.getPropertyValue(u)||d!==s.style.getPropertyPriority(u)?d===""?o.styleDiff[u]=a:o.styleDiff[u]=[a,d]:o._unchangedStyles[u]=[a,d]}for(const u of Array.from(s.style))r.style.getPropertyValue(u)===""&&(o.styleDiff[u]=!1)}break}case"childList":{if(z(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const n=this.mirror.getId(r),i=Ee(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);z(t.target,this.blockClass,this.blockSelector,!1)||pt(r,this.mirror)||!_n(r,this.mirror)||(this.addedSet.has(r)?(yt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Qt(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[nr(n,i)]?yt(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:Ee(t.target)&&Re(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(pt(t,this.mirror))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[nr(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);z(t,this.blockClass,this.blockSelector,!1)||(t.childNodes.forEach(n=>this.genAdds(n)),gt(t)&&t.shadowRoot.childNodes.forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}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 yt(e,t){e.delete(t),t.childNodes.forEach(r=>yt(e,r))}function ir(e,t,r){return e.length===0?!1:or(e,t,r)}function or(e,t,r){const{parentNode:n}=t;if(!n)return!1;const i=r.getId(n);return e.some(o=>o.id===i)?!0:or(e,n,r)}function sr(e,t){return e.size===0?!1:ar(e,t)}function ar(e,t){const{parentNode:r}=t;return r?e.has(r)?!0:ar(e,r):!1}let Te;function kn(e){Te=e}function Nn(){Te=void 0}const C=e=>Te?(...r)=>{try{return e(...r)}catch(n){if(Te&&Te(n)===!0)return;throw n}}:e,le=[];function ke(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{}return e&&e.target}function ur(e,t){var r,n;const i=new Tn;le.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const s=(n=(r=window?.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");s&&window[s]&&(o=window[s]);const u=new o(C(i.processMutations.bind(i)));return u.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),u}function Dn({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let s=[],u;const a=xe(C(f=>{const p=Date.now()-u;e(s.map(h=>(h.timeOffset-=p,h)),f),s=[],u=null}),o),d=C(xe(C(f=>{const p=ke(f),{clientX:h,clientY:g}=mt(f)?f.changedTouches[0]:f;u||(u=Ge()),s.push({x:h,y:g,id:n.getId(p),timeOffset:Ge()-u}),a(typeof DragEvent<"u"&&f instanceof DragEvent?_.Drag:f instanceof MouseEvent?_.MouseMove:_.TouchMove)}),i,{trailing:!1})),l=[q("mousemove",d,r),q("touchmove",d,r),q("drag",d,r)];return C(()=>{l.forEach(f=>f())})}function An({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,u=[];let a=null;const d=l=>f=>{const p=ke(f);if(z(p,n,i,!0))return;let h=null,g=l;if("pointerType"in f){switch(f.pointerType){case"mouse":h=re.Mouse;break;case"touch":h=re.Touch;break;case"pen":h=re.Pen;break}h===re.Touch?j[l]===j.MouseDown?g="TouchStart":j[l]===j.MouseUp&&(g="TouchEnd"):re.Pen}else mt(f)&&(h=re.Touch);h!==null?(a=h,(g.startsWith("Touch")&&h===re.Touch||g.startsWith("Mouse")&&h===re.Mouse)&&(h=null)):j[l]===j.Click&&(h=a,a=null);const m=mt(f)?f.changedTouches[0]:f;if(!m)return;const v=r.getId(p),{clientX:w,clientY:b}=m;C(e)(Object.assign({type:j[g],id:v,x:w,y:b},h!==null&&{pointerType:h}))};return Object.keys(j).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&s[l]!==!1).forEach(l=>{let f=ce(l);const p=d(l);if(window.PointerEvent)switch(j[l]){case j.MouseDown:case j.MouseUp:f=f.replace("mouse","pointer");break;case j.TouchStart:case j.TouchEnd:return}u.push(q(f,p,t))}),C(()=>{u.forEach(l=>l())})}function cr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){const s=C(xe(C(u=>{const a=ke(u);if(!a||z(a,n,i,!0))return;const d=r.getId(a);if(a===t&&t.defaultView){const l=Vt(t.defaultView);e({id:d,x:l.left,y:l.top})}else e({id:d,x:a.scrollLeft,y:a.scrollTop})}),o.scroll||100));return q("scroll",s,t)}function Ln({viewportResizeCb:e},{win:t}){let r=-1,n=-1;const i=C(xe(C(()=>{const o=Jt(),s=Xt();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return q("resize",i,t)}const Pn=["INPUT","TEXTAREA","SELECT"],lr=new WeakMap;function Fn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:u,maskInputFn:a,sampling:d,userTriggeredOnInput:l}){function f(b){let y=ke(b);const S=b.isTrusted,I=y&&y.tagName;if(y&&I==="OPTION"&&(y=y.parentElement),!y||!I||Pn.indexOf(I)<0||z(y,n,i,!0)||y.classList.contains(o)||s&&y.matches(s))return;let U=y.value,B=!1;const k=ft(y)||"";k==="radio"||k==="checkbox"?B=y.checked:(u[I.toLowerCase()]||u[k])&&(U=dt({element:y,maskInputOptions:u,tagName:I,type:k,value:U,maskInputFn:a})),p(y,l?{text:U,isChecked:B,userTriggered:S}:{text:U,isChecked:B});const N=y.name;k==="radio"&&N&&B&&t.querySelectorAll(`input[type="radio"][name="${N}"]`).forEach(V=>{if(V!==y){const J=V.value;p(V,l?{text:J,isChecked:!B,userTriggered:!1}:{text:J,isChecked:!B})}})}function p(b,y){const S=lr.get(b);if(!S||S.text!==y.text||S.isChecked!==y.isChecked){lr.set(b,y);const I=r.getId(b);C(e)(Object.assign(Object.assign({},y),{id:I}))}}const g=(d.input==="last"?["change"]:["input","change"]).map(b=>q(b,C(f),t)),m=t.defaultView;if(!m)return()=>{g.forEach(b=>b())};const v=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&g.push(...w.map(b=>je(b[0],b[1],{set(){C(f)({target:this,isTrusted:!1})}},!1,m))),C(()=>{g.forEach(b=>b())})}function Ve(e){const t=[];function r(n,i){if(Je("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Je("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Je("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Je("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){const s=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(s)}else if(n.parentStyleSheet){const s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(e,t)}function oe(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Bn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:C((l,f,p)=>{const[h,g]=p,{id:m,styleId:v}=oe(f,t,r.styleMirror);return(m&&m!==-1||v&&v!==-1)&&e({id:m,styleId:v,adds:[{rule:h,index:g}]}),l.apply(f,p)})});const o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:C((l,f,p)=>{const[h]=p,{id:g,styleId:m}=oe(f,t,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,removes:[{index:h}]}),l.apply(f,p)})});let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:C((l,f,p)=>{const[h]=p,{id:g,styleId:m}=oe(f,t,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,replace:h}),l.apply(f,p)})}));let u;n.CSSStyleSheet.prototype.replaceSync&&(u=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:C((l,f,p)=>{const[h]=p,{id:g,styleId:m}=oe(f,t,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,replaceSync:h}),l.apply(f,p)})}));const a={};Xe("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(Xe("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),Xe("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),Xe("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));const d={};return Object.entries(a).forEach(([l,f])=>{d[l]={insertRule:f.prototype.insertRule,deleteRule:f.prototype.deleteRule},f.prototype.insertRule=new Proxy(d[l].insertRule,{apply:C((p,h,g)=>{const[m,v]=g,{id:w,styleId:b}=oe(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||b&&b!==-1)&&e({id:w,styleId:b,adds:[{rule:m,index:[...Ve(h),v||0]}]}),p.apply(h,g)})}),f.prototype.deleteRule=new Proxy(d[l].deleteRule,{apply:C((p,h,g)=>{const[m]=g,{id:v,styleId:w}=oe(h.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,removes:[{index:[...Ve(h),m]}]}),p.apply(h,g)})})}),C(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),u&&(n.CSSStyleSheet.prototype.replaceSync=u),Object.entries(a).forEach(([l,f])=>{f.prototype.insertRule=d[l].insertRule,f.prototype.deleteRule=d[l].deleteRule})})}function dr({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(r.host);const u=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(o=(i=r.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,a=u?.prototype?Object.getOwnPropertyDescriptor(u?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!u||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var d;return(d=a.get)===null||d===void 0?void 0:d.call(this)},set(d){var l;const f=(l=a.set)===null||l===void 0?void 0:l.call(this,d);if(s!==null&&s!==-1)try{t.adoptStyleSheets(d,s)}catch{}return f}}),C(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Un({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:C((u,a,d)=>{var l;const[f,p,h]=d;if(r.has(f))return o.apply(a,[f,p,h]);const{id:g,styleId:m}=oe((l=a.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,n.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,set:{property:f,value:p,priority:h},index:Ve(a.parentRule)}),u.apply(a,d)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:C((u,a,d)=>{var l;const[f]=d;if(r.has(f))return s.apply(a,[f]);const{id:p,styleId:h}=oe((l=a.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,remove:{property:f},index:Ve(a.parentRule)}),u.apply(a,d)})}),C(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function Wn({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){const s=C(a=>xe(C(d=>{const l=ke(d);if(!l||z(l,t,r,!0))return;const{currentTime:f,volume:p,muted:h,playbackRate:g,loop:m}=l;e({type:a,id:n.getId(l),currentTime:f,volume:p,muted:h,playbackRate:g,loop:m})}),i.media||500)),u=[q("play",s(0),o),q("pause",s(1),o),q("seeked",s(2),o),q("volumechange",s(3),o),q("ratechange",s(4),o)];return C(()=>{u.forEach(a=>a())})}function qn({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(a,d,l){const f=new o(a,d,l);return i.set(f,{family:a,buffer:typeof d!="string",descriptors:l,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),f};const s=we(t.fonts,"add",function(u){return function(a){return setTimeout(C(()=>{const d=i.get(a);d&&(e(d),i.delete(a))}),0),u.apply(this,[a])}});return n.push(()=>{r.FontFace=o}),n.push(s),C(()=>{n.forEach(u=>u())})}function zn(e){const{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e;let s=!0;const u=C(()=>{const a=t.getSelection();if(!a||s&&a?.isCollapsed)return;s=a.isCollapsed||!1;const d=[],l=a.rangeCount||0;for(let f=0;f<l;f++){const p=a.getRangeAt(f),{startContainer:h,startOffset:g,endContainer:m,endOffset:v}=p;z(h,n,i,!0)||z(m,n,i,!0)||d.push({start:r.getId(h),startOffset:g,end:r.getId(m),endOffset:v})}o({ranges:d})});return u(),q("selectionchange",u)}function $n({doc:e,customElementCb:t}){const r=e.defaultView;return!r||!r.customElements?()=>{}:we(r.customElements,"define",function(i){return function(o,s,u){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,u])}})}function Hn(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:u,mediaInteractionCb:a,styleSheetRuleCb:d,styleDeclarationCb:l,canvasMutationCb:f,fontCb:p,selectionCb:h,customElementCb:g}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),i(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),o(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),s(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),u(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),a(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),d(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),l(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),f(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),p(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),g(...m)}}function jn(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};Hn(e,t);let n;e.recordDOM&&(n=ur(e,e.doc));const i=Dn(e),o=An(e),s=cr(e),u=Ln(e,{win:r}),a=Fn(e),d=Wn(e);let l=()=>{},f=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(l=Bn(e,{win:r}),f=dr(e,e.doc),p=Un(e,{win:r}),e.collectFonts&&(h=qn(e)));const g=zn(e),m=$n(e),v=[];for(const w of e.plugins)v.push(w.observer(w.callback,r,w.options));return C(()=>{le.forEach(w=>w.reset()),n?.disconnect(),i(),o(),s(),u(),a(),d(),l(),f(),p(),h(),g(),m(),v.forEach(w=>w())})}function Je(e){return typeof window[e]<"u"}function Xe(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class fr{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,r,n,i){const o=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t);let u=o.get(r);return u||(u=this.generateIdFn(),o.set(r,u),s.set(u,r)),u}getIds(t,r){const n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,i))}getRemoteId(t,r,n){const i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const o=i.get(r);return o||-1}getRemoteIds(t,r){const n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class Gn{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new fr(qt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new fr(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)===null||n===void 0||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case E.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:E.IncrementalSnapshot,data:{source:_.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case E.Meta:case E.Load:case E.DomContentLoaded:return!1;case E.Plugin:return r;case E.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case E.IncrementalSnapshot:switch(r.data.source){case _.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case _.Drag:case _.TouchMove:case _.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case _.ViewportResize:return!1;case _.MediaInteraction:case _.MouseInteraction:case _.Scroll:case _.CanvasMutation:case _.Input:return this.replaceIds(r.data,t,["id"]),r;case _.StyleSheetRule:case _.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case _.Font:return r;case _.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case _.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,n,i){for(const o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==P.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}}class Vn{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Re(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const n=ur(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(cr(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(dr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){const n=this;this.restoreHandlers.push(we(t.prototype,"attachShadow",function(i){return function(o){const s=i.call(this,o);return this.shadowRoot&&tr(this)&&n.addShadowRoot(this.shadowRoot,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`;let Vt={map:{},getId(){return console.error(be),-1},getNode(){return console.error(be),null},removeNodeFromMap(){console.error(be)},has(){return console.error(be),!1},reset(){console.error(be)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Vt=new Proxy(Vt,{get(e,t,r){return t==="map"&&console.error(be),Reflect.get(e,t,r)}}));function xe(e,t,r={}){let n=null,i=0;return function(...o){const s=Date.now();!i&&r.leading===!1&&(i=s);const u=t-(s-i),a=this;u<=0||u>t?(n&&(clearTimeout(n),n=null),i=s,e.apply(a,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{i=r.leading===!1?0:Date.now(),n=null,e.apply(a,o)},u))}}function je(e,t,r,n,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>je(e,t,o||{},!0)}function we(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],i=r(n);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=i,()=>{e[t]=n}}catch{return()=>{}}}let Ge=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ge=()=>new Date().getTime());function Jt(e){var t,r,n,i,o,s;const u=e.document;return{left:u.scrollingElement?u.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:u?.documentElement.scrollLeft||((r=(t=u?.body)===null||t===void 0?void 0:t.parentElement)===null||r===void 0?void 0:r.scrollLeft)||((n=u?.body)===null||n===void 0?void 0:n.scrollLeft)||0,top:u.scrollingElement?u.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:u?.documentElement.scrollTop||((o=(i=u?.body)===null||i===void 0?void 0:i.parentElement)===null||o===void 0?void 0:o.scrollTop)||((s=u?.body)===null||s===void 0?void 0:s.scrollTop)||0}}function Xt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Kt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Qt(e){return e?e.nodeType===e.ELEMENT_NODE?e:e.parentElement:null}function z(e,t,r,n){if(!e)return!1;const i=Qt(e);if(!i)return!1;try{if(typeof t=="string"){if(i.classList.contains(t)||n&&i.closest("."+t)!==null)return!0}else if(He(i,t,n))return!0}catch{}return!!(r&&(i.matches(r)||n&&i.closest(r)!==null))}function Mn(e,t){return t.getId(e)!==-1}function pt(e,t){return t.getId(e)===Oe}function Yt(e,t){if(Ee(e))return!1;const r=t.getId(e);return t.has(r)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?Yt(e.parentNode,t):!0:!0}function mt(e){return!!e.changedTouches}function _n(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=(...t)=>{let r=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===r)return!0;while(r=r&&r.parentNode);return!1})}function Zt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function er(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function gt(e){return!!e?.shadowRoot}class Cn{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var r;return(r=this.styleIDMap.get(t))!==null&&r!==void 0?r:-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function tr(e){var t,r;let n=null;return((r=(t=e.getRootNode)===null||t===void 0?void 0:t.call(e))===null||r===void 0?void 0:r.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(n=e.getRootNode().host),n}function En(e){let t=e,r;for(;r=tr(t);)t=r;return t}function Rn(e){const t=e.ownerDocument;if(!t)return!1;const r=En(e);return t.contains(r)}function rr(e){const t=e.ownerDocument;return t?t.contains(e)||Rn(e):!1}var E=(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))(E||{}),_=(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))(_||{}),j=(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))(j||{}),re=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(re||{}),Ie=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ie||{});function nr(e){return"__ln"in e}class On{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){const r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&nr(t.previousSibling)){const n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&nr(t.nextSibling)&&t.nextSibling.__ln.previous){const n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){const r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const ir=(e,t)=>`${e}@${t}`;class xn{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=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],r=new Set,n=new On,i=a=>{let d=a,l=Oe;for(;l===Oe;)d=d&&d.nextSibling,l=d&&this.mirror.getId(d);return l},o=a=>{if(!a.parentNode||!rr(a)||a.parentNode.tagName==="TEXTAREA")return;const d=Ee(a.parentNode)?this.mirror.getId(tr(a)):this.mirror.getId(a.parentNode),l=i(a);if(d===-1||l===-1)return n.addNode(a);const f=Se(a,{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:p=>{Zt(p,this.mirror)&&this.iframeManager.addIframe(p),er(p,this.mirror)&&this.stylesheetManager.trackLinkElement(p),gt(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc)},onIframeLoad:(p,h)=>{this.iframeManager.attachIframe(p,h),this.shadowDomManager.observeAttachShadow(p)},onStylesheetLoad:(p,h)=>{this.stylesheetManager.attachLinkElement(p,h)}});f&&(t.push({parentId:d,nextId:l,node:f}),r.add(f.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)or(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||o(a);for(const a of this.addedSet)!ar(this.droppedSet,a)&&!or(this.removes,a,this.mirror)||ar(this.movedSet,a)?o(a):this.droppedSet.add(a);let s=null;for(;n.length;){let a=null;if(s){const d=this.mirror.getId(s.value.parentNode),l=i(s.value);d!==-1&&l!==-1&&(a=s)}if(!a){let d=n.tail;for(;d;){const l=d;if(d=d.previous,l){const f=this.mirror.getId(l.value.parentNode);if(i(l.value)===-1)continue;if(f!==-1){a=l;break}else{const h=l.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const g=h.parentNode.host;if(this.mirror.getId(g)!==-1){a=l;break}}}}}}if(!a){for(;n.head;)n.removeNode(n.head.value);break}s=a.previous,n.removeNode(a.value),o(a.value)}const u={texts:this.texts.map(a=>{const d=a.node;return d.parentNode&&d.parentNode.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(d.parentNode),{id:this.mirror.getId(d),value:a.value}}).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>{const{attributes:d}=a;if(typeof d.style=="string"){const l=JSON.stringify(a.styleDiff),f=JSON.stringify(a._unchangedStyles);l.length<d.style.length&&(l+f).split("var(").length===d.style.split("var(").length&&(d.style=a.styleDiff)}return{id:this.mirror.getId(a.node),attributes:d}}).filter(a=>!r.has(a.id)).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:t};!u.texts.length&&!u.attributes.length&&!u.removes.length&&!u.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(u))},this.genTextAreaValueMutation=t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r)),r.attributes.value=Array.from(t.childNodes,n=>n.textContent||"").join("")},this.processMutation=t=>{if(!pt(t.target,this.mirror))switch(t.type){case"characterData":{const r=t.target.textContent;!z(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Gt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Qt(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{const r=t.target;let n=t.attributeName,i=t.target.getAttribute(n);if(n==="value"){const s=ft(r);i=dt({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:i,maskInputFn:this.maskInputFn})}if(z(t.target,this.blockClass,this.blockSelector,!1)||i===t.oldValue)return;let o=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(i))if(!r.contentDocument)n="rr_src";else return;if(o||(o={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(t.target,o)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!jt(r.tagName,n)&&(o.attributes[n]=Ht(this.doc,ce(r.tagName),ce(n),i),n==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const s=this.unattachedDoc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(const u of Array.from(r.style)){const a=r.style.getPropertyValue(u),d=r.style.getPropertyPriority(u);a!==s.style.getPropertyValue(u)||d!==s.style.getPropertyPriority(u)?d===""?o.styleDiff[u]=a:o.styleDiff[u]=[a,d]:o._unchangedStyles[u]=[a,d]}for(const u of Array.from(s.style))r.style.getPropertyValue(u)===""&&(o.styleDiff[u]=!1)}break}case"childList":{if(z(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{const n=this.mirror.getId(r),i=Ee(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);z(t.target,this.blockClass,this.blockSelector,!1)||pt(r,this.mirror)||!Mn(r,this.mirror)||(this.addedSet.has(r)?(yt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Yt(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[ir(n,i)]?yt(this.movedSet,r):this.removes.push({parentId:i,id:n,isShadow:Ee(t.target)&&Re(t.target)?!0:void 0})),this.mapRemoves.push(r))});break}}},this.genAdds=(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(pt(t,this.mirror))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[ir(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);z(t,this.blockClass,this.blockSelector,!1)||(t.childNodes.forEach(n=>this.genAdds(n)),gt(t)&&t.shadowRoot.childNodes.forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}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 yt(e,t){e.delete(t),t.childNodes.forEach(r=>yt(e,r))}function or(e,t,r){return e.length===0?!1:sr(e,t,r)}function sr(e,t,r){const{parentNode:n}=t;if(!n)return!1;const i=r.getId(n);return e.some(o=>o.id===i)?!0:sr(e,n,r)}function ar(e,t){return e.size===0?!1:ur(e,t)}function ur(e,t){const{parentNode:r}=t;return r?e.has(r)?!0:ur(e,r):!1}let Te;function Tn(e){Te=e}function kn(){Te=void 0}const C=e=>Te?(...r)=>{try{return e(...r)}catch(n){if(Te&&Te(n)===!0)return;throw n}}:e,le=[];function ke(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{}return e&&e.target}function cr(e,t){var r,n;const i=new xn;le.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const s=(n=(r=window?.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");s&&window[s]&&(o=window[s]);const u=new o(C(i.processMutations.bind(i)));return u.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),u}function Nn({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let s=[],u;const a=xe(C(f=>{const p=Date.now()-u;e(s.map(h=>(h.timeOffset-=p,h)),f),s=[],u=null}),o),d=C(xe(C(f=>{const p=ke(f),{clientX:h,clientY:g}=mt(f)?f.changedTouches[0]:f;u||(u=Ge()),s.push({x:h,y:g,id:n.getId(p),timeOffset:Ge()-u}),a(typeof DragEvent<"u"&&f instanceof DragEvent?_.Drag:f instanceof MouseEvent?_.MouseMove:_.TouchMove)}),i,{trailing:!1})),l=[q("mousemove",d,r),q("touchmove",d,r),q("drag",d,r)];return C(()=>{l.forEach(f=>f())})}function Dn({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,u=[];let a=null;const d=l=>f=>{const p=ke(f);if(z(p,n,i,!0))return;let h=null,g=l;if("pointerType"in f){switch(f.pointerType){case"mouse":h=re.Mouse;break;case"touch":h=re.Touch;break;case"pen":h=re.Pen;break}h===re.Touch?j[l]===j.MouseDown?g="TouchStart":j[l]===j.MouseUp&&(g="TouchEnd"):re.Pen}else mt(f)&&(h=re.Touch);h!==null?(a=h,(g.startsWith("Touch")&&h===re.Touch||g.startsWith("Mouse")&&h===re.Mouse)&&(h=null)):j[l]===j.Click&&(h=a,a=null);const m=mt(f)?f.changedTouches[0]:f;if(!m)return;const v=r.getId(p),{clientX:w,clientY:b}=m;C(e)(Object.assign({type:j[g],id:v,x:w,y:b},h!==null&&{pointerType:h}))};return Object.keys(j).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&s[l]!==!1).forEach(l=>{let f=ce(l);const p=d(l);if(window.PointerEvent)switch(j[l]){case j.MouseDown:case j.MouseUp:f=f.replace("mouse","pointer");break;case j.TouchStart:case j.TouchEnd:return}u.push(q(f,p,t))}),C(()=>{u.forEach(l=>l())})}function lr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,sampling:o}){const s=C(xe(C(u=>{const a=ke(u);if(!a||z(a,n,i,!0))return;const d=r.getId(a);if(a===t&&t.defaultView){const l=Jt(t.defaultView);e({id:d,x:l.left,y:l.top})}else e({id:d,x:a.scrollLeft,y:a.scrollTop})}),o.scroll||100));return q("scroll",s,t)}function An({viewportResizeCb:e},{win:t}){let r=-1,n=-1;const i=C(xe(C(()=>{const o=Xt(),s=Kt();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200));return q("resize",i,t)}const Ln=["INPUT","TEXTAREA","SELECT"],dr=new WeakMap;function Pn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:u,maskInputFn:a,sampling:d,userTriggeredOnInput:l}){function f(b){let y=ke(b);const S=b.isTrusted,I=y&&y.tagName;if(y&&I==="OPTION"&&(y=y.parentElement),!y||!I||Ln.indexOf(I)<0||z(y,n,i,!0)||y.classList.contains(o)||s&&y.matches(s))return;let U=y.value,B=!1;const k=ft(y)||"";k==="radio"||k==="checkbox"?B=y.checked:(u[I.toLowerCase()]||u[k])&&(U=dt({element:y,maskInputOptions:u,tagName:I,type:k,value:U,maskInputFn:a})),p(y,l?{text:U,isChecked:B,userTriggered:S}:{text:U,isChecked:B});const N=y.name;k==="radio"&&N&&B&&t.querySelectorAll(`input[type="radio"][name="${N}"]`).forEach(V=>{if(V!==y){const J=V.value;p(V,l?{text:J,isChecked:!B,userTriggered:!1}:{text:J,isChecked:!B})}})}function p(b,y){const S=dr.get(b);if(!S||S.text!==y.text||S.isChecked!==y.isChecked){dr.set(b,y);const I=r.getId(b);C(e)(Object.assign(Object.assign({},y),{id:I}))}}const g=(d.input==="last"?["change"]:["input","change"]).map(b=>q(b,C(f),t)),m=t.defaultView;if(!m)return()=>{g.forEach(b=>b())};const v=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&g.push(...w.map(b=>je(b[0],b[1],{set(){C(f)({target:this,isTrusted:!1})}},!1,m))),C(()=>{g.forEach(b=>b())})}function Ve(e){const t=[];function r(n,i){if(Je("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Je("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Je("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Je("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){const s=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(s)}else if(n.parentStyleSheet){const s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(s)}return i}return r(e,t)}function oe(e,t,r){let n,i;return e?(e.ownerNode?n=t.getId(e.ownerNode):i=r.getId(e),{styleId:i,id:n}):{}}function Fn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const i=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:C((l,f,p)=>{const[h,g]=p,{id:m,styleId:v}=oe(f,t,r.styleMirror);return(m&&m!==-1||v&&v!==-1)&&e({id:m,styleId:v,adds:[{rule:h,index:g}]}),l.apply(f,p)})});const o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:C((l,f,p)=>{const[h]=p,{id:g,styleId:m}=oe(f,t,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,removes:[{index:h}]}),l.apply(f,p)})});let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:C((l,f,p)=>{const[h]=p,{id:g,styleId:m}=oe(f,t,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,replace:h}),l.apply(f,p)})}));let u;n.CSSStyleSheet.prototype.replaceSync&&(u=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(u,{apply:C((l,f,p)=>{const[h]=p,{id:g,styleId:m}=oe(f,t,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,replaceSync:h}),l.apply(f,p)})}));const a={};Xe("CSSGroupingRule")?a.CSSGroupingRule=n.CSSGroupingRule:(Xe("CSSMediaRule")&&(a.CSSMediaRule=n.CSSMediaRule),Xe("CSSConditionRule")&&(a.CSSConditionRule=n.CSSConditionRule),Xe("CSSSupportsRule")&&(a.CSSSupportsRule=n.CSSSupportsRule));const d={};return Object.entries(a).forEach(([l,f])=>{d[l]={insertRule:f.prototype.insertRule,deleteRule:f.prototype.deleteRule},f.prototype.insertRule=new Proxy(d[l].insertRule,{apply:C((p,h,g)=>{const[m,v]=g,{id:w,styleId:b}=oe(h.parentStyleSheet,t,r.styleMirror);return(w&&w!==-1||b&&b!==-1)&&e({id:w,styleId:b,adds:[{rule:m,index:[...Ve(h),v||0]}]}),p.apply(h,g)})}),f.prototype.deleteRule=new Proxy(d[l].deleteRule,{apply:C((p,h,g)=>{const[m]=g,{id:v,styleId:w}=oe(h.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,removes:[{index:[...Ve(h),m]}]}),p.apply(h,g)})})}),C(()=>{n.CSSStyleSheet.prototype.insertRule=i,n.CSSStyleSheet.prototype.deleteRule=o,s&&(n.CSSStyleSheet.prototype.replace=s),u&&(n.CSSStyleSheet.prototype.replaceSync=u),Object.entries(a).forEach(([l,f])=>{f.prototype.insertRule=d[l].insertRule,f.prototype.deleteRule=d[l].deleteRule})})}function fr({mirror:e,stylesheetManager:t},r){var n,i,o;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(r.host);const u=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(o=(i=r.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,a=u?.prototype?Object.getOwnPropertyDescriptor(u?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!u||!a?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var d;return(d=a.get)===null||d===void 0?void 0:d.call(this)},set(d){var l;const f=(l=a.set)===null||l===void 0?void 0:l.call(this,d);if(s!==null&&s!==-1)try{t.adoptStyleSheets(d,s)}catch{}return f}}),C(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function Bn({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:C((u,a,d)=>{var l;const[f,p,h]=d;if(r.has(f))return o.apply(a,[f,p,h]);const{id:g,styleId:m}=oe((l=a.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,n.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,set:{property:f,value:p,priority:h},index:Ve(a.parentRule)}),u.apply(a,d)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:C((u,a,d)=>{var l;const[f]=d;if(r.has(f))return s.apply(a,[f]);const{id:p,styleId:h}=oe((l=a.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,remove:{property:f},index:Ve(a.parentRule)}),u.apply(a,d)})}),C(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function Un({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:i,doc:o}){const s=C(a=>xe(C(d=>{const l=ke(d);if(!l||z(l,t,r,!0))return;const{currentTime:f,volume:p,muted:h,playbackRate:g,loop:m}=l;e({type:a,id:n.getId(l),currentTime:f,volume:p,muted:h,playbackRate:g,loop:m})}),i.media||500)),u=[q("play",s(0),o),q("pause",s(1),o),q("seeked",s(2),o),q("volumechange",s(3),o),q("ratechange",s(4),o)];return C(()=>{u.forEach(a=>a())})}function Wn({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(a,d,l){const f=new o(a,d,l);return i.set(f,{family:a,buffer:typeof d!="string",descriptors:l,fontSource:typeof d=="string"?d:JSON.stringify(Array.from(new Uint8Array(d)))}),f};const s=we(t.fonts,"add",function(u){return function(a){return setTimeout(C(()=>{const d=i.get(a);d&&(e(d),i.delete(a))}),0),u.apply(this,[a])}});return n.push(()=>{r.FontFace=o}),n.push(s),C(()=>{n.forEach(u=>u())})}function qn(e){const{doc:t,mirror:r,blockClass:n,blockSelector:i,selectionCb:o}=e;let s=!0;const u=C(()=>{const a=t.getSelection();if(!a||s&&a?.isCollapsed)return;s=a.isCollapsed||!1;const d=[],l=a.rangeCount||0;for(let f=0;f<l;f++){const p=a.getRangeAt(f),{startContainer:h,startOffset:g,endContainer:m,endOffset:v}=p;z(h,n,i,!0)||z(m,n,i,!0)||d.push({start:r.getId(h),startOffset:g,end:r.getId(m),endOffset:v})}o({ranges:d})});return u(),q("selectionchange",u)}function zn({doc:e,customElementCb:t}){const r=e.defaultView;return!r||!r.customElements?()=>{}:we(r.customElements,"define",function(i){return function(o,s,u){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return i.apply(this,[o,s,u])}})}function $n(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:u,mediaInteractionCb:a,styleSheetRuleCb:d,styleDeclarationCb:l,canvasMutationCb:f,fontCb:p,selectionCb:h,customElementCb:g}=e;e.mutationCb=(...m)=>{t.mutation&&t.mutation(...m),r(...m)},e.mousemoveCb=(...m)=>{t.mousemove&&t.mousemove(...m),n(...m)},e.mouseInteractionCb=(...m)=>{t.mouseInteraction&&t.mouseInteraction(...m),i(...m)},e.scrollCb=(...m)=>{t.scroll&&t.scroll(...m),o(...m)},e.viewportResizeCb=(...m)=>{t.viewportResize&&t.viewportResize(...m),s(...m)},e.inputCb=(...m)=>{t.input&&t.input(...m),u(...m)},e.mediaInteractionCb=(...m)=>{t.mediaInteaction&&t.mediaInteaction(...m),a(...m)},e.styleSheetRuleCb=(...m)=>{t.styleSheetRule&&t.styleSheetRule(...m),d(...m)},e.styleDeclarationCb=(...m)=>{t.styleDeclaration&&t.styleDeclaration(...m),l(...m)},e.canvasMutationCb=(...m)=>{t.canvasMutation&&t.canvasMutation(...m),f(...m)},e.fontCb=(...m)=>{t.font&&t.font(...m),p(...m)},e.selectionCb=(...m)=>{t.selection&&t.selection(...m),h(...m)},e.customElementCb=(...m)=>{t.customElement&&t.customElement(...m),g(...m)}}function Hn(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};$n(e,t);let n;e.recordDOM&&(n=cr(e,e.doc));const i=Nn(e),o=Dn(e),s=lr(e),u=An(e,{win:r}),a=Pn(e),d=Un(e);let l=()=>{},f=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(l=Fn(e,{win:r}),f=fr(e,e.doc),p=Bn(e,{win:r}),e.collectFonts&&(h=Wn(e)));const g=qn(e),m=zn(e),v=[];for(const w of e.plugins)v.push(w.observer(w.callback,r,w.options));return C(()=>{le.forEach(w=>w.reset()),n?.disconnect(),i(),o(),s(),u(),a(),d(),l(),f(),p(),h(),g(),m(),v.forEach(w=>w())})}function Je(e){return typeof window[e]<"u"}function Xe(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class hr{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,r,n,i){const o=n||this.getIdToRemoteIdMap(t),s=i||this.getRemoteIdToIdMap(t);let u=o.get(r);return u||(u=this.generateIdFn(),o.set(r,u),s.set(u,r)),u}getIds(t,r){const n=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,i))}getRemoteId(t,r,n){const i=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;const o=i.get(r);return o||-1}getRemoteIds(t,r){const n=this.getRemoteIdToIdMap(t);return r.map(i=>this.getRemoteId(t,i,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}}class jn{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new hr(zt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new hr(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(n=this.loadListener)===null||n===void 0||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case E.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);const i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:E.IncrementalSnapshot,data:{source:_.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case E.Meta:case E.Load:case E.DomContentLoaded:return!1;case E.Plugin:return r;case E.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case E.IncrementalSnapshot:switch(r.data.source){case _.Mutation:return r.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),r.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),r.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),r.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case _.Drag:case _.TouchMove:case _.MouseMove:return r.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),r;case _.ViewportResize:return!1;case _.MediaInteraction:case _.MouseInteraction:case _.Scroll:case _.CanvasMutation:case _.Input:return this.replaceIds(r.data,t,["id"]),r;case _.StyleSheetRule:case _.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case _.Font:return r;case _.Selection:return r.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),r;case _.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),r}}return!1}replace(t,r,n,i){for(const o of i)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==P.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}}class Gn{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Re(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const n=cr(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(lr(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(fr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){const n=this;this.restoreHandlers.push(we(t.prototype,"attachShadow",function(i){return function(o){const s=i.call(this,o);return this.shadowRoot&&rr(this)&&n.addShadowRoot(this.shadowRoot,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
|
|
4
4
|
Copyright (c) Microsoft Corporation.
|
|
5
5
|
|
|
6
6
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -13,10 +13,10 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
13
13
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
14
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
15
|
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */function
|
|
16
|
+
***************************************************************************** */function Vn(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Jn(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(l){try{d(n.next(l))}catch(f){s(f)}}function a(l){try{d(n.throw(l))}catch(f){s(f)}}function d(l){l.done?o(l.value):i(l.value).then(u,a)}d((n=n.apply(e,t||[])).next())})}for(var Me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xn=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ke=0;Ke<Me.length;Ke++)Xn[Me.charCodeAt(Ke)]=Ke;var Kn=function(e){var t=new Uint8Array(e),r,n=t.length,i="";for(r=0;r<n;r+=3)i+=Me[t[r]>>2],i+=Me[(t[r]&3)<<4|t[r+1]>>4],i+=Me[(t[r+1]&15)<<2|t[r+2]>>6],i+=Me[t[r+2]&63];return n%3===2?i=i.substring(0,i.length-1)+"=":n%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const pr=new Map;function Qn(e,t){let r=pr.get(e);return r||(r=new Map,pr.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}const mr=(e,t,r)=>{if(!e||!(yr(e,t)||typeof e=="object"))return;const n=e.constructor.name,i=Qn(r,n);let o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Qe(e,t,r){if(e instanceof Array)return e.map(n=>Qe(n,t,r));if(e===null)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){const n=e.constructor.name,i=Kn(e);return{rr_type:n,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Qe(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const n=e.constructor.name,{src:i}=e;return{rr_type:n,src:i}}else if(e instanceof HTMLCanvasElement){const n="HTMLImageElement",i=e.toDataURL();return{rr_type:n,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Qe(e.data,t,r),e.width,e.height]};if(yr(e,t)||typeof e=="object"){const n=e.constructor.name,i=mr(e,t,r);return{rr_type:n,index:i}}}}return e}const gr=(e,t,r)=>e.map(n=>Qe(n,t,r)),yr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function").find(i=>e instanceof t[i]);function Yn(e,t,r,n){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;const u=we(t.CanvasRenderingContext2D.prototype,s,function(a){return function(...d){return z(this.canvas,r,n,!0)||setTimeout(()=>{const l=gr(d,t,this);e(this.canvas,{type:Ie["2D"],property:s,args:l})},0),a.apply(this,d)}});i.push(u)}catch{const a=je(t.CanvasRenderingContext2D.prototype,s,{set(d){e(this.canvas,{type:Ie["2D"],property:s,args:[d],setter:!0})}});i.push(a)}return()=>{i.forEach(s=>s())}}function Zn(e){return e==="experimental-webgl"?"webgl":e}function vr(e,t,r,n){const i=[];try{const o=we(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(u,...a){if(!z(this,t,r,!0)){const d=Zn(u);if("__context"in this||(this.__context=d),n&&["webgl","webgl2"].includes(d))if(a[0]&&typeof a[0]=="object"){const l=a[0];l.preserveDrawingBuffer||(l.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[u,...a])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function Sr(e,t,r,n,i,o,s){const u=[],a=Object.getOwnPropertyNames(e);for(const d of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if(typeof e[d]!="function")continue;const l=we(e,d,function(f){return function(...p){const h=f.apply(this,p);if(mr(h,s,this),"tagName"in this.canvas&&!z(this.canvas,n,i,!0)){const g=gr(p,s,this),m={type:t,property:d,args:g};r(this.canvas,m)}return h}});u.push(l)}catch{const f=je(e,d,{set(p){r(this.canvas,{type:t,property:d,args:[p],setter:!0})}});u.push(f)}return u}function ei(e,t,r,n,i){const o=[];return o.push(...Sr(t.WebGLRenderingContext.prototype,Ie.WebGL,e,r,n,i,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...Sr(t.WebGL2RenderingContext.prototype,Ie.WebGL2,e,r,n,i,t)),()=>{o.forEach(s=>s())}}function ti(e,t){var r=t===void 0?null:t,n=e.toString(),i=n.split(`
|
|
17
17
|
`);i.pop(),i.shift();for(var o=i[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,u=0,a=i.length;u<a;++u)i[u]=i[u].substring(o).replace(s,"$1use strict$2")+`
|
|
18
18
|
`;return r&&i.push("//# sourceMappingURL="+r+`
|
|
19
|
-
`),i}function
|
|
19
|
+
`),i}function ri(e,t){var r=ti(e,t),n=new Blob(r,{type:"application/javascript"});return URL.createObjectURL(n)}function ni(e,t){var r;return function(i){return r=r||ri(e,t),new Worker(r,i)}}var ii=ni(function(){(function(){"__worker_loader_strict__";/*! *****************************************************************************
|
|
20
20
|
Copyright (c) Microsoft Corporation.
|
|
21
21
|
|
|
22
22
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -29,11 +29,11 @@ or you can use record.mirror to access the mirror instance during recording.`;le
|
|
|
29
29
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
30
30
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
31
31
|
PERFORMANCE OF THIS SOFTWARE.
|
|
32
|
-
***************************************************************************** */function e(d,l,f,p){function h(g){return g instanceof f?g:new f(function(m){m(g)})}return new(f||(f=Promise))(function(g,m){function v(y){try{b(p.next(y))}catch(S){m(S)}}function w(y){try{b(p.throw(y))}catch(S){m(S)}}function b(y){y.done?g(y.value):h(y.value).then(v,w)}b((p=p.apply(d,l||[])).next())})}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=typeof Uint8Array>"u"?[]:new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;var i=function(d){var l=new Uint8Array(d),f,p=l.length,h="";for(f=0;f<p;f+=3)h+=t[l[f]>>2],h+=t[(l[f]&3)<<4|l[f+1]>>4],h+=t[(l[f+1]&15)<<2|l[f+2]>>6],h+=t[l[f+2]&63];return p%3===2?h=h.substring(0,h.length-1)+"=":p%3===1&&(h=h.substring(0,h.length-2)+"=="),h};const o=new Map,s=new Map;function u(d,l,f){return e(this,void 0,void 0,function*(){const p=`${d}-${l}`;if("OffscreenCanvas"in globalThis){if(s.has(p))return s.get(p);const h=new OffscreenCanvas(d,l);h.getContext("2d");const m=yield(yield h.convertToBlob(f)).arrayBuffer(),v=i(m);return s.set(p,v),v}else return""})}const a=self;a.onmessage=function(d){return e(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:l,bitmap:f,width:p,height:h,dataURLOptions:g}=d.data,m=u(p,h,g),v=new OffscreenCanvas(p,h);v.getContext("2d").drawImage(f,0,0),f.close();const b=yield v.convertToBlob(g),y=b.type,S=yield b.arrayBuffer(),I=i(S);if(!o.has(l)&&(yield m)===I)return o.set(l,I),a.postMessage({id:l});if(o.get(l)===I)return a.postMessage({id:l});a.postMessage({id:l,type:y,base64:I,width:p,height:h}),o.set(l,I)}else return a.postMessage({id:d.data.id})})}})()},null);class si{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(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(a,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(d)};const{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:u}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:u})}initCanvasFPSObserver(t,r,n,i,o){const s=yr(r,n,i,!0),u=new Map,a=new oi;a.onmessage=g=>{const{id:m}=g.data;if(u.set(m,!1),!("base64"in g.data))return;const{base64:v,type:w,width:b,height:y}=g.data;this.mutationCb({id:m,type:Ie["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:w}]},0,0]}]})};const d=1e3/t;let l=0,f;const p=()=>{const g=[];return r.document.querySelectorAll("canvas").forEach(m=>{z(m,n,i,!0)||g.push(m)}),g},h=g=>{if(l&&g-l<d){f=requestAnimationFrame(h);return}l=g,p().forEach(m=>Xn(this,void 0,void 0,function*(){var v;const w=this.mirror.getId(m);if(u.get(w)||m.width===0||m.height===0)return;if(u.set(w,!0),["webgl","webgl2"].includes(m.__context)){const y=m.getContext(m.__context);((v=y?.getContextAttributes())===null||v===void 0?void 0:v.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}const b=yield createImageBitmap(m);a.postMessage({id:w,bitmap:b,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[b])})),f=requestAnimationFrame(h)};f=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(f)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=yr(t,r,n,!1),o=Zn(this.processMutation.bind(this),t,r,n),s=ti(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const i=n.map(s=>Jn(s,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class ai{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new En,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},i=[];for(const o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(u,a)=>({rule:Ft(u),index:a}))})),n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class ui{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function F(e){return Object.assign(Object.assign({},e),{timestamp:Ge()})}let L,Ye,vt,Ze=!1;const X=en();function Ne(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:u=null,maskTextClass:a="rr-mask",maskTextSelector:d=null,inlineStylesheet:l=!0,maskAllInputs:f,maskInputOptions:p,slimDOMOptions:h,maskInputFn:g,maskTextFn:m,hooks:v,packFn:w,sampling:b={},dataURLOptions:y={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:U=!1,recordCrossOriginIframes:B=!1,recordAfter:k=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:N=!1,collectFonts:V=!1,inlineImages:J=!1,plugins:x,keepIframeSrcFn:he=()=>!1,ignoreCSSAttributes:$=new Set([]),errorHandler:ue}=e;kn(ue);const te=B?window.parent===window:!0;let ut=!1;if(!te)try{window.parent.document&&(ut=!1)}catch{ut=!0}if(te&&!t)throw new Error("emit function is required");S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),X.reset();const kt=f===!0?{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}:p!==void 0?p:{password:!0},Nt=h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};Cn();let Hr,Dt=0;const jr=M=>{for(const Y of x||[])Y.eventProcessor&&(M=Y.eventProcessor(M));return w&&!ut&&(M=w(M)),M};L=(M,Y)=>{var A;if(!((A=le[0])===null||A===void 0)&&A.isFrozen()&&M.type!==E.FullSnapshot&&!(M.type===E.IncrementalSnapshot&&M.data.source===_.Mutation)&&le.forEach(H=>H.unfreeze()),te)t?.(jr(M),Y);else if(ut){const H={type:"rrweb",event:jr(M),origin:window.location.origin,isCheckout:Y};window.parent.postMessage(H,"*")}if(M.type===E.FullSnapshot)Hr=M,Dt=0;else if(M.type===E.IncrementalSnapshot){if(M.data.source===_.Mutation&&M.data.isAttachIframe)return;Dt++;const H=n&&Dt>=n,ge=r&&M.timestamp-Hr.timestamp>r;(H||ge)&&Ye(!0)}};const ct=M=>{L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Mutation},M)}))},Gr=M=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Scroll},M)})),Vr=M=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.CanvasMutation},M)})),Bi=M=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.AdoptedStyleSheet},M)})),pe=new ai({mutationCb:ct,adoptedStyleSheetCb:Bi}),me=new Gn({mirror:X,mutationCb:ct,stylesheetManager:pe,recordCrossOriginIframes:B,wrappedEmit:L});for(const M of x||[])M.getMirror&&M.getMirror({nodeMirror:X,crossOriginIframeMirror:me.crossOriginIframeMirror,crossOriginIframeStyleMirror:me.crossOriginIframeStyleMirror});const At=new ui;vt=new si({recordCanvas:U,mutationCb:Vr,win:window,blockClass:i,blockSelector:o,mirror:X,sampling:b.canvas,dataURLOptions:y});const lt=new Vn({mutationCb:ct,scrollCb:Gr,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:d,inlineStylesheet:l,maskInputOptions:kt,dataURLOptions:y,maskTextFn:m,maskInputFn:g,recordCanvas:U,inlineImages:J,sampling:b,slimDOMOptions:Nt,iframeManager:me,stylesheetManager:pe,canvasManager:vt,keepIframeSrcFn:he,processedNodeManager:At},mirror:X});Ye=(M=!1)=>{if(!I)return;L(F({type:E.Meta,data:{href:window.location.href,width:Xt(),height:Jt()}}),M),pe.reset(),lt.init(),le.forEach(A=>A.lock());const Y=Mn(document,{mirror:X,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:d,inlineStylesheet:l,maskAllInputs:kt,maskTextFn:m,slimDOM:Nt,dataURLOptions:y,recordCanvas:U,inlineImages:J,onSerialize:A=>{Yt(A,X)&&me.addIframe(A),Zt(A,X)&&pe.trackLinkElement(A),gt(A)&<.addShadowRoot(A.shadowRoot,document)},onIframeLoad:(A,H)=>{me.attachIframe(A,H),lt.observeAttachShadow(A)},onStylesheetLoad:(A,H)=>{pe.attachLinkElement(A,H)},keepIframeSrcFn:he});if(!Y)return console.warn("Failed to snapshot the document");L(F({type:E.FullSnapshot,data:{node:Y,initialOffset:Vt(window)}}),M),le.forEach(A=>A.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&pe.adoptStyleSheets(document.adoptedStyleSheets,X.getId(document))};try{const M=[],Y=H=>{var ge;return C(jn)({mutationCb:ct,mousemoveCb:(D,Lt)=>L(F({type:E.IncrementalSnapshot,data:{source:Lt,positions:D}})),mouseInteractionCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.MouseInteraction},D)})),scrollCb:Gr,viewportResizeCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.ViewportResize},D)})),inputCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Input},D)})),mediaInteractionCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.MediaInteraction},D)})),styleSheetRuleCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.StyleSheetRule},D)})),styleDeclarationCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.StyleDeclaration},D)})),canvasMutationCb:Vr,fontCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Font},D)})),selectionCb:D=>{L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Selection},D)}))},customElementCb:D=>{L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.CustomElement},D)}))},blockClass:i,ignoreClass:s,ignoreSelector:u,maskTextClass:a,maskTextSelector:d,maskInputOptions:kt,inlineStylesheet:l,sampling:b,recordDOM:I,recordCanvas:U,inlineImages:J,userTriggeredOnInput:N,collectFonts:V,doc:H,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:he,blockSelector:o,slimDOMOptions:Nt,dataURLOptions:y,mirror:X,iframeManager:me,stylesheetManager:pe,shadowDomManager:lt,processedNodeManager:At,canvasManager:vt,ignoreCSSAttributes:$,plugins:((ge=x?.filter(D=>D.observer))===null||ge===void 0?void 0:ge.map(D=>({observer:D.observer,options:D.options,callback:Lt=>L(F({type:E.Plugin,data:{plugin:D.name,payload:Lt}}))})))||[]},v)};me.addLoadListener(H=>{try{M.push(Y(H.contentDocument))}catch(ge){console.warn(ge)}});const A=()=>{Ye(),M.push(Y(document)),Ze=!0};return document.readyState==="interactive"||document.readyState==="complete"?A():(M.push(q("DOMContentLoaded",()=>{L(F({type:E.DomContentLoaded,data:{}})),k==="DOMContentLoaded"&&A()})),M.push(q("load",()=>{L(F({type:E.Load,data:{}})),k==="load"&&A()},window))),()=>{M.forEach(H=>H()),At.destroy(),Ze=!1,Nn()}}catch(M){console.warn(M)}}Ne.addCustomEvent=(e,t)=>{if(!Ze)throw new Error("please add custom event after start recording");L(F({type:E.Custom,data:{tag:e,payload:t}}))},Ne.freezePage=()=>{le.forEach(e=>e.freeze())},Ne.takeFullSnapshot=e=>{if(!Ze)throw new Error("please take full snapshot after start recording");Ye(e)},Ne.mirror=X;var Sr=R.setImmediate,se,St,bt,br=Object.prototype.toString,ci=typeof Sr<"u"?function(t){return Sr(t)}:setTimeout;try{Object.defineProperty({},"x",{}),se=function(t,r,n,i){return Object.defineProperty(t,r,{value:n,writable:!0,configurable:i!==!1})}}catch{se=function(r,n,i){return r[n]=i,r}}bt=function(){var t,r,n;function i(o,s){this.fn=o,this.self=s,this.next=void 0}return{add:function(s,u){n=new i(s,u),r?r.next=n:t=n,r=n,n=void 0},drain:function(){var s=t;for(t=r=St=void 0;s;)s.fn.call(s.self),s=s.next}}}();function et(e,t){bt.add(e,t),St||(St=ci(bt.drain))}function wr(e){var t,r=typeof e;return e!==null&&(r==="object"||r==="function")&&(t=e.then),typeof t=="function"?t:!1}function wt(){for(var e=0;e<this.chain.length;e++)li(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function li(e,t,r){var n,i;try{t===!1?r.reject(e.msg):(t===!0?n=e.msg:n=t.call(void 0,e.msg),n===r.promise?r.reject(TypeError("Promise-chain cycle")):(i=wr(n))?i.call(n,r.resolve,r.reject):r.resolve(n))}catch(o){r.reject(o)}}function Ir(e){var t,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(t=wr(e))?et(function(){var n=new _r(r);try{t.call(e,function(){Ir.apply(n,arguments)},function(){De.apply(n,arguments)})}catch(i){De.call(n,i)}}):(r.msg=e,r.state=1,r.chain.length>0&&et(wt,r))}catch(n){De.call(new _r(r),n)}}}function De(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&et(wt,t))}function Mr(e,t,r,n){for(var i=0;i<t.length;i++)(function(s){e.resolve(t[s]).then(function(a){r(s,a)},n)})(i)}function _r(e){this.def=e,this.triggered=!1}function di(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function ae(e){if(typeof e!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var t=new di(this);this.then=function(n,i){var o={success:typeof n=="function"?n:!0,failure:typeof i=="function"?i:!1};return o.promise=new this.constructor(function(u,a){if(typeof u!="function"||typeof a!="function")throw TypeError("Not a function");o.resolve=u,o.reject=a}),t.chain.push(o),t.state!==0&&et(wt,t),o.promise},this.catch=function(n){return this.then(void 0,n)};try{e.call(void 0,function(n){Ir.call(t,n)},function(n){De.call(t,n)})}catch(r){De.call(t,r)}}var Cr=se({},"constructor",ae,!1);ae.prototype=Cr,se(Cr,"__NPO__",0,!1),se(ae,"resolve",function(t){var r=this;return t&&typeof t=="object"&&t.__NPO__===1?t:new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");i(t)})}),se(ae,"reject",function(t){return new this(function(n,i){if(typeof n!="function"||typeof i!="function")throw TypeError("Not a function");i(t)})}),se(ae,"all",function(t){var r=this;return br.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):t.length===0?r.resolve([]):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");var s=t.length,u=Array(s),a=0;Mr(r,t,function(l,f){u[l]=f,++a===s&&i(u)},o)})}),se(ae,"race",function(t){var r=this;return br.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");Mr(r,t,function(u,a){i(a)},o)})});var O;typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1?O=Promise:O=ae;var Er=(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))(Er||{}),Z=(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))(Z||{}),It={DEBUG:!1,LIB_VERSION:"2.61.0"},tt=24*60*60*1e3,Mt=8*1e3,rt=Array.prototype,fi=Function.prototype,Rr=Object.prototype,de=rt.slice,Ae=Rr.toString,nt=Rr.hasOwnProperty,Le=R.console,Pe=R.navigator,G=R.document,it=R.opera,ot=R.screen,fe=Pe.userAgent,_t=fi.bind,Or=rt.forEach,xr=rt.indexOf,Tr=rt.map,hi=Array.isArray,Ct={},c={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},K={log:function(){},warn:function(){},error:function(){},critical:function(){if(!c.isUndefined(Le)&&Le){var e=["Mixpanel error:"].concat(c.toArray(arguments));try{Le.error.apply(Le,e)}catch{c.each(e,function(r){Le.error(r)})}}}},Et=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(K,arguments)}},Fe=function(e){return{log:Et(K.log,e),error:Et(K.error,e),critical:Et(K.critical,e)}};c.bind=function(e,t){var r,n;if(_t&&e.bind===_t)return _t.apply(e,de.call(arguments,1));if(!c.isFunction(e))throw new TypeError;return r=de.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,r.concat(de.call(arguments)));var i={};i.prototype=e.prototype;var o=new i;i.prototype=null;var s=e.apply(o,r.concat(de.call(arguments)));return Object(s)===s?s:o},n},c.each=function(e,t,r){if(e!=null){if(Or&&e.forEach===Or)e.forEach(t,r);else if(e.length===+e.length){for(var n=0,i=e.length;n<i;n++)if(n in e&&t.call(r,e[n],n,e)===Ct)return}else for(var o in e)if(nt.call(e,o)&&t.call(r,e[o],o,e)===Ct)return}},c.extend=function(e){return c.each(de.call(arguments,1),function(t){for(var r in t)t[r]!==void 0&&(e[r]=t[r])}),e},c.isArray=hi||function(e){return Ae.call(e)==="[object Array]"},c.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch{return!1}},c.isArguments=function(e){return!!(e&&nt.call(e,"callee"))},c.toArray=function(e){return e?e.toArray?e.toArray():c.isArray(e)||c.isArguments(e)?de.call(e):c.values(e):[]},c.map=function(e,t,r){if(Tr&&e.map===Tr)return e.map(t,r);var n=[];return c.each(e,function(i){n.push(t.call(r,i))}),n},c.keys=function(e){var t=[];return e===null||c.each(e,function(r,n){t[t.length]=n}),t},c.values=function(e){var t=[];return e===null||c.each(e,function(r){t[t.length]=r}),t},c.include=function(e,t){var r=!1;return e===null?r:xr&&e.indexOf===xr?e.indexOf(t)!=-1:(c.each(e,function(n){if(r||(r=n===t))return Ct}),r)},c.includes=function(e,t){return e.indexOf(t)!==-1},c.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},c.isObject=function(e){return e===Object(e)&&!c.isArray(e)},c.isEmptyObject=function(e){if(c.isObject(e)){for(var t in e)if(nt.call(e,t))return!1;return!0}return!1},c.isUndefined=function(e){return e===void 0},c.isString=function(e){return Ae.call(e)=="[object String]"},c.isDate=function(e){return Ae.call(e)=="[object Date]"},c.isNumber=function(e){return Ae.call(e)=="[object Number]"},c.isElement=function(e){return!!(e&&e.nodeType===1)},c.encodeDates=function(e){return c.each(e,function(t,r){c.isDate(t)?e[r]=c.formatDate(t):c.isObject(t)&&(e[r]=c.encodeDates(t))}),e},c.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},c.formatDate=function(e){function t(r){return r<10?"0"+r:r}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())},c.strip_empty_properties=function(e){var t={};return c.each(e,function(r,n){c.isString(r)&&r.length>0&&(t[n]=r)}),t},c.truncate=function(e,t){var r;return typeof e=="string"?r=e.slice(0,t):c.isArray(e)?(r=[],c.each(e,function(n){r.push(c.truncate(n,t))})):c.isObject(e)?(r={},c.each(e,function(n,i){r[i]=c.truncate(n,t)})):r=e,r},c.JSONEncode=function(){return function(e){var t=e,r=function(i){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(i)?'"'+i.replace(o,function(u){var a=s[u];return typeof a=="string"?a:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'},n=function(i,o){var s="",u=" ",a=0,d="",l="",f=0,p=s,h=[],g=o[i];switch(g&&typeof g=="object"&&typeof g.toJSON=="function"&&(g=g.toJSON(i)),typeof g){case"string":return r(g);case"number":return isFinite(g)?String(g):"null";case"boolean":case"null":return String(g);case"object":if(!g)return"null";if(s+=u,h=[],Ae.apply(g)==="[object Array]"){for(f=g.length,a=0;a<f;a+=1)h[a]=n(a,g)||"null";return l=h.length===0?"[]":s?`[
|
|
32
|
+
***************************************************************************** */function e(d,l,f,p){function h(g){return g instanceof f?g:new f(function(m){m(g)})}return new(f||(f=Promise))(function(g,m){function v(y){try{b(p.next(y))}catch(S){m(S)}}function w(y){try{b(p.throw(y))}catch(S){m(S)}}function b(y){y.done?g(y.value):h(y.value).then(v,w)}b((p=p.apply(d,l||[])).next())})}for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=typeof Uint8Array>"u"?[]:new Uint8Array(256),n=0;n<t.length;n++)r[t.charCodeAt(n)]=n;var i=function(d){var l=new Uint8Array(d),f,p=l.length,h="";for(f=0;f<p;f+=3)h+=t[l[f]>>2],h+=t[(l[f]&3)<<4|l[f+1]>>4],h+=t[(l[f+1]&15)<<2|l[f+2]>>6],h+=t[l[f+2]&63];return p%3===2?h=h.substring(0,h.length-1)+"=":p%3===1&&(h=h.substring(0,h.length-2)+"=="),h};const o=new Map,s=new Map;function u(d,l,f){return e(this,void 0,void 0,function*(){const p=`${d}-${l}`;if("OffscreenCanvas"in globalThis){if(s.has(p))return s.get(p);const h=new OffscreenCanvas(d,l);h.getContext("2d");const m=yield(yield h.convertToBlob(f)).arrayBuffer(),v=i(m);return s.set(p,v),v}else return""})}const a=self;a.onmessage=function(d){return e(this,void 0,void 0,function*(){if("OffscreenCanvas"in globalThis){const{id:l,bitmap:f,width:p,height:h,dataURLOptions:g}=d.data,m=u(p,h,g),v=new OffscreenCanvas(p,h);v.getContext("2d").drawImage(f,0,0),f.close();const b=yield v.convertToBlob(g),y=b.type,S=yield b.arrayBuffer(),I=i(S);if(!o.has(l)&&(yield m)===I)return o.set(l,I),a.postMessage({id:l});if(o.get(l)===I)return a.postMessage({id:l});a.postMessage({id:l,type:y,base64:I,width:p,height:h}),o.set(l,I)}else return a.postMessage({id:d.data.id})})}})()},null);class oi{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(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(a,d)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(d)};const{sampling:r="all",win:n,blockClass:i,blockSelector:o,recordCanvas:s,dataURLOptions:u}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,i,o),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,i,o,{dataURLOptions:u})}initCanvasFPSObserver(t,r,n,i,o){const s=vr(r,n,i,!0),u=new Map,a=new ii;a.onmessage=g=>{const{id:m}=g.data;if(u.set(m,!1),!("base64"in g.data))return;const{base64:v,type:w,width:b,height:y}=g.data;this.mutationCb({id:m,type:Ie["2D"],commands:[{property:"clearRect",args:[0,0,b,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:v}],type:w}]},0,0]}]})};const d=1e3/t;let l=0,f;const p=()=>{const g=[];return r.document.querySelectorAll("canvas").forEach(m=>{z(m,n,i,!0)||g.push(m)}),g},h=g=>{if(l&&g-l<d){f=requestAnimationFrame(h);return}l=g,p().forEach(m=>Jn(this,void 0,void 0,function*(){var v;const w=this.mirror.getId(m);if(u.get(w)||m.width===0||m.height===0)return;if(u.set(w,!0),["webgl","webgl2"].includes(m.__context)){const y=m.getContext(m.__context);((v=y?.getContextAttributes())===null||v===void 0?void 0:v.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}const b=yield createImageBitmap(m);a.postMessage({id:w,bitmap:b,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[b])})),f=requestAnimationFrame(h)};f=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(f)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=vr(t,r,n,!1),o=Yn(this.processMutation.bind(this),t,r,n),s=ei(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{i(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const i=n.map(s=>Vn(s,["type"])),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class si{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Cn,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},i=[];for(const o of t){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),i.push({styleId:s,rules:Array.from(o.rules||CSSRule,(u,a)=>({rule:Bt(u),index:a}))})),n.styleIds.push(s)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class ai{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(i=>i!==r)}add(t,r){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function F(e){return Object.assign(Object.assign({},e),{timestamp:Ge()})}let L,Ye,vt,Ze=!1;const X=Zr();function Ne(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:s="rr-ignore",ignoreSelector:u=null,maskTextClass:a="rr-mask",maskTextSelector:d=null,inlineStylesheet:l=!0,maskAllInputs:f,maskInputOptions:p,slimDOMOptions:h,maskInputFn:g,maskTextFn:m,hooks:v,packFn:w,sampling:b={},dataURLOptions:y={},mousemoveWait:S,recordDOM:I=!0,recordCanvas:U=!1,recordCrossOriginIframes:B=!1,recordAfter:k=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:N=!1,collectFonts:V=!1,inlineImages:J=!1,plugins:x,keepIframeSrcFn:he=()=>!1,ignoreCSSAttributes:$=new Set([]),errorHandler:ue}=e;Tn(ue);const te=B?window.parent===window:!0;let ut=!1;if(!te)try{window.parent.document&&(ut=!1)}catch{ut=!0}if(te&&!t)throw new Error("emit function is required");S!==void 0&&b.mousemove===void 0&&(b.mousemove=S),X.reset();const Nt=f===!0?{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}:p!==void 0?p:{password:!0},Dt=h===!0||h==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};_n();let $r,At=0;const Hr=M=>{for(const Y of x||[])Y.eventProcessor&&(M=Y.eventProcessor(M));return w&&!ut&&(M=w(M)),M};L=(M,Y)=>{var A;if(!((A=le[0])===null||A===void 0)&&A.isFrozen()&&M.type!==E.FullSnapshot&&!(M.type===E.IncrementalSnapshot&&M.data.source===_.Mutation)&&le.forEach(H=>H.unfreeze()),te)t?.(Hr(M),Y);else if(ut){const H={type:"rrweb",event:Hr(M),origin:window.location.origin,isCheckout:Y};window.parent.postMessage(H,"*")}if(M.type===E.FullSnapshot)$r=M,At=0;else if(M.type===E.IncrementalSnapshot){if(M.data.source===_.Mutation&&M.data.isAttachIframe)return;At++;const H=n&&At>=n,ge=r&&M.timestamp-$r.timestamp>r;(H||ge)&&Ye(!0)}};const ct=M=>{L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Mutation},M)}))},jr=M=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Scroll},M)})),Gr=M=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.CanvasMutation},M)})),Bi=M=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.AdoptedStyleSheet},M)})),pe=new si({mutationCb:ct,adoptedStyleSheetCb:Bi}),me=new jn({mirror:X,mutationCb:ct,stylesheetManager:pe,recordCrossOriginIframes:B,wrappedEmit:L});for(const M of x||[])M.getMirror&&M.getMirror({nodeMirror:X,crossOriginIframeMirror:me.crossOriginIframeMirror,crossOriginIframeStyleMirror:me.crossOriginIframeStyleMirror});const Lt=new ai;vt=new oi({recordCanvas:U,mutationCb:Gr,win:window,blockClass:i,blockSelector:o,mirror:X,sampling:b.canvas,dataURLOptions:y});const lt=new Gn({mutationCb:ct,scrollCb:jr,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:d,inlineStylesheet:l,maskInputOptions:Nt,dataURLOptions:y,maskTextFn:m,maskInputFn:g,recordCanvas:U,inlineImages:J,sampling:b,slimDOMOptions:Dt,iframeManager:me,stylesheetManager:pe,canvasManager:vt,keepIframeSrcFn:he,processedNodeManager:Lt},mirror:X});Ye=(M=!1)=>{if(!I)return;L(F({type:E.Meta,data:{href:window.location.href,width:Kt(),height:Xt()}}),M),pe.reset(),lt.init(),le.forEach(A=>A.lock());const Y=In(document,{mirror:X,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:d,inlineStylesheet:l,maskAllInputs:Nt,maskTextFn:m,slimDOM:Dt,dataURLOptions:y,recordCanvas:U,inlineImages:J,onSerialize:A=>{Zt(A,X)&&me.addIframe(A),er(A,X)&&pe.trackLinkElement(A),gt(A)&<.addShadowRoot(A.shadowRoot,document)},onIframeLoad:(A,H)=>{me.attachIframe(A,H),lt.observeAttachShadow(A)},onStylesheetLoad:(A,H)=>{pe.attachLinkElement(A,H)},keepIframeSrcFn:he});if(!Y)return console.warn("Failed to snapshot the document");L(F({type:E.FullSnapshot,data:{node:Y,initialOffset:Jt(window)}}),M),le.forEach(A=>A.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&pe.adoptStyleSheets(document.adoptedStyleSheets,X.getId(document))};try{const M=[],Y=H=>{var ge;return C(Hn)({mutationCb:ct,mousemoveCb:(D,Pt)=>L(F({type:E.IncrementalSnapshot,data:{source:Pt,positions:D}})),mouseInteractionCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.MouseInteraction},D)})),scrollCb:jr,viewportResizeCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.ViewportResize},D)})),inputCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Input},D)})),mediaInteractionCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.MediaInteraction},D)})),styleSheetRuleCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.StyleSheetRule},D)})),styleDeclarationCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.StyleDeclaration},D)})),canvasMutationCb:Gr,fontCb:D=>L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Font},D)})),selectionCb:D=>{L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.Selection},D)}))},customElementCb:D=>{L(F({type:E.IncrementalSnapshot,data:Object.assign({source:_.CustomElement},D)}))},blockClass:i,ignoreClass:s,ignoreSelector:u,maskTextClass:a,maskTextSelector:d,maskInputOptions:Nt,inlineStylesheet:l,sampling:b,recordDOM:I,recordCanvas:U,inlineImages:J,userTriggeredOnInput:N,collectFonts:V,doc:H,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:he,blockSelector:o,slimDOMOptions:Dt,dataURLOptions:y,mirror:X,iframeManager:me,stylesheetManager:pe,shadowDomManager:lt,processedNodeManager:Lt,canvasManager:vt,ignoreCSSAttributes:$,plugins:((ge=x?.filter(D=>D.observer))===null||ge===void 0?void 0:ge.map(D=>({observer:D.observer,options:D.options,callback:Pt=>L(F({type:E.Plugin,data:{plugin:D.name,payload:Pt}}))})))||[]},v)};me.addLoadListener(H=>{try{M.push(Y(H.contentDocument))}catch(ge){console.warn(ge)}});const A=()=>{Ye(),M.push(Y(document)),Ze=!0};return document.readyState==="interactive"||document.readyState==="complete"?A():(M.push(q("DOMContentLoaded",()=>{L(F({type:E.DomContentLoaded,data:{}})),k==="DOMContentLoaded"&&A()})),M.push(q("load",()=>{L(F({type:E.Load,data:{}})),k==="load"&&A()},window))),()=>{M.forEach(H=>H()),Lt.destroy(),Ze=!1,kn()}}catch(M){console.warn(M)}}Ne.addCustomEvent=(e,t)=>{if(!Ze)throw new Error("please add custom event after start recording");L(F({type:E.Custom,data:{tag:e,payload:t}}))},Ne.freezePage=()=>{le.forEach(e=>e.freeze())},Ne.takeFullSnapshot=e=>{if(!Ze)throw new Error("please take full snapshot after start recording");Ye(e)},Ne.mirror=X;var br=R.setImmediate,se,St,bt,wr=Object.prototype.toString,ui=typeof br<"u"?function(t){return br(t)}:setTimeout;try{Object.defineProperty({},"x",{}),se=function(t,r,n,i){return Object.defineProperty(t,r,{value:n,writable:!0,configurable:i!==!1})}}catch{se=function(r,n,i){return r[n]=i,r}}bt=function(){var t,r,n;function i(o,s){this.fn=o,this.self=s,this.next=void 0}return{add:function(s,u){n=new i(s,u),r?r.next=n:t=n,r=n,n=void 0},drain:function(){var s=t;for(t=r=St=void 0;s;)s.fn.call(s.self),s=s.next}}}();function et(e,t){bt.add(e,t),St||(St=ui(bt.drain))}function Ir(e){var t,r=typeof e;return e!==null&&(r==="object"||r==="function")&&(t=e.then),typeof t=="function"?t:!1}function wt(){for(var e=0;e<this.chain.length;e++)ci(this,this.state===1?this.chain[e].success:this.chain[e].failure,this.chain[e]);this.chain.length=0}function ci(e,t,r){var n,i;try{t===!1?r.reject(e.msg):(t===!0?n=e.msg:n=t.call(void 0,e.msg),n===r.promise?r.reject(TypeError("Promise-chain cycle")):(i=Ir(n))?i.call(n,r.resolve,r.reject):r.resolve(n))}catch(o){r.reject(o)}}function Mr(e){var t,r=this;if(!r.triggered){r.triggered=!0,r.def&&(r=r.def);try{(t=Ir(e))?et(function(){var n=new Cr(r);try{t.call(e,function(){Mr.apply(n,arguments)},function(){De.apply(n,arguments)})}catch(i){De.call(n,i)}}):(r.msg=e,r.state=1,r.chain.length>0&&et(wt,r))}catch(n){De.call(new Cr(r),n)}}}function De(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&et(wt,t))}function _r(e,t,r,n){for(var i=0;i<t.length;i++)(function(s){e.resolve(t[s]).then(function(a){r(s,a)},n)})(i)}function Cr(e){this.def=e,this.triggered=!1}function li(e){this.promise=e,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function ae(e){if(typeof e!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var t=new li(this);this.then=function(n,i){var o={success:typeof n=="function"?n:!0,failure:typeof i=="function"?i:!1};return o.promise=new this.constructor(function(u,a){if(typeof u!="function"||typeof a!="function")throw TypeError("Not a function");o.resolve=u,o.reject=a}),t.chain.push(o),t.state!==0&&et(wt,t),o.promise},this.catch=function(n){return this.then(void 0,n)};try{e.call(void 0,function(n){Mr.call(t,n)},function(n){De.call(t,n)})}catch(r){De.call(t,r)}}var Er=se({},"constructor",ae,!1);ae.prototype=Er,se(Er,"__NPO__",0,!1),se(ae,"resolve",function(t){var r=this;return t&&typeof t=="object"&&t.__NPO__===1?t:new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");i(t)})}),se(ae,"reject",function(t){return new this(function(n,i){if(typeof n!="function"||typeof i!="function")throw TypeError("Not a function");i(t)})}),se(ae,"all",function(t){var r=this;return wr.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):t.length===0?r.resolve([]):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");var s=t.length,u=Array(s),a=0;_r(r,t,function(l,f){u[l]=f,++a===s&&i(u)},o)})}),se(ae,"race",function(t){var r=this;return wr.call(t)!=="[object Array]"?r.reject(TypeError("Not an array")):new r(function(i,o){if(typeof i!="function"||typeof o!="function")throw TypeError("Not a function");_r(r,t,function(u,a){i(a)},o)})});var O;typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1?O=Promise:O=ae;var It=(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))(It||{}),Z=(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))(Z||{}),Mt={DEBUG:!1,LIB_VERSION:"2.61.2"},tt=24*60*60*1e3,_t=8*1e3,rt=Array.prototype,di=Function.prototype,Rr=Object.prototype,de=rt.slice,Ae=Rr.toString,nt=Rr.hasOwnProperty,Le=R.console,Pe=R.navigator,G=R.document,it=R.opera,ot=R.screen,fe=Pe.userAgent,Ct=di.bind,Or=rt.forEach,xr=rt.indexOf,Tr=rt.map,fi=Array.isArray,Et={},c={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},K={log:function(){},warn:function(){},error:function(){},critical:function(){if(!c.isUndefined(Le)&&Le){var e=["Mixpanel error:"].concat(c.toArray(arguments));try{Le.error.apply(Le,e)}catch{c.each(e,function(r){Le.error(r)})}}}},Rt=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(K,arguments)}},Fe=function(e){return{log:Rt(K.log,e),error:Rt(K.error,e),critical:Rt(K.critical,e)}};c.bind=function(e,t){var r,n;if(Ct&&e.bind===Ct)return Ct.apply(e,de.call(arguments,1));if(!c.isFunction(e))throw new TypeError;return r=de.call(arguments,2),n=function(){if(!(this instanceof n))return e.apply(t,r.concat(de.call(arguments)));var i={};i.prototype=e.prototype;var o=new i;i.prototype=null;var s=e.apply(o,r.concat(de.call(arguments)));return Object(s)===s?s:o},n},c.each=function(e,t,r){if(e!=null){if(Or&&e.forEach===Or)e.forEach(t,r);else if(e.length===+e.length){for(var n=0,i=e.length;n<i;n++)if(n in e&&t.call(r,e[n],n,e)===Et)return}else for(var o in e)if(nt.call(e,o)&&t.call(r,e[o],o,e)===Et)return}},c.extend=function(e){return c.each(de.call(arguments,1),function(t){for(var r in t)t[r]!==void 0&&(e[r]=t[r])}),e},c.isArray=fi||function(e){return Ae.call(e)==="[object Array]"},c.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch{return!1}},c.isArguments=function(e){return!!(e&&nt.call(e,"callee"))},c.toArray=function(e){return e?e.toArray?e.toArray():c.isArray(e)||c.isArguments(e)?de.call(e):c.values(e):[]},c.map=function(e,t,r){if(Tr&&e.map===Tr)return e.map(t,r);var n=[];return c.each(e,function(i){n.push(t.call(r,i))}),n},c.keys=function(e){var t=[];return e===null||c.each(e,function(r,n){t[t.length]=n}),t},c.values=function(e){var t=[];return e===null||c.each(e,function(r){t[t.length]=r}),t},c.include=function(e,t){var r=!1;return e===null?r:xr&&e.indexOf===xr?e.indexOf(t)!=-1:(c.each(e,function(n){if(r||(r=n===t))return Et}),r)},c.includes=function(e,t){return e.indexOf(t)!==-1},c.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},c.isObject=function(e){return e===Object(e)&&!c.isArray(e)},c.isEmptyObject=function(e){if(c.isObject(e)){for(var t in e)if(nt.call(e,t))return!1;return!0}return!1},c.isUndefined=function(e){return e===void 0},c.isString=function(e){return Ae.call(e)=="[object String]"},c.isDate=function(e){return Ae.call(e)=="[object Date]"},c.isNumber=function(e){return Ae.call(e)=="[object Number]"},c.isElement=function(e){return!!(e&&e.nodeType===1)},c.encodeDates=function(e){return c.each(e,function(t,r){c.isDate(t)?e[r]=c.formatDate(t):c.isObject(t)&&(e[r]=c.encodeDates(t))}),e},c.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},c.formatDate=function(e){function t(r){return r<10?"0"+r:r}return e.getUTCFullYear()+"-"+t(e.getUTCMonth()+1)+"-"+t(e.getUTCDate())+"T"+t(e.getUTCHours())+":"+t(e.getUTCMinutes())+":"+t(e.getUTCSeconds())},c.strip_empty_properties=function(e){var t={};return c.each(e,function(r,n){c.isString(r)&&r.length>0&&(t[n]=r)}),t},c.truncate=function(e,t){var r;return typeof e=="string"?r=e.slice(0,t):c.isArray(e)?(r=[],c.each(e,function(n){r.push(c.truncate(n,t))})):c.isObject(e)?(r={},c.each(e,function(n,i){r[i]=c.truncate(n,t)})):r=e,r},c.JSONEncode=function(){return function(e){var t=e,r=function(i){var o=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return o.lastIndex=0,o.test(i)?'"'+i.replace(o,function(u){var a=s[u];return typeof a=="string"?a:"\\u"+("0000"+u.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+i+'"'},n=function(i,o){var s="",u=" ",a=0,d="",l="",f=0,p=s,h=[],g=o[i];switch(g&&typeof g=="object"&&typeof g.toJSON=="function"&&(g=g.toJSON(i)),typeof g){case"string":return r(g);case"number":return isFinite(g)?String(g):"null";case"boolean":case"null":return String(g);case"object":if(!g)return"null";if(s+=u,h=[],Ae.apply(g)==="[object Array]"){for(f=g.length,a=0;a<f;a+=1)h[a]=n(a,g)||"null";return l=h.length===0?"[]":s?`[
|
|
33
33
|
`+s+h.join(`,
|
|
34
34
|
`+s)+`
|
|
35
35
|
`+p+"]":"["+h.join(",")+"]",s=p,l}for(d in g)nt.call(g,d)&&(l=n(d,g),l&&h.push(r(d)+(s?": ":":")+l));return l=h.length===0?"{}":s?"{"+h.join(",")+p+"}":"{"+h.join(",")+"}",s=p,l}};return n("",{"":t})}}(),c.JSONDecode=function(){var e,t,r={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
36
36
|
`,r:"\r",t:" "},n,i=function(h){var g=new SyntaxError(h);throw g.at=e,g.text=n,g},o=function(h){return h&&h!==t&&i("Expected '"+h+"' instead of '"+t+"'"),t=n.charAt(e),e+=1,t},s=function(){var h,g="";for(t==="-"&&(g="-",o("-"));t>="0"&&t<="9";)g+=t,o();if(t===".")for(g+=".";o()&&t>="0"&&t<="9";)g+=t;if(t==="e"||t==="E")for(g+=t,o(),(t==="-"||t==="+")&&(g+=t,o());t>="0"&&t<="9";)g+=t,o();if(h=+g,!isFinite(h))i("Bad number");else return h},u=function(){var h,g,m="",v;if(t==='"')for(;o();){if(t==='"')return o(),m;if(t==="\\")if(o(),t==="u"){for(v=0,g=0;g<4&&(h=parseInt(o(),16),!!isFinite(h));g+=1)v=v*16+h;m+=String.fromCharCode(v)}else if(typeof r[t]=="string")m+=r[t];else break;else m+=t}i("Bad string")},a=function(){for(;t&&t<=" ";)o()},d=function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}i('Unexpected "'+t+'"')},l,f=function(){var h=[];if(t==="["){if(o("["),a(),t==="]")return o("]"),h;for(;t;){if(h.push(l()),a(),t==="]")return o("]"),h;o(","),a()}}i("Bad array")},p=function(){var h,g={};if(t==="{"){if(o("{"),a(),t==="}")return o("}"),g;for(;t;){if(h=u(),a(),o(":"),Object.hasOwnProperty.call(g,h)&&i('Duplicate key "'+h+'"'),g[h]=l(),a(),t==="}")return o("}"),g;o(","),a()}}i("Bad object")};return l=function(){switch(a(),t){case"{":return p();case"[":return f();case'"':return u();case"-":return s();default:return t>="0"&&t<="9"?s():d()}},function(h){var g;return n=h,e=0,t=" ",g=l(),a(),t&&i("Syntax error"),g}}(),c.base64Encode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,n,i,o,s,u,a,d,l=0,f=0,p="",h=[];if(!e)return e;e=c.utf8Encode(e);do r=e.charCodeAt(l++),n=e.charCodeAt(l++),i=e.charCodeAt(l++),d=r<<16|n<<8|i,o=d>>18&63,s=d>>12&63,u=d>>6&63,a=d&63,h[f++]=t.charAt(o)+t.charAt(s)+t.charAt(u)+t.charAt(a);while(l<e.length);switch(p=h.join(""),e.length%3){case 1:p=p.slice(0,-2)+"==";break;case 2:p=p.slice(0,-1)+"=";break}return p},c.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,`
|
|
37
37
|
`).replace(/\r/g,`
|
|
38
|
-
`);var t="",r,n,i=0,o;for(r=n=0,i=e.length,o=0;o<i;o++){var s=e.charCodeAt(o),u=null;s<128?n++:s>127&&s<2048?u=String.fromCharCode(s>>6|192,s&63|128):u=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),u!==null&&(n>r&&(t+=e.substring(r,n)),t+=u,r=n=o+1)}return n>r&&(t+=e.substring(r,e.length)),t},c.UUID=function(){var e=function(){var n=1*new Date,i;if(R.performance&&R.performance.now)i=R.performance.now();else for(i=0;n==1*new Date;)i++;return n.toString(16)+Math.floor(i).toString(16)},t=function(){return Math.random().toString(16).replace(".","")},r=function(){var n=fe,i,o,s=[],u=0;function a(d,l){var f,p=0;for(f=0;f<l.length;f++)p|=s[f]<<f*8;return d^p}for(i=0;i<n.length;i++)o=n.charCodeAt(i),s.unshift(o&255),s.length>=4&&(u=a(u,s),s=[]);return s.length>0&&(u=a(u,s)),u.toString(16)};return function(){var n=(ot.height*ot.width).toString(16);return e()+"-"+t()+"-"+r()+"-"+n+"-"+e()}}();var kr=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];c.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<kr.length;t++)if(e.indexOf(kr[t])!==-1)return!0;return!1},c.HTTPBuildQuery=function(e,t){var r,n,i=[];return c.isUndefined(t)&&(t="&"),c.each(e,function(o,s){r=encodeURIComponent(o.toString()),n=encodeURIComponent(s),i[i.length]=n+"="+r}),i.join(t)},c.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var r="[\\?&]"+t+"=([^&#]*)",n=new RegExp(r),i=n.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{K.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},c.cookie={get:function(e){for(var t=e+"=",r=G.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=c.JSONDecode(c.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,r,n,i,o,s){var u="",a="",d="";if(s)u="; domain="+s;else if(n){var l=Ar(G.location.hostname);u=l?"; domain=."+l:""}if(r){var f=new Date;f.setTime(f.getTime()+r*1e3),a="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),G.cookie=e+"="+encodeURIComponent(t)+a+"; path=/"+u+d},set:function(e,t,r,n,i,o,s){var u="",a="",d="";if(s)u="; domain="+s;else if(n){var l=Ar(G.location.hostname);u=l?"; domain=."+l:""}if(r){var f=new Date;f.setTime(f.getTime()+r*24*60*60*1e3),a="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var p=e+"="+encodeURIComponent(t)+a+"; path=/"+u+d;return G.cookie=p,p},remove:function(e,t,r){c.cookie.set(e,"",-1,t,!1,!1,r)}};var Nr=function(e){var t=!0;try{var r="__mplss_"+xt(8),n="xyz";e.setItem(r,n),e.getItem(r)!==n&&(t=!1),e.removeItem(r)}catch{t=!1}return t},Rt=null,Be=function(e,t){return Rt!==null&&!t?Rt:Rt=Nr(e||R.localStorage)},Ot=null,pi=function(e,t){return Ot!==null&&!t?Ot:Ot=Nr(e||R.sessionStorage)};function Dr(e,t,r){var n=function(i){K.error(t+" error: "+i)};return{is_supported:function(i){var o=r(e,i);return o||K.error(t+" unsupported"),o},error:n,get:function(i){try{return e.getItem(i)}catch(o){n(o)}return null},parse:function(i){try{return c.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(s){n(s)}},remove:function(i){try{e.removeItem(i)}catch(o){n(o)}}}}c.localStorage=Dr(R.localStorage,"localStorage",Be),c.sessionStorage=Dr(R.sessionStorage,"sessionStorage",pi),c.register_event=function(){var e=function(n,i,o,s,u){if(!n){K.error("No valid element provided to register_event");return}if(n.addEventListener&&!s)n.addEventListener(i,o,!!u);else{var a="on"+i,d=n[a];n[a]=t(n,o,d)}};function t(n,i,o){var s=function(u){if(u=u||r(R.event),!!u){var a=!0,d,l;return c.isFunction(o)&&(d=o(u)),l=i.call(n,u),(d===!1||l===!1)&&(a=!1),a}};return s}function r(n){return n&&(n.preventDefault=r.preventDefault,n.stopPropagation=r.stopPropagation),n}return r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0},e}();var mi=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');c.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function r(i,o){var s=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(s)>=0}function n(i){if(!G.getElementsByTagName)return[];var o=i.split(" "),s,u,a,d,l,f,p,h,g,m,v=[G];for(f=0;f<o.length;f++){if(s=o[f].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){u=s.split("#"),a=u[0];var w=u[1],b=G.getElementById(w);if(!b||a&&b.nodeName.toLowerCase()!=a)return[];v=[b];continue}if(s.indexOf(".")>-1){u=s.split("."),a=u[0];var y=u[1];for(a||(a="*"),d=[],l=0,p=0;p<v.length;p++)for(a=="*"?g=e(v[p]):g=v[p].getElementsByTagName(a),h=0;h<g.length;h++)d[l++]=g[h];for(v=[],m=0,p=0;p<d.length;p++)d[p].className&&c.isString(d[p].className)&&r(d[p],y)&&(v[m++]=d[p]);continue}var S=s.match(mi);if(S){a=S[1];var I=S[2],U=S[3],B=S[4];for(a||(a="*"),d=[],l=0,p=0;p<v.length;p++)for(a=="*"?g=e(v[p]):g=v[p].getElementsByTagName(a),h=0;h<g.length;h++)d[l++]=g[h];v=[],m=0;var k;switch(U){case"=":k=function(N){return N.getAttribute(I)==B};break;case"~":k=function(N){return N.getAttribute(I).match(new RegExp("\\b"+B+"\\b"))};break;case"|":k=function(N){return N.getAttribute(I).match(new RegExp("^"+B+"-?"))};break;case"^":k=function(N){return N.getAttribute(I).indexOf(B)===0};break;case"$":k=function(N){return N.getAttribute(I).lastIndexOf(B)==N.getAttribute(I).length-B.length};break;case"*":k=function(N){return N.getAttribute(I).indexOf(B)>-1};break;default:k=function(N){return N.getAttribute(I)}}for(v=[],m=0,p=0;p<d.length;p++)k(d[p])&&(v[m++]=d[p]);continue}for(a=s,d=[],l=0,p=0;p<v.length;p++)for(g=v[p].getElementsByTagName(a),h=0;h<g.length;h++)d[l++]=g[h];v=d}return v}return function(i){return c.isElement(i)?[i]:c.isObject(i)&&!c.isUndefined(i.length)?i:n.call(this,i)}}();var gi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],yi=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];c.info={campaignParams:function(e){var t="",r={};return c.each(gi,function(n){t=c.getQueryParam(G.URL,n),t.length?r[n]=t:e!==void 0&&(r[n]=e)}),r},clickParams:function(){var e="",t={};return c.each(yi,function(r){e=c.getQueryParam(G.URL,r),e.length&&(t[r]=e)}),t},marketingParams:function(){return c.extend(c.info.campaignParams(),c.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=c.info.searchEngine(e),r=t!="yahoo"?"q":"p",n={};if(t!==null){n.$search_engine=t;var i=c.getQueryParam(e,r);i.length&&(n.mp_keyword=i)}return n},browser:function(e,t,r){return t=t||"",r||c.includes(e," OPR/")?c.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":c.includes(e,"IEMobile")||c.includes(e,"WPDesktop")?"Internet Explorer Mobile":c.includes(e,"SamsungBrowser/")?"Samsung Internet":c.includes(e,"Edge")||c.includes(e,"Edg/")?"Microsoft Edge":c.includes(e,"FBIOS")?"Facebook Mobile":c.includes(e,"Chrome")?"Chrome":c.includes(e,"CriOS")?"Chrome iOS":c.includes(e,"UCWEB")||c.includes(e,"UCBrowser")?"UC Browser":c.includes(e,"FxiOS")?"Firefox iOS":c.includes(t,"Apple")?c.includes(e,"Mobile")?"Mobile Safari":"Safari":c.includes(e,"Android")?"Android Mobile":c.includes(e,"Konqueror")?"Konqueror":c.includes(e,"Firefox")?"Firefox":c.includes(e,"MSIE")||c.includes(e,"Trident/")?"Internet Explorer":c.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,r){var n=c.info.browser(e,t,r),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+)?)/},o=i[n];if(o===void 0)return null;var s=e.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var e=fe;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 R.location.href},properties:function(e){return typeof e!="object"&&(e={}),c.extend(c.strip_empty_properties({$os:c.info.os(),$browser:c.info.browser(fe,Pe.vendor,it),$referrer:G.referrer,$referring_domain:c.info.referringDomain(G.referrer),$device:c.info.device(fe)}),{$current_url:c.info.currentUrl(),$browser_version:c.info.browserVersion(fe,Pe.vendor,it),$screen_height:ot.height,$screen_width:ot.width,mp_lib:"web",$lib_version:It.LIB_VERSION,$insert_id:xt(),time:c.timestamp()/1e3},c.strip_empty_properties(e))},people_properties:function(){return c.extend(c.strip_empty_properties({$os:c.info.os(),$browser:c.info.browser(fe,Pe.vendor,it)}),{$browser_version:c.info.browserVersion(fe,Pe.vendor,it)})},mpPageViewProperties:function(){return c.strip_empty_properties({current_page_title:G.title,current_domain:R.location.hostname,current_url_path:R.location.pathname,current_url_protocol:R.location.protocol,current_url_search:R.location.search})}};var vi=function(e,t){var r=null,n=[];return function(i){var o=this;return n.push(i),r||(r=new O(function(s){setTimeout(function(){var u=e.apply(o,[n]);r=null,n=[],s(u)},t)})),r}},xt=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},Si=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,bi=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Ar=function(e){var t=bi,r=e.split("."),n=r[r.length-1];(n.length>4||n==="com"||n==="org")&&(t=Si);var i=e.match(t);return i?i[0]:""},wi=function(){var e=R.navigator.onLine;return c.isUndefined(e)||e},Tt=function(){},st=null,at=null;typeof JSON<"u"&&(st=JSON.stringify,at=JSON.parse),st=st||c.JSONEncode,at=at||c.JSONDecode,c.info=c.info,c.info.browser=c.info.browser,c.info.browserVersion=c.info.browserVersion,c.info.device=c.info.device,c.info.properties=c.info.properties,c.isBlockedUA=c.isBlockedUA,c.isEmptyObject=c.isEmptyObject,c.isObject=c.isObject,c.JSONDecode=c.JSONDecode,c.JSONEncode=c.JSONEncode,c.toArray=c.toArray,c.NPO=ae;var Ii="mixpanelBrowserDb",Lr="mixpanelRecordingEvents",Pr="mixpanelRecordingRegistry",Mi=1,_i=[Lr,Pr],ne=function(e){this.dbPromise=null,this.storeName=e};ne.prototype._openDb=function(){return new O(function(e,t){var r=R.indexedDB.open(Ii,Mi);r.onerror=function(){t(r.error)},r.onsuccess=function(){e(r.result)},r.onupgradeneeded=function(n){var i=n.target.result;_i.forEach(function(o){i.createObjectStore(o)})}})},ne.prototype.init=function(){return R.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof R.IDBDatabase?O.resolve():O.reject(e)})):O.reject("indexedDB is not supported in this browser")},ne.prototype.makeTransaction=function(e,t){var r=this.storeName,n=function(i){return new O(function(o,s){var u=i.transaction(r,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){s(u.error)},t(u.objectStore(r))})};return this.dbPromise.then(n).catch(function(i){return i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(n)):O.reject(i)}.bind(this))},ne.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(r){r.put(t,e)})},ne.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(r){t=r.get(e)}).then(function(){return t.result})},ne.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},ne.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var Ci="__mp_opt_in_out_";function Ei(e,t){if(Ti(t))return K.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 r=xi(e,t)==="0";return r&&K.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),r}function Fr(e){return ki(e,function(t){return this.get_config(t)})}function Ri(e){return e=e||{},e.persistenceType==="localStorage"?c.localStorage:c.cookie}function Oi(e,t){return t=t||{},(t.persistencePrefix||Ci)+e}function xi(e,t){return Ri(t).get(Oi(e,t))}function Ti(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||R,r=t.navigator||{},n=!1;return c.each([r.doNotTrack,r.msDoNotTrack,t.doNotTrack],function(i){c.includes([!0,1,"1","yes"],i)&&(n=!0)}),n}function ki(e,t){return function(){var r=!1;try{var n=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),s=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");n&&(r=Ei(n,{ignoreDnt:i,persistenceType:o,persistencePrefix:s,window:u}))}catch(d){K.error("Unexpected error when checking tracking opt-out status: "+d)}if(!r)return e.apply(this,arguments);var a=arguments[arguments.length-1];typeof a=="function"&&a(0)}}var Ni=Fe("lock"),Br=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||R.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||O};Br.prototype.withLock=function(e,t){var r=this.promiseImpl;return new r(c.bind(function(n,i){var o=t||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),u=this.storageKey,a=this.pollIntervalMS,d=this.timeoutMS,l=this.storage,f=u+":X",p=u+":Y",h=u+":Z",g=function(y){if(new Date().getTime()-s>d){Ni.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),l.removeItem(h),l.removeItem(p),w();return}setTimeout(function(){try{y()}catch(S){i(S)}},a*(Math.random()+.1))},m=function(y,S){y()?S():g(function(){m(y,S)})},v=function(){var y=l.getItem(p);return y&&y!==o?!1:(l.setItem(p,o),l.getItem(p)===o?!0:(Be(l,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},w=function(){l.setItem(f,o),m(v,function(){if(l.getItem(f)===o){b();return}g(function(){if(l.getItem(p)!==o){w();return}m(function(){return!l.getItem(h)},b)})})},b=function(){l.setItem(h,"1");var y=function(){l.removeItem(h),l.getItem(p)===o&&l.removeItem(p),l.getItem(f)===o&&l.removeItem(f)};e().then(function(S){y(),n(S)}).catch(function(S){y(),i(S)})};try{if(Be(l,!0))w();else throw new Error("localStorage support check failed")}catch(y){i(y)}},this))};var Ue=function(e){this.storage=e||localStorage};Ue.prototype.init=function(){return O.resolve()},Ue.prototype.setItem=function(e,t){return new O(c.bind(function(r,n){try{this.storage.setItem(e,st(t))}catch(i){n(i)}r()},this))},Ue.prototype.getItem=function(e){return new O(c.bind(function(t,r){var n;try{n=at(this.storage.getItem(e))}catch(i){r(i)}t(n)},this))},Ue.prototype.removeItem=function(e){return new O(c.bind(function(t,r){try{this.storage.removeItem(e)}catch(n){r(n)}t()},this))};var Ur=Fe("batch"),ee=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new Ue,this.lock=new Br(e,{storage:t.sharedLockStorage||R.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||c.bind(Ur.error,Ur),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=vi(c.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=c.bind(function(r){return this._enqueuePersisted([r])},this)};ee.prototype.ensureInit=function(){return this.initialized?O.resolve():this.queueStorage.init().then(c.bind(function(){this.initialized=!0},this)).catch(c.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},ee.prototype.enqueue=function(e,t){var r={id:xt(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(r):(this.memQueue.push(r),O.resolve(!0))},ee.prototype._enqueuePersisted=function(e){var t=c.bind(function(){return this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(r){return this.saveToStorage(r.concat(e))},this)).then(c.bind(function(r){return r&&(this.memQueue=this.memQueue.concat(e)),r},this)).catch(c.bind(function(r){return this.reportError("Error enqueueing items",r,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(c.bind(function(r){return this.reportError("Error acquiring storage lock",r),!1},this))},ee.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(r){if(r.length){var n={};c.each(t,function(s){n[s.id]=!0});for(var i=0;i<r.length;i++){var o=r[i];if(new Date().getTime()>o.flushAfter&&!n[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):O.resolve(t)};var Wr=function(e,t){var r=[];return c.each(e,function(n){n.id&&!t[n.id]&&r.push(n)}),r};ee.prototype.removeItemsByID=function(e){var t={};if(c.each(e,function(n){t[n]=!0}),this.memQueue=Wr(this.memQueue,t),this.usePersistence){var r=c.bind(function(){return this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(n){return n=Wr(n,t),this.saveToStorage(n)},this)).then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(n){for(var i=0;i<n.length;i++){var o=n[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(c.bind(function(n){return this.reportError("Error removing items",n,e),!1},this))},this);return this.lock.withLock(r,this.pid).catch(c.bind(function(n){return this.reportError("Error acquiring storage lock",n),Be(this.lock.storage,!0)?!1:r().then(c.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(c.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return O.resolve(!0)};var qr=function(e,t){var r=[];return c.each(e,function(n){var i=n.id;if(i in t){var o=t[i];o!==null&&(n.payload=o,r.push(n))}else r.push(n)}),r};ee.prototype.updatePayloads=function(e){return this.memQueue=qr(this.memQueue,e),this.usePersistence?this.lock.withLock(c.bind(function(){return this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(r){return r=qr(r,e),this.saveToStorage(r)},this)).catch(c.bind(function(r){return this.reportError("Error updating items",e,r),!1},this))},this),this.pid).catch(c.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):O.resolve(!0)},ee.prototype.readFromStorage=function(){return this.ensureInit().then(c.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(c.bind(function(e){return e&&(c.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(c.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},ee.prototype.saveToStorage=function(e){return this.ensureInit().then(c.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(c.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},ee.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(c.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):O.resolve()};var Di=10*60*1e3,We=Fe("batch"),Q=function(e,t){this.errorReporter=t.errorReporter,this.queue=new ee(e,{errorReporter:c.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),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,this._flushPromise=null};Q.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},Q.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},Q.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},Q.prototype.clear=function(){return this.queue.clear()},Q.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},Q.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},Q.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(c.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},Q.prototype.sendRequestPromise=function(e,t){return new O(c.bind(function(r){this.sendRequest(e,t,r)},this))},Q.prototype.flush=function(e){if(this.requestInProgress)return We.log("Flush: Request already in progress"),O.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,r=new Date().getTime(),n=this.batchSize;return this.queue.fillBatch(n).then(c.bind(function(i){var o=i.length===n,s=[],u={};if(c.each(i,function(f){var p=f.payload;if(this.beforeSendHook&&!f.orphaned&&(p=this.beforeSendHook(p)),p){p.event&&p.properties&&(p.properties=c.extend({},p.properties,{mp_sent_by_lib_version:It.LIB_VERSION}));var h=!0,g=f.id;g?(this.itemIdsSentSuccessfully[g]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:f,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[g]}),h=!1):this.reportError("[dupe] found item with no ID",{item:f}),h&&s.push(p)}u[f.id]=p},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),O.resolve();var a=c.bind(function(){return this.queue.removeItemsByID(c.map(i,function(f){return f.id})).then(c.bind(function(f){return c.each(i,c.bind(function(p){var h=p.id;h?(this.itemIdsSentSuccessfully[h]=this.itemIdsSentSuccessfully[h]||0,this.itemIdsSentSuccessfully[h]++,this.itemIdsSentSuccessfully[h]>5&&this.reportError("[dupe] item ID sent too many times",{item:p,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[h]})):this.reportError("[dupe] found item with no ID while removing",{item:p})},this)),f?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),O.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),O.resolve())},this))},this),d=c.bind(function(f){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(c.isObject(f)&&f.error==="timeout"&&new Date().getTime()-r>=t)return this.reportError("Network timeout; retrying"),this.flush();if(c.isObject(f)&&(f.httpStatusCode>=500||f.httpStatusCode===429||f.httpStatusCode<=0&&!wi()||f.error==="timeout")){var p=this.flushInterval*2;return f.retryAfter&&(p=parseInt(f.retryAfter,10)*1e3||p),p=Math.min(Di,p),this.reportError("Error; retry in "+p+" ms"),this.scheduleFlush(p),O.resolve()}else if(c.isObject(f)&&f.httpStatusCode===413)if(i.length>1){var h=Math.max(1,Math.floor(n/2));return this.batchSize=Math.min(this.batchSize,h,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),O.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),a();else return a()}catch(g){this.reportError("Error handling API response",g),this.resetFlush()}},this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(l.transport="sendBeacon"),We.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,l).then(d)},this)).catch(c.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},Q.prototype.reportError=function(e,t){if(We.error.apply(We.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(r){We.error(r)}};var zr=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},Ai=250,_e=Fe("recorder"),$r=R.CompressionStream,Li={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Pi=new Set([Z.MouseMove,Z.MouseInteraction,Z.Scroll,Z.ViewportResize,Z.Input,Z.TouchMove,Z.MediaInteraction,Z.Drag,Z.Selection]);function Fi(e){return e.type===Er.IncrementalSnapshot&&Pi.has(e.data.source)}var W=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||Tt,this._onMaxLengthReached=e.onMaxLengthReached||Tt,this._onBatchSent=e.onBatchSent||Tt,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=tt,this.recordMinMs=0;var t=Be(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new ne(Lr),this.batcher=new Q(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:Li,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:Ai,sharedLockTimeoutMS:10*1e3})};W.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then(function(){return this.queueStorage.removeItem(this.batcherKey)}.bind(this))},W.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},W.prototype.get_config=function(e){return this.getConfig(e)},W.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){_e.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>tt&&(this.recordMaxMs=tt,_e.critical("record_max_ms cannot be greater than "+tt+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Mt&&(this.recordMinMs=Mt,_e.critical("record_min_ms cannot be greater than "+Mt+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=c.info.currentUrl(),this.replayStartUrl=c.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}.bind(this),r=this.getConfig("record_block_selector");if((r===""||r===null)&&(r=void 0),this._stopRecording=this._rrwebRecord({emit:Fr(function(i){Fi(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(i)}.bind(this)),blockClass:this.getConfig("record_block_class"),blockSelector:r,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}}),typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}t();var n=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),n)},W.prototype.stopRecording=function(e){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(r){this.reportError("Error with rrweb stopRecording",r)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t},W.prototype.isRrwebStopped=function(){return this._stopRecording===null},W.prototype.flushEventsWithOptOut=function(e,t,r){this._flushEvents(e,t,r,this._onOptOut.bind(this))},W.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}},W.deserialize=function(e,t){var r=new W(c.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return r},W.prototype._onOptOut=function(e){e===0&&this.stopRecording()},W.prototype._sendRequest=function(e,t,r,n){var i=function(o,s){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=c.info.currentUrl()),this._onBatchSent(),n({status:0,httpStatusCode:o.status,responseBody:s,retryAfter:o.headers.get("Retry-After")})}.bind(this);R.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:r}).then(function(o){o.json().then(function(s){i(o,s)}).catch(function(s){n({error:s})})}).catch(function(o){n({error:o,httpStatusCode:0})})},W.prototype._flushEvents=Fr(function(e,t,r){var n=e.length;if(n>0){var i=this.replayId,o=e[0].timestamp;(this.seqNo===0||!this.replayStartTime)&&(this.seqNo!==0&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var s=e[n-1].timestamp-this.replayStartTime,u={$current_url:this.batchStartUrl,$lib_version:It.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:s,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},a=c.JSONEncode(e),d=this._mixpanel.get_property("$device_id");d&&(u.$device_id=d);var l=this._mixpanel.get_property("$user_id");if(l&&(u.$user_id=l),$r){var f=new Blob([a],{type:"application/json"}).stream(),p=f.pipeThrough(new $r("gzip"));new Response(p).blob().then(function(h){u.format="gzip",this._sendRequest(i,u,h,r)}.bind(this))}else u.format="body",this._sendRequest(i,u,a,r)}}),W.prototype.reportError=function(e,t){_e.error.apply(_e.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(r){_e.error(r)}};var Ce=function(e){this.idb=new ne(Pr),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Ce.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Ce.prototype.setActiveRecording=function(e){var t=e.tabId;return t?this.idb.init().then(function(){return this.idb.setItem(t,e)}.bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),O.resolve())},Ce.prototype.getActiveRecording=function(){return this.idb.init().then(function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}.bind(this)).then(function(e){return zr(e)?null:e}.bind(this)).catch(this.handleError.bind(this))},Ce.prototype.clearActiveRecording=function(){return this.getActiveRecording().then(function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}.bind(this)).catch(this.handleError.bind(this))},Ce.prototype.flushInactiveRecordings=function(){return this.idb.init().then(function(){return this.idb.getAll()}.bind(this)).then(function(e){var t=e.filter(function(r){return zr(r)}).map(function(r){var n=W.deserialize(r,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return n.unloadPersistedData().then(function(){return this.idb.removeItem(r.tabId)}.bind(this)).catch(this.handleError.bind(this))}.bind(this));return O.all(t)}.bind(this)).catch(this.handleError.bind(this))};var qe=Fe("recorder"),ie=function(e,t,r){this.mixpanelInstance=e,this.rrwebRecord=t||Ne,this.sharedLockStorage=r,this.recordingRegistry=new Ce({mixpanelInstance:this.mixpanelInstance,errorReporter:qe.error,sharedLockStorage:r}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};ie.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){qe.log("Recording already in progress, skipping startRecording.");return}var t=function(){qe.log("Idle timeout reached, restarting recording."),this.resetRecording()}.bind(this),r=function(){qe.log("Max recording length reached, stopping recording."),this.resetRecording()}.bind(this),n=function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}.bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:n,onIdleTimeout:t,onMaxLengthReached:r,replayId:c.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=W.deserialize(e.activeSerializedRecording,i):this.activeRecording=new W(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},ie.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},ie.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},ie.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):O.resolve()},ie.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),O.resolve(null)):this.recordingRegistry.getActiveRecording().then(function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(qe.log("No resumable recording found."),null)}.bind(this))},ie.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},ie.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(ie.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),R.__mp_recorder=ie})();
|
|
38
|
+
`);var t="",r,n,i=0,o;for(r=n=0,i=e.length,o=0;o<i;o++){var s=e.charCodeAt(o),u=null;s<128?n++:s>127&&s<2048?u=String.fromCharCode(s>>6|192,s&63|128):u=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),u!==null&&(n>r&&(t+=e.substring(r,n)),t+=u,r=n=o+1)}return n>r&&(t+=e.substring(r,e.length)),t},c.UUID=function(){var e=function(){var n=1*new Date,i;if(R.performance&&R.performance.now)i=R.performance.now();else for(i=0;n==1*new Date;)i++;return n.toString(16)+Math.floor(i).toString(16)},t=function(){return Math.random().toString(16).replace(".","")},r=function(){var n=fe,i,o,s=[],u=0;function a(d,l){var f,p=0;for(f=0;f<l.length;f++)p|=s[f]<<f*8;return d^p}for(i=0;i<n.length;i++)o=n.charCodeAt(i),s.unshift(o&255),s.length>=4&&(u=a(u,s),s=[]);return s.length>0&&(u=a(u,s)),u.toString(16)};return function(){var n=(ot.height*ot.width).toString(16);return e()+"-"+t()+"-"+r()+"-"+n+"-"+e()}}();var kr=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];c.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<kr.length;t++)if(e.indexOf(kr[t])!==-1)return!0;return!1},c.HTTPBuildQuery=function(e,t){var r,n,i=[];return c.isUndefined(t)&&(t="&"),c.each(e,function(o,s){r=encodeURIComponent(o.toString()),n=encodeURIComponent(s),i[i.length]=n+"="+r}),i.join(t)},c.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var r="[\\?&]"+t+"=([^&#]*)",n=new RegExp(r),i=n.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{K.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},c.cookie={get:function(e){for(var t=e+"=",r=G.cookie.split(";"),n=0;n<r.length;n++){for(var i=r[n];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=c.JSONDecode(c.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,r,n,i,o,s){var u="",a="",d="";if(s)u="; domain="+s;else if(n){var l=Ar(G.location.hostname);u=l?"; domain=."+l:""}if(r){var f=new Date;f.setTime(f.getTime()+r*1e3),a="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),G.cookie=e+"="+encodeURIComponent(t)+a+"; path=/"+u+d},set:function(e,t,r,n,i,o,s){var u="",a="",d="";if(s)u="; domain="+s;else if(n){var l=Ar(G.location.hostname);u=l?"; domain=."+l:""}if(r){var f=new Date;f.setTime(f.getTime()+r*24*60*60*1e3),a="; expires="+f.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var p=e+"="+encodeURIComponent(t)+a+"; path=/"+u+d;return G.cookie=p,p},remove:function(e,t,r){c.cookie.set(e,"",-1,t,!1,!1,r)}};var Nr=function(e){var t=!0;try{var r="__mplss_"+Tt(8),n="xyz";e.setItem(r,n),e.getItem(r)!==n&&(t=!1),e.removeItem(r)}catch{t=!1}return t},Ot=null,Be=function(e,t){return Ot!==null&&!t?Ot:Ot=Nr(e||R.localStorage)},xt=null,hi=function(e,t){return xt!==null&&!t?xt:xt=Nr(e||R.sessionStorage)};function Dr(e,t,r){var n=function(i){K.error(t+" error: "+i)};return{is_supported:function(i){var o=r(e,i);return o||K.error(t+" unsupported"),o},error:n,get:function(i){try{return e.getItem(i)}catch(o){n(o)}return null},parse:function(i){try{return c.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(s){n(s)}},remove:function(i){try{e.removeItem(i)}catch(o){n(o)}}}}c.localStorage=Dr(R.localStorage,"localStorage",Be),c.sessionStorage=Dr(R.sessionStorage,"sessionStorage",hi),c.register_event=function(){var e=function(n,i,o,s,u){if(!n){K.error("No valid element provided to register_event");return}if(n.addEventListener&&!s)n.addEventListener(i,o,!!u);else{var a="on"+i,d=n[a];n[a]=t(n,o,d)}};function t(n,i,o){var s=function(u){if(u=u||r(R.event),!!u){var a=!0,d,l;return c.isFunction(o)&&(d=o(u)),l=i.call(n,u),(d===!1||l===!1)&&(a=!1),a}};return s}function r(n){return n&&(n.preventDefault=r.preventDefault,n.stopPropagation=r.stopPropagation),n}return r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0},e}();var pi=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');c.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function r(i,o){var s=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(s)>=0}function n(i){if(!G.getElementsByTagName)return[];var o=i.split(" "),s,u,a,d,l,f,p,h,g,m,v=[G];for(f=0;f<o.length;f++){if(s=o[f].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){u=s.split("#"),a=u[0];var w=u[1],b=G.getElementById(w);if(!b||a&&b.nodeName.toLowerCase()!=a)return[];v=[b];continue}if(s.indexOf(".")>-1){u=s.split("."),a=u[0];var y=u[1];for(a||(a="*"),d=[],l=0,p=0;p<v.length;p++)for(a=="*"?g=e(v[p]):g=v[p].getElementsByTagName(a),h=0;h<g.length;h++)d[l++]=g[h];for(v=[],m=0,p=0;p<d.length;p++)d[p].className&&c.isString(d[p].className)&&r(d[p],y)&&(v[m++]=d[p]);continue}var S=s.match(pi);if(S){a=S[1];var I=S[2],U=S[3],B=S[4];for(a||(a="*"),d=[],l=0,p=0;p<v.length;p++)for(a=="*"?g=e(v[p]):g=v[p].getElementsByTagName(a),h=0;h<g.length;h++)d[l++]=g[h];v=[],m=0;var k;switch(U){case"=":k=function(N){return N.getAttribute(I)==B};break;case"~":k=function(N){return N.getAttribute(I).match(new RegExp("\\b"+B+"\\b"))};break;case"|":k=function(N){return N.getAttribute(I).match(new RegExp("^"+B+"-?"))};break;case"^":k=function(N){return N.getAttribute(I).indexOf(B)===0};break;case"$":k=function(N){return N.getAttribute(I).lastIndexOf(B)==N.getAttribute(I).length-B.length};break;case"*":k=function(N){return N.getAttribute(I).indexOf(B)>-1};break;default:k=function(N){return N.getAttribute(I)}}for(v=[],m=0,p=0;p<d.length;p++)k(d[p])&&(v[m++]=d[p]);continue}for(a=s,d=[],l=0,p=0;p<v.length;p++)for(g=v[p].getElementsByTagName(a),h=0;h<g.length;h++)d[l++]=g[h];v=d}return v}return function(i){return c.isElement(i)?[i]:c.isObject(i)&&!c.isUndefined(i.length)?i:n.call(this,i)}}();var mi=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],gi=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];c.info={campaignParams:function(e){var t="",r={};return c.each(mi,function(n){t=c.getQueryParam(G.URL,n),t.length?r[n]=t:e!==void 0&&(r[n]=e)}),r},clickParams:function(){var e="",t={};return c.each(gi,function(r){e=c.getQueryParam(G.URL,r),e.length&&(t[r]=e)}),t},marketingParams:function(){return c.extend(c.info.campaignParams(),c.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=c.info.searchEngine(e),r=t!="yahoo"?"q":"p",n={};if(t!==null){n.$search_engine=t;var i=c.getQueryParam(e,r);i.length&&(n.mp_keyword=i)}return n},browser:function(e,t,r){return t=t||"",r||c.includes(e," OPR/")?c.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":c.includes(e,"IEMobile")||c.includes(e,"WPDesktop")?"Internet Explorer Mobile":c.includes(e,"SamsungBrowser/")?"Samsung Internet":c.includes(e,"Edge")||c.includes(e,"Edg/")?"Microsoft Edge":c.includes(e,"FBIOS")?"Facebook Mobile":c.includes(e,"Chrome")?"Chrome":c.includes(e,"CriOS")?"Chrome iOS":c.includes(e,"UCWEB")||c.includes(e,"UCBrowser")?"UC Browser":c.includes(e,"FxiOS")?"Firefox iOS":c.includes(t,"Apple")?c.includes(e,"Mobile")?"Mobile Safari":"Safari":c.includes(e,"Android")?"Android Mobile":c.includes(e,"Konqueror")?"Konqueror":c.includes(e,"Firefox")?"Firefox":c.includes(e,"MSIE")||c.includes(e,"Trident/")?"Internet Explorer":c.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,r){var n=c.info.browser(e,t,r),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+)?)/},o=i[n];if(o===void 0)return null;var s=e.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var e=fe;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 R.location.href},properties:function(e){return typeof e!="object"&&(e={}),c.extend(c.strip_empty_properties({$os:c.info.os(),$browser:c.info.browser(fe,Pe.vendor,it),$referrer:G.referrer,$referring_domain:c.info.referringDomain(G.referrer),$device:c.info.device(fe)}),{$current_url:c.info.currentUrl(),$browser_version:c.info.browserVersion(fe,Pe.vendor,it),$screen_height:ot.height,$screen_width:ot.width,mp_lib:"web",$lib_version:Mt.LIB_VERSION,$insert_id:Tt(),time:c.timestamp()/1e3},c.strip_empty_properties(e))},people_properties:function(){return c.extend(c.strip_empty_properties({$os:c.info.os(),$browser:c.info.browser(fe,Pe.vendor,it)}),{$browser_version:c.info.browserVersion(fe,Pe.vendor,it)})},mpPageViewProperties:function(){return c.strip_empty_properties({current_page_title:G.title,current_domain:R.location.hostname,current_url_path:R.location.pathname,current_url_protocol:R.location.protocol,current_url_search:R.location.search})}};var yi=function(e,t){var r=null,n=[];return function(i){var o=this;return n.push(i),r||(r=new O(function(s){setTimeout(function(){var u=e.apply(o,[n]);r=null,n=[],s(u)},t)})),r}},Tt=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},vi=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Si=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,Ar=function(e){var t=Si,r=e.split("."),n=r[r.length-1];(n.length>4||n==="com"||n==="org")&&(t=vi);var i=e.match(t);return i?i[0]:""},bi=function(){var e=R.navigator.onLine;return c.isUndefined(e)||e},kt=function(){},st=null,at=null;typeof JSON<"u"&&(st=JSON.stringify,at=JSON.parse),st=st||c.JSONEncode,at=at||c.JSONDecode,c.info=c.info,c.info.browser=c.info.browser,c.info.browserVersion=c.info.browserVersion,c.info.device=c.info.device,c.info.properties=c.info.properties,c.isBlockedUA=c.isBlockedUA,c.isEmptyObject=c.isEmptyObject,c.isObject=c.isObject,c.JSONDecode=c.JSONDecode,c.JSONEncode=c.JSONEncode,c.toArray=c.toArray,c.NPO=ae;var wi="mixpanelBrowserDb",Lr="mixpanelRecordingEvents",Pr="mixpanelRecordingRegistry",Ii=1,Mi=[Lr,Pr],ne=function(e){this.dbPromise=null,this.storeName=e};ne.prototype._openDb=function(){return new O(function(e,t){var r=R.indexedDB.open(wi,Ii);r.onerror=function(){t(r.error)},r.onsuccess=function(){e(r.result)},r.onupgradeneeded=function(n){var i=n.target.result;Mi.forEach(function(o){i.createObjectStore(o)})}})},ne.prototype.init=function(){return R.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof R.IDBDatabase?O.resolve():O.reject(e)})):O.reject("indexedDB is not supported in this browser")},ne.prototype.makeTransaction=function(e,t){var r=this.storeName,n=function(i){return new O(function(o,s){var u=i.transaction(r,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){s(u.error)},t(u.objectStore(r))})};return this.dbPromise.then(n).catch(function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(n)):O.reject(i)}.bind(this))},ne.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(r){r.put(t,e)})},ne.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(r){t=r.get(e)}).then(function(){return t.result})},ne.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},ne.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var _i="__mp_opt_in_out_";function Ci(e,t){if(Ti(t))return K.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 r=xi(e,t)==="0";return r&&K.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),r}function Ei(e){return ki(e,function(t){return this.get_config(t)})}function Ri(e){return e=e||{},e.persistenceType==="localStorage"?c.localStorage:c.cookie}function Oi(e,t){return t=t||{},(t.persistencePrefix||_i)+e}function xi(e,t){return Ri(t).get(Oi(e,t))}function Ti(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||R,r=t.navigator||{},n=!1;return c.each([r.doNotTrack,r.msDoNotTrack,t.doNotTrack],function(i){c.includes([!0,1,"1","yes"],i)&&(n=!0)}),n}function ki(e,t){return function(){var r=!1;try{var n=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),s=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");n&&(r=Ci(n,{ignoreDnt:i,persistenceType:o,persistencePrefix:s,window:u}))}catch(d){K.error("Unexpected error when checking tracking opt-out status: "+d)}if(!r)return e.apply(this,arguments);var a=arguments[arguments.length-1];typeof a=="function"&&a(0)}}var Ni=Fe("lock"),Fr=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||R.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||O};Fr.prototype.withLock=function(e,t){var r=this.promiseImpl;return new r(c.bind(function(n,i){var o=t||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),u=this.storageKey,a=this.pollIntervalMS,d=this.timeoutMS,l=this.storage,f=u+":X",p=u+":Y",h=u+":Z",g=function(y){if(new Date().getTime()-s>d){Ni.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),l.removeItem(h),l.removeItem(p),w();return}setTimeout(function(){try{y()}catch(S){i(S)}},a*(Math.random()+.1))},m=function(y,S){y()?S():g(function(){m(y,S)})},v=function(){var y=l.getItem(p);return y&&y!==o?!1:(l.setItem(p,o),l.getItem(p)===o?!0:(Be(l,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},w=function(){l.setItem(f,o),m(v,function(){if(l.getItem(f)===o){b();return}g(function(){if(l.getItem(p)!==o){w();return}m(function(){return!l.getItem(h)},b)})})},b=function(){l.setItem(h,"1");var y=function(){l.removeItem(h),l.getItem(p)===o&&l.removeItem(p),l.getItem(f)===o&&l.removeItem(f)};e().then(function(S){y(),n(S)}).catch(function(S){y(),i(S)})};try{if(Be(l,!0))w();else throw new Error("localStorage support check failed")}catch(y){i(y)}},this))};var Ue=function(e){this.storage=e||localStorage};Ue.prototype.init=function(){return O.resolve()},Ue.prototype.setItem=function(e,t){return new O(c.bind(function(r,n){try{this.storage.setItem(e,st(t))}catch(i){n(i)}r()},this))},Ue.prototype.getItem=function(e){return new O(c.bind(function(t,r){var n;try{n=at(this.storage.getItem(e))}catch(i){r(i)}t(n)},this))},Ue.prototype.removeItem=function(e){return new O(c.bind(function(t,r){try{this.storage.removeItem(e)}catch(n){r(n)}t()},this))};var Br=Fe("batch"),ee=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new Ue,this.lock=new Fr(e,{storage:t.sharedLockStorage||R.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||c.bind(Br.error,Br),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=yi(c.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=c.bind(function(r){return this._enqueuePersisted([r])},this)};ee.prototype.ensureInit=function(){return this.initialized?O.resolve():this.queueStorage.init().then(c.bind(function(){this.initialized=!0},this)).catch(c.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},ee.prototype.enqueue=function(e,t){var r={id:Tt(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(r):(this.memQueue.push(r),O.resolve(!0))},ee.prototype._enqueuePersisted=function(e){var t=c.bind(function(){return this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(r){return this.saveToStorage(r.concat(e))},this)).then(c.bind(function(r){return r&&(this.memQueue=this.memQueue.concat(e)),r},this)).catch(c.bind(function(r){return this.reportError("Error enqueueing items",r,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(c.bind(function(r){return this.reportError("Error acquiring storage lock",r),!1},this))},ee.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(r){if(r.length){var n={};c.each(t,function(s){n[s.id]=!0});for(var i=0;i<r.length;i++){var o=r[i];if(new Date().getTime()>o.flushAfter&&!n[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):O.resolve(t)};var Ur=function(e,t){var r=[];return c.each(e,function(n){n.id&&!t[n.id]&&r.push(n)}),r};ee.prototype.removeItemsByID=function(e){var t={};if(c.each(e,function(n){t[n]=!0}),this.memQueue=Ur(this.memQueue,t),this.usePersistence){var r=c.bind(function(){return this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(n){return n=Ur(n,t),this.saveToStorage(n)},this)).then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(n){for(var i=0;i<n.length;i++){var o=n[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(c.bind(function(n){return this.reportError("Error removing items",n,e),!1},this))},this);return this.lock.withLock(r,this.pid).catch(c.bind(function(n){return this.reportError("Error acquiring storage lock",n),Be(this.lock.storage,!0)?!1:r().then(c.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(c.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return O.resolve(!0)};var Wr=function(e,t){var r=[];return c.each(e,function(n){var i=n.id;if(i in t){var o=t[i];o!==null&&(n.payload=o,r.push(n))}else r.push(n)}),r};ee.prototype.updatePayloads=function(e){return this.memQueue=Wr(this.memQueue,e),this.usePersistence?this.lock.withLock(c.bind(function(){return this.ensureInit().then(c.bind(function(){return this.readFromStorage()},this)).then(c.bind(function(r){return r=Wr(r,e),this.saveToStorage(r)},this)).catch(c.bind(function(r){return this.reportError("Error updating items",e,r),!1},this))},this),this.pid).catch(c.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):O.resolve(!0)},ee.prototype.readFromStorage=function(){return this.ensureInit().then(c.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(c.bind(function(e){return e&&(c.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(c.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},ee.prototype.saveToStorage=function(e){return this.ensureInit().then(c.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(c.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},ee.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(c.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):O.resolve()};var Di=10*60*1e3,We=Fe("batch"),Q=function(e,t){this.errorReporter=t.errorReporter,this.queue=new ee(e,{errorReporter:c.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),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,this._flushPromise=null};Q.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},Q.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},Q.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},Q.prototype.clear=function(){return this.queue.clear()},Q.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},Q.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},Q.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(c.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},Q.prototype.sendRequestPromise=function(e,t){return new O(c.bind(function(r){this.sendRequest(e,t,r)},this))},Q.prototype.flush=function(e){if(this.requestInProgress)return We.log("Flush: Request already in progress"),O.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,r=new Date().getTime(),n=this.batchSize;return this.queue.fillBatch(n).then(c.bind(function(i){var o=i.length===n,s=[],u={};if(c.each(i,function(f){var p=f.payload;if(this.beforeSendHook&&!f.orphaned&&(p=this.beforeSendHook(p)),p){p.event&&p.properties&&(p.properties=c.extend({},p.properties,{mp_sent_by_lib_version:Mt.LIB_VERSION}));var h=!0,g=f.id;g?(this.itemIdsSentSuccessfully[g]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:f,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[g]}),h=!1):this.reportError("[dupe] found item with no ID",{item:f}),h&&s.push(p)}u[f.id]=p},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),O.resolve();var a=c.bind(function(){return this.queue.removeItemsByID(c.map(i,function(f){return f.id})).then(c.bind(function(f){return c.each(i,c.bind(function(p){var h=p.id;h?(this.itemIdsSentSuccessfully[h]=this.itemIdsSentSuccessfully[h]||0,this.itemIdsSentSuccessfully[h]++,this.itemIdsSentSuccessfully[h]>5&&this.reportError("[dupe] item ID sent too many times",{item:p,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[h]})):this.reportError("[dupe] found item with no ID while removing",{item:p})},this)),f?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),O.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),O.resolve())},this))},this),d=c.bind(function(f){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(c.isObject(f)&&f.error==="timeout"&&new Date().getTime()-r>=t)return this.reportError("Network timeout; retrying"),this.flush();if(c.isObject(f)&&(f.httpStatusCode>=500||f.httpStatusCode===429||f.httpStatusCode<=0&&!bi()||f.error==="timeout")){var p=this.flushInterval*2;return f.retryAfter&&(p=parseInt(f.retryAfter,10)*1e3||p),p=Math.min(Di,p),this.reportError("Error; retry in "+p+" ms"),this.scheduleFlush(p),O.resolve()}else if(c.isObject(f)&&f.httpStatusCode===413)if(i.length>1){var h=Math.max(1,Math.floor(n/2));return this.batchSize=Math.min(this.batchSize,h,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),O.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),a();else return a()}catch(g){this.reportError("Error handling API response",g),this.resetFlush()}},this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(l.transport="sendBeacon"),We.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,l).then(d)},this)).catch(c.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},Q.prototype.reportError=function(e,t){if(We.error.apply(We.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(r){We.error(r)}};var qr=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},Ai=250,_e=Fe("recorder"),zr=R.CompressionStream,Li={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},Pi=new Set([Z.MouseMove,Z.MouseInteraction,Z.Scroll,Z.ViewportResize,Z.Input,Z.TouchMove,Z.MediaInteraction,Z.Drag,Z.Selection]);function Fi(e){return e.type===It.IncrementalSnapshot&&Pi.has(e.data.source)}var W=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||kt,this._onMaxLengthReached=e.onMaxLengthReached||kt,this._onBatchSent=e.onBatchSent||kt,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=tt,this.recordMinMs=0;var t=Be(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new ne(Lr),this.batcher=new Q(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:Li,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:Ai,sharedLockTimeoutMS:10*1e3})};W.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then(function(){return this.queueStorage.removeItem(this.batcherKey)}.bind(this))},W.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},W.prototype.get_config=function(e){return this.getConfig(e)},W.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){_e.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>tt&&(this.recordMaxMs=tt,_e.critical("record_max_ms cannot be greater than "+tt+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>_t&&(this.recordMinMs=_t,_e.critical("record_min_ms cannot be greater than "+_t+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=c.info.currentUrl(),this.replayStartUrl=c.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}.bind(this),r=this.getConfig("record_block_selector");(r===""||r===null)&&(r=void 0);try{this._stopRecording=this._rrwebRecord({emit:function(i){Fi(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(i)}.bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:r,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(i){this.reportError("Unexpected error when starting rrweb recording.",i)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}t();var n=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),n)},W.prototype.stopRecording=function(e){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(r){this.reportError("Error with rrweb stopRecording",r)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t},W.prototype.isRrwebStopped=function(){return this._stopRecording===null},W.prototype.flushEventsWithOptOut=function(e,t,r){var n=function(i){i===0&&(this.stopRecording(),r({error:"Tracking has been opted out, stopping recording."}))}.bind(this);this._flushEvents(e,t,r,n)},W.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}},W.deserialize=function(e,t){var r=new W(c.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return r},W.prototype._sendRequest=function(e,t,r,n){var i=function(o,s){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=c.info.currentUrl()),this._onBatchSent(),n({status:0,httpStatusCode:o.status,responseBody:s,retryAfter:o.headers.get("Retry-After")})}.bind(this);R.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:r}).then(function(o){o.json().then(function(s){i(o,s)}).catch(function(s){n({error:s})})}).catch(function(o){n({error:o,httpStatusCode:0})})},W.prototype._flushEvents=Ei(function(e,t,r){var n=e.length;if(n>0){for(var i=this.replayId,o=1/0,s=-1/0,u=!1,a=0;a<n;a++)o=Math.min(o,e[a].timestamp),s=Math.max(s,e[a].timestamp),e[a].type===It.FullSnapshot&&(u=!0);if(this.seqNo===0){if(!u){r({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var d=s-this.replayStartTime,l={$current_url:this.batchStartUrl,$lib_version:Mt.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:d,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},f=c.JSONEncode(e),p=this._mixpanel.get_property("$device_id");p&&(l.$device_id=p);var h=this._mixpanel.get_property("$user_id");if(h&&(l.$user_id=h),zr){var g=new Blob([f],{type:"application/json"}).stream(),m=g.pipeThrough(new zr("gzip"));new Response(m).blob().then(function(v){l.format="gzip",this._sendRequest(i,l,v,r)}.bind(this))}else l.format="body",this._sendRequest(i,l,f,r)}}),W.prototype.reportError=function(e,t){_e.error.apply(_e.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(r){_e.error(r)}};var Ce=function(e){this.idb=new ne(Pr),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Ce.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Ce.prototype.setActiveRecording=function(e){var t=e.tabId;return t?this.idb.init().then(function(){return this.idb.setItem(t,e)}.bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),O.resolve())},Ce.prototype.getActiveRecording=function(){return this.idb.init().then(function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}.bind(this)).then(function(e){return qr(e)?null:e}.bind(this)).catch(this.handleError.bind(this))},Ce.prototype.clearActiveRecording=function(){return this.getActiveRecording().then(function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}.bind(this)).catch(this.handleError.bind(this))},Ce.prototype.flushInactiveRecordings=function(){return this.idb.init().then(function(){return this.idb.getAll()}.bind(this)).then(function(e){var t=e.filter(function(r){return qr(r)}).map(function(r){var n=W.deserialize(r,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return n.unloadPersistedData().then(function(){return this.idb.removeItem(r.tabId)}.bind(this)).catch(this.handleError.bind(this))}.bind(this));return O.all(t)}.bind(this)).catch(this.handleError.bind(this))};var qe=Fe("recorder"),ie=function(e,t,r){this.mixpanelInstance=e,this.rrwebRecord=t||Ne,this.sharedLockStorage=r,this.recordingRegistry=new Ce({mixpanelInstance:this.mixpanelInstance,errorReporter:qe.error,sharedLockStorage:r}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};ie.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){qe.log("Recording already in progress, skipping startRecording.");return}var t=function(){qe.log("Idle timeout reached, restarting recording."),this.resetRecording()}.bind(this),r=function(){qe.log("Max recording length reached, stopping recording."),this.resetRecording()}.bind(this),n=function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}.bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:n,onIdleTimeout:t,onMaxLengthReached:r,replayId:c.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=W.deserialize(e.activeSerializedRecording,i):this.activeRecording=new W(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},ie.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},ie.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},ie.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):O.resolve()},ie.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),O.resolve(null)):this.recordingRegistry.getActiveRecording().then(function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(qe.log("No resumable recording found."),null)}.bind(this))},ie.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},ie.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(ie.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),R.__mp_recorder=ie})();
|
|
39
39
|
//# sourceMappingURL=mixpanel-recorder.min.js.map
|