ghostplay-sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.global.js +3 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var GhostplaySDK=(function(exports){'use strict';var ft=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Dt={apiUrl:"https://api.ghostplay.dev/v1",maskAllInputs:true,recordNetwork:true,recordConsole:true,trackPerformance:true,trackRageClicks:true,flushIntervalMs:5e3,flushMaxBytes:5e4};function Ft(t){if(!t.projectId)throw new Error("[Ghostplay] projectId is required");if(!t.projectId.startsWith("gp_"))throw new Error('[Ghostplay] projectId must start with "gp_"');return {...Dt,...t}}function vr(){let t=Date.now().toString(36),e=Math.random().toString(36).substring(2,10);return `gs_${t}_${e}`}var Ne=class{constructor(e){this.projectId=e;this.session=null;}start(){return this.session={id:vr(),projectId:this.projectId,startedAt:Date.now(),tags:[],metadata:{}},this.session}current(){if(!this.session)throw new Error("[Ghostplay] No active session");return this.session}identify(e,r){let n=this.current();n.userId=e,n.userTraits=r;}addTag(e){let r=this.current();r.tags.includes(e)||r.tags.push(e);}setMetadata(e){let r=this.current();r.metadata={...r.metadata,...e};}end(){this.session=null;}};var D;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";})(D||(D={}));function Cr(t){return t.nodeType===t.ELEMENT_NODE}function he(t){var e=t?.host;return e?.shadowRoot===t}function pe(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function yr(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function ht(t){try{var e=t.rules||t.cssRules;return e?yr(Array.from(e).map(mt).join("")):null}catch{return null}}function mt(t){var e=t.cssText;if(Sr(t))try{e=ht(t.styleSheet)||e;}catch{}return e}function Sr(t){return "styleSheet"in t}var Gt=(function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}return t.prototype.getId=function(e){var r;if(!e)return -1;var n=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return n??-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var r=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(o){return r.removeNodeFromMap(o)});},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,r){var n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r);},t.prototype.replace=function(e,r){var n=this.getNode(e);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o);}this.idNodeMap.set(e,r);},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;},t})();function Wt(){return new Gt}function we(t){var e=t.maskInputOptions,r=t.tagName,n=t.type,o=t.value,i=t.maskInputFn,a=o||"";return (e[r.toLowerCase()]||e[n])&&(i?a=i(a):a="*".repeat(a.length)),a}var Lt="__rrweb_original__";function br(t){var e=t.getContext("2d");if(!e)return true;for(var r=50,n=0;n<t.width;n+=r)for(var o=0;o<t.height;o+=r){var i=e.getImageData,a=Lt in i?i[Lt]:i,s=new Uint32Array(a.call(e,n,o,Math.min(r,t.width-n),Math.min(r,t.height-o)).data.buffer);if(s.some(function(l){return l!==0}))return false}return true}var Ar=1,kr=new RegExp("[^a-z0-9-_:]"),fe=-2;function gt(){return Ar++}function wr(t){if(t instanceof HTMLFormElement)return "form";var e=t.tagName.toLowerCase().trim();return kr.test(e)?"div":e}function Er(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function Tr(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var ve,Bt,Mr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Rr=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Nr=/^(data:)([^,]*),(.*)/i;function xe(t,e){return (t||"").replace(Mr,function(r,n,o,i,a,s){var l=o||a||s,c=n||i||"";if(!l)return r;if(!Rr.test(l)||Nr.test(l))return "url(".concat(c).concat(l).concat(c,")");if(l[0]==="/")return "url(".concat(c).concat(Tr(e)+l).concat(c,")");var d=e.split("/"),u=l.split("/");d.pop();for(var f=0,h=u;f<h.length;f++){var p=h[f];p!=="."&&(p===".."?d.pop():d.push(p));}return "url(".concat(c).concat(d.join("/")).concat(c,")")})}var xr=/^[^ \t\n\r\u000c]+/,Or=/^[, \t\n\r\u000c]+/;function Dr(t,e){if(e.trim()==="")return e;var r=0;function n(c){var d,u=c.exec(e.substring(r));return u?(d=u[0],r+=d.length,d):""}for(var o=[];n(Or),!(r>=e.length);){var i=n(xr);if(i.slice(-1)===",")i=Ce(t,i.substring(0,i.length-1)),o.push(i);else {var a="";i=Ce(t,i);for(var s=false;;){var l=e.charAt(r);if(l===""){o.push((i+a).trim());break}else if(s)l===")"&&(s=false);else if(l===","){r+=1,o.push((i+a).trim());break}else l==="("&&(s=true);a+=l,r+=1;}}}return o.join(", ")}function Ce(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function Fr(t){return !!(t.tagName==="svg"||t.ownerSVGElement)}function It(){var t=document.createElement("a");return t.href="",t.href}function vt(t,e,r,n){return r==="src"||r==="href"&&n&&!(e==="use"&&n[0]==="#")||r==="xlink:href"&&n&&n[0]!=="#"||r==="background"&&n&&(e==="table"||e==="td"||e==="th")?Ce(t,n):r==="srcset"&&n?Dr(t,n):r==="style"&&n?xe(n,It()):e==="object"&&r==="data"&&n?Ce(t,n):n}function Lr(t,e,r){if(typeof e=="string"){if(t.classList.contains(e))return true}else for(var n=t.classList.length;n--;){var o=t.classList[n];if(e.test(o))return true}return r?t.matches(r):false}function ke(t,e,r){if(!t)return false;if(t.nodeType!==t.ELEMENT_NODE)return r?ke(t.parentNode,e,r):false;for(var n=t.classList.length;n--;){var o=t.classList[n];if(e.test(o))return true}return r?ke(t.parentNode,e,r):false}function Ct(t,e,r){var n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(n===null)return false;if(typeof e=="string"){if(n.classList.contains(e)||n.closest(".".concat(e)))return true}else if(ke(n,e,true))return true;return !!(r&&(n.matches(r)||n.closest(r)))}function Br(t,e,r){var n=t.contentWindow;if(n){var o=false,i;try{i=n.document.readyState;}catch{return}if(i!=="complete"){var a=setTimeout(function(){o||(e(),o=true);},r);t.addEventListener("load",function(){clearTimeout(a),o=true,e();});return}var s="about:blank";if(n.location.href!==s||t.src===s||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e);}}function Gr(t,e,r){var n=false,o;try{o=t.sheet;}catch{return}if(!o){var i=setTimeout(function(){n||(e(),n=true);},r);t.addEventListener("load",function(){clearTimeout(i),n=true,e();});}}function Wr(t,e){var r=e.doc,n=e.mirror,o=e.blockClass,i=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,l=e.inlineStylesheet,c=e.maskInputOptions,d=c===void 0?{}:c,u=e.maskTextFn,f=e.maskInputFn,h=e.dataURLOptions,p=h===void 0?{}:h,I=e.inlineImages,S=e.recordCanvas,C=e.keepIframeSrcFn,m=e.newlyAddedElement,g=m===void 0?false:m,k=Ur(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:D.Document,childNodes:[],compatMode:t.compatMode}:{type:D.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return {type:D.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:k};case t.ELEMENT_NODE:return Zr(t,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:l,maskInputOptions:d,maskInputFn:f,dataURLOptions:p,inlineImages:I,recordCanvas:S,keepIframeSrcFn:C,newlyAddedElement:g,rootId:k});case t.TEXT_NODE:return Vr(t,{maskTextClass:a,maskTextSelector:s,maskTextFn:u,rootId:k});case t.CDATA_SECTION_NODE:return {type:D.CDATA,textContent:"",rootId:k};case t.COMMENT_NODE:return {type:D.Comment,textContent:t.textContent||"",rootId:k};default:return false}}function Ur(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function Vr(t,e){var r,n=e.maskTextClass,o=e.maskTextSelector,i=e.maskTextFn,a=e.rootId,s=t.parentNode&&t.parentNode.tagName,l=t.textContent,c=s==="STYLE"?true:void 0,d=s==="SCRIPT"?true:void 0;if(c&&l){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(l=Er(t.parentNode.sheet));}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t);}l=xe(l,It());}return d&&(l="SCRIPT_PLACEHOLDER"),!c&&!d&&l&&Ct(t,n,o)&&(l=i?i(l):l.replace(/[\S]/g,"*")),{type:D.Text,textContent:l||"",isStyle:c,rootId:a}}function Zr(t,e){for(var r=e.doc,n=e.blockClass,o=e.blockSelector,i=e.inlineStylesheet,a=e.maskInputOptions,s=a===void 0?{}:a,l=e.maskInputFn,c=e.dataURLOptions,d=c===void 0?{}:c,u=e.inlineImages,f=e.recordCanvas,h=e.keepIframeSrcFn,p=e.newlyAddedElement,I=p===void 0?false:p,S=e.rootId,C=Lr(t,n,o),m=wr(t),g={},k=t.attributes.length,W=0;W<k;W++){var F=t.attributes[W];g[F.name]=vt(r,m,F.name,F.value);}if(m==="link"&&i){var L=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),w=null;L&&(w=ht(L)),w&&(delete g.rel,delete g.href,g._cssText=xe(w,L.href));}if(m==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var w=ht(t.sheet);w&&(g._cssText=xe(w,It()));}if(m==="input"||m==="textarea"||m==="select"){var P=t.value,z=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&P?g.value=we({type:g.type,tagName:m,value:P,maskInputOptions:s,maskInputFn:l}):z&&(g.checked=z);}if(m==="option"&&(t.selected&&!s.select?g.selected=true:delete g.selected),m==="canvas"&&f){if(t.__context==="2d")br(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var J=t.toDataURL(d.type,d.quality),Q=document.createElement("canvas");Q.width=t.width,Q.height=t.height;var q=Q.toDataURL(d.type,d.quality);J!==q&&(g.rr_dataURL=J);}}if(m==="img"&&u){ve||(ve=r.createElement("canvas"),Bt=ve.getContext("2d"));var x=t,K=x.crossOrigin;x.crossOrigin="anonymous";var X=function(){try{ve.width=x.naturalWidth,ve.height=x.naturalHeight,Bt.drawImage(x,0,0),g.rr_dataURL=ve.toDataURL(d.type,d.quality);}catch(Y){console.warn("Cannot inline img src=".concat(x.currentSrc,"! Error: ").concat(Y));}K?g.crossOrigin=K:x.removeAttribute("crossorigin");};x.complete&&x.naturalWidth!==0?X():x.onload=X;}if((m==="audio"||m==="video")&&(g.rr_mediaState=t.paused?"paused":"played",g.rr_mediaCurrentTime=t.currentTime),I||(t.scrollLeft&&(g.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(g.rr_scrollTop=t.scrollTop)),C){var ne=t.getBoundingClientRect(),ie=ne.width,Z=ne.height;g={class:g.class,rr_width:"".concat(ie,"px"),rr_height:"".concat(Z,"px")};}return m==="iframe"&&!h(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:D.Element,tagName:m,attributes:g,childNodes:[],isSVG:Fr(t)||void 0,needBlock:C,rootId:S}}function E(t){return t===void 0?"":t.toLowerCase()}function Hr(t,e){if(e.comment&&t.type===D.Comment)return true;if(t.type===D.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")))return true;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||E(t.attributes.name)==="application-name"||E(t.attributes.rel)==="icon"||E(t.attributes.rel)==="apple-touch-icon"||E(t.attributes.rel)==="shortcut icon")))return true;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return true;if(e.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||E(t.attributes.name)==="pinterest"))return true;if(e.headMetaRobots&&(E(t.attributes.name)==="robots"||E(t.attributes.name)==="googlebot"||E(t.attributes.name)==="bingbot"))return true;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return true;if(e.headMetaAuthorship&&(E(t.attributes.name)==="author"||E(t.attributes.name)==="generator"||E(t.attributes.name)==="framework"||E(t.attributes.name)==="publisher"||E(t.attributes.name)==="progid"||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return true;if(e.headMetaVerification&&(E(t.attributes.name)==="google-site-verification"||E(t.attributes.name)==="yandex-verification"||E(t.attributes.name)==="csrf-token"||E(t.attributes.name)==="p:domain_verify"||E(t.attributes.name)==="verify-v1"||E(t.attributes.name)==="verification"||E(t.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function ue(t,e){var r=e.doc,n=e.mirror,o=e.blockClass,i=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,l=e.skipChild,c=l===void 0?false:l,d=e.inlineStylesheet,u=d===void 0?true:d,f=e.maskInputOptions,h=f===void 0?{}:f,p=e.maskTextFn,I=e.maskInputFn,S=e.slimDOMOptions,C=e.dataURLOptions,m=C===void 0?{}:C,g=e.inlineImages,k=g===void 0?false:g,W=e.recordCanvas,F=W===void 0?false:W,L=e.onSerialize,w=e.onIframeLoad,P=e.iframeLoadTimeout,z=P===void 0?5e3:P,J=e.onStylesheetLoad,Q=e.stylesheetLoadTimeout,q=Q===void 0?5e3:Q,x=e.keepIframeSrcFn,K=x===void 0?function(){return false}:x,X=e.newlyAddedElement,ne=X===void 0?false:X,ie=e.preserveWhiteSpace,Z=ie===void 0?true:ie,Y=Wr(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,dataURLOptions:m,inlineImages:k,recordCanvas:F,keepIframeSrcFn:K,newlyAddedElement:ne});if(!Y)return console.warn(t,"not serialized"),null;var le;n.hasNode(t)?le=n.getId(t):Hr(Y,S)||!Z&&Y.type===D.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?le=fe:le=gt();var N=Object.assign(Y,{id:le});if(n.add(t,N),le===fe)return null;L&&L(t);var $=!c;if(N.type===D.Element){$=$&&!N.needBlock,delete N.needBlock;var oe=t.shadowRoot;oe&&pe(oe)&&(N.isShadowHost=true);}if((N.type===D.Document||N.type===D.Element)&&$){S.headWhitespace&&N.type===D.Element&&N.tagName==="head"&&(Z=false);for(var Ie={doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:c,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,slimDOMOptions:S,dataURLOptions:m,inlineImages:k,recordCanvas:F,preserveWhiteSpace:Z,onSerialize:L,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K},v=0,U=Array.from(t.childNodes);v<U.length;v++){var H=U[v],T=ue(H,Ie);T&&N.childNodes.push(T);}if(Cr(t)&&t.shadowRoot)for(var j=0,A=Array.from(t.shadowRoot.childNodes);j<A.length;j++){var H=A[j],T=ue(H,Ie);T&&(pe(t.shadowRoot)&&(T.isShadow=true),N.childNodes.push(T));}}return t.parentNode&&he(t.parentNode)&&pe(t.parentNode)&&(N.isShadow=true),N.type===D.Element&&N.tagName==="iframe"&&Br(t,function(){var _=t.contentDocument;if(_&&w){var Ae=ue(_,{doc:_,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,slimDOMOptions:S,dataURLOptions:m,inlineImages:k,recordCanvas:F,preserveWhiteSpace:Z,onSerialize:L,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K});Ae&&w(t,Ae);}},z),N.type===D.Element&&N.tagName==="link"&&N.attributes.rel==="stylesheet"&&Gr(t,function(){if(J){var _=ue(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,slimDOMOptions:S,dataURLOptions:m,inlineImages:k,recordCanvas:F,preserveWhiteSpace:Z,onSerialize:L,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K});_&&J(t,_);}},q),N}function Ut(t,e){var r=e||{},n=r.mirror,o=n===void 0?new Gt:n,i=r.blockClass,a=i===void 0?"rr-block":i,s=r.blockSelector,l=s===void 0?null:s,c=r.maskTextClass,d=c===void 0?"rr-mask":c,u=r.maskTextSelector,f=u===void 0?null:u,h=r.inlineStylesheet,p=h===void 0?true:h,I=r.inlineImages,S=I===void 0?false:I,C=r.recordCanvas,m=C===void 0?false:C,g=r.maskAllInputs,k=g===void 0?false:g,W=r.maskTextFn,F=r.maskInputFn,L=r.slimDOM,w=L===void 0?false:L,P=r.dataURLOptions,z=r.preserveWhiteSpace,J=r.onSerialize,Q=r.onIframeLoad,q=r.iframeLoadTimeout,x=r.onStylesheetLoad,K=r.stylesheetLoadTimeout,X=r.keepIframeSrcFn,ne=X===void 0?function(){return false}:X,ie=k===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:k===false?{password:true}:k,Z=w===true||w==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaDescKeywords:w==="all",headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaAuthorship:true,headMetaVerification:true}:w===false?{}:w;return ue(t,{doc:t,mirror:o,blockClass:a,blockSelector:l,maskTextClass:d,maskTextSelector:f,skipChild:false,inlineStylesheet:p,maskInputOptions:ie,maskTextFn:W,maskInputFn:F,slimDOMOptions:Z,dataURLOptions:P,inlineImages:S,recordCanvas:m,preserveWhiteSpace:z,onSerialize:J,onIframeLoad:Q,iframeLoadTimeout:q,onStylesheetLoad:x,stylesheetLoadTimeout:K,keepIframeSrcFn:ne,newlyAddedElement:false})}function B(t,e,r=document){let n={capture:true,passive:true};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var ye=`Please stop import mirror directly. Instead of that,\r
|
|
1
|
+
var GhostplaySDK=(function(exports){'use strict';var ft=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Dt={apiUrl:"https://api.ghostplay.dev/v1",maskAllInputs:true,recordNetwork:true,recordConsole:true,trackPerformance:true,trackRageClicks:true,flushIntervalMs:5e3,flushMaxBytes:5e4};function Ft(t){if(!t.projectId)throw new Error("[Ghostplay] projectId is required");if(!t.projectId.startsWith("gp_"))throw new Error('[Ghostplay] projectId must start with "gp_"');return {...Dt,...t}}function vr(){let t=Date.now().toString(36),e=Math.random().toString(36).substring(2,10);return `gs_${t}_${e}`}var Ne=class{constructor(e){this.projectId=e;this.session=null;}start(){return this.session={id:vr(),projectId:this.projectId,startedAt:Date.now(),tags:[],metadata:{}},this.session}current(){if(!this.session)throw new Error("[Ghostplay] No active session");return this.session}identify(e,r){let n=this.current();n.userId=e,n.userTraits=r;}addTag(e){let r=this.current();r.tags.includes(e)||r.tags.push(e);}setMetadata(e){let r=this.current();r.metadata={...r.metadata,...e};}end(){this.session=null;}};var D;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";})(D||(D={}));function Cr(t){return t.nodeType===t.ELEMENT_NODE}function he(t){var e=t?.host;return e?.shadowRoot===t}function pe(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function yr(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t}function ht(t){try{var e=t.rules||t.cssRules;return e?yr(Array.from(e).map(mt).join("")):null}catch{return null}}function mt(t){var e=t.cssText;if(Sr(t))try{e=ht(t.styleSheet)||e;}catch{}return e}function Sr(t){return "styleSheet"in t}var Gt=(function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;}return t.prototype.getId=function(e){var r;if(!e)return -1;var n=(r=this.getMeta(e))===null||r===void 0?void 0:r.id;return n??-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var r=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(function(o){return r.removeNodeFromMap(o)});},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,r){var n=r.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,r);},t.prototype.replace=function(e,r){var n=this.getNode(e);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o);}this.idNodeMap.set(e,r);},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap;},t})();function Wt(){return new Gt}function we(t){var e=t.maskInputOptions,r=t.tagName,n=t.type,o=t.value,i=t.maskInputFn,a=o||"";return (e[r.toLowerCase()]||e[n])&&(i?a=i(a):a="*".repeat(a.length)),a}var Lt="__rrweb_original__";function br(t){var e=t.getContext("2d");if(!e)return true;for(var r=50,n=0;n<t.width;n+=r)for(var o=0;o<t.height;o+=r){var i=e.getImageData,a=Lt in i?i[Lt]:i,s=new Uint32Array(a.call(e,n,o,Math.min(r,t.width-n),Math.min(r,t.height-o)).data.buffer);if(s.some(function(l){return l!==0}))return false}return true}var Ar=1,kr=new RegExp("[^a-z0-9-_:]"),fe=-2;function gt(){return Ar++}function wr(t){if(t instanceof HTMLFormElement)return "form";var e=t.tagName.toLowerCase().trim();return kr.test(e)?"div":e}function Er(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function Tr(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var ve,Bt,Mr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Rr=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Nr=/^(data:)([^,]*),(.*)/i;function xe(t,e){return (t||"").replace(Mr,function(r,n,o,i,a,s){var l=o||a||s,c=n||i||"";if(!l)return r;if(!Rr.test(l)||Nr.test(l))return "url(".concat(c).concat(l).concat(c,")");if(l[0]==="/")return "url(".concat(c).concat(Tr(e)+l).concat(c,")");var d=e.split("/"),u=l.split("/");d.pop();for(var f=0,h=u;f<h.length;f++){var p=h[f];p!=="."&&(p===".."?d.pop():d.push(p));}return "url(".concat(c).concat(d.join("/")).concat(c,")")})}var xr=/^[^ \t\n\r\u000c]+/,Or=/^[, \t\n\r\u000c]+/;function Dr(t,e){if(e.trim()==="")return e;var r=0;function n(c){var d,u=c.exec(e.substring(r));return u?(d=u[0],r+=d.length,d):""}for(var o=[];n(Or),!(r>=e.length);){var i=n(xr);if(i.slice(-1)===",")i=Ce(t,i.substring(0,i.length-1)),o.push(i);else {var a="";i=Ce(t,i);for(var s=false;;){var l=e.charAt(r);if(l===""){o.push((i+a).trim());break}else if(s)l===")"&&(s=false);else if(l===","){r+=1,o.push((i+a).trim());break}else l==="("&&(s=true);a+=l,r+=1;}}}return o.join(", ")}function Ce(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function Fr(t){return !!(t.tagName==="svg"||t.ownerSVGElement)}function It(){var t=document.createElement("a");return t.href="",t.href}function vt(t,e,r,n){return r==="src"||r==="href"&&n&&!(e==="use"&&n[0]==="#")||r==="xlink:href"&&n&&n[0]!=="#"||r==="background"&&n&&(e==="table"||e==="td"||e==="th")?Ce(t,n):r==="srcset"&&n?Dr(t,n):r==="style"&&n?xe(n,It()):e==="object"&&r==="data"&&n?Ce(t,n):n}function Lr(t,e,r){if(typeof e=="string"){if(t.classList.contains(e))return true}else for(var n=t.classList.length;n--;){var o=t.classList[n];if(e.test(o))return true}return r?t.matches(r):false}function ke(t,e,r){if(!t)return false;if(t.nodeType!==t.ELEMENT_NODE)return r?ke(t.parentNode,e,r):false;for(var n=t.classList.length;n--;){var o=t.classList[n];if(e.test(o))return true}return r?ke(t.parentNode,e,r):false}function Ct(t,e,r){var n=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(n===null)return false;if(typeof e=="string"){if(n.classList.contains(e)||n.closest(".".concat(e)))return true}else if(ke(n,e,true))return true;return !!(r&&(n.matches(r)||n.closest(r)))}function Br(t,e,r){var n=t.contentWindow;if(n){var o=false,i;try{i=n.document.readyState;}catch{return}if(i!=="complete"){var a=setTimeout(function(){o||(e(),o=true);},r);t.addEventListener("load",function(){clearTimeout(a),o=true,e();});return}var s="about:blank";if(n.location.href!==s||t.src===s||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e);}}function Gr(t,e,r){var n=false,o;try{o=t.sheet;}catch{return}if(!o){var i=setTimeout(function(){n||(e(),n=true);},r);t.addEventListener("load",function(){clearTimeout(i),n=true,e();});}}function Wr(t,e){var r=e.doc,n=e.mirror,o=e.blockClass,i=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,l=e.inlineStylesheet,c=e.maskInputOptions,d=c===void 0?{}:c,u=e.maskTextFn,f=e.maskInputFn,h=e.dataURLOptions,p=h===void 0?{}:h,I=e.inlineImages,S=e.recordCanvas,C=e.keepIframeSrcFn,m=e.newlyAddedElement,g=m===void 0?false:m,k=Ur(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:D.Document,childNodes:[],compatMode:t.compatMode}:{type:D.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return {type:D.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:k};case t.ELEMENT_NODE:return Zr(t,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:l,maskInputOptions:d,maskInputFn:f,dataURLOptions:p,inlineImages:I,recordCanvas:S,keepIframeSrcFn:C,newlyAddedElement:g,rootId:k});case t.TEXT_NODE:return Vr(t,{maskTextClass:a,maskTextSelector:s,maskTextFn:u,rootId:k});case t.CDATA_SECTION_NODE:return {type:D.CDATA,textContent:"",rootId:k};case t.COMMENT_NODE:return {type:D.Comment,textContent:t.textContent||"",rootId:k};default:return false}}function Ur(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function Vr(t,e){var r,n=e.maskTextClass,o=e.maskTextSelector,i=e.maskTextFn,a=e.rootId,s=t.parentNode&&t.parentNode.tagName,l=t.textContent,c=s==="STYLE"?true:void 0,d=s==="SCRIPT"?true:void 0;if(c&&l){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(l=Er(t.parentNode.sheet));}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t);}l=xe(l,It());}return d&&(l="SCRIPT_PLACEHOLDER"),!c&&!d&&l&&Ct(t,n,o)&&(l=i?i(l):l.replace(/[\S]/g,"*")),{type:D.Text,textContent:l||"",isStyle:c,rootId:a}}function Zr(t,e){for(var r=e.doc,n=e.blockClass,o=e.blockSelector,i=e.inlineStylesheet,a=e.maskInputOptions,s=a===void 0?{}:a,l=e.maskInputFn,c=e.dataURLOptions,d=c===void 0?{}:c,u=e.inlineImages,f=e.recordCanvas,h=e.keepIframeSrcFn,p=e.newlyAddedElement,I=p===void 0?false:p,S=e.rootId,C=Lr(t,n,o),m=wr(t),g={},k=t.attributes.length,W=0;W<k;W++){var F=t.attributes[W];g[F.name]=vt(r,m,F.name,F.value);}if(m==="link"&&i){var L=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),w=null;L&&(w=ht(L)),w&&(delete g.rel,delete g.href,g._cssText=xe(w,L.href));}if(m==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var w=ht(t.sheet);w&&(g._cssText=xe(w,It()));}if(m==="input"||m==="textarea"||m==="select"){var P=t.value,K=t.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&P?g.value=we({type:g.type,tagName:m,value:P,maskInputOptions:s,maskInputFn:l}):K&&(g.checked=K);}if(m==="option"&&(t.selected&&!s.select?g.selected=true:delete g.selected),m==="canvas"&&f){if(t.__context==="2d")br(t)||(g.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var J=t.toDataURL(d.type,d.quality),Q=document.createElement("canvas");Q.width=t.width,Q.height=t.height;var q=Q.toDataURL(d.type,d.quality);J!==q&&(g.rr_dataURL=J);}}if(m==="img"&&u){ve||(ve=r.createElement("canvas"),Bt=ve.getContext("2d"));var x=t,z=x.crossOrigin;x.crossOrigin="anonymous";var X=function(){try{ve.width=x.naturalWidth,ve.height=x.naturalHeight,Bt.drawImage(x,0,0),g.rr_dataURL=ve.toDataURL(d.type,d.quality);}catch(Y){console.warn("Cannot inline img src=".concat(x.currentSrc,"! Error: ").concat(Y));}z?g.crossOrigin=z:x.removeAttribute("crossorigin");};x.complete&&x.naturalWidth!==0?X():x.onload=X;}if((m==="audio"||m==="video")&&(g.rr_mediaState=t.paused?"paused":"played",g.rr_mediaCurrentTime=t.currentTime),I||(t.scrollLeft&&(g.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(g.rr_scrollTop=t.scrollTop)),C){var ne=t.getBoundingClientRect(),ie=ne.width,Z=ne.height;g={class:g.class,rr_width:"".concat(ie,"px"),rr_height:"".concat(Z,"px")};}return m==="iframe"&&!h(g.src)&&(t.contentDocument||(g.rr_src=g.src),delete g.src),{type:D.Element,tagName:m,attributes:g,childNodes:[],isSVG:Fr(t)||void 0,needBlock:C,rootId:S}}function E(t){return t===void 0?"":t.toLowerCase()}function _r(t,e){if(e.comment&&t.type===D.Comment)return true;if(t.type===D.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")))return true;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(E(t.attributes.name).match(/^msapplication-tile(image|color)$/)||E(t.attributes.name)==="application-name"||E(t.attributes.rel)==="icon"||E(t.attributes.rel)==="apple-touch-icon"||E(t.attributes.rel)==="shortcut icon")))return true;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&E(t.attributes.name).match(/^description|keywords$/))return true;if(e.headMetaSocial&&(E(t.attributes.property).match(/^(og|twitter|fb):/)||E(t.attributes.name).match(/^(og|twitter):/)||E(t.attributes.name)==="pinterest"))return true;if(e.headMetaRobots&&(E(t.attributes.name)==="robots"||E(t.attributes.name)==="googlebot"||E(t.attributes.name)==="bingbot"))return true;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return true;if(e.headMetaAuthorship&&(E(t.attributes.name)==="author"||E(t.attributes.name)==="generator"||E(t.attributes.name)==="framework"||E(t.attributes.name)==="publisher"||E(t.attributes.name)==="progid"||E(t.attributes.property).match(/^article:/)||E(t.attributes.property).match(/^product:/)))return true;if(e.headMetaVerification&&(E(t.attributes.name)==="google-site-verification"||E(t.attributes.name)==="yandex-verification"||E(t.attributes.name)==="csrf-token"||E(t.attributes.name)==="p:domain_verify"||E(t.attributes.name)==="verify-v1"||E(t.attributes.name)==="verification"||E(t.attributes.name)==="shopify-checkout-api-token"))return true}}return false}function ue(t,e){var r=e.doc,n=e.mirror,o=e.blockClass,i=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,l=e.skipChild,c=l===void 0?false:l,d=e.inlineStylesheet,u=d===void 0?true:d,f=e.maskInputOptions,h=f===void 0?{}:f,p=e.maskTextFn,I=e.maskInputFn,S=e.slimDOMOptions,C=e.dataURLOptions,m=C===void 0?{}:C,g=e.inlineImages,k=g===void 0?false:g,W=e.recordCanvas,F=W===void 0?false:W,L=e.onSerialize,w=e.onIframeLoad,P=e.iframeLoadTimeout,K=P===void 0?5e3:P,J=e.onStylesheetLoad,Q=e.stylesheetLoadTimeout,q=Q===void 0?5e3:Q,x=e.keepIframeSrcFn,z=x===void 0?function(){return false}:x,X=e.newlyAddedElement,ne=X===void 0?false:X,ie=e.preserveWhiteSpace,Z=ie===void 0?true:ie,Y=Wr(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,dataURLOptions:m,inlineImages:k,recordCanvas:F,keepIframeSrcFn:z,newlyAddedElement:ne});if(!Y)return console.warn(t,"not serialized"),null;var le;n.hasNode(t)?le=n.getId(t):_r(Y,S)||!Z&&Y.type===D.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?le=fe:le=gt();var N=Object.assign(Y,{id:le});if(n.add(t,N),le===fe)return null;L&&L(t);var $=!c;if(N.type===D.Element){$=$&&!N.needBlock,delete N.needBlock;var oe=t.shadowRoot;oe&&pe(oe)&&(N.isShadowHost=true);}if((N.type===D.Document||N.type===D.Element)&&$){S.headWhitespace&&N.type===D.Element&&N.tagName==="head"&&(Z=false);for(var Ie={doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:c,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,slimDOMOptions:S,dataURLOptions:m,inlineImages:k,recordCanvas:F,preserveWhiteSpace:Z,onSerialize:L,onIframeLoad:w,iframeLoadTimeout:K,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:z},v=0,U=Array.from(t.childNodes);v<U.length;v++){var _=U[v],T=ue(_,Ie);T&&N.childNodes.push(T);}if(Cr(t)&&t.shadowRoot)for(var j=0,A=Array.from(t.shadowRoot.childNodes);j<A.length;j++){var _=A[j],T=ue(_,Ie);T&&(pe(t.shadowRoot)&&(T.isShadow=true),N.childNodes.push(T));}}return t.parentNode&&he(t.parentNode)&&pe(t.parentNode)&&(N.isShadow=true),N.type===D.Element&&N.tagName==="iframe"&&Br(t,function(){var H=t.contentDocument;if(H&&w){var Ae=ue(H,{doc:H,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,slimDOMOptions:S,dataURLOptions:m,inlineImages:k,recordCanvas:F,preserveWhiteSpace:Z,onSerialize:L,onIframeLoad:w,iframeLoadTimeout:K,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:z});Ae&&w(t,Ae);}},K),N.type===D.Element&&N.tagName==="link"&&N.attributes.rel==="stylesheet"&&Gr(t,function(){if(J){var H=ue(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:h,maskTextFn:p,maskInputFn:I,slimDOMOptions:S,dataURLOptions:m,inlineImages:k,recordCanvas:F,preserveWhiteSpace:Z,onSerialize:L,onIframeLoad:w,iframeLoadTimeout:K,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:z});H&&J(t,H);}},q),N}function Ut(t,e){var r=e||{},n=r.mirror,o=n===void 0?new Gt:n,i=r.blockClass,a=i===void 0?"rr-block":i,s=r.blockSelector,l=s===void 0?null:s,c=r.maskTextClass,d=c===void 0?"rr-mask":c,u=r.maskTextSelector,f=u===void 0?null:u,h=r.inlineStylesheet,p=h===void 0?true:h,I=r.inlineImages,S=I===void 0?false:I,C=r.recordCanvas,m=C===void 0?false:C,g=r.maskAllInputs,k=g===void 0?false:g,W=r.maskTextFn,F=r.maskInputFn,L=r.slimDOM,w=L===void 0?false:L,P=r.dataURLOptions,K=r.preserveWhiteSpace,J=r.onSerialize,Q=r.onIframeLoad,q=r.iframeLoadTimeout,x=r.onStylesheetLoad,z=r.stylesheetLoadTimeout,X=r.keepIframeSrcFn,ne=X===void 0?function(){return false}:X,ie=k===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:k===false?{password:true}:k,Z=w===true||w==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaDescKeywords:w==="all",headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaAuthorship:true,headMetaVerification:true}:w===false?{}:w;return ue(t,{doc:t,mirror:o,blockClass:a,blockSelector:l,maskTextClass:d,maskTextSelector:f,skipChild:false,inlineStylesheet:p,maskInputOptions:ie,maskTextFn:W,maskInputFn:F,slimDOMOptions:Z,dataURLOptions:P,inlineImages:S,recordCanvas:m,preserveWhiteSpace:K,onSerialize:J,onIframeLoad:Q,iframeLoadTimeout:q,onStylesheetLoad:x,stylesheetLoadTimeout:z,keepIframeSrcFn:ne,newlyAddedElement:false})}function B(t,e,r=document){let n={capture:true,passive:true};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var ye=`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.`,Vt={map:{},getId(){return console.error(ye),-1},getNode(){return console.error(ye),null},removeNodeFromMap(){console.error(ye);},has(){return console.error(ye),false},reset(){console.error(ye);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Vt=new Proxy(Vt,{get(t,e,r){return e==="map"&&console.error(ye),Reflect.get(t,e,r)}}));function Se(t,e,r={}){let n=null,o=0;return function(...i){let a=Date.now();!o&&r.leading===false&&(o=a);let s=e-(a-o),l=this;s<=0||s>e?(n&&(clearTimeout(n),n=null),o=a,t.apply(l,i)):!n&&r.trailing!==false&&(n=setTimeout(()=>{o=r.leading===false?0:Date.now(),n=null,t.apply(l,i);},s));}}function me(t,e,r,n,o=window){let i=o.Object.getOwnPropertyDescriptor(t,e);return o.Object.defineProperty(t,e,n?r:{set(a){setTimeout(()=>{r.set.call(this,a);},0),i&&i.set&&i.set.call(this,a);}}),()=>me(t,e,i||{},true)}function ee(t,e,r){try{if(!(e in t))return ()=>{};let n=t[e],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),t[e]=o,()=>{t[e]=n;}}catch{return ()=>{}}}function De(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Fe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function M(t,e,r,n){if(!t)return false;let o=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!o)return false;if(typeof e=="string"){if(o.classList.contains(e)||n&&o.closest("."+e)!==null)return true}else if(ke(o,e,n))return true;return !!(r&&(t.matches(r)||n&&o.closest(r)!==null))}function Zt(t,e){return e.getId(t)!==-1}function Le(t,e){return e.getId(t)===fe}function yt(t,e){if(he(t))return false;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?false:t.parentNode?yt(t.parentNode,e):true:true}function St(t){return !!t.changedTouches}function Ht(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let r=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===r)return true;while(r=r&&r.parentNode);return false});}function Be(t,e){return !!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Ge(t,e){return !!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function We(t){return !!t?.shadowRoot}var Oe=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map;}getId(e){var r;return (r=this.styleIDMap.get(e))!==null&&r!==void 0?r:-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1;}generateId(){return this.id++}};var b=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(b||{}),y=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(y||{}),Ue=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(Ue||{}),se=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(se||{});function _t(t){return "__ln"in t}var bt=class{constructor(){this.length=0,this.head=null;}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<e;n++)r=r?.next||null;return r}addNode(e){let r={value:e,previous:null,next:null};if(e.__ln=r,e.previousSibling&&_t(e.previousSibling)){let n=e.previousSibling.__ln.next;r.next=n,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,n&&(n.previous=r);}else if(e.nextSibling&&_t(e.nextSibling)&&e.nextSibling.__ln.previous){let n=e.nextSibling.__ln.previous;r.previous=n,r.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=r,n&&(n.next=r);}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;this.length++;}removeNode(e){let r=e.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next&&(r.next.previous=r.previous)):(this.head=r.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--);}},Pt=(t,e)=>`${t}@${e}`,Ve=class{constructor(){this.frozen=false,this.locked=false,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit();},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],r=new bt,n=s=>{let l=s,c=fe;for(;c===fe;)l=l&&l.nextSibling,c=l&&this.mirror.getId(l);return c},o=s=>{var l,c,d,u;let f=null;((c=(l=s.getRootNode)===null||l===void 0?void 0:l.call(s))===null||c===void 0?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(f=s.getRootNode().host);let h=f;for(;((u=(d=h?.getRootNode)===null||d===void 0?void 0:d.call(h))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&h.getRootNode().host;)h=h.getRootNode().host;let p=!this.doc.contains(s)&&(!h||!this.doc.contains(h));if(!s.parentNode||p)return;let I=he(s.parentNode)?this.mirror.getId(f):this.mirror.getId(s.parentNode),S=n(s);if(I===-1||S===-1)return r.addNode(s);let C=ue(s,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,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:m=>{Be(m,this.mirror)&&this.iframeManager.addIframe(m),Ge(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),We(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc);},onIframeLoad:(m,g)=>{this.iframeManager.attachIframe(m,g),this.shadowDomManager.observeAttachShadow(m);},onStylesheetLoad:(m,g)=>{this.stylesheetManager.attachLinkElement(m,g);}});C&&e.push({parentId:I,nextId:S,node:C});};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))zt(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||o(s);for(let s of Array.from(this.addedSet.values()))!Kt(this.droppedSet,s)&&!zt(this.removes,s,this.mirror)||Kt(this.movedSet,s)?o(s):this.droppedSet.add(s);let i=null;for(;r.length;){let s=null;if(i){let l=this.mirror.getId(i.value.parentNode),c=n(i.value);l!==-1&&c!==-1&&(s=i);}if(!s)for(let l=r.length-1;l>=0;l--){let c=r.get(l);if(c){let d=this.mirror.getId(c.value.parentNode);if(n(c.value)===-1)continue;if(d!==-1){s=c;break}else {let f=c.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let h=f.parentNode.host;if(this.mirror.getId(h)!==-1){s=c;break}}}}}if(!s){for(;r.head;)r.removeNode(r.head.value);break}i=s.previous,r.removeNode(s.value),o(s.value);}let a={texts:this.texts.map(s=>({id:this.mirror.getId(s.node),value:s.value})).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>({id:this.mirror.getId(s.node),attributes:s.attributes})).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a));},this.processMutation=e=>{if(!Le(e.target,this.mirror))switch(e.type){case "characterData":{let r=e.target.textContent;!M(e.target,this.blockClass,this.blockSelector,false)&&r!==e.oldValue&&this.texts.push({value:Ct(e.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:e.target});break}case "attributes":{let r=e.target,n=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(n=we({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),M(e.target,this.blockClass,this.blockSelector,false)||n===e.oldValue)return;let o=this.attributes.find(i=>i.node===e.target);if(r.tagName==="IFRAME"&&e.attributeName==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)e.attributeName="rr_src";else return;if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),e.attributeName==="style"){let i=this.doc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue),(o.attributes.style===void 0||o.attributes.style===null)&&(o.attributes.style={});let a=o.attributes.style;for(let s of Array.from(r.style)){let l=r.style.getPropertyValue(s),c=r.style.getPropertyPriority(s);(l!==i.style.getPropertyValue(s)||c!==i.style.getPropertyPriority(s))&&(c===""?a[s]=l:a[s]=[l,c]);}for(let s of Array.from(i.style))r.style.getPropertyValue(s)===""&&(a[s]=false);}else o.attributes[e.attributeName]=vt(this.doc,r.tagName,e.attributeName,n);break}case "childList":{if(M(e.target,this.blockClass,this.blockSelector,true))return;e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let n=this.mirror.getId(r),o=he(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);M(e.target,this.blockClass,this.blockSelector,false)||Le(r,this.mirror)||!Zt(r,this.mirror)||(this.addedSet.has(r)?(At(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||yt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Pt(n,o)]?At(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:he(e.target)&&pe(e.target)?true:void 0})),this.mapRemoves.push(r));});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(Le(e,this.mirror))return;this.movedSet.add(e);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Pt(this.mirror.getId(e),n)]=true);}else this.addedSet.add(e),this.droppedSet.delete(e);M(e,this.blockClass,this.blockSelector,false)||e.childNodes.forEach(n=>this.genAdds(n));};}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(r=>{this[r]=e[r];});}freeze(){this.frozen=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};function At(t,e){t.delete(e),e.childNodes.forEach(r=>At(t,r));}function zt(t,e,r){return t.length===0?false:Yt(t,e,r)}function Yt(t,e,r){let{parentNode:n}=e;if(!n)return false;let o=r.getId(n);return t.some(i=>i.id===o)?true:Yt(t,n,r)}function Kt(t,e){return t.size===0?false:jt(t,e)}function jt(t,e){let{parentNode:r}=e;return r?t.has(r)?true:jt(t,r):false}var de=[],qt=typeof CSSGroupingRule<"u",Xt=typeof CSSMediaRule<"u",$t=typeof CSSSupportsRule<"u",er=typeof CSSConditionRule<"u";function Ee(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch{return t.target}}function kt(t,e){var r,n;let o=new Ve;de.push(o),o.init(t);let i=window.MutationObserver||window.__rrMutationObserver,a=(n=(r=window?.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");a&&window[a]&&(i=window[a]);let s=new i(o.processMutations.bind(o));return s.observe(e,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),s}function Pr({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===false)return ()=>{};let o=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,a=[],s,l=Se(u=>{let f=Date.now()-s;t(a.map(h=>(h.timeOffset-=f,h)),u),a=[],s=null;},i),c=Se(u=>{let f=Ee(u),{clientX:h,clientY:p}=St(u)?u.changedTouches[0]:u;s||(s=Date.now()),a.push({x:h,y:p,id:n.getId(f),timeOffset:Date.now()-s}),l(typeof DragEvent<"u"&&u instanceof DragEvent?y.Drag:u instanceof MouseEvent?y.MouseMove:y.TouchMove);},o,{trailing:false}),d=[B("mousemove",c,r),B("touchmove",c,r),B("drag",c,r)];return ()=>{d.forEach(u=>u());}}function zr({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){if(i.mouseInteraction===false)return ()=>{};let a=i.mouseInteraction===true||i.mouseInteraction===void 0?{}:i.mouseInteraction,s=[],l=c=>d=>{let u=Ee(d);if(M(u,n,o,true))return;let f=St(d)?d.changedTouches[0]:d;if(!f)return;let h=r.getId(u),{clientX:p,clientY:I}=f;t({type:Ue[c],id:h,x:p,y:I});};return Object.keys(Ue).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&a[c]!==false).forEach(c=>{let d=c.toLowerCase(),u=l(c);s.push(B(d,u,e));}),()=>{s.forEach(c=>c());}}function wt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){let a=Se(s=>{let l=Ee(s);if(!l||M(l,n,o,true))return;let c=r.getId(l);if(l===e){let d=e.scrollingElement||e.documentElement;t({id:c,x:d.scrollLeft,y:d.scrollTop});}else t({id:c,x:l.scrollLeft,y:l.scrollTop});},i.scroll||100);return B("scroll",a,e)}function Kr({viewportResizeCb:t}){let e=-1,r=-1,n=Se(()=>{let o=De(),i=Fe();(e!==o||r!==i)&&(t({width:Number(i),height:Number(o)}),e=o,r=i);},200);return B("resize",n,window)}function Jt(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var Yr=["INPUT","TEXTAREA","SELECT"],Qt=new WeakMap;function jr({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,maskInputOptions:a,maskInputFn:s,sampling:l,userTriggeredOnInput:c}){function d(C){let m=Ee(C),g=C.isTrusted;if(m&&m.tagName==="OPTION"&&(m=m.parentElement),!m||!m.tagName||Yr.indexOf(m.tagName)<0||M(m,n,o,true))return;let k=m.type;if(m.classList.contains(i))return;let W=m.value,F=false;k==="radio"||k==="checkbox"?F=m.checked:(a[m.tagName.toLowerCase()]||a[k])&&(W=we({maskInputOptions:a,tagName:m.tagName,type:k,value:W,maskInputFn:s})),u(m,Jt({text:W,isChecked:F,userTriggered:g},c));let L=m.name;k==="radio"&&L&&F&&e.querySelectorAll(`input[type="radio"][name="${L}"]`).forEach(w=>{w!==m&&u(w,Jt({text:w.value,isChecked:!F,userTriggered:false},c));});}function u(C,m){let g=Qt.get(C);if(!g||g.text!==m.text||g.isChecked!==m.isChecked){Qt.set(C,m);let k=r.getId(C);t(Object.assign(Object.assign({},m),{id:k}));}}let h=(l.input==="last"?["change"]:["input","change"]).map(C=>B(C,d,e)),p=e.defaultView;if(!p)return ()=>{h.forEach(C=>C());};let I=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),S=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return I&&I.set&&h.push(...S.map(C=>me(C[0],C[1],{set(){d({target:this});}},false,p))),()=>{h.forEach(C=>C());}}function Ze(t){let e=[];function r(n,o){if(qt&&n.parentRule instanceof CSSGroupingRule||Xt&&n.parentRule instanceof CSSMediaRule||$t&&n.parentRule instanceof CSSSupportsRule||er&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(a);}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a);}return o}return r(t,e)}function ce(t,e,r){let n,o;return t?(t.ownerNode?n=e.getId(t.ownerNode):o=r.getId(t),{styleId:o,id:n}):{}}function Jr({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:f,styleId:h}=ce(this,e,r.styleMirror);return (f&&f!==-1||h&&h!==-1)&&t({id:f,styleId:h,adds:[{rule:d,index:u}]}),o.apply(this,[d,u])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(d){let{id:u,styleId:f}=ce(this,e,r.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,removes:[{index:d}]}),i.apply(this,[d])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:f}=ce(this,e,r.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,replace:d}),a.apply(this,[d])});let s;n.CSSStyleSheet.prototype.replaceSync&&(s=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:f}=ce(this,e,r.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,replaceSync:d}),s.apply(this,[d])});let l={};qt?l.CSSGroupingRule=n.CSSGroupingRule:(Xt&&(l.CSSMediaRule=n.CSSMediaRule),er&&(l.CSSConditionRule=n.CSSConditionRule),$t&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([d,u])=>{c[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(f,h){let{id:p,styleId:I}=ce(this.parentStyleSheet,e,r.styleMirror);return (p&&p!==-1||I&&I!==-1)&&t({id:p,styleId:I,adds:[{rule:f,index:[...Ze(this),h||0]}]}),c[d].insertRule.apply(this,[f,h])},u.prototype.deleteRule=function(f){let{id:h,styleId:p}=ce(this.parentStyleSheet,e,r.styleMirror);return (h&&h!==-1||p&&p!==-1)&&t({id:h,styleId:p,removes:[{index:[...Ze(this),f]}]}),c[d].deleteRule.apply(this,[f])};}),()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,a&&(n.CSSStyleSheet.prototype.replace=a),s&&(n.CSSStyleSheet.prototype.replaceSync=s),Object.entries(l).forEach(([d,u])=>{u.prototype.insertRule=c[d].insertRule,u.prototype.deleteRule=c[d].deleteRule;});}}function Et({mirror:t,stylesheetManager:e},r){var n,o,i;let a=null;r.nodeName==="#document"?a=t.getId(r):a=t.getId(r.host);let s=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(i=(o=r.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||i===void 0?void 0:i.ShadowRoot,l=Object.getOwnPropertyDescriptor(s?.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return (c=l.get)===null||c===void 0?void 0:c.call(this)},set(c){var d;let u=(d=l.set)===null||d===void 0?void 0:d.call(this,c);if(a!==null&&a!==-1)try{e.adoptStyleSheets(c,a);}catch{}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set});})}function Qr({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=function(s,l,c){var d;if(r.has(s))return i.apply(this,[s,l,c]);let{id:u,styleId:f}=ce((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,n.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,set:{property:s,value:l,priority:c},index:Ze(this.parentRule)}),i.apply(this,[s,l,c])};let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=function(s){var l;if(r.has(s))return a.apply(this,[s]);let{id:c,styleId:d}=ce((l=this.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,e,n.styleMirror);return (c&&c!==-1||d&&d!==-1)&&t({id:c,styleId:d,remove:{property:s},index:Ze(this.parentRule)}),a.apply(this,[s])},()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=a;}}function qr({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:o}){let i=s=>Se(l=>{let c=Ee(l);if(!c||M(c,e,r,true))return;let{currentTime:d,volume:u,muted:f,playbackRate:h}=c;t({type:s,id:n.getId(c),currentTime:d,volume:u,muted:f,playbackRate:h});},o.media||500),a=[B("play",i(0)),B("pause",i(1)),B("seeked",i(2)),B("volumechange",i(3)),B("ratechange",i(4))];return ()=>{a.forEach(s=>s());}}function Xr({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return ()=>{};let n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(l,c,d){let u=new i(l,c,d);return o.set(u,{family:l,buffer:typeof c!="string",descriptors:d,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),u};let a=ee(e.fonts,"add",function(s){return function(l){return setTimeout(()=>{let c=o.get(l);c&&(t(c),o.delete(l));},0),s.apply(this,[l])}});return n.push(()=>{r.FontFace=i;}),n.push(a),()=>{n.forEach(s=>s());}}function $r(t){let{doc:e,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=t,a=true,s=()=>{let l=e.getSelection();if(!l||a&&l?.isCollapsed)return;a=l.isCollapsed||false;let c=[],d=l.rangeCount||0;for(let u=0;u<d;u++){let f=l.getRangeAt(u),{startContainer:h,startOffset:p,endContainer:I,endOffset:S}=f;M(h,n,o,true)||M(I,n,o,true)||c.push({start:r.getId(h),startOffset:p,end:r.getId(I),endOffset:S});}i({ranges:c});};return s(),B("selectionchange",s)}function en(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:a,inputCb:s,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:f,selectionCb:h}=t;t.mutationCb=(...p)=>{e.mutation&&e.mutation(...p),r(...p);},t.mousemoveCb=(...p)=>{e.mousemove&&e.mousemove(...p),n(...p);},t.mouseInteractionCb=(...p)=>{e.mouseInteraction&&e.mouseInteraction(...p),o(...p);},t.scrollCb=(...p)=>{e.scroll&&e.scroll(...p),i(...p);},t.viewportResizeCb=(...p)=>{e.viewportResize&&e.viewportResize(...p),a(...p);},t.inputCb=(...p)=>{e.input&&e.input(...p),s(...p);},t.mediaInteractionCb=(...p)=>{e.mediaInteaction&&e.mediaInteaction(...p),l(...p);},t.styleSheetRuleCb=(...p)=>{e.styleSheetRule&&e.styleSheetRule(...p),c(...p);},t.styleDeclarationCb=(...p)=>{e.styleDeclaration&&e.styleDeclaration(...p),d(...p);},t.canvasMutationCb=(...p)=>{e.canvasMutation&&e.canvasMutation(...p),u(...p);},t.fontCb=(...p)=>{e.font&&e.font(...p),f(...p);},t.selectionCb=(...p)=>{e.selection&&e.selection(...p),h(...p);};}function tr(t,e={}){let r=t.doc.defaultView;if(!r)return ()=>{};en(t,e);let n=kt(t,t.doc),o=Pr(t),i=zr(t),a=wt(t),s=Kr(t),l=jr(t),c=qr(t),d=Jr(t,{win:r}),u=Et(t,t.doc),f=Qr(t,{win:r}),h=t.collectFonts?Xr(t):()=>{},p=$r(t),I=[];for(let S of t.plugins)I.push(S.observer(S.callback,r,S.options));return ()=>{de.forEach(S=>S.reset()),n.disconnect(),o(),i(),a(),s(),l(),c(),d(),u(),f(),h(),p(),I.forEach(S=>S());}}var Te=class{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;}getId(e,r,n,o){let i=n||this.getIdToRemoteIdMap(e),a=o||this.getRemoteIdToIdMap(e),s=i.get(r);return s||(s=this.generateIdFn(),i.set(r,s),a.set(s,r)),s}getIds(e,r){let n=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return r.map(i=>this.getId(e,i,n,o))}getRemoteId(e,r,n){let o=n||this.getRemoteIdToIdMap(e);if(typeof r!="number")return r;let i=o.get(r);return i||-1}getRemoteIds(e,r){let n=this.getRemoteIdToIdMap(e);return r.map(o=>this.getRemoteId(e,o,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e);}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}};var He=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Te(gt),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Te(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this));}addIframe(e){this.iframes.set(e,true),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e);}addLoadListener(e){this.loadListener=e;}attachIframe(e,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:true}),(n=this.loadListener)===null||n===void 0||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument));}handleMessage(e){if(e.data.type==="rrweb"){if(!e.source)return;let n=this.crossOriginIframeMap.get(e.source);if(!n)return;let o=this.transformCrossOriginEvent(n,e.data.event);o&&this.wrappedEmit(o,e.data.isCheckout);}}transformCrossOriginEvent(e,r){var n;switch(r.type){case b.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e),{timestamp:r.timestamp,type:b.IncrementalSnapshot,data:{source:y.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}};case b.Meta:case b.Load:case b.DomContentLoaded:return false;case b.Plugin:return r;case b.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case b.IncrementalSnapshot:switch(r.data.source){case y.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);}),r.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"]);}),r.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"]);}),r.data.texts.forEach(o=>{this.replaceIds(o,e,["id"]);}),r;case y.Drag:case y.TouchMove:case y.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,e,["id"]);}),r;case y.ViewportResize:return false;case y.MediaInteraction:case y.MouseInteraction:case y.Scroll:case y.CanvasMutation:case y.Input:return this.replaceIds(r.data,e,["id"]),r;case y.StyleSheetRule:case y.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case y.Font:return r;case y.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"]);}),r;case y.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(o=>{this.replaceStyleIds(o,e,["styleId"]);}),r}}}replace(e,r,n,o){for(let i of o)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=e.getIds(n,r[i]):r[i]=e.getId(n,r[i]));return r}replaceIds(e,r,n){return this.replace(this.crossOriginIframeMirror,e,r,n)}replaceStyleIds(e,r,n){return this.replace(this.crossOriginIframeStyleMirror,e,r,n)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id"]),"childNodes"in e&&e.childNodes.forEach(n=>{this.replaceIdOnNode(n,r);});}};var _e=class{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;let r=this;this.restorePatches.push(ee(Element.prototype,"attachShadow",function(n){return function(o){let i=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),i}}));}addShadowRoot(e,r){pe(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),kt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),wt(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Et({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e);},0)));}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ee(e.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(o){let i=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,e.contentDocument),i}}));}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet;}};function rr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function nr(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i);})}return new(r||(r=Promise))(function(i,a){function s(d){try{c(n.next(d));}catch(u){a(u);}}function l(d){try{c(n.throw(d));}catch(u){a(u);}}function c(d){d.done?i(d.value):o(d.value).then(s,l);}c((n=n.apply(t,[])).next());})}var be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Me=0;Me<be.length;Me++)tn[be.charCodeAt(Me)]=Me;var Me,or=function(t){var e=new Uint8Array(t),r,n=e.length,o="";for(r=0;r<n;r+=3)o+=be[e[r]>>2],o+=be[(e[r]&3)<<4|e[r+1]>>4],o+=be[(e[r+1]&15)<<2|e[r+2]>>6],o+=be[e[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};var ir=new Map;function rn(t,e){let r=ir.get(t);return r||(r=new Map,ir.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Tt=(t,e,r)=>{if(!t||!(sr(t,e)||typeof t=="object"))return;let n=t.constructor.name,o=rn(r,n),i=o.indexOf(t);return i===-1&&(i=o.length,o.push(t)),i};function Pe(t,e,r){if(t instanceof Array)return t.map(n=>Pe(n,e,r));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return {rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let n=t.constructor.name,o=or(t);return {rr_type:n,base64:o}}else {if(t instanceof DataView)return {rr_type:t.constructor.name,args:[Pe(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let n=t.constructor.name,{src:o}=t;return {rr_type:n,src:o}}else if(t instanceof HTMLCanvasElement){let n="HTMLImageElement",o=t.toDataURL();return {rr_type:n,src:o}}else {if(t instanceof ImageData)return {rr_type:t.constructor.name,args:[Pe(t.data,e,r),t.width,t.height]};if(sr(t,e)||typeof t=="object"){let n=t.constructor.name,o=Tt(t,e,r);return {rr_type:n,index:o}}}}return t}var ze=(t,e,r)=>[...t].map(n=>Pe(n,e,r)),sr=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof e[o]=="function").find(o=>t instanceof e[o]);function ar(t,e,r,n){let o=[],i=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let a of i)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;let s=ee(e.CanvasRenderingContext2D.prototype,a,function(l){return function(...c){return M(this.canvas,r,n,!0)||setTimeout(()=>{let d=ze([...c],e,this);t(this.canvas,{type:se["2D"],property:a,args:d});},0),l.apply(this,c)}});o.push(s);}catch{let l=me(e.CanvasRenderingContext2D.prototype,a,{set(c){t(this.canvas,{type:se["2D"],property:a,args:[c],setter:true});}});o.push(l);}return ()=>{o.forEach(a=>a());}}function Mt(t,e,r){let n=[];try{let o=ee(t.HTMLCanvasElement.prototype,"getContext",function(i){return function(a,...s){return M(this,e,r,!0)||"__context"in this||(this.__context=a),i.apply(this,[a,...s])}});n.push(o);}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{n.forEach(o=>o());}}function lr(t,e,r,n,o,i,a){let s=[],l=Object.getOwnPropertyNames(t);for(let c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof t[c]!="function")continue;let d=ee(t,c,function(u){return function(...f){let h=u.apply(this,f);if(Tt(h,a,this),!M(this.canvas,n,o,!0)){let p=ze([...f],a,this),I={type:e,property:c,args:p};r(this.canvas,I);}return h}});s.push(d);}catch{let u=me(t,c,{set(f){r(this.canvas,{type:e,property:c,args:[f],setter:true});}});s.push(u);}return s}function cr(t,e,r,n,o){let i=[];return i.push(...lr(e.WebGLRenderingContext.prototype,se.WebGL,t,r,n,o,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...lr(e.WebGL2RenderingContext.prototype,se.WebGL2,t,r,n,o,e)),()=>{i.forEach(a=>a());}}var Rt=null;try{dr=typeof module<"u"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof ft=="function"&&ft("worker_threads"),Rt=dr.Worker;}catch{}var dr;function nn(t,e){return Buffer.from(t,"base64").toString("utf8")}function ur(t,e,r){var i=nn(t),a=i.indexOf(`
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,Vt={map:{},getId(){return console.error(ye),-1},getNode(){return console.error(ye),null},removeNodeFromMap(){console.error(ye);},has(){return console.error(ye),false},reset(){console.error(ye);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Vt=new Proxy(Vt,{get(t,e,r){return e==="map"&&console.error(ye),Reflect.get(t,e,r)}}));function Se(t,e,r={}){let n=null,o=0;return function(...i){let a=Date.now();!o&&r.leading===false&&(o=a);let s=e-(a-o),l=this;s<=0||s>e?(n&&(clearTimeout(n),n=null),o=a,t.apply(l,i)):!n&&r.trailing!==false&&(n=setTimeout(()=>{o=r.leading===false?0:Date.now(),n=null,t.apply(l,i);},s));}}function me(t,e,r,n,o=window){let i=o.Object.getOwnPropertyDescriptor(t,e);return o.Object.defineProperty(t,e,n?r:{set(a){setTimeout(()=>{r.set.call(this,a);},0),i&&i.set&&i.set.call(this,a);}}),()=>me(t,e,i||{},true)}function ee(t,e,r){try{if(!(e in t))return ()=>{};let n=t[e],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),t[e]=o,()=>{t[e]=n;}}catch{return ()=>{}}}function De(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Fe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function M(t,e,r,n){if(!t)return false;let o=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!o)return false;if(typeof e=="string"){if(o.classList.contains(e)||n&&o.closest("."+e)!==null)return true}else if(ke(o,e,n))return true;return !!(r&&(t.matches(r)||n&&o.closest(r)!==null))}function Zt(t,e){return e.getId(t)!==-1}function Le(t,e){return e.getId(t)===fe}function yt(t,e){if(he(t))return false;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?false:t.parentNode?yt(t.parentNode,e):true:true}function St(t){return !!t.changedTouches}function _t(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let r=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===r)return true;while(r=r&&r.parentNode);return false});}function Be(t,e){return !!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Ge(t,e){return !!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function We(t){return !!t?.shadowRoot}var Oe=class{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map;}getId(e){var r;return (r=this.styleIDMap.get(e))!==null&&r!==void 0?r:-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1;}generateId(){return this.id++}};var b=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(b||{}),y=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t))(y||{}),Ue=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(Ue||{}),se=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(se||{});function Ht(t){return "__ln"in t}var bt=class{constructor(){this.length=0,this.head=null;}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<e;n++)r=r?.next||null;return r}addNode(e){let r={value:e,previous:null,next:null};if(e.__ln=r,e.previousSibling&&Ht(e.previousSibling)){let n=e.previousSibling.__ln.next;r.next=n,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,n&&(n.previous=r);}else if(e.nextSibling&&Ht(e.nextSibling)&&e.nextSibling.__ln.previous){let n=e.nextSibling.__ln.previous;r.previous=n,r.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=r,n&&(n.next=r);}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;this.length++;}removeNode(e){let r=e.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next&&(r.next.previous=r.previous)):(this.head=r.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--);}},Pt=(t,e)=>`${t}@${e}`,Ve=class{constructor(){this.frozen=false,this.locked=false,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit();},this.emit=()=>{if(this.frozen||this.locked)return;let e=[],r=new bt,n=s=>{let l=s,c=fe;for(;c===fe;)l=l&&l.nextSibling,c=l&&this.mirror.getId(l);return c},o=s=>{var l,c,d,u;let f=null;((c=(l=s.getRootNode)===null||l===void 0?void 0:l.call(s))===null||c===void 0?void 0:c.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(f=s.getRootNode().host);let h=f;for(;((u=(d=h?.getRootNode)===null||d===void 0?void 0:d.call(h))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&h.getRootNode().host;)h=h.getRootNode().host;let p=!this.doc.contains(s)&&(!h||!this.doc.contains(h));if(!s.parentNode||p)return;let I=he(s.parentNode)?this.mirror.getId(f):this.mirror.getId(s.parentNode),S=n(s);if(I===-1||S===-1)return r.addNode(s);let C=ue(s,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:true,newlyAddedElement:true,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:m=>{Be(m,this.mirror)&&this.iframeManager.addIframe(m),Ge(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),We(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc);},onIframeLoad:(m,g)=>{this.iframeManager.attachIframe(m,g),this.shadowDomManager.observeAttachShadow(m);},onStylesheetLoad:(m,g)=>{this.stylesheetManager.attachLinkElement(m,g);}});C&&e.push({parentId:I,nextId:S,node:C});};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))Kt(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||o(s);for(let s of Array.from(this.addedSet.values()))!zt(this.droppedSet,s)&&!Kt(this.removes,s,this.mirror)||zt(this.movedSet,s)?o(s):this.droppedSet.add(s);let i=null;for(;r.length;){let s=null;if(i){let l=this.mirror.getId(i.value.parentNode),c=n(i.value);l!==-1&&c!==-1&&(s=i);}if(!s)for(let l=r.length-1;l>=0;l--){let c=r.get(l);if(c){let d=this.mirror.getId(c.value.parentNode);if(n(c.value)===-1)continue;if(d!==-1){s=c;break}else {let f=c.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let h=f.parentNode.host;if(this.mirror.getId(h)!==-1){s=c;break}}}}}if(!s){for(;r.head;)r.removeNode(r.head.value);break}i=s.previous,r.removeNode(s.value),o(s.value);}let a={texts:this.texts.map(s=>({id:this.mirror.getId(s.node),value:s.value})).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>({id:this.mirror.getId(s.node),attributes:s.attributes})).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:e};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a));},this.processMutation=e=>{if(!Le(e.target,this.mirror))switch(e.type){case "characterData":{let r=e.target.textContent;!M(e.target,this.blockClass,this.blockSelector,false)&&r!==e.oldValue&&this.texts.push({value:Ct(e.target,this.maskTextClass,this.maskTextSelector)&&r?this.maskTextFn?this.maskTextFn(r):r.replace(/[\S]/g,"*"):r,node:e.target});break}case "attributes":{let r=e.target,n=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(n=we({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:n,maskInputFn:this.maskInputFn})),M(e.target,this.blockClass,this.blockSelector,false)||n===e.oldValue)return;let o=this.attributes.find(i=>i.node===e.target);if(r.tagName==="IFRAME"&&e.attributeName==="src"&&!this.keepIframeSrcFn(n))if(!r.contentDocument)e.attributeName="rr_src";else return;if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),e.attributeName==="style"){let i=this.doc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue),(o.attributes.style===void 0||o.attributes.style===null)&&(o.attributes.style={});let a=o.attributes.style;for(let s of Array.from(r.style)){let l=r.style.getPropertyValue(s),c=r.style.getPropertyPriority(s);(l!==i.style.getPropertyValue(s)||c!==i.style.getPropertyPriority(s))&&(c===""?a[s]=l:a[s]=[l,c]);}for(let s of Array.from(i.style))r.style.getPropertyValue(s)===""&&(a[s]=false);}else o.attributes[e.attributeName]=vt(this.doc,r.tagName,e.attributeName,n);break}case "childList":{if(M(e.target,this.blockClass,this.blockSelector,true))return;e.addedNodes.forEach(r=>this.genAdds(r,e.target)),e.removedNodes.forEach(r=>{let n=this.mirror.getId(r),o=he(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);M(e.target,this.blockClass,this.blockSelector,false)||Le(r,this.mirror)||!Zt(r,this.mirror)||(this.addedSet.has(r)?(At(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||yt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Pt(n,o)]?At(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:he(e.target)&&pe(e.target)?true:void 0})),this.mapRemoves.push(r));});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(Le(e,this.mirror))return;this.movedSet.add(e);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Pt(this.mirror.getId(e),n)]=true);}else this.addedSet.add(e),this.droppedSet.delete(e);M(e,this.blockClass,this.blockSelector,false)||e.childNodes.forEach(n=>this.genAdds(n));};}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].forEach(r=>{this[r]=e[r];});}freeze(){this.frozen=true,this.canvasManager.freeze();}unfreeze(){this.frozen=false,this.canvasManager.unfreeze(),this.emit();}isFrozen(){return this.frozen}lock(){this.locked=true,this.canvasManager.lock();}unlock(){this.locked=false,this.canvasManager.unlock(),this.emit();}reset(){this.shadowDomManager.reset(),this.canvasManager.reset();}};function At(t,e){t.delete(e),e.childNodes.forEach(r=>At(t,r));}function Kt(t,e,r){return t.length===0?false:Yt(t,e,r)}function Yt(t,e,r){let{parentNode:n}=e;if(!n)return false;let o=r.getId(n);return t.some(i=>i.id===o)?true:Yt(t,n,r)}function zt(t,e){return t.size===0?false:jt(t,e)}function jt(t,e){let{parentNode:r}=e;return r?t.has(r)?true:jt(t,r):false}var de=[],qt=typeof CSSGroupingRule<"u",Xt=typeof CSSMediaRule<"u",$t=typeof CSSSupportsRule<"u",er=typeof CSSConditionRule<"u";function Ee(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch{return t.target}}function kt(t,e){var r,n;let o=new Ve;de.push(o),o.init(t);let i=window.MutationObserver||window.__rrMutationObserver,a=(n=(r=window?.Zone)===null||r===void 0?void 0:r.__symbol__)===null||n===void 0?void 0:n.call(r,"MutationObserver");a&&window[a]&&(i=window[a]);let s=new i(o.processMutations.bind(o));return s.observe(e,{attributes:true,attributeOldValue:true,characterData:true,characterDataOldValue:true,childList:true,subtree:true}),s}function Pr({mousemoveCb:t,sampling:e,doc:r,mirror:n}){if(e.mousemove===false)return ()=>{};let o=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,a=[],s,l=Se(u=>{let f=Date.now()-s;t(a.map(h=>(h.timeOffset-=f,h)),u),a=[],s=null;},i),c=Se(u=>{let f=Ee(u),{clientX:h,clientY:p}=St(u)?u.changedTouches[0]:u;s||(s=Date.now()),a.push({x:h,y:p,id:n.getId(f),timeOffset:Date.now()-s}),l(typeof DragEvent<"u"&&u instanceof DragEvent?y.Drag:u instanceof MouseEvent?y.MouseMove:y.TouchMove);},o,{trailing:false}),d=[B("mousemove",c,r),B("touchmove",c,r),B("drag",c,r)];return ()=>{d.forEach(u=>u());}}function Kr({mouseInteractionCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){if(i.mouseInteraction===false)return ()=>{};let a=i.mouseInteraction===true||i.mouseInteraction===void 0?{}:i.mouseInteraction,s=[],l=c=>d=>{let u=Ee(d);if(M(u,n,o,true))return;let f=St(d)?d.changedTouches[0]:d;if(!f)return;let h=r.getId(u),{clientX:p,clientY:I}=f;t({type:Ue[c],id:h,x:p,y:I});};return Object.keys(Ue).filter(c=>Number.isNaN(Number(c))&&!c.endsWith("_Departed")&&a[c]!==false).forEach(c=>{let d=c.toLowerCase(),u=l(c);s.push(B(d,u,e));}),()=>{s.forEach(c=>c());}}function wt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){let a=Se(s=>{let l=Ee(s);if(!l||M(l,n,o,true))return;let c=r.getId(l);if(l===e){let d=e.scrollingElement||e.documentElement;t({id:c,x:d.scrollLeft,y:d.scrollTop});}else t({id:c,x:l.scrollLeft,y:l.scrollTop});},i.scroll||100);return B("scroll",a,e)}function zr({viewportResizeCb:t}){let e=-1,r=-1,n=Se(()=>{let o=De(),i=Fe();(e!==o||r!==i)&&(t({width:Number(i),height:Number(o)}),e=o,r=i);},200);return B("resize",n,window)}function Jt(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var Yr=["INPUT","TEXTAREA","SELECT"],Qt=new WeakMap;function jr({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,maskInputOptions:a,maskInputFn:s,sampling:l,userTriggeredOnInput:c}){function d(C){let m=Ee(C),g=C.isTrusted;if(m&&m.tagName==="OPTION"&&(m=m.parentElement),!m||!m.tagName||Yr.indexOf(m.tagName)<0||M(m,n,o,true))return;let k=m.type;if(m.classList.contains(i))return;let W=m.value,F=false;k==="radio"||k==="checkbox"?F=m.checked:(a[m.tagName.toLowerCase()]||a[k])&&(W=we({maskInputOptions:a,tagName:m.tagName,type:k,value:W,maskInputFn:s})),u(m,Jt({text:W,isChecked:F,userTriggered:g},c));let L=m.name;k==="radio"&&L&&F&&e.querySelectorAll(`input[type="radio"][name="${L}"]`).forEach(w=>{w!==m&&u(w,Jt({text:w.value,isChecked:!F,userTriggered:false},c));});}function u(C,m){let g=Qt.get(C);if(!g||g.text!==m.text||g.isChecked!==m.isChecked){Qt.set(C,m);let k=r.getId(C);t(Object.assign(Object.assign({},m),{id:k}));}}let h=(l.input==="last"?["change"]:["input","change"]).map(C=>B(C,d,e)),p=e.defaultView;if(!p)return ()=>{h.forEach(C=>C());};let I=p.Object.getOwnPropertyDescriptor(p.HTMLInputElement.prototype,"value"),S=[[p.HTMLInputElement.prototype,"value"],[p.HTMLInputElement.prototype,"checked"],[p.HTMLSelectElement.prototype,"value"],[p.HTMLTextAreaElement.prototype,"value"],[p.HTMLSelectElement.prototype,"selectedIndex"],[p.HTMLOptionElement.prototype,"selected"]];return I&&I.set&&h.push(...S.map(C=>me(C[0],C[1],{set(){d({target:this});}},false,p))),()=>{h.forEach(C=>C());}}function Ze(t){let e=[];function r(n,o){if(qt&&n.parentRule instanceof CSSGroupingRule||Xt&&n.parentRule instanceof CSSMediaRule||$t&&n.parentRule instanceof CSSSupportsRule||er&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(a);}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a);}return o}return r(t,e)}function ce(t,e,r){let n,o;return t?(t.ownerNode?n=e.getId(t.ownerNode):o=r.getId(t),{styleId:o,id:n}):{}}function Jr({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:f,styleId:h}=ce(this,e,r.styleMirror);return (f&&f!==-1||h&&h!==-1)&&t({id:f,styleId:h,adds:[{rule:d,index:u}]}),o.apply(this,[d,u])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(d){let{id:u,styleId:f}=ce(this,e,r.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,removes:[{index:d}]}),i.apply(this,[d])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=function(d){let{id:u,styleId:f}=ce(this,e,r.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,replace:d}),a.apply(this,[d])});let s;n.CSSStyleSheet.prototype.replaceSync&&(s=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=function(d){let{id:u,styleId:f}=ce(this,e,r.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,replaceSync:d}),s.apply(this,[d])});let l={};qt?l.CSSGroupingRule=n.CSSGroupingRule:(Xt&&(l.CSSMediaRule=n.CSSMediaRule),er&&(l.CSSConditionRule=n.CSSConditionRule),$t&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([d,u])=>{c[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(f,h){let{id:p,styleId:I}=ce(this.parentStyleSheet,e,r.styleMirror);return (p&&p!==-1||I&&I!==-1)&&t({id:p,styleId:I,adds:[{rule:f,index:[...Ze(this),h||0]}]}),c[d].insertRule.apply(this,[f,h])},u.prototype.deleteRule=function(f){let{id:h,styleId:p}=ce(this.parentStyleSheet,e,r.styleMirror);return (h&&h!==-1||p&&p!==-1)&&t({id:h,styleId:p,removes:[{index:[...Ze(this),f]}]}),c[d].deleteRule.apply(this,[f])};}),()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,a&&(n.CSSStyleSheet.prototype.replace=a),s&&(n.CSSStyleSheet.prototype.replaceSync=s),Object.entries(l).forEach(([d,u])=>{u.prototype.insertRule=c[d].insertRule,u.prototype.deleteRule=c[d].deleteRule;});}}function Et({mirror:t,stylesheetManager:e},r){var n,o,i;let a=null;r.nodeName==="#document"?a=t.getId(r):a=t.getId(r.host);let s=r.nodeName==="#document"?(n=r.defaultView)===null||n===void 0?void 0:n.Document:(i=(o=r.ownerDocument)===null||o===void 0?void 0:o.defaultView)===null||i===void 0?void 0:i.ShadowRoot,l=Object.getOwnPropertyDescriptor(s?.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return (c=l.get)===null||c===void 0?void 0:c.call(this)},set(c){var d;let u=(d=l.set)===null||d===void 0?void 0:d.call(this,c);if(a!==null&&a!==-1)try{e.adoptStyleSheets(c,a);}catch{}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set});})}function Qr({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=function(s,l,c){var d;if(r.has(s))return i.apply(this,[s,l,c]);let{id:u,styleId:f}=ce((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,n.styleMirror);return (u&&u!==-1||f&&f!==-1)&&t({id:u,styleId:f,set:{property:s,value:l,priority:c},index:Ze(this.parentRule)}),i.apply(this,[s,l,c])};let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=function(s){var l;if(r.has(s))return a.apply(this,[s]);let{id:c,styleId:d}=ce((l=this.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,e,n.styleMirror);return (c&&c!==-1||d&&d!==-1)&&t({id:c,styleId:d,remove:{property:s},index:Ze(this.parentRule)}),a.apply(this,[s])},()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=a;}}function qr({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:o}){let i=s=>Se(l=>{let c=Ee(l);if(!c||M(c,e,r,true))return;let{currentTime:d,volume:u,muted:f,playbackRate:h}=c;t({type:s,id:n.getId(c),currentTime:d,volume:u,muted:f,playbackRate:h});},o.media||500),a=[B("play",i(0)),B("pause",i(1)),B("seeked",i(2)),B("volumechange",i(3)),B("ratechange",i(4))];return ()=>{a.forEach(s=>s());}}function Xr({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return ()=>{};let n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(l,c,d){let u=new i(l,c,d);return o.set(u,{family:l,buffer:typeof c!="string",descriptors:d,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),u};let a=ee(e.fonts,"add",function(s){return function(l){return setTimeout(()=>{let c=o.get(l);c&&(t(c),o.delete(l));},0),s.apply(this,[l])}});return n.push(()=>{r.FontFace=i;}),n.push(a),()=>{n.forEach(s=>s());}}function $r(t){let{doc:e,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=t,a=true,s=()=>{let l=e.getSelection();if(!l||a&&l?.isCollapsed)return;a=l.isCollapsed||false;let c=[],d=l.rangeCount||0;for(let u=0;u<d;u++){let f=l.getRangeAt(u),{startContainer:h,startOffset:p,endContainer:I,endOffset:S}=f;M(h,n,o,true)||M(I,n,o,true)||c.push({start:r.getId(h),startOffset:p,end:r.getId(I),endOffset:S});}i({ranges:c});};return s(),B("selectionchange",s)}function en(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:a,inputCb:s,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:f,selectionCb:h}=t;t.mutationCb=(...p)=>{e.mutation&&e.mutation(...p),r(...p);},t.mousemoveCb=(...p)=>{e.mousemove&&e.mousemove(...p),n(...p);},t.mouseInteractionCb=(...p)=>{e.mouseInteraction&&e.mouseInteraction(...p),o(...p);},t.scrollCb=(...p)=>{e.scroll&&e.scroll(...p),i(...p);},t.viewportResizeCb=(...p)=>{e.viewportResize&&e.viewportResize(...p),a(...p);},t.inputCb=(...p)=>{e.input&&e.input(...p),s(...p);},t.mediaInteractionCb=(...p)=>{e.mediaInteaction&&e.mediaInteaction(...p),l(...p);},t.styleSheetRuleCb=(...p)=>{e.styleSheetRule&&e.styleSheetRule(...p),c(...p);},t.styleDeclarationCb=(...p)=>{e.styleDeclaration&&e.styleDeclaration(...p),d(...p);},t.canvasMutationCb=(...p)=>{e.canvasMutation&&e.canvasMutation(...p),u(...p);},t.fontCb=(...p)=>{e.font&&e.font(...p),f(...p);},t.selectionCb=(...p)=>{e.selection&&e.selection(...p),h(...p);};}function tr(t,e={}){let r=t.doc.defaultView;if(!r)return ()=>{};en(t,e);let n=kt(t,t.doc),o=Pr(t),i=Kr(t),a=wt(t),s=zr(t),l=jr(t),c=qr(t),d=Jr(t,{win:r}),u=Et(t,t.doc),f=Qr(t,{win:r}),h=t.collectFonts?Xr(t):()=>{},p=$r(t),I=[];for(let S of t.plugins)I.push(S.observer(S.callback,r,S.options));return ()=>{de.forEach(S=>S.reset()),n.disconnect(),o(),i(),a(),s(),l(),c(),d(),u(),f(),h(),p(),I.forEach(S=>S());}}var Te=class{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;}getId(e,r,n,o){let i=n||this.getIdToRemoteIdMap(e),a=o||this.getRemoteIdToIdMap(e),s=i.get(r);return s||(s=this.generateIdFn(),i.set(r,s),a.set(s,r)),s}getIds(e,r){let n=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return r.map(i=>this.getId(e,i,n,o))}getRemoteId(e,r,n){let o=n||this.getRemoteIdToIdMap(e);if(typeof r!="number")return r;let i=o.get(r);return i||-1}getRemoteIds(e,r){let n=this.getRemoteIdToIdMap(e);return r.map(o=>this.getRemoteId(e,o,n))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e);}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}};var _e=class{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Te(gt),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Te(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this));}addIframe(e){this.iframes.set(e,true),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e);}addLoadListener(e){this.loadListener=e;}attachIframe(e,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:true}),(n=this.loadListener)===null||n===void 0||n.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument));}handleMessage(e){if(e.data.type==="rrweb"){if(!e.source)return;let n=this.crossOriginIframeMap.get(e.source);if(!n)return;let o=this.transformCrossOriginEvent(n,e.data.event);o&&this.wrappedEmit(o,e.data.isCheckout);}}transformCrossOriginEvent(e,r){var n;switch(r.type){case b.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e),{timestamp:r.timestamp,type:b.IncrementalSnapshot,data:{source:y.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:true}};case b.Meta:case b.Load:case b.DomContentLoaded:return false;case b.Plugin:return r;case b.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case b.IncrementalSnapshot:switch(r.data.source){case y.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,e);}),r.data.removes.forEach(o=>{this.replaceIds(o,e,["parentId","id"]);}),r.data.attributes.forEach(o=>{this.replaceIds(o,e,["id"]);}),r.data.texts.forEach(o=>{this.replaceIds(o,e,["id"]);}),r;case y.Drag:case y.TouchMove:case y.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,e,["id"]);}),r;case y.ViewportResize:return false;case y.MediaInteraction:case y.MouseInteraction:case y.Scroll:case y.CanvasMutation:case y.Input:return this.replaceIds(r.data,e,["id"]),r;case y.StyleSheetRule:case y.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case y.Font:return r;case y.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"]);}),r;case y.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),(n=r.data.styles)===null||n===void 0||n.forEach(o=>{this.replaceStyleIds(o,e,["styleId"]);}),r}}}replace(e,r,n,o){for(let i of o)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=e.getIds(n,r[i]):r[i]=e.getId(n,r[i]));return r}replaceIds(e,r,n){return this.replace(this.crossOriginIframeMirror,e,r,n)}replaceStyleIds(e,r,n){return this.replace(this.crossOriginIframeStyleMirror,e,r,n)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id"]),"childNodes"in e&&e.childNodes.forEach(n=>{this.replaceIdOnNode(n,r);});}};var He=class{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;let r=this;this.restorePatches.push(ee(Element.prototype,"attachShadow",function(n){return function(o){let i=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,this.ownerDocument),i}}));}addShadowRoot(e,r){pe(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),kt(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),wt(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),Et({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e);},0)));}observeAttachShadow(e){if(e.contentWindow){let r=this;this.restorePatches.push(ee(e.contentWindow.HTMLElement.prototype,"attachShadow",function(n){return function(o){let i=n.call(this,o);return this.shadowRoot&&r.addShadowRoot(this.shadowRoot,e.contentDocument),i}}));}}reset(){this.restorePatches.forEach(e=>e()),this.shadowDoms=new WeakSet;}};function rr(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]]);return r}function nr(t,e,r,n){function o(i){return i instanceof r?i:new r(function(a){a(i);})}return new(r||(r=Promise))(function(i,a){function s(d){try{c(n.next(d));}catch(u){a(u);}}function l(d){try{c(n.throw(d));}catch(u){a(u);}}function c(d){d.done?i(d.value):o(d.value).then(s,l);}c((n=n.apply(t,[])).next());})}var be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Me=0;Me<be.length;Me++)tn[be.charCodeAt(Me)]=Me;var Me,or=function(t){var e=new Uint8Array(t),r,n=e.length,o="";for(r=0;r<n;r+=3)o+=be[e[r]>>2],o+=be[(e[r]&3)<<4|e[r+1]>>4],o+=be[(e[r+1]&15)<<2|e[r+2]>>6],o+=be[e[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};var ir=new Map;function rn(t,e){let r=ir.get(t);return r||(r=new Map,ir.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Tt=(t,e,r)=>{if(!t||!(sr(t,e)||typeof t=="object"))return;let n=t.constructor.name,o=rn(r,n),i=o.indexOf(t);return i===-1&&(i=o.length,o.push(t)),i};function Pe(t,e,r){if(t instanceof Array)return t.map(n=>Pe(n,e,r));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return {rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let n=t.constructor.name,o=or(t);return {rr_type:n,base64:o}}else {if(t instanceof DataView)return {rr_type:t.constructor.name,args:[Pe(t.buffer,e,r),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let n=t.constructor.name,{src:o}=t;return {rr_type:n,src:o}}else if(t instanceof HTMLCanvasElement){let n="HTMLImageElement",o=t.toDataURL();return {rr_type:n,src:o}}else {if(t instanceof ImageData)return {rr_type:t.constructor.name,args:[Pe(t.data,e,r),t.width,t.height]};if(sr(t,e)||typeof t=="object"){let n=t.constructor.name,o=Tt(t,e,r);return {rr_type:n,index:o}}}}return t}var Ke=(t,e,r)=>[...t].map(n=>Pe(n,e,r)),sr=(t,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof e[o]=="function").find(o=>t instanceof e[o]);function ar(t,e,r,n){let o=[],i=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let a of i)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;let s=ee(e.CanvasRenderingContext2D.prototype,a,function(l){return function(...c){return M(this.canvas,r,n,!0)||setTimeout(()=>{let d=Ke([...c],e,this);t(this.canvas,{type:se["2D"],property:a,args:d});},0),l.apply(this,c)}});o.push(s);}catch{let l=me(e.CanvasRenderingContext2D.prototype,a,{set(c){t(this.canvas,{type:se["2D"],property:a,args:[c],setter:true});}});o.push(l);}return ()=>{o.forEach(a=>a());}}function Mt(t,e,r){let n=[];try{let o=ee(t.HTMLCanvasElement.prototype,"getContext",function(i){return function(a,...s){return M(this,e,r,!0)||"__context"in this||(this.__context=a),i.apply(this,[a,...s])}});n.push(o);}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext");}return ()=>{n.forEach(o=>o());}}function lr(t,e,r,n,o,i,a){let s=[],l=Object.getOwnPropertyNames(t);for(let c of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof t[c]!="function")continue;let d=ee(t,c,function(u){return function(...f){let h=u.apply(this,f);if(Tt(h,a,this),!M(this.canvas,n,o,!0)){let p=Ke([...f],a,this),I={type:e,property:c,args:p};r(this.canvas,I);}return h}});s.push(d);}catch{let u=me(t,c,{set(f){r(this.canvas,{type:e,property:c,args:[f],setter:true});}});s.push(u);}return s}function cr(t,e,r,n,o){let i=[];return i.push(...lr(e.WebGLRenderingContext.prototype,se.WebGL,t,r,n,o,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...lr(e.WebGL2RenderingContext.prototype,se.WebGL2,t,r,n,o,e)),()=>{i.forEach(a=>a());}}var Rt=null;try{dr=typeof module<"u"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof ft=="function"&&ft("worker_threads"),Rt=dr.Worker;}catch{}var dr;function nn(t,e){return Buffer.from(t,"base64").toString("utf8")}function ur(t,e,r){var i=nn(t),a=i.indexOf(`
|
|
4
4
|
`,10)+1,s=i.substring(a)+("");return function(c){return new Rt(s,Object.assign({},c,{eval:true}))}}function on(t,e){var r=atob(t);return r}function sn(t,e,r){var i=on(t),a=i.indexOf(`
|
|
5
|
-
`,10)+1,s=i.substring(a)+(""),l=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(l)}function pr(t,e,r){var n;return function(i){return n=n||sn(t),new Worker(n,i)}}var an=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";function fr(){return an}function hr(t,e,r){return fr()?ur(t):pr(t)}var mr=hr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCi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gICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");var Ke=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=false,this.locked=false,this.processMutation=(l,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(c);};let{sampling:r="all",win:n,blockClass:o,blockSelector:i,recordCanvas:a,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,o,i),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,i,{dataURLOptions:s});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(e,r,n,o,i){let a=Mt(r,n,o),s=new Map,l=new mr;l.onmessage=p=>{let{id:I}=p.data;if(s.set(I,false),!("base64"in p.data))return;let{base64:S,type:C,width:m,height:g}=p.data;this.mutationCb({id:I,type:se["2D"],commands:[{property:"clearRect",args:[0,0,m,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:C}]},0,0]}]});};let c=1e3/e,d=0,u,f=()=>{let p=[];return r.document.querySelectorAll("canvas").forEach(I=>{M(I,n,o,true)||p.push(I);}),p},h=p=>{if(d&&p-d<c){u=requestAnimationFrame(h);return}d=p,f().forEach(I=>nr(this,void 0,void 0,function*(){var S;let C=this.mirror.getId(I);if(s.get(C))return;if(s.set(C,true),["webgl","webgl2"].includes(I.__context)){let g=I.getContext(I.__context);((S=g?.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===false&&g?.clear(g.COLOR_BUFFER_BIT);}let m=yield createImageBitmap(I);l.postMessage({id:C,bitmap:m,width:I.width,height:I.height,dataURLOptions:i.dataURLOptions},[m]);})),u=requestAnimationFrame(h);};u=requestAnimationFrame(h),this.resetObservers=()=>{a(),cancelAnimationFrame(u);};}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Mt(e,r,n),i=ar(this.processMutation.bind(this),e,r,n),a=cr(this.processMutation.bind(this),e,r,n,this.mirror);this.resetObservers=()=>{o(),i(),a();};}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations());}startRAFTimestamping(){let e=r=>{this.rafStamps.latestId=r,requestAnimationFrame(e);};requestAnimationFrame(e);}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n);}),requestAnimationFrame(()=>this.flushPendingCanvasMutations());}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||r===-1)return;let o=n.map(a=>rr(a,["type"])),{type:i}=n[0];this.mutationCb({id:r,type:i,commands:o}),this.pendingCanvasMutations.delete(e);}};var Ye=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Oe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb;}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e);}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e));}adoptStyleSheets(e,r){if(e.length===0)return;let n={id:r,styleIds:[]},o=[];for(let i of e){let a;if(this.styleMirror.has(i))a=this.styleMirror.getId(i);else {a=this.styleMirror.add(i);let s=Array.from(i.rules||CSSRule);o.push({styleId:a,rules:s.map((l,c)=>({rule:mt(l),index:c}))});}n.styleIds.push(a);}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(e){}};function O(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var R,je,Nt,Je=false,te=Wt();function ge(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:a="rr-ignore",maskTextClass:s="rr-mask",maskTextSelector:l=null,inlineStylesheet:c=true,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:f,maskInputFn:h,maskTextFn:p,hooks:I,packFn:S,sampling:C={},dataURLOptions:m={},mousemoveWait:g,recordCanvas:k=false,recordCrossOriginIframes:W=false,userTriggeredOnInput:F=false,collectFonts:L=false,inlineImages:w=false,plugins:P,keepIframeSrcFn:z=()=>false,ignoreCSSAttributes:J=new Set([])}=t,Q=W?window.parent===window:true,q=false;if(!Q)try{window.parent.document,q=!1;}catch{q=true;}if(Q&&!e)throw new Error("emit function is required");g!==void 0&&C.mousemove===void 0&&(C.mousemove=g),te.reset();let x=d===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:u!==void 0?u:{password:true},K=f===true||f==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all"}:f||{};Ht();let X,ne=0,ie=v=>{for(let U of P||[])U.eventProcessor&&(v=U.eventProcessor(v));return S&&(v=S(v)),v};R=(v,U)=>{var H;if(!((H=de[0])===null||H===void 0)&&H.isFrozen()&&v.type!==b.FullSnapshot&&!(v.type===b.IncrementalSnapshot&&v.data.source===y.Mutation)&&de.forEach(T=>T.unfreeze()),Q)e?.(ie(v),U);else if(q){let T={type:"rrweb",event:ie(v),isCheckout:U};window.parent.postMessage(T,"*");}if(v.type===b.FullSnapshot)X=v,ne=0;else if(v.type===b.IncrementalSnapshot){if(v.data.source===y.Mutation&&v.data.isAttachIframe)return;ne++;let T=n&&ne>=n,j=r&&v.timestamp-X.timestamp>r;(T||j)&&je(true);}};let Z=v=>{R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Mutation},v)}));},Y=v=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Scroll},v)})),le=v=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.CanvasMutation},v)})),N=v=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.AdoptedStyleSheet},v)})),$=new Ye({mutationCb:Z,adoptedStyleSheetCb:N}),oe=new He({mirror:te,mutationCb:Z,stylesheetManager:$,recordCrossOriginIframes:W,wrappedEmit:R});for(let v of P||[])v.getMirror&&v.getMirror({nodeMirror:te,crossOriginIframeMirror:oe.crossOriginIframeMirror,crossOriginIframeStyleMirror:oe.crossOriginIframeStyleMirror});Nt=new Ke({recordCanvas:k,mutationCb:le,win:window,blockClass:o,blockSelector:i,mirror:te,sampling:C.canvas,dataURLOptions:m});let Ie=new _e({mutationCb:Z,scrollCb:Y,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:l,inlineStylesheet:c,maskInputOptions:x,dataURLOptions:m,maskTextFn:p,maskInputFn:h,recordCanvas:k,inlineImages:w,sampling:C,slimDOMOptions:K,iframeManager:oe,stylesheetManager:$,canvasManager:Nt,keepIframeSrcFn:z},mirror:te});je=(v=false)=>{var U,H,T,j,A,_;R(O({type:b.Meta,data:{href:window.location.href,width:Fe(),height:De()}}),v),$.reset(),de.forEach(V=>V.lock());let Ae=Ut(document,{mirror:te,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:l,inlineStylesheet:c,maskAllInputs:x,maskTextFn:p,slimDOM:K,dataURLOptions:m,recordCanvas:k,inlineImages:w,onSerialize:V=>{Be(V,te)&&oe.addIframe(V),Ge(V,te)&&$.trackLinkElement(V),We(V)&&Ie.addShadowRoot(V.shadowRoot,document);},onIframeLoad:(V,pt)=>{oe.attachIframe(V,pt),Ie.observeAttachShadow(V);},onStylesheetLoad:(V,pt)=>{$.attachLinkElement(V,pt);},keepIframeSrcFn:z});if(!Ae)return console.warn("Failed to snapshot the document");R(O({type:b.FullSnapshot,data:{node:Ae,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:document?.documentElement.scrollLeft||((H=(U=document?.body)===null||U===void 0?void 0:U.parentElement)===null||H===void 0?void 0:H.scrollLeft)||((T=document?.body)===null||T===void 0?void 0:T.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:document?.documentElement.scrollTop||((A=(j=document?.body)===null||j===void 0?void 0:j.parentElement)===null||A===void 0?void 0:A.scrollTop)||((_=document?.body)===null||_===void 0?void 0:_.scrollTop)||0}}})),de.forEach(V=>V.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document));};try{let v=[];v.push(B("DOMContentLoaded",()=>{R(O({type:b.DomContentLoaded,data:{}}));}));let U=T=>{var j;return tr({mutationCb:Z,mousemoveCb:(A,_)=>R(O({type:b.IncrementalSnapshot,data:{source:_,positions:A}})),mouseInteractionCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.MouseInteraction},A)})),scrollCb:Y,viewportResizeCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.ViewportResize},A)})),inputCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Input},A)})),mediaInteractionCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.MediaInteraction},A)})),styleSheetRuleCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.StyleSheetRule},A)})),styleDeclarationCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.StyleDeclaration},A)})),canvasMutationCb:le,fontCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Font},A)})),selectionCb:A=>{R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Selection},A)}));},blockClass:o,ignoreClass:a,maskTextClass:s,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:c,sampling:C,recordCanvas:k,inlineImages:w,userTriggeredOnInput:F,collectFonts:L,doc:T,maskInputFn:h,maskTextFn:p,keepIframeSrcFn:z,blockSelector:i,slimDOMOptions:K,dataURLOptions:m,mirror:te,iframeManager:oe,stylesheetManager:$,shadowDomManager:Ie,canvasManager:Nt,ignoreCSSAttributes:J,plugins:((j=P?.filter(A=>A.observer))===null||j===void 0?void 0:j.map(A=>({observer:A.observer,options:A.options,callback:_=>R(O({type:b.Plugin,data:{plugin:A.name,payload:_}}))})))||[]},I)};oe.addLoadListener(T=>{v.push(U(T.contentDocument));});let H=()=>{je(),v.push(U(document)),Je=!0;};return document.readyState==="interactive"||document.readyState==="complete"?H():v.push(B("load",()=>{R(O({type:b.Load,data:{}})),H();},window)),()=>{v.forEach(T=>T()),Je=!1;}}catch(v){console.warn(v);}}ge.addCustomEvent=(t,e)=>{if(!Je)throw new Error("please add custom event after start recording");R(O({type:b.Custom,data:{tag:t,payload:e}}));};ge.freezePage=()=>{de.forEach(t=>t.freeze());};ge.takeFullSnapshot=t=>{if(!Je)throw new Error("please take full snapshot after start recording");je(t);};ge.mirror=te;var Qe=class{constructor(e,r,n){this.sessionId=e;this.emit=r;this.rrwebConfig=n;this.stopFn=null;}start(){this.stopFn=ge({...this.rrwebConfig,emit:e=>{this.emit({type:"rrweb",timestamp:e.timestamp,sessionId:this.sessionId,data:e});}})??null;}stop(){this.stopFn&&(this.stopFn(),this.stopFn=null);}};var qe=class{constructor(e,r){this.sessionId=e;this.emit=r;this.onErrorHandler=null;this.onRejectionHandler=null;this.previousOnError=null;}start(){this.previousOnError=window.onerror,this.onErrorHandler=(e,r,n,o,i)=>{let a={message:String(e),stack:i?.stack,source:r??void 0,lineno:n??void 0,colno:o??void 0,type:"onerror"};return this.emit({type:"error",timestamp:Date.now(),sessionId:this.sessionId,data:a}),this.previousOnError?this.previousOnError.call(window,e,r,n,o,i):false},this.onRejectionHandler=e=>{let r=e.reason,n={message:r instanceof Error?r.message:String(r),stack:r instanceof Error?r.stack:void 0,type:"unhandledrejection"};this.emit({type:"error",timestamp:Date.now(),sessionId:this.sessionId,data:n});},window.onerror=this.onErrorHandler,window.addEventListener("unhandledrejection",this.onRejectionHandler);}stop(){this.previousOnError?window.onerror=this.previousOnError:window.onerror=null,this.onRejectionHandler&&window.removeEventListener("unhandledrejection",this.onRejectionHandler),this.onErrorHandler=null,this.onRejectionHandler=null;}};var ln=/ghostplay\.dev/,Xe=class{constructor(e,r){this.sessionId=e;this.emit=r;this.originalFetch=null;this.active=false;}start(){this.active=true,this.patchFetch();}stop(){this.active=false,this.restoreFetch();}patchFetch(){this.originalFetch=globalThis.fetch;let e=this;globalThis.fetch=async function(r,n){let o=typeof r=="string"?r:r instanceof URL?r.toString():r.url,i=n?.method??"GET";if(ln.test(o))return e.originalFetch.call(globalThis,r,n);let a=Date.now();try{let s=await e.originalFetch.call(globalThis,r,n);if(e.active){let l={method:i.toUpperCase(),url:o,status:s.status,statusText:s.statusText,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:l});}return s}catch(s){if(e.active){let l={method:i.toUpperCase(),url:o,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:l});}throw s}};}restoreFetch(){this.originalFetch&&(globalThis.fetch=this.originalFetch,this.originalFetch=null);}};var gr=["log","warn","error","info","debug"],$e=class{constructor(e,r){this.sessionId=e;this.emit=r;this.originals={};}start(){for(let e of gr)this.originals[e]=console[e].bind(console),console[e]=(...r)=>{let n={level:e,args:r.map(o=>this.serialize(o))};this.emit({type:"console",timestamp:Date.now(),sessionId:this.sessionId,data:n}),this.originals[e]?.(...r);};}stop(){for(let e of gr)this.originals[e]&&(console[e]=this.originals[e]);this.originals={};}serialize(e){if(e instanceof Error)return {__type:"Error",message:e.message,stack:e.stack};if(typeof e=="object"&&e!==null)try{return JSON.stringify(e),e}catch{return String(e)}return e}};var cn={LCP:[1e3,4e3],FID:[100,300],CLS:[.1,.25],TTFB:[800,1800],INP:[200,500]},et=class{constructor(e,r){this.sessionId=e;this.emit=r;this.observers=[];}start(){typeof PerformanceObserver>"u"||(this.observeLCP(),this.observeFID(),this.observeCLS(),this.observeTTFB(),this.observeINP());}stop(){this.observers.forEach(e=>e.disconnect()),this.observers=[];}handleMetric(e,r){let[n,o]=cn[e],i=r<=n?"good":r<=o?"needs-improvement":"poor";this.emit({type:"performance",timestamp:Date.now(),sessionId:this.sessionId,data:{metric:e,value:r,rating:i}});}observeLCP(){try{let e=new PerformanceObserver(r=>{let n=r.getEntries(),o=n[n.length-1];o&&this.handleMetric("LCP",o.startTime);});e.observe({type:"largest-contentful-paint",buffered:!0}),this.observers.push(e);}catch{}}observeFID(){try{let e=new PerformanceObserver(r=>{let o=r.getEntries()[0];o&&this.handleMetric("FID",o.processingStart-o.startTime);});e.observe({type:"first-input",buffered:!0}),this.observers.push(e);}catch{}}observeCLS(){let e=0;try{let r=new PerformanceObserver(n=>{for(let o of n.getEntries())o.hadRecentInput||(e+=o.value);this.handleMetric("CLS",e);});r.observe({type:"layout-shift",buffered:!0}),this.observers.push(r);}catch{}}observeTTFB(){try{let e=new PerformanceObserver(r=>{let n=r.getEntries()[0];n&&this.handleMetric("TTFB",n.responseStart);});e.observe({type:"navigation",buffered:!0}),this.observers.push(e);}catch{}}observeINP(){try{let e=new PerformanceObserver(r=>{for(let n of r.getEntries())this.handleMetric("INP",n.duration);});e.observe({type:"event",buffered:!0}),this.observers.push(e);}catch{}}};var tt=class{constructor(e,r){this.sessionId=e;this.emit=r;this.clickHandler=null;this.recentClicks=[];}start(){this.clickHandler=e=>{let r=e.target;if(!r)return;let n=Date.now(),o=this.recentClicks.find(i=>i.element===r);if(o||(o={element:r,timestamps:[]},this.recentClicks.push(o)),o.timestamps.push(n),o.timestamps=o.timestamps.filter(i=>n-i<1e3),o.timestamps.length>=3){let i={selector:this.getSelector(r),clickCount:o.timestamps.length,x:e.clientX,y:e.clientY};this.emit({type:"rage-click",timestamp:n,sessionId:this.sessionId,data:i}),o.timestamps=[];}this.recentClicks=this.recentClicks.filter(i=>i.timestamps.length>0);},document.addEventListener("click",this.clickHandler,true);}stop(){this.clickHandler&&(document.removeEventListener("click",this.clickHandler,true),this.clickHandler=null),this.recentClicks=[];}getSelector(e){if(e.id)return `#${e.id}`;let r=e.getAttribute("data-testid");if(r)return `[data-testid="${r}"]`;let n=e.tagName.toLowerCase(),o=e.className?`.${e.className.split(" ").filter(Boolean).join(".")}`:"";return `${n}${o}`}};var rt=class{constructor(e=50){this.maxSize=e;this.trail=[];}add(e,r,n){let o={category:e,message:r};n&&(o.data=n),this.trail.push(o),this.trail.length>this.maxSize&&(this.trail=this.trail.slice(-this.maxSize));}getTrail(){return [...this.trail]}clear(){this.trail=[];}};var dn=["password"],un=["email","tel"],pn=["set-cookie"],nt=class{constructor(e){this.options=e;}shouldBlockElement(e){return this.options.blockSelector?e.matches(this.options.blockSelector):false}shouldIgnoreElement(e){return this.options.ignoreSelector?e.matches(this.options.ignoreSelector):false}shouldMaskInput(e){let r=e.type.toLowerCase();return !!(dn.includes(r)||un.includes(r)||this.options.maskAllInputs||this.options.maskInputSelector&&e.matches(this.options.maskInputSelector))}sanitizeNetworkEvent(e){let r={...e},n=this.options.networkSanitize;return r.responseHeaders&&(r.responseHeaders=this.filterHeaders(r.responseHeaders,pn)),n&&(r.requestHeaders&&n.denyHeaders.length>0&&(r.requestHeaders=this.filterHeaders(r.requestHeaders,n.denyHeaders)),r.responseHeaders&&n.denyHeaders.length>0&&(r.responseHeaders=this.filterHeaders(r.responseHeaders,n.denyHeaders)),n.denyBodyUrls.length>0&&this.urlMatchesDeny(e.url,n.denyBodyUrls)&&(r.requestBody&&(r.requestBody="[REDACTED]"),r.responseBody&&(r.responseBody="[REDACTED]"))),r}filterHeaders(e,r){let n=r.map(i=>i.toLowerCase()),o={};for(let[i,a]of Object.entries(e))n.includes(i.toLowerCase())||(o[i]=a);return o}urlMatchesDeny(e,r){return r.some(n=>new RegExp("^"+n.replace(/\*/g,".*")+"$").test(e))}};var ot=class{constructor(e){this.config=e;this.buffer=[];this.bufferBytes=0;this.flushTimer=null;}start(){this.flushTimer=setInterval(()=>{this.flush();},this.config.flushIntervalMs);}stop(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush();}send(e){let r=JSON.stringify(e).length;this.buffer.push(e),this.bufferBytes+=r,this.bufferBytes>=this.config.flushMaxBytes&&this.flush();}flush(){if(this.buffer.length===0)return;let e=this.buffer;this.buffer=[],this.bufferBytes=0;let r={projectId:this.config.projectId,sessionId:this.config.sessionId,events:e,sentAt:Date.now()},n=JSON.stringify(r),o=`${this.config.apiUrl}/events`;try{fetch(o,{method:"POST",headers:{"Content-Type":"application/json","x-project-id":this.config.projectId},body:n,keepalive:!0}).catch(()=>{});}catch{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(o,new Blob([n],{type:"application/json"}));}}};var fn="0.1.0",G=null,re=null,it=null,st=null,at=null,lt=null,ct=null,dt=null,ut=null,xt=null,Re=null;function Ot(){if(!re)throw new Error("[Ghostplay] SDK not initialized. Call Ghostplay.init() first.")}function ae(t){ut&&t.type!=="rrweb"&&ut.add(t.type==="error"?"error":t.type==="network"?"network":t.type==="rage-click"?"click":"custom",`${t.type}: ${JSON.stringify(t.data).substring(0,100)}`),Re?.send(t);}function hn(t){Ir(),G=Ft(t),re=new Ne(G.projectId);let e=re.start();xt=new nt({maskAllInputs:G.maskAllInputs,maskInputSelector:G.maskInputSelector,blockSelector:G.blockSelector,ignoreSelector:G.ignoreSelector,networkSanitize:G.networkSanitize}),Re=new ot({apiUrl:G.apiUrl,projectId:G.projectId,sessionId:e.id,flushIntervalMs:G.flushIntervalMs,flushMaxBytes:G.flushMaxBytes}),Re.start(),ut=new rt,it=new Qe(e.id,ae,G.rrwebConfig),it.start(),st=new qe(e.id,ae),st.start(),G.recordNetwork&&(at=new Xe(e.id,r=>{let n=xt.sanitizeNetworkEvent(r.data);ae({...r,data:n});}),at.start()),G.recordConsole&&(lt=new $e(e.id,ae),lt.start()),G.trackPerformance&&(ct=new et(e.id,ae),ct.start()),G.trackRageClicks&&(dt=new tt(e.id,ae),dt.start());}function mn(t,e){Ot(),re.identify(t,e),ae({type:"identify",timestamp:Date.now(),sessionId:re.current().id,data:{userId:t,traits:e}});}function gn(t){Ot(),re.addTag(t),ae({type:"tag",timestamp:Date.now(),sessionId:re.current().id,data:{tag:t}});}function In(t){Ot(),re.setMetadata(t),ae({type:"metadata",timestamp:Date.now(),sessionId:re.current().id,data:t});}function Ir(){it?.stop(),st?.stop(),at?.stop(),lt?.stop(),ct?.stop(),dt?.stop(),Re?.stop(),re?.end(),it=null,st=null,at=null,lt=null,ct=null,dt=null,Re=null,re=null,ut=null,xt=null,G=null;}var vn={VERSION:fn,init:hn,identify:mn,tag:gn,setMetadata:In,stop:Ir},li=vn;/*! Bundled license information:
|
|
5
|
+
`,10)+1,s=i.substring(a)+(""),l=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(l)}function pr(t,e,r){var n;return function(i){return n=n||sn(t),new Worker(n,i)}}var an=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";function fr(){return an}function hr(t,e,r){return fr()?ur(t):p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gIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");var ze=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=false,this.locked=false,this.processMutation=(l,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(c);};let{sampling:r="all",win:n,blockClass:o,blockSelector:i,recordCanvas:a,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,o,i),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,i,{dataURLOptions:s});}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers();}freeze(){this.frozen=true;}unfreeze(){this.frozen=false;}lock(){this.locked=true;}unlock(){this.locked=false;}initCanvasFPSObserver(e,r,n,o,i){let a=Mt(r,n,o),s=new Map,l=new mr;l.onmessage=p=>{let{id:I}=p.data;if(s.set(I,false),!("base64"in p.data))return;let{base64:S,type:C,width:m,height:g}=p.data;this.mutationCb({id:I,type:se["2D"],commands:[{property:"clearRect",args:[0,0,m,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:C}]},0,0]}]});};let c=1e3/e,d=0,u,f=()=>{let p=[];return r.document.querySelectorAll("canvas").forEach(I=>{M(I,n,o,true)||p.push(I);}),p},h=p=>{if(d&&p-d<c){u=requestAnimationFrame(h);return}d=p,f().forEach(I=>nr(this,void 0,void 0,function*(){var S;let C=this.mirror.getId(I);if(s.get(C))return;if(s.set(C,true),["webgl","webgl2"].includes(I.__context)){let g=I.getContext(I.__context);((S=g?.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===false&&g?.clear(g.COLOR_BUFFER_BIT);}let m=yield createImageBitmap(I);l.postMessage({id:C,bitmap:m,width:I.width,height:I.height,dataURLOptions:i.dataURLOptions},[m]);})),u=requestAnimationFrame(h);};u=requestAnimationFrame(h),this.resetObservers=()=>{a(),cancelAnimationFrame(u);};}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Mt(e,r,n),i=ar(this.processMutation.bind(this),e,r,n),a=cr(this.processMutation.bind(this),e,r,n,this.mirror);this.resetObservers=()=>{o(),i(),a();};}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations());}startRAFTimestamping(){let e=r=>{this.rafStamps.latestId=r,requestAnimationFrame(e);};requestAnimationFrame(e);}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n);}),requestAnimationFrame(()=>this.flushPendingCanvasMutations());}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(e);if(!n||r===-1)return;let o=n.map(a=>rr(a,["type"])),{type:i}=n[0];this.mutationCb({id:r,type:i,commands:o}),this.pendingCanvasMutations.delete(e);}};var Ye=class{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new Oe,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb;}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e);}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e));}adoptStyleSheets(e,r){if(e.length===0)return;let n={id:r,styleIds:[]},o=[];for(let i of e){let a;if(this.styleMirror.has(i))a=this.styleMirror.getId(i);else {a=this.styleMirror.add(i);let s=Array.from(i.rules||CSSRule);o.push({styleId:a,rules:s.map((l,c)=>({rule:mt(l),index:c}))});}n.styleIds.push(a);}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(e){}};function O(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var R,je,Nt,Je=false,te=Wt();function ge(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:a="rr-ignore",maskTextClass:s="rr-mask",maskTextSelector:l=null,inlineStylesheet:c=true,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:f,maskInputFn:h,maskTextFn:p,hooks:I,packFn:S,sampling:C={},dataURLOptions:m={},mousemoveWait:g,recordCanvas:k=false,recordCrossOriginIframes:W=false,userTriggeredOnInput:F=false,collectFonts:L=false,inlineImages:w=false,plugins:P,keepIframeSrcFn:K=()=>false,ignoreCSSAttributes:J=new Set([])}=t,Q=W?window.parent===window:true,q=false;if(!Q)try{window.parent.document,q=!1;}catch{q=true;}if(Q&&!e)throw new Error("emit function is required");g!==void 0&&C.mousemove===void 0&&(C.mousemove=g),te.reset();let x=d===true?{color:true,date:true,"datetime-local":true,email:true,month:true,number:true,range:true,search:true,tel:true,text:true,time:true,url:true,week:true,textarea:true,select:true,password:true}:u!==void 0?u:{password:true},z=f===true||f==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all"}:f||{};_t();let X,ne=0,ie=v=>{for(let U of P||[])U.eventProcessor&&(v=U.eventProcessor(v));return S&&(v=S(v)),v};R=(v,U)=>{var _;if(!((_=de[0])===null||_===void 0)&&_.isFrozen()&&v.type!==b.FullSnapshot&&!(v.type===b.IncrementalSnapshot&&v.data.source===y.Mutation)&&de.forEach(T=>T.unfreeze()),Q)e?.(ie(v),U);else if(q){let T={type:"rrweb",event:ie(v),isCheckout:U};window.parent.postMessage(T,"*");}if(v.type===b.FullSnapshot)X=v,ne=0;else if(v.type===b.IncrementalSnapshot){if(v.data.source===y.Mutation&&v.data.isAttachIframe)return;ne++;let T=n&&ne>=n,j=r&&v.timestamp-X.timestamp>r;(T||j)&&je(true);}};let Z=v=>{R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Mutation},v)}));},Y=v=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Scroll},v)})),le=v=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.CanvasMutation},v)})),N=v=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.AdoptedStyleSheet},v)})),$=new Ye({mutationCb:Z,adoptedStyleSheetCb:N}),oe=new _e({mirror:te,mutationCb:Z,stylesheetManager:$,recordCrossOriginIframes:W,wrappedEmit:R});for(let v of P||[])v.getMirror&&v.getMirror({nodeMirror:te,crossOriginIframeMirror:oe.crossOriginIframeMirror,crossOriginIframeStyleMirror:oe.crossOriginIframeStyleMirror});Nt=new ze({recordCanvas:k,mutationCb:le,win:window,blockClass:o,blockSelector:i,mirror:te,sampling:C.canvas,dataURLOptions:m});let Ie=new He({mutationCb:Z,scrollCb:Y,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:l,inlineStylesheet:c,maskInputOptions:x,dataURLOptions:m,maskTextFn:p,maskInputFn:h,recordCanvas:k,inlineImages:w,sampling:C,slimDOMOptions:z,iframeManager:oe,stylesheetManager:$,canvasManager:Nt,keepIframeSrcFn:K},mirror:te});je=(v=false)=>{var U,_,T,j,A,H;R(O({type:b.Meta,data:{href:window.location.href,width:Fe(),height:De()}}),v),$.reset(),de.forEach(V=>V.lock());let Ae=Ut(document,{mirror:te,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:l,inlineStylesheet:c,maskAllInputs:x,maskTextFn:p,slimDOM:z,dataURLOptions:m,recordCanvas:k,inlineImages:w,onSerialize:V=>{Be(V,te)&&oe.addIframe(V),Ge(V,te)&&$.trackLinkElement(V),We(V)&&Ie.addShadowRoot(V.shadowRoot,document);},onIframeLoad:(V,pt)=>{oe.attachIframe(V,pt),Ie.observeAttachShadow(V);},onStylesheetLoad:(V,pt)=>{$.attachLinkElement(V,pt);},keepIframeSrcFn:K});if(!Ae)return console.warn("Failed to snapshot the document");R(O({type:b.FullSnapshot,data:{node:Ae,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:document?.documentElement.scrollLeft||((_=(U=document?.body)===null||U===void 0?void 0:U.parentElement)===null||_===void 0?void 0:_.scrollLeft)||((T=document?.body)===null||T===void 0?void 0:T.scrollLeft)||0,top:window.pageYOffset!==void 0?window.pageYOffset:document?.documentElement.scrollTop||((A=(j=document?.body)===null||j===void 0?void 0:j.parentElement)===null||A===void 0?void 0:A.scrollTop)||((H=document?.body)===null||H===void 0?void 0:H.scrollTop)||0}}})),de.forEach(V=>V.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document));};try{let v=[];v.push(B("DOMContentLoaded",()=>{R(O({type:b.DomContentLoaded,data:{}}));}));let U=T=>{var j;return tr({mutationCb:Z,mousemoveCb:(A,H)=>R(O({type:b.IncrementalSnapshot,data:{source:H,positions:A}})),mouseInteractionCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.MouseInteraction},A)})),scrollCb:Y,viewportResizeCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.ViewportResize},A)})),inputCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Input},A)})),mediaInteractionCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.MediaInteraction},A)})),styleSheetRuleCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.StyleSheetRule},A)})),styleDeclarationCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.StyleDeclaration},A)})),canvasMutationCb:le,fontCb:A=>R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Font},A)})),selectionCb:A=>{R(O({type:b.IncrementalSnapshot,data:Object.assign({source:y.Selection},A)}));},blockClass:o,ignoreClass:a,maskTextClass:s,maskTextSelector:l,maskInputOptions:x,inlineStylesheet:c,sampling:C,recordCanvas:k,inlineImages:w,userTriggeredOnInput:F,collectFonts:L,doc:T,maskInputFn:h,maskTextFn:p,keepIframeSrcFn:K,blockSelector:i,slimDOMOptions:z,dataURLOptions:m,mirror:te,iframeManager:oe,stylesheetManager:$,shadowDomManager:Ie,canvasManager:Nt,ignoreCSSAttributes:J,plugins:((j=P?.filter(A=>A.observer))===null||j===void 0?void 0:j.map(A=>({observer:A.observer,options:A.options,callback:H=>R(O({type:b.Plugin,data:{plugin:A.name,payload:H}}))})))||[]},I)};oe.addLoadListener(T=>{v.push(U(T.contentDocument));});let _=()=>{je(),v.push(U(document)),Je=!0;};return document.readyState==="interactive"||document.readyState==="complete"?_():v.push(B("load",()=>{R(O({type:b.Load,data:{}})),_();},window)),()=>{v.forEach(T=>T()),Je=!1;}}catch(v){console.warn(v);}}ge.addCustomEvent=(t,e)=>{if(!Je)throw new Error("please add custom event after start recording");R(O({type:b.Custom,data:{tag:t,payload:e}}));};ge.freezePage=()=>{de.forEach(t=>t.freeze());};ge.takeFullSnapshot=t=>{if(!Je)throw new Error("please take full snapshot after start recording");je(t);};ge.mirror=te;var Qe=class{constructor(e,r,n){this.sessionId=e;this.emit=r;this.rrwebConfig=n;this.stopFn=null;}start(){this.stopFn=ge({...this.rrwebConfig,emit:e=>{this.emit({type:"rrweb",timestamp:e.timestamp,sessionId:this.sessionId,data:e});}})??null;}stop(){this.stopFn&&(this.stopFn(),this.stopFn=null);}};var qe=class{constructor(e,r){this.sessionId=e;this.emit=r;this.onErrorHandler=null;this.onRejectionHandler=null;this.previousOnError=null;}start(){this.previousOnError=window.onerror,this.onErrorHandler=(e,r,n,o,i)=>{let a={message:String(e),stack:i?.stack,source:r??void 0,lineno:n??void 0,colno:o??void 0,type:"onerror"};return this.emit({type:"error",timestamp:Date.now(),sessionId:this.sessionId,data:a}),this.previousOnError?this.previousOnError.call(window,e,r,n,o,i):false},this.onRejectionHandler=e=>{let r=e.reason,n={message:r instanceof Error?r.message:String(r),stack:r instanceof Error?r.stack:void 0,type:"unhandledrejection"};this.emit({type:"error",timestamp:Date.now(),sessionId:this.sessionId,data:n});},window.onerror=this.onErrorHandler,window.addEventListener("unhandledrejection",this.onRejectionHandler);}stop(){this.previousOnError?window.onerror=this.previousOnError:window.onerror=null,this.onRejectionHandler&&window.removeEventListener("unhandledrejection",this.onRejectionHandler),this.onErrorHandler=null,this.onRejectionHandler=null;}};var ln=/ghostplay\.dev/,Xe=class{constructor(e,r){this.sessionId=e;this.emit=r;this.originalFetch=null;this.active=false;}start(){this.active=true,this.patchFetch();}stop(){this.active=false,this.restoreFetch();}patchFetch(){this.originalFetch=globalThis.fetch;let e=this;globalThis.fetch=async function(r,n){let o=typeof r=="string"?r:r instanceof URL?r.toString():r.url,i=n?.method??"GET";if(ln.test(o))return e.originalFetch.call(globalThis,r,n);let a=Date.now();try{let s=await e.originalFetch.call(globalThis,r,n);if(e.active){let l={method:i.toUpperCase(),url:o,status:s.status,statusText:s.statusText,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:l});}return s}catch(s){if(e.active){let l={method:i.toUpperCase(),url:o,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:l});}throw s}};}restoreFetch(){this.originalFetch&&(globalThis.fetch=this.originalFetch,this.originalFetch=null);}};var gr=["log","warn","error","info","debug"],$e=class{constructor(e,r){this.sessionId=e;this.emit=r;this.originals={};}start(){for(let e of gr)this.originals[e]=console[e].bind(console),console[e]=(...r)=>{let n={level:e,args:r.map(o=>this.serialize(o))};this.emit({type:"console",timestamp:Date.now(),sessionId:this.sessionId,data:n}),this.originals[e]?.(...r);};}stop(){for(let e of gr)this.originals[e]&&(console[e]=this.originals[e]);this.originals={};}serialize(e){if(e instanceof Error)return {__type:"Error",message:e.message,stack:e.stack};if(typeof e=="object"&&e!==null)try{return JSON.stringify(e),e}catch{return String(e)}return e}};var cn={LCP:[1e3,4e3],FID:[100,300],CLS:[.1,.25],TTFB:[800,1800],INP:[200,500]},et=class{constructor(e,r){this.sessionId=e;this.emit=r;this.observers=[];}start(){typeof PerformanceObserver>"u"||(this.observeLCP(),this.observeFID(),this.observeCLS(),this.observeTTFB(),this.observeINP());}stop(){this.observers.forEach(e=>e.disconnect()),this.observers=[];}handleMetric(e,r){let[n,o]=cn[e],i=r<=n?"good":r<=o?"needs-improvement":"poor";this.emit({type:"performance",timestamp:Date.now(),sessionId:this.sessionId,data:{metric:e,value:r,rating:i}});}observeLCP(){try{let e=new PerformanceObserver(r=>{let n=r.getEntries(),o=n[n.length-1];o&&this.handleMetric("LCP",o.startTime);});e.observe({type:"largest-contentful-paint",buffered:!0}),this.observers.push(e);}catch{}}observeFID(){try{let e=new PerformanceObserver(r=>{let o=r.getEntries()[0];o&&this.handleMetric("FID",o.processingStart-o.startTime);});e.observe({type:"first-input",buffered:!0}),this.observers.push(e);}catch{}}observeCLS(){let e=0;try{let r=new PerformanceObserver(n=>{for(let o of n.getEntries())o.hadRecentInput||(e+=o.value);this.handleMetric("CLS",e);});r.observe({type:"layout-shift",buffered:!0}),this.observers.push(r);}catch{}}observeTTFB(){try{let e=new PerformanceObserver(r=>{let n=r.getEntries()[0];n&&this.handleMetric("TTFB",n.responseStart);});e.observe({type:"navigation",buffered:!0}),this.observers.push(e);}catch{}}observeINP(){try{let e=new PerformanceObserver(r=>{for(let n of r.getEntries())this.handleMetric("INP",n.duration);});e.observe({type:"event",buffered:!0}),this.observers.push(e);}catch{}}};var tt=class{constructor(e,r){this.sessionId=e;this.emit=r;this.clickHandler=null;this.recentClicks=[];}start(){this.clickHandler=e=>{let r=e.target;if(!r)return;let n=Date.now(),o=this.recentClicks.find(i=>i.element===r);if(o||(o={element:r,timestamps:[]},this.recentClicks.push(o)),o.timestamps.push(n),o.timestamps=o.timestamps.filter(i=>n-i<1e3),o.timestamps.length>=3){let i={selector:this.getSelector(r),clickCount:o.timestamps.length,x:e.clientX,y:e.clientY};this.emit({type:"rage-click",timestamp:n,sessionId:this.sessionId,data:i}),o.timestamps=[];}this.recentClicks=this.recentClicks.filter(i=>i.timestamps.length>0);},document.addEventListener("click",this.clickHandler,true);}stop(){this.clickHandler&&(document.removeEventListener("click",this.clickHandler,true),this.clickHandler=null),this.recentClicks=[];}getSelector(e){if(e.id)return `#${e.id}`;let r=e.getAttribute("data-testid");if(r)return `[data-testid="${r}"]`;let n=e.tagName.toLowerCase(),o=e.className?`.${e.className.split(" ").filter(Boolean).join(".")}`:"";return `${n}${o}`}};var rt=class{constructor(e=50){this.maxSize=e;this.trail=[];}add(e,r,n){let o={category:e,message:r};n&&(o.data=n),this.trail.push(o),this.trail.length>this.maxSize&&(this.trail=this.trail.slice(-this.maxSize));}getTrail(){return [...this.trail]}clear(){this.trail=[];}};var dn=["password"],un=["email","tel"],pn=["set-cookie"],nt=class{constructor(e){this.options=e;}shouldBlockElement(e){return this.options.blockSelector?e.matches(this.options.blockSelector):false}shouldIgnoreElement(e){return this.options.ignoreSelector?e.matches(this.options.ignoreSelector):false}shouldMaskInput(e){let r=e.type.toLowerCase();return !!(dn.includes(r)||un.includes(r)||this.options.maskAllInputs||this.options.maskInputSelector&&e.matches(this.options.maskInputSelector))}sanitizeNetworkEvent(e){let r={...e},n=this.options.networkSanitize;return r.responseHeaders&&(r.responseHeaders=this.filterHeaders(r.responseHeaders,pn)),n&&(r.requestHeaders&&n.denyHeaders.length>0&&(r.requestHeaders=this.filterHeaders(r.requestHeaders,n.denyHeaders)),r.responseHeaders&&n.denyHeaders.length>0&&(r.responseHeaders=this.filterHeaders(r.responseHeaders,n.denyHeaders)),n.denyBodyUrls.length>0&&this.urlMatchesDeny(e.url,n.denyBodyUrls)&&(r.requestBody&&(r.requestBody="[REDACTED]"),r.responseBody&&(r.responseBody="[REDACTED]"))),r}filterHeaders(e,r){let n=r.map(i=>i.toLowerCase()),o={};for(let[i,a]of Object.entries(e))n.includes(i.toLowerCase())||(o[i]=a);return o}urlMatchesDeny(e,r){return r.some(n=>new RegExp("^"+n.replace(/\*/g,".*")+"$").test(e))}};var ot=class{constructor(e){this.config=e;this.buffer=[];this.bufferBytes=0;this.flushTimer=null;}start(){this.flushTimer=setInterval(()=>{this.flush();},this.config.flushIntervalMs);}stop(){this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush();}send(e){let r=JSON.stringify(e).length;this.buffer.push(e),this.bufferBytes+=r,this.bufferBytes>=this.config.flushMaxBytes&&this.flush();}flush(){if(this.buffer.length===0)return;let e=this.buffer;this.buffer=[],this.bufferBytes=0;let r={projectId:this.config.projectId,sessionId:this.config.sessionId,events:e,sentAt:Date.now()},n=JSON.stringify(r),o=`${this.config.apiUrl}/events`,i=n.length<6e4;try{fetch(o,{method:"POST",headers:{"Content-Type":"application/json","x-project-id":this.config.projectId},body:n,keepalive:i}).catch(()=>{this.sendBeacon(o,n);});}catch{this.sendBeacon(o,n);}}sendBeacon(e,r){typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(e,new Blob([r],{type:"application/json"}));}};var fn="0.1.0",G=null,re=null,it=null,st=null,at=null,lt=null,ct=null,dt=null,ut=null,xt=null,Re=null;function Ot(){if(!re)throw new Error("[Ghostplay] SDK not initialized. Call Ghostplay.init() first.")}function ae(t){ut&&t.type!=="rrweb"&&ut.add(t.type==="error"?"error":t.type==="network"?"network":t.type==="rage-click"?"click":"custom",`${t.type}: ${JSON.stringify(t.data).substring(0,100)}`),Re?.send(t);}function hn(t){Ir(),G=Ft(t),re=new Ne(G.projectId);let e=re.start();xt=new nt({maskAllInputs:G.maskAllInputs,maskInputSelector:G.maskInputSelector,blockSelector:G.blockSelector,ignoreSelector:G.ignoreSelector,networkSanitize:G.networkSanitize}),Re=new ot({apiUrl:G.apiUrl,projectId:G.projectId,sessionId:e.id,flushIntervalMs:G.flushIntervalMs,flushMaxBytes:G.flushMaxBytes}),Re.start(),ut=new rt,it=new Qe(e.id,ae,G.rrwebConfig),it.start(),st=new qe(e.id,ae),st.start(),G.recordNetwork&&(at=new Xe(e.id,r=>{let n=xt.sanitizeNetworkEvent(r.data);ae({...r,data:n});}),at.start()),G.recordConsole&&(lt=new $e(e.id,ae),lt.start()),G.trackPerformance&&(ct=new et(e.id,ae),ct.start()),G.trackRageClicks&&(dt=new tt(e.id,ae),dt.start());}function mn(t,e){Ot(),re.identify(t,e),ae({type:"identify",timestamp:Date.now(),sessionId:re.current().id,data:{userId:t,traits:e}});}function gn(t){Ot(),re.addTag(t),ae({type:"tag",timestamp:Date.now(),sessionId:re.current().id,data:{tag:t}});}function In(t){Ot(),re.setMetadata(t),ae({type:"metadata",timestamp:Date.now(),sessionId:re.current().id,data:t});}function Ir(){it?.stop(),st?.stop(),at?.stop(),lt?.stop(),ct?.stop(),dt?.stop(),Re?.stop(),re?.end(),it=null,st=null,at=null,lt=null,ct=null,dt=null,Re=null,re=null,ut=null,xt=null,G=null;}var vn={VERSION:fn,init:hn,identify:mn,tag:gn,setMetadata:In,stop:Ir},li=vn;/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
rrweb/es/rrweb/ext/tslib/tslib.es6.js:
|
|
8
8
|
(*! *****************************************************************************
|