@replayd/core 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capacitor.js +1 -1
- package/dist/capacitor.js.map +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/replay.js +3 -3
- package/dist/replay.js.map +4 -4
- package/dist/replayd.min.js +1 -1
- package/dist/replayd.min.js.map +1 -1
- package/dist/types/errors.d.ts +12 -0
- package/dist/types/idb.d.ts +2 -0
- package/dist/types/index.d.ts +10 -4
- package/dist/types/ring.d.ts +2 -0
- package/dist/types/seg.d.ts +33 -0
- package/dist/types/session.d.ts +5 -1
- package/dist/types/types.d.ts +52 -3
- package/dist/worker.js +1 -1
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
package/dist/replay.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var yr=Object.defineProperty,br=(e,t,r)=>t in e?yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t,r)=>br(e,typeof t!="symbol"?t+"":t,r),Et,E=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(E||{}),O=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(O||{}),K=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(K||{}),ce=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ce||{}),Ee=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ee||{}),ve=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(ve||{}),H=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(H||{}),Ot={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Tt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},_e={},ct={},xt=0,Sr=()=>!!globalThis.Zone;function It(e){if(_e[e])return _e[e];let t=globalThis[e],r=t.prototype,n=e in Ot?Ot[e]:void 0,o=!!(n&&n.every(c=>{var i,u;return!!((u=(i=Object.getOwnPropertyDescriptor(r,c))==null?void 0:i.get)!=null&&u.toString().includes("[native code]"))})),s=e in Tt?Tt[e]:void 0,a=!!(s&&s.every(c=>{var i;return typeof r[c]=="function"&&((i=r[c])==null?void 0:i.toString().includes("[native code]"))}));if(o&&a&&!Sr())return _e[e]=t.prototype,t.prototype;try{let c=document.createElement("iframe");c.style.display="none",document.body.appendChild(c);let i=c.contentWindow;if(!i)return t.prototype;let u=i[e].prototype;if(!u)return c.remove(),r;let d=navigator.userAgent;return d.includes("Safari")&&!d.includes("Chrome")?(c.classList.add("rr-block"),c.setAttribute("__rrwebUntaintedMutationObserver",""),ct[e]=()=>c.remove()):c.remove(),_e[e]=u}catch{return r}}var st={};function te(e,t,r){var n,o;let s=(n=st[e])==null?void 0:n[r];if(s)return s.call(t);let a=It(e),c=(o=Object.getOwnPropertyDescriptor(a,r))==null?void 0:o.get;return c?((st[e]||(st[e]={}))[r]=c,c.call(t)):t[r]}var it={};function Gt(e,t,r){let n=`${e}.${String(r)}`;if(it[n])return it[n].bind(t);let s=It(e)[r];return typeof s!="function"?t[r]:(it[n]=s,s.bind(t))}function wr(e){return te("Node",e,"ownerDocument")}function Cr(e){return te("Node",e,"childNodes")}function vr(e){return te("Node",e,"parentNode")}function Mr(e){return te("Node",e,"parentElement")}function Ir(e){return te("Node",e,"textContent")}function Rr(e){return te("Node",e,"firstChild")}function kr(e){return te("Node",e,"lastChild")}function Nr(e){return te("Node",e,"nextSibling")}function Er(e){return te("Node",e,"previousSibling")}function Or(e,t){return Gt("Node",e,"contains")(t)}function Tr(e){return Gt("Node",e,"getRootNode")()}function xr(e){return!e||!("host"in e)?null:te("ShadowRoot",e,"host")}function Lr(e){return e.styleSheets}function Dr(e){return!e||!("shadowRoot"in e)?null:te("Element",e,"shadowRoot")}function Ar(e,t){return te("Element",e,"querySelector")(t)}function _r(e,t){return te("Element",e,"querySelectorAll")(t)}function jt(){let e=It("MutationObserver");xt++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--xt!==0))return;let r=ct.MutationObserver;if(r)try{r()}finally{delete _e.MutationObserver,delete ct.MutationObserver}}]}var Ue=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ue=()=>new Date().getTime());function ge(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var C={ownerDocument:wr,childNodes:Cr,parentNode:vr,parentElement:Mr,textContent:Ir,firstChild:Rr,lastChild:kr,nextSibling:Nr,previousSibling:Er,contains:Or,getRootNode:Tr,host:xr,styleSheets:Lr,shadowRoot:Dr,querySelector:Ar,querySelectorAll:_r,nowTimestamp:Ue,mutationObserverCtor:jt,patch:ge};function qt(e){return e.nodeType===e.ELEMENT_NODE}function Fe(e){let t=e&&"host"in e&&"mode"in e&&C.host(e)||null;return!!(t&&"shadowRoot"in t&&C.shadowRoot(t)===e)}function Pe(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Fr(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Pr(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function dt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,o=>Vt(o,r)).join("");return Fr(n)}catch{return null}}function Vt(e,t){if(Ur(e)){let r;try{r=dt(e.styleSheet)||Pr(e)}catch{r=e.cssText}return e.styleSheet.href?Qe(r,e.styleSheet.href):r}else{let r=e.cssText;return Br(e)&&e.selectorText.includes(":")&&(r=Wr(r)),t?Qe(r,t):r}}function Wr(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Ur(e){return"styleSheet"in e}function Br(e){return"selectorText"in e}var Ye=class{constructor(){g(this,"idNodeMap",new Map),g(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(o=>this.removeNodeFromMap(o));let n=C.shadowRoot(t);n&&this.removeNodeFromMap(n)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Hr(){return new Ye}function Je({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:s}){let a=o||"",c=n&&fe(n);return(t[r.toLowerCase()]||c&&t[c])&&(s?a=s(a,e):a="*".repeat(a.length)),a}function fe(e){return e.toLowerCase()}var Lt="__rrweb_original__";function zr(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let s=t.getImageData,a=Lt in s?s[Lt]:s;if(new Uint32Array(a.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(i=>i!==0))return!1}return!0}function Ze(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?fe(t):null}function $t(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,o=r.pathname.match(n);return o?.[1]??null}function Gr(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var jr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,qr=/^(?:[a-z+]+:)?\/\//i,Vr=/^www\..*/i,$r=/^(data:)([^,]*),(.*)/i;function Qe(e,t){return(e||"").replace(jr,(r,n,o,s,a,c)=>{let i=o||a||c,u=n||s||"";if(!i)return r;if(qr.test(i)||Vr.test(i))return`url(${u}${i}${u})`;if($r.test(i))return`url(${u}${i}${u})`;if(i[0]==="/")return`url(${u}${Gr(t)+i}${u})`;let d=i.split("#")[0],h=i.substring(d.length),p=t.split("#")[0].split("/"),f=d.split("/");p.pop();for(let m of f)m!=="."&&(m===".."?p.pop():p.push(m));return`url(${u}${p.join("/")}${h}${u})`})}var Xt="(?:/\\*[^*]*\\*/)|[\\s;]",Xr=new RegExp(`${Xt}|\\b(0)px?`,"g"),Yr=new RegExp(Xt,"g");function je(e,t=!1){return t?e.replace(Yr,""):e.replace(Xr,"$1")}function Jr(e,t,r=!1){let n=Array.from(t.childNodes),o=[],s=0;if(n.length>1&&e&&typeof e=="string"){let a=je(e,r),c=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){let u=je(n[i].textContent,r),d=100,h=3;for(;h<u.length&&(u[h].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,h),1)!==-1);h++);for(;h<u.length;h++){let p=u.substring(0,h),f=a.split(p),m=-1;if(f.length===2)m=f[0].length;else if(f.length>2&&f[0]===""&&n[i-1].textContent!=="")m=a.indexOf(p,1);else if(f.length===1){if(p=p.substring(0,p.length-1),f=a.split(p),f.length<=1)return o.push(e),o;h=d+1}else h===u.length-1&&(m=a.indexOf(p));if(f.length>=2&&h>d){let l=n[i-1].textContent;if(l&&typeof l=="string"){let S=je(l).length;m=a.indexOf(p,S)}m===-1&&(m=f[0].length)}if(m!==-1){let l=Math.floor(m/c);for(;l>0&&l<e.length;){if(s+=1,s>50*n.length)return o.push(e),o;let S=je(e.substring(0,l),r);if(S.length===m){o.push(e.substring(0,l)),e=e.substring(l),a=a.substring(m);break}else S.length<m?l+=Math.max(1,Math.floor((m-S.length)/c)):l-=Math.max(1,Math.floor((S.length-m)*c))}break}}}}return o.push(e),o}function Zr(e,t){return Jr(e,t).join("/* rr_split */")}var Qr=1,Kr=new RegExp("[^a-z0-9-_:]"),Ke=-2;function Yt(){return Qr++}function en(e){if(e instanceof HTMLFormElement)return"form";let t=fe(e.tagName);return Kr.test(t)?"div":t}var Ce,Dt,tn=/^[^ \t\n\r\u000c]+/,rn=/^[, \t\n\r\u000c]+/;function nn(e,t){if(t.trim()==="")return t;let r=0;function n(s){let a,c=s.exec(t.substring(r));return c?(a=c[0],r+=a.length,a):""}let o=[];for(;n(rn),!(r>=t.length);){let s=n(tn);if(s.slice(-1)===",")s=Ie(e,s.substring(0,s.length-1)),o.push(s);else{let a="";s=Ie(e,s);let c=!1;for(;;){let i=t.charAt(r);if(i===""){o.push((s+a).trim());break}else if(c)i===")"&&(c=!1);else if(i===","){r+=1,o.push((s+a).trim());break}else i==="("&&(c=!0);a+=i,r+=1}}}return o.join(", ")}var At=new WeakMap;function Ie(e,t){return!t||t.trim()===""?t:Rt(e,t)}function on(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Rt(e,t){let r=At.get(e);if(r||(r=e.createElement("a"),At.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Jt(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Ie(e,n):r==="srcset"?nn(e,n):r==="style"?Qe(n,Rt(e)):t==="object"&&r==="data"?Ie(e,n):n)}function Zt(e,t,r){return["video","audio"].includes(e)&&fe(t)==="autoplay"}function sn(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}if(r)return e.matches(r)}catch{}return!1}function et(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?et(C.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}return r?et(C.parentNode(e),t,r):!1}function Qt(e,t,r,n){let o;if(qt(e)){if(o=e,!C.childNodes(o).length)return!1}else{if(C.parentElement(e)===null)return!1;o=C.parentElement(e)}try{if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(et(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}}catch{}return!1}function an(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,s;try{s=n.document.readyState}catch{return}if(s!=="complete"){let c=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(c),o=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function ln(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let s=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),n=!0,t()})}function cn(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:c,maskInputOptions:i={},maskTextFn:u,maskInputFn:d,dataURLOptions:h={},inlineImages:p,recordCanvas:f,keepIframeSrcFn:m,newlyAddedElement:l=!1,cssCaptured:S=!1}=t,v=dn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:H.Document,childNodes:[],compatMode:e.compatMode}:{type:H.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:H.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return hn(e,{doc:r,blockClass:o,blockSelector:s,inlineStylesheet:c,maskInputOptions:i,maskInputFn:d,dataURLOptions:h,inlineImages:p,recordCanvas:f,keepIframeSrcFn:m,newlyAddedElement:l,rootId:v});case e.TEXT_NODE:return un(e,{doc:r,needsMask:a,maskTextFn:u,rootId:v,cssCaptured:S});case e.CDATA_SECTION_NODE:return{type:H.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:H.Comment,textContent:C.textContent(e)||"",rootId:v};default:return!1}}function dn(e,t){let r=t.getId(e);return r===-1||r===1?void 0:r}function un(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:s}=t,a=C.parentNode(e),c=a&&a.tagName,i="",u=c==="STYLE"?!0:void 0,d=c==="SCRIPT"?!0:void 0;return d?i="SCRIPT_PLACEHOLDER":s||(i=C.textContent(e),u&&i&&(i=Qe(i,Rt(t.doc)))),!u&&!d&&i&&r&&(i=n?n(i,C.parentElement(e)):i.replace(/[\S]/g,"*")),{type:H.Text,textContent:i||"",rootId:o}}function hn(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:c,dataURLOptions:i={},inlineImages:u,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:f}=t,m=sn(e,n,o),l=en(e),S={},v=e.attributes.length;for(let y=0;y<v;y++){let R=e.attributes[y];Zt(l,R.name,R.value)||(S[R.name]=Jt(r,l,fe(R.name),R.value))}if(l==="link"&&s){let y=Array.from(r.styleSheets).find(D=>D.href===e.href),R=null;y&&(R=dt(y)),R&&(delete S.rel,delete S.href,S._cssText=R)}if(l==="style"&&e.sheet){let y=dt(e.sheet);y&&(e.childNodes.length>1&&(y=Zr(y,e)),S._cssText=y)}if(["input","textarea","select"].includes(l)){let y=e.value,R=e.checked;S.type!=="radio"&&S.type!=="checkbox"&&S.type!=="submit"&&S.type!=="button"&&y?S.value=Je({element:e,type:Ze(e),tagName:l,value:y,maskInputOptions:a,maskInputFn:c}):R&&(S.checked=R)}if(l==="option"&&(e.selected&&!a.select?S.selected=!0:delete S.selected),l==="dialog"&&e.open&&(S.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),l==="canvas"&&d){if(e.__context==="2d")zr(e)||(S.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){let y=e.toDataURL(i.type,i.quality),R=r.createElement("canvas");R.width=e.width,R.height=e.height;let D=R.toDataURL(i.type,i.quality);y!==D&&(S.rr_dataURL=y)}}if(l==="img"&&u){Ce||(Ce=r.createElement("canvas"),Dt=Ce.getContext("2d"));let y=e,R=y.currentSrc||y.getAttribute("src")||"<unknown-src>",D=y.crossOrigin,F=()=>{y.removeEventListener("load",F);try{Ce.width=y.naturalWidth,Ce.height=y.naturalHeight,Dt.drawImage(y,0,0),S.rr_dataURL=Ce.toDataURL(i.type,i.quality)}catch(z){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?F():y.addEventListener("load",F);return}else console.warn(`Cannot inline img src=${R}! Error: ${z}`)}y.crossOrigin==="anonymous"&&(D?S.crossOrigin=D:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?F():y.addEventListener("load",F)}if(["audio","video"].includes(l)){let y=S;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(S.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(S.rr_scrollTop=e.scrollTop)),m){let{width:y,height:R}=e.getBoundingClientRect();S={class:S.class,rr_width:`${y}px`,rr_height:`${R}px`}}l==="iframe"&&!h(S.src)&&(e.contentDocument||(S.rr_src=S.src),delete S.src);let M;try{customElements.get(l)&&(M=!0)}catch{}return{type:H.Element,tagName:l,attributes:S,childNodes:[],isSVG:on(e)||void 0,needBlock:m,rootId:f,isCustom:M}}function _(e){return e==null?"":e.toLowerCase()}function Kt(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function fn(e,t){if(t.comment&&e.type===H.Comment)return!0;if(e.type===H.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&$t(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(_(e.attributes.name).match(/^msapplication-tile(image|color)$/)||_(e.attributes.name)==="application-name"||_(e.attributes.rel)==="icon"||_(e.attributes.rel)==="apple-touch-icon"||_(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&_(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(_(e.attributes.property).match(/^(og|twitter|fb):/)||_(e.attributes.name).match(/^(og|twitter):/)||_(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(_(e.attributes.name)==="robots"||_(e.attributes.name)==="googlebot"||_(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(_(e.attributes.name)==="author"||_(e.attributes.name)==="generator"||_(e.attributes.name)==="framework"||_(e.attributes.name)==="publisher"||_(e.attributes.name)==="progid"||_(e.attributes.property).match(/^article:/)||_(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(_(e.attributes.name)==="google-site-verification"||_(e.attributes.name)==="yandex-verification"||_(e.attributes.name)==="csrf-token"||_(e.attributes.name)==="p:domain_verify"||_(e.attributes.name)==="verify-v1"||_(e.attributes.name)==="verification"||_(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Re(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:i=!1,inlineStylesheet:u=!0,maskInputOptions:d={},maskTextFn:h,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m={},inlineImages:l=!1,recordCanvas:S=!1,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:y=5e3,onStylesheetLoad:R,stylesheetLoadTimeout:D=5e3,keepIframeSrcFn:F=()=>!1,newlyAddedElement:z=!1,cssCaptured:Y=!1}=t,{needsMask:$}=t,{preserveWhiteSpace:V=!0}=t;$||($=Qt(e,a,c,$===void 0));let J=cn(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:$,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,dataURLOptions:m,inlineImages:l,recordCanvas:S,keepIframeSrcFn:F,newlyAddedElement:z,cssCaptured:Y});if(!J)return console.warn(e,"not serialized"),null;let Z;n.hasNode(e)?Z=n.getId(e):fn(J,f)||!V&&J.type===H.Text&&!J.textContent.replace(/^\s+|\s+$/gm,"").length?Z=Ke:Z=Yt();let k=J;if(k.id=Z,n.add(e,k),Z===Ke)return null;v&&v(e);let de=!i;if(k.type===H.Element){de=de&&!k.needBlock,delete k.needBlock;let U=C.shadowRoot(e);U&&Pe(U)&&(k.isShadowHost=!0)}if((k.type===H.Document||k.type===H.Element)&&de){f.headWhitespace&&k.type===H.Element&&k.tagName==="head"&&(V=!1);let U={doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:$,maskTextClass:a,maskTextSelector:c,skipChild:i,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:S,preserveWhiteSpace:V,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:y,onStylesheetLoad:R,stylesheetLoadTimeout:D,keepIframeSrcFn:F,cssCaptured:!1};if(!(k.type===H.Element&&k.tagName==="textarea"&&k.attributes.value!==void 0)){k.type===H.Element&&k.attributes._cssText!==void 0&&typeof k.attributes._cssText=="string"&&(U.cssCaptured=!0);for(let se of Array.from(C.childNodes(e))){let ee=Re(se,U);ee&&k.childNodes.push(ee)}}let G=null;if(qt(e)&&(G=C.shadowRoot(e)))for(let se of Array.from(C.childNodes(G))){let ee=Re(se,U);ee&&(Pe(G)&&(ee.isShadow=!0),k.childNodes.push(ee))}}let oe=C.parentNode(e);return oe&&Fe(oe)&&Pe(oe)&&(k.isShadow=!0),k.type===H.Element&&k.tagName==="iframe"&&an(e,()=>{let U=e.contentDocument;if(U&&M){let G=Re(U,{doc:U,mirror:n,blockClass:o,blockSelector:s,needsMask:$,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:S,preserveWhiteSpace:V,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:y,onStylesheetLoad:R,stylesheetLoadTimeout:D,keepIframeSrcFn:F});G&&M(e,G)}},y),k.type===H.Element&&k.tagName==="link"&&typeof k.attributes.rel=="string"&&(k.attributes.rel==="stylesheet"||k.attributes.rel==="preload"&&typeof k.attributes.href=="string"&&$t(k.attributes.href)==="css")&&ln(e,()=>{if(R){let U=Re(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:$,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:u,maskInputOptions:d,maskTextFn:h,maskInputFn:p,slimDOMOptions:f,dataURLOptions:m,inlineImages:l,recordCanvas:S,preserveWhiteSpace:V,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:y,onStylesheetLoad:R,stylesheetLoadTimeout:D,keepIframeSrcFn:F});U&&R(e,U)}},D),k}function pn(e,t){let{mirror:r=new Ye,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:c=!0,inlineImages:i=!1,recordCanvas:u=!1,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:p,slimDOM:f=!1,dataURLOptions:m,preserveWhiteSpace:l,onSerialize:S,onIframeLoad:v,iframeLoadTimeout:M,onStylesheetLoad:y,stylesheetLoadTimeout:R,keepIframeSrcFn:D=()=>!1}=t,F=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:d===!1?{password:!0}:d,z=Kt(f);return Re(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:F,maskTextFn:h,maskInputFn:p,slimDOMOptions:z,dataURLOptions:m,inlineImages:i,recordCanvas:u,preserveWhiteSpace:l,onSerialize:S,onIframeLoad:v,iframeLoadTimeout:M,onStylesheetLoad:y,stylesheetLoadTimeout:R,keepIframeSrcFn:D,newlyAddedElement:!1})}var ut=class e{constructor(...t){g(this,"parentElement",null),g(this,"parentNode",null),g(this,"ownerDocument"),g(this,"firstChild",null),g(this,"lastChild",null),g(this,"previousSibling",null),g(this,"nextSibling",null),g(this,"ELEMENT_NODE",1),g(this,"TEXT_NODE",3),g(this,"nodeType"),g(this,"nodeName"),g(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function q(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Me=`Please stop import mirror directly. Instead of that,\r
|
|
1
|
+
var $r=Object.defineProperty,Gr=(e,t,r)=>t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,y=(e,t,r)=>Gr(e,typeof t!="symbol"?t+"":t,r),Xt,E=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e))(E||{}),O=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(O||{}),ae=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(ae||{}),ge=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ge||{}),Ue=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ue||{}),Le=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(Le||{}),G=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(G||{}),Yt={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Zt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},qe={},It={},Kt=0,Vr=()=>!!globalThis.Zone;function Ut(e){if(qe[e])return qe[e];let t=globalThis[e],r=t.prototype,n=e in Yt?Yt[e]:void 0,s=!!(n&&n.every(l=>{var i,u;return!!((u=(i=Object.getOwnPropertyDescriptor(r,l))==null?void 0:i.get)!=null&&u.toString().includes("[native code]"))})),o=e in Zt?Zt[e]:void 0,a=!!(o&&o.every(l=>{var i;return typeof r[l]=="function"&&((i=r[l])==null?void 0:i.toString().includes("[native code]"))}));if(s&&a&&!Vr())return qe[e]=t.prototype,t.prototype;try{let l=document.createElement("iframe");l.style.display="none",document.body.appendChild(l);let i=l.contentWindow;if(!i)return t.prototype;let u=i[e].prototype;if(!u)return l.remove(),r;let f=navigator.userAgent;return f.includes("Safari")&&!f.includes("Chrome")?(l.classList.add("rr-block"),l.setAttribute("__rrwebUntaintedMutationObserver",""),It[e]=()=>l.remove()):l.remove(),qe[e]=u}catch{return r}}var wt={};function ue(e,t,r){var n,s;let o=(n=wt[e])==null?void 0:n[r];if(o)return o.call(t);let a=Ut(e),l=(s=Object.getOwnPropertyDescriptor(a,r))==null?void 0:s.get;return l?((wt[e]||(wt[e]={}))[r]=l,l.call(t)):t[r]}var vt={};function dr(e,t,r){let n=`${e}.${String(r)}`;if(vt[n])return vt[n].bind(t);let o=Ut(e)[r];return typeof o!="function"?t[r]:(vt[n]=o,o.bind(t))}function Jr(e){return ue("Node",e,"ownerDocument")}function Xr(e){return ue("Node",e,"childNodes")}function Yr(e){return ue("Node",e,"parentNode")}function Zr(e){return ue("Node",e,"parentElement")}function Kr(e){return ue("Node",e,"textContent")}function Qr(e){return ue("Node",e,"firstChild")}function en(e){return ue("Node",e,"lastChild")}function tn(e){return ue("Node",e,"nextSibling")}function rn(e){return ue("Node",e,"previousSibling")}function nn(e,t){return dr("Node",e,"contains")(t)}function sn(e){return dr("Node",e,"getRootNode")()}function on(e){return!e||!("host"in e)?null:ue("ShadowRoot",e,"host")}function an(e){return e.styleSheets}function ln(e){return!e||!("shadowRoot"in e)?null:ue("Element",e,"shadowRoot")}function cn(e,t){return ue("Element",e,"querySelector")(t)}function dn(e,t){return ue("Element",e,"querySelectorAll")(t)}function ur(){let e=Ut("MutationObserver");Kt++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--Kt!==0))return;let r=It.MutationObserver;if(r)try{r()}finally{delete qe.MutationObserver,delete It.MutationObserver}}]}var Je=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Je=()=>new Date().getTime());function Ne(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],s=r(n);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=s,()=>{e[t]=n}}catch{return()=>{}}}var C={ownerDocument:Jr,childNodes:Xr,parentNode:Yr,parentElement:Zr,textContent:Kr,firstChild:Qr,lastChild:en,nextSibling:tn,previousSibling:rn,contains:nn,getRootNode:sn,host:on,styleSheets:an,shadowRoot:ln,querySelector:cn,querySelectorAll:dn,nowTimestamp:Je,mutationObserverCtor:ur,patch:Ne};function fr(e){return e.nodeType===e.ELEMENT_NODE}function $e(e){let t=e&&"host"in e&&"mode"in e&&C.host(e)||null;return!!(t&&"shadowRoot"in t&&C.shadowRoot(t)===e)}function Ge(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function un(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function fn(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function Rt(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,s=>hr(s,r)).join("");return un(n)}catch{return null}}function hr(e,t){if(pn(e)){let r;try{r=Rt(e.styleSheet)||fn(e)}catch{r=e.cssText}return e.styleSheet.href?lt(r,e.styleSheet.href):r}else{let r=e.cssText;return mn(e)&&e.selectorText.includes(":")&&(r=hn(r)),t?lt(r,t):r}}function hn(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function pn(e){return"styleSheet"in e}function mn(e){return"selectorText"in e}var ot=class{constructor(){y(this,"idNodeMap",new Map),y(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(s=>this.removeNodeFromMap(s));let n=C.shadowRoot(t);n&&this.removeNodeFromMap(n)}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let s=this.nodeMetaMap.get(n);s&&this.nodeMetaMap.set(r,s)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function gn(){return new ot}function it({element:e,maskInputOptions:t,tagName:r,type:n,value:s,maskInputFn:o}){let a=s||"",l=n&&Me(n);return(t[r.toLowerCase()]||l&&t[l])&&(o?a=o(a,e):a="*".repeat(a.length)),a}function Me(e){return e.toLowerCase()}var Qt="__rrweb_original__";function yn(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let s=0;s<e.height;s+=r){let o=t.getImageData,a=Qt in o?o[Qt]:o;if(new Uint32Array(a.call(t,n,s,Math.min(r,e.width-n),Math.min(r,e.height-s)).data.buffer).some(i=>i!==0))return!1}return!0}function at(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Me(t):null}function pr(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,s=r.pathname.match(n);return s?.[1]??null}function bn(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Sn=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,wn=/^(?:[a-z+]+:)?\/\//i,vn=/^www\..*/i,Cn=/^(data:)([^,]*),(.*)/i;function lt(e,t){return(e||"").replace(Sn,(r,n,s,o,a,l)=>{let i=s||a||l,u=n||o||"";if(!i)return r;if(wn.test(i)||vn.test(i))return`url(${u}${i}${u})`;if(Cn.test(i))return`url(${u}${i}${u})`;if(i[0]==="/")return`url(${u}${bn(t)+i}${u})`;let f=i.split("#")[0],p=i.substring(f.length),m=t.split("#")[0].split("/"),d=f.split("/");m.pop();for(let h of d)h!=="."&&(h===".."?m.pop():m.push(h));return`url(${u}${m.join("/")}${p}${u})`})}var mr="(?:/\\*[^*]*\\*/)|[\\s;]",Mn=new RegExp(`${mr}|\\b(0)px?`,"g"),In=new RegExp(mr,"g");function et(e,t=!1){return t?e.replace(In,""):e.replace(Mn,"$1")}function Rn(e,t,r=!1){let n=Array.from(t.childNodes),s=[],o=0;if(n.length>1&&e&&typeof e=="string"){let a=et(e,r),l=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){let u=et(n[i].textContent,r),f=100,p=3;for(;p<u.length&&(u[p].match(/[a-zA-Z0-9]/)||u.indexOf(u.substring(0,p),1)!==-1);p++);for(;p<u.length;p++){let m=u.substring(0,p),d=a.split(m),h=-1;if(d.length===2)h=d[0].length;else if(d.length>2&&d[0]===""&&n[i-1].textContent!=="")h=a.indexOf(m,1);else if(d.length===1){if(m=m.substring(0,m.length-1),d=a.split(m),d.length<=1)return s.push(e),s;p=f+1}else p===u.length-1&&(h=a.indexOf(m));if(d.length>=2&&p>f){let c=n[i-1].textContent;if(c&&typeof c=="string"){let b=et(c).length;h=a.indexOf(m,b)}h===-1&&(h=d[0].length)}if(h!==-1){let c=Math.floor(h/l);for(;c>0&&c<e.length;){if(o+=1,o>50*n.length)return s.push(e),s;let b=et(e.substring(0,c),r);if(b.length===h){s.push(e.substring(0,c)),e=e.substring(c),a=a.substring(h);break}else b.length<h?c+=Math.max(1,Math.floor((h-b.length)/l)):c-=Math.max(1,Math.floor((b.length-h)*l))}break}}}}return s.push(e),s}function kn(e,t){return Rn(e,t).join("/* rr_split */")}var Nn=1,En=new RegExp("[^a-z0-9-_:]"),ct=-2;function gr(){return Nn++}function On(e){if(e instanceof HTMLFormElement)return"form";let t=Me(e.tagName);return En.test(t)?"div":t}var De,er,Tn=/^[^ \t\n\r\u000c]+/,xn=/^[, \t\n\r\u000c]+/;function Dn(e,t){if(t.trim()==="")return t;let r=0;function n(o){let a,l=o.exec(t.substring(r));return l?(a=l[0],r+=a.length,a):""}let s=[];for(;n(xn),!(r>=t.length);){let o=n(Tn);if(o.slice(-1)===",")o=_e(e,o.substring(0,o.length-1)),s.push(o);else{let a="";o=_e(e,o);let l=!1;for(;;){let i=t.charAt(r);if(i===""){s.push((o+a).trim());break}else if(l)i===")"&&(l=!1);else if(i===","){r+=1,s.push((o+a).trim());break}else i==="("&&(l=!0);a+=i,r+=1}}}return s.join(", ")}var tr=new WeakMap;function _e(e,t){return!t||t.trim()===""?t:Bt(e,t)}function Ln(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Bt(e,t){let r=tr.get(e);if(r||(r=e.createElement("a"),tr.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function yr(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?_e(e,n):r==="srcset"?Dn(e,n):r==="style"?lt(n,Bt(e)):t==="object"&&r==="data"?_e(e,n):n)}function br(e,t,r){return["video","audio"].includes(e)&&Me(t)==="autoplay"}function An(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}if(r)return e.matches(r)}catch{}return!1}function dt(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?dt(C.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let s=e.classList[n];if(t.test(s))return!0}return r?dt(C.parentNode(e),t,r):!1}function Sr(e,t,r,n){let s;if(fr(e)){if(s=e,!C.childNodes(s).length)return!1}else{if(C.parentElement(e)===null)return!1;s=C.parentElement(e)}try{if(typeof t=="string"){if(n){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(dt(s,t,n))return!0;if(r){if(n){if(s.closest(r))return!0}else if(s.matches(r))return!0}}catch{}return!1}function _n(e,t,r){let n=e.contentWindow;if(!n)return;let s=!1,o;try{o=n.document.readyState}catch{return}if(o!=="complete"){let l=setTimeout(()=>{s||(t(),s=!0)},r);e.addEventListener("load",()=>{clearTimeout(l),s=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Fn(e,t,r){let n=!1,s;try{s=e.sheet}catch{return}if(s)return;let o=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(o),n=!0,t()})}function Pn(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:a,inlineStylesheet:l,maskInputOptions:i={},maskTextFn:u,maskInputFn:f,dataURLOptions:p={},inlineImages:m,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:c=!1,cssCaptured:b=!1}=t,v=Wn(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:G.Document,childNodes:[],compatMode:e.compatMode}:{type:G.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:G.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return Bn(e,{doc:r,blockClass:s,blockSelector:o,inlineStylesheet:l,maskInputOptions:i,maskInputFn:f,dataURLOptions:p,inlineImages:m,recordCanvas:d,keepIframeSrcFn:h,newlyAddedElement:c,rootId:v});case e.TEXT_NODE:return Un(e,{doc:r,needsMask:a,maskTextFn:u,rootId:v,cssCaptured:b});case e.CDATA_SECTION_NODE:return{type:G.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:G.Comment,textContent:C.textContent(e)||"",rootId:v};default:return!1}}function Wn(e,t){let r=t.getId(e);return r===-1||r===1?void 0:r}function Un(e,t){let{needsMask:r,maskTextFn:n,rootId:s,cssCaptured:o}=t,a=C.parentNode(e),l=a&&a.tagName,i="",u=l==="STYLE"?!0:void 0,f=l==="SCRIPT"?!0:void 0;return f?i="SCRIPT_PLACEHOLDER":o||(i=C.textContent(e),u&&i&&(i=lt(i,Bt(t.doc)))),!u&&!f&&i&&r&&(i=n?n(i,C.parentElement(e)):i.replace(/[\S]/g,"*")),{type:G.Text,textContent:i||"",rootId:s}}function Bn(e,t){let{doc:r,blockClass:n,blockSelector:s,inlineStylesheet:o,maskInputOptions:a={},maskInputFn:l,dataURLOptions:i={},inlineImages:u,recordCanvas:f,keepIframeSrcFn:p,newlyAddedElement:m=!1,rootId:d}=t,h=An(e,n,s),c=On(e),b={},v=e.attributes.length;for(let g=0;g<v;g++){let I=e.attributes[g];br(c,I.name,I.value)||(b[I.name]=yr(r,c,Me(I.name),I.value))}if(c==="link"&&o){let g=Array.from(r.styleSheets).find(F=>F.href===e.href),I=null;g&&(I=Rt(g)),I&&(delete b.rel,delete b.href,b._cssText=I)}if(c==="style"&&e.sheet){let g=Rt(e.sheet);g&&(e.childNodes.length>1&&(g=kn(g,e)),b._cssText=g)}if(["input","textarea","select"].includes(c)){let g=e.value,I=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&g?b.value=it({element:e,type:at(e),tagName:c,value:g,maskInputOptions:a,maskInputFn:l}):I&&(b.checked=I)}if(c==="option"&&(e.selected&&!a.select?b.selected=!0:delete b.selected),c==="dialog"&&e.open&&(b.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),c==="canvas"&&f){if(e.__context==="2d")yn(e)||(b.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){let g=e.toDataURL(i.type,i.quality),I=r.createElement("canvas");I.width=e.width,I.height=e.height;let F=I.toDataURL(i.type,i.quality);g!==F&&(b.rr_dataURL=g)}}if(c==="img"&&u){De||(De=r.createElement("canvas"),er=De.getContext("2d"));let g=e,I=g.currentSrc||g.getAttribute("src")||"<unknown-src>",F=g.crossOrigin,W=()=>{g.removeEventListener("load",W);try{De.width=g.naturalWidth,De.height=g.naturalHeight,er.drawImage(g,0,0),b.rr_dataURL=De.toDataURL(i.type,i.quality)}catch(J){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?W():g.addEventListener("load",W);return}else console.warn(`Cannot inline img src=${I}! Error: ${J}`)}g.crossOrigin==="anonymous"&&(F?b.crossOrigin=F:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?W():g.addEventListener("load",W)}if(["audio","video"].includes(c)){let g=b;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(m||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),h){let{width:g,height:I}=e.getBoundingClientRect();b={class:b.class,rr_width:`${g}px`,rr_height:`${I}px`}}c==="iframe"&&!p(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src);let M;try{customElements.get(c)&&(M=!0)}catch{}return{type:G.Element,tagName:c,attributes:b,childNodes:[],isSVG:Ln(e)||void 0,needBlock:h,rootId:d,isCustom:M}}function B(e){return e==null?"":e.toLowerCase()}function wr(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Hn(e,t){if(t.comment&&e.type===G.Comment)return!0;if(e.type===G.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&pr(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(B(e.attributes.name).match(/^msapplication-tile(image|color)$/)||B(e.attributes.name)==="application-name"||B(e.attributes.rel)==="icon"||B(e.attributes.rel)==="apple-touch-icon"||B(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&B(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(B(e.attributes.property).match(/^(og|twitter|fb):/)||B(e.attributes.name).match(/^(og|twitter):/)||B(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(B(e.attributes.name)==="robots"||B(e.attributes.name)==="googlebot"||B(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(B(e.attributes.name)==="author"||B(e.attributes.name)==="generator"||B(e.attributes.name)==="framework"||B(e.attributes.name)==="publisher"||B(e.attributes.name)==="progid"||B(e.attributes.property).match(/^article:/)||B(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(B(e.attributes.name)==="google-site-verification"||B(e.attributes.name)==="yandex-verification"||B(e.attributes.name)==="csrf-token"||B(e.attributes.name)==="p:domain_verify"||B(e.attributes.name)==="verify-v1"||B(e.attributes.name)==="verification"||B(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Fe(e,t){let{doc:r,mirror:n,blockClass:s,blockSelector:o,maskTextClass:a,maskTextSelector:l,skipChild:i=!1,inlineStylesheet:u=!0,maskInputOptions:f={},maskTextFn:p,maskInputFn:m,slimDOMOptions:d,dataURLOptions:h={},inlineImages:c=!1,recordCanvas:b=!1,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:g=5e3,onStylesheetLoad:I,stylesheetLoadTimeout:F=5e3,keepIframeSrcFn:W=()=>!1,newlyAddedElement:J=!1,cssCaptured:le=!1}=t,{needsMask:ee}=t,{preserveWhiteSpace:te=!0}=t;ee||(ee=Sr(e,a,l,ee===void 0));let re=Pn(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:ee,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:m,dataURLOptions:h,inlineImages:c,recordCanvas:b,keepIframeSrcFn:W,newlyAddedElement:J,cssCaptured:le});if(!re)return console.warn(e,"not serialized"),null;let ne;n.hasNode(e)?ne=n.getId(e):Hn(re,d)||!te&&re.type===G.Text&&!re.textContent.replace(/^\s+|\s+$/gm,"").length?ne=ct:ne=gr();let N=re;if(N.id=ne,n.add(e,N),ne===ct)return null;v&&v(e);let me=!i;if(N.type===G.Element){me=me&&!N.needBlock,delete N.needBlock;let z=C.shadowRoot(e);z&&Ge(z)&&(N.isShadowHost=!0)}if((N.type===G.Document||N.type===G.Element)&&me){d.headWhitespace&&N.type===G.Element&&N.tagName==="head"&&(te=!1);let z={doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:ee,maskTextClass:a,maskTextSelector:l,skipChild:i,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:d,dataURLOptions:h,inlineImages:c,recordCanvas:b,preserveWhiteSpace:te,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:g,onStylesheetLoad:I,stylesheetLoadTimeout:F,keepIframeSrcFn:W,cssCaptured:!1};if(!(N.type===G.Element&&N.tagName==="textarea"&&N.attributes.value!==void 0)){N.type===G.Element&&N.attributes._cssText!==void 0&&typeof N.attributes._cssText=="string"&&(z.cssCaptured=!0);for(let fe of Array.from(C.childNodes(e))){let Q=Fe(fe,z);Q&&N.childNodes.push(Q)}}let V=null;if(fr(e)&&(V=C.shadowRoot(e)))for(let fe of Array.from(C.childNodes(V))){let Q=Fe(fe,z);Q&&(Ge(V)&&(Q.isShadow=!0),N.childNodes.push(Q))}}let ye=C.parentNode(e);return ye&&$e(ye)&&Ge(ye)&&(N.isShadow=!0),N.type===G.Element&&N.tagName==="iframe"&&_n(e,()=>{let z=e.contentDocument;if(z&&M){let V=Fe(z,{doc:z,mirror:n,blockClass:s,blockSelector:o,needsMask:ee,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:d,dataURLOptions:h,inlineImages:c,recordCanvas:b,preserveWhiteSpace:te,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:g,onStylesheetLoad:I,stylesheetLoadTimeout:F,keepIframeSrcFn:W});V&&M(e,V)}},g),N.type===G.Element&&N.tagName==="link"&&typeof N.attributes.rel=="string"&&(N.attributes.rel==="stylesheet"||N.attributes.rel==="preload"&&typeof N.attributes.href=="string"&&pr(N.attributes.href)==="css")&&Fn(e,()=>{if(I){let z=Fe(e,{doc:r,mirror:n,blockClass:s,blockSelector:o,needsMask:ee,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:u,maskInputOptions:f,maskTextFn:p,maskInputFn:m,slimDOMOptions:d,dataURLOptions:h,inlineImages:c,recordCanvas:b,preserveWhiteSpace:te,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:g,onStylesheetLoad:I,stylesheetLoadTimeout:F,keepIframeSrcFn:W});z&&I(e,z)}},F),N}function zn(e,t){let{mirror:r=new ot,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:o="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:i=!1,recordCanvas:u=!1,maskAllInputs:f=!1,maskTextFn:p,maskInputFn:m,slimDOM:d=!1,dataURLOptions:h,preserveWhiteSpace:c,onSerialize:b,onIframeLoad:v,iframeLoadTimeout:M,onStylesheetLoad:g,stylesheetLoadTimeout:I,keepIframeSrcFn:F=()=>!1}=t,W=f===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f===!1?{password:!0}:f,J=wr(d);return Fe(e,{doc:e,mirror:r,blockClass:n,blockSelector:s,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:W,maskTextFn:p,maskInputFn:m,slimDOMOptions:J,dataURLOptions:h,inlineImages:i,recordCanvas:u,preserveWhiteSpace:c,onSerialize:b,onIframeLoad:v,iframeLoadTimeout:M,onStylesheetLoad:g,stylesheetLoadTimeout:I,keepIframeSrcFn:F,newlyAddedElement:!1})}var kt=class e{constructor(...t){y(this,"parentElement",null),y(this,"parentNode",null),y(this,"ownerDocument"),y(this,"firstChild",null),y(this,"lastChild",null),y(this,"previousSibling",null),y(this,"nextSibling",null),y(this,"ELEMENT_NODE",1),y(this,"TEXT_NODE",3),y(this,"nodeType"),y(this,"nodeName"),y(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function K(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Ae=`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(Me),-1},getNode(){return console.error(Me),null},removeNodeFromMap(){console.error(Me)},has(){return console.error(Me),!1},reset(){console.error(Me)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(_t=new Proxy(_t,{get(e,t,r){return t==="map"&&console.error(Me),Reflect.get(e,t,r)}}));function Be(e,t,r={}){let n=null,o=0;return function(...s){let a=Date.now();!o&&r.leading===!1&&(o=a);let c=t-(a-o),i=this;c<=0||c>t?(n&&(clearTimeout(n),n=null),o=a,e.apply(i,s)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(i,s)},c))}}function nt(e,t,r,n,o=window){let s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>nt(e,t,s||{},!0)}function er(e){var t,r,n,o;let s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:s.documentElement.scrollLeft||s?.body&&((t=C.parentElement(s.body))==null?void 0:t.scrollLeft)||((r=s?.body)==null?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:s?.documentElement.scrollTop||s?.body&&((n=C.parentElement(s.body))==null?void 0:n.scrollTop)||((o=s?.body)==null?void 0:o.scrollTop)||0}}function tr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function rr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function nr(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function X(e,t,r,n){if(!e)return!1;let o=nr(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(et(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function mn(e,t){return t.getId(e)!==-1}function at(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Ke}function or(e,t){if(Fe(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=C.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?or(n,t):!0}function ht(e){return!!e.changedTouches}function gn(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function sr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function ir(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function ft(e){return e?e instanceof ut&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var pt=class{constructor(){g(this,"id",1),g(this,"styleIDMap",new WeakMap),g(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function ar(e){var t;let r=null;return"getRootNode"in e&&((t=C.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function yn(e){let t=e,r;for(;r=ar(t);)t=r;return t}function bn(e){let t=C.ownerDocument(e);if(!t)return!1;let r=yn(e);return C.contains(t,r)}function mt(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||bn(e):!1}var Ft=(e,t)=>`${e}@${t}`,gt=class{constructor(){g(this,"frozen",!1),g(this,"locked",!1),g(this,"texts",[]),g(this,"attributes",[]),g(this,"attributeMap",new WeakMap),g(this,"removes",[]),g(this,"mapRemoves",[]),g(this,"movedMap",{}),g(this,"addedSet",new Set),g(this,"movedSet",new Set),g(this,"droppedSet",new Set),g(this,"removesSubTreeCache",new Set),g(this,"mutationCb"),g(this,"blockClass"),g(this,"blockSelector"),g(this,"maskTextClass"),g(this,"maskTextSelector"),g(this,"inlineStylesheet"),g(this,"maskInputOptions"),g(this,"maskTextFn"),g(this,"maskInputFn"),g(this,"keepIframeSrcFn"),g(this,"recordCanvas"),g(this,"inlineImages"),g(this,"slimDOMOptions"),g(this,"dataURLOptions"),g(this,"doc"),g(this,"mirror"),g(this,"iframeManager"),g(this,"stylesheetManager"),g(this,"shadowDomManager"),g(this,"processedNodeManager"),g(this,"unattachedDoc"),g(this,"processMutations",t=>{bt&&(t=bt(t),!t.length)||(t.forEach(this.processMutation),this.emit())}),g(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let p of this.movedSet){let f=C.parentNode(p);this.removesSubTreeCache.has(f)&&!this.movedSet.has(f)||this.addedSet.add(p)}let n=null,o=null,s=-1,a=null,c=!1,i=new Set,u=this.addedSet.values(),d=u.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(C.previousSibling(n)))a=n,n=C.previousSibling(n);else{for(this.addedSet.has(d.value)||(d=u.next()),n=d.value;;){if(o=C.parentNode(n),this.addedSet.has(o)){n=o;continue}break}if(i.has(o))o=null;else if(o){if(mt(o)?(c=Pt(this.droppedSet,o)||this.removesSubTreeCache.has(o),c&&Pt(this.movedSet,n)&&(c=!1)):c=!0,this.addedSet.has(C.lastChild(o)))n=C.lastChild(o),a=null;else for(;;){if(a=C.nextSibling(n),this.addedSet.has(a)){n=a;continue}break}if(s=Fe(o)?this.mirror.getId(ar(n)):this.mirror.getId(o),s===-1&&o.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let l=C.host(o);s=this.mirror.getId(l)}}}if(this.addedSet.delete(n),!o||s===-1){i.add(n);continue}else if(c){this.droppedSet.add(n);continue}let p=!1;if(n.nodeType===Node.TEXT_NODE){let l=o.tagName;if(l==="TEXTAREA")continue;l==="STYLE"&&r.has(s)&&(p=!0)}let f=a?this.mirror.getId(a):null;for(;f===Ke;)a=a&&C.nextSibling(a),f=a&&this.mirror.getId(a);if(f===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",a),n=null;continue}let m=Re(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:l=>{sr(l,this.mirror)&&this.iframeManager.addIframe(l),ir(l,this.mirror)&&this.stylesheetManager.trackLinkElement(l),ft(n)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(n),this.doc)},onIframeLoad:(l,S)=>{this.iframeManager.attachIframe(l,S),this.shadowDomManager.observeAttachShadow(l)},onStylesheetLoad:(l,S)=>{this.stylesheetManager.attachLinkElement(l,S)},cssCaptured:p});m&&(t.push({parentId:s,nextId:f,node:m}),r.add(m.id))}let h={texts:this.texts.map(p=>{let f=p.node,m=C.parentNode(f);return m&&m.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(m),{id:this.mirror.getId(f),value:p.value}}).filter(p=>!r.has(p.id)).filter(p=>this.mirror.has(p.id)),attributes:this.attributes.map(p=>{let{attributes:f}=p;if(typeof f.style=="string"){let m=JSON.stringify(p.styleDiff),l=JSON.stringify(p._unchangedStyles);m.length<f.style.length&&(m+l).split("var(").length===f.style.split("var(").length&&(f.style=p.styleDiff)}return{id:this.mirror.getId(p.node),attributes:f}}).filter(p=>!r.has(p.id)).filter(p=>this.mirror.has(p.id)),removes:this.removes,adds:t};!h.texts.length&&!h.attributes.length&&!h.removes.length&&!h.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(h))}),g(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(C.childNodes(t),o=>C.textContent(o)||"").join("");r.attributes.value=Je({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Ze(t),value:n,maskInputFn:this.maskInputFn})}),g(this,"processMutation",t=>{if(!at(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!X(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Qt(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,nr(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=fe(r.tagName),o=t.attributeName,s=t.target.getAttribute(o);if(o==="value"){let c=Ze(r);s=Je({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:c,value:s,maskInputFn:this.maskInputFn})}if(X(t.target,this.blockClass,this.blockSelector,!1)||s===t.oldValue)return;let a=this.attributeMap.get(t.target);if(n==="iframe"&&o==="src"&&!this.keepIframeSrcFn(s))if(!r.contentDocument)o="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),o==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Zt(n,o))if(a.attributes[o]=Jt(this.doc,n,fe(o),s),o==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let c=this.unattachedDoc.createElement("span");t.oldValue&&c.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let u=r.style.getPropertyValue(i),d=r.style.getPropertyPriority(i);u!==c.style.getPropertyValue(i)||d!==c.style.getPropertyPriority(i)?d===""?a.styleDiff[i]=u:a.styleDiff[i]=[u,d]:a._unchangedStyles[i]=[u,d]}for(let i of Array.from(c.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else o==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(X(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{mt(r)||this.shadowDomManager.removeShadowRootsIn(r);let n=this.mirror.getId(r),o=Fe(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);X(t.target,this.blockClass,this.blockSelector,!1)||at(r,this.mirror,this.slimDOMOptions)||!mn(r,this.mirror)||(this.addedSet.has(r)?(yt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||or(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[Ft(n,o)]?yt(this.movedSet,r):(this.removes.push({parentId:o,id:n,isShadow:Fe(t.target)&&Pe(t.target)?!0:void 0}),Sn(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),g(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(at(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[Ft(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);X(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),ft(t)&&C.childNodes(C.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function yt(e,t){e.delete(t),C.childNodes(t).forEach(r=>yt(e,r))}function Sn(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),C.childNodes(n).forEach(o=>r.push(o)))}}function Pt(e,t){return e.size===0?!1:lr(e,t)}function lr(e,t){if(e.has(t))return!0;let r=C.parentNode(t);return r?lr(e,r):!1}var We;function wn(e){We=e}function Cn(){We=void 0}var T=e=>We?(...r)=>{try{return e(...r)}catch(n){if(We&&We(n)===!0)return;throw n}}:e,bt=null,Ne=new Set;function ze(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function cr(e,t){let r=new gt;Ne.add(r),r.init(e);let[n,o]=jt(),s=new n(T(r.processMutations.bind(r)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{s.disconnect(),Ne.delete(r),o()}}function vn({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],c,i=Be(T(h=>{let p=Date.now()-c;e(a.map(f=>(f.timeOffset-=p,f)),h),a=[],c=null}),s),u=T(Be(T(h=>{let p=ze(h),{clientX:f,clientY:m}=ht(h)?h.changedTouches[0]:h;c||(c=Ue()),a.push({x:f,y:m,id:n.getId(p),timeOffset:Ue()-c}),i(typeof DragEvent<"u"&&h instanceof DragEvent?O.Drag:h instanceof MouseEvent?O.MouseMove:O.TouchMove)}),o,{trailing:!1})),d=[q("mousemove",u,r),q("touchmove",u,r),q("drag",u,r)];return T(()=>{d.forEach(h=>h())})}function Mn({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,c=[],i=null,u=d=>h=>{let p=ze(h);if(X(p,n,o,!0))return;let f=null,m=d;if("pointerType"in h){switch(h.pointerType){case"mouse":f=ce.Mouse;break;case"touch":f=ce.Touch;break;case"pen":f=ce.Pen;break}f===ce.Touch?K[d]===K.MouseDown?m="TouchStart":K[d]===K.MouseUp&&(m="TouchEnd"):ce.Pen}else ht(h)&&(f=ce.Touch);f!==null?(i=f,(m.startsWith("Touch")&&f===ce.Touch||m.startsWith("Mouse")&&f===ce.Mouse)&&(f=null)):K[d]===K.Click&&(f=i,i=null);let l=ht(h)?h.changedTouches[0]:h;if(!l)return;let S=r.getId(p),{clientX:v,clientY:M}=l;T(e)({type:K[m],id:S,x:v,y:M,...f!==null&&{pointerType:f}})};return Object.keys(K).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&a[d]!==!1).forEach(d=>{let h=fe(d),p=u(d);if(window.PointerEvent)switch(K[d]){case K.MouseDown:case K.MouseUp:h=h.replace("mouse","pointer");break;case K.TouchStart:case K.TouchEnd:return}c.push(q(h,p,t))}),T(()=>{c.forEach(d=>d())})}function dr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){let a=T(Be(T(c=>{let i=ze(c);if(!i||X(i,n,o,!0))return;let u=r.getId(i);if(i===t&&t.defaultView){let d=er(t.defaultView);e({id:u,x:d.left,y:d.top})}else e({id:u,x:i.scrollLeft,y:i.scrollTop})}),s.scroll||100));return q("scroll",a,t)}function In({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=T(Be(T(()=>{let s=tr(),a=rr();(r!==s||n!==a)&&(e({width:Number(a),height:Number(s)}),r=s,n=a)}),200));return q("resize",o,t)}var Rn=["INPUT","TEXTAREA","SELECT"],Wt=new WeakMap;function kn({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:c,maskInputFn:i,sampling:u,userTriggeredOnInput:d}){function h(M){let y=ze(M),R=M.isTrusted,D=y&&y.tagName;if(y&&D==="OPTION"&&(y=C.parentElement(y)),!y||!D||Rn.indexOf(D)<0||X(y,n,o,!0)||y.classList.contains(s)||a&&y.matches(a))return;let F=y.value,z=!1,Y=Ze(y)||"";Y==="radio"||Y==="checkbox"?z=y.checked:(c[D.toLowerCase()]||c[Y])&&(F=Je({element:y,maskInputOptions:c,tagName:D,type:Y,value:F,maskInputFn:i})),p(y,d?{text:F,isChecked:z,userTriggered:R}:{text:F,isChecked:z});let $=y.name;Y==="radio"&&$&&z&&t.querySelectorAll(`input[type="radio"][name="${$}"]`).forEach(V=>{if(V!==y){let J=V.value;p(V,d?{text:J,isChecked:!z,userTriggered:!1}:{text:J,isChecked:!z})}})}function p(M,y){let R=Wt.get(M);if(!R||R.text!==y.text||R.isChecked!==y.isChecked){Wt.set(M,y);let D=r.getId(M);T(e)({...y,id:D})}}let m=(u.input==="last"?["change"]:["input","change"]).map(M=>q(M,T(h),t)),l=t.defaultView;if(!l)return()=>{m.forEach(M=>M())};let S=l.Object.getOwnPropertyDescriptor(l.HTMLInputElement.prototype,"value"),v=[[l.HTMLInputElement.prototype,"value"],[l.HTMLInputElement.prototype,"checked"],[l.HTMLSelectElement.prototype,"value"],[l.HTMLTextAreaElement.prototype,"value"],[l.HTMLSelectElement.prototype,"selectedIndex"],[l.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&m.push(...v.map(M=>nt(M[0],M[1],{set(){T(h)({target:this,isTrusted:!1})}},!1,l))),T(()=>{m.forEach(M=>M())})}function tt(e){let t=[];function r(n,o){if(qe("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||qe("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||qe("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||qe("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);return o.unshift(a),r(n.parentRule,o)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(a)}return o}return r(e,t)}function he(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function Nn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:T((d,h,p)=>{let[f,m]=p,{id:l,styleId:S}=he(h,t,r.styleMirror);return(l&&l!==-1||S&&S!==-1)&&e({id:l,styleId:S,adds:[{rule:f,index:m}]}),d.apply(h,p)})}),n.CSSStyleSheet.prototype.addRule=function(d,h,p=this.cssRules.length){let f=`${d} { ${h} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[f,p])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:T((d,h,p)=>{let[f]=p,{id:m,styleId:l}=he(h,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,removes:[{index:f}]}),d.apply(h,p)})}),n.CSSStyleSheet.prototype.removeRule=function(d){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[d])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:T((d,h,p)=>{let[f]=p,{id:m,styleId:l}=he(h,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replace:f}),d.apply(h,p)})}));let c;n.CSSStyleSheet.prototype.replaceSync&&(c=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:T((d,h,p)=>{let[f]=p,{id:m,styleId:l}=he(h,t,r.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,replaceSync:f}),d.apply(h,p)})}));let i={};Ve("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(Ve("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),Ve("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),Ve("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let u={};return Object.entries(i).forEach(([d,h])=>{u[d]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(u[d].insertRule,{apply:T((p,f,m)=>{let[l,S]=m,{id:v,styleId:M}=he(f.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||M&&M!==-1)&&e({id:v,styleId:M,adds:[{rule:l,index:[...tt(f),S||0]}]}),p.apply(f,m)})}),h.prototype.deleteRule=new Proxy(u[d].deleteRule,{apply:T((p,f,m)=>{let[l]=m,{id:S,styleId:v}=he(f.parentStyleSheet,t,r.styleMirror);return(S&&S!==-1||v&&v!==-1)&&e({id:S,styleId:v,removes:[{index:[...tt(f),l]}]}),p.apply(f,m)})})}),T(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=s,a&&(n.CSSStyleSheet.prototype.replace=a),c&&(n.CSSStyleSheet.prototype.replaceSync=c),Object.entries(i).forEach(([d,h])=>{h.prototype.insertRule=u[d].insertRule,h.prototype.deleteRule=u[d].deleteRule})})}function ur({mirror:e,stylesheetManager:t},r){var n,o,s;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(C.host(r));let c=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(s=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:s.ShadowRoot,i=c?.prototype?Object.getOwnPropertyDescriptor(c?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!c||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var u;return(u=i.get)==null?void 0:u.call(this)},set(u){var d;let h=(d=i.set)==null?void 0:d.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch{}return h}}),T(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function En({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:T((c,i,u)=>{var d;let[h,p,f]=u;if(r.has(h))return s.apply(i,[h,p,f]);let{id:m,styleId:l}=he((d=i.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||l&&l!==-1)&&e({id:m,styleId:l,set:{property:h,value:p,priority:f},index:tt(i.parentRule)}),c.apply(i,u)})});let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:T((c,i,u)=>{var d;let[h]=u;if(r.has(h))return a.apply(i,[h]);let{id:p,styleId:f}=he((d=i.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,remove:{property:h},index:tt(i.parentRule)}),c.apply(i,u)})}),T(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function On({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:s}){let a=T(i=>Be(T(u=>{let d=ze(u);if(!d||X(d,t,r,!0))return;let{currentTime:h,volume:p,muted:f,playbackRate:m,loop:l}=d;e({type:i,id:n.getId(d),currentTime:h,volume:p,muted:f,playbackRate:m,loop:l})}),o.media||500)),c=[q("play",a(ve.Play),s),q("pause",a(ve.Pause),s),q("seeked",a(ve.Seeked),s),q("volumechange",a(ve.VolumeChange),s),q("ratechange",a(ve.RateChange),s)];return T(()=>{c.forEach(i=>i())})}function Tn({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,s=r.FontFace;r.FontFace=function(i,u,d){let h=new s(i,u,d);return o.set(h,{family:i,buffer:typeof u!="string",descriptors:d,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),h};let a=ge(t.fonts,"add",function(c){return function(i){return setTimeout(T(()=>{let u=o.get(i);u&&(e(u),o.delete(i))}),0),c.apply(this,[i])}});return n.push(()=>{r.FontFace=s}),n.push(a),T(()=>{n.forEach(c=>c())})}function xn(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:s}=e,a=!0,c=T(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let u=[],d=i.rangeCount||0;for(let h=0;h<d;h++){let p=i.getRangeAt(h),{startContainer:f,startOffset:m,endContainer:l,endOffset:S}=p;X(f,n,o,!0)||X(l,n,o,!0)||u.push({start:r.getId(f),startOffset:m,end:r.getId(l),endOffset:S})}s({ranges:u})});return c(),q("selectionchange",c)}function Ln({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:ge(r.customElements,"define",function(o){return function(s,a,c){try{t({define:{name:s}})}catch{console.warn(`Custom element callback failed for ${s}`)}return o.apply(this,[s,a,c])}})}function Dn(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:c,mediaInteractionCb:i,styleSheetRuleCb:u,styleDeclarationCb:d,canvasMutationCb:h,fontCb:p,selectionCb:f,customElementCb:m}=e;e.mutationCb=(...l)=>{t.mutation&&t.mutation(...l),r(...l)},e.mousemoveCb=(...l)=>{t.mousemove&&t.mousemove(...l),n(...l)},e.mouseInteractionCb=(...l)=>{t.mouseInteraction&&t.mouseInteraction(...l),o(...l)},e.scrollCb=(...l)=>{t.scroll&&t.scroll(...l),s(...l)},e.viewportResizeCb=(...l)=>{t.viewportResize&&t.viewportResize(...l),a(...l)},e.inputCb=(...l)=>{t.input&&t.input(...l),c(...l)},e.mediaInteractionCb=(...l)=>{t.mediaInteaction&&t.mediaInteaction(...l),i(...l)},e.styleSheetRuleCb=(...l)=>{t.styleSheetRule&&t.styleSheetRule(...l),u(...l)},e.styleDeclarationCb=(...l)=>{t.styleDeclaration&&t.styleDeclaration(...l),d(...l)},e.canvasMutationCb=(...l)=>{t.canvasMutation&&t.canvasMutation(...l),h(...l)},e.fontCb=(...l)=>{t.font&&t.font(...l),p(...l)},e.selectionCb=(...l)=>{t.selection&&t.selection(...l),f(...l)},e.customElementCb=(...l)=>{t.customElement&&t.customElement(...l),m(...l)}}function An(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};Dn(e,t);let n;e.recordDOM&&(n=cr(e,e.doc));let o=vn(e),s=Mn(e),a=dr(e),c=In(e,{win:r}),i=kn(e),u=On(e),d=()=>{},h=()=>{},p=()=>{},f=()=>{};e.recordDOM&&(d=Nn(e,{win:r}),h=ur(e,e.doc),p=En(e,{win:r}),e.collectFonts&&(f=Tn(e)));let m=xn(e),l=Ln(e),S=[];for(let v of e.plugins)S.push(v.observer(v.callback,r,v.options));return T(()=>{n?.(),o(),s(),a(),c(),i(),u(),d(),h(),p(),f(),m(),l(),S.forEach(v=>v())})}function qe(e){return typeof window[e]<"u"}function Ve(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var rt=class{constructor(t){g(this,"iframeIdToRemoteIdMap",new WeakMap),g(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,o){let s=n||this.getIdToRemoteIdMap(t),a=o||this.getRemoteIdToIdMap(t),c=s.get(r);return c||(c=this.generateIdFn(),s.set(r,c),a.set(c,r)),c}getIds(t,r){let n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(s=>this.getId(t,s,n,o))}getRemoteId(t,r,n){let o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let s=o.get(r);return s||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},St=class{constructor(t){g(this,"iframes",new WeakMap),g(this,"crossOriginIframeMap",new WeakMap),g(this,"crossOriginIframeMirror",new rt(Yt)),g(this,"crossOriginIframeStyleMirror"),g(this,"crossOriginIframeRootIdMap",new WeakMap),g(this,"mirror"),g(this,"mutationCb"),g(this,"wrappedEmit"),g(this,"loadListener"),g(this,"unloadListener"),g(this,"attachedWindows",new Map),g(this,"messageHandler",r=>this.handleMessage(r)),g(this,"stylesheetManager"),g(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new rt(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let r=t.contentWindow;if(!r||this.attachedWindows.has(r))return;let n=[],o=()=>{this.attachedWindows.delete(r),n.forEach(s=>{try{s()}catch{}})};this.attachedWindows.set(r,o),this.recordCrossOriginIframes&&n.push(q("message",this.messageHandler,r)),n.push(q("pagehide",s=>{var a;if(s.persisted)return;let c=r.document;o(),(a=this.unloadListener)==null||a.call(this,c)},r))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let s=this.transformCrossOriginEvent(o,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case E.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:E.IncrementalSnapshot,data:{source:O.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case E.Meta:case E.Load:case E.DomContentLoaded:return!1;case E.Annotation:case E.Plugin:return r;case E.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case E.IncrementalSnapshot:switch(r.data.source){case O.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let s=this.crossOriginIframeRootIdMap.get(t);s&&this.patchRootIdOnNode(o.node,s)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case O.Drag:case O.TouchMove:case O.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case O.ViewportResize:return!1;case O.MediaInteraction:case O.MouseInteraction:case O.Scroll:case O.CanvasMutation:case O.Input:return this.replaceIds(r.data,t,["id"]),r;case O.StyleSheetRule:case O.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case O.Font:return r;case O.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case O.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}return!1}replace(t,r,n,o){for(let s of o)!Array.isArray(r[s])&&typeof r[s]!="number"||(Array.isArray(r[s])?r[s]=t.getIds(n,r[s]):r[s]=t.getId(n,r[s]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==H.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},wt=class{constructor(t){g(this,"shadowDoms",new Map),g(this,"mutationCb"),g(this,"scrollCb"),g(this,"bypassOptions"),g(this,"mirror"),g(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Pe(t)||this.shadowDoms.has(t))return;let n=[];this.shadowDoms.set(t,n);let o=cr({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);n.push(o),n.push(dr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===n&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(C.host(t))),n.push(ur({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let r=C.shadowRoot(t);r&&(this.shadowDoms.has(r)&&this.removeShadowRoot(r),this.removeShadowRootsIn(r)),C.childNodes(t).forEach(n=>this.removeShadowRootsIn(n))}removeShadowRoot(t){let r=this.shadowDoms.get(t);this.shadowDoms.delete(t),r?.forEach(lt)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(ge(t.prototype,"attachShadow",function(o){return function(s){let a=o.call(this,s),c=C.shadowRoot(this);return c&&mt(this)&&n.addShadowRoot(c,r),a}}))}reset(){this.restoreHandlers.forEach(lt),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(r=>r.forEach(lt))}};function lt(e){try{e()}catch{}}var ke="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_n=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Ae=0;Ae<ke.length;Ae++)_n[ke.charCodeAt(Ae)]=Ae;var Ae,Fn=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=ke[t[r]>>2],o+=ke[(t[r]&3)<<4|t[r+1]>>4],o+=ke[(t[r+1]&15)<<2|t[r+2]>>6],o+=ke[t[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},Ut=new Map;function Pn(e,t){let r=Ut.get(e);return r||(r=new Map,Ut.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var hr=(e,t,r)=>{if(!e||!(pr(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=Pn(r,n),s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function $e(e,t,r){if(e instanceof Array)return e.map(n=>$e(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,o=Fn(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[$e(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[$e(e.data,t,r),e.width,e.height]};if(pr(e,t)||typeof e=="object"){let n=e.constructor.name,o=hr(e,t,r);return{rr_type:n,index:o}}}}return e}var fr=(e,t,r)=>e.map(n=>$e(n,t,r)),pr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function Wn(e,t,r,n){let o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of s)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let c=ge(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...u){return X(this.canvas,r,n,!0)||setTimeout(()=>{let d=fr(u,t,this);e(this.canvas,{type:Ee["2D"],property:a,args:d})},0),i.apply(this,u)}});o.push(c)}catch{let c=nt(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:Ee["2D"],property:a,args:[i],setter:!0})}});o.push(c)}return()=>{o.forEach(a=>a())}}function Un(e){return e==="experimental-webgl"?"webgl":e}function Bt(e,t,r,n){let o=[];try{let s=ge(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(c,...i){if(!X(this,t,r,!0)){let u=Un(c);if("__context"in this||(this.__context=u),n&&["webgl","webgl2"].includes(u))if(i[0]&&typeof i[0]=="object"){let d=i[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[c,...i])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function Ht(e,t,r,n,o,s){let a=[],c=Object.getOwnPropertyNames(e);for(let i of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let u=ge(e,i,function(d){return function(...h){let p=d.apply(this,h);if(hr(p,s,this),"tagName"in this.canvas&&!X(this.canvas,n,o,!0)){let f=fr(h,s,this),m={type:t,property:i,args:f};r(this.canvas,m)}return p}});a.push(u)}catch{let u=nt(e,i,{set(d){r(this.canvas,{type:t,property:i,args:[d],setter:!0})}});a.push(u)}return a}function Bn(e,t,r,n){let o=[];return typeof t.WebGLRenderingContext<"u"&&o.push(...Ht(t.WebGLRenderingContext.prototype,Ee.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...Ht(t.WebGL2RenderingContext.prototype,Ee.WebGL2,e,r,n,t)),()=>{o.forEach(s=>s())}}var mr=`(function() {
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`,rr={map:{},getId(){return console.error(Ae),-1},getNode(){return console.error(Ae),null},removeNodeFromMap(){console.error(Ae)},has(){return console.error(Ae),!1},reset(){console.error(Ae)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(rr=new Proxy(rr,{get(e,t,r){return t==="map"&&console.error(Ae),Reflect.get(e,t,r)}}));function Xe(e,t,r={}){let n=null,s=0;return function(...o){let a=Date.now();!s&&r.leading===!1&&(s=a);let l=t-(a-s),i=this;l<=0||l>t?(n&&(clearTimeout(n),n=null),s=a,e.apply(i,o)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{s=r.leading===!1?0:Date.now(),n=null,e.apply(i,o)},l))}}function ht(e,t,r,n,s=window){let o=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>ht(e,t,o||{},!0)}function vr(e){var t,r,n,s;let o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:o.documentElement.scrollLeft||o?.body&&((t=C.parentElement(o.body))==null?void 0:t.scrollLeft)||((r=o?.body)==null?void 0:r.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:o?.documentElement.scrollTop||o?.body&&((n=C.parentElement(o.body))==null?void 0:n.scrollTop)||((s=o?.body)==null?void 0:s.scrollTop)||0}}function Cr(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Mr(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ir(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function oe(e,t,r,n){if(!e)return!1;let s=Ir(e);if(!s)return!1;try{if(typeof t=="string"){if(s.classList.contains(t)||n&&s.closest("."+t)!==null)return!0}else if(dt(s,t,n))return!0}catch{}return!!(r&&(s.matches(r)||n&&s.closest(r)!==null))}function jn(e,t){return t.getId(e)!==-1}function Ct(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===ct}function Rr(e,t){if($e(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=C.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Rr(n,t):!0}function Nt(e){return!!e.changedTouches}function qn(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function kr(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Nr(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Et(e){return e?e instanceof kt&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var Ot=class{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Er(e){var t;let r=null;return"getRootNode"in e&&((t=C.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function $n(e){let t=e,r;for(;r=Er(t);)t=r;return t}function Gn(e){let t=C.ownerDocument(e);if(!t)return!1;let r=$n(e);return C.contains(t,r)}function Tt(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||Gn(e):!1}var nr=(e,t)=>`${e}@${t}`,xt=class{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"processMutations",t=>{Lt&&(t=Lt(t),!t.length)||(t.forEach(this.processMutation),this.emit())}),y(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let m of this.movedSet){let d=C.parentNode(m);this.removesSubTreeCache.has(d)&&!this.movedSet.has(d)||this.addedSet.add(m)}let n=null,s=null,o=-1,a=null,l=!1,i=new Set,u=this.addedSet.values(),f=u.next();for(;this.addedSet.size;){if(n!==null&&this.addedSet.has(C.previousSibling(n)))a=n,n=C.previousSibling(n);else{for(this.addedSet.has(f.value)||(f=u.next()),n=f.value;;){if(s=C.parentNode(n),this.addedSet.has(s)){n=s;continue}break}if(i.has(s))s=null;else if(s){if(Tt(s)?(l=sr(this.droppedSet,s)||this.removesSubTreeCache.has(s),l&&sr(this.movedSet,n)&&(l=!1)):l=!0,this.addedSet.has(C.lastChild(s)))n=C.lastChild(s),a=null;else for(;;){if(a=C.nextSibling(n),this.addedSet.has(a)){n=a;continue}break}if(o=$e(s)?this.mirror.getId(Er(n)):this.mirror.getId(s),o===-1&&s.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let c=C.host(s);o=this.mirror.getId(c)}}}if(this.addedSet.delete(n),!s||o===-1){i.add(n);continue}else if(l){this.droppedSet.add(n);continue}let m=!1;if(n.nodeType===Node.TEXT_NODE){let c=s.tagName;if(c==="TEXTAREA")continue;c==="STYLE"&&r.has(o)&&(m=!0)}let d=a?this.mirror.getId(a):null;for(;d===ct;)a=a&&C.nextSibling(a),d=a&&this.mirror.getId(a);if(d===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",a),n=null;continue}let h=Fe(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:c=>{kr(c,this.mirror)&&this.iframeManager.addIframe(c),Nr(c,this.mirror)&&this.stylesheetManager.trackLinkElement(c),Et(n)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(n),this.doc)},onIframeLoad:(c,b)=>{this.iframeManager.attachIframe(c,b),this.shadowDomManager.observeAttachShadow(c)},onStylesheetLoad:(c,b)=>{this.stylesheetManager.attachLinkElement(c,b)},cssCaptured:m});h&&(t.push({parentId:o,nextId:d,node:h}),r.add(h.id))}let p={texts:this.texts.map(m=>{let d=m.node,h=C.parentNode(d);return h&&h.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(h),{id:this.mirror.getId(d),value:m.value}}).filter(m=>!r.has(m.id)).filter(m=>this.mirror.has(m.id)),attributes:this.attributes.map(m=>{let{attributes:d}=m;if(typeof d.style=="string"){let h=JSON.stringify(m.styleDiff),c=JSON.stringify(m._unchangedStyles);h.length<d.style.length&&(h+c).split("var(").length===d.style.split("var(").length&&(d.style=m.styleDiff)}return{id:this.mirror.getId(m.node),attributes:d}}).filter(m=>!r.has(m.id)).filter(m=>this.mirror.has(m.id)),removes:this.removes,adds:t};!p.texts.length&&!p.attributes.length&&!p.removes.length&&!p.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(p))}),y(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(C.childNodes(t),s=>C.textContent(s)||"").join("");r.attributes.value=it({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:at(t),value:n,maskInputFn:this.maskInputFn})}),y(this,"processMutation",t=>{if(!Ct(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!oe(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Sr(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,Ir(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=Me(r.tagName),s=t.attributeName,o=t.target.getAttribute(s);if(s==="value"){let l=at(r);o=it({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:l,value:o,maskInputFn:this.maskInputFn})}if(oe(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(n==="iframe"&&s==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)s="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),s==="type"&&n==="input"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!br(n,s))if(a.attributes[s]=yr(this.doc,n,Me(s),o),s==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let l=this.unattachedDoc.createElement("span");t.oldValue&&l.setAttribute("style",t.oldValue);for(let i of Array.from(r.style)){let u=r.style.getPropertyValue(i),f=r.style.getPropertyPriority(i);u!==l.style.getPropertyValue(i)||f!==l.style.getPropertyPriority(i)?f===""?a.styleDiff[i]=u:a.styleDiff[i]=[u,f]:a._unchangedStyles[i]=[u,f]}for(let i of Array.from(l.style))r.style.getPropertyValue(i)===""&&(a.styleDiff[i]=!1)}else s==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(oe(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{Tt(r)||this.shadowDomManager.removeShadowRootsIn(r);let n=this.mirror.getId(r),s=$e(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);oe(t.target,this.blockClass,this.blockSelector,!1)||Ct(r,this.mirror,this.slimDOMOptions)||!jn(r,this.mirror)||(this.addedSet.has(r)?(Dt(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||Rr(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[nr(n,s)]?Dt(this.movedSet,r):(this.removes.push({parentId:s,id:n,isShadow:$e(t.target)&&Ge(t.target)?!0:void 0}),Vn(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),y(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(Ct(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[nr(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);oe(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),Et(t)&&C.childNodes(C.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}};function Dt(e,t){e.delete(t),C.childNodes(t).forEach(r=>Dt(e,r))}function Vn(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),C.childNodes(n).forEach(s=>r.push(s)))}}function sr(e,t){return e.size===0?!1:Or(e,t)}function Or(e,t){if(e.has(t))return!0;let r=C.parentNode(t);return r?Or(e,r):!1}var Ve;function Jn(e){Ve=e}function Xn(){Ve=void 0}var x=e=>Ve?(...r)=>{try{return e(...r)}catch(n){if(Ve&&Ve(n)===!0)return;throw n}}:e,Lt=null,We=new Set;function Ze(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function Tr(e,t){let r=new xt;We.add(r),r.init(e);let[n,s]=ur(),o=new n(x(r.processMutations.bind(r)));return o.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{o.disconnect(),We.delete(r),s()}}function Yn({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let s=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],l,i=Xe(x(p=>{let m=Date.now()-l;e(a.map(d=>(d.timeOffset-=m,d)),p),a=[],l=null}),o),u=x(Xe(x(p=>{let m=Ze(p),{clientX:d,clientY:h}=Nt(p)?p.changedTouches[0]:p;l||(l=Je()),a.push({x:d,y:h,id:n.getId(m),timeOffset:Je()-l}),i(typeof DragEvent<"u"&&p instanceof DragEvent?O.Drag:p instanceof MouseEvent?O.MouseMove:O.TouchMove)}),s,{trailing:!1})),f=[K("mousemove",u,r),K("touchmove",u,r),K("drag",u,r)];return x(()=>{f.forEach(p=>p())})}function Zn({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,l=[],i=null,u=f=>p=>{let m=Ze(p);if(oe(m,n,s,!0))return;let d=null,h=f;if("pointerType"in p){switch(p.pointerType){case"mouse":d=ge.Mouse;break;case"touch":d=ge.Touch;break;case"pen":d=ge.Pen;break}d===ge.Touch?ae[f]===ae.MouseDown?h="TouchStart":ae[f]===ae.MouseUp&&(h="TouchEnd"):ge.Pen}else Nt(p)&&(d=ge.Touch);d!==null?(i=d,(h.startsWith("Touch")&&d===ge.Touch||h.startsWith("Mouse")&&d===ge.Mouse)&&(d=null)):ae[f]===ae.Click&&(d=i,i=null);let c=Nt(p)?p.changedTouches[0]:p;if(!c)return;let b=r.getId(m),{clientX:v,clientY:M}=c;x(e)({type:ae[h],id:b,x:v,y:M,...d!==null&&{pointerType:d}})};return Object.keys(ae).filter(f=>Number.isNaN(Number(f))&&!f.endsWith("_Departed")&&a[f]!==!1).forEach(f=>{let p=Me(f),m=u(f);if(window.PointerEvent)switch(ae[f]){case ae.MouseDown:case ae.MouseUp:p=p.replace("mouse","pointer");break;case ae.TouchStart:case ae.TouchEnd:return}l.push(K(p,m,t))}),x(()=>{l.forEach(f=>f())})}function xr({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,sampling:o}){let a=x(Xe(x(l=>{let i=Ze(l);if(!i||oe(i,n,s,!0))return;let u=r.getId(i);if(i===t&&t.defaultView){let f=vr(t.defaultView);e({id:u,x:f.left,y:f.top})}else e({id:u,x:i.scrollLeft,y:i.scrollTop})}),o.scroll||100));return K("scroll",a,t)}function Kn({viewportResizeCb:e},{win:t}){let r=-1,n=-1,s=x(Xe(x(()=>{let o=Cr(),a=Mr();(r!==o||n!==a)&&(e({width:Number(a),height:Number(o)}),r=o,n=a)}),200));return K("resize",s,t)}var Qn=["INPUT","TEXTAREA","SELECT"],or=new WeakMap;function es({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:s,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:i,sampling:u,userTriggeredOnInput:f}){function p(M){let g=Ze(M),I=M.isTrusted,F=g&&g.tagName;if(g&&F==="OPTION"&&(g=C.parentElement(g)),!g||!F||Qn.indexOf(F)<0||oe(g,n,s,!0)||g.classList.contains(o)||a&&g.matches(a))return;let W=g.value,J=!1,le=at(g)||"";le==="radio"||le==="checkbox"?J=g.checked:(l[F.toLowerCase()]||l[le])&&(W=it({element:g,maskInputOptions:l,tagName:F,type:le,value:W,maskInputFn:i})),m(g,f?{text:W,isChecked:J,userTriggered:I}:{text:W,isChecked:J});let ee=g.name;le==="radio"&&ee&&J&&t.querySelectorAll(`input[type="radio"][name="${ee}"]`).forEach(te=>{if(te!==g){let re=te.value;m(te,f?{text:re,isChecked:!J,userTriggered:!1}:{text:re,isChecked:!J})}})}function m(M,g){let I=or.get(M);if(!I||I.text!==g.text||I.isChecked!==g.isChecked){or.set(M,g);let F=r.getId(M);x(e)({...g,id:F})}}let h=(u.input==="last"?["change"]:["input","change"]).map(M=>K(M,x(p),t)),c=t.defaultView;if(!c)return()=>{h.forEach(M=>M())};let b=c.Object.getOwnPropertyDescriptor(c.HTMLInputElement.prototype,"value"),v=[[c.HTMLInputElement.prototype,"value"],[c.HTMLInputElement.prototype,"checked"],[c.HTMLSelectElement.prototype,"value"],[c.HTMLTextAreaElement.prototype,"value"],[c.HTMLSelectElement.prototype,"selectedIndex"],[c.HTMLOptionElement.prototype,"selected"]];return b&&b.set&&h.push(...v.map(M=>ht(M[0],M[1],{set(){x(p)({target:this,isTrusted:!1})}},!1,c))),x(()=>{h.forEach(M=>M())})}function ut(e){let t=[];function r(n,s){if(tt("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||tt("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||tt("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||tt("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let a=Array.from(n.parentRule.cssRules).indexOf(n);return s.unshift(a),r(n.parentRule,s)}else if(n.parentStyleSheet){let a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);s.unshift(a)}return s}return r(e,t)}function Ce(e,t,r){let n,s;return e?(e.ownerNode?n=t.getId(e.ownerNode):s=r.getId(e),{styleId:s,id:n}):{}}function ts({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let s=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:x((f,p,m)=>{let[d,h]=m,{id:c,styleId:b}=Ce(p,t,r.styleMirror);return(c&&c!==-1||b&&b!==-1)&&e({id:c,styleId:b,adds:[{rule:d,index:h}]}),f.apply(p,m)})}),n.CSSStyleSheet.prototype.addRule=function(f,p,m=this.cssRules.length){let d=`${f} { ${p} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[d,m])};let o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:x((f,p,m)=>{let[d]=m,{id:h,styleId:c}=Ce(p,t,r.styleMirror);return(h&&h!==-1||c&&c!==-1)&&e({id:h,styleId:c,removes:[{index:d}]}),f.apply(p,m)})}),n.CSSStyleSheet.prototype.removeRule=function(f){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[f])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:x((f,p,m)=>{let[d]=m,{id:h,styleId:c}=Ce(p,t,r.styleMirror);return(h&&h!==-1||c&&c!==-1)&&e({id:h,styleId:c,replace:d}),f.apply(p,m)})}));let l;n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:x((f,p,m)=>{let[d]=m,{id:h,styleId:c}=Ce(p,t,r.styleMirror);return(h&&h!==-1||c&&c!==-1)&&e({id:h,styleId:c,replaceSync:d}),f.apply(p,m)})}));let i={};rt("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(rt("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),rt("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),rt("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let u={};return Object.entries(i).forEach(([f,p])=>{u[f]={insertRule:p.prototype.insertRule,deleteRule:p.prototype.deleteRule},p.prototype.insertRule=new Proxy(u[f].insertRule,{apply:x((m,d,h)=>{let[c,b]=h,{id:v,styleId:M}=Ce(d.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||M&&M!==-1)&&e({id:v,styleId:M,adds:[{rule:c,index:[...ut(d),b||0]}]}),m.apply(d,h)})}),p.prototype.deleteRule=new Proxy(u[f].deleteRule,{apply:x((m,d,h)=>{let[c]=h,{id:b,styleId:v}=Ce(d.parentStyleSheet,t,r.styleMirror);return(b&&b!==-1||v&&v!==-1)&&e({id:b,styleId:v,removes:[{index:[...ut(d),c]}]}),m.apply(d,h)})})}),x(()=>{n.CSSStyleSheet.prototype.insertRule=s,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(i).forEach(([f,p])=>{p.prototype.insertRule=u[f].insertRule,p.prototype.deleteRule=u[f].deleteRule})})}function Dr({mirror:e,stylesheetManager:t},r){var n,s,o;let a=null;r.nodeName==="#document"?a=e.getId(r):a=e.getId(C.host(r));let l=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(o=(s=r.ownerDocument)==null?void 0:s.defaultView)==null?void 0:o.ShadowRoot,i=l?.prototype?Object.getOwnPropertyDescriptor(l?.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!i?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){var u;return(u=i.get)==null?void 0:u.call(this)},set(u){var f;let p=(f=i.set)==null?void 0:f.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch{}return p}}),x(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function rs({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:s}){let o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:x((l,i,u)=>{var f;let[p,m,d]=u;if(r.has(p))return o.apply(i,[p,m,d]);let{id:h,styleId:c}=Ce((f=i.parentRule)==null?void 0:f.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||c&&c!==-1)&&e({id:h,styleId:c,set:{property:p,value:m,priority:d},index:ut(i.parentRule)}),l.apply(i,u)})});let a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:x((l,i,u)=>{var f;let[p]=u;if(r.has(p))return a.apply(i,[p]);let{id:m,styleId:d}=Ce((f=i.parentRule)==null?void 0:f.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&e({id:m,styleId:d,remove:{property:p},index:ut(i.parentRule)}),l.apply(i,u)})}),x(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}function ns({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:s,doc:o}){let a=x(i=>Xe(x(u=>{let f=Ze(u);if(!f||oe(f,t,r,!0))return;let{currentTime:p,volume:m,muted:d,playbackRate:h,loop:c}=f;e({type:i,id:n.getId(f),currentTime:p,volume:m,muted:d,playbackRate:h,loop:c})}),s.media||500)),l=[K("play",a(Le.Play),o),K("pause",a(Le.Pause),o),K("seeked",a(Le.Seeked),o),K("volumechange",a(Le.VolumeChange),o),K("ratechange",a(Le.RateChange),o)];return x(()=>{l.forEach(i=>i())})}function ss({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],s=new WeakMap,o=r.FontFace;r.FontFace=function(i,u,f){let p=new o(i,u,f);return s.set(p,{family:i,buffer:typeof u!="string",descriptors:f,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),p};let a=Ne(t.fonts,"add",function(l){return function(i){return setTimeout(x(()=>{let u=s.get(i);u&&(e(u),s.delete(i))}),0),l.apply(this,[i])}});return n.push(()=>{r.FontFace=o}),n.push(a),x(()=>{n.forEach(l=>l())})}function os(e){let{doc:t,mirror:r,blockClass:n,blockSelector:s,selectionCb:o}=e,a=!0,l=x(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let u=[],f=i.rangeCount||0;for(let p=0;p<f;p++){let m=i.getRangeAt(p),{startContainer:d,startOffset:h,endContainer:c,endOffset:b}=m;oe(d,n,s,!0)||oe(c,n,s,!0)||u.push({start:r.getId(d),startOffset:h,end:r.getId(c),endOffset:b})}o({ranges:u})});return l(),K("selectionchange",l)}function is({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Ne(r.customElements,"define",function(s){return function(o,a,l){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return s.apply(this,[o,a,l])}})}function as(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:s,scrollCb:o,viewportResizeCb:a,inputCb:l,mediaInteractionCb:i,styleSheetRuleCb:u,styleDeclarationCb:f,canvasMutationCb:p,fontCb:m,selectionCb:d,customElementCb:h}=e;e.mutationCb=(...c)=>{t.mutation&&t.mutation(...c),r(...c)},e.mousemoveCb=(...c)=>{t.mousemove&&t.mousemove(...c),n(...c)},e.mouseInteractionCb=(...c)=>{t.mouseInteraction&&t.mouseInteraction(...c),s(...c)},e.scrollCb=(...c)=>{t.scroll&&t.scroll(...c),o(...c)},e.viewportResizeCb=(...c)=>{t.viewportResize&&t.viewportResize(...c),a(...c)},e.inputCb=(...c)=>{t.input&&t.input(...c),l(...c)},e.mediaInteractionCb=(...c)=>{t.mediaInteaction&&t.mediaInteaction(...c),i(...c)},e.styleSheetRuleCb=(...c)=>{t.styleSheetRule&&t.styleSheetRule(...c),u(...c)},e.styleDeclarationCb=(...c)=>{t.styleDeclaration&&t.styleDeclaration(...c),f(...c)},e.canvasMutationCb=(...c)=>{t.canvasMutation&&t.canvasMutation(...c),p(...c)},e.fontCb=(...c)=>{t.font&&t.font(...c),m(...c)},e.selectionCb=(...c)=>{t.selection&&t.selection(...c),d(...c)},e.customElementCb=(...c)=>{t.customElement&&t.customElement(...c),h(...c)}}function ls(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};as(e,t);let n;e.recordDOM&&(n=Tr(e,e.doc));let s=Yn(e),o=Zn(e),a=xr(e),l=Kn(e,{win:r}),i=es(e),u=ns(e),f=()=>{},p=()=>{},m=()=>{},d=()=>{};e.recordDOM&&(f=ts(e,{win:r}),p=Dr(e,e.doc),m=rs(e,{win:r}),e.collectFonts&&(d=ss(e)));let h=os(e),c=is(e),b=[];for(let v of e.plugins)b.push(v.observer(v.callback,r,v.options));return x(()=>{n?.(),s(),o(),a(),l(),i(),u(),f(),p(),m(),d(),h(),c(),b.forEach(v=>v())})}function tt(e){return typeof window[e]<"u"}function rt(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ft=class{constructor(t){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,s){let o=n||this.getIdToRemoteIdMap(t),a=s||this.getRemoteIdToIdMap(t),l=o.get(r);return l||(l=this.generateIdFn(),o.set(r,l),a.set(l,r)),l}getIds(t,r){let n=this.getIdToRemoteIdMap(t),s=this.getRemoteIdToIdMap(t);return r.map(o=>this.getId(t,o,n,s))}getRemoteId(t,r,n){let s=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let o=s.get(r);return o||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(s=>this.getRemoteId(t,s,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},At=class{constructor(t){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new ft(gr)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"unloadListener"),y(this,"attachedWindows",new Map),y(this,"messageHandler",r=>this.handleMessage(r)),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ft(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}addUnloadListener(t){this.unloadListener=t}attachIframe(t,r){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(t),(n=this.loadListener)==null||n.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(t=>t())}watchIframeWindow(t){let r=t.contentWindow;if(!r||this.attachedWindows.has(r))return;let n=[],s=()=>{this.attachedWindows.delete(r),n.forEach(o=>{try{o()}catch{}})};this.attachedWindows.set(r,s),this.recordCrossOriginIframes&&n.push(K("message",this.messageHandler,r)),n.push(K("pagehide",o=>{var a;if(o.persisted)return;let l=r.document;s(),(a=this.unloadListener)==null||a.call(this,l)},r))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let s=this.crossOriginIframeMap.get(t.source);if(!s)return;let o=this.transformCrossOriginEvent(s,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case E.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let s=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,s),this.patchRootIdOnNode(r.data.node,s),{timestamp:r.timestamp,type:E.IncrementalSnapshot,data:{source:O.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case E.Meta:case E.Load:case E.DomContentLoaded:return!1;case E.Annotation:case E.Plugin:return r;case E.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case E.IncrementalSnapshot:switch(r.data.source){case O.Mutation:return r.data.adds.forEach(s=>{this.replaceIds(s,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(s.node,t);let o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(s.node,o)}),r.data.removes.forEach(s=>{this.replaceIds(s,t,["parentId","id"])}),r.data.attributes.forEach(s=>{this.replaceIds(s,t,["id"])}),r.data.texts.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case O.Drag:case O.TouchMove:case O.MouseMove:return r.data.positions.forEach(s=>{this.replaceIds(s,t,["id"])}),r;case O.ViewportResize:return!1;case O.MediaInteraction:case O.MouseInteraction:case O.Scroll:case O.CanvasMutation:case O.Input:return this.replaceIds(r.data,t,["id"]),r;case O.StyleSheetRule:case O.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case O.Font:return r;case O.Selection:return r.data.ranges.forEach(s=>{this.replaceIds(s,t,["start","end"])}),r;case O.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(s=>{this.replaceStyleIds(s,t,["styleId"])}),r}}return!1}replace(t,r,n,s){for(let o of s)!Array.isArray(r[o])&&typeof r[o]!="number"||(Array.isArray(r[o])?r[o]=t.getIds(n,r[o]):r[o]=t.getId(n,r[o]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==G.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},_t=class{constructor(t){y(this,"shadowDoms",new Map),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!Ge(t)||this.shadowDoms.has(t))return;let n=[];this.shadowDoms.set(t,n);let s=Tr({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);n.push(s),n.push(xr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(t)===n&&(t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(C.host(t))),n.push(Dr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)))},0)}removeShadowRootsIn(t){if(this.shadowDoms.size===0)return;let r=C.shadowRoot(t);r&&(this.shadowDoms.has(r)&&this.removeShadowRoot(r),this.removeShadowRootsIn(r)),C.childNodes(t).forEach(n=>this.removeShadowRootsIn(n))}removeShadowRoot(t){let r=this.shadowDoms.get(t);this.shadowDoms.delete(t),r?.forEach(Mt)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Ne(t.prototype,"attachShadow",function(s){return function(o){let a=s.call(this,o),l=C.shadowRoot(this);return l&&Tt(this)&&n.addShadowRoot(l,r),a}}))}reset(){this.restoreHandlers.forEach(Mt),this.restoreHandlers=[];let t=this.shadowDoms;this.shadowDoms=new Map,t.forEach(r=>r.forEach(Mt))}};function Mt(e){try{e()}catch{}}var Pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cs=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(je=0;je<Pe.length;je++)cs[Pe.charCodeAt(je)]=je;var je,ds=function(e){var t=new Uint8Array(e),r,n=t.length,s="";for(r=0;r<n;r+=3)s+=Pe[t[r]>>2],s+=Pe[(t[r]&3)<<4|t[r+1]>>4],s+=Pe[(t[r+1]&15)<<2|t[r+2]>>6],s+=Pe[t[r+2]&63];return n%3===2?s=s.substring(0,s.length-1)+"=":n%3===1&&(s=s.substring(0,s.length-2)+"=="),s},ir=new Map;function us(e,t){let r=ir.get(e);return r||(r=new Map,ir.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Lr=(e,t,r)=>{if(!e||!(_r(e,t)||typeof e=="object"))return;let n=e.constructor.name,s=us(r,n),o=s.indexOf(e);return o===-1&&(o=s.length,s.push(e)),o};function nt(e,t,r){if(e instanceof Array)return e.map(n=>nt(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){let n=e.constructor.name,s=ds(e);return{rr_type:n,base64:s}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[nt(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:s}=e;return{rr_type:n,src:s}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",s=e.toDataURL();return{rr_type:n,src:s}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[nt(e.data,t,r),e.width,e.height]};if(_r(e,t)||typeof e=="object"){let n=e.constructor.name,s=Lr(e,t,r);return{rr_type:n,index:s}}}}return e}var Ar=(e,t,r)=>e.map(n=>nt(n,t,r)),_r=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(s=>typeof t[s]=="function").find(s=>e instanceof t[s]);function fs(e,t,r,n){let s=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let l=Ne(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...u){return oe(this.canvas,r,n,!0)||setTimeout(()=>{let f=Ar(u,t,this);e(this.canvas,{type:Ue["2D"],property:a,args:f})},0),i.apply(this,u)}});s.push(l)}catch{let l=ht(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:Ue["2D"],property:a,args:[i],setter:!0})}});s.push(l)}return()=>{s.forEach(a=>a())}}function hs(e){return e==="experimental-webgl"?"webgl":e}function ar(e,t,r,n){let s=[];try{let o=Ne(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...i){if(!oe(this,t,r,!0)){let u=hs(l);if("__context"in this||(this.__context=u),n&&["webgl","webgl2"].includes(u))if(i[0]&&typeof i[0]=="object"){let f=i[0];f.preserveDrawingBuffer||(f.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...i])}});s.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(o=>o())}}function lr(e,t,r,n,s,o){let a=[],l=Object.getOwnPropertyNames(e);for(let i of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let u=Ne(e,i,function(f){return function(...p){let m=f.apply(this,p);if(Lr(m,o,this),"tagName"in this.canvas&&!oe(this.canvas,n,s,!0)){let d=Ar(p,o,this),h={type:t,property:i,args:d};r(this.canvas,h)}return m}});a.push(u)}catch{let u=ht(e,i,{set(f){r(this.canvas,{type:t,property:i,args:[f],setter:!0})}});a.push(u)}return a}function ps(e,t,r,n){let s=[];return typeof t.WebGLRenderingContext<"u"&&s.push(...lr(t.WebGLRenderingContext.prototype,Ue.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&s.push(...lr(t.WebGL2RenderingContext.prototype,Ue.WebGL2,e,r,n,t)),()=>{s.forEach(o=>o())}}var Fr=`(function() {
|
|
4
4
|
"use strict";
|
|
5
5
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
6
6
|
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
@@ -75,5 +75,5 @@ or you can use record.mirror to access the mirror instance during recording.`,_t
|
|
|
75
75
|
};
|
|
76
76
|
})();
|
|
77
77
|
//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map
|
|
78
|
-
`,zt=typeof self<"u"&&self.Blob&&new Blob([mr],{type:"text/javascript;charset=utf-8"});function Hn(e){let t;try{if(t=zt&&(self.URL||self.webkitURL).createObjectURL(zt),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(mr),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Ct=class{constructor(t){g(this,"pendingCanvasMutations",new Map),g(this,"rafStamps",{latestId:0,invokeId:null}),g(this,"mirror"),g(this,"mutationCb"),g(this,"resetObservers"),g(this,"frozen",!1),g(this,"locked",!1),g(this,"processMutation",(i,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(u)});let{sampling:r="all",win:n,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:c}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,o,s),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,s,{dataURLOptions:c})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,o,s){let a=Bt(r,n,o,!0),c=new Map,i=new Hn;i.onmessage=m=>{let{id:l}=m.data;if(c.set(l,!1),!("base64"in m.data))return;let{base64:S,type:v,width:M,height:y}=m.data;this.mutationCb({id:l,type:Ee["2D"],commands:[{property:"clearRect",args:[0,0,M,y]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:S}],type:v}]},0,0]}]})};let u=1e3/t,d=0,h,p=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(l=>{X(l,n,o,!0)||m.push(l)}),m},f=m=>{if(d&&m-d<u){h=requestAnimationFrame(f);return}d=m,p().forEach(async l=>{var S;let v=this.mirror.getId(l);if(c.get(v)||l.width===0||l.height===0)return;if(c.set(v,!0),["webgl","webgl2"].includes(l.__context)){let y=l.getContext(l.__context);((S=y?.getContextAttributes())==null?void 0:S.preserveDrawingBuffer)===!1&&y.clear(y.COLOR_BUFFER_BIT)}let M=await createImageBitmap(l);i.postMessage({id:v,bitmap:M,width:l.width,height:l.height,dataURLOptions:s.dataURLOptions},[M])}),h=requestAnimationFrame(f)};h=requestAnimationFrame(f),this.resetObservers=()=>{a(),cancelAnimationFrame(h)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=Bt(t,r,n,!1),s=Wn(this.processMutation.bind(this),t,r,n),a=Bn(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{o(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let o=n.map(a=>{let{type:c,...i}=a;return i}),{type:s}=n[0];this.mutationCb({id:r,type:s,commands:o}),this.pendingCanvasMutations.delete(t)}},vt=class{constructor(t){g(this,"trackedLinkElements",new WeakSet),g(this,"mutationCb"),g(this,"adoptedStyleSheetCb"),g(this,"styleMirror",new pt),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},o=[];for(let s of t){let a;this.styleMirror.has(s)?a=this.styleMirror.getId(s):(a=this.styleMirror.add(s),o.push({styleId:a,rules:Array.from(s.rules||CSSRule,(c,i)=>({rule:Vt(c,s.href),index:i}))})),n.styleIds.push(a)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Mt=class{constructor(){g(this,"nodeMap",new WeakMap),g(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},B,Xe,ue,He=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Et=e.contentWindow)==null?void 0:Et.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var ne=Hr();function pe(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:c=null,maskTextClass:i="rr-mask",maskTextSelector:u=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:f,maskInputFn:m,maskTextFn:l,hooks:S,packFn:v,sampling:M={},dataURLOptions:y={},mousemoveWait:R,recordDOM:D=!0,recordCanvas:F=!1,recordCrossOriginIframes:z=!1,recordAfter:Y=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:$=!1,collectFonts:V=!1,inlineImages:J=!1,plugins:Z,keepIframeSrcFn:k=()=>!1,ignoreCSSAttributes:de=new Set([]),errorHandler:oe}=e;wn(oe);let U=z?window.parent===window:!0,G=!1;if(!U)try{window.parent.document&&(G=!1)}catch{G=!0}if(U&&!t)throw new Error("emit function is required");if(!U&&!G)return()=>{};R!==void 0&&M.mousemove===void 0&&(M.mousemove=R),ne.reset();let se=h===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},ee=Kt(f);gn();let Te,ye=0,xe=x=>{for(let w of Z||[])w.eventProcessor&&(x=w.eventProcessor(x));return v&&!G&&(x=v(x)),x};B=(x,w)=>{let b=x;if(b.timestamp=Ue(),b.type!==E.FullSnapshot&&!(b.type===E.IncrementalSnapshot&&b.data.source===O.Mutation)){ue.unfreeze();for(let N of Ne)if(N.isFrozen())N.unfreeze();else break}if(U)t?.(xe(b),w);else if(G){let N={type:"rrweb",event:xe(b),origin:window.location.origin,isCheckout:w};window.parent.postMessage(N,"*")}if(b.type===E.FullSnapshot)Te=b,ye=0;else if(b.type===E.IncrementalSnapshot){if(b.data.source===O.Mutation&&b.data.isAttachIframe)return;ye++;let N=n&&ye>=n,P=r&&b.timestamp-Te.timestamp>r;(N||P)&&Xe(!0)}};let be=x=>{B({type:E.IncrementalSnapshot,data:{source:O.Mutation,...x}})},me=x=>B({type:E.IncrementalSnapshot,data:{source:O.Scroll,...x}}),Se=x=>B({type:E.IncrementalSnapshot,data:{source:O.CanvasMutation,...x}}),ot=x=>B({type:E.IncrementalSnapshot,data:{source:O.AdoptedStyleSheet,...x}}),ae=new vt({mutationCb:be,adoptedStyleSheetCb:ot}),re=new St({mirror:ne,mutationCb:be,stylesheetManager:ae,recordCrossOriginIframes:z,wrappedEmit:B});for(let x of Z||[])x.getMirror&&x.getMirror({nodeMirror:ne,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});let Le=new Mt;ue=new Ct({recordCanvas:F,mutationCb:Se,win:window,blockClass:o,blockSelector:s,mirror:ne,sampling:M.canvas,dataURLOptions:y});let le=new wt({mutationCb:be,scrollCb:me,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:u,inlineStylesheet:d,maskInputOptions:se,dataURLOptions:y,maskTextFn:l,maskInputFn:m,recordCanvas:F,inlineImages:J,sampling:M,slimDOMOptions:ee,iframeManager:re,stylesheetManager:ae,canvasManager:ue,keepIframeSrcFn:k,processedNodeManager:Le},mirror:ne});Xe=(x=!1)=>{if(!D)return;B({type:E.Meta,data:{href:window.location.href,width:rr(),height:tr()}},x),ae.reset(),le.init(),ue.lock(),Ne.forEach(b=>b.lock());let w=pn(document,{mirror:ne,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:u,inlineStylesheet:d,maskAllInputs:se,maskTextFn:l,maskInputFn:m,slimDOM:ee,dataURLOptions:y,recordCanvas:F,inlineImages:J,onSerialize:b=>{b.nodeType===1&&(sr(b,ne)&&re.addIframe(b),ir(b,ne)&&ae.trackLinkElement(b),ft(b)&&le.addShadowRoot(C.shadowRoot(b),document))},onIframeLoad:(b,N)=>{re.attachIframe(b,N),le.observeAttachShadow(b)},onStylesheetLoad:(b,N)=>{ae.attachLinkElement(b,N)},keepIframeSrcFn:k});if(!w)return console.warn("Failed to snapshot the document");B({type:E.FullSnapshot,data:{node:w,initialOffset:er(window)}},x),ue.unlock(),Ne.forEach(b=>b.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ae.adoptStyleSheets(document.adoptedStyleSheets,ne.getId(document))};try{let x=[],w=P=>{var L;return T(An)({mutationCb:be,mousemoveCb:(I,A)=>B({type:E.IncrementalSnapshot,data:{source:A,positions:I}}),mouseInteractionCb:I=>B({type:E.IncrementalSnapshot,data:{source:O.MouseInteraction,...I}}),scrollCb:me,viewportResizeCb:I=>B({type:E.IncrementalSnapshot,data:{source:O.ViewportResize,...I}}),inputCb:I=>B({type:E.IncrementalSnapshot,data:{source:O.Input,...I}}),mediaInteractionCb:I=>B({type:E.IncrementalSnapshot,data:{source:O.MediaInteraction,...I}}),styleSheetRuleCb:I=>B({type:E.IncrementalSnapshot,data:{source:O.StyleSheetRule,...I}}),styleDeclarationCb:I=>B({type:E.IncrementalSnapshot,data:{source:O.StyleDeclaration,...I}}),canvasMutationCb:Se,fontCb:I=>B({type:E.IncrementalSnapshot,data:{source:O.Font,...I}}),selectionCb:I=>{B({type:E.IncrementalSnapshot,data:{source:O.Selection,...I}})},customElementCb:I=>{B({type:E.IncrementalSnapshot,data:{source:O.CustomElement,...I}})},blockClass:o,ignoreClass:a,ignoreSelector:c,maskTextClass:i,maskTextSelector:u,maskInputOptions:se,inlineStylesheet:d,sampling:M,recordDOM:D,recordCanvas:F,inlineImages:J,userTriggeredOnInput:$,collectFonts:V,doc:P,maskInputFn:m,maskTextFn:l,keepIframeSrcFn:k,blockSelector:s,slimDOMOptions:ee,dataURLOptions:y,mirror:ne,iframeManager:re,stylesheetManager:ae,shadowDomManager:le,processedNodeManager:Le,canvasManager:ue,ignoreCSSAttributes:de,plugins:((L=Z?.filter(I=>I.observer))==null?void 0:L.map(I=>({observer:I.observer,options:I.options,callback:A=>B({type:E.Plugin,data:{plugin:I.name,payload:A}})})))||[]},S)},b=new Map;re.addLoadListener(P=>{try{let L=P.contentDocument;if(b.has(L))return;b.set(L,w(L))}catch(L){console.warn(L)}}),re.addUnloadListener(P=>{let L=b.get(P);L&&(b.delete(P),L(),le.removeShadowRootsIn(P),ne.removeNodeFromMap(P))});let N=()=>{Xe(),x.push(w(document)),He=!0};return["interactive","complete"].includes(document.readyState)?N():(x.push(q("DOMContentLoaded",()=>{B({type:E.DomContentLoaded,data:{}}),Y==="DOMContentLoaded"&&N()})),x.push(q("load",()=>{B({type:E.Load,data:{}}),Y==="load"&&N()},window))),()=>{[...x,...b.values()].forEach(P=>{try{P()}catch(L){String(L).toLowerCase().includes("cross-origin")||console.warn(L)}}),b.clear(),re.destroy(),Le.destroy(),le.reset(),ue.reset(),He=!1,Cn()}}catch(x){console.warn(x)}}pe.addCustomEvent=(e,t)=>{if(!He)throw new Error("please add custom event after start recording");B({type:E.Custom,data:{tag:e,payload:t}})};pe.addAnnotation=e=>{if(!He)throw new Error("please add annotation after recording started");B({type:E.Annotation,data:e})};pe.freezePage=()=>{ue.freeze(),Ne.forEach(e=>e.freeze())};pe.takeFullSnapshot=e=>{if(!He)throw new Error("please take full snapshot after start recording");Xe(e)};pe.mirror=ne;pe.setMutationHook=e=>{bt=e};var Oe=pe,gr=1e4,zn="[data-rp-throttle]";function $n(e){try{jn(e)}catch{}}var Gn=()=>{let e=new URL("./worker.js",import.meta.url).href;try{return new Worker(e)}catch{return new Worker(URL.createObjectURL(new Blob([`importScripts(${JSON.stringify(e)})`],{type:"text/javascript"})))}};function jn(e){let t=e.o(),r=t.replay,n=t.redact,o=window,s=document,a=Oe.mirror,c=Gn(),i=`.rr-mask,${r.maskSelector??"[data-rp-mask]"}`,u=[],d=0,h=0,p=()=>{let w=n.headers.length+n.bodyKeys.length+n.queryParams.length;return w!=h?(h=w,n):0},f=()=>{u.length&&(c.postMessage([1,u,p()]),u=[],d=1)},m=w=>{u.push(w)>=300&&f()},l=w=>m({type:5,timestamp:w.ts,data:{tag:w.type,payload:w.data}}),S={n:s,id:-1,i:0,s:!1,q:!1,e:0},v=[],M=0,y=new WeakMap,R=0,D=Symbol(),F=w=>{let b=w[D];return b&&b.g==R?b:void 0},z=(w,b)=>w[D]=b==S?{...S,g:R}:Object.assign(b,{g:R}),Y=w=>{let b=y.get(w);if(b===void 0){let N=w.closest?.(zn);b=N&&+N.getAttribute("data-rp-throttle")||0,b&&(r.maskAllText||w.closest(i))&&(b=-b),y.set(w,b)}return b},$=w=>{for(let b=0;b<w.length;b++)if(w[b].nodeType!=3)return!1;return!0},V=w=>{if(!w.q){w.q=!0,M++;let b=(w.i<0?-w.i:w.i)/500|0,N=w.id<0||b<2?0:w.id%b;(v[N]??=[]).push(w)}},J=w=>{let b=null,N=0;for(let P=0;P<w.length;P++){let L=w[P],I=L.target,A=!1;if(L.type=="characterData"){let j=F(I);if(!j){let Q=I.parentNode,W=Q?Y(Q):0;j=z(I,W?{n:I,id:-2,i:W,s:!1,q:!1,e:0}:S)}j.i&&(V(j),A=!0)}else if(L.type=="childList"){let j=F(I),Q=I.firstChild;if(j?.s)Q===I.lastChild&&(!Q||Q.nodeType==3)&&(V(j),A=!0);else if(I.nodeType==1&&Y(I)&&Q===I.lastChild&&$(L.addedNodes)&&$(L.removedNodes)){if(!j){let W=L.removedNodes[0],ie=W?a.getId(W):-1;ie>0&&(j=z(I,{n:I,id:ie,i:Y(I),s:!0,q:!1,e:0}))}j&&(V(j),A=!0)}if(!A&&N<=gr){let W=L.addedNodes;for(let ie=0;ie<W.length;ie++)N+=1+(W[ie].getElementsByTagName?.("*").length??0)}}A?b??=w.slice(0,P):b&&b.push(L)}return N>gr?(Oe.takeFullSnapshot(!0),[]):b??w},Z=0,k=()=>{if(Z++,!M)return;let w=new Int32Array(M),b=0,N="",P=[],L=Date.now();for(let A=0;A<v.length;A++){let j=v[A];if(!j?.length)continue;let Q=[];for(let W of j){let ie=W.i,kt=ie<0?-ie:ie,we=kt/500|0;if(we>1&&W.id>=0&&Z%we!=W.id%we||L-W.e<kt-50){Q.push(W);continue}W.q=!1,M--;let De=W.n;if(W.id<0){let Ge=a.getId(De);if(Ge<0||a.getNode(Ge)!==De)continue;if(W.id=Ge,we>1&&Z%we!=Ge%we){V(W);continue}}else if(!De.isConnected)continue;W.e=L;let Nt=(W.s?De.textContent:De.nodeValue)??"";N+=(b?"\0":"")+(ie<0?Nt.replace(/\S/g,"*"):Nt),w[b++]=W.id}P[A]=Q}for(let A=0;A<P.length;A++)P[A]&&(v[A]=P[A]);if(!b)return;let I=b==w.length?w:w.slice(0,b);c.postMessage([2,I,N,Date.now(),u,p()],[I.buffer]),u=[],d=1},de=()=>{k(),f()},oe="",U=-1,G=0,se=0,ee=0,Te=-1,ye,xe=navigator,be=()=>{let w=e.m(),b=w.ctx.app??{};return{url:location.href,ref:s.referrer,ua:xe.userAgent,vw:o.innerWidth,vh:o.innerHeight,lang:xe.language,release:t.release,env:t.environment,platform:e.platform,user:w.user,app_ver:t.appVersion??b.version,device:b.device,os_ver:b.os,wv_ver:b.webview,...e.clock?.(e.sess().st)}},me=w=>{if(ee)return;if(!e.en())return le();if(f(),!d)return;d=0;let b=e.sess(),N=oe&&b.id!=oe,P=N?U+1:(oe=b.id,e.seq()),L=e.c.ws_disc,I=L>=se?L-se:L;se=L;let A=e.m(),j=A.fields_version??0,Q=t.appVersion??A.ctx.app?.version,W=!G||j!==Te||Q!==ye?{user:A.user??null,custom_fields:A.custom_fields??{},tags:A.tags,app_ver:Q}:void 0;c.postMessage([3,{sid:oe,seq:P,ws_disc:I,ie:e.ie(),fields:W,...G?{}:{init:be()}},t.redact,!!w]),Te=j,ye=Q,U=P,G=1,N&&(oe=b.id,U=-1,G=0,Oe.takeFullSnapshot(!0))},Se=()=>{de(),me(!0)},ot=()=>s.visibilityState=="hidden"&&Se(),ae=()=>c.postMessage([4]),re=[[o,"pagehide",Se],[s,"visibilitychange",ot],[o,"online",ae],[o,"replayd:resume",ae],[o,"replayd:flush",Se]],Le=[setInterval(de,500),setInterval(me,5e3)],le=()=>{ee=1;for(let w of Le)clearInterval(w);Oe.setMutationHook(null),e.sink(null),e.onError(()=>{});for(let[w,b,N]of re)w.removeEventListener(b,N);try{x?.()}catch{}c.terminate()};c.postMessage([0,new URL(e.url("replay"),location.href).href,t.redact,(t.websocket.channelOf??"centrifugo-json")=="centrifugo-json"?1:0,t.websocket.sample.perChannelPerSec,e.platform!="web"||!!t.offlineQueue]),c.onmessage=w=>w.data[0]?le():me(),c.onerror=le;for(let[w,b,N]of re)w.addEventListener(b,N);e.onError(()=>me()),Oe.setMutationHook(J);let x=Oe({emit:w=>{if(w.type==2){y=new WeakMap,R++;for(let b of v)for(let N of b??[])N.q=!1;v=[],M=0}m(w)},checkoutEveryNms:6e5,sampling:{mousemove:50,mouseInteraction:!0,scroll:150,media:800,input:"last"},blockSelector:r.blockSelector??"[data-rp-block]",maskTextSelector:r.maskAllText?"*":r.maskSelector??"[data-rp-mask]",maskAllInputs:!!r.maskAllInputs,maskInputOptions:{password:!0},recordCanvas:!1,collectFonts:!1,inlineImages:!1,inlineStylesheet:!0,slimDOMOptions:"all",recordCrossOriginIframes:!1});for(let w of e.drain())l(w);e.sink(l)}export{$n as startReplay};
|
|
78
|
+
`,cr=typeof self<"u"&&self.Blob&&new Blob([Fr],{type:"text/javascript;charset=utf-8"});function ms(e){let t;try{if(t=cr&&(self.URL||self.webkitURL).createObjectURL(cr),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Fr),{name:e?.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}var Ft=class{constructor(t){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(i,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(i)||this.pendingCanvasMutations.set(i,[]),this.pendingCanvasMutations.get(i).push(u)});let{sampling:r="all",win:n,blockClass:s,blockSelector:o,recordCanvas:a,dataURLOptions:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&r==="all"&&this.initCanvasMutationObserver(n,s,o),a&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,s,o,{dataURLOptions:l})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,s,o){let a=ar(r,n,s,!0),l=new Map,i=new ms;i.onmessage=h=>{let{id:c}=h.data;if(l.set(c,!1),!("base64"in h.data))return;let{base64:b,type:v,width:M,height:g}=h.data;this.mutationCb({id:c,type:Ue["2D"],commands:[{property:"clearRect",args:[0,0,M,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:b}],type:v}]},0,0]}]})};let u=1e3/t,f=0,p,m=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(c=>{oe(c,n,s,!0)||h.push(c)}),h},d=h=>{if(f&&h-f<u){p=requestAnimationFrame(d);return}f=h,m().forEach(async c=>{var b;let v=this.mirror.getId(c);if(l.get(v)||c.width===0||c.height===0)return;if(l.set(v,!0),["webgl","webgl2"].includes(c.__context)){let g=c.getContext(c.__context);((b=g?.getContextAttributes())==null?void 0:b.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let M=await createImageBitmap(c);i.postMessage({id:v,bitmap:M,width:c.width,height:c.height,dataURLOptions:o.dataURLOptions},[M])}),p=requestAnimationFrame(d)};p=requestAnimationFrame(d),this.resetObservers=()=>{a(),cancelAnimationFrame(p)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let s=ar(t,r,n,!1),o=fs(this.processMutation.bind(this),t,r,n),a=ps(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{s(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let s=n.map(a=>{let{type:l,...i}=a;return i}),{type:o}=n[0];this.mutationCb({id:r,type:o,commands:s}),this.pendingCanvasMutations.delete(t)}},Pt=class{constructor(t){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new Ot),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},s=[];for(let o of t){let a;this.styleMirror.has(o)?a=this.styleMirror.getId(o):(a=this.styleMirror.add(o),s.push({styleId:a,rules:Array.from(o.rules||CSSRule,(l,i)=>({rule:hr(l,o.href),index:i}))})),n.styleIds.push(a)}s.length>0&&(n.styles=s),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Wt=class{constructor(){y(this,"nodeMap",new WeakMap),y(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(s=>s!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},H,st,ve,Ye=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Xt=e.contentWindow)==null?void 0:Xt.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var pe=gn();function Ie(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:s="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:i="rr-mask",maskTextSelector:u=null,inlineStylesheet:f=!0,maskAllInputs:p,maskInputOptions:m,slimDOMOptions:d,maskInputFn:h,maskTextFn:c,hooks:b,packFn:v,sampling:M={},dataURLOptions:g={},mousemoveWait:I,recordDOM:F=!0,recordCanvas:W=!1,recordCrossOriginIframes:J=!1,recordAfter:le=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:ee=!1,collectFonts:te=!1,inlineImages:re=!1,plugins:ne,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:me=new Set([]),errorHandler:ye}=e;Jn(ye);let z=J?window.parent===window:!0,V=!1;if(!z)try{window.parent.document&&(V=!1)}catch{V=!0}if(z&&!t)throw new Error("emit function is required");if(!z&&!V)return()=>{};I!==void 0&&M.mousemove===void 0&&(M.mousemove=I),pe.reset();let fe=p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m!==void 0?m:{password:!0},Q=wr(d);qn();let Oe,be=0,Se=T=>{for(let se of ne||[])se.eventProcessor&&(T=se.eventProcessor(T));return v&&!V&&(T=v(T)),T};H=(T,se)=>{let R=T;if(R.timestamp=Je(),R.type!==E.FullSnapshot&&!(R.type===E.IncrementalSnapshot&&R.data.source===O.Mutation)){ve.unfreeze();for(let X of We)if(X.isFrozen())X.unfreeze();else break}if(z)t?.(Se(R),se);else if(V){let X={type:"rrweb",event:Se(R),origin:window.location.origin,isCheckout:se};window.parent.postMessage(X,"*")}if(R.type===E.FullSnapshot)Oe=R,be=0;else if(R.type===E.IncrementalSnapshot){if(R.data.source===O.Mutation&&R.data.isAttachIframe)return;be++;let X=n&&be>=n,ie=r&&R.timestamp-Oe.timestamp>r;(X||ie)&&st(!0)}};let Re=T=>{H({type:E.IncrementalSnapshot,data:{source:O.Mutation,...T}})},Be=T=>H({type:E.IncrementalSnapshot,data:{source:O.Scroll,...T}}),Te=T=>H({type:E.IncrementalSnapshot,data:{source:O.CanvasMutation,...T}}),mt=T=>H({type:E.IncrementalSnapshot,data:{source:O.AdoptedStyleSheet,...T}}),ce=new Pt({mutationCb:Re,adoptedStyleSheetCb:mt}),de=new At({mirror:pe,mutationCb:Re,stylesheetManager:ce,recordCrossOriginIframes:J,wrappedEmit:H});for(let T of ne||[])T.getMirror&&T.getMirror({nodeMirror:pe,crossOriginIframeMirror:de.crossOriginIframeMirror,crossOriginIframeStyleMirror:de.crossOriginIframeStyleMirror});let he=new Wt;ve=new Ft({recordCanvas:W,mutationCb:Te,win:window,blockClass:s,blockSelector:o,mirror:pe,sampling:M.canvas,dataURLOptions:g});let j=new _t({mutationCb:Re,scrollCb:Be,bypassOptions:{blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:u,inlineStylesheet:f,maskInputOptions:fe,dataURLOptions:g,maskTextFn:c,maskInputFn:h,recordCanvas:W,inlineImages:re,sampling:M,slimDOMOptions:Q,iframeManager:de,stylesheetManager:ce,canvasManager:ve,keepIframeSrcFn:N,processedNodeManager:he},mirror:pe});st=(T=!1)=>{if(!F)return;H({type:E.Meta,data:{href:window.location.href,width:Mr(),height:Cr()}},T),ce.reset(),j.init(),ve.lock(),We.forEach(R=>R.lock());let se=zn(document,{mirror:pe,blockClass:s,blockSelector:o,maskTextClass:i,maskTextSelector:u,inlineStylesheet:f,maskAllInputs:fe,maskTextFn:c,maskInputFn:h,slimDOM:Q,dataURLOptions:g,recordCanvas:W,inlineImages:re,onSerialize:R=>{R.nodeType===1&&(kr(R,pe)&&de.addIframe(R),Nr(R,pe)&&ce.trackLinkElement(R),Et(R)&&j.addShadowRoot(C.shadowRoot(R),document))},onIframeLoad:(R,X)=>{de.attachIframe(R,X),j.observeAttachShadow(R)},onStylesheetLoad:(R,X)=>{ce.attachLinkElement(R,X)},keepIframeSrcFn:N});if(!se)return console.warn("Failed to snapshot the document");H({type:E.FullSnapshot,data:{node:se,initialOffset:vr(window)}},T),ve.unlock(),We.forEach(R=>R.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ce.adoptStyleSheets(document.adoptedStyleSheets,pe.getId(document))};try{let T=[],se=ie=>{var Y;return x(ls)({mutationCb:Re,mousemoveCb:(P,He)=>H({type:E.IncrementalSnapshot,data:{source:He,positions:P}}),mouseInteractionCb:P=>H({type:E.IncrementalSnapshot,data:{source:O.MouseInteraction,...P}}),scrollCb:Be,viewportResizeCb:P=>H({type:E.IncrementalSnapshot,data:{source:O.ViewportResize,...P}}),inputCb:P=>H({type:E.IncrementalSnapshot,data:{source:O.Input,...P}}),mediaInteractionCb:P=>H({type:E.IncrementalSnapshot,data:{source:O.MediaInteraction,...P}}),styleSheetRuleCb:P=>H({type:E.IncrementalSnapshot,data:{source:O.StyleSheetRule,...P}}),styleDeclarationCb:P=>H({type:E.IncrementalSnapshot,data:{source:O.StyleDeclaration,...P}}),canvasMutationCb:Te,fontCb:P=>H({type:E.IncrementalSnapshot,data:{source:O.Font,...P}}),selectionCb:P=>{H({type:E.IncrementalSnapshot,data:{source:O.Selection,...P}})},customElementCb:P=>{H({type:E.IncrementalSnapshot,data:{source:O.CustomElement,...P}})},blockClass:s,ignoreClass:a,ignoreSelector:l,maskTextClass:i,maskTextSelector:u,maskInputOptions:fe,inlineStylesheet:f,sampling:M,recordDOM:F,recordCanvas:W,inlineImages:re,userTriggeredOnInput:ee,collectFonts:te,doc:ie,maskInputFn:h,maskTextFn:c,keepIframeSrcFn:N,blockSelector:o,slimDOMOptions:Q,dataURLOptions:g,mirror:pe,iframeManager:de,stylesheetManager:ce,shadowDomManager:j,processedNodeManager:he,canvasManager:ve,ignoreCSSAttributes:me,plugins:((Y=ne?.filter(P=>P.observer))==null?void 0:Y.map(P=>({observer:P.observer,options:P.options,callback:He=>H({type:E.Plugin,data:{plugin:P.name,payload:He}})})))||[]},b)},R=new Map;de.addLoadListener(ie=>{try{let Y=ie.contentDocument;if(R.has(Y))return;R.set(Y,se(Y))}catch(Y){console.warn(Y)}}),de.addUnloadListener(ie=>{let Y=R.get(ie);Y&&(R.delete(ie),Y(),j.removeShadowRootsIn(ie),pe.removeNodeFromMap(ie))});let X=()=>{st(),T.push(se(document)),Ye=!0};return["interactive","complete"].includes(document.readyState)?X():(T.push(K("DOMContentLoaded",()=>{H({type:E.DomContentLoaded,data:{}}),le==="DOMContentLoaded"&&X()})),T.push(K("load",()=>{H({type:E.Load,data:{}}),le==="load"&&X()},window))),()=>{[...T,...R.values()].forEach(ie=>{try{ie()}catch(Y){String(Y).toLowerCase().includes("cross-origin")||console.warn(Y)}}),R.clear(),de.destroy(),he.destroy(),j.reset(),ve.reset(),Ye=!1,Xn()}}catch(T){console.warn(T)}}Ie.addCustomEvent=(e,t)=>{if(!Ye)throw new Error("please add custom event after start recording");H({type:E.Custom,data:{tag:e,payload:t}})};Ie.addAnnotation=e=>{if(!Ye)throw new Error("please add annotation after recording started");H({type:E.Annotation,data:e})};Ie.freezePage=()=>{ve.freeze(),We.forEach(e=>e.freeze())};Ie.takeFullSnapshot=e=>{if(!Ye)throw new Error("please take full snapshot after start recording");st(e)};Ie.mirror=pe;Ie.setMutationHook=e=>{Lt=e};var Pr=(e,t)=>{let r=[],n=0,s=0,o=0,a=0,l=0,i=0,u=0,f=[],p=d=>typeof d=="string"&&f.length<10&&!f.includes(d)&&f.push(d),m=()=>{r=[],n=s=a=l=i=u=0,f=[]};return{raw:()=>n,n:()=>s,reset:m,add(d){let h=d.data,c=d.timestamp;if(d.type==4&&h.href)p(h.href=e.u(h.href));else if(d.type==3&&h.source==2&&h.type==2)l++;else if(d.type==5){let v=h.payload;if(h.tag=="error")v.level=="warning"?u++:i++;else if(h.tag=="fields")v.value=e.j(v.value);else if(h.tag=="nav"&&typeof v.to=="string")p(v.to=e.u(v.to));else if(h.tag=="network")for(let M of["reqBody","resBody"])typeof v[M]=="string"&&(v[M]=e.t(v[M]));else if(h.tag=="ws"&&typeof v.raw=="string"){if(t&&v.dir=="in"){let M=t(v.raw,c);if(M==null)return;v.raw=M}v.raw=e.t(v.raw)}}s++||(o=c),c>a&&(a=c);let b=JSON.stringify(d);n+=b.length,r.push(b)},take(d,h){d.init&&(d.init.url=e.u(d.init.url),d.init.ref=e.u(d.init.ref),d.init.user=e.j(d.init.user)),d.fields&&(d.fields.user=e.j(d.fields.user),d.fields.custom_fields=e.j(d.fields.custom_fields),d.fields.tags=e.j(d.fields.tags),new TextEncoder().encode(JSON.stringify(d.fields.tags)).length>8192&&delete d.fields.tags),h&&r.unshift(JSON.stringify({type:5,timestamp:o,data:{tag:"gap",payload:{reason:"dropped",segments:h}}}));let c=JSON.stringify({canvas_bytes:0,...d,t0:o,t1:a,enc:"gzip",n:s,urls:f,clicks:l,errs:i,warns:u,has_error:i>0,gap:h>0}),b=`[${r.join(",")}]`;return m(),[c,b]}}},pt,Wr=e=>{if(!pt){pt=new Int32Array(256);for(let i=0;i<256;i++){let u=i;for(let f=0;f<8;f++)u=u&1?3988292384^u>>>1:u>>>1;pt[i]=u}}let t=e.length,r=Math.ceil(t/65535)||1,n=new Uint8Array(18+t+r*5),s=new DataView(n.buffer);n.set([31,139,8,0,0,0,0,0,0,255]);let o=10,a=0,l=-1;for(let i=0;i<r;i++){let u=Math.min(65535,t-a);n[o]=+(i==r-1),s.setUint16(o+1,u,!0),s.setUint16(o+3,~u,!0),n.set(e.subarray(a,a+=u),o+=5),o+=u}for(let i=0;i<t;i++)l=pt[(l^e[i])&255]^l>>>8;return s.setUint32(o,~l,!0),s.setUint32(o+4,t,!0),n},Ur=(e,t)=>{let r=new TextEncoder().encode(e),n=new Uint8Array(8+r.length+t.length),s=new DataView(n.buffer);return s.setUint16(0,r.length,!0),n.set(r,2),s.setUint32(2+r.length,t.length,!0),n.set(t,6+r.length),n};var Ee=Ie,Br=1e4,gs="[data-rp-throttle]";function Ms(e){try{bs(e)}catch{}}var ys=()=>{let e=new URL("./worker.js",import.meta.url).href;try{return new Worker(e)}catch{return new Worker(URL.createObjectURL(new Blob([`importScripts(${JSON.stringify(e)})`],{type:"text/javascript"})))}};function bs(e){let t=e.o(),r=t.replay,n=t.redact,s=window,o=document,a=Ee.mirror,l=ys(),i=`.rr-mask,${r.maskSelector??"[data-rp-mask]"}`,u=[],f=0,p=0,m=0,d=[],h=()=>{let S=n.headers.length+n.bodyKeys.length+n.queryParams.length;return S!=p?(p=S,n):0},c=()=>{u.length&&(l.postMessage([1,u,h()]),d.push(u),u=[],f=1)},b=S=>{!m&&u.push(S)>=300&&c()},v=S=>b({type:5,timestamp:S.ts,data:{tag:S.type,payload:S.data}}),M={n:o,id:-1,i:0,s:!1,q:!1,e:0},g=[],I=0,F=new WeakMap,W=0,J=Symbol(),le=S=>{let w=S[J];return w&&w.g==W?w:void 0},ee=(S,w)=>S[J]=w==M?{...M,g:W}:Object.assign(w,{g:W}),te=S=>{let w=F.get(S);if(w===void 0){let k=S.closest?.(gs);w=k&&+k.getAttribute("data-rp-throttle")||0,w&&(r.maskAllText||S.closest(i))&&(w=-w),F.set(S,w)}return w},re=S=>{for(let w=0;w<S.length;w++)if(S[w].nodeType!=3)return!1;return!0},ne=S=>{if(!S.q){S.q=!0,I++;let w=(S.i<0?-S.i:S.i)/500|0,k=S.id<0||w<2?0:S.id%w;(g[k]??=[]).push(S)}},N=S=>{let w=null,k=0;for(let D=0;D<S.length;D++){let L=S[D],A=L.target,_=!1;if(L.type=="characterData"){let q=le(A);if(!q){let Z=A.parentNode,U=Z?te(Z):0;q=ee(A,U?{n:A,id:-2,i:U,s:!1,q:!1,e:0}:M)}q.i&&(ne(q),_=!0)}else if(L.type=="childList"){let q=le(A),Z=A.firstChild;if(q?.s)Z===A.lastChild&&(!Z||Z.nodeType==3)&&(ne(q),_=!0);else if(A.nodeType==1&&te(A)&&Z===A.lastChild&&re(L.addedNodes)&&re(L.removedNodes)){if(!q){let U=L.removedNodes[0],$=U?a.getId(U):-1;$>0&&(q=ee(A,{n:A,id:$,i:te(A),s:!0,q:!1,e:0}))}q&&(ne(q),_=!0)}if(!_&&k<=Br){let U=L.addedNodes;for(let $=0;$<U.length;$++)k+=1+(U[$].getElementsByTagName?.("*").length??0)}}_?w??=S.slice(0,D):w&&w.push(L)}return k>Br?(Ee.takeFullSnapshot(!0),[]):w??S},me=0,ye=()=>{if(me++,!I)return;let S=new Int32Array(I),w=0,k="",D=[],L=Date.now();for(let _=0;_<g.length;_++){let q=g[_];if(!q?.length)continue;let Z=[];for(let U of q){let $=U.i,ke=$<0?-$:$,we=ke/500|0;if(we>1&&U.id>=0&&me%we!=U.id%we||L-U.e<ke-50){Z.push(U);continue}U.q=!1,I--;let ze=U.n;if(U.id<0){let Qe=a.getId(ze);if(Qe<0||a.getNode(Qe)!==ze)continue;if(U.id=Qe,we>1&&me%we!=Qe%we){ne(U);continue}}else if(!ze.isConnected)continue;U.e=L;let Jt=(U.s?ze.textContent:ze.nodeValue)??"";k+=(w?"\0":"")+($<0?Jt.replace(/\S/g,"*"):Jt),S[w++]=U.id}D[_]=Z}for(let _=0;_<D.length;_++)D[_]&&(g[_]=D[_]);if(!w)return;let A=w==S.length?S:S.slice(0,w);l.postMessage([2,A,k,Date.now(),u,h()],[A.buffer]),d.push(u),u=[],f=1},z=()=>{m||(ye(),c())},V="",fe=-1,Q=0,Oe=0,be=0,Se=0,Re=-1,Be,Te=navigator,mt=()=>{let S=e.m(),w=S.ctx.app??{};return{url:location.href,ref:o.referrer,ua:Te.userAgent,vw:s.innerWidth,vh:s.innerHeight,lang:Te.language,release:t.release,env:t.environment,platform:e.platform,user:S.user,app_ver:t.appVersion??w.version,device:w.device,os_ver:w.os,wv_ver:w.webview,...e.clock?.(e.sess().st)}},ce=S=>{if(be)return;if(!e.en())return St();if(Se)return;if(e.idle()){m||Hr();return}if(m&&Ht(),c(),!f)return;f=0;let w=e.sess(),k=V&&w.id!=V,D=k?fe+1:(V=w.id,e.seq()),L=e.c.ws_disc,A=L>=Oe?L-Oe:L;Oe=L;let _=e.m(),q=_.fields_version??0,Z=t.appVersion??_.ctx.app?.version,U=!Q||q!==Re||Z!==Be?{user:_.user??null,custom_fields:_.custom_fields??{},tags:_.tags,app_ver:Z}:void 0,$={sid:V,seq:D,ws_disc:A,ie:e.ie(),fields:U,...Q?{}:{init:mt()}};S===2?X($):(l.postMessage([3,$,t.redact,!!S]),he.push([$,d])>4&&he.shift()),d=[],Re=q,Be=Z,fe=D,Q=1,k&&(V=w.id,fe=-1,Q=0,Ee.takeFullSnapshot(!0))},de="rp_tail",he=[],j=[],T=0,se=()=>{try{let S=j.map(w=>w[1]);T&&S.unshift(`${T}`),S.length?sessionStorage.setItem(de,S.join("")):sessionStorage.removeItem(de)}catch{}},R;try{let S=indexedDB.open("replayd",1);S.onupgradeneeded=()=>{for(let w of["q","e"])S.result.createObjectStore(w,{autoIncrement:!0})},S.onsuccess=()=>R=S.result}catch{}let X=S=>{l.postMessage([5,1]);let w=6e4;for(let[L,A]of S?[...he,[S,d]]:he){let _=Pr(e.rd);for(let ke of A)for(let we of ke)_.add(we);if(!_.n())continue;let[q,Z]=_.take(L,0),U=`${L.sid}:${L.seq}`,$=Ur(q,Wr(new TextEncoder().encode(Z)));if(j.push([U,`${q}\0${Z}`]),$.length<w)w-=$.length,e.fetch(e.url("replay"),{method:"POST",body:$,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{});else try{let ke=R.transaction("q","readwrite");ke.objectStore("q").add({t:Date.now(),b:$,s:U}),ke.commit?.()}catch{}}he=[];let k=j.at(-1)?.[1].length??0,D=j.length-1;for(;D>0&&(k+=j[D-1][1].length)<=1e6;)D--;D>0&&(T+=D,j=j.slice(D)),se()},ie=()=>{ye(),ce(2),he.length&&!be&&X(),Se=1},Y=()=>{let S=0,w=0;j=[];try{for(let k of sessionStorage.getItem(de)?.split("")??[]){let D=k.indexOf("\0");if(D<0)w=S+=+k||0;else{let L=k.slice(0,D),A=JSON.parse(L);j.push([`${A.sid}:${A.seq}`,k]),l.postMessage([6,L,k.slice(D+1),S]),S=0}}}catch{}T=0,w&&se()},P=S=>{he=he.filter(([k])=>`${k.sid}:${k.seq}`!=S);let w=j.length;j=j.filter(k=>k[0]!=S),j.length<w&&se()},He=S=>S.persisted&&(Se=0,Y(),yt()),Hr=()=>{m=1,u=[],d=[],f=0,l.postMessage([5])},Ht=()=>{m=0,V=e.sess().id,fe=-1,Q=0,Ee.takeFullSnapshot(!0)},gt=()=>m&&!Se&&!e.idle()&&Ht(),zt=()=>{z(),ce(!0)},zr=()=>o.visibilityState=="hidden"&&zt(),yt=()=>l.postMessage([4]),xe=r.canvas,Ke=new Set,jr=`.rr-block,${r.blockSelector??"[data-rp-block]"}`,jt=xe.enabled&&xe.fps>0&&typeof OffscreenCanvas=="function"&&typeof createImageBitmap=="function",qt=()=>{if(m||Se||be||o.visibilityState=="hidden")return;let S=Date.now(),w=[],k=(D,L)=>{for(let A of D.querySelectorAll(xe.selector))A.tagName=="CANVAS"&&w.push(A);if(L<3)for(let A of D.querySelectorAll("iframe"))try{let _=A.contentDocument;_&&k(_,L+1)}catch{}};k(o,0);for(let D of w){let L=a.getId(D);L<1||Ke.has(L)||!D.width||!D.height||D.closest(jr)||(Ke.add(L),createImageBitmap(D).then(A=>l.postMessage([7,L,A,S,xe.maxWidth,xe.quality],[A]),()=>Ke.delete(L)))}},$t=[[s,"pagehide",ie],[s,"pageshow",He],[o,"visibilitychange",zr],[s,"online",yt],[s,"replayd:resume",yt],[s,"replayd:flush",zt],[s,"pointerdown",gt],[s,"keydown",gt],[s,"scroll",gt]],Gt=[setInterval(z,500),setInterval(ce,5e3)],bt=jt?setInterval(qt,1e3/xe.fps/(Te.hardwareConcurrency<=4?.5:1)):void 0;bt&&Gt.push(bt);let St=()=>{be=1;for(let S of Gt)clearInterval(S);Ee.setMutationHook(null),e.sink(null),e.onError(()=>{});for(let[S,w,k]of $t)S.removeEventListener(w,k,!0);try{qr?.()}catch{}l.terminate()};l.postMessage([0,new URL(e.url("replay"),location.href).href,t.redact,(t.websocket.channelOf??"centrifugo-json")=="centrifugo-json"?1:0,t.websocket.sample.perChannelPerSec,e.platform!="web"||!!t.offlineQueue]),Y(),l.onmessage=S=>{let w=S.data;w[0]==2?(Ke.delete(w[1]),w[2]&&clearInterval(bt)):w[0]==3?P(w[1]):w[0]?St():ce()},l.onerror=St;for(let[S,w,k]of $t)S.addEventListener(w,k,!0);e.onError(()=>ce()),Ee.setMutationHook(N);let qr=Ee({emit:S=>{if(S.type==2){F=new WeakMap,W++;for(let w of g)for(let k of w??[])k.q=!1;g=[],I=0,jt&&setTimeout(qt,50)}b(S)},checkoutEveryNms:6e5,sampling:{mousemove:50,mouseInteraction:!0,scroll:150,media:800,input:"last"},blockSelector:r.blockSelector??"[data-rp-block]",maskTextSelector:r.maskAllText?"*":r.maskSelector??"[data-rp-mask]",maskAllInputs:!!r.maskAllInputs,maskInputOptions:{password:!0},recordCanvas:!1,collectFonts:!1,inlineImages:!1,inlineStylesheet:!0,slimDOMOptions:"all",recordCrossOriginIframes:!1}),Vt=performance.getEntriesByType?.("navigation")[0];v({type:"nav",ts:Math.round(performance.timeOrigin),data:{to:Vt?.name||location.href,load:Vt?.type||"navigate"}});for(let S of e.drain())v(S);e.sink(v)}export{Ms as startReplay};
|
|
79
79
|
//# sourceMappingURL=replay.js.map
|