@glimt/record 0.0.28 → 0.0.30
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/record.cjs +30 -4
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +30 -4
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +30 -4
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +1 -1
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.umd.min.cjs
CHANGED
|
@@ -55,7 +55,7 @@ https://www.w3ctech.com/topic/2226`));let l=t(...a);return l.postcssPlugin=e,l.p
|
|
|
55
55
|
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
56
56
|
https://www.w3ctech.com/topic/2226`));let l=t(...a);return l.postcssPlugin=e,l.postcssVersion=new Ts().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(a,l,o){return _([i(o)]).process(a,l)},i};_.stringify=yh;_.parse=mh;_.fromJSON=ch;_.list=ph;_.comment=s=>new go(s);_.atRule=s=>new mo(s);_.decl=s=>new yo(s);_.rule=s=>new So(s);_.root=s=>new bo(s);_.document=s=>new wo(s);_.CssSyntaxError=uh;_.Declaration=yo;_.Container=lh;_.Processor=Ts;_.Document=wo;_.Comment=go;_.Warning=wh;_.AtRule=mo;_.Result=gh;_.Input=hh;_.Rule=So;_.Root=bo;_.Node=dh;fh.registerPostcss(_);var bh=_;_.default=_;const W=ku(bh);W.stringify;W.fromJSON;W.plugin;W.parse;W.list;W.document;W.comment;W.atRule;W.rule;W.decl;W.root;W.CssSyntaxError;W.Declaration;W.Container;W.Processor;W.Document;W.Comment;W.Warning;W.AtRule;W.Result;W.Input;W.Rule;W.Root;W.Node;class Ds{constructor(...e){te(this,"parentElement",null),te(this,"parentNode",null),te(this,"ownerDocument"),te(this,"firstChild",null),te(this,"lastChild",null),te(this,"previousSibling",null),te(this,"nextSibling",null),te(this,"ELEMENT_NODE",1),te(this,"TEXT_NODE",3),te(this,"nodeType"),te(this,"nodeName"),te(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 Ds){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;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"}}const ki={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Pi={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Dt={},Sh=()=>!!globalThis.Zone;function Fs(s){if(Dt[s])return Dt[s];const e=globalThis[s],t=e.prototype,r=s in ki?ki[s]:void 0,i=!!(r&&r.every(l=>{var o,c;return!!((c=(o=Object.getOwnPropertyDescriptor(t,l))==null?void 0:o.get)!=null&&c.toString().includes("[native code]"))})),n=s in Pi?Pi[s]:void 0,a=!!(n&&n.every(l=>{var o;return typeof t[l]=="function"&&((o=t[l])==null?void 0:o.toString().includes("[native code]"))}));if(i&&a&&!Sh())return Dt[s]=e.prototype,e.prototype;try{const l=document.createElement("iframe");document.body.appendChild(l);const o=l.contentWindow;if(!o)return e.prototype;const c=o[s].prototype;return document.body.removeChild(l),c?Dt[s]=c:t}catch(l){return t}}const Nr={};function be(s,e,t){var r;const i=`${s}.${String(t)}`;if(Nr[i])return Nr[i].call(e);const n=Fs(s),a=(r=Object.getOwnPropertyDescriptor(n,t))==null?void 0:r.get;return a?(Nr[i]=a,a.call(e)):e[t]}const kr={};function Co(s,e,t){const r=`${s}.${String(t)}`;if(kr[r])return kr[r].bind(e);const n=Fs(s)[t];return typeof n!="function"?e[t]:(kr[r]=n,n.bind(e))}function Ch(s){return be("Node",s,"childNodes")}function vh(s){return be("Node",s,"parentNode")}function Ih(s){return be("Node",s,"parentElement")}function xh(s){return be("Node",s,"textContent")}function Rh(s,e){return Co("Node",s,"contains")(e)}function Oh(s){return Co("Node",s,"getRootNode")()}function Mh(s){return!s||!("host"in s)?null:be("ShadowRoot",s,"host")}function Ah(s){return s.styleSheets}function Eh(s){return!s||!("shadowRoot"in s)?null:be("Element",s,"shadowRoot")}function $h(s,e){return be("Element",s,"querySelector")(e)}function Nh(s,e){return be("Element",s,"querySelectorAll")(e)}function vo(){return Fs("MutationObserver").constructor}function Ae(s,e,t){try{if(!(e in s))return()=>{};const r=s[e],i=t(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),s[e]=i,()=>{s[e]=r}}catch(r){return()=>{}}}const R={childNodes:Ch,parentNode:vh,parentElement:Ih,textContent:xh,contains:Rh,getRootNode:Oh,host:Mh,styleSheets:Ah,shadowRoot:Eh,querySelector:$h,querySelectorAll:Nh,mutationObserver:vo,patch:Ae};function Z(s,e,t=document){const r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}const Ne=`Please stop import mirror directly. Instead of that,\r
|
|
57
57
|
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
58
|
-
or you can use record.mirror to access the mirror instance during recording.`;let Li={map:{},getId(){return console.error(Ne),-1},getNode(){return console.error(Ne),null},removeNodeFromMap(){console.error(Ne)},has(){return console.error(Ne),!1},reset(){console.error(Ne)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(Li=new Proxy(Li,{get(s,e,t){return e==="map"&&console.error(Ne),Reflect.get(s,e,t)}}));function ut(s,e,t={}){let r=null,i=0;return function(...n){const a=Date.now();!i&&t.leading===!1&&(i=a);const l=e-(a-i),o=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=a,s.apply(o,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(o,n)},l))}}function wr(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(a){setTimeout(()=>{t.set.call(this,a)},0),n&&n.set&&n.set.call(this,a)}}),()=>wr(s,e,n||{},!0)}let nr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(nr=()=>new Date().getTime());function Io(s){var e,t,r,i;const n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||(n==null?void 0:n.body)&&((e=R.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n==null?void 0:n.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:(n==null?void 0:n.documentElement.scrollTop)||(n==null?void 0:n.body)&&((r=R.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function xo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ro(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Oo(s){return s?s.nodeType===s.ELEMENT_NODE?s:R.parentElement(s):null}function J(s,e,t,r){if(!s)return!1;const i=Oo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Xt(i,e,r))return!0}catch(n){}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function kh(s,e){return e.getId(s)!==-1}function Pr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===et}function Mo(s,e){if(Ke(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=R.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Mo(r,e):!0}function fs(s){return!!s.changedTouches}function Ph(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Ao(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function Eo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function ps(s){return s?s instanceof Ds&&"shadowRoot"in s?!!s.shadowRoot:!!R.shadowRoot(s):!1}class Lh{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){var t;return(t=this.styleIDMap.get(e))!=null?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}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 $o(s){var e;let t=null;return"getRootNode"in s&&((e=R.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&R.host(R.getRootNode(s))&&(t=R.host(R.getRootNode(s))),t}function _h(s){let e=s,t;for(;t=$o(e);)e=t;return e}function Th(s){const e=s.ownerDocument;if(!e)return!1;const t=_h(s);return R.contains(e,t)}function No(s){const e=s.ownerDocument;return e?R.contains(e,s)||Th(s):!1}var N=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(N||{}),O=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(O||{}),K=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(K||{}),pe=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(pe||{}),We=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(We||{}),ke=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(ke||{}),ko=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(ko||{});function _i(s){return"__ln"in s}class Dh{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&_i(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&_i(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(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 Ti=(s,e)=>`${s}@${e}`;class Fh{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"stormBatches",[]),w(this,"stormInfo"),w(this,"stormSettings",{batchSize:300,timeout:50,mutationLimit:1500}),w(this,"handleStormMutations",e=>{const t=Date.now();this.stormInfo==null&&(console.log("detected probable mutation storm start"),this.stormInfo={startedAt:t,totalMutations:0,timeout:setTimeout(this.handleStormFinish,this.stormSettings.timeout),stormExceededLimit:!1}),this.stormInfo.totalMutations+=e.length,console.log("current storm mutations",this.stormInfo.totalMutations),this.stormInfo.totalMutations>=this.stormSettings.mutationLimit?(this.stormInfo.stormExceededLimit=!0,this.stormBatches=[]):this.stormBatches.push({ts:t,mutations:e}),e.length<this.stormSettings.batchSize&&(clearTimeout(this.stormInfo.timeout),this.handleStormFinish())}),w(this,"handleStormFinish",()=>{if(!this.stormInfo)return;const{stormExceededLimit:e}=this.stormInfo;if(console.log("mutation storm finished","totalMutations:",this.stormInfo.totalMutations,"stormExceededLimit:",e),clearTimeout(this.stormInfo.timeout),this.stormInfo=null,e)this.stormBatches=[],gf();else{let t=[];for(const r of this.stormBatches)t.push(...r.mutations);this.stormBatches=[],this.processInternalMutations(t,!0)}}),w(this,"processInternalMutations",(e,t=!1)=>{if(!t&&(this.stormInfo!=null||e.length>=this.stormSettings.batchSize)){this.handleStormMutations(e);return}const r=performance.now();for(const i of e)this.processMutation(i);console.log(e.length,"mutations processed in",performance.now()-r,"ms","overrideStorm",t),this.emit()}),w(this,"processMutations",e=>{this.processInternalMutations(e)}),w(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Dh,i=u=>{let h=u,p=et;for(;p===et;)h=h&&h.nextSibling,p=h&&this.mirror.getId(h);return p},n=u=>{const h=R.parentNode(u);if(!h||!No(u))return;let p=!1;if(u.nodeType===Node.TEXT_NODE){const f=h.tagName;if(f==="TEXTAREA")return;f==="STYLE"&&this.addedSet.has(h)&&(p=!0)}const d=Ke(h)?this.mirror.getId($o(u)):this.mirror.getId(h),g=i(u);if(d===-1||g===-1)return r.addNode(u);const m=Le(u,{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:f=>{Ao(f,this.mirror)&&this.iframeManager.addIframe(f),Eo(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),ps(u)&&this.shadowDomManager.addShadowRoot(R.shadowRoot(u),this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)},cssCaptured:p});m&&(e.push({parentId:d,nextId:g,node:m}),t.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const u of this.movedSet)Di(this.removesSubTreeCache,u,this.mirror)&&!this.movedSet.has(R.parentNode(u))||n(u);for(const u of this.addedSet)!Fi(this.droppedSet,u)&&!Di(this.removesSubTreeCache,u,this.mirror)||Fi(this.movedSet,u)?n(u):this.droppedSet.add(u);let a=null;for(;r.length;){let u=null;if(a){const h=this.mirror.getId(R.parentNode(a.value)),p=i(a.value);h!==-1&&p!==-1&&(u=a)}if(!u){let h=r.tail;for(;h;){const p=h;if(h=h.previous,p){const d=this.mirror.getId(R.parentNode(p.value));if(i(p.value)===-1)continue;if(d!==-1){u=p;break}else{const m=p.value,f=R.parentNode(m);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const y=R.host(f);if(this.mirror.getId(y)!==-1){u=p;break}}}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}a=u.previous,r.removeNode(u.value),n(u.value)}const l=[];for(const u of this.texts){const h=u.node,p=R.parentNode(h);p&&p.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(p);const d=this.mirror.getId(h);!t.has(d)&&this.mirror.has(d)&&l.push({id:d,value:u.value})}const o=[];for(const u of this.attributes){const{attributes:h}=u;if(typeof h.style=="string"){const d=JSON.stringify(u.styleDiff),g=JSON.stringify(u._unchangedStyles);d.length<h.style.length&&(d+g).split("var(").length===h.style.split("var(").length&&(h.style=u.styleDiff)}const p=this.mirror.getId(u.node);!t.has(p)&&this.mirror.has(p)&&o.push({id:p,attributes:h})}const c={texts:l,attributes:o,removes:this.removes,adds:e};!c.texts.length&&!c.attributes.length&&!c.removes.length&&!c.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(c))}),w(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 r=Array.from(R.childNodes(e),i=>R.textContent(i)||"").join("");t.attributes.value=Yt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Zt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Pr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=R.textContent(e.target);!J(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:en(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Oo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const a=Zt(t);i=Yt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:a,value:i,maskInputFn:this.maskInputFn})}if(J(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!qi(t.tagName,r))if(n.attributes[r]=Qi(this.doc,Re(t.tagName),Re(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(l){this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const o=t.style.getPropertyValue(l),c=t.style.getPropertyPriority(l);o!==a.style.getPropertyValue(l)||c!==a.style.getPropertyPriority(l)?c===""?n.styleDiff[l]=o:n.styleDiff[l]=[o,c]:n._unchangedStyles[l]=[o,c]}for(const l of Array.from(a.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(J(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}for(let a=0;a<e.addedNodes.length;a++)this.genAdds(e.addedNodes[a],e.target);const t=Ke(e.target)?this.mirror.getId(R.host(e.target)):this.mirror.getId(e.target);if(J(e.target,this.blockClass,this.blockSelector,!1))return;const r=this.addedSet.has(e.target),i=Mo(e.target,this.mirror),n=Ke(e.target)&&Qe(e.target)?!0:void 0;for(let a=0;a<e.removedNodes.length;a++){const l=e.removedNodes[a],o=this.mirror.getId(l);if(Pr(l,this.mirror,this.slimDOMOptions)||!kh(l,this.mirror))return;this.addedSet.has(l)?(ds(this.addedSet,l),this.droppedSet.add(l)):r&&o===-1||i||(this.movedSet.has(l)&&this.movedMap[Ti(o,t)]?ds(this.movedSet,l):(this.removes.push({parentId:t,id:o,isShadow:n}),Bh(l,this.removesSubTreeCache))),this.mapRemoves.push(l)}break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Pr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Ti(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!J(e,this.blockClass,this.blockSelector,!1)){const r=R.childNodes(e);for(let i=0;i<r.length;i++)this.genAdds(r[i]);if(ps(e)){const i=R.childNodes(R.shadowRoot(e));for(let n=0;n<i.length;n++){const a=i[n];this.processedNodeManager.add(a,this),this.genAdds(a,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 ds(s,e){s.delete(e);const t=R.childNodes(e);for(let r=0;r<t.length;r++)ds(s,t[r])}function Bh(s,e){const t=[s];for(;t.length;){const r=t.pop();if(e.has(r))continue;e.add(r);const i=R.childNodes(r);for(let n=0;n<i.length;n++)t.push(i[n])}}function Di(s,e,t){return s.size===0?!1:Uh(s,e)}function Uh(s,e,t){const r=R.parentNode(e);return r?s.has(r):!1}function Fi(s,e){return s.size===0?!1:Po(s,e)}function Po(s,e){const t=R.parentNode(e);return t?s.has(t)?!0:Po(s,t):!1}let qe;function zh(s){qe=s}function Wh(){qe=void 0}const E=s=>qe?(...t)=>{try{return s(...t)}catch(r){if(qe&&qe(r)===!0)return;throw r}}:s,xe=[];function dt(s){try{if("composedPath"in s){const e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch(e){}return s&&s.target}function Lo(s,e){const t=new Fh;xe.push(t),t.init(s);const r=new(vo())(E(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Gh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const o=ut(E(h=>{const p=Date.now()-l;s(a.map(d=>(d.timeOffset-=p,d)),h),a=[],l=null}),n),c=E(ut(E(h=>{const p=dt(h),{clientX:d,clientY:g}=fs(h)?h.changedTouches[0]:h;l||(l=nr()),a.push({x:d,y:g,id:r.getId(p),timeOffset:nr()-l}),o(typeof DragEvent!="undefined"&&h instanceof DragEvent?O.Drag:h instanceof MouseEvent?O.MouseMove:O.TouchMove)}),i,{trailing:!1})),u=[Z("mousemove",c,t),Z("touchmove",c,t),Z("drag",c,t)];return E(()=>{u.forEach(h=>h())})}function Vh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const a=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let o=null;const c=u=>h=>{const p=dt(h);if(J(p,r,i,!0))return;let d=null,g=u;if("pointerType"in h){switch(h.pointerType){case"mouse":d=pe.Mouse;break;case"touch":d=pe.Touch;break;case"pen":d=pe.Pen;break}d===pe.Touch?K[u]===K.MouseDown?g="TouchStart":K[u]===K.MouseUp&&(g="TouchEnd"):pe.Pen}else fs(h)&&(d=pe.Touch);d!==null?(o=d,(g.startsWith("Touch")&&d===pe.Touch||g.startsWith("Mouse")&&d===pe.Mouse)&&(d=null)):K[u]===K.Click&&(d=o,o=null);const m=fs(h)?h.changedTouches[0]:h;if(!m)return;const f=t.getId(p),{clientX:y,clientY:S}=m;E(s)(A({type:K[g],id:f,x:y,y:S},d!==null&&{pointerType:d}))};return Object.keys(K).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{let h=Re(u);const p=c(u);if(window.PointerEvent)switch(K[u]){case K.MouseDown:case K.MouseUp:h=h.replace("mouse","pointer");break;case K.TouchStart:case K.TouchEnd:return}l.push(Z(h,p,e))}),E(()=>{l.forEach(u=>u())})}function _o({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const a=E(ut(E(l=>{const o=dt(l);if(!o||J(o,r,i,!0))return;const c=t.getId(o);if(o===e&&e.defaultView){const u=Io(e.defaultView);s({id:c,x:u.left,y:u.top})}else s({id:c,x:o.scrollLeft,y:o.scrollTop})}),n.scroll||100));return Z("scroll",a,e)}function jh({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=E(ut(E(()=>{const n=xo(),a=Ro();(t!==n||r!==a)&&(s({width:Number(a),height:Number(n)}),t=n,r=a)}),200));return Z("resize",i,e)}const Hh=["INPUT","TEXTAREA","SELECT"],Bi=new WeakMap;function Yh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:a,maskInputOptions:l,maskInputFn:o,sampling:c,userTriggeredOnInput:u}){function h(S){let C=dt(S);const D=S.isTrusted,b=C&&C.tagName;if(C&&b==="OPTION"&&(C=R.parentElement(C)),!C||!b||Hh.indexOf(b)<0||J(C,r,i,!0)||C.classList.contains(n)||a&&C.matches(a))return;let v=C.value,F=!1;const $=Zt(C)||"";$==="radio"||$==="checkbox"?F=C.checked:(l[b.toLowerCase()]||l[$])&&(v=Yt({element:C,maskInputOptions:l,tagName:b,type:$,value:v,maskInputFn:o})),p(C,u?{text:v,isChecked:F,userTriggered:D}:{text:v,isChecked:F});const U=C.name;$==="radio"&&U&&F&&e.querySelectorAll(`input[type="radio"][name="${U}"]`).forEach(V=>{if(V!==C){const Q=V.value;p(V,u?{text:Q,isChecked:!F,userTriggered:!1}:{text:Q,isChecked:!F})}})}function p(S,C){const D=Bi.get(S);if(!D||D.text!==C.text||D.isChecked!==C.isChecked){Bi.set(S,C);const b=t.getId(S);E(s)(ee(A({},C),{id:b}))}}const g=(c.input==="last"?["change"]:["input","change"]).map(S=>Z(S,E(h),e)),m=e.defaultView;if(!m)return()=>{g.forEach(S=>S())};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&&g.push(...y.map(S=>wr(S[0],S[1],{set(){E(h)({target:this,isTrusted:!1})}},!1,m))),E(()=>{g.forEach(S=>S())})}function or(s){const e=[];function t(r,i){if(Ft("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ft("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ft("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ft("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(a)}return i}return t(s,e)}function ye(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Zh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:E((u,h,p)=>{const[d,g]=p,{id:m,styleId:f}=ye(h,e,t.styleMirror);return(m&&m!==-1||f&&f!==-1)&&s({id:m,styleId:f,adds:[{rule:d,index:g}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,p=this.cssRules.length){const d=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[d,p])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:E((u,h,p)=>{const[d]=p,{id:g,styleId:m}=ye(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,removes:[{index:d}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:E((u,h,p)=>{const[d]=p,{id:g,styleId:m}=ye(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replace:d}),u.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:E((u,h,p)=>{const[d]=p,{id:g,styleId:m}=ye(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replaceSync:d}),u.apply(h,p)})}));const o={};Bt("CSSGroupingRule")?o.CSSGroupingRule=r.CSSGroupingRule:(Bt("CSSMediaRule")&&(o.CSSMediaRule=r.CSSMediaRule),Bt("CSSConditionRule")&&(o.CSSConditionRule=r.CSSConditionRule),Bt("CSSSupportsRule")&&(o.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(o).forEach(([u,h])=>{c[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(c[u].insertRule,{apply:E((p,d,g)=>{const[m,f]=g,{id:y,styleId:S}=ye(d.parentStyleSheet,e,t.styleMirror);return(y&&y!==-1||S&&S!==-1)&&s({id:y,styleId:S,adds:[{rule:m,index:[...or(d),f||0]}]}),p.apply(d,g)})}),h.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:E((p,d,g)=>{const[m]=g,{id:f,styleId:y}=ye(d.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&s({id:f,styleId:y,removes:[{index:[...or(d),m]}]}),p.apply(d,g)})})}),E(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,a&&(r.CSSStyleSheet.prototype.replace=a),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(o).forEach(([u,h])=>{h.prototype.insertRule=c[u].insertRule,h.prototype.deleteRule=c[u].deleteRule})})}function To({mirror:s,stylesheetManager:e},t){var r,i,n;let a=null;t.nodeName==="#document"?a=s.getId(t):a=s.getId(R.host(t));const l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,o=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!o?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:o.configurable,enumerable:o.enumerable,get(){var c;return(c=o.get)==null?void 0:c.call(this)},set(c){var u;const h=(u=o.set)==null?void 0:u.call(this,c);if(a!==null&&a!==-1)try{e.adoptStyleSheets(c,a)}catch(p){}return h}}),E(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:o.configurable,enumerable:o.enumerable,get:o.get,set:o.set})}))}function Jh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:E((l,o,c)=>{var u;const[h,p,d]=c;if(t.has(h))return n.apply(o,[h,p,d]);const{id:g,styleId:m}=ye((u=o.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,set:{property:h,value:p,priority:d},index:or(o.parentRule)}),l.apply(o,c)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:E((l,o,c)=>{var u;const[h]=c;if(t.has(h))return a.apply(o,[h]);const{id:p,styleId:d}=ye((u=o.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||d&&d!==-1)&&s({id:p,styleId:d,remove:{property:h},index:or(o.parentRule)}),l.apply(o,c)})}),E(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=a})}function Xh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const a=E(o=>ut(E(c=>{const u=dt(c);if(!u||J(u,e,t,!0))return;const{currentTime:h,volume:p,muted:d,playbackRate:g,loop:m}=u;s({type:o,id:r.getId(u),currentTime:h,volume:p,muted:d,playbackRate:g,loop:m})}),i.media||500)),l=[Z("play",a(ke.Play),n),Z("pause",a(ke.Pause),n),Z("seeked",a(ke.Seeked),n),Z("volumechange",a(ke.VolumeChange),n),Z("ratechange",a(ke.RateChange),n)];return E(()=>{l.forEach(o=>o())})}function Kh({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(o,c,u){const h=new n(o,c,u);return i.set(h,{family:o,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};const a=Ae(e.fonts,"add",function(l){return function(o){return setTimeout(E(()=>{const c=i.get(o);c&&(s(c),i.delete(o))}),0),l.apply(this,[o])}});return r.push(()=>{t.FontFace=n}),r.push(a),E(()=>{r.forEach(l=>l())})}function Qh(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let a=!0;const l=E(()=>{const o=e.getSelection();if(!o||a&&(o!=null&&o.isCollapsed))return;a=o.isCollapsed||!1;const c=[],u=o.rangeCount||0;for(let h=0;h<u;h++){const p=o.getRangeAt(h),{startContainer:d,startOffset:g,endContainer:m,endOffset:f}=p;J(d,r,i,!0)||J(m,r,i,!0)||c.push({start:t.getId(d),startOffset:g,end:t.getId(m),endOffset:f})}n({ranges:c})});return l(),Z("selectionchange",l)}function qh({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:Ae(t.customElements,"define",function(i){return function(n,a,l){try{e({define:{name:n}})}catch(o){console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,a,l])}})}function ef(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:a,inputCb:l,mediaInteractionCb:o,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:h,fontCb:p,selectionCb:d,customElementCb:g}=s;s.mutationCb=(...m)=>{e.mutation&&e.mutation(...m),t(...m)},s.mousemoveCb=(...m)=>{e.mousemove&&e.mousemove(...m),r(...m)},s.mouseInteractionCb=(...m)=>{e.mouseInteraction&&e.mouseInteraction(...m),i(...m)},s.scrollCb=(...m)=>{e.scroll&&e.scroll(...m),n(...m)},s.viewportResizeCb=(...m)=>{e.viewportResize&&e.viewportResize(...m),a(...m)},s.inputCb=(...m)=>{e.input&&e.input(...m),l(...m)},s.mediaInteractionCb=(...m)=>{e.mediaInteaction&&e.mediaInteaction(...m),o(...m)},s.styleSheetRuleCb=(...m)=>{e.styleSheetRule&&e.styleSheetRule(...m),c(...m)},s.styleDeclarationCb=(...m)=>{e.styleDeclaration&&e.styleDeclaration(...m),u(...m)},s.canvasMutationCb=(...m)=>{e.canvasMutation&&e.canvasMutation(...m),h(...m)},s.fontCb=(...m)=>{e.font&&e.font(...m),p(...m)},s.selectionCb=(...m)=>{e.selection&&e.selection(...m),d(...m)},s.customElementCb=(...m)=>{e.customElement&&e.customElement(...m),g(...m)}}function tf(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};ef(s,e);let r;s.recordDOM&&(r=Lo(s,s.doc));const i=Gh(s),n=Vh(s),a=_o(s),l=jh(s,{win:t}),o=Yh(s),c=Xh(s);let u=()=>{},h=()=>{},p=()=>{},d=()=>{};s.recordDOM&&(u=Zh(s,{win:t}),h=To(s,s.doc),p=Jh(s,{win:t}),s.collectFonts&&(d=Kh(s)));const g=Qh(s),m=qh(s),f=[];for(const y of s.plugins)f.push(y.observer(y.callback,t,y.options));return E(()=>{xe.forEach(y=>y.reset()),r==null||r.disconnect(),i(),n(),a(),l(),o(),c(),u(),h(),p(),d(),g(),m(),f.forEach(y=>y())})}function Ft(s){return typeof window[s]!="undefined"}function Bt(s){return!!(typeof window[s]!="undefined"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}class Ui{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),a.set(l,t)),l}getIds(e,t){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const n=i.get(t);return n||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}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 rf{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new Ui(Ki)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ui(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 r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.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(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case N.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:N.IncrementalSnapshot,data:{source:O.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case N.Meta:case N.Load:case N.DomContentLoaded:return!1;case N.Plugin:return t;case N.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case N.IncrementalSnapshot:switch(t.data.source){case O.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case O.Drag:case O.TouchMove:case O.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,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(i=>{this.replaceIds(i,e,["start","end"])}),t;case O.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(const n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==ko.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}class sf{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(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(!Qe(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=Lo(ee(A({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(_o(ee(A({},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(R.host(e))),this.restoreHandlers.push(To({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 r=this;this.restoreHandlers.push(Ae(e.prototype,"attachShadow",function(i){return function(n){const a=i.call(this,n),l=R.shadowRoot(this);return l&&No(this)&&r.addShadowRoot(l,t),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var _e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nf=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var Ut=0;Ut<_e.length;Ut++)nf[_e.charCodeAt(Ut)]=Ut;var of=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=_e[e[t]>>2],i+=_e[(e[t]&3)<<4|e[t+1]>>4],i+=_e[(e[t+1]&15)<<2|e[t+2]>>6],i+=_e[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const zi=new Map;function af(s,e){let t=zi.get(s);return t||(t=new Map,zi.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const Do=(s,e,t)=>{if(!s||!(Bo(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=af(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function jt(s,e,t){if(s instanceof Array)return s.map(r=>jt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){const r=s.constructor.name,i=of(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[jt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){const r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){const r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[jt(s.data,e,t),s.width,s.height]};if(Bo(s,e)||typeof s=="object"){const r=s.constructor.name,i=Do(s,e,t);return{rr_type:r,index:i}}}}return s}const Fo=(s,e,t)=>s.map(r=>jt(r,e,t)),Bo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function lf(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of n)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;const l=Ae(e.CanvasRenderingContext2D.prototype,a,function(o){return function(...c){return J(this.canvas,t,r,!0)||setTimeout(()=>{const u=Fo(c,e,this);s(this.canvas,{type:We["2D"],property:a,args:u})},0),o.apply(this,c)}});i.push(l)}catch(l){const o=wr(e.CanvasRenderingContext2D.prototype,a,{set(c){s(this.canvas,{type:We["2D"],property:a,args:[c],setter:!0})}});i.push(o)}return()=>{i.forEach(a=>a())}}function uf(s){return s==="experimental-webgl"?"webgl":s}function Wi(s,e,t,r){const i=[];try{const n=Ae(s.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...o){if(!J(this,e,t,!0)){const c=uf(l);if("__context"in this||(this.__context=c),r&&["webgl","webgl2"].includes(c))if(o[0]&&typeof o[0]=="object"){const u=o[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...o])}});i.push(n)}catch(n){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function Gi(s,e,t,r,i,n){const a=[],l=Object.getOwnPropertyNames(s);for(const o of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(o))try{if(typeof s[o]!="function")continue;const c=Ae(s,o,function(u){return function(...h){const p=u.apply(this,h);if(Do(p,n,this),"tagName"in this.canvas&&!J(this.canvas,r,i,!0)){const d=Fo(h,n,this),g={type:e,property:o,args:d};t(this.canvas,g)}return p}});a.push(c)}catch(c){const u=wr(s,o,{set(h){t(this.canvas,{type:e,property:o,args:[h],setter:!0})}});a.push(u)}return a}function cf(s,e,t,r){const i=[];return i.push(...Gi(e.WebGLRenderingContext.prototype,We.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext!="undefined"&&i.push(...Gi(e.WebGL2RenderingContext.prototype,We.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const Uo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",hf=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Vi=typeof self!="undefined"&&self.Blob&&new Blob([hf(Uo)],{type:"text/javascript;charset=utf-8"});function ff(s){let e;try{if(e=Vi&&(self.URL||self.webkitURL).createObjectURL(Vi),!e)throw"";const t=new Worker(e,{name:s==null?void 0:s.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch(t){return new Worker("data:text/javascript;base64,"+Uo,{name:s==null?void 0:s.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class pf{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(o,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(o)||this.pendingCanvasMutations.set(o,[]),this.pendingCanvasMutations.get(o).push(c)});const{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&t==="all"&&this.initCanvasMutationObserver(r,i,n),a&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{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(e,t,r,i,n){const a=Wi(t,r,i,!0),l=new Map,o=new ff;o.onmessage=g=>{const{id:m}=g.data;if(l.set(m,!1),!("base64"in g.data))return;const{base64:f,type:y,width:S,height:C}=g.data;this.mutationCb({id:m,type:We["2D"],commands:[{property:"clearRect",args:[0,0,S,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:y}]},0,0]}]})};const c=1e3/e;let u=0,h;const p=()=>{const g=[];return t.document.querySelectorAll("canvas").forEach(m=>{J(m,r,i,!0)||g.push(m)}),g},d=g=>{if(u&&g-u<c){h=requestAnimationFrame(d);return}u=g,p().forEach(async m=>{var f;const y=this.mirror.getId(m);if(l.get(y)||m.width===0||m.height===0)return;if(l.set(y,!0),["webgl","webgl2"].includes(m.__context)){const C=m.getContext(m.__context);((f=C==null?void 0:C.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&C.clear(C.COLOR_BUFFER_BIT)}const S=await createImageBitmap(m);o.postMessage({id:y,bitmap:S,width:m.width,height:m.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(d)};h=requestAnimationFrame(d),this.resetObservers=()=>{a(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Wi(e,t,r,!1),n=lf(this.processMutation.bind(this),e,t,r),a=cf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;const i=r.map(a=>{const c=a,{type:l}=c;return Ee(c,["type"])}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class df{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new Lh),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(e.length===0)return;const r={id:t,styleIds:[]},i=[];for(const n of e){let a;this.styleMirror.has(n)?a=this.styleMirror.getId(n):(a=this.styleMirror.add(n),i.push({styleId:a,rules:Array.from(n.rules||CSSRule,(l,o)=>({rule:Zi(l,n.href),index:o}))})),r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class mf{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==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 G,Ht,Lr,ar=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((js=s.contentWindow)==null?void 0:js.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}const re=da();function Se(s={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:o="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:d,maskInputFn:g,maskTextFn:m,hooks:f,packFn:y,sampling:S={},dataURLOptions:C={},mousemoveWait:D,recordDOM:b=!0,recordCanvas:v=!1,recordCrossOriginIframes:F=!1,recordAfter:$=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:U=!1,collectFonts:V=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:k=()=>!1,ignoreCSSAttributes:Ge=new Set([]),errorHandler:Ve}=s;zh(Ve);const j=F?window.parent===window:!0;let q=!1;if(!j)try{window.parent.document&&(q=!1)}catch(P){q=!0}if(j&&!e)throw new Error("emit function is required");if(!j&&!q)return()=>{};D!==void 0&&S.mousemove===void 0&&(S.mousemove=D),re.reset();const ge=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},oe=d===!0||d==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:d==="all",headMetaDescKeywords:d==="all",headTitleMutations:d==="all"}:d||{};Ph();let mt,Ce=0;const Bs=P=>{for(const ae of ne||[])ae.eventProcessor&&(P=ae.eventProcessor(P));return y&&!q&&(P=y(P)),P};G=(P,ae)=>{var ce;const M=P;if(M.timestamp=nr(),(ce=xe[0])!=null&&ce.isFrozen()&&M.type!==N.FullSnapshot&&!(M.type===N.IncrementalSnapshot&&M.data.source===O.Mutation)&&xe.forEach(X=>X.unfreeze()),j)e==null||e(Bs(M),ae);else if(q){const X={type:"rrweb",event:Bs(M),origin:window.location.origin,isCheckout:ae};window.parent.postMessage(X,"*")}if(M.type===N.FullSnapshot)mt=M,Ce=0;else if(M.type===N.IncrementalSnapshot){if(M.data.source===O.Mutation&&M.data.isAttachIframe)return;Ce++;const X=r&&Ce>=r,T=t&&M.timestamp-mt.timestamp>t;(X||T)&&Ht(!0)}};const gt=P=>{G({type:N.IncrementalSnapshot,data:A({source:O.Mutation},P)})},Us=P=>G({type:N.IncrementalSnapshot,data:A({source:O.Scroll},P)}),zs=P=>G({type:N.IncrementalSnapshot,data:A({source:O.CanvasMutation},P)}),zo=P=>G({type:N.IncrementalSnapshot,data:A({source:O.AdoptedStyleSheet},P)}),ve=new df({mutationCb:gt,adoptedStyleSheetCb:zo}),Ie=new rf({mirror:re,mutationCb:gt,stylesheetManager:ve,recordCrossOriginIframes:F,wrappedEmit:G});for(const P of ne||[])P.getMirror&&P.getMirror({nodeMirror:re,crossOriginIframeMirror:Ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ie.crossOriginIframeStyleMirror});const br=new mf;Lr=new pf({recordCanvas:v,mutationCb:zs,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:C});const yt=new sf({mutationCb:gt,scrollCb:Us,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:ge,dataURLOptions:C,maskTextFn:m,maskInputFn:g,recordCanvas:v,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:Ie,stylesheetManager:ve,canvasManager:Lr,keepIframeSrcFn:k,processedNodeManager:br},mirror:re});Ht=(P=!1)=>{if(!b)return;const ae=performance.now();G({type:N.Meta,data:{href:window.location.href,width:Ro(),height:xo()}},P),ve.reset(),yt.init(),xe.forEach(M=>M.lock());const ce=za(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:ge,maskTextFn:m,maskInputFn:g,slimDOM:oe,dataURLOptions:C,recordCanvas:v,inlineImages:Q,onSerialize:M=>{Ao(M,re)&&Ie.addIframe(M),Eo(M,re)&&ve.trackLinkElement(M),ps(M)&&yt.addShadowRoot(R.shadowRoot(M),document)},onIframeLoad:(M,X)=>{Ie.attachIframe(M,X),yt.observeAttachShadow(M)},onStylesheetLoad:(M,X)=>{ve.attachLinkElement(M,X)},keepIframeSrcFn:k});if(!ce)return console.warn("Failed to snapshot the document");G({type:N.FullSnapshot,data:{node:ce,initialOffset:Io(window)}},P),xe.forEach(M=>M.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ve.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document)),console.log("full snapshot took",performance.now()-ae,"ms")};try{const P=[],ae=M=>{var X;return E(tf)({mutationCb:gt,mousemoveCb:(T,Sr)=>G({type:N.IncrementalSnapshot,data:{source:Sr,positions:T}}),mouseInteractionCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.MouseInteraction},T)}),scrollCb:Us,viewportResizeCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.ViewportResize},T)}),inputCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.Input},T)}),mediaInteractionCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.MediaInteraction},T)}),styleSheetRuleCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.StyleSheetRule},T)}),styleDeclarationCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.StyleDeclaration},T)}),canvasMutationCb:zs,fontCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.Font},T)}),selectionCb:T=>{G({type:N.IncrementalSnapshot,data:A({source:O.Selection},T)})},customElementCb:T=>{G({type:N.IncrementalSnapshot,data:A({source:O.CustomElement},T)})},blockClass:i,ignoreClass:a,ignoreSelector:l,maskTextClass:o,maskTextSelector:c,maskInputOptions:ge,inlineStylesheet:u,sampling:S,recordDOM:b,recordCanvas:v,inlineImages:Q,userTriggeredOnInput:U,collectFonts:V,doc:M,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:k,blockSelector:n,slimDOMOptions:oe,dataURLOptions:C,mirror:re,iframeManager:Ie,stylesheetManager:ve,shadowDomManager:yt,processedNodeManager:br,canvasManager:Lr,ignoreCSSAttributes:Ge,plugins:((X=ne==null?void 0:ne.filter(T=>T.observer))==null?void 0:X.map(T=>({observer:T.observer,options:T.options,callback:Sr=>G({type:N.Plugin,data:{plugin:T.name,payload:Sr}})})))||[]},f)};Ie.addLoadListener(M=>{try{P.push(ae(M.contentDocument))}catch(X){console.warn(X)}});const ce=()=>{Ht(),P.push(ae(document)),ar=!0};return document.readyState==="interactive"||document.readyState==="complete"?ce():(P.push(Z("DOMContentLoaded",()=>{G({type:N.DomContentLoaded,data:{}}),$==="DOMContentLoaded"&&ce()})),P.push(Z("load",()=>{G({type:N.Load,data:{}}),$==="load"&&ce()},window))),()=>{P.forEach(M=>M()),br.destroy(),ar=!1,Wh()}}catch(P){console.warn(P)}}Se.addCustomEvent=(s,e)=>{if(!ar)throw new Error("please add custom event after start recording");G({type:N.Custom,data:{tag:s,payload:e}})};Se.freezePage=()=>{xe.forEach(s=>s.freeze())};Se.takeFullSnapshot=s=>{if(!ar)throw new Error("please take full snapshot after start recording");Ht(s)};Se.mirror=re;var ji;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(ji||(ji={}));const{addCustomEvent:Xf}=Se,{freezePage:Kf}=Se,{takeFullSnapshot:gf}=Se;exports.record=Se;
|
|
58
|
+
or you can use record.mirror to access the mirror instance during recording.`;let Li={map:{},getId(){return console.error(Ne),-1},getNode(){return console.error(Ne),null},removeNodeFromMap(){console.error(Ne)},has(){return console.error(Ne),!1},reset(){console.error(Ne)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(Li=new Proxy(Li,{get(s,e,t){return e==="map"&&console.error(Ne),Reflect.get(s,e,t)}}));function ut(s,e,t={}){let r=null,i=0;return function(...n){const a=Date.now();!i&&t.leading===!1&&(i=a);const l=e-(a-i),o=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=a,s.apply(o,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(o,n)},l))}}function wr(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(a){setTimeout(()=>{t.set.call(this,a)},0),n&&n.set&&n.set.call(this,a)}}),()=>wr(s,e,n||{},!0)}let nr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(nr=()=>new Date().getTime());function Io(s){var e,t,r,i;const n=s.document;return{left:n.scrollingElement?n.scrollingElement.scrollLeft:s.pageXOffset!==void 0?s.pageXOffset:n.documentElement.scrollLeft||(n==null?void 0:n.body)&&((e=R.parentElement(n.body))==null?void 0:e.scrollLeft)||((t=n==null?void 0:n.body)==null?void 0:t.scrollLeft)||0,top:n.scrollingElement?n.scrollingElement.scrollTop:s.pageYOffset!==void 0?s.pageYOffset:(n==null?void 0:n.documentElement.scrollTop)||(n==null?void 0:n.body)&&((r=R.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function xo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ro(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Oo(s){return s?s.nodeType===s.ELEMENT_NODE?s:R.parentElement(s):null}function J(s,e,t,r){if(!s)return!1;const i=Oo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Xt(i,e,r))return!0}catch(n){}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function kh(s,e){return e.getId(s)!==-1}function Pr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===et}function Mo(s,e){if(Ke(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=R.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Mo(r,e):!0}function fs(s){return!!s.changedTouches}function Ph(s=window){"NodeList"in s&&!s.NodeList.prototype.forEach&&(s.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in s&&!s.DOMTokenList.prototype.forEach&&(s.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Ao(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function Eo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function ps(s){return s?s instanceof Ds&&"shadowRoot"in s?!!s.shadowRoot:!!R.shadowRoot(s):!1}class Lh{constructor(){w(this,"id",1),w(this,"styleIDMap",new WeakMap),w(this,"idStyleMap",new Map)}getId(e){var t;return(t=this.styleIDMap.get(e))!=null?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}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 $o(s){var e;let t=null;return"getRootNode"in s&&((e=R.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&R.host(R.getRootNode(s))&&(t=R.host(R.getRootNode(s))),t}function _h(s){let e=s,t;for(;t=$o(e);)e=t;return e}function Th(s){const e=s.ownerDocument;if(!e)return!1;const t=_h(s);return R.contains(e,t)}function No(s){const e=s.ownerDocument;return e?R.contains(e,s)||Th(s):!1}var N=(s=>(s[s.DomContentLoaded=0]="DomContentLoaded",s[s.Load=1]="Load",s[s.FullSnapshot=2]="FullSnapshot",s[s.IncrementalSnapshot=3]="IncrementalSnapshot",s[s.Meta=4]="Meta",s[s.Custom=5]="Custom",s[s.Plugin=6]="Plugin",s))(N||{}),O=(s=>(s[s.Mutation=0]="Mutation",s[s.MouseMove=1]="MouseMove",s[s.MouseInteraction=2]="MouseInteraction",s[s.Scroll=3]="Scroll",s[s.ViewportResize=4]="ViewportResize",s[s.Input=5]="Input",s[s.TouchMove=6]="TouchMove",s[s.MediaInteraction=7]="MediaInteraction",s[s.StyleSheetRule=8]="StyleSheetRule",s[s.CanvasMutation=9]="CanvasMutation",s[s.Font=10]="Font",s[s.Log=11]="Log",s[s.Drag=12]="Drag",s[s.StyleDeclaration=13]="StyleDeclaration",s[s.Selection=14]="Selection",s[s.AdoptedStyleSheet=15]="AdoptedStyleSheet",s[s.CustomElement=16]="CustomElement",s))(O||{}),K=(s=>(s[s.MouseUp=0]="MouseUp",s[s.MouseDown=1]="MouseDown",s[s.Click=2]="Click",s[s.ContextMenu=3]="ContextMenu",s[s.DblClick=4]="DblClick",s[s.Focus=5]="Focus",s[s.Blur=6]="Blur",s[s.TouchStart=7]="TouchStart",s[s.TouchMove_Departed=8]="TouchMove_Departed",s[s.TouchEnd=9]="TouchEnd",s[s.TouchCancel=10]="TouchCancel",s))(K||{}),pe=(s=>(s[s.Mouse=0]="Mouse",s[s.Pen=1]="Pen",s[s.Touch=2]="Touch",s))(pe||{}),We=(s=>(s[s["2D"]=0]="2D",s[s.WebGL=1]="WebGL",s[s.WebGL2=2]="WebGL2",s))(We||{}),ke=(s=>(s[s.Play=0]="Play",s[s.Pause=1]="Pause",s[s.Seeked=2]="Seeked",s[s.VolumeChange=3]="VolumeChange",s[s.RateChange=4]="RateChange",s))(ke||{}),ko=(s=>(s[s.Document=0]="Document",s[s.DocumentType=1]="DocumentType",s[s.Element=2]="Element",s[s.Text=3]="Text",s[s.CDATA=4]="CDATA",s[s.Comment=5]="Comment",s))(ko||{});function _i(s){return"__ln"in s}class Dh{constructor(){w(this,"length",0),w(this,"head",null),w(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)t=(t==null?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&_i(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&_i(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;t.next===null&&(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 Ti=(s,e)=>`${s}@${e}`;function Fh(s=8){for(var e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length,i=0;i<s;i++)e+=t.charAt(Math.floor(Math.random()*r));return e}class Bh{constructor(){w(this,"frozen",!1),w(this,"locked",!1),w(this,"texts",[]),w(this,"attributes",[]),w(this,"attributeMap",new WeakMap),w(this,"removes",[]),w(this,"mapRemoves",[]),w(this,"movedMap",{}),w(this,"addedSet",new Set),w(this,"movedSet",new Set),w(this,"droppedSet",new Set),w(this,"removesSubTreeCache",new Set),w(this,"mutationCb"),w(this,"blockClass"),w(this,"blockSelector"),w(this,"maskTextClass"),w(this,"maskTextSelector"),w(this,"inlineStylesheet"),w(this,"maskInputOptions"),w(this,"maskTextFn"),w(this,"maskInputFn"),w(this,"keepIframeSrcFn"),w(this,"recordCanvas"),w(this,"inlineImages"),w(this,"slimDOMOptions"),w(this,"dataURLOptions"),w(this,"doc"),w(this,"mirror"),w(this,"iframeManager"),w(this,"stylesheetManager"),w(this,"shadowDomManager"),w(this,"canvasManager"),w(this,"processedNodeManager"),w(this,"unattachedDoc"),w(this,"myId",Fh()),w(this,"stormBatches",[]),w(this,"stormInfo"),w(this,"stormSettings",{batchSize:300,timeout:50,mutationLimit:1500}),w(this,"handleStormMutations",e=>{const t=Date.now();this.stormInfo==null&&(console.log("detected probable mutation storm start","buffer id:",this.myId),this.stormInfo={startedAt:t,totalMutations:0,timeout:setTimeout(this.handleStormFinish,this.stormSettings.timeout),stormExceededLimit:!1}),this.stormInfo.totalMutations+=e.length,console.log("current storm mutations",this.stormInfo.totalMutations,"buffer id:",this.myId),this.stormInfo.totalMutations>=this.stormSettings.mutationLimit?(this.stormInfo.stormExceededLimit=!0,this.stormBatches=[]):this.stormBatches.push({ts:t,mutations:e}),e.length<this.stormSettings.batchSize&&(clearTimeout(this.stormInfo.timeout),this.handleStormFinish())}),w(this,"handleStormFinish",()=>{if(!this.stormInfo)return;const{stormExceededLimit:e}=this.stormInfo;if(console.log("mutation storm finished","totalMutations:",this.stormInfo.totalMutations,"stormExceededLimit:",e,"storm duration:",Date.now()-this.stormInfo.startedAt,"ms","buffer id:",this.myId),clearTimeout(this.stormInfo.timeout),this.stormInfo=null,e)this.stormBatches=[],yf();else{let t=[];for(const r of this.stormBatches)t.push(...r.mutations);this.stormBatches=[],this.processInternalMutations(t,!0)}}),w(this,"processInternalMutations",(e,t=!1)=>{if(!t&&(this.stormInfo!=null||e.length>=this.stormSettings.batchSize)){this.handleStormMutations(e);return}const r=performance.now();for(const i of e)this.processMutation(i);console.log(e.length,"mutations processed in",performance.now()-r,"ms","overrideStorm",t,"buffer id:",this.myId),this.emit()}),w(this,"processMutations",e=>{this.processInternalMutations(e)}),w(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Dh,i=u=>{let h=u,p=et;for(;p===et;)h=h&&h.nextSibling,p=h&&this.mirror.getId(h);return p},n=u=>{const h=R.parentNode(u);if(!h||!No(u))return;let p=!1;if(u.nodeType===Node.TEXT_NODE){const f=h.tagName;if(f==="TEXTAREA")return;f==="STYLE"&&this.addedSet.has(h)&&(p=!0)}const d=Ke(h)?this.mirror.getId($o(u)):this.mirror.getId(h),g=i(u);if(d===-1||g===-1)return r.addNode(u);const m=Le(u,{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:f=>{Ao(f,this.mirror)&&this.iframeManager.addIframe(f),Eo(f,this.mirror)&&this.stylesheetManager.trackLinkElement(f),ps(u)&&this.shadowDomManager.addShadowRoot(R.shadowRoot(u),this.doc)},onIframeLoad:(f,y)=>{this.iframeManager.attachIframe(f,y),this.shadowDomManager.observeAttachShadow(f)},onStylesheetLoad:(f,y)=>{this.stylesheetManager.attachLinkElement(f,y)},cssCaptured:p});m&&(e.push({parentId:d,nextId:g,node:m}),t.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const u of this.movedSet)Di(this.removesSubTreeCache,u,this.mirror)&&!this.movedSet.has(R.parentNode(u))||n(u);for(const u of this.addedSet)!Fi(this.droppedSet,u)&&!Di(this.removesSubTreeCache,u,this.mirror)||Fi(this.movedSet,u)?n(u):this.droppedSet.add(u);let a=null;for(;r.length;){let u=null;if(a){const h=this.mirror.getId(R.parentNode(a.value)),p=i(a.value);h!==-1&&p!==-1&&(u=a)}if(!u){let h=r.tail;for(;h;){const p=h;if(h=h.previous,p){const d=this.mirror.getId(R.parentNode(p.value));if(i(p.value)===-1)continue;if(d!==-1){u=p;break}else{const m=p.value,f=R.parentNode(m);if(f&&f.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const y=R.host(f);if(this.mirror.getId(y)!==-1){u=p;break}}}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}a=u.previous,r.removeNode(u.value),n(u.value)}const l=[];for(const u of this.texts){const h=u.node,p=R.parentNode(h);p&&p.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(p);const d=this.mirror.getId(h);!t.has(d)&&this.mirror.has(d)&&l.push({id:d,value:u.value})}const o=[];for(const u of this.attributes){const{attributes:h}=u;if(typeof h.style=="string"){const d=JSON.stringify(u.styleDiff),g=JSON.stringify(u._unchangedStyles);d.length<h.style.length&&(d+g).split("var(").length===h.style.split("var(").length&&(h.style=u.styleDiff)}const p=this.mirror.getId(u.node);!t.has(p)&&this.mirror.has(p)&&o.push({id:p,attributes:h})}const c={texts:l,attributes:o,removes:this.removes,adds:e};!c.texts.length&&!c.attributes.length&&!c.removes.length&&!c.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(c))}),w(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 r=Array.from(R.childNodes(e),i=>R.textContent(i)||"").join("");t.attributes.value=Yt({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:Zt(e),value:r,maskInputFn:this.maskInputFn})}),w(this,"processMutation",e=>{if(!Pr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=R.textContent(e.target);!J(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:en(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Oo(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if(r==="value"){const a=Zt(t);i=Yt({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:a,value:i,maskInputFn:this.maskInputFn})}if(J(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let n=this.attributeMap.get(e.target);if(t.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(i))if(!t.contentDocument)r="rr_src";else return;if(n||(n={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(n),this.attributeMap.set(e.target,n)),r==="type"&&t.tagName==="INPUT"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!qi(t.tagName,r))if(n.attributes[r]=Qi(this.doc,Re(t.tagName),Re(r),i),r==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(l){this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const o=t.style.getPropertyValue(l),c=t.style.getPropertyPriority(l);o!==a.style.getPropertyValue(l)||c!==a.style.getPropertyPriority(l)?c===""?n.styleDiff[l]=o:n.styleDiff[l]=[o,c]:n._unchangedStyles[l]=[o,c]}for(const l of Array.from(a.style))t.style.getPropertyValue(l)===""&&(n.styleDiff[l]=!1)}else r==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?n.attributes.rr_open_mode="modal":n.attributes.rr_open_mode="non-modal");break}case"childList":{if(J(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}for(let a=0;a<e.addedNodes.length;a++)this.genAdds(e.addedNodes[a],e.target);const t=Ke(e.target)?this.mirror.getId(R.host(e.target)):this.mirror.getId(e.target);if(J(e.target,this.blockClass,this.blockSelector,!1))return;const r=this.addedSet.has(e.target),i=Mo(e.target,this.mirror),n=Ke(e.target)&&Qe(e.target)?!0:void 0;for(let a=0;a<e.removedNodes.length;a++){const l=e.removedNodes[a],o=this.mirror.getId(l);if(Pr(l,this.mirror,this.slimDOMOptions)||!kh(l,this.mirror))return;this.addedSet.has(l)?(ds(this.addedSet,l),this.droppedSet.add(l)):r&&o===-1||i||(this.movedSet.has(l)&&this.movedMap[Ti(o,t)]?ds(this.movedSet,l):(this.removes.push({parentId:t,id:o,isShadow:n}),Uh(l,this.removesSubTreeCache))),this.mapRemoves.push(l)}break}}}),w(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Pr(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[Ti(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!J(e,this.blockClass,this.blockSelector,!1)){const r=R.childNodes(e);for(let i=0;i<r.length;i++)this.genAdds(r[i]);if(ps(e)){const i=R.childNodes(R.shadowRoot(e));for(let n=0;n<i.length;n++){const a=i[n];this.processedNodeManager.add(a,this),this.genAdds(a,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 ds(s,e){s.delete(e);const t=R.childNodes(e);for(let r=0;r<t.length;r++)ds(s,t[r])}function Uh(s,e){const t=[s];for(;t.length;){const r=t.pop();if(e.has(r))continue;e.add(r);const i=R.childNodes(r);for(let n=0;n<i.length;n++)t.push(i[n])}}function Di(s,e,t){return s.size===0?!1:zh(s,e)}function zh(s,e,t){const r=R.parentNode(e);return r?s.has(r):!1}function Fi(s,e){return s.size===0?!1:Po(s,e)}function Po(s,e){const t=R.parentNode(e);return t?s.has(t)?!0:Po(s,t):!1}let qe;function Wh(s){qe=s}function Gh(){qe=void 0}const E=s=>qe?(...t)=>{try{return s(...t)}catch(r){if(qe&&qe(r)===!0)return;throw r}}:s,xe=[];function dt(s){try{if("composedPath"in s){const e=s.composedPath();if(e.length)return e[0]}else if("path"in s&&s.path.length)return s.path[0]}catch(e){}return s&&s.target}function Lo(s,e){const t=new Bh;xe.push(t),t.init(s);const r=new(vo())(E(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Vh({mousemoveCb:s,sampling:e,doc:t,mirror:r}){if(e.mousemove===!1)return()=>{};const i=typeof e.mousemove=="number"?e.mousemove:50,n=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let a=[],l;const o=ut(E(h=>{const p=Date.now()-l;s(a.map(d=>(d.timeOffset-=p,d)),h),a=[],l=null}),n),c=E(ut(E(h=>{const p=dt(h),{clientX:d,clientY:g}=fs(h)?h.changedTouches[0]:h;l||(l=nr()),a.push({x:d,y:g,id:r.getId(p),timeOffset:nr()-l}),o(typeof DragEvent!="undefined"&&h instanceof DragEvent?O.Drag:h instanceof MouseEvent?O.MouseMove:O.TouchMove)}),i,{trailing:!1})),u=[Z("mousemove",c,t),Z("touchmove",c,t),Z("drag",c,t)];return E(()=>{u.forEach(h=>h())})}function jh({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const a=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let o=null;const c=u=>h=>{const p=dt(h);if(J(p,r,i,!0))return;let d=null,g=u;if("pointerType"in h){switch(h.pointerType){case"mouse":d=pe.Mouse;break;case"touch":d=pe.Touch;break;case"pen":d=pe.Pen;break}d===pe.Touch?K[u]===K.MouseDown?g="TouchStart":K[u]===K.MouseUp&&(g="TouchEnd"):pe.Pen}else fs(h)&&(d=pe.Touch);d!==null?(o=d,(g.startsWith("Touch")&&d===pe.Touch||g.startsWith("Mouse")&&d===pe.Mouse)&&(d=null)):K[u]===K.Click&&(d=o,o=null);const m=fs(h)?h.changedTouches[0]:h;if(!m)return;const f=t.getId(p),{clientX:y,clientY:S}=m;E(s)(A({type:K[g],id:f,x:y,y:S},d!==null&&{pointerType:d}))};return Object.keys(K).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{let h=Re(u);const p=c(u);if(window.PointerEvent)switch(K[u]){case K.MouseDown:case K.MouseUp:h=h.replace("mouse","pointer");break;case K.TouchStart:case K.TouchEnd:return}l.push(Z(h,p,e))}),E(()=>{l.forEach(u=>u())})}function _o({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const a=E(ut(E(l=>{const o=dt(l);if(!o||J(o,r,i,!0))return;const c=t.getId(o);if(o===e&&e.defaultView){const u=Io(e.defaultView);s({id:c,x:u.left,y:u.top})}else s({id:c,x:o.scrollLeft,y:o.scrollTop})}),n.scroll||100));return Z("scroll",a,e)}function Hh({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=E(ut(E(()=>{const n=xo(),a=Ro();(t!==n||r!==a)&&(s({width:Number(a),height:Number(n)}),t=n,r=a)}),200));return Z("resize",i,e)}const Yh=["INPUT","TEXTAREA","SELECT"],Bi=new WeakMap;function Zh({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:a,maskInputOptions:l,maskInputFn:o,sampling:c,userTriggeredOnInput:u}){function h(S){let C=dt(S);const D=S.isTrusted,b=C&&C.tagName;if(C&&b==="OPTION"&&(C=R.parentElement(C)),!C||!b||Yh.indexOf(b)<0||J(C,r,i,!0)||C.classList.contains(n)||a&&C.matches(a))return;let v=C.value,F=!1;const $=Zt(C)||"";$==="radio"||$==="checkbox"?F=C.checked:(l[b.toLowerCase()]||l[$])&&(v=Yt({element:C,maskInputOptions:l,tagName:b,type:$,value:v,maskInputFn:o})),p(C,u?{text:v,isChecked:F,userTriggered:D}:{text:v,isChecked:F});const U=C.name;$==="radio"&&U&&F&&e.querySelectorAll(`input[type="radio"][name="${U}"]`).forEach(V=>{if(V!==C){const Q=V.value;p(V,u?{text:Q,isChecked:!F,userTriggered:!1}:{text:Q,isChecked:!F})}})}function p(S,C){const D=Bi.get(S);if(!D||D.text!==C.text||D.isChecked!==C.isChecked){Bi.set(S,C);const b=t.getId(S);E(s)(ee(A({},C),{id:b}))}}const g=(c.input==="last"?["change"]:["input","change"]).map(S=>Z(S,E(h),e)),m=e.defaultView;if(!m)return()=>{g.forEach(S=>S())};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&&g.push(...y.map(S=>wr(S[0],S[1],{set(){E(h)({target:this,isTrusted:!1})}},!1,m))),E(()=>{g.forEach(S=>S())})}function or(s){const e=[];function t(r,i){if(Ft("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ft("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ft("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ft("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(a)}return i}return t(s,e)}function ye(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function Jh({styleSheetRuleCb:s,mirror:e,stylesheetManager:t},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:E((u,h,p)=>{const[d,g]=p,{id:m,styleId:f}=ye(h,e,t.styleMirror);return(m&&m!==-1||f&&f!==-1)&&s({id:m,styleId:f,adds:[{rule:d,index:g}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,p=this.cssRules.length){const d=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[d,p])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:E((u,h,p)=>{const[d]=p,{id:g,styleId:m}=ye(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,removes:[{index:d}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:E((u,h,p)=>{const[d]=p,{id:g,styleId:m}=ye(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replace:d}),u.apply(h,p)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:E((u,h,p)=>{const[d]=p,{id:g,styleId:m}=ye(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replaceSync:d}),u.apply(h,p)})}));const o={};Bt("CSSGroupingRule")?o.CSSGroupingRule=r.CSSGroupingRule:(Bt("CSSMediaRule")&&(o.CSSMediaRule=r.CSSMediaRule),Bt("CSSConditionRule")&&(o.CSSConditionRule=r.CSSConditionRule),Bt("CSSSupportsRule")&&(o.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(o).forEach(([u,h])=>{c[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(c[u].insertRule,{apply:E((p,d,g)=>{const[m,f]=g,{id:y,styleId:S}=ye(d.parentStyleSheet,e,t.styleMirror);return(y&&y!==-1||S&&S!==-1)&&s({id:y,styleId:S,adds:[{rule:m,index:[...or(d),f||0]}]}),p.apply(d,g)})}),h.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:E((p,d,g)=>{const[m]=g,{id:f,styleId:y}=ye(d.parentStyleSheet,e,t.styleMirror);return(f&&f!==-1||y&&y!==-1)&&s({id:f,styleId:y,removes:[{index:[...or(d),m]}]}),p.apply(d,g)})})}),E(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,a&&(r.CSSStyleSheet.prototype.replace=a),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(o).forEach(([u,h])=>{h.prototype.insertRule=c[u].insertRule,h.prototype.deleteRule=c[u].deleteRule})})}function To({mirror:s,stylesheetManager:e},t){var r,i,n;let a=null;t.nodeName==="#document"?a=s.getId(t):a=s.getId(R.host(t));const l=t.nodeName==="#document"?(r=t.defaultView)==null?void 0:r.Document:(n=(i=t.ownerDocument)==null?void 0:i.defaultView)==null?void 0:n.ShadowRoot,o=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return a===null||a===-1||!l||!o?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:o.configurable,enumerable:o.enumerable,get(){var c;return(c=o.get)==null?void 0:c.call(this)},set(c){var u;const h=(u=o.set)==null?void 0:u.call(this,c);if(a!==null&&a!==-1)try{e.adoptStyleSheets(c,a)}catch(p){}return h}}),E(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:o.configurable,enumerable:o.enumerable,get:o.get,set:o.set})}))}function Xh({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:E((l,o,c)=>{var u;const[h,p,d]=c;if(t.has(h))return n.apply(o,[h,p,d]);const{id:g,styleId:m}=ye((u=o.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,set:{property:h,value:p,priority:d},index:or(o.parentRule)}),l.apply(o,c)})});const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:E((l,o,c)=>{var u;const[h]=c;if(t.has(h))return a.apply(o,[h]);const{id:p,styleId:d}=ye((u=o.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||d&&d!==-1)&&s({id:p,styleId:d,remove:{property:h},index:or(o.parentRule)}),l.apply(o,c)})}),E(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=a})}function Kh({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const a=E(o=>ut(E(c=>{const u=dt(c);if(!u||J(u,e,t,!0))return;const{currentTime:h,volume:p,muted:d,playbackRate:g,loop:m}=u;s({type:o,id:r.getId(u),currentTime:h,volume:p,muted:d,playbackRate:g,loop:m})}),i.media||500)),l=[Z("play",a(ke.Play),n),Z("pause",a(ke.Pause),n),Z("seeked",a(ke.Seeked),n),Z("volumechange",a(ke.VolumeChange),n),Z("ratechange",a(ke.RateChange),n)];return E(()=>{l.forEach(o=>o())})}function Qh({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(o,c,u){const h=new n(o,c,u);return i.set(h,{family:o,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};const a=Ae(e.fonts,"add",function(l){return function(o){return setTimeout(E(()=>{const c=i.get(o);c&&(s(c),i.delete(o))}),0),l.apply(this,[o])}});return r.push(()=>{t.FontFace=n}),r.push(a),E(()=>{r.forEach(l=>l())})}function qh(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let a=!0;const l=E(()=>{const o=e.getSelection();if(!o||a&&(o!=null&&o.isCollapsed))return;a=o.isCollapsed||!1;const c=[],u=o.rangeCount||0;for(let h=0;h<u;h++){const p=o.getRangeAt(h),{startContainer:d,startOffset:g,endContainer:m,endOffset:f}=p;J(d,r,i,!0)||J(m,r,i,!0)||c.push({start:t.getId(d),startOffset:g,end:t.getId(m),endOffset:f})}n({ranges:c})});return l(),Z("selectionchange",l)}function ef({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:Ae(t.customElements,"define",function(i){return function(n,a,l){try{e({define:{name:n}})}catch(o){console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,a,l])}})}function tf(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:a,inputCb:l,mediaInteractionCb:o,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:h,fontCb:p,selectionCb:d,customElementCb:g}=s;s.mutationCb=(...m)=>{e.mutation&&e.mutation(...m),t(...m)},s.mousemoveCb=(...m)=>{e.mousemove&&e.mousemove(...m),r(...m)},s.mouseInteractionCb=(...m)=>{e.mouseInteraction&&e.mouseInteraction(...m),i(...m)},s.scrollCb=(...m)=>{e.scroll&&e.scroll(...m),n(...m)},s.viewportResizeCb=(...m)=>{e.viewportResize&&e.viewportResize(...m),a(...m)},s.inputCb=(...m)=>{e.input&&e.input(...m),l(...m)},s.mediaInteractionCb=(...m)=>{e.mediaInteaction&&e.mediaInteaction(...m),o(...m)},s.styleSheetRuleCb=(...m)=>{e.styleSheetRule&&e.styleSheetRule(...m),c(...m)},s.styleDeclarationCb=(...m)=>{e.styleDeclaration&&e.styleDeclaration(...m),u(...m)},s.canvasMutationCb=(...m)=>{e.canvasMutation&&e.canvasMutation(...m),h(...m)},s.fontCb=(...m)=>{e.font&&e.font(...m),p(...m)},s.selectionCb=(...m)=>{e.selection&&e.selection(...m),d(...m)},s.customElementCb=(...m)=>{e.customElement&&e.customElement(...m),g(...m)}}function rf(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};tf(s,e);let r;s.recordDOM&&(r=Lo(s,s.doc));const i=Vh(s),n=jh(s),a=_o(s),l=Hh(s,{win:t}),o=Zh(s),c=Kh(s);let u=()=>{},h=()=>{},p=()=>{},d=()=>{};s.recordDOM&&(u=Jh(s,{win:t}),h=To(s,s.doc),p=Xh(s,{win:t}),s.collectFonts&&(d=Qh(s)));const g=qh(s),m=ef(s),f=[];for(const y of s.plugins)f.push(y.observer(y.callback,t,y.options));return E(()=>{xe.forEach(y=>y.reset()),r==null||r.disconnect(),i(),n(),a(),l(),o(),c(),u(),h(),p(),d(),g(),m(),f.forEach(y=>y())})}function Ft(s){return typeof window[s]!="undefined"}function Bt(s){return!!(typeof window[s]!="undefined"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}class Ui{constructor(e){w(this,"iframeIdToRemoteIdMap",new WeakMap),w(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),a.set(l,t)),l}getIds(e,t){const r=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map(n=>this.getId(e,n,r,i))}getRemoteId(e,t,r){const i=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;const n=i.get(t);return n||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(i=>this.getRemoteId(e,i,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}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 sf{constructor(e){w(this,"iframes",new WeakMap),w(this,"crossOriginIframeMap",new WeakMap),w(this,"crossOriginIframeMirror",new Ui(Ki)),w(this,"crossOriginIframeStyleMirror"),w(this,"crossOriginIframeRootIdMap",new WeakMap),w(this,"mirror"),w(this,"mutationCb"),w(this,"wrappedEmit"),w(this,"loadListener"),w(this,"stylesheetManager"),w(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ui(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 r,i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((r=e.contentWindow)==null||r.addEventListener("message",this.handleMessage.bind(this))),(i=this.loadListener)==null||i.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(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const n=this.transformCrossOriginEvent(i,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case N.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const i=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(t.data.node,i),{timestamp:t.timestamp,type:N.IncrementalSnapshot,data:{source:O.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case N.Meta:case N.Load:case N.DomContentLoaded:return!1;case N.Plugin:return t;case N.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case N.IncrementalSnapshot:switch(t.data.source){case O.Mutation:return t.data.adds.forEach(i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(i.node,n)}),t.data.removes.forEach(i=>{this.replaceIds(i,e,["parentId","id"])}),t.data.attributes.forEach(i=>{this.replaceIds(i,e,["id"])}),t.data.texts.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case O.Drag:case O.TouchMove:case O.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,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(i=>{this.replaceIds(i,e,["start","end"])}),t;case O.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),(r=t.data.styles)==null||r.forEach(i=>{this.replaceStyleIds(i,e,["styleId"])}),t}}return!1}replace(e,t,r,i){for(const n of i)!Array.isArray(t[n])&&typeof t[n]!="number"||(Array.isArray(t[n])?t[n]=e.getIds(r,t[n]):t[n]=e.getId(r,t[n]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==ko.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}class nf{constructor(e){w(this,"shadowDoms",new WeakSet),w(this,"mutationCb"),w(this,"scrollCb"),w(this,"bypassOptions"),w(this,"mirror"),w(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(!Qe(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=Lo(ee(A({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(_o(ee(A({},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(R.host(e))),this.restoreHandlers.push(To({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 r=this;this.restoreHandlers.push(Ae(e.prototype,"attachShadow",function(i){return function(n){const a=i.call(this,n),l=R.shadowRoot(this);return l&&No(this)&&r.addShadowRoot(l,t),a}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}var _e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",of=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var Ut=0;Ut<_e.length;Ut++)of[_e.charCodeAt(Ut)]=Ut;var af=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=_e[e[t]>>2],i+=_e[(e[t]&3)<<4|e[t+1]>>4],i+=_e[(e[t+1]&15)<<2|e[t+2]>>6],i+=_e[e[t+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const zi=new Map;function lf(s,e){let t=zi.get(s);return t||(t=new Map,zi.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const Do=(s,e,t)=>{if(!s||!(Bo(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=lf(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function jt(s,e,t){if(s instanceof Array)return s.map(r=>jt(r,e,t));if(s===null)return s;if(s instanceof Float32Array||s instanceof Float64Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Uint8Array||s instanceof Uint16Array||s instanceof Int16Array||s instanceof Int8Array||s instanceof Uint8ClampedArray)return{rr_type:s.constructor.name,args:[Object.values(s)]};if(s instanceof ArrayBuffer){const r=s.constructor.name,i=af(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[jt(s.buffer,e,t),s.byteOffset,s.byteLength]};if(s instanceof HTMLImageElement){const r=s.constructor.name,{src:i}=s;return{rr_type:r,src:i}}else if(s instanceof HTMLCanvasElement){const r="HTMLImageElement",i=s.toDataURL();return{rr_type:r,src:i}}else{if(s instanceof ImageData)return{rr_type:s.constructor.name,args:[jt(s.data,e,t),s.width,s.height]};if(Bo(s,e)||typeof s=="object"){const r=s.constructor.name,i=Do(s,e,t);return{rr_type:r,index:i}}}}return s}const Fo=(s,e,t)=>s.map(r=>jt(r,e,t)),Bo=(s,e)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof e[i]=="function").find(i=>s instanceof e[i]);function uf(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of n)try{if(typeof e.CanvasRenderingContext2D.prototype[a]!="function")continue;const l=Ae(e.CanvasRenderingContext2D.prototype,a,function(o){return function(...c){return J(this.canvas,t,r,!0)||setTimeout(()=>{const u=Fo(c,e,this);s(this.canvas,{type:We["2D"],property:a,args:u})},0),o.apply(this,c)}});i.push(l)}catch(l){const o=wr(e.CanvasRenderingContext2D.prototype,a,{set(c){s(this.canvas,{type:We["2D"],property:a,args:[c],setter:!0})}});i.push(o)}return()=>{i.forEach(a=>a())}}function cf(s){return s==="experimental-webgl"?"webgl":s}function Wi(s,e,t,r){const i=[];try{const n=Ae(s.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...o){if(!J(this,e,t,!0)){const c=cf(l);if("__context"in this||(this.__context=c),r&&["webgl","webgl2"].includes(c))if(o[0]&&typeof o[0]=="object"){const u=o[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...o])}});i.push(n)}catch(n){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function Gi(s,e,t,r,i,n){const a=[],l=Object.getOwnPropertyNames(s);for(const o of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(o))try{if(typeof s[o]!="function")continue;const c=Ae(s,o,function(u){return function(...h){const p=u.apply(this,h);if(Do(p,n,this),"tagName"in this.canvas&&!J(this.canvas,r,i,!0)){const d=Fo(h,n,this),g={type:e,property:o,args:d};t(this.canvas,g)}return p}});a.push(c)}catch(c){const u=wr(s,o,{set(h){t(this.canvas,{type:e,property:o,args:[h],setter:!0})}});a.push(u)}return a}function hf(s,e,t,r){const i=[];return i.push(...Gi(e.WebGLRenderingContext.prototype,We.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext!="undefined"&&i.push(...Gi(e.WebGL2RenderingContext.prototype,We.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const Uo="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",ff=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),Vi=typeof self!="undefined"&&self.Blob&&new Blob([ff(Uo)],{type:"text/javascript;charset=utf-8"});function pf(s){let e;try{if(e=Vi&&(self.URL||self.webkitURL).createObjectURL(Vi),!e)throw"";const t=new Worker(e,{name:s==null?void 0:s.name});return t.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),t}catch(t){return new Worker("data:text/javascript;base64,"+Uo,{name:s==null?void 0:s.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class df{constructor(e){w(this,"pendingCanvasMutations",new Map),w(this,"rafStamps",{latestId:0,invokeId:null}),w(this,"mirror"),w(this,"mutationCb"),w(this,"resetObservers"),w(this,"frozen",!1),w(this,"locked",!1),w(this,"processMutation",(o,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(o)||this.pendingCanvasMutations.set(o,[]),this.pendingCanvasMutations.get(o).push(c)});const{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:a,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&t==="all"&&this.initCanvasMutationObserver(r,i,n),a&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,i,n,{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(e,t,r,i,n){const a=Wi(t,r,i,!0),l=new Map,o=new pf;o.onmessage=g=>{const{id:m}=g.data;if(l.set(m,!1),!("base64"in g.data))return;const{base64:f,type:y,width:S,height:C}=g.data;this.mutationCb({id:m,type:We["2D"],commands:[{property:"clearRect",args:[0,0,S,C]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:y}]},0,0]}]})};const c=1e3/e;let u=0,h;const p=()=>{const g=[];return t.document.querySelectorAll("canvas").forEach(m=>{J(m,r,i,!0)||g.push(m)}),g},d=g=>{if(u&&g-u<c){h=requestAnimationFrame(d);return}u=g,p().forEach(async m=>{var f;const y=this.mirror.getId(m);if(l.get(y)||m.width===0||m.height===0)return;if(l.set(y,!0),["webgl","webgl2"].includes(m.__context)){const C=m.getContext(m.__context);((f=C==null?void 0:C.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&C.clear(C.COLOR_BUFFER_BIT)}const S=await createImageBitmap(m);o.postMessage({id:y,bitmap:S,width:m.width,height:m.height,dataURLOptions:n.dataURLOptions},[S])}),h=requestAnimationFrame(d)};h=requestAnimationFrame(d),this.resetObservers=()=>{a(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=Wi(e,t,r,!1),n=uf(this.processMutation.bind(this),e,t,r),a=hf(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{const r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;const i=r.map(a=>{const c=a,{type:l}=c;return Ee(c,["type"])}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class mf{constructor(e){w(this,"trackedLinkElements",new WeakSet),w(this,"mutationCb"),w(this,"adoptedStyleSheetCb"),w(this,"styleMirror",new Lh),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(e.length===0)return;const r={id:t,styleIds:[]},i=[];for(const n of e){let a;this.styleMirror.has(n)?a=this.styleMirror.getId(n):(a=this.styleMirror.add(n),i.push({styleId:a,rules:Array.from(n.rules||CSSRule,(l,o)=>({rule:Zi(l,n.href),index:o}))})),r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class gf{constructor(){w(this,"nodeMap",new WeakMap),w(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).some(i=>i!==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 G,Ht,Lr,ar=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((js=s.contentWindow)==null?void 0:js.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){console.debug("Unable to override Array.from",s)}const re=da();function Se(s={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:o="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:h,maskInputOptions:p,slimDOMOptions:d,maskInputFn:g,maskTextFn:m,hooks:f,packFn:y,sampling:S={},dataURLOptions:C={},mousemoveWait:D,recordDOM:b=!0,recordCanvas:v=!1,recordCrossOriginIframes:F=!1,recordAfter:$=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:U=!1,collectFonts:V=!1,inlineImages:Q=!1,plugins:ne,keepIframeSrcFn:k=()=>!1,ignoreCSSAttributes:Ge=new Set([]),errorHandler:Ve}=s;Wh(Ve);const j=F?window.parent===window:!0;let q=!1;if(!j)try{window.parent.document&&(q=!1)}catch(P){q=!0}if(j&&!e)throw new Error("emit function is required");if(!j&&!q)return()=>{};D!==void 0&&S.mousemove===void 0&&(S.mousemove=D),re.reset();const ge=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},oe=d===!0||d==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:d==="all",headMetaDescKeywords:d==="all",headTitleMutations:d==="all"}:d||{};Ph();let mt,Ce=0;const Bs=P=>{for(const ae of ne||[])ae.eventProcessor&&(P=ae.eventProcessor(P));return y&&!q&&(P=y(P)),P};G=(P,ae)=>{var ce;const M=P;if(M.timestamp=nr(),(ce=xe[0])!=null&&ce.isFrozen()&&M.type!==N.FullSnapshot&&!(M.type===N.IncrementalSnapshot&&M.data.source===O.Mutation)&&xe.forEach(X=>X.unfreeze()),j)e==null||e(Bs(M),ae);else if(q){const X={type:"rrweb",event:Bs(M),origin:window.location.origin,isCheckout:ae};window.parent.postMessage(X,"*")}if(M.type===N.FullSnapshot)mt=M,Ce=0;else if(M.type===N.IncrementalSnapshot){if(M.data.source===O.Mutation&&M.data.isAttachIframe)return;Ce++;const X=r&&Ce>=r,T=t&&M.timestamp-mt.timestamp>t;(X||T)&&Ht(!0)}};const gt=P=>{G({type:N.IncrementalSnapshot,data:A({source:O.Mutation},P)})},Us=P=>G({type:N.IncrementalSnapshot,data:A({source:O.Scroll},P)}),zs=P=>G({type:N.IncrementalSnapshot,data:A({source:O.CanvasMutation},P)}),zo=P=>G({type:N.IncrementalSnapshot,data:A({source:O.AdoptedStyleSheet},P)}),ve=new mf({mutationCb:gt,adoptedStyleSheetCb:zo}),Ie=new sf({mirror:re,mutationCb:gt,stylesheetManager:ve,recordCrossOriginIframes:F,wrappedEmit:G});for(const P of ne||[])P.getMirror&&P.getMirror({nodeMirror:re,crossOriginIframeMirror:Ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:Ie.crossOriginIframeStyleMirror});const br=new gf;Lr=new df({recordCanvas:v,mutationCb:zs,win:window,blockClass:i,blockSelector:n,mirror:re,sampling:S.canvas,dataURLOptions:C});const yt=new nf({mutationCb:gt,scrollCb:Us,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:ge,dataURLOptions:C,maskTextFn:m,maskInputFn:g,recordCanvas:v,inlineImages:Q,sampling:S,slimDOMOptions:oe,iframeManager:Ie,stylesheetManager:ve,canvasManager:Lr,keepIframeSrcFn:k,processedNodeManager:br},mirror:re});Ht=(P=!1)=>{if(!b)return;const ae=performance.now();G({type:N.Meta,data:{href:window.location.href,width:Ro(),height:xo()}},P),ve.reset(),yt.init(),xe.forEach(M=>M.lock());const ce=za(document,{mirror:re,blockClass:i,blockSelector:n,maskTextClass:o,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:ge,maskTextFn:m,maskInputFn:g,slimDOM:oe,dataURLOptions:C,recordCanvas:v,inlineImages:Q,onSerialize:M=>{Ao(M,re)&&Ie.addIframe(M),Eo(M,re)&&ve.trackLinkElement(M),ps(M)&&yt.addShadowRoot(R.shadowRoot(M),document)},onIframeLoad:(M,X)=>{Ie.attachIframe(M,X),yt.observeAttachShadow(M)},onStylesheetLoad:(M,X)=>{ve.attachLinkElement(M,X)},keepIframeSrcFn:k});if(!ce)return console.warn("Failed to snapshot the document");G({type:N.FullSnapshot,data:{node:ce,initialOffset:Io(window)}},P),xe.forEach(M=>M.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ve.adoptStyleSheets(document.adoptedStyleSheets,re.getId(document)),console.log("full snapshot took",performance.now()-ae,"ms")};try{const P=[],ae=M=>{var X;return E(rf)({mutationCb:gt,mousemoveCb:(T,Sr)=>G({type:N.IncrementalSnapshot,data:{source:Sr,positions:T}}),mouseInteractionCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.MouseInteraction},T)}),scrollCb:Us,viewportResizeCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.ViewportResize},T)}),inputCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.Input},T)}),mediaInteractionCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.MediaInteraction},T)}),styleSheetRuleCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.StyleSheetRule},T)}),styleDeclarationCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.StyleDeclaration},T)}),canvasMutationCb:zs,fontCb:T=>G({type:N.IncrementalSnapshot,data:A({source:O.Font},T)}),selectionCb:T=>{G({type:N.IncrementalSnapshot,data:A({source:O.Selection},T)})},customElementCb:T=>{G({type:N.IncrementalSnapshot,data:A({source:O.CustomElement},T)})},blockClass:i,ignoreClass:a,ignoreSelector:l,maskTextClass:o,maskTextSelector:c,maskInputOptions:ge,inlineStylesheet:u,sampling:S,recordDOM:b,recordCanvas:v,inlineImages:Q,userTriggeredOnInput:U,collectFonts:V,doc:M,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:k,blockSelector:n,slimDOMOptions:oe,dataURLOptions:C,mirror:re,iframeManager:Ie,stylesheetManager:ve,shadowDomManager:yt,processedNodeManager:br,canvasManager:Lr,ignoreCSSAttributes:Ge,plugins:((X=ne==null?void 0:ne.filter(T=>T.observer))==null?void 0:X.map(T=>({observer:T.observer,options:T.options,callback:Sr=>G({type:N.Plugin,data:{plugin:T.name,payload:Sr}})})))||[]},f)};Ie.addLoadListener(M=>{try{P.push(ae(M.contentDocument))}catch(X){console.warn(X)}});const ce=()=>{Ht(),P.push(ae(document)),ar=!0};return document.readyState==="interactive"||document.readyState==="complete"?ce():(P.push(Z("DOMContentLoaded",()=>{G({type:N.DomContentLoaded,data:{}}),$==="DOMContentLoaded"&&ce()})),P.push(Z("load",()=>{G({type:N.Load,data:{}}),$==="load"&&ce()},window))),()=>{P.forEach(M=>M()),br.destroy(),ar=!1,Gh()}}catch(P){console.warn(P)}}Se.addCustomEvent=(s,e)=>{if(!ar)throw new Error("please add custom event after start recording");G({type:N.Custom,data:{tag:s,payload:e}})};Se.freezePage=()=>{xe.forEach(s=>s.freeze())};Se.takeFullSnapshot=s=>{if(!ar)throw new Error("please take full snapshot after start recording");Ht(s)};Se.mirror=re;var ji;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(ji||(ji={}));const{addCustomEvent:Kf}=Se,{freezePage:Qf}=Se,{takeFullSnapshot:yf}=Se;exports.record=Se;
|
|
59
59
|
;if (typeof module.exports == "object" && typeof exports == "object") {
|
|
60
60
|
var __cp = (to, from, except, desc) => {
|
|
61
61
|
if ((from && typeof from === "object") || typeof from === "function") {
|