@dash0/sdk-web 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/dash0-session-recording.iife.js +2 -0
- package/dist/dash0-session-recording.iife.js.map +1 -0
- package/dist/dash0-session-recording.js +2 -0
- package/dist/dash0-session-recording.js.map +1 -0
- package/dist/dash0-session-recording.umd.cjs +2 -0
- package/dist/dash0-session-recording.umd.cjs.map +1 -0
- package/dist/dash0.iife.js +1 -1
- package/dist/dash0.iife.js.map +1 -1
- package/dist/dash0.js +1 -1
- package/dist/dash0.js.map +1 -1
- package/dist/dash0.umd.cjs +1 -1
- package/dist/dash0.umd.cjs.map +1 -1
- package/dist/modules/api/init.js +18 -1
- package/dist/modules/api/init_test.js +27 -0
- package/dist/modules/api/session-recording.js +30 -0
- package/dist/modules/api/session-recording_test.js +36 -0
- package/dist/modules/entrypoint/npm-package.js +1 -0
- package/dist/modules/entrypoint/script.js +3 -0
- package/dist/modules/entrypoint/session-recording-script.js +19 -0
- package/dist/modules/entrypoint/session-recording.js +11 -0
- package/dist/modules/instrumentations/session-recording/chunker.js +70 -0
- package/dist/modules/instrumentations/session-recording/chunker_test.js +125 -0
- package/dist/modules/instrumentations/session-recording/index.js +165 -0
- package/dist/modules/instrumentations/session-recording/index_test.js +230 -0
- package/dist/modules/instrumentations/session-recording/log.js +23 -0
- package/dist/modules/instrumentations/session-recording/log_test.js +46 -0
- package/dist/modules/semantic-conventions.js +7 -0
- package/dist/modules/transport/fetch.js +2 -2
- package/dist/modules/transport/fetch_test.js +25 -0
- package/dist/modules/transport/index.js +44 -11
- package/dist/modules/transport/index_test.js +73 -0
- package/dist/modules/types/session-recording.js +1 -0
- package/dist/modules/vars.js +11 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/api/session-recording.d.ts +17 -0
- package/dist/types/api/session-recording_test.d.ts +1 -0
- package/dist/types/entrypoint/npm-package.d.ts +2 -0
- package/dist/types/entrypoint/session-recording-script.d.ts +1 -0
- package/dist/types/entrypoint/session-recording.d.ts +5 -0
- package/dist/types/instrumentations/session-recording/chunker.d.ts +38 -0
- package/dist/types/instrumentations/session-recording/chunker_test.d.ts +1 -0
- package/dist/types/instrumentations/session-recording/index.d.ts +23 -0
- package/dist/types/instrumentations/session-recording/index_test.d.ts +1 -0
- package/dist/types/instrumentations/session-recording/log.d.ts +14 -0
- package/dist/types/instrumentations/session-recording/log_test.d.ts +1 -0
- package/dist/types/semantic-conventions.d.ts +6 -0
- package/dist/types/transport/fetch.d.ts +8 -1
- package/dist/types/transport/index.d.ts +10 -0
- package/dist/types/transport/index_test.d.ts +1 -0
- package/dist/types/types/options.d.ts +2 -2
- package/dist/types/types/session-recording.d.ts +128 -0
- package/dist/types/vars.d.ts +6 -0
- package/package.json +10 -2
- package/src/api/init.ts +19 -1
- package/src/api/init_test.ts +33 -1
- package/src/api/session-recording.ts +40 -0
- package/src/api/session-recording_test.ts +44 -0
- package/src/entrypoint/npm-package.ts +2 -0
- package/src/entrypoint/script.ts +3 -0
- package/src/entrypoint/session-recording-script.ts +23 -0
- package/src/entrypoint/session-recording.ts +13 -0
- package/src/instrumentations/session-recording/chunker.ts +118 -0
- package/src/instrumentations/session-recording/chunker_test.ts +147 -0
- package/src/instrumentations/session-recording/index.ts +175 -0
- package/src/instrumentations/session-recording/index_test.ts +273 -0
- package/src/instrumentations/session-recording/log.ts +48 -0
- package/src/instrumentations/session-recording/log_test.ts +60 -0
- package/src/semantic-conventions.ts +8 -0
- package/src/transport/fetch.ts +10 -2
- package/src/transport/fetch_test.ts +30 -0
- package/src/transport/index.ts +64 -25
- package/src/transport/index_test.ts +90 -0
- package/src/types/options.ts +3 -1
- package/src/types/session-recording.ts +144 -0
- package/src/vars.ts +18 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e,t=Object.defineProperty,n=(e,n,r)=>((e,n,r)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r)(e,"symbol"!=typeof n?n+"":n,r),r=(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))(r||{}),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||{}),s=(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))(s||{}),a=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(a||{}),i=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(i||{}),l=(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))(l||{}),c=(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))(c||{});const d={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},u={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},h={},p={};function m(e){if(h[e])return h[e];const t=globalThis[e],n=t.prototype,r=e in d?d[e]:void 0,o=Boolean(r&&r.every((e=>{var t,r;return Boolean(null==(r=null==(t=Object.getOwnPropertyDescriptor(n,e))?void 0:t.get)?void 0:r.toString().includes("[native code]"))}))),s=e in u?u[e]:void 0,a=Boolean(s&&s.every((e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))})));if(o&&a&&!globalThis.Zone)return h[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");r.style.display="none",document.body.appendChild(r);const o=r.contentWindow;if(!o)return t.prototype;const s=o[e].prototype;if(!s)return r.remove(),n;const a=navigator.userAgent;return a.includes("Safari")&&!a.includes("Chrome")?(r.classList.add("rr-block"),r.setAttribute("__rrwebUntaintedMutationObserver",""),p[e]=()=>r.remove()):r.remove(),h[e]=s}catch{return n}}const f={};function y(e,t,n){var r;const o=`${e}.${String(n)}`;if(f[o])return f[o].call(t);const s=m(e),a=null==(r=Object.getOwnPropertyDescriptor(s,n))?void 0:r.get;return a?(f[o]=a,a.call(t)):t[n]}const g={};function S(e,t,n){const r=`${e}.${String(n)}`;if(g[r])return g[r].bind(t);const o=m(e)[n];return"function"!=typeof o?t[n]:(g[r]=o,o.bind(t))}function b(){return[m("MutationObserver").constructor,p.MutationObserver??(()=>{})]}let v=Date.now;function I(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,()=>{e[t]=r}}catch{return()=>{}}}/[1-9][0-9]{12}/.test(Date.now().toString())||(v=()=>(new Date).getTime());const C={ownerDocument:function(e){return y("Node",e,"ownerDocument")},childNodes:function(e){return y("Node",e,"childNodes")},parentNode:function(e){return y("Node",e,"parentNode")},parentElement:function(e){return y("Node",e,"parentElement")},textContent:function(e){return y("Node",e,"textContent")},contains:function(e,t){return S("Node",e,"contains")(t)},getRootNode:function(e){return S("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?y("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?y("Element",e,"shadowRoot"):null},querySelector:function(e,t){return y("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return y("Element",e,"querySelectorAll")(t)},nowTimestamp:v,mutationObserverCtor:b,patch:I};function M(e){return e.nodeType===e.ELEMENT_NODE}function w(e){const t=e&&"host"in e&&"mode"in e&&C.host(e)||null;return Boolean(t&&"shadowRoot"in t&&C.shadowRoot(t)===e)}function k(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function T(e){try{const n=e.rules||e.cssRules;if(!n)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);const o=Array.from(n,(e=>R(e,r))).join("");return(t=o).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}catch(e){return null}var t}function R(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=T(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(n){t=e.cssText}return e.styleSheet.href?U(t,e.styleSheet.href):t}{let n=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(n=function(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(n)),t?U(n,t):n}}class O{constructor(){n(this,"idNodeMap",new Map),n(this,"nodeMetaMap",new WeakMap)}getId(e){var t;if(!e)return-1;return(null==(t=this.getMeta(e))?void 0:t.id)??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function E({element:e,maskInputOptions:t,tagName:n,type:r,value:o,maskInputFn:s}){let a=o||"";const i=r&&x(r);return(t[n.toLowerCase()]||i&&t[i])&&(a=s?s(a,e):"*".repeat(a.length)),a}function x(e){return e.toLowerCase()}const N="__rrweb_original__";function L(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?x(t):null}function D(e,t){let n;try{n=new URL(e,t??window.location.href)}catch(e){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}const A=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,F=/^(?:[a-z+]+:)?\/\//i,_=/^www\..*/i,P=/^(data:)([^,]*),(.*)/i;function U(e,t){return(e||"").replace(A,((e,n,r,o,s,a)=>{const i=r||s||a,l=n||o||"";if(!i)return e;if(F.test(i)||_.test(i))return`url(${l}${i}${l})`;if(P.test(i))return`url(${l}${i}${l})`;if("/"===i[0])return`url(${l}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+i}${l})`;const c=i.split("#")[0],d=i.substring(c.length),u=t.split("#")[0].split("/"),h=c.split("/");u.pop();for(const e of h)"."!==e&&(".."===e?u.pop():u.push(e));return`url(${l}${u.join("/")}${d}${l})`}))}function W(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function B(e,t){return function(e,t,n=!1){const r=Array.from(t.childNodes),o=[];let s=0;if(r.length>1&&e&&"string"==typeof e){let t=W(e,n);const a=t.length/e.length;for(let i=1;i<r.length;i++)if(r[i].textContent&&"string"==typeof r[i].textContent){const l=W(r[i].textContent,n),c=100;let d=3;for(;d<l.length&&(l[d].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,d),1));d++);for(;d<l.length;d++){let u=l.substring(0,d),h=t.split(u),p=-1;if(2===h.length)p=h[0].length;else if(h.length>2&&""===h[0]&&""!==r[i-1].textContent)p=t.indexOf(u,1);else if(1===h.length){if(u=u.substring(0,u.length-1),h=t.split(u),h.length<=1)return o.push(e),o;d=c+1}else d===l.length-1&&(p=t.indexOf(u));if(h.length>=2&&d>c){const e=r[i-1].textContent;if(e&&"string"==typeof e){const n=W(e).length;p=t.indexOf(u,n)}-1===p&&(p=h[0].length)}if(-1!==p){let i=Math.floor(p/a);for(;i>0&&i<e.length;){if(s+=1,s>50*r.length)return o.push(e),o;const l=W(e.substring(0,i),n);if(l.length===p){o.push(e.substring(0,i)),e=e.substring(i),t=t.substring(p);break}l.length<p?i+=Math.max(1,Math.floor((p-l.length)/a)):i-=Math.max(1,Math.floor((l.length-p)*a))}break}}}}return o.push(e),o}(e,t).join("/* rr_split */")}let z=1;const j=new RegExp("[^a-z0-9-_:]");function $(){return z++}let V,G;const H=/^[^ \t\n\r\u000c]+/,q=/^[, \t\n\r\u000c]+/;const X=new WeakMap;function Y(e,t){return t&&""!==t.trim()?K(e,t):t}function J(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function K(e,t){let n=X.get(e);if(n||(n=e.createElement("a"),X.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function Z(e,t,n,r){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]||"background"===n&&["table","td","th"].includes(t)?Y(e,r):"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}const o=[];for(;r(q),!(n>=t.length);){let s=r(H);if(","===s.slice(-1))s=Y(e,s.substring(0,s.length-1)),o.push(s);else{let r="";s=Y(e,s);let a=!1;for(;;){const e=t.charAt(n);if(""===e){o.push((s+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,o.push((s+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n?U(r,K(e)):"object"===t&&"data"===n?Y(e,r):r:r}function Q(e,t,n){return["video","audio"].includes(e)&&"autoplay"===t}function ee(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&ee(C.parentNode(e),t,n);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!n&&ee(C.parentNode(e),t,n)}function te(e,t,n,r){let o;if(M(e)){if(o=e,!C.childNodes(o).length)return!1}else{if(null===C.parentElement(e))return!1;o=C.parentElement(e)}try{if("string"==typeof t){if(r){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(ee(o,t,r))return!0;if(n)if(r){if(o.closest(n))return!0}else if(o.matches(n))return!0}catch(e){}return!1}function ne(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:i,maskInputOptions:l={},maskTextFn:d,maskInputFn:u,dataURLOptions:h={},inlineImages:p,recordCanvas:m,keepIframeSrcFn:f,newlyAddedElement:y=!1,cssCaptured:g=!1}=t,S=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:c.Document,childNodes:[],compatMode:e.compatMode}:{type:c.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:c.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:S};case e.ELEMENT_NODE:return function(e,t){const{doc:n,blockClass:r,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:i,dataURLOptions:l={},inlineImages:d,recordCanvas:u,keepIframeSrcFn:h,newlyAddedElement:p=!1,rootId:m}=t,f=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,o),y=function(e){if(e instanceof HTMLFormElement)return"form";const t=x(e.tagName);return j.test(t)?"div":t}(e);let g={};const S=e.attributes.length;for(let t=0;t<S;t++){const r=e.attributes[t];Q(y,r.name,r.value)||(g[r.name]=Z(n,y,x(r.name),r.value))}if("link"===y&&s){const t=Array.from(n.styleSheets).find((t=>t.href===e.href));let r=null;t&&(r=T(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if("style"===y&&e.sheet){let t=T(e.sheet);t&&(e.childNodes.length>1&&(t=B(t,e)),g._cssText=t)}if(["input","textarea","select"].includes(y)){const t=e.value,n=e.checked;"radio"!==g.type&&"checkbox"!==g.type&&"submit"!==g.type&&"button"!==g.type&&t?g.value=E({element:e,type:L(e),tagName:y,value:t,maskInputOptions:a,maskInputFn:i}):n&&(g.checked=n)}"option"===y&&(e.selected&&!a.select?g.selected=!0:delete g.selected);"dialog"===y&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===y&&u)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const o=t.getImageData,s=N in o?o[N]:o;if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(g.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){const t=e.toDataURL(l.type,l.quality),r=n.createElement("canvas");r.width=e.width,r.height=e.height;t!==r.toDataURL(l.type,l.quality)&&(g.rr_dataURL=t)}if("img"===y&&d){V||(V=n.createElement("canvas"),G=V.getContext("2d"));const t=e,r=t.currentSrc||t.getAttribute("src")||"<unknown-src>",o=t.crossOrigin,s=()=>{t.removeEventListener("load",s);try{V.width=t.naturalWidth,V.height=t.naturalHeight,G.drawImage(t,0,0),g.rr_dataURL=V.toDataURL(l.type,l.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?s():t.addEventListener("load",s));console.warn(`Cannot inline img src=${r}! Error: ${e}`)}"anonymous"===t.crossOrigin&&(o?g.crossOrigin=o:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?s():t.addEventListener("load",s)}if(["audio","video"].includes(y)){const t=g;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}p||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop));if(f){const{width:t,height:n}=e.getBoundingClientRect();g={class:g.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==y||h(g.src)||(e.contentDocument||(g.rr_src=g.src),delete g.src);let b;try{customElements.get(y)&&(b=!0)}catch(e){}return{type:c.Element,tagName:y,attributes:g,childNodes:[],isSVG:J(e)||void 0,needBlock:f,rootId:m,isCustom:b}}(e,{doc:n,blockClass:o,blockSelector:s,inlineStylesheet:i,maskInputOptions:l,maskInputFn:u,dataURLOptions:h,inlineImages:p,recordCanvas:m,keepIframeSrcFn:f,newlyAddedElement:y,rootId:S});case e.TEXT_NODE:return function(e,t){const{needsMask:n,maskTextFn:r,rootId:o,cssCaptured:s}=t,a=C.parentNode(e),i=a&&a.tagName;let l="";const d="STYLE"===i||void 0,u="SCRIPT"===i||void 0;u?l="SCRIPT_PLACEHOLDER":s||(l=C.textContent(e),d&&l&&(l=U(l,K(t.doc))));!d&&!u&&l&&n&&(l=r?r(l,C.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:c.Text,textContent:l||"",rootId:o}}(e,{doc:n,needsMask:a,maskTextFn:d,rootId:S,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:c.CDATA,textContent:"",rootId:S};case e.COMMENT_NODE:return{type:c.Comment,textContent:C.textContent(e)||"",rootId:S};default:return!1}}function re(e){return null==e?"":e.toLowerCase()}function oe(e){return!0===e||"all"===e?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===e,headMetaDescKeywords:"all"===e,headTitleMutations:"all"===e}:e||{}}function se(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:i,skipChild:l=!1,inlineStylesheet:d=!0,maskInputOptions:u={},maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:f={},inlineImages:y=!1,recordCanvas:g=!1,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:v=5e3,onStylesheetLoad:I,stylesheetLoadTimeout:T=5e3,keepIframeSrcFn:R=()=>!1,newlyAddedElement:O=!1,cssCaptured:E=!1}=t;let{needsMask:x}=t,{preserveWhiteSpace:N=!0}=t;if(!x){x=te(e,a,i,void 0===x)}const L=ne(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:x,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:p,dataURLOptions:f,inlineImages:y,recordCanvas:g,keepIframeSrcFn:R,newlyAddedElement:O,cssCaptured:E});if(!L)return console.warn(e,"not serialized"),null;let A;A=r.hasNode(e)?r.getId(e):function(e,t){if(t.comment&&e.type===c.Comment)return!0;if(e.type===c.Element){if(t.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel&&"script"===e.attributes.as||"modulepreload"===e.attributes.rel)||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===D(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(re(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===re(e.attributes.name)||"icon"===re(e.attributes.rel)||"apple-touch-icon"===re(e.attributes.rel)||"shortcut icon"===re(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&re(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(re(e.attributes.property).match(/^(og|twitter|fb):/)||re(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===re(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===re(e.attributes.name)||"googlebot"===re(e.attributes.name)||"bingbot"===re(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===re(e.attributes.name)||"generator"===re(e.attributes.name)||"framework"===re(e.attributes.name)||"publisher"===re(e.attributes.name)||"progid"===re(e.attributes.name)||re(e.attributes.property).match(/^article:/)||re(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===re(e.attributes.name)||"yandex-verification"===re(e.attributes.name)||"csrf-token"===re(e.attributes.name)||"p:domain_verify"===re(e.attributes.name)||"verify-v1"===re(e.attributes.name)||"verification"===re(e.attributes.name)||"shopify-checkout-api-token"===re(e.attributes.name)))return!0}}return!1}(L,m)||!N&&L.type===c.Text&&!L.textContent.replace(/^\s+|\s+$/gm,"").length?-2:$();const F=Object.assign(L,{id:A});if(r.add(e,F),-2===A)return null;S&&S(e);let _=!l;if(F.type===c.Element){_=_&&!F.needBlock,delete F.needBlock;const t=C.shadowRoot(e);t&&k(t)&&(F.isShadowHost=!0)}if((F.type===c.Document||F.type===c.Element)&&_){m.headWhitespace&&F.type===c.Element&&"head"===F.tagName&&(N=!1);const t={doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:x,maskTextClass:a,maskTextSelector:i,skipChild:l,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:f,inlineImages:y,recordCanvas:g,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:T,keepIframeSrcFn:R,cssCaptured:!1};if(F.type===c.Element&&"textarea"===F.tagName&&void 0!==F.attributes.value);else{F.type===c.Element&&void 0!==F.attributes._cssText&&"string"==typeof F.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(C.childNodes(e))){const e=se(n,t);e&&F.childNodes.push(e)}}let w=null;if(M(e)&&(w=C.shadowRoot(e)))for(const e of Array.from(C.childNodes(w))){const n=se(e,t);n&&(k(w)&&(n.isShadow=!0),F.childNodes.push(n))}}const P=C.parentNode(e);return P&&w(P)&&k(P)&&(F.isShadow=!0),F.type===c.Element&&"iframe"===F.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"!==o){const r=setTimeout((()=>{s||(t(),s=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),s=!0,t()}))}const a="about:blank";if(r.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&b){const n=se(t,{doc:t,mirror:r,blockClass:o,blockSelector:s,needsMask:x,maskTextClass:a,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:f,inlineImages:y,recordCanvas:g,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:T,keepIframeSrcFn:R});n&&b(e,n)}}),v),F.type===c.Element&&"link"===F.tagName&&"string"==typeof F.attributes.rel&&("stylesheet"===F.attributes.rel||"preload"===F.attributes.rel&&"string"==typeof F.attributes.href&&"css"===D(F.attributes.href))&&function(e,t,n){let r,o=!1;try{r=e.sheet}catch(e){return}if(r)return;const s=setTimeout((()=>{o||(t(),o=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(s),o=!0,t()}))}(e,(()=>{if(I){const t=se(e,{doc:n,mirror:r,blockClass:o,blockSelector:s,needsMask:x,maskTextClass:a,maskTextSelector:i,skipChild:!1,inlineStylesheet:d,maskInputOptions:u,maskTextFn:h,maskInputFn:p,slimDOMOptions:m,dataURLOptions:f,inlineImages:y,recordCanvas:g,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:b,iframeLoadTimeout:v,onStylesheetLoad:I,stylesheetLoadTimeout:T,keepIframeSrcFn:R});t&&I(e,t)}}),T),F}class ae{constructor(...e){n(this,"parentElement",null),n(this,"parentNode",null),n(this,"ownerDocument"),n(this,"firstChild",null),n(this,"lastChild",null),n(this,"previousSibling",null),n(this,"nextSibling",null),n(this,"ELEMENT_NODE",1),n(this,"TEXT_NODE",3),n(this,"nodeType"),n(this,"nodeName"),n(this,"RRNodeType")}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof ae))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,t){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function ie(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const le="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let ce={map:{},getId:()=>(console.error(le),-1),getNode:()=>(console.error(le),null),removeNodeFromMap(){console.error(le)},has:()=>(console.error(le),!1),reset(){console.error(le)}};function de(e,t,n={}){let r=null,o=0;return function(...s){const a=Date.now();o||!1!==n.leading||(o=a);const i=t-(a-o),l=this;i<=0||i>t?(r&&(clearTimeout(r),r=null),o=a,e.apply(l,s)):r||!1===n.trailing||(r=setTimeout((()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(l,s)}),i))}}function ue(e,t,n,r,o=window){const s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>ue(e,t,s||{},!0)}function he(e){var t,n,r,o;const s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:s.documentElement.scrollLeft||(null==s?void 0:s.body)&&(null==(t=C.parentElement(s.body))?void 0:t.scrollLeft)||(null==(n=null==s?void 0:s.body)?void 0:n.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null==s?void 0:s.body)&&(null==(r=C.parentElement(s.body))?void 0:r.scrollTop)||(null==(o=null==s?void 0:s.body)?void 0:o.scrollTop)||0}}function pe(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function me(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function fe(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e)}function ye(e,t,n,r){if(!e)return!1;const o=fe(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(ee(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function ge(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function Se(e,t){if(w(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=C.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||Se(r,t))}function be(e){return Boolean(e.changedTouches)}function ve(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ie(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Ce(e){return!!e&&(e instanceof ae&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(C.shadowRoot(e)))}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(ce=new Proxy(ce,{get:(e,t,n)=>("map"===t&&console.error(le),Reflect.get(e,t,n))}));class Me{constructor(){n(this,"id",1),n(this,"styleIDMap",new WeakMap),n(this,"idStyleMap",new Map)}getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function we(e){var t;let n=null;return"getRootNode"in e&&(null==(t=C.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(n=C.host(C.getRootNode(e))),n}function ke(e){const t=C.ownerDocument(e);if(!t)return!1;const n=function(e){let t,n=e;for(;t=we(n);)n=t;return n}(e);return C.contains(t,n)}function Te(e){const t=C.ownerDocument(e);return!!t&&(C.contains(t,e)||ke(e))}function Re(e){return"__ln"in e}class Oe{constructor(){n(this,"length",0),n(this,"head",null),n(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&Re(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&Re(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const Ee=(e,t)=>`${e}@${t}`;class xe{constructor(){n(this,"frozen",!1),n(this,"locked",!1),n(this,"texts",[]),n(this,"attributes",[]),n(this,"attributeMap",new WeakMap),n(this,"removes",[]),n(this,"mapRemoves",[]),n(this,"movedMap",{}),n(this,"addedSet",new Set),n(this,"movedSet",new Set),n(this,"droppedSet",new Set),n(this,"removesSubTreeCache",new Set),n(this,"mutationCb"),n(this,"blockClass"),n(this,"blockSelector"),n(this,"maskTextClass"),n(this,"maskTextSelector"),n(this,"inlineStylesheet"),n(this,"maskInputOptions"),n(this,"maskTextFn"),n(this,"maskInputFn"),n(this,"keepIframeSrcFn"),n(this,"recordCanvas"),n(this,"inlineImages"),n(this,"slimDOMOptions"),n(this,"dataURLOptions"),n(this,"doc"),n(this,"mirror"),n(this,"iframeManager"),n(this,"stylesheetManager"),n(this,"shadowDomManager"),n(this,"canvasManager"),n(this,"processedNodeManager"),n(this,"unattachedDoc"),n(this,"processMutations",(e=>{e.forEach(this.processMutation),this.emit()})),n(this,"emit",(()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,n=new Oe,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},o=o=>{const s=C.parentNode(o);if(!s||!Te(o))return;let a=!1;if(o.nodeType===Node.TEXT_NODE){const e=s.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(s)&&(a=!0)}const i=w(s)?this.mirror.getId(we(o)):this.mirror.getId(s),l=r(o);if(-1===i||-1===l)return n.addNode(o);const c=se(o,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{ve(e,this.mirror)&&this.iframeManager.addIframe(e),Ie(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Ce(o)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(o),this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)},cssCaptured:a});c&&(e.push({parentId:i,nextId:l,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of this.movedSet)Le(this.removesSubTreeCache,e,this.mirror)&&!this.movedSet.has(C.parentNode(e))||o(e);for(const e of this.addedSet)De(this.droppedSet,e)||Le(this.removesSubTreeCache,e,this.mirror)?De(this.movedSet,e)?o(e):this.droppedSet.add(e):o(e);let s=null;for(;n.length;){let e=null;if(s){const t=this.mirror.getId(C.parentNode(s.value)),n=r(s.value);-1!==t&&-1!==n&&(e=s)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(C.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=C.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=C.host(r);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}s=e.previous,n.removeNode(e.value),o(e.value)}const a={texts:this.texts.map((e=>{const t=e.node,n=C.parentNode(t);return n&&"TEXTAREA"===n.tagName&&this.genTextAreaValueMutation(n),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),r=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+r).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.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(a))})),n(this,"genTextAreaValueMutation",(e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));const n=Array.from(C.childNodes(e),(e=>C.textContent(e)||"")).join("");t.attributes.value=E({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:L(e),value:n,maskInputFn:this.maskInputFn})})),n(this,"processMutation",(e=>{if(!ge(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=C.textContent(e.target);ye(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:te(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,fe(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let n=e.attributeName,r=e.target.getAttribute(n);if("value"===n){const e=L(t);r=E({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:e,value:r,maskInputFn:this.maskInputFn})}if(ye(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue)return;let o=this.attributeMap.get(e.target);if("IFRAME"===t.tagName&&"src"===n&&!this.keepIframeSrcFn(r)){if(t.contentDocument)return;n="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(e.target,o)),"type"===n&&"INPUT"===t.tagName&&"password"===(e.oldValue||"").toLowerCase()&&t.setAttribute("data-rr-is-password","true"),!Q(t.tagName,n))if(o.attributes[n]=Z(this.doc,x(t.tagName),x(n),r),"style"===n){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(e){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(t.style)){const r=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);r!==n.style.getPropertyValue(e)||s!==n.style.getPropertyPriority(e)?o.styleDiff[e]=""===s?r:[r,s]:o._unchangedStyles[e]=[r,s]}for(const e of Array.from(n.style))""===t.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}else"open"===n&&"DIALOG"===t.tagName&&(t.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":if(ye(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),r=w(e.target)?this.mirror.getId(C.host(e.target)):this.mirror.getId(e.target);ye(e.target,this.blockClass,this.blockSelector,!1)||ge(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Ne(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Se(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Ee(n,r)]?Ne(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!w(e.target)||!k(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),C.childNodes(e).forEach((e=>n.push(e))))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))}))}})),n(this,"genAdds",((e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(ge(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[Ee(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);ye(e,this.blockClass,this.blockSelector,!1)||(C.childNodes(e).forEach((e=>this.genAdds(e))),Ce(e)&&C.childNodes(C.shadowRoot(e)).forEach((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,e)})))}}))}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((t=>{this[t]=e[t]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Ne(e,t){e.delete(t),C.childNodes(t).forEach((t=>Ne(e,t)))}function Le(e,t,n){return 0!==e.size&&function(e,t){const n=C.parentNode(t);return!!n&&e.has(n)}(e,t)}function De(e,t){return 0!==e.size&&Ae(e,t)}function Ae(e,t){const n=C.parentNode(t);return!!n&&(!!e.has(n)||Ae(e,n))}let Fe;const _e=e=>{if(!Fe)return e;return(...t)=>{try{return e(...t)}catch(e){if(Fe&&!0===Fe(e))return;throw e}}},Pe=[];function Ue(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function We(e,t){const n=new xe;Pe.push(n),n.init(e);const[r,o]=b(),s=new r(_e(n.processMutations.bind(n)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),[s,o]}function Be({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const l=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,c=[];let d=null;return Object.keys(s).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==l[e])).forEach((i=>{let l=x(i);const u=(t=>i=>{const l=Ue(i);if(ye(l,r,o,!0))return;let c=null,u=t;if("pointerType"in i){switch(i.pointerType){case"mouse":c=a.Mouse;break;case"touch":c=a.Touch;break;case"pen":c=a.Pen}c===a.Touch?s[t]===s.MouseDown?u="TouchStart":s[t]===s.MouseUp&&(u="TouchEnd"):a.Pen}else be(i)&&(c=a.Touch);null!==c?(d=c,(u.startsWith("Touch")&&c===a.Touch||u.startsWith("Mouse")&&c===a.Mouse)&&(c=null)):s[t]===s.Click&&(c=d,d=null);const h=be(i)?i.changedTouches[0]:i;if(!h)return;const p=n.getId(l),{clientX:m,clientY:f}=h;_e(e)({type:s[u],id:p,x:m,y:f,...null!==c&&{pointerType:c}})})(i);if(window.PointerEvent)switch(s[i]){case s.MouseDown:case s.MouseUp:l=l.replace("mouse","pointer");break;case s.TouchStart:case s.TouchEnd:return}c.push(ie(l,u,t))})),_e((()=>{c.forEach((e=>e()))}))}function ze({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:s}){return ie("scroll",_e(de(_e((s=>{const a=Ue(s);if(!a||ye(a,r,o,!0))return;const i=n.getId(a);if(a===t&&t.defaultView){const n=he(t.defaultView);e({id:i,x:n.left,y:n.top})}else e({id:i,x:a.scrollLeft,y:a.scrollTop})})),s.scroll||100)),t)}const je=["INPUT","TEXTAREA","SELECT"],$e=new WeakMap;function Ve(e){return function e(t,n){if(Xe("CSSGroupingRule")&&t.parentRule instanceof CSSGroupingRule||Xe("CSSMediaRule")&&t.parentRule instanceof CSSMediaRule||Xe("CSSSupportsRule")&&t.parentRule instanceof CSSSupportsRule||Xe("CSSConditionRule")&&t.parentRule instanceof CSSConditionRule){const r=Array.from(t.parentRule.cssRules).indexOf(t);return n.unshift(r),e(t.parentRule,n)}if(t.parentStyleSheet){const e=Array.from(t.parentStyleSheet.cssRules).indexOf(t);n.unshift(e)}return n}(e,[])}function Ge(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function He({mirror:e,stylesheetManager:t},n){var r,o,s;let a=null;a="#document"===n.nodeName?e.getId(n):e.getId(C.host(n));const i="#document"===n.nodeName?null==(r=n.defaultView)?void 0:r.Document:null==(s=null==(o=n.ownerDocument)?void 0:o.defaultView)?void 0:s.ShadowRoot,l=(null==i?void 0:i.prototype)?Object.getOwnPropertyDescriptor(null==i?void 0:i.prototype,"adoptedStyleSheets"):void 0;return null!==a&&-1!==a&&i&&l?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var n;const r=null==(n=l.set)?void 0:n.call(this,e);if(null!==a&&-1!==a)try{t.adoptStyleSheets(e,a)}catch(e){}return r}}),_e((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))):()=>{}}function qe(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:i,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:h,selectionCb:p,customElementCb:m}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),r(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),o(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),a(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),i(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),u(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),h(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),p(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),m(...e)}}(e,t);let s=()=>{};e.recordDOM&&([r,s]=We(e,e.doc));const a=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,l=[];const c=de(_e((t=>{const n=Date.now()-i;e(l.map((e=>(e.timeOffset-=n,e))),t),l=[],i=null})),a),d=_e(de(_e((e=>{const t=Ue(e),{clientX:n,clientY:s}=be(e)?e.changedTouches[0]:e;i||(i=v()),l.push({x:n,y:s,id:r.getId(t),timeOffset:v()-i}),c("undefined"!=typeof DragEvent&&e instanceof DragEvent?o.Drag:e instanceof MouseEvent?o.MouseMove:o.TouchMove)})),s,{trailing:!1})),u=[ie("mousemove",d,n),ie("touchmove",d,n),ie("drag",d,n)];return _e((()=>{u.forEach((e=>e()))}))}(e),i=Be(e),c=ze(e),d=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return ie("resize",_e(de(_e((()=>{const t=pe(),o=me();n===t&&r===o||(e({width:Number(o),height:Number(t)}),n=t,r=o)})),200)),t)}(e,{win:n}),u=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:i,maskInputFn:l,sampling:c,userTriggeredOnInput:d}){function u(e){let n=Ue(e);const c=e.isTrusted,u=n&&n.tagName;if(n&&"OPTION"===u&&(n=C.parentElement(n)),!n||!u||je.indexOf(u)<0||ye(n,r,o,!0))return;if(n.classList.contains(s)||a&&n.matches(a))return;let p=n.value,m=!1;const f=L(n)||"";"radio"===f||"checkbox"===f?m=n.checked:(i[u.toLowerCase()]||i[f])&&(p=E({element:n,maskInputOptions:i,tagName:u,type:f,value:p,maskInputFn:l})),h(n,d?{text:p,isChecked:m,userTriggered:c}:{text:p,isChecked:m});const y=n.name;"radio"===f&&y&&m&&t.querySelectorAll(`input[type="radio"][name="${y}"]`).forEach((e=>{if(e!==n){const t=e.value;h(e,d?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}}))}function h(t,r){const o=$e.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){$e.set(t,r);const o=n.getId(t);_e(e)({...r,id:o})}}const p=("last"===c.input?["change"]:["input","change"]).map((e=>ie(e,_e(u),t))),m=t.defaultView;if(!m)return()=>{p.forEach((e=>e()))};const f=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),y=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&p.push(...y.map((e=>ue(e[0],e[1],{set(){_e(u)({target:this,isTrusted:!1})}},!1,m)))),_e((()=>{p.forEach((e=>e()))}))}(e),h=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:s}){const a=_e((s=>de(_e((o=>{const a=Ue(o);if(!a||ye(a,t,n,!0))return;const{currentTime:i,volume:l,muted:c,playbackRate:d,loop:u}=a;e({type:s,id:r.getId(a),currentTime:i,volume:l,muted:c,playbackRate:d,loop:u})})),o.media||500))),i=[ie("play",a(l.Play),s),ie("pause",a(l.Pause),s),ie("seeked",a(l.Seeked),s),ie("volumechange",a(l.VolumeChange),s),ie("ratechange",a(l.RateChange),s)];return _e((()=>{i.forEach((e=>e()))}))}(e);let p=()=>{},m=()=>{},f=()=>{},y=()=>{};e.recordDOM&&(p=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const o=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:_e(((r,o,s)=>{const[a,i]=s,{id:l,styleId:c}=Ge(o,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:a,index:i}]}),r.apply(o,s)}))}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){const o=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[o,n])};const s=r.CSSStyleSheet.prototype.deleteRule;let a,i;r.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:_e(((r,o,s)=>{const[a]=s,{id:i,styleId:l}=Ge(o,t,n.styleMirror);return(i&&-1!==i||l&&-1!==l)&&e({id:i,styleId:l,removes:[{index:a}]}),r.apply(o,s)}))}),r.CSSStyleSheet.prototype.removeRule=function(e){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:_e(((r,o,s)=>{const[a]=s,{id:i,styleId:l}=Ge(o,t,n.styleMirror);return(i&&-1!==i||l&&-1!==l)&&e({id:i,styleId:l,replace:a}),r.apply(o,s)}))})),r.CSSStyleSheet.prototype.replaceSync&&(i=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(i,{apply:_e(((r,o,s)=>{const[a]=s,{id:i,styleId:l}=Ge(o,t,n.styleMirror);return(i&&-1!==i||l&&-1!==l)&&e({id:i,styleId:l,replaceSync:a}),r.apply(o,s)}))}));const l={};Ye("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(Ye("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),Ye("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),Ye("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach((([r,o])=>{c[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(c[r].insertRule,{apply:_e(((r,o,s)=>{const[a,i]=s,{id:l,styleId:c}=Ge(o.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:a,index:[...Ve(o),i||0]}]}),r.apply(o,s)}))}),o.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:_e(((r,o,s)=>{const[a]=s,{id:i,styleId:l}=Ge(o.parentStyleSheet,t,n.styleMirror);return(i&&-1!==i||l&&-1!==l)&&e({id:i,styleId:l,removes:[{index:[...Ve(o),a]}]}),r.apply(o,s)}))})})),_e((()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=s,a&&(r.CSSStyleSheet.prototype.replace=a),i&&(r.CSSStyleSheet.prototype.replaceSync=i),Object.entries(l).forEach((([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule}))}))}(e,{win:n}),m=He(e,e.doc),f=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:o}){const s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:_e(((o,a,i)=>{var l;const[c,d,u]=i;if(n.has(c))return s.apply(a,[c,d,u]);const{id:h,styleId:p}=Ge(null==(l=a.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(h&&-1!==h||p&&-1!==p)&&e({id:h,styleId:p,set:{property:c,value:d,priority:u},index:Ve(a.parentRule)}),o.apply(a,i)}))});const a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:_e(((o,s,i)=>{var l;const[c]=i;if(n.has(c))return a.apply(s,[c]);const{id:d,styleId:u}=Ge(null==(l=s.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:c},index:Ve(s.parentRule)}),o.apply(s,i)}))}),_e((()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a}))}(e,{win:n}),e.collectFonts&&(y=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,s=n.FontFace;n.FontFace=function(e,t,n){const r=new s(e,t,n);return o.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};const a=I(t.fonts,"add",(function(t){return function(n){return setTimeout(_e((()=>{const t=o.get(n);t&&(e(t),o.delete(n))})),0),t.apply(this,[n])}}));return r.push((()=>{n.FontFace=s})),r.push(a),_e((()=>{r.forEach((e=>e()))}))}(e)));const g=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:o,selectionCb:s}=e;let a=!0;const i=_e((()=>{const e=t.getSelection();if(!e||a&&(null==e?void 0:e.isCollapsed))return;a=e.isCollapsed||!1;const i=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const s=e.getRangeAt(t),{startContainer:a,startOffset:l,endContainer:c,endOffset:d}=s;ye(a,r,o,!0)||ye(c,r,o,!0)||i.push({start:n.getId(a),startOffset:l,end:n.getId(c),endOffset:d})}s({ranges:i})}));return i(),ie("selectionchange",i)}(e),S=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?I(n.customElements,"define",(function(e){return function(n,r,o){try{t({define:{name:n}})}catch(e){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,r,o])}})):()=>{}}(e),b=[];for(const t of e.plugins)b.push(t.observer(t.callback,n,t.options));return _e((()=>{Pe.forEach((e=>e.reset())),null==r||r.disconnect(),s(),a(),i(),c(),d(),u(),h(),p(),m(),f(),y(),g(),S(),b.forEach((e=>e()))}))}function Xe(e){return void 0!==window[e]}function Ye(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class Je{constructor(e){n(this,"iframeIdToRemoteIdMap",new WeakMap),n(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const o=n||this.getIdToRemoteIdMap(e),s=r||this.getRemoteIdToIdMap(e);let a=o.get(t);return a||(a=this.generateIdFn(),o.set(t,a),s.set(a,t)),a}getIds(e,t){const n=this.getIdToRemoteIdMap(e),r=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,r)))}getRemoteId(e,t,n){const r=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=r.get(t);return o||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class Ke{constructor(e){n(this,"iframes",new WeakMap),n(this,"crossOriginIframeMap",new WeakMap),n(this,"crossOriginIframeMirror",new Je($)),n(this,"crossOriginIframeStyleMirror"),n(this,"crossOriginIframeRootIdMap",new WeakMap),n(this,"mirror"),n(this,"mutationCb"),n(this,"wrappedEmit"),n(this,"loadListener"),n(this,"stylesheetManager"),n(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Je(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var n,r;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(n=e.contentWindow)||n.addEventListener("message",this.handleMessage.bind(this))),null==(r=this.loadListener)||r.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case r.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:r.IncrementalSnapshot,data:{source:o.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case r.Meta:case r.Load:case r.DomContentLoaded:return!1;case r.Plugin:return t;case r.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case r.IncrementalSnapshot:switch(t.data.source){case o.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case o.Drag:case o.TouchMove:case o.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case o.ViewportResize:return!1;case o.MediaInteraction:case o.MouseInteraction:case o.Scroll:case o.CanvasMutation:case o.Input:return this.replaceIds(t.data,e,["id"]),t;case o.StyleSheetRule:case o.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case o.Font:return t;case o.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case o.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(n=t.data.styles)||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,r){for(const o of r)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(n,t[o]):t[o]=e.getId(n,t[o]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===c.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}class Ze{constructor(e){n(this,"shadowDoms",new WeakSet),n(this,"mutationCb"),n(this,"scrollCb"),n(this,"bypassOptions"),n(this,"mirror"),n(this,"restoreHandlers",[]),this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!k(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const[n]=We({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push((()=>n.disconnect())),this.restoreHandlers.push(ze({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(C.host(e))),this.restoreHandlers.push(He({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){const n=this;this.restoreHandlers.push(I(e.prototype,"attachShadow",(function(e){return function(r){const o=e.call(this,r),s=C.shadowRoot(this);return s&&Te(this)&&n.addShadowRoot(s,t),o}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}for(var Qe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",et="undefined"==typeof Uint8Array?[]:new Uint8Array(256),tt=0;tt<64;tt++)et[Qe.charCodeAt(tt)]=tt;const nt=new Map;const rt=(e,t,n)=>{if(!e||!at(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=nt.get(e);return n||(n=new Map,nt.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let o=r.indexOf(e);return-1===o&&(o=r.length,r.push(e)),o};function ot(e,t,n){if(e instanceof Array)return e.map((e=>ot(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const t=e.constructor.name,n=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=Qe[n[t]>>2],o+=Qe[(3&n[t])<<4|n[t+1]>>4],o+=Qe[(15&n[t+1])<<2|n[t+2]>>6],o+=Qe[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o}(e);return{rr_type:t,base64:n}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[ot(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[ot(e.data,t,n),e.width,e.height]}}if(at(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:rt(e,t,n)}}return e}const st=(e,t,n)=>e.map((e=>ot(e,t,n))),at=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function it(e,t,n,r){const o=[];try{const s=I(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...s){if(!ye(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(s[0]&&"object"==typeof s[0]){const e=s[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else s.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[o,...s])}}));o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function lt(e,t,n,r,o,s){const a=[],i=Object.getOwnPropertyNames(e);for(const l of i)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const i=I(e,l,(function(e){return function(...a){const i=e.apply(this,a);if(rt(i,s,this),"tagName"in this.canvas&&!ye(this.canvas,r,o,!0)){const e=st(a,s,this),r={type:t,property:l,args:e};n(this.canvas,r)}return i}}));a.push(i)}catch{const r=ue(e,l,{set(e){n(this.canvas,{type:t,property:l,args:[e],setter:!0})}});a.push(r)}return a}const ct='(function() {\n "use strict";\n var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);\n for (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n }\n var encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = "";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + "=";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + "==";\n }\n return base64;\n };\n const lastBlobMap = /* @__PURE__ */ new Map();\n const transparentBlobMap = /* @__PURE__ */ new Map();\n async function getTransparentBlobFor(width, height, dataURLOptions) {\n const id = `${width}-${height}`;\n if ("OffscreenCanvas" in globalThis) {\n if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);\n const offscreen = new OffscreenCanvas(width, height);\n offscreen.getContext("2d");\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n transparentBlobMap.set(id, base64);\n return base64;\n } else {\n return "";\n }\n }\n const worker = self;\n worker.onmessage = async function(e) {\n if ("OffscreenCanvas" in globalThis) {\n const { id, bitmap, width, height, dataURLOptions } = e.data;\n const transparentBase64 = getTransparentBlobFor(\n width,\n height,\n dataURLOptions\n );\n const offscreen = new OffscreenCanvas(width, height);\n const ctx = offscreen.getContext("2d");\n ctx.drawImage(bitmap, 0, 0);\n bitmap.close();\n const blob = await offscreen.convertToBlob(dataURLOptions);\n const type = blob.type;\n const arrayBuffer = await blob.arrayBuffer();\n const base64 = encode(arrayBuffer);\n if (!lastBlobMap.has(id) && await transparentBase64 === base64) {\n lastBlobMap.set(id, base64);\n return worker.postMessage({ id });\n }\n if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });\n worker.postMessage({\n id,\n type,\n base64,\n width,\n height\n });\n lastBlobMap.set(id, base64);\n } else {\n return worker.postMessage({ id: e.data.id });\n }\n };\n})();\n//# sourceMappingURL=image-bitmap-data-url-worker-IJpC7g_b.js.map\n',dt="undefined"!=typeof self&&self.Blob&&new Blob([ct],{type:"text/javascript;charset=utf-8"});function ut(e){let t;try{if(t=dt&&(self.URL||self.webkitURL).createObjectURL(dt),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),n}catch(t){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(ct),{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}class ht{constructor(e){n(this,"pendingCanvasMutations",new Map),n(this,"rafStamps",{latestId:0,invokeId:null}),n(this,"mirror"),n(this,"mutationCb"),n(this,"resetObservers"),n(this,"frozen",!1),n(this,"locked",!1),n(this,"processMutation",((e,t)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)}));const{sampling:t="all",win:r,blockClass:o,blockSelector:s,recordCanvas:a,dataURLOptions:i}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(r,o,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,o,s,{dataURLOptions:i})}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(e,t,n,r,o){const s=it(t,n,r,!0),a=new Map,l=new ut;l.onmessage=e=>{const{id:t}=e.data;if(a.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:o,height:s}=e.data;this.mutationCb({id:t,type:i["2D"],commands:[{property:"clearRect",args:[0,0,o,s]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:r}]},0,0]}]})};const c=1e3/e;let d,u=0;const h=e=>{u&&e-u<c||(u=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{ye(t,n,r,!0)||e.push(t)})),e})().forEach((async e=>{var t;const n=this.mirror.getId(e);if(a.get(n))return;if(0===e.width||0===e.height)return;if(a.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null==(t=null==n?void 0:n.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const r=await createImageBitmap(e);l.postMessage({id:n,bitmap:r,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[r])}))),d=requestAnimationFrame(h)};d=requestAnimationFrame(h),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=it(e,t,n,!1),o=function(e,t,n,r){const o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of s)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[a])continue;const s=I(t.CanvasRenderingContext2D.prototype,a,(function(o){return function(...s){return ye(this.canvas,n,r,!0)||setTimeout((()=>{const n=st(s,t,this);e(this.canvas,{type:i["2D"],property:a,args:n})}),0),o.apply(this,s)}}));o.push(s)}catch{const n=ue(t.CanvasRenderingContext2D.prototype,a,{set(t){e(this.canvas,{type:i["2D"],property:a,args:[t],setter:!0})}});o.push(n)}return()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),s=function(e,t,n,r){const o=[];return void 0!==t.WebGLRenderingContext&&o.push(...lt(t.WebGLRenderingContext.prototype,i.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&o.push(...lt(t.WebGL2RenderingContext.prototype,i.WebGL2,e,n,r,t)),()=>{o.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const r=n.map((e=>{const{type:t,...n}=e;return n})),{type:o}=n[0];this.mutationCb({id:t,type:o,commands:r}),this.pendingCanvasMutations.delete(e)}}class pt{constructor(e){n(this,"trackedLinkElements",new WeakSet),n(this,"mutationCb"),n(this,"adoptedStyleSheetCb"),n(this,"styleMirror",new Me),this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},r=[];for(const t of e){let e;this.styleMirror.has(t)?e=this.styleMirror.getId(t):(e=this.styleMirror.add(t),r.push({styleId:e,rules:Array.from(t.rules||CSSRule,((e,n)=>({rule:R(e,t.href),index:n})))})),n.styleIds.push(e)}r.length>0&&(n.styles=r),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class mt{constructor(){n(this,"nodeMap",new WeakMap),n(this,"active",!1)}inOtherBuffer(e,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.active||(this.active=!0,requestAnimationFrame((()=>{this.nodeMap=new WeakMap,this.active=!1}))),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}}let ft,yt,gt,St=!1;try{if(2!==Array.from([1],(e=>2*e))[0]){const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null==(e=t.contentWindow)?void 0:e.Array.from)||Array.from,document.body.removeChild(t)}}catch(e){console.debug("Unable to override Array.from",e)}const bt=new O;function vt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:a="rr-block",blockSelector:i=null,ignoreClass:l="rr-ignore",ignoreSelector:c=null,maskTextClass:d="rr-mask",maskTextSelector:u=null,inlineStylesheet:h=!0,maskAllInputs:p,maskInputOptions:m,slimDOMOptions:f,maskInputFn:y,maskTextFn:g,hooks:S,packFn:b,sampling:I={},dataURLOptions:M={},mousemoveWait:w,recordDOM:k=!0,recordCanvas:T=!1,recordCrossOriginIframes:R=!1,recordAfter:E=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:x=!1,collectFonts:N=!1,inlineImages:L=!1,plugins:D,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:F=new Set([]),errorHandler:_}=e;Fe=_;const P=!R||window.parent===window;let U=!1;if(!P)try{window.parent.document&&(U=!1)}catch(e){U=!0}if(P&&!t)throw new Error("emit function is required");if(!P&&!U)return()=>{};void 0!==w&&void 0===I.mousemove&&(I.mousemove=w),bt.reset();const W=!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==m?m:{password:!0},B=oe(f);let z;!function(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)}();let j=0;const $=e=>{for(const t of D||[])t.eventProcessor&&(e=t.eventProcessor(e));return b&&!U&&(e=b(e)),e};ft=(e,a)=>{var i;const l=e;if(l.timestamp=v(),!(null==(i=Pe[0])?void 0:i.isFrozen())||l.type===r.FullSnapshot||l.type===r.IncrementalSnapshot&&l.data.source===o.Mutation||Pe.forEach((e=>e.unfreeze())),P)null==t||t($(l),a);else if(U){const e={type:"rrweb",event:$(l),origin:window.location.origin,isCheckout:a};window.parent.postMessage(e,"*")}if(l.type===r.FullSnapshot)z=l,j=0;else if(l.type===r.IncrementalSnapshot){if(l.data.source===o.Mutation&&l.data.isAttachIframe)return;j++;const e=s&&j>=s,t=n&&l.timestamp-z.timestamp>n;(e||t)&&yt(!0)}};const V=e=>{ft({type:r.IncrementalSnapshot,data:{source:o.Mutation,...e}})},G=e=>ft({type:r.IncrementalSnapshot,data:{source:o.Scroll,...e}}),H=e=>ft({type:r.IncrementalSnapshot,data:{source:o.CanvasMutation,...e}}),q=new pt({mutationCb:V,adoptedStyleSheetCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.AdoptedStyleSheet,...e}})}),X=new Ke({mirror:bt,mutationCb:V,stylesheetManager:q,recordCrossOriginIframes:R,wrappedEmit:ft});for(const e of D||[])e.getMirror&&e.getMirror({nodeMirror:bt,crossOriginIframeMirror:X.crossOriginIframeMirror,crossOriginIframeStyleMirror:X.crossOriginIframeStyleMirror});const Y=new mt;gt=new ht({recordCanvas:T,mutationCb:H,win:window,blockClass:a,blockSelector:i,mirror:bt,sampling:I.canvas,dataURLOptions:M});const J=new Ze({mutationCb:V,scrollCb:G,bypassOptions:{blockClass:a,blockSelector:i,maskTextClass:d,maskTextSelector:u,inlineStylesheet:h,maskInputOptions:W,dataURLOptions:M,maskTextFn:g,maskInputFn:y,recordCanvas:T,inlineImages:L,sampling:I,slimDOMOptions:B,iframeManager:X,stylesheetManager:q,canvasManager:gt,keepIframeSrcFn:A,processedNodeManager:Y},mirror:bt});yt=(e=!1)=>{if(!k)return;ft({type:r.Meta,data:{href:window.location.href,width:me(),height:pe()}},e),q.reset(),J.init(),Pe.forEach((e=>e.lock()));const t=function(e,t){const{mirror:n=new O,blockClass:r="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:i=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:d=!1,maskTextFn:u,maskInputFn:h,slimDOM:p=!1,dataURLOptions:m,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:g,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:v,keepIframeSrcFn:I=()=>!1}=t;return se(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:i,maskInputOptions:!0===d?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===d?{password:!0}:d,maskTextFn:u,maskInputFn:h,slimDOMOptions:oe(p),dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:g,iframeLoadTimeout:S,onStylesheetLoad:b,stylesheetLoadTimeout:v,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:bt,blockClass:a,blockSelector:i,maskTextClass:d,maskTextSelector:u,inlineStylesheet:h,maskAllInputs:W,maskTextFn:g,maskInputFn:y,slimDOM:B,dataURLOptions:M,recordCanvas:T,inlineImages:L,onSerialize:e=>{ve(e,bt)&&X.addIframe(e),Ie(e,bt)&&q.trackLinkElement(e),Ce(e)&&J.addShadowRoot(C.shadowRoot(e),document)},onIframeLoad:(e,t)=>{X.attachIframe(e,t),J.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{q.attachLinkElement(e,t)},keepIframeSrcFn:A});if(!t)return console.warn("Failed to snapshot the document");ft({type:r.FullSnapshot,data:{node:t,initialOffset:he(window)}},e),Pe.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&q.adoptStyleSheets(document.adoptedStyleSheets,bt.getId(document))};try{const e=[],t=e=>{var t;return _e(qe)({mutationCb:V,mousemoveCb:(e,t)=>ft({type:r.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.MouseInteraction,...e}}),scrollCb:G,viewportResizeCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.ViewportResize,...e}}),inputCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.Input,...e}}),mediaInteractionCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.MediaInteraction,...e}}),styleSheetRuleCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.StyleSheetRule,...e}}),styleDeclarationCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.StyleDeclaration,...e}}),canvasMutationCb:H,fontCb:e=>ft({type:r.IncrementalSnapshot,data:{source:o.Font,...e}}),selectionCb:e=>{ft({type:r.IncrementalSnapshot,data:{source:o.Selection,...e}})},customElementCb:e=>{ft({type:r.IncrementalSnapshot,data:{source:o.CustomElement,...e}})},blockClass:a,ignoreClass:l,ignoreSelector:c,maskTextClass:d,maskTextSelector:u,maskInputOptions:W,inlineStylesheet:h,sampling:I,recordDOM:k,recordCanvas:T,inlineImages:L,userTriggeredOnInput:x,collectFonts:N,doc:e,maskInputFn:y,maskTextFn:g,keepIframeSrcFn:A,blockSelector:i,slimDOMOptions:B,dataURLOptions:M,mirror:bt,iframeManager:X,stylesheetManager:q,shadowDomManager:J,processedNodeManager:Y,canvasManager:gt,ignoreCSSAttributes:F,plugins:(null==(t=null==D?void 0:D.filter((e=>e.observer)))?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>ft({type:r.Plugin,data:{plugin:e.name,payload:t}})}))))||[]},S)};X.addLoadListener((n=>{try{e.push(t(n.contentDocument))}catch(e){console.warn(e)}}));const n=()=>{yt(),e.push(t(document)),St=!0};return["interactive","complete"].includes(document.readyState)?n():(e.push(ie("DOMContentLoaded",(()=>{ft({type:r.DomContentLoaded,data:{}}),"DOMContentLoaded"===E&&n()}))),e.push(ie("load",(()=>{ft({type:r.Load,data:{}}),"load"===E&&n()}),window))),()=>{e.forEach((e=>{try{e()}catch(e){String(e).toLowerCase().includes("cross-origin")||console.warn(e)}})),Y.destroy(),St=!1,Fe=void 0}}catch(e){console.warn(e)}}vt.addCustomEvent=(e,t)=>{if(!St)throw new Error("please add custom event after start recording");ft({type:r.Custom,data:{tag:e,payload:t}})},vt.freezePage=()=>{Pe.forEach((e=>e.freeze()))},vt.takeFullSnapshot=e=>{if(!St)throw new Error("please take full snapshot after start recording");yt(e)},vt.mirror=bt;const It=vt;export{It as recorder};
|
|
2
|
+
//# sourceMappingURL=dash0-session-recording.js.map
|