ghostplay-sdk 0.1.5 → 0.1.6

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.
@@ -1,8 +1,8 @@
1
- var GhostplaySDK=(function(exports){'use strict';var gt=(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 Ft={apiUrl:"https://api.ghostplay.dev/v1",maskAllInputs:true,recordNetwork:true,recordConsole:true,trackPerformance:true,trackRageClicks:true,trackNavigation:true,flushIntervalMs:5e3,flushMaxBytes:5e4};function Bt(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 {...Ft,...t}}function Cr(){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:Cr(),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 L;(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";})(L||(L={}));function Sr(t){return t.nodeType===t.ELEMENT_NODE}function fe(t){var e=t?.host;return e?.shadowRoot===t}function pe(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function br(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 mt(t){try{var e=t.rules||t.cssRules;return e?br(Array.from(e).map(vt).join("")):null}catch{return null}}function vt(t){var e=t.cssText;if(Ar(t))try{e=mt(t.styleSheet)||e;}catch{}return e}function Ar(t){return "styleSheet"in t}var Ut=(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 Ht(){return new Ut}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 Gt="__rrweb_original__";function kr(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=Gt in i?i[Gt]: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(c){return c!==0}))return false}return true}var wr=1,Er=new RegExp("[^a-z0-9-_:]"),he=-2;function It(){return wr++}function Tr(t){if(t instanceof HTMLFormElement)return "form";var e=t.tagName.toLowerCase().trim();return Er.test(e)?"div":e}function Mr(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function Rr(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ie,Wt,Nr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,xr=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Or=/^(data:)([^,]*),(.*)/i;function xe(t,e){return (t||"").replace(Nr,function(r,n,o,i,a,s){var c=o||a||s,l=n||i||"";if(!c)return r;if(!xr.test(c)||Or.test(c))return "url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return "url(".concat(l).concat(Rr(e)+c).concat(l,")");var d=e.split("/"),u=c.split("/");d.pop();for(var h=0,f=u;h<f.length;h++){var p=f[h];p!=="."&&(p===".."?d.pop():d.push(p));}return "url(".concat(l).concat(d.join("/")).concat(l,")")})}var Dr=/^[^ \t\n\r\u000c]+/,Lr=/^[, \t\n\r\u000c]+/;function Fr(t,e){if(e.trim()==="")return e;var r=0;function n(l){var d,u=l.exec(e.substring(r));return u?(d=u[0],r+=d.length,d):""}for(var o=[];n(Lr),!(r>=e.length);){var i=n(Dr);if(i.slice(-1)===",")i=ye(t,i.substring(0,i.length-1)),o.push(i);else {var a="";i=ye(t,i);for(var s=false;;){var c=e.charAt(r);if(c===""){o.push((i+a).trim());break}else if(s)c===")"&&(s=false);else if(c===","){r+=1,o.push((i+a).trim());break}else c==="("&&(s=true);a+=c,r+=1;}}}return o.join(", ")}function ye(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function Br(t){return !!(t.tagName==="svg"||t.ownerSVGElement)}function yt(){var t=document.createElement("a");return t.href="",t.href}function Ct(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")?ye(t,n):r==="srcset"&&n?Fr(t,n):r==="style"&&n?xe(n,yt()):e==="object"&&r==="data"&&n?ye(t,n):n}function Gr(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 St(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 Wr(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 Ur(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 Hr(t,e){var r=e.doc,n=e.mirror,o=e.blockClass,i=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,c=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,u=e.maskTextFn,h=e.maskInputFn,f=e.dataURLOptions,p=f===void 0?{}:f,v=e.inlineImages,S=e.recordCanvas,y=e.keepIframeSrcFn,g=e.newlyAddedElement,m=g===void 0?false:g,k=Vr(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:L.Document,childNodes:[],compatMode:t.compatMode}:{type:L.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return {type:L.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:c,maskInputOptions:d,maskInputFn:h,dataURLOptions:p,inlineImages:v,recordCanvas:S,keepIframeSrcFn:y,newlyAddedElement:m,rootId:k});case t.TEXT_NODE:return _r(t,{maskTextClass:a,maskTextSelector:s,maskTextFn:u,rootId:k});case t.CDATA_SECTION_NODE:return {type:L.CDATA,textContent:"",rootId:k};case t.COMMENT_NODE:return {type:L.Comment,textContent:t.textContent||"",rootId:k};default:return false}}function Vr(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function _r(t,e){var r,n=e.maskTextClass,o=e.maskTextSelector,i=e.maskTextFn,a=e.rootId,s=t.parentNode&&t.parentNode.tagName,c=t.textContent,l=s==="STYLE"?true:void 0,d=s==="SCRIPT"?true:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=Mr(t.parentNode.sheet));}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t);}c=xe(c,yt());}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&St(t,n,o)&&(c=i?i(c):c.replace(/[\S]/g,"*")),{type:L.Text,textContent:c||"",isStyle:l,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,c=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,u=e.inlineImages,h=e.recordCanvas,f=e.keepIframeSrcFn,p=e.newlyAddedElement,v=p===void 0?false:p,S=e.rootId,y=Gr(t,n,o),g=Tr(t),m={},k=t.attributes.length,W=0;W<k;W++){var F=t.attributes[W];m[F.name]=Ct(r,g,F.name,F.value);}if(g==="link"&&i){var B=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),w=null;B&&(w=mt(B)),w&&(delete m.rel,delete m.href,m._cssText=xe(w,B.href));}if(g==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var w=mt(t.sheet);w&&(m._cssText=xe(w,yt()));}if(g==="input"||g==="textarea"||g==="select"){var P=t.value,z=t.checked;m.type!=="radio"&&m.type!=="checkbox"&&m.type!=="submit"&&m.type!=="button"&&P?m.value=we({type:m.type,tagName:g,value:P,maskInputOptions:s,maskInputFn:c}):z&&(m.checked=z);}if(g==="option"&&(t.selected&&!s.select?m.selected=true:delete m.selected),g==="canvas"&&h){if(t.__context==="2d")kr(t)||(m.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&&(m.rr_dataURL=J);}}if(g==="img"&&u){Ie||(Ie=r.createElement("canvas"),Wt=Ie.getContext("2d"));var O=t,K=O.crossOrigin;O.crossOrigin="anonymous";var X=function(){try{Ie.width=O.naturalWidth,Ie.height=O.naturalHeight,Wt.drawImage(O,0,0),m.rr_dataURL=Ie.toDataURL(d.type,d.quality);}catch(Y){console.warn("Cannot inline img src=".concat(O.currentSrc,"! Error: ").concat(Y));}K?m.crossOrigin=K:O.removeAttribute("crossorigin");};O.complete&&O.naturalWidth!==0?X():O.onload=X;}if((g==="audio"||g==="video")&&(m.rr_mediaState=t.paused?"paused":"played",m.rr_mediaCurrentTime=t.currentTime),v||(t.scrollLeft&&(m.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(m.rr_scrollTop=t.scrollTop)),y){var ne=t.getBoundingClientRect(),se=ne.width,V=ne.height;m={class:m.class,rr_width:"".concat(se,"px"),rr_height:"".concat(V,"px")};}return g==="iframe"&&!f(m.src)&&(t.contentDocument||(m.rr_src=m.src),delete m.src),{type:L.Element,tagName:g,attributes:m,childNodes:[],isSVG:Br(t)||void 0,needBlock:y,rootId:S}}function E(t){return t===void 0?"":t.toLowerCase()}function Pr(t,e){if(e.comment&&t.type===L.Comment)return true;if(t.type===L.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,c=e.skipChild,l=c===void 0?false:c,d=e.inlineStylesheet,u=d===void 0?true:d,h=e.maskInputOptions,f=h===void 0?{}:h,p=e.maskTextFn,v=e.maskInputFn,S=e.slimDOMOptions,y=e.dataURLOptions,g=y===void 0?{}:y,m=e.inlineImages,k=m===void 0?false:m,W=e.recordCanvas,F=W===void 0?false:W,B=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,O=e.keepIframeSrcFn,K=O===void 0?function(){return false}:O,X=e.newlyAddedElement,ne=X===void 0?false:X,se=e.preserveWhiteSpace,V=se===void 0?true:se,Y=Hr(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,dataURLOptions:g,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):Pr(Y,S)||!V&&Y.type===L.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?le=he:le=It();var x=Object.assign(Y,{id:le});if(n.add(t,x),le===he)return null;B&&B(t);var $=!l;if(x.type===L.Element){$=$&&!x.needBlock,delete x.needBlock;var oe=t.shadowRoot;oe&&pe(oe)&&(x.isShadowHost=true);}if((x.type===L.Document||x.type===L.Element)&&$){S.headWhitespace&&x.type===L.Element&&x.tagName==="head"&&(V=false);for(var ve={doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:l,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:S,dataURLOptions:g,inlineImages:k,recordCanvas:F,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K},I=0,U=Array.from(t.childNodes);I<U.length;I++){var _=U[I],T=ue(_,ve);T&&x.childNodes.push(T);}if(Sr(t)&&t.shadowRoot)for(var j=0,A=Array.from(t.shadowRoot.childNodes);j<A.length;j++){var _=A[j],T=ue(_,ve);T&&(pe(t.shadowRoot)&&(T.isShadow=true),x.childNodes.push(T));}}return t.parentNode&&fe(t.parentNode)&&pe(t.parentNode)&&(x.isShadow=true),x.type===L.Element&&x.tagName==="iframe"&&Wr(t,function(){var Z=t.contentDocument;if(Z&&w){var Ae=ue(Z,{doc:Z,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:S,dataURLOptions:g,inlineImages:k,recordCanvas:F,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K});Ae&&w(t,Ae);}},z),x.type===L.Element&&x.tagName==="link"&&x.attributes.rel==="stylesheet"&&Ur(t,function(){if(J){var Z=ue(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:S,dataURLOptions:g,inlineImages:k,recordCanvas:F,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K});Z&&J(t,Z);}},q),x}function Vt(t,e){var r=e||{},n=r.mirror,o=n===void 0?new Ut:n,i=r.blockClass,a=i===void 0?"rr-block":i,s=r.blockSelector,c=s===void 0?null:s,l=r.maskTextClass,d=l===void 0?"rr-mask":l,u=r.maskTextSelector,h=u===void 0?null:u,f=r.inlineStylesheet,p=f===void 0?true:f,v=r.inlineImages,S=v===void 0?false:v,y=r.recordCanvas,g=y===void 0?false:y,m=r.maskAllInputs,k=m===void 0?false:m,W=r.maskTextFn,F=r.maskInputFn,B=r.slimDOM,w=B===void 0?false:B,P=r.dataURLOptions,z=r.preserveWhiteSpace,J=r.onSerialize,Q=r.onIframeLoad,q=r.iframeLoadTimeout,O=r.onStylesheetLoad,K=r.stylesheetLoadTimeout,X=r.keepIframeSrcFn,ne=X===void 0?function(){return false}:X,se=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,V=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:c,maskTextClass:d,maskTextSelector:h,skipChild:false,inlineStylesheet:p,maskInputOptions:se,maskTextFn:W,maskInputFn:F,slimDOMOptions:V,dataURLOptions:P,inlineImages:S,recordCanvas:g,preserveWhiteSpace:z,onSerialize:J,onIframeLoad:Q,iframeLoadTimeout:q,onStylesheetLoad:O,stylesheetLoadTimeout:K,keepIframeSrcFn:ne,newlyAddedElement:false})}function G(t,e,r=document){let n={capture:true,passive:true};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var Ce=`Please stop import mirror directly. Instead of that,\r
1
+ var GhostplaySDK=(function(exports){'use strict';var gt=(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 Lt={apiUrl:"https://api.ghostplay.dev/v1",maskAllInputs:true,recordNetwork:true,recordConsole:true,trackPerformance:true,trackRageClicks:true,trackNavigation:true,flushIntervalMs:5e3,flushMaxBytes:5e4};function Bt(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 {...Lt,...t}}function Cr(){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:Cr(),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 F;(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";})(F||(F={}));function Sr(t){return t.nodeType===t.ELEMENT_NODE}function fe(t){var e=t?.host;return e?.shadowRoot===t}function pe(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function br(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 mt(t){try{var e=t.rules||t.cssRules;return e?br(Array.from(e).map(vt).join("")):null}catch{return null}}function vt(t){var e=t.cssText;if(Ar(t))try{e=mt(t.styleSheet)||e;}catch{}return e}function Ar(t){return "styleSheet"in t}var Ut=(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 Ht(){return new Ut}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 Gt="__rrweb_original__";function kr(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=Gt in i?i[Gt]: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(c){return c!==0}))return false}return true}var wr=1,Er=new RegExp("[^a-z0-9-_:]"),he=-2;function It(){return wr++}function Tr(t){if(t instanceof HTMLFormElement)return "form";var e=t.tagName.toLowerCase().trim();return Er.test(e)?"div":e}function Mr(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function Rr(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var Ie,Wt,Nr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,xr=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,Or=/^(data:)([^,]*),(.*)/i;function xe(t,e){return (t||"").replace(Nr,function(r,n,o,i,a,s){var c=o||a||s,l=n||i||"";if(!c)return r;if(!xr.test(c)||Or.test(c))return "url(".concat(l).concat(c).concat(l,")");if(c[0]==="/")return "url(".concat(l).concat(Rr(e)+c).concat(l,")");var d=e.split("/"),u=c.split("/");d.pop();for(var h=0,f=u;h<f.length;h++){var p=f[h];p!=="."&&(p===".."?d.pop():d.push(p));}return "url(".concat(l).concat(d.join("/")).concat(l,")")})}var Dr=/^[^ \t\n\r\u000c]+/,Fr=/^[, \t\n\r\u000c]+/;function Lr(t,e){if(e.trim()==="")return e;var r=0;function n(l){var d,u=l.exec(e.substring(r));return u?(d=u[0],r+=d.length,d):""}for(var o=[];n(Fr),!(r>=e.length);){var i=n(Dr);if(i.slice(-1)===",")i=ye(t,i.substring(0,i.length-1)),o.push(i);else {var a="";i=ye(t,i);for(var s=false;;){var c=e.charAt(r);if(c===""){o.push((i+a).trim());break}else if(s)c===")"&&(s=false);else if(c===","){r+=1,o.push((i+a).trim());break}else c==="("&&(s=true);a+=c,r+=1;}}}return o.join(", ")}function ye(t,e){if(!e||e.trim()==="")return e;var r=t.createElement("a");return r.href=e,r.href}function Br(t){return !!(t.tagName==="svg"||t.ownerSVGElement)}function yt(){var t=document.createElement("a");return t.href="",t.href}function Ct(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")?ye(t,n):r==="srcset"&&n?Lr(t,n):r==="style"&&n?xe(n,yt()):e==="object"&&r==="data"&&n?ye(t,n):n}function Gr(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 St(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 Wr(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 Ur(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 Hr(t,e){var r=e.doc,n=e.mirror,o=e.blockClass,i=e.blockSelector,a=e.maskTextClass,s=e.maskTextSelector,c=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,u=e.maskTextFn,h=e.maskInputFn,f=e.dataURLOptions,p=f===void 0?{}:f,v=e.inlineImages,S=e.recordCanvas,y=e.keepIframeSrcFn,g=e.newlyAddedElement,m=g===void 0?false:g,k=Vr(r,n);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:F.Document,childNodes:[],compatMode:t.compatMode}:{type:F.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return {type:F.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:c,maskInputOptions:d,maskInputFn:h,dataURLOptions:p,inlineImages:v,recordCanvas:S,keepIframeSrcFn:y,newlyAddedElement:m,rootId:k});case t.TEXT_NODE:return _r(t,{maskTextClass:a,maskTextSelector:s,maskTextFn:u,rootId:k});case t.CDATA_SECTION_NODE:return {type:F.CDATA,textContent:"",rootId:k};case t.COMMENT_NODE:return {type:F.Comment,textContent:t.textContent||"",rootId:k};default:return false}}function Vr(t,e){if(e.hasNode(t)){var r=e.getId(t);return r===1?void 0:r}}function _r(t,e){var r,n=e.maskTextClass,o=e.maskTextSelector,i=e.maskTextFn,a=e.rootId,s=t.parentNode&&t.parentNode.tagName,c=t.textContent,l=s==="STYLE"?true:void 0,d=s==="SCRIPT"?true:void 0;if(l&&c){try{t.nextSibling||t.previousSibling||!((r=t.parentNode.sheet)===null||r===void 0)&&r.cssRules&&(c=Mr(t.parentNode.sheet));}catch(u){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(u),t);}c=xe(c,yt());}return d&&(c="SCRIPT_PLACEHOLDER"),!l&&!d&&c&&St(t,n,o)&&(c=i?i(c):c.replace(/[\S]/g,"*")),{type:F.Text,textContent:c||"",isStyle:l,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,c=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,u=e.inlineImages,h=e.recordCanvas,f=e.keepIframeSrcFn,p=e.newlyAddedElement,v=p===void 0?false:p,S=e.rootId,y=Gr(t,n,o),g=Tr(t),m={},k=t.attributes.length,W=0;W<k;W++){var L=t.attributes[W];m[L.name]=Ct(r,g,L.name,L.value);}if(g==="link"&&i){var B=Array.from(r.styleSheets).find(function(Y){return Y.href===t.href}),w=null;B&&(w=mt(B)),w&&(delete m.rel,delete m.href,m._cssText=xe(w,B.href));}if(g==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var w=mt(t.sheet);w&&(m._cssText=xe(w,yt()));}if(g==="input"||g==="textarea"||g==="select"){var P=t.value,z=t.checked;m.type!=="radio"&&m.type!=="checkbox"&&m.type!=="submit"&&m.type!=="button"&&P?m.value=we({type:m.type,tagName:g,value:P,maskInputOptions:s,maskInputFn:c}):z&&(m.checked=z);}if(g==="option"&&(t.selected&&!s.select?m.selected=true:delete m.selected),g==="canvas"&&h){if(t.__context==="2d")kr(t)||(m.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&&(m.rr_dataURL=J);}}if(g==="img"&&u){Ie||(Ie=r.createElement("canvas"),Wt=Ie.getContext("2d"));var O=t,K=O.crossOrigin;O.crossOrigin="anonymous";var X=function(){try{Ie.width=O.naturalWidth,Ie.height=O.naturalHeight,Wt.drawImage(O,0,0),m.rr_dataURL=Ie.toDataURL(d.type,d.quality);}catch(Y){console.warn("Cannot inline img src=".concat(O.currentSrc,"! Error: ").concat(Y));}K?m.crossOrigin=K:O.removeAttribute("crossorigin");};O.complete&&O.naturalWidth!==0?X():O.onload=X;}if((g==="audio"||g==="video")&&(m.rr_mediaState=t.paused?"paused":"played",m.rr_mediaCurrentTime=t.currentTime),v||(t.scrollLeft&&(m.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(m.rr_scrollTop=t.scrollTop)),y){var ne=t.getBoundingClientRect(),se=ne.width,V=ne.height;m={class:m.class,rr_width:"".concat(se,"px"),rr_height:"".concat(V,"px")};}return g==="iframe"&&!f(m.src)&&(t.contentDocument||(m.rr_src=m.src),delete m.src),{type:F.Element,tagName:g,attributes:m,childNodes:[],isSVG:Br(t)||void 0,needBlock:y,rootId:S}}function E(t){return t===void 0?"":t.toLowerCase()}function Pr(t,e){if(e.comment&&t.type===F.Comment)return true;if(t.type===F.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,c=e.skipChild,l=c===void 0?false:c,d=e.inlineStylesheet,u=d===void 0?true:d,h=e.maskInputOptions,f=h===void 0?{}:h,p=e.maskTextFn,v=e.maskInputFn,S=e.slimDOMOptions,y=e.dataURLOptions,g=y===void 0?{}:y,m=e.inlineImages,k=m===void 0?false:m,W=e.recordCanvas,L=W===void 0?false:W,B=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,O=e.keepIframeSrcFn,K=O===void 0?function(){return false}:O,X=e.newlyAddedElement,ne=X===void 0?false:X,se=e.preserveWhiteSpace,V=se===void 0?true:se,Y=Hr(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,dataURLOptions:g,inlineImages:k,recordCanvas:L,keepIframeSrcFn:K,newlyAddedElement:ne});if(!Y)return console.warn(t,"not serialized"),null;var le;n.hasNode(t)?le=n.getId(t):Pr(Y,S)||!V&&Y.type===F.Text&&!Y.isStyle&&!Y.textContent.replace(/^\s+|\s+$/gm,"").length?le=he:le=It();var x=Object.assign(Y,{id:le});if(n.add(t,x),le===he)return null;B&&B(t);var $=!l;if(x.type===F.Element){$=$&&!x.needBlock,delete x.needBlock;var oe=t.shadowRoot;oe&&pe(oe)&&(x.isShadowHost=true);}if((x.type===F.Document||x.type===F.Element)&&$){S.headWhitespace&&x.type===F.Element&&x.tagName==="head"&&(V=false);for(var ve={doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:l,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:S,dataURLOptions:g,inlineImages:k,recordCanvas:L,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K},I=0,U=Array.from(t.childNodes);I<U.length;I++){var _=U[I],T=ue(_,ve);T&&x.childNodes.push(T);}if(Sr(t)&&t.shadowRoot)for(var j=0,A=Array.from(t.shadowRoot.childNodes);j<A.length;j++){var _=A[j],T=ue(_,ve);T&&(pe(t.shadowRoot)&&(T.isShadow=true),x.childNodes.push(T));}}return t.parentNode&&fe(t.parentNode)&&pe(t.parentNode)&&(x.isShadow=true),x.type===F.Element&&x.tagName==="iframe"&&Wr(t,function(){var Z=t.contentDocument;if(Z&&w){var Ae=ue(Z,{doc:Z,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:S,dataURLOptions:g,inlineImages:k,recordCanvas:L,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K});Ae&&w(t,Ae);}},z),x.type===F.Element&&x.tagName==="link"&&x.attributes.rel==="stylesheet"&&Ur(t,function(){if(J){var Z=ue(t,{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,skipChild:false,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:v,slimDOMOptions:S,dataURLOptions:g,inlineImages:k,recordCanvas:L,preserveWhiteSpace:V,onSerialize:B,onIframeLoad:w,iframeLoadTimeout:z,onStylesheetLoad:J,stylesheetLoadTimeout:q,keepIframeSrcFn:K});Z&&J(t,Z);}},q),x}function Vt(t,e){var r=e||{},n=r.mirror,o=n===void 0?new Ut:n,i=r.blockClass,a=i===void 0?"rr-block":i,s=r.blockSelector,c=s===void 0?null:s,l=r.maskTextClass,d=l===void 0?"rr-mask":l,u=r.maskTextSelector,h=u===void 0?null:u,f=r.inlineStylesheet,p=f===void 0?true:f,v=r.inlineImages,S=v===void 0?false:v,y=r.recordCanvas,g=y===void 0?false:y,m=r.maskAllInputs,k=m===void 0?false:m,W=r.maskTextFn,L=r.maskInputFn,B=r.slimDOM,w=B===void 0?false:B,P=r.dataURLOptions,z=r.preserveWhiteSpace,J=r.onSerialize,Q=r.onIframeLoad,q=r.iframeLoadTimeout,O=r.onStylesheetLoad,K=r.stylesheetLoadTimeout,X=r.keepIframeSrcFn,ne=X===void 0?function(){return false}:X,se=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,V=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:c,maskTextClass:d,maskTextSelector:h,skipChild:false,inlineStylesheet:p,maskInputOptions:se,maskTextFn:W,maskInputFn:L,slimDOMOptions:V,dataURLOptions:P,inlineImages:S,recordCanvas:g,preserveWhiteSpace:z,onSerialize:J,onIframeLoad:Q,iframeLoadTimeout:q,onStylesheetLoad:O,stylesheetLoadTimeout:K,keepIframeSrcFn:ne,newlyAddedElement:false})}function G(t,e,r=document){let n={capture:true,passive:true};return r.addEventListener(t,e,n),()=>r.removeEventListener(t,e,n)}var Ce=`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.`,_t={map:{},getId(){return console.error(Ce),-1},getNode(){return console.error(Ce),null},removeNodeFromMap(){console.error(Ce);},has(){return console.error(Ce),false},reset(){console.error(Ce);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(_t=new Proxy(_t,{get(t,e,r){return e==="map"&&console.error(Ce),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),c=this;s<=0||s>e?(n&&(clearTimeout(n),n=null),o=a,t.apply(c,i)):!n&&r.trailing!==false&&(n=setTimeout(()=>{o=r.leading===false?0:Date.now(),n=null,t.apply(c,i);},s));}}function ge(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);}}),()=>ge(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 Le(){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 Fe(t,e){return e.getId(t)===he}function bt(t,e){if(fe(t))return false;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?false:t.parentNode?bt(t.parentNode,e):true:true}function At(t){return !!t.changedTouches}function Pt(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||{}),C=(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))(C||{}),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||{}),ae=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(ae||{});function zt(t){return "__ln"in t}var kt=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&&zt(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&&zt(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--);}},Kt=(t,e)=>`${t}@${e}`,He=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 kt,n=s=>{let c=s,l=he;for(;l===he;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},o=s=>{var c,l,d,u;let h=null;((l=(c=s.getRootNode)===null||c===void 0?void 0:c.call(s))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(h=s.getRootNode().host);let f=h;for(;((u=(d=f?.getRootNode)===null||d===void 0?void 0:d.call(f))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&f.getRootNode().host;)f=f.getRootNode().host;let p=!this.doc.contains(s)&&(!f||!this.doc.contains(f));if(!s.parentNode||p)return;let v=fe(s.parentNode)?this.mirror.getId(h):this.mirror.getId(s.parentNode),S=n(s);if(v===-1||S===-1)return r.addNode(s);let y=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:g=>{Be(g,this.mirror)&&this.iframeManager.addIframe(g),Ge(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),We(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc);},onIframeLoad:(g,m)=>{this.iframeManager.attachIframe(g,m),this.shadowDomManager.observeAttachShadow(g);},onStylesheetLoad:(g,m)=>{this.stylesheetManager.attachLinkElement(g,m);}});y&&e.push({parentId:v,nextId:S,node:y});};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))Yt(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||o(s);for(let s of Array.from(this.addedSet.values()))!jt(this.droppedSet,s)&&!Yt(this.removes,s,this.mirror)||jt(this.movedSet,s)?o(s):this.droppedSet.add(s);let i=null;for(;r.length;){let s=null;if(i){let c=this.mirror.getId(i.value.parentNode),l=n(i.value);c!==-1&&l!==-1&&(s=i);}if(!s)for(let c=r.length-1;c>=0;c--){let l=r.get(c);if(l){let d=this.mirror.getId(l.value.parentNode);if(n(l.value)===-1)continue;if(d!==-1){s=l;break}else {let h=l.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=h.parentNode.host;if(this.mirror.getId(f)!==-1){s=l;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(!Fe(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:St(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 c=r.style.getPropertyValue(s),l=r.style.getPropertyPriority(s);(c!==i.style.getPropertyValue(s)||l!==i.style.getPropertyPriority(s))&&(l===""?a[s]=c:a[s]=[c,l]);}for(let s of Array.from(i.style))r.style.getPropertyValue(s)===""&&(a[s]=false);}else o.attributes[e.attributeName]=Ct(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=fe(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);M(e.target,this.blockClass,this.blockSelector,false)||Fe(r,this.mirror)||!Zt(r,this.mirror)||(this.addedSet.has(r)?(wt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||bt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Kt(n,o)]?wt(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:fe(e.target)&&pe(e.target)?true:void 0})),this.mapRemoves.push(r));});break}}},this.genAdds=(e,r)=>{if(this.mirror.hasNode(e)){if(Fe(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[Kt(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 wt(t,e){t.delete(e),e.childNodes.forEach(r=>wt(t,r));}function Yt(t,e,r){return t.length===0?false:Jt(t,e,r)}function Jt(t,e,r){let{parentNode:n}=e;if(!n)return false;let o=r.getId(n);return t.some(i=>i.id===o)?true:Jt(t,n,r)}function jt(t,e){return t.size===0?false:Qt(t,e)}function Qt(t,e){let{parentNode:r}=e;return r?t.has(r)?true:Qt(t,r):false}var de=[],$t=typeof CSSGroupingRule<"u",er=typeof CSSMediaRule<"u",tr=typeof CSSSupportsRule<"u",rr=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 Et(t,e){var r,n;let o=new He;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 Kr({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,c=Se(u=>{let h=Date.now()-s;t(a.map(f=>(f.timeOffset-=h,f)),u),a=[],s=null;},i),l=Se(u=>{let h=Ee(u),{clientX:f,clientY:p}=At(u)?u.changedTouches[0]:u;s||(s=Date.now()),a.push({x:f,y:p,id:n.getId(h),timeOffset:Date.now()-s}),c(typeof DragEvent<"u"&&u instanceof DragEvent?C.Drag:u instanceof MouseEvent?C.MouseMove:C.TouchMove);},o,{trailing:false}),d=[G("mousemove",l,r),G("touchmove",l,r),G("drag",l,r)];return ()=>{d.forEach(u=>u());}}function Yr({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=[],c=l=>d=>{let u=Ee(d);if(M(u,n,o,true))return;let h=At(d)?d.changedTouches[0]:d;if(!h)return;let f=r.getId(u),{clientX:p,clientY:v}=h;t({type:Ue[l],id:f,x:p,y:v});};return Object.keys(Ue).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==false).forEach(l=>{let d=l.toLowerCase(),u=c(l);s.push(G(d,u,e));}),()=>{s.forEach(l=>l());}}function Tt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){let a=Se(s=>{let c=Ee(s);if(!c||M(c,n,o,true))return;let l=r.getId(c);if(c===e){let d=e.scrollingElement||e.documentElement;t({id:l,x:d.scrollLeft,y:d.scrollTop});}else t({id:l,x:c.scrollLeft,y:c.scrollTop});},i.scroll||100);return G("scroll",a,e)}function jr({viewportResizeCb:t}){let e=-1,r=-1,n=Se(()=>{let o=De(),i=Le();(e!==o||r!==i)&&(t({width:Number(i),height:Number(o)}),e=o,r=i);},200);return G("resize",n,window)}function qt(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var Jr=["INPUT","TEXTAREA","SELECT"],Xt=new WeakMap;function Qr({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,maskInputOptions:a,maskInputFn:s,sampling:c,userTriggeredOnInput:l}){function d(y){let g=Ee(y),m=y.isTrusted;if(g&&g.tagName==="OPTION"&&(g=g.parentElement),!g||!g.tagName||Jr.indexOf(g.tagName)<0||M(g,n,o,true))return;let k=g.type;if(g.classList.contains(i))return;let W=g.value,F=false;k==="radio"||k==="checkbox"?F=g.checked:(a[g.tagName.toLowerCase()]||a[k])&&(W=we({maskInputOptions:a,tagName:g.tagName,type:k,value:W,maskInputFn:s})),u(g,qt({text:W,isChecked:F,userTriggered:m},l));let B=g.name;k==="radio"&&B&&F&&e.querySelectorAll(`input[type="radio"][name="${B}"]`).forEach(w=>{w!==g&&u(w,qt({text:w.value,isChecked:!F,userTriggered:false},l));});}function u(y,g){let m=Xt.get(y);if(!m||m.text!==g.text||m.isChecked!==g.isChecked){Xt.set(y,g);let k=r.getId(y);t(Object.assign(Object.assign({},g),{id:k}));}}let f=(c.input==="last"?["change"]:["input","change"]).map(y=>G(y,d,e)),p=e.defaultView;if(!p)return ()=>{f.forEach(y=>y());};let v=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 v&&v.set&&f.push(...S.map(y=>ge(y[0],y[1],{set(){d({target:this});}},false,p))),()=>{f.forEach(y=>y());}}function Ve(t){let e=[];function r(n,o){if($t&&n.parentRule instanceof CSSGroupingRule||er&&n.parentRule instanceof CSSMediaRule||tr&&n.parentRule instanceof CSSSupportsRule||rr&&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 qr({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:h,styleId:f}=ce(this,e,r.styleMirror);return (h&&h!==-1||f&&f!==-1)&&t({id:h,styleId:f,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:h}=ce(this,e,r.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,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:h}=ce(this,e,r.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,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:h}=ce(this,e,r.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,replaceSync:d}),s.apply(this,[d])});let c={};$t?c.CSSGroupingRule=n.CSSGroupingRule:(er&&(c.CSSMediaRule=n.CSSMediaRule),rr&&(c.CSSConditionRule=n.CSSConditionRule),tr&&(c.CSSSupportsRule=n.CSSSupportsRule));let l={};return Object.entries(c).forEach(([d,u])=>{l[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(h,f){let{id:p,styleId:v}=ce(this.parentStyleSheet,e,r.styleMirror);return (p&&p!==-1||v&&v!==-1)&&t({id:p,styleId:v,adds:[{rule:h,index:[...Ve(this),f||0]}]}),l[d].insertRule.apply(this,[h,f])},u.prototype.deleteRule=function(h){let{id:f,styleId:p}=ce(this.parentStyleSheet,e,r.styleMirror);return (f&&f!==-1||p&&p!==-1)&&t({id:f,styleId:p,removes:[{index:[...Ve(this),h]}]}),l[d].deleteRule.apply(this,[h])};}),()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,a&&(n.CSSStyleSheet.prototype.replace=a),s&&(n.CSSStyleSheet.prototype.replaceSync=s),Object.entries(c).forEach(([d,u])=>{u.prototype.insertRule=l[d].insertRule,u.prototype.deleteRule=l[d].deleteRule;});}}function Mt({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,c=Object.getOwnPropertyDescriptor(s?.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!c?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return (l=c.get)===null||l===void 0?void 0:l.call(this)},set(l){var d;let u=(d=c.set)===null||d===void 0?void 0:d.call(this,l);if(a!==null&&a!==-1)try{e.adoptStyleSheets(l,a);}catch{}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set});})}function Xr({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=function(s,c,l){var d;if(r.has(s))return i.apply(this,[s,c,l]);let{id:u,styleId:h}=ce((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,n.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,set:{property:s,value:c,priority:l},index:Ve(this.parentRule)}),i.apply(this,[s,c,l])};let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=function(s){var c;if(r.has(s))return a.apply(this,[s]);let{id:l,styleId:d}=ce((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,e,n.styleMirror);return (l&&l!==-1||d&&d!==-1)&&t({id:l,styleId:d,remove:{property:s},index:Ve(this.parentRule)}),a.apply(this,[s])},()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=a;}}function $r({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:o}){let i=s=>Se(c=>{let l=Ee(c);if(!l||M(l,e,r,true))return;let{currentTime:d,volume:u,muted:h,playbackRate:f}=l;t({type:s,id:n.getId(l),currentTime:d,volume:u,muted:h,playbackRate:f});},o.media||500),a=[G("play",i(0)),G("pause",i(1)),G("seeked",i(2)),G("volumechange",i(3)),G("ratechange",i(4))];return ()=>{a.forEach(s=>s());}}function en({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return ()=>{};let n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(c,l,d){let u=new i(c,l,d);return o.set(u,{family:c,buffer:typeof l!="string",descriptors:d,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),u};let a=ee(e.fonts,"add",function(s){return function(c){return setTimeout(()=>{let l=o.get(c);l&&(t(l),o.delete(c));},0),s.apply(this,[c])}});return n.push(()=>{r.FontFace=i;}),n.push(a),()=>{n.forEach(s=>s());}}function tn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=t,a=true,s=()=>{let c=e.getSelection();if(!c||a&&c?.isCollapsed)return;a=c.isCollapsed||false;let l=[],d=c.rangeCount||0;for(let u=0;u<d;u++){let h=c.getRangeAt(u),{startContainer:f,startOffset:p,endContainer:v,endOffset:S}=h;M(f,n,o,true)||M(v,n,o,true)||l.push({start:r.getId(f),startOffset:p,end:r.getId(v),endOffset:S});}i({ranges:l});};return s(),G("selectionchange",s)}function rn(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:a,inputCb:s,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:f}=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),c(...p);},t.styleSheetRuleCb=(...p)=>{e.styleSheetRule&&e.styleSheetRule(...p),l(...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),h(...p);},t.selectionCb=(...p)=>{e.selection&&e.selection(...p),f(...p);};}function nr(t,e={}){let r=t.doc.defaultView;if(!r)return ()=>{};rn(t,e);let n=Et(t,t.doc),o=Kr(t),i=Yr(t),a=Tt(t),s=jr(t),c=Qr(t),l=$r(t),d=qr(t,{win:r}),u=Mt(t,t.doc),h=Xr(t,{win:r}),f=t.collectFonts?en(t):()=>{},p=tn(t),v=[];for(let S of t.plugins)v.push(S.observer(S.callback,r,S.options));return ()=>{de.forEach(S=>S.reset()),n.disconnect(),o(),i(),a(),s(),c(),l(),d(),u(),h(),f(),p(),v.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(It),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:C.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 C.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 C.Drag:case C.TouchMove:case C.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,e,["id"]);}),r;case C.ViewportResize:return false;case C.MediaInteraction:case C.MouseInteraction:case C.Scroll:case C.CanvasMutation:case C.Input:return this.replaceIds(r.data,e,["id"]),r;case C.StyleSheetRule:case C.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case C.Font:return r;case C.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"]);}),r;case C.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 Ze=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),Et(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Tt(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)),Mt({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 or(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 ir(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{l(n.next(d));}catch(u){a(u);}}function c(d){try{l(n.throw(d));}catch(u){a(u);}}function l(d){d.done?i(d.value):o(d.value).then(s,c);}l((n=n.apply(t,[])).next());})}var be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Me=0;Me<be.length;Me++)nn[be.charCodeAt(Me)]=Me;var Me,sr=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 ar=new Map;function on(t,e){let r=ar.get(t);return r||(r=new Map,ar.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Rt=(t,e,r)=>{if(!t||!(lr(t,e)||typeof t=="object"))return;let n=t.constructor.name,o=on(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=sr(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(lr(t,e)||typeof t=="object"){let n=t.constructor.name,o=Rt(t,e,r);return {rr_type:n,index:o}}}}return t}var ze=(t,e,r)=>[...t].map(n=>Pe(n,e,r)),lr=(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 cr(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(c){return function(...l){return M(this.canvas,r,n,!0)||setTimeout(()=>{let d=ze([...l],e,this);t(this.canvas,{type:ae["2D"],property:a,args:d});},0),c.apply(this,l)}});o.push(s);}catch{let c=ge(e.CanvasRenderingContext2D.prototype,a,{set(l){t(this.canvas,{type:ae["2D"],property:a,args:[l],setter:true});}});o.push(c);}return ()=>{o.forEach(a=>a());}}function Nt(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 dr(t,e,r,n,o,i,a){let s=[],c=Object.getOwnPropertyNames(t);for(let l of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof t[l]!="function")continue;let d=ee(t,l,function(u){return function(...h){let f=u.apply(this,h);if(Rt(f,a,this),!M(this.canvas,n,o,!0)){let p=ze([...h],a,this),v={type:e,property:l,args:p};r(this.canvas,v);}return f}});s.push(d);}catch{let u=ge(t,l,{set(h){r(this.canvas,{type:e,property:l,args:[h],setter:true});}});s.push(u);}return s}function ur(t,e,r,n,o){let i=[];return i.push(...dr(e.WebGLRenderingContext.prototype,ae.WebGL,t,r,n,o,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...dr(e.WebGL2RenderingContext.prototype,ae.WebGL2,t,r,n,o,e)),()=>{i.forEach(a=>a());}}var xt=null;try{pr=typeof module<"u"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof gt=="function"&&gt("worker_threads"),xt=pr.Worker;}catch{}var pr;function sn(t,e){return Buffer.from(t,"base64").toString("utf8")}function hr(t,e,r){var i=sn(t),a=i.indexOf(`
3
+ or you can use record.mirror to access the mirror instance during recording.`,_t={map:{},getId(){return console.error(Ce),-1},getNode(){return console.error(Ce),null},removeNodeFromMap(){console.error(Ce);},has(){return console.error(Ce),false},reset(){console.error(Ce);}};typeof window<"u"&&window.Proxy&&window.Reflect&&(_t=new Proxy(_t,{get(t,e,r){return e==="map"&&console.error(Ce),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),c=this;s<=0||s>e?(n&&(clearTimeout(n),n=null),o=a,t.apply(c,i)):!n&&r.trailing!==false&&(n=setTimeout(()=>{o=r.leading===false?0:Date.now(),n=null,t.apply(c,i);},s));}}function ge(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);}}),()=>ge(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)===he}function bt(t,e){if(fe(t))return false;let r=e.getId(t);return e.has(r)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?false:t.parentNode?bt(t.parentNode,e):true:true}function At(t){return !!t.changedTouches}function Pt(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||{}),C=(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))(C||{}),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||{}),ae=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(ae||{});function zt(t){return "__ln"in t}var kt=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&&zt(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&&zt(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--);}},Kt=(t,e)=>`${t}@${e}`,He=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 kt,n=s=>{let c=s,l=he;for(;l===he;)c=c&&c.nextSibling,l=c&&this.mirror.getId(c);return l},o=s=>{var c,l,d,u;let h=null;((l=(c=s.getRootNode)===null||c===void 0?void 0:c.call(s))===null||l===void 0?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&s.getRootNode().host&&(h=s.getRootNode().host);let f=h;for(;((u=(d=f?.getRootNode)===null||d===void 0?void 0:d.call(f))===null||u===void 0?void 0:u.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&f.getRootNode().host;)f=f.getRootNode().host;let p=!this.doc.contains(s)&&(!f||!this.doc.contains(f));if(!s.parentNode||p)return;let v=fe(s.parentNode)?this.mirror.getId(h):this.mirror.getId(s.parentNode),S=n(s);if(v===-1||S===-1)return r.addNode(s);let y=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:g=>{Be(g,this.mirror)&&this.iframeManager.addIframe(g),Ge(g,this.mirror)&&this.stylesheetManager.trackLinkElement(g),We(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc);},onIframeLoad:(g,m)=>{this.iframeManager.attachIframe(g,m),this.shadowDomManager.observeAttachShadow(g);},onStylesheetLoad:(g,m)=>{this.stylesheetManager.attachLinkElement(g,m);}});y&&e.push({parentId:v,nextId:S,node:y});};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let s of Array.from(this.movedSet.values()))Yt(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||o(s);for(let s of Array.from(this.addedSet.values()))!jt(this.droppedSet,s)&&!Yt(this.removes,s,this.mirror)||jt(this.movedSet,s)?o(s):this.droppedSet.add(s);let i=null;for(;r.length;){let s=null;if(i){let c=this.mirror.getId(i.value.parentNode),l=n(i.value);c!==-1&&l!==-1&&(s=i);}if(!s)for(let c=r.length-1;c>=0;c--){let l=r.get(c);if(l){let d=this.mirror.getId(l.value.parentNode);if(n(l.value)===-1)continue;if(d!==-1){s=l;break}else {let h=l.value;if(h.parentNode&&h.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=h.parentNode.host;if(this.mirror.getId(f)!==-1){s=l;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:St(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 c=r.style.getPropertyValue(s),l=r.style.getPropertyPriority(s);(c!==i.style.getPropertyValue(s)||l!==i.style.getPropertyPriority(s))&&(l===""?a[s]=c:a[s]=[c,l]);}for(let s of Array.from(i.style))r.style.getPropertyValue(s)===""&&(a[s]=false);}else o.attributes[e.attributeName]=Ct(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=fe(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)?(wt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&n===-1||bt(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Kt(n,o)]?wt(this.movedSet,r):this.removes.push({parentId:o,id:n,isShadow:fe(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[Kt(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 wt(t,e){t.delete(e),e.childNodes.forEach(r=>wt(t,r));}function Yt(t,e,r){return t.length===0?false:Jt(t,e,r)}function Jt(t,e,r){let{parentNode:n}=e;if(!n)return false;let o=r.getId(n);return t.some(i=>i.id===o)?true:Jt(t,n,r)}function jt(t,e){return t.size===0?false:Qt(t,e)}function Qt(t,e){let{parentNode:r}=e;return r?t.has(r)?true:Qt(t,r):false}var de=[],$t=typeof CSSGroupingRule<"u",er=typeof CSSMediaRule<"u",tr=typeof CSSSupportsRule<"u",rr=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 Et(t,e){var r,n;let o=new He;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 Kr({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,c=Se(u=>{let h=Date.now()-s;t(a.map(f=>(f.timeOffset-=h,f)),u),a=[],s=null;},i),l=Se(u=>{let h=Ee(u),{clientX:f,clientY:p}=At(u)?u.changedTouches[0]:u;s||(s=Date.now()),a.push({x:f,y:p,id:n.getId(h),timeOffset:Date.now()-s}),c(typeof DragEvent<"u"&&u instanceof DragEvent?C.Drag:u instanceof MouseEvent?C.MouseMove:C.TouchMove);},o,{trailing:false}),d=[G("mousemove",l,r),G("touchmove",l,r),G("drag",l,r)];return ()=>{d.forEach(u=>u());}}function Yr({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=[],c=l=>d=>{let u=Ee(d);if(M(u,n,o,true))return;let h=At(d)?d.changedTouches[0]:d;if(!h)return;let f=r.getId(u),{clientX:p,clientY:v}=h;t({type:Ue[l],id:f,x:p,y:v});};return Object.keys(Ue).filter(l=>Number.isNaN(Number(l))&&!l.endsWith("_Departed")&&a[l]!==false).forEach(l=>{let d=l.toLowerCase(),u=c(l);s.push(G(d,u,e));}),()=>{s.forEach(l=>l());}}function Tt({scrollCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,sampling:i}){let a=Se(s=>{let c=Ee(s);if(!c||M(c,n,o,true))return;let l=r.getId(c);if(c===e){let d=e.scrollingElement||e.documentElement;t({id:l,x:d.scrollLeft,y:d.scrollTop});}else t({id:l,x:c.scrollLeft,y:c.scrollTop});},i.scroll||100);return G("scroll",a,e)}function jr({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 G("resize",n,window)}function qt(t,e){let r=Object.assign({},t);return e||delete r.userTriggered,r}var Jr=["INPUT","TEXTAREA","SELECT"],Xt=new WeakMap;function Qr({inputCb:t,doc:e,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,maskInputOptions:a,maskInputFn:s,sampling:c,userTriggeredOnInput:l}){function d(y){let g=Ee(y),m=y.isTrusted;if(g&&g.tagName==="OPTION"&&(g=g.parentElement),!g||!g.tagName||Jr.indexOf(g.tagName)<0||M(g,n,o,true))return;let k=g.type;if(g.classList.contains(i))return;let W=g.value,L=false;k==="radio"||k==="checkbox"?L=g.checked:(a[g.tagName.toLowerCase()]||a[k])&&(W=we({maskInputOptions:a,tagName:g.tagName,type:k,value:W,maskInputFn:s})),u(g,qt({text:W,isChecked:L,userTriggered:m},l));let B=g.name;k==="radio"&&B&&L&&e.querySelectorAll(`input[type="radio"][name="${B}"]`).forEach(w=>{w!==g&&u(w,qt({text:w.value,isChecked:!L,userTriggered:false},l));});}function u(y,g){let m=Xt.get(y);if(!m||m.text!==g.text||m.isChecked!==g.isChecked){Xt.set(y,g);let k=r.getId(y);t(Object.assign(Object.assign({},g),{id:k}));}}let f=(c.input==="last"?["change"]:["input","change"]).map(y=>G(y,d,e)),p=e.defaultView;if(!p)return ()=>{f.forEach(y=>y());};let v=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 v&&v.set&&f.push(...S.map(y=>ge(y[0],y[1],{set(){d({target:this});}},false,p))),()=>{f.forEach(y=>y());}}function Ve(t){let e=[];function r(n,o){if($t&&n.parentRule instanceof CSSGroupingRule||er&&n.parentRule instanceof CSSMediaRule||tr&&n.parentRule instanceof CSSSupportsRule||rr&&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 qr({styleSheetRuleCb:t,mirror:e,stylesheetManager:r},{win:n}){let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(d,u){let{id:h,styleId:f}=ce(this,e,r.styleMirror);return (h&&h!==-1||f&&f!==-1)&&t({id:h,styleId:f,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:h}=ce(this,e,r.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,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:h}=ce(this,e,r.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,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:h}=ce(this,e,r.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,replaceSync:d}),s.apply(this,[d])});let c={};$t?c.CSSGroupingRule=n.CSSGroupingRule:(er&&(c.CSSMediaRule=n.CSSMediaRule),rr&&(c.CSSConditionRule=n.CSSConditionRule),tr&&(c.CSSSupportsRule=n.CSSSupportsRule));let l={};return Object.entries(c).forEach(([d,u])=>{l[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=function(h,f){let{id:p,styleId:v}=ce(this.parentStyleSheet,e,r.styleMirror);return (p&&p!==-1||v&&v!==-1)&&t({id:p,styleId:v,adds:[{rule:h,index:[...Ve(this),f||0]}]}),l[d].insertRule.apply(this,[h,f])},u.prototype.deleteRule=function(h){let{id:f,styleId:p}=ce(this.parentStyleSheet,e,r.styleMirror);return (f&&f!==-1||p&&p!==-1)&&t({id:f,styleId:p,removes:[{index:[...Ve(this),h]}]}),l[d].deleteRule.apply(this,[h])};}),()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,a&&(n.CSSStyleSheet.prototype.replace=a),s&&(n.CSSStyleSheet.prototype.replaceSync=s),Object.entries(c).forEach(([d,u])=>{u.prototype.insertRule=l[d].insertRule,u.prototype.deleteRule=l[d].deleteRule;});}}function Mt({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,c=Object.getOwnPropertyDescriptor(s?.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!c?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return (l=c.get)===null||l===void 0?void 0:l.call(this)},set(l){var d;let u=(d=c.set)===null||d===void 0?void 0:d.call(this,l);if(a!==null&&a!==-1)try{e.adoptStyleSheets(l,a);}catch{}return u}}),()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set});})}function Xr({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=function(s,c,l){var d;if(r.has(s))return i.apply(this,[s,c,l]);let{id:u,styleId:h}=ce((d=this.parentRule)===null||d===void 0?void 0:d.parentStyleSheet,e,n.styleMirror);return (u&&u!==-1||h&&h!==-1)&&t({id:u,styleId:h,set:{property:s,value:c,priority:l},index:Ve(this.parentRule)}),i.apply(this,[s,c,l])};let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=function(s){var c;if(r.has(s))return a.apply(this,[s]);let{id:l,styleId:d}=ce((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,e,n.styleMirror);return (l&&l!==-1||d&&d!==-1)&&t({id:l,styleId:d,remove:{property:s},index:Ve(this.parentRule)}),a.apply(this,[s])},()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=a;}}function $r({mediaInteractionCb:t,blockClass:e,blockSelector:r,mirror:n,sampling:o}){let i=s=>Se(c=>{let l=Ee(c);if(!l||M(l,e,r,true))return;let{currentTime:d,volume:u,muted:h,playbackRate:f}=l;t({type:s,id:n.getId(l),currentTime:d,volume:u,muted:h,playbackRate:f});},o.media||500),a=[G("play",i(0)),G("pause",i(1)),G("seeked",i(2)),G("volumechange",i(3)),G("ratechange",i(4))];return ()=>{a.forEach(s=>s());}}function en({fontCb:t,doc:e}){let r=e.defaultView;if(!r)return ()=>{};let n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(c,l,d){let u=new i(c,l,d);return o.set(u,{family:c,buffer:typeof l!="string",descriptors:d,fontSource:typeof l=="string"?l:JSON.stringify(Array.from(new Uint8Array(l)))}),u};let a=ee(e.fonts,"add",function(s){return function(c){return setTimeout(()=>{let l=o.get(c);l&&(t(l),o.delete(c));},0),s.apply(this,[c])}});return n.push(()=>{r.FontFace=i;}),n.push(a),()=>{n.forEach(s=>s());}}function tn(t){let{doc:e,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=t,a=true,s=()=>{let c=e.getSelection();if(!c||a&&c?.isCollapsed)return;a=c.isCollapsed||false;let l=[],d=c.rangeCount||0;for(let u=0;u<d;u++){let h=c.getRangeAt(u),{startContainer:f,startOffset:p,endContainer:v,endOffset:S}=h;M(f,n,o,true)||M(v,n,o,true)||l.push({start:r.getId(f),startOffset:p,end:r.getId(v),endOffset:S});}i({ranges:l});};return s(),G("selectionchange",s)}function rn(t,e){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:a,inputCb:s,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:f}=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),c(...p);},t.styleSheetRuleCb=(...p)=>{e.styleSheetRule&&e.styleSheetRule(...p),l(...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),h(...p);},t.selectionCb=(...p)=>{e.selection&&e.selection(...p),f(...p);};}function nr(t,e={}){let r=t.doc.defaultView;if(!r)return ()=>{};rn(t,e);let n=Et(t,t.doc),o=Kr(t),i=Yr(t),a=Tt(t),s=jr(t),c=Qr(t),l=$r(t),d=qr(t,{win:r}),u=Mt(t,t.doc),h=Xr(t,{win:r}),f=t.collectFonts?en(t):()=>{},p=tn(t),v=[];for(let S of t.plugins)v.push(S.observer(S.callback,r,S.options));return ()=>{de.forEach(S=>S.reset()),n.disconnect(),o(),i(),a(),s(),c(),l(),d(),u(),h(),f(),p(),v.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(It),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:C.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 C.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 C.Drag:case C.TouchMove:case C.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,e,["id"]);}),r;case C.ViewportResize:return false;case C.MediaInteraction:case C.MouseInteraction:case C.Scroll:case C.CanvasMutation:case C.Input:return this.replaceIds(r.data,e,["id"]),r;case C.StyleSheetRule:case C.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case C.Font:return r;case C.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,e,["start","end"]);}),r;case C.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 Ze=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),Et(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),Tt(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)),Mt({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 or(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 ir(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{l(n.next(d));}catch(u){a(u);}}function c(d){try{l(n.throw(d));}catch(u){a(u);}}function l(d){d.done?i(d.value):o(d.value).then(s,c);}l((n=n.apply(t,[])).next());})}var be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Me=0;Me<be.length;Me++)nn[be.charCodeAt(Me)]=Me;var Me,sr=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 ar=new Map;function on(t,e){let r=ar.get(t);return r||(r=new Map,ar.set(t,r)),r.has(e)||r.set(e,[]),r.get(e)}var Rt=(t,e,r)=>{if(!t||!(lr(t,e)||typeof t=="object"))return;let n=t.constructor.name,o=on(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=sr(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(lr(t,e)||typeof t=="object"){let n=t.constructor.name,o=Rt(t,e,r);return {rr_type:n,index:o}}}}return t}var ze=(t,e,r)=>[...t].map(n=>Pe(n,e,r)),lr=(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 cr(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(c){return function(...l){return M(this.canvas,r,n,!0)||setTimeout(()=>{let d=ze([...l],e,this);t(this.canvas,{type:ae["2D"],property:a,args:d});},0),c.apply(this,l)}});o.push(s);}catch{let c=ge(e.CanvasRenderingContext2D.prototype,a,{set(l){t(this.canvas,{type:ae["2D"],property:a,args:[l],setter:true});}});o.push(c);}return ()=>{o.forEach(a=>a());}}function Nt(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 dr(t,e,r,n,o,i,a){let s=[],c=Object.getOwnPropertyNames(t);for(let l of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof t[l]!="function")continue;let d=ee(t,l,function(u){return function(...h){let f=u.apply(this,h);if(Rt(f,a,this),!M(this.canvas,n,o,!0)){let p=ze([...h],a,this),v={type:e,property:l,args:p};r(this.canvas,v);}return f}});s.push(d);}catch{let u=ge(t,l,{set(h){r(this.canvas,{type:e,property:l,args:[h],setter:true});}});s.push(u);}return s}function ur(t,e,r,n,o){let i=[];return i.push(...dr(e.WebGLRenderingContext.prototype,ae.WebGL,t,r,n,o,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...dr(e.WebGL2RenderingContext.prototype,ae.WebGL2,t,r,n,o,e)),()=>{i.forEach(a=>a());}}var xt=null;try{pr=typeof module<"u"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof gt=="function"&&gt("worker_threads"),xt=pr.Worker;}catch{}var pr;function sn(t,e){return Buffer.from(t,"base64").toString("utf8")}function hr(t,e,r){var i=sn(t),a=i.indexOf(`
4
4
  `,10)+1,s=i.substring(a)+("");return function(l){return new xt(s,Object.assign({},l,{eval:true}))}}function an(t,e){var r=atob(t);return r}function ln(t,e,r){var i=an(t),a=i.indexOf(`
5
- `,10)+1,s=i.substring(a)+(""),c=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(c)}function fr(t,e,r){var n;return function(i){return n=n||ln(t),new Worker(n,i)}}var cn=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";function gr(){return cn}function mr(t,e,r){return gr()?hr(t):fr(t)}var vr=mr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3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AgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");var Ke=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=false,this.locked=false,this.processMutation=(c,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(l);};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=Nt(r,n,o),s=new Map,c=new vr;c.onmessage=p=>{let{id:v}=p.data;if(s.set(v,false),!("base64"in p.data))return;let{base64:S,type:y,width:g,height:m}=p.data;this.mutationCb({id:v,type:ae["2D"],commands:[{property:"clearRect",args:[0,0,g,m]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:y}]},0,0]}]});};let l=1e3/e,d=0,u,h=()=>{let p=[];return r.document.querySelectorAll("canvas").forEach(v=>{M(v,n,o,true)||p.push(v);}),p},f=p=>{if(d&&p-d<l){u=requestAnimationFrame(f);return}d=p,h().forEach(v=>ir(this,void 0,void 0,function*(){var S;let y=this.mirror.getId(v);if(s.get(y))return;if(s.set(y,true),["webgl","webgl2"].includes(v.__context)){let m=v.getContext(v.__context);((S=m?.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===false&&m?.clear(m.COLOR_BUFFER_BIT);}let g=yield createImageBitmap(v);c.postMessage({id:y,bitmap:g,width:v.width,height:v.height,dataURLOptions:i.dataURLOptions},[g]);})),u=requestAnimationFrame(f);};u=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(u);};}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Nt(e,r,n),i=cr(this.processMutation.bind(this),e,r,n),a=ur(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=>or(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((c,l)=>({rule:vt(c),index:l}))});}n.styleIds.push(a);}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(e){}};function D(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var R,je,Ot,Je=false,te=Ht();function me(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:a="rr-ignore",maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=true,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:h,maskInputFn:f,maskTextFn:p,hooks:v,packFn:S,sampling:y={},dataURLOptions:g={},mousemoveWait:m,recordCanvas:k=false,recordCrossOriginIframes:W=false,userTriggeredOnInput:F=false,collectFonts:B=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");m!==void 0&&y.mousemove===void 0&&(y.mousemove=m),te.reset();let O=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=h===true||h==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};Pt();let X,ne=0,se=I=>{for(let U of P||[])U.eventProcessor&&(I=U.eventProcessor(I));return S&&(I=S(I)),I};R=(I,U)=>{var _;if(!((_=de[0])===null||_===void 0)&&_.isFrozen()&&I.type!==b.FullSnapshot&&!(I.type===b.IncrementalSnapshot&&I.data.source===C.Mutation)&&de.forEach(T=>T.unfreeze()),Q)e?.(se(I),U);else if(q){let T={type:"rrweb",event:se(I),isCheckout:U};window.parent.postMessage(T,"*");}if(I.type===b.FullSnapshot)X=I,ne=0;else if(I.type===b.IncrementalSnapshot){if(I.data.source===C.Mutation&&I.data.isAttachIframe)return;ne++;let T=n&&ne>=n,j=r&&I.timestamp-X.timestamp>r;(T||j)&&je(true);}};let V=I=>{R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Mutation},I)}));},Y=I=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Scroll},I)})),le=I=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.CanvasMutation},I)})),x=I=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.AdoptedStyleSheet},I)})),$=new Ye({mutationCb:V,adoptedStyleSheetCb:x}),oe=new _e({mirror:te,mutationCb:V,stylesheetManager:$,recordCrossOriginIframes:W,wrappedEmit:R});for(let I of P||[])I.getMirror&&I.getMirror({nodeMirror:te,crossOriginIframeMirror:oe.crossOriginIframeMirror,crossOriginIframeStyleMirror:oe.crossOriginIframeStyleMirror});Ot=new Ke({recordCanvas:k,mutationCb:le,win:window,blockClass:o,blockSelector:i,mirror:te,sampling:y.canvas,dataURLOptions:g});let ve=new Ze({mutationCb:V,scrollCb:Y,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:O,dataURLOptions:g,maskTextFn:p,maskInputFn:f,recordCanvas:k,inlineImages:w,sampling:y,slimDOMOptions:K,iframeManager:oe,stylesheetManager:$,canvasManager:Ot,keepIframeSrcFn:z},mirror:te});je=(I=false)=>{var U,_,T,j,A,Z;R(D({type:b.Meta,data:{href:window.location.href,width:Le(),height:De()}}),I),$.reset(),de.forEach(H=>H.lock());let Ae=Vt(document,{mirror:te,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:O,maskTextFn:p,slimDOM:K,dataURLOptions:g,recordCanvas:k,inlineImages:w,onSerialize:H=>{Be(H,te)&&oe.addIframe(H),Ge(H,te)&&$.trackLinkElement(H),We(H)&&ve.addShadowRoot(H.shadowRoot,document);},onIframeLoad:(H,ft)=>{oe.attachIframe(H,ft),ve.observeAttachShadow(H);},onStylesheetLoad:(H,ft)=>{$.attachLinkElement(H,ft);},keepIframeSrcFn:z});if(!Ae)return console.warn("Failed to snapshot the document");R(D({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)||((Z=document?.body)===null||Z===void 0?void 0:Z.scrollTop)||0}}})),de.forEach(H=>H.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document));};try{let I=[];I.push(G("DOMContentLoaded",()=>{R(D({type:b.DomContentLoaded,data:{}}));}));let U=T=>{var j;return nr({mutationCb:V,mousemoveCb:(A,Z)=>R(D({type:b.IncrementalSnapshot,data:{source:Z,positions:A}})),mouseInteractionCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.MouseInteraction},A)})),scrollCb:Y,viewportResizeCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.ViewportResize},A)})),inputCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Input},A)})),mediaInteractionCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.MediaInteraction},A)})),styleSheetRuleCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.StyleSheetRule},A)})),styleDeclarationCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.StyleDeclaration},A)})),canvasMutationCb:le,fontCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Font},A)})),selectionCb:A=>{R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Selection},A)}));},blockClass:o,ignoreClass:a,maskTextClass:s,maskTextSelector:c,maskInputOptions:O,inlineStylesheet:l,sampling:y,recordCanvas:k,inlineImages:w,userTriggeredOnInput:F,collectFonts:B,doc:T,maskInputFn:f,maskTextFn:p,keepIframeSrcFn:z,blockSelector:i,slimDOMOptions:K,dataURLOptions:g,mirror:te,iframeManager:oe,stylesheetManager:$,shadowDomManager:ve,canvasManager:Ot,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:Z=>R(D({type:b.Plugin,data:{plugin:A.name,payload:Z}}))})))||[]},v)};oe.addLoadListener(T=>{I.push(U(T.contentDocument));});let _=()=>{je(),I.push(U(document)),Je=!0;};return document.readyState==="interactive"||document.readyState==="complete"?_():I.push(G("load",()=>{R(D({type:b.Load,data:{}})),_();},window)),()=>{I.forEach(T=>T()),Je=!1;}}catch(I){console.warn(I);}}me.addCustomEvent=(t,e)=>{if(!Je)throw new Error("please add custom event after start recording");R(D({type:b.Custom,data:{tag:t,payload:e}}));};me.freezePage=()=>{de.forEach(t=>t.freeze());};me.takeFullSnapshot=t=>{if(!Je)throw new Error("please take full snapshot after start recording");je(t);};me.mirror=te;var Qe=class{constructor(e,r,n){this.sessionId=e;this.emit=r;this.rrwebConfig=n;this.stopFn=null;}start(){this.stopFn=me({...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 dn=/ghostplay\.dev/;var 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(dn.test(o))return e.originalFetch.call(globalThis,r,n);let a=Date.now(),s=un(n?.headers),c=pn(n?.body);try{let l=await e.originalFetch.call(globalThis,r,n);if(e.active){let d={};l.headers.forEach((f,p)=>{d[p]=f;});let u;try{let f=l.headers.get("content-type")??"";if(f.includes("json")||f.includes("text")){let v=await l.clone().text();u=v.length>1048576?v.substring(0,1048576)+"...[truncated]":v;}}catch{}let h={method:i.toUpperCase(),url:o,status:l.status,statusText:l.statusText,requestHeaders:s,responseHeaders:d,requestBody:c,responseBody:u,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:h});}return l}catch(l){if(e.active){let d={method:i.toUpperCase(),url:o,requestHeaders:s,requestBody:c,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:d});}throw l}};}restoreFetch(){this.originalFetch&&(globalThis.fetch=this.originalFetch,this.originalFetch=null);}};function un(t){let e={};if(!t)return e;if(t instanceof Headers)t.forEach((r,n)=>{e[n]=r;});else if(Array.isArray(t))for(let[r,n]of t)e[r]=n;else for(let[r,n]of Object.entries(t))e[r]=n;return e}function pn(t){if(t){if(typeof t=="string")return t.length>1048576?t.substring(0,1048576)+"...[truncated]":t;if(t instanceof URLSearchParams)return t.toString()}}var Ir=["log","warn","error","info","debug"],$e=class{constructor(e,r){this.sessionId=e;this.emit=r;this.originals={};}start(){for(let e of Ir)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 Ir)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 hn={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]=hn[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 nt=class{constructor(e,r){this.sessionId=e;this.emit=r;this.currentUrl="";this.originalPushState=null;this.originalReplaceState=null;this.popstateHandler=null;this.hashchangeHandler=null;}start(){this.currentUrl=window.location.href,this.emitNavigation(null,this.currentUrl,"initial"),this.originalPushState=history.pushState.bind(history),history.pushState=(...e)=>{this.originalPushState(...e),this.handleUrlChange("pushState");},this.originalReplaceState=history.replaceState.bind(history),history.replaceState=(...e)=>{this.originalReplaceState(...e),this.handleUrlChange("replaceState");},this.popstateHandler=()=>this.handleUrlChange("popstate"),window.addEventListener("popstate",this.popstateHandler),this.hashchangeHandler=()=>this.handleUrlChange("hashchange"),window.addEventListener("hashchange",this.hashchangeHandler);}stop(){this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.hashchangeHandler&&(window.removeEventListener("hashchange",this.hashchangeHandler),this.hashchangeHandler=null);}handleUrlChange(e){let r=window.location.href;if(r!==this.currentUrl){let n=this.currentUrl;this.currentUrl=r,this.emitNavigation(n,r,e);}}emitNavigation(e,r,n){let o={from:e,to:r,trigger:n};this.emit({type:"navigation",timestamp:Date.now(),sessionId:this.sessionId,data:o});}};var fn=["set-cookie"],ot=class{constructor(e){this.options=e;}sanitizeNetworkEvent(e){let r={...e},n=this.options.networkSanitize;return r.responseHeaders&&(r.responseHeaders=this.filterHeaders(r.responseHeaders,fn)),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 it=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 gn="0.1.0",N=null,re=null,st=null,at=null,lt=null,ct=null,dt=null,ut=null,pt=null,ht=null,Dt=null,Re=null;function Lt(){if(!re)throw new Error("[Ghostplay] SDK not initialized. Call Ghostplay.init() first.")}function ie(t){pt&&t.type!=="rrweb"&&pt.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 mn(t){yr(),N=Bt(t),re=new Ne(N.projectId);let e=re.start();Dt=new ot({networkSanitize:N.networkSanitize}),Re=new it({apiUrl:N.apiUrl,projectId:N.projectId,sessionId:e.id,flushIntervalMs:N.flushIntervalMs,flushMaxBytes:N.flushMaxBytes}),Re.start(),pt=new rt,st=new Qe(e.id,ie,{maskAllInputs:N.maskAllInputs,...N.maskInputSelector?{maskInputSelector:N.maskInputSelector}:{},...N.blockSelector?{blockSelector:N.blockSelector}:{},...N.ignoreSelector?{ignoreSelector:N.ignoreSelector}:{},...N.rrwebConfig}),st.start(),at=new qe(e.id,ie),at.start(),N.recordNetwork&&(lt=new Xe(e.id,r=>{let n=Dt.sanitizeNetworkEvent(r.data);ie({...r,data:n});}),lt.start()),N.recordConsole&&(ct=new $e(e.id,ie),ct.start()),N.trackPerformance&&(dt=new et(e.id,ie),dt.start()),N.trackRageClicks&&(ut=new tt(e.id,ie),ut.start()),N.trackNavigation&&(ht=new nt(e.id,ie),ht.start());}function vn(t,e){Lt(),re.identify(t,e),ie({type:"identify",timestamp:Date.now(),sessionId:re.current().id,data:{userId:t,traits:e}});}function In(t){Lt(),re.addTag(t),ie({type:"tag",timestamp:Date.now(),sessionId:re.current().id,data:{tag:t}});}function yn(t){Lt(),re.setMetadata(t),ie({type:"metadata",timestamp:Date.now(),sessionId:re.current().id,data:t});}function yr(){st?.stop(),at?.stop(),lt?.stop(),ct?.stop(),dt?.stop(),ut?.stop(),ht?.stop(),Re?.stop(),re?.end(),st=null,at=null,lt=null,ct=null,dt=null,ut=null,ht=null,Re=null,re=null,pt=null,Dt=null,N=null;}var Cn={VERSION:gn,init:mn,identify:vn,tag:In,setMetadata:yn,stop:yr},pi=Cn;/*! Bundled license information:
5
+ `,10)+1,s=i.substring(a)+(""),c=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(c)}function fr(t,e,r){var n;return function(i){return n=n||ln(t),new Worker(n,i)}}var cn=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";function gr(){return cn}function mr(t,e,r){return gr()?hr(t):fr(t)}var vr=mr("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICA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c2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=");var Ke=class{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=false,this.locked=false,this.processMutation=(c,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(l);};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=Nt(r,n,o),s=new Map,c=new vr;c.onmessage=p=>{let{id:v}=p.data;if(s.set(v,false),!("base64"in p.data))return;let{base64:S,type:y,width:g,height:m}=p.data;this.mutationCb({id:v,type:ae["2D"],commands:[{property:"clearRect",args:[0,0,g,m]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:y}]},0,0]}]});};let l=1e3/e,d=0,u,h=()=>{let p=[];return r.document.querySelectorAll("canvas").forEach(v=>{M(v,n,o,true)||p.push(v);}),p},f=p=>{if(d&&p-d<l){u=requestAnimationFrame(f);return}d=p,h().forEach(v=>ir(this,void 0,void 0,function*(){var S;let y=this.mirror.getId(v);if(s.get(y))return;if(s.set(y,true),["webgl","webgl2"].includes(v.__context)){let m=v.getContext(v.__context);((S=m?.getContextAttributes())===null||S===void 0?void 0:S.preserveDrawingBuffer)===false&&m?.clear(m.COLOR_BUFFER_BIT);}let g=yield createImageBitmap(v);c.postMessage({id:y,bitmap:g,width:v.width,height:v.height,dataURLOptions:i.dataURLOptions},[g]);})),u=requestAnimationFrame(f);};u=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(u);};}initCanvasMutationObserver(e,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Nt(e,r,n),i=cr(this.processMutation.bind(this),e,r,n),a=ur(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=>or(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((c,l)=>({rule:vt(c),index:l}))});}n.styleIds.push(a);}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n);}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet;}trackStylesheetInLinkElement(e){}};function D(t){return Object.assign(Object.assign({},t),{timestamp:Date.now()})}var R,je,Ot,Je=false,te=Ht();function me(t={}){let{emit:e,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:a="rr-ignore",maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:l=true,maskAllInputs:d,maskInputOptions:u,slimDOMOptions:h,maskInputFn:f,maskTextFn:p,hooks:v,packFn:S,sampling:y={},dataURLOptions:g={},mousemoveWait:m,recordCanvas:k=false,recordCrossOriginIframes:W=false,userTriggeredOnInput:L=false,collectFonts:B=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");m!==void 0&&y.mousemove===void 0&&(y.mousemove=m),te.reset();let O=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=h===true||h==="all"?{script:true,comment:true,headFavicon:true,headWhitespace:true,headMetaSocial:true,headMetaRobots:true,headMetaHttpEquiv:true,headMetaVerification:true,headMetaAuthorship:h==="all",headMetaDescKeywords:h==="all"}:h||{};Pt();let X,ne=0,se=I=>{for(let U of P||[])U.eventProcessor&&(I=U.eventProcessor(I));return S&&(I=S(I)),I};R=(I,U)=>{var _;if(!((_=de[0])===null||_===void 0)&&_.isFrozen()&&I.type!==b.FullSnapshot&&!(I.type===b.IncrementalSnapshot&&I.data.source===C.Mutation)&&de.forEach(T=>T.unfreeze()),Q)e?.(se(I),U);else if(q){let T={type:"rrweb",event:se(I),isCheckout:U};window.parent.postMessage(T,"*");}if(I.type===b.FullSnapshot)X=I,ne=0;else if(I.type===b.IncrementalSnapshot){if(I.data.source===C.Mutation&&I.data.isAttachIframe)return;ne++;let T=n&&ne>=n,j=r&&I.timestamp-X.timestamp>r;(T||j)&&je(true);}};let V=I=>{R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Mutation},I)}));},Y=I=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Scroll},I)})),le=I=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.CanvasMutation},I)})),x=I=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.AdoptedStyleSheet},I)})),$=new Ye({mutationCb:V,adoptedStyleSheetCb:x}),oe=new _e({mirror:te,mutationCb:V,stylesheetManager:$,recordCrossOriginIframes:W,wrappedEmit:R});for(let I of P||[])I.getMirror&&I.getMirror({nodeMirror:te,crossOriginIframeMirror:oe.crossOriginIframeMirror,crossOriginIframeStyleMirror:oe.crossOriginIframeStyleMirror});Ot=new Ke({recordCanvas:k,mutationCb:le,win:window,blockClass:o,blockSelector:i,mirror:te,sampling:y.canvas,dataURLOptions:g});let ve=new Ze({mutationCb:V,scrollCb:Y,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskInputOptions:O,dataURLOptions:g,maskTextFn:p,maskInputFn:f,recordCanvas:k,inlineImages:w,sampling:y,slimDOMOptions:K,iframeManager:oe,stylesheetManager:$,canvasManager:Ot,keepIframeSrcFn:z},mirror:te});je=(I=false)=>{var U,_,T,j,A,Z;R(D({type:b.Meta,data:{href:window.location.href,width:Fe(),height:De()}}),I),$.reset(),de.forEach(H=>H.lock());let Ae=Vt(document,{mirror:te,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:c,inlineStylesheet:l,maskAllInputs:O,maskTextFn:p,slimDOM:K,dataURLOptions:g,recordCanvas:k,inlineImages:w,onSerialize:H=>{Be(H,te)&&oe.addIframe(H),Ge(H,te)&&$.trackLinkElement(H),We(H)&&ve.addShadowRoot(H.shadowRoot,document);},onIframeLoad:(H,ft)=>{oe.attachIframe(H,ft),ve.observeAttachShadow(H);},onStylesheetLoad:(H,ft)=>{$.attachLinkElement(H,ft);},keepIframeSrcFn:z});if(!Ae)return console.warn("Failed to snapshot the document");R(D({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)||((Z=document?.body)===null||Z===void 0?void 0:Z.scrollTop)||0}}})),de.forEach(H=>H.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&$.adoptStyleSheets(document.adoptedStyleSheets,te.getId(document));};try{let I=[];I.push(G("DOMContentLoaded",()=>{R(D({type:b.DomContentLoaded,data:{}}));}));let U=T=>{var j;return nr({mutationCb:V,mousemoveCb:(A,Z)=>R(D({type:b.IncrementalSnapshot,data:{source:Z,positions:A}})),mouseInteractionCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.MouseInteraction},A)})),scrollCb:Y,viewportResizeCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.ViewportResize},A)})),inputCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Input},A)})),mediaInteractionCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.MediaInteraction},A)})),styleSheetRuleCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.StyleSheetRule},A)})),styleDeclarationCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.StyleDeclaration},A)})),canvasMutationCb:le,fontCb:A=>R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Font},A)})),selectionCb:A=>{R(D({type:b.IncrementalSnapshot,data:Object.assign({source:C.Selection},A)}));},blockClass:o,ignoreClass:a,maskTextClass:s,maskTextSelector:c,maskInputOptions:O,inlineStylesheet:l,sampling:y,recordCanvas:k,inlineImages:w,userTriggeredOnInput:L,collectFonts:B,doc:T,maskInputFn:f,maskTextFn:p,keepIframeSrcFn:z,blockSelector:i,slimDOMOptions:K,dataURLOptions:g,mirror:te,iframeManager:oe,stylesheetManager:$,shadowDomManager:ve,canvasManager:Ot,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:Z=>R(D({type:b.Plugin,data:{plugin:A.name,payload:Z}}))})))||[]},v)};oe.addLoadListener(T=>{I.push(U(T.contentDocument));});let _=()=>{je(),I.push(U(document)),Je=!0;};return document.readyState==="interactive"||document.readyState==="complete"?_():I.push(G("load",()=>{R(D({type:b.Load,data:{}})),_();},window)),()=>{I.forEach(T=>T()),Je=!1;}}catch(I){console.warn(I);}}me.addCustomEvent=(t,e)=>{if(!Je)throw new Error("please add custom event after start recording");R(D({type:b.Custom,data:{tag:t,payload:e}}));};me.freezePage=()=>{de.forEach(t=>t.freeze());};me.takeFullSnapshot=t=>{if(!Je)throw new Error("please take full snapshot after start recording");je(t);};me.mirror=te;var Qe=class{constructor(e,r,n){this.sessionId=e;this.emit=r;this.rrwebConfig=n;this.stopFn=null;}start(){this.stopFn=me({...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 dn=/ghostplay\.dev/;var 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(dn.test(o))return e.originalFetch.call(globalThis,r,n);let a=Date.now(),s=un(n?.headers),c=pn(n?.body);try{let l=await e.originalFetch.call(globalThis,r,n);if(e.active){let d={};l.headers.forEach((f,p)=>{d[p]=f;});let u;try{let f=l.headers.get("content-type")??"";if(f.includes("json")||f.includes("text")){let v=await l.clone().text();u=v.length>1048576?v.substring(0,1048576)+"...[truncated]":v;}}catch{}let h={method:i.toUpperCase(),url:o,status:l.status,statusText:l.statusText,requestHeaders:s,responseHeaders:d,requestBody:c,responseBody:u,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:h});}return l}catch(l){if(e.active){let d={method:i.toUpperCase(),url:o,requestHeaders:s,requestBody:c,startTime:a,endTime:Date.now(),duration:Date.now()-a};e.emit({type:"network",timestamp:a,sessionId:e.sessionId,data:d});}throw l}};}restoreFetch(){this.originalFetch&&(globalThis.fetch=this.originalFetch,this.originalFetch=null);}};function un(t){let e={};if(!t)return e;if(t instanceof Headers)t.forEach((r,n)=>{e[n]=r;});else if(Array.isArray(t))for(let[r,n]of t)e[r]=n;else for(let[r,n]of Object.entries(t))e[r]=n;return e}function pn(t){if(t){if(typeof t=="string")return t.length>1048576?t.substring(0,1048576)+"...[truncated]":t;if(t instanceof URLSearchParams)return t.toString()}}var Ir=["log","warn","error","info","debug"],$e=class{constructor(e,r){this.sessionId=e;this.emit=r;this.originals={};}start(){for(let e of Ir)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 Ir)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 hn={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]=hn[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 nt=class{constructor(e,r){this.sessionId=e;this.emit=r;this.currentUrl="";this.originalPushState=null;this.originalReplaceState=null;this.popstateHandler=null;this.hashchangeHandler=null;}start(){this.currentUrl=window.location.href,this.emitNavigation(null,this.currentUrl,"initial"),this.originalPushState=history.pushState.bind(history),history.pushState=(...e)=>{this.originalPushState(...e),this.handleUrlChange("pushState");},this.originalReplaceState=history.replaceState.bind(history),history.replaceState=(...e)=>{this.originalReplaceState(...e),this.handleUrlChange("replaceState");},this.popstateHandler=()=>this.handleUrlChange("popstate"),window.addEventListener("popstate",this.popstateHandler),this.hashchangeHandler=()=>this.handleUrlChange("hashchange"),window.addEventListener("hashchange",this.hashchangeHandler);}stop(){this.originalPushState&&(history.pushState=this.originalPushState,this.originalPushState=null),this.originalReplaceState&&(history.replaceState=this.originalReplaceState,this.originalReplaceState=null),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.hashchangeHandler&&(window.removeEventListener("hashchange",this.hashchangeHandler),this.hashchangeHandler=null);}handleUrlChange(e){let r=window.location.href;if(r!==this.currentUrl){let n=this.currentUrl;this.currentUrl=r,this.emitNavigation(n,r,e);}}emitNavigation(e,r,n){let o={from:e,to:r,trigger:n};this.emit({type:"navigation",timestamp:Date.now(),sessionId:this.sessionId,data:o});}};var fn=["set-cookie"],ot=class{constructor(e){this.options=e;}sanitizeNetworkEvent(e){let r={...e},n=this.options.networkSanitize;return r.responseHeaders&&(r.responseHeaders=this.filterHeaders(r.responseHeaders,fn)),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 it=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}).then(a=>{a.ok||console.warn(`[Ghostplay] Event batch rejected (${a.status})`);}).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 gn="0.1.0",N=null,re=null,st=null,at=null,lt=null,ct=null,dt=null,ut=null,pt=null,ht=null,Dt=null,Re=null;function Ft(){if(!re)throw new Error("[Ghostplay] SDK not initialized. Call Ghostplay.init() first.")}function ie(t){pt&&t.type!=="rrweb"&&pt.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 mn(t){yr(),N=Bt(t),re=new Ne(N.projectId);let e=re.start();Dt=new ot({networkSanitize:N.networkSanitize}),Re=new it({apiUrl:N.apiUrl,projectId:N.projectId,sessionId:e.id,flushIntervalMs:N.flushIntervalMs,flushMaxBytes:N.flushMaxBytes}),Re.start(),pt=new rt,st=new Qe(e.id,ie,{maskAllInputs:N.maskAllInputs,...N.maskInputSelector?{maskInputSelector:N.maskInputSelector}:{},...N.blockSelector?{blockSelector:N.blockSelector}:{},...N.ignoreSelector?{ignoreSelector:N.ignoreSelector}:{},...N.rrwebConfig});let r=()=>st?.start();document.readyState==="complete"?requestAnimationFrame(()=>requestAnimationFrame(r)):window.addEventListener("load",()=>requestAnimationFrame(r),{once:true}),at=new qe(e.id,ie),at.start(),N.recordNetwork&&(lt=new Xe(e.id,n=>{let o=Dt.sanitizeNetworkEvent(n.data);ie({...n,data:o});}),lt.start()),N.recordConsole&&(ct=new $e(e.id,ie),ct.start()),N.trackPerformance&&(dt=new et(e.id,ie),dt.start()),N.trackRageClicks&&(ut=new tt(e.id,ie),ut.start()),N.trackNavigation&&(ht=new nt(e.id,ie),ht.start());}function vn(t,e){Ft(),re.identify(t,e),ie({type:"identify",timestamp:Date.now(),sessionId:re.current().id,data:{userId:t,traits:e}});}function In(t){Ft(),re.addTag(t),ie({type:"tag",timestamp:Date.now(),sessionId:re.current().id,data:{tag:t}});}function yn(t){Ft(),re.setMetadata(t),ie({type:"metadata",timestamp:Date.now(),sessionId:re.current().id,data:t});}function yr(){st?.stop(),at?.stop(),lt?.stop(),ct?.stop(),dt?.stop(),ut?.stop(),ht?.stop(),Re?.stop(),re?.end(),st=null,at=null,lt=null,ct=null,dt=null,ut=null,ht=null,Re=null,re=null,pt=null,Dt=null,N=null;}var Cn={VERSION:gn,init:mn,identify:vn,tag:In,setMetadata:yn,stop:yr},pi=Cn;/*! Bundled license information:
6
6
 
7
7
  rrweb/es/rrweb/ext/tslib/tslib.es6.js:
8
8
  (*! *****************************************************************************