@glimt/record 0.0.83 → 0.0.84
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 +2 -2
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +2 -2
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +2 -2
- package/dist/record.umd.cjs.map +2 -2
- package/dist/record.umd.min.cjs +1 -1
- package/dist/record.umd.min.cjs.map +2 -2
- 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(...o);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(...o);return l.postcssPlugin=e,l.postcssVersion=new Qs().version,l}let n;return Object.defineProperty(i,"postcss",{get(){return n||(n=i()),n}}),i.process=function(o,l,a){return T([i(a)]).process(o,l)},i};T.stringify=Nf;T.parse=Ef;T.fromJSON=xf;T.list=Of;T.comment=s=>new Wo(s);T.atRule=s=>new Uo(s);T.decl=s=>new zo(s);T.rule=s=>new Vo(s);T.root=s=>new jo(s);T.document=s=>new Go(s);T.CssSyntaxError=If;T.Declaration=zo;T.Container=vf;T.Processor=Qs;T.Document=Go;T.Comment=Wo;T.Warning=kf;T.AtRule=Uo;T.Result=$f;T.Input=Mf;T.Rule=Vo;T.Root=jo;T.Node=Rf;Af.registerPostcss(T);var Tf=T;T.default=T;const F=Vc(Tf);F.stringify;F.fromJSON;F.plugin;F.parse;F.list;F.document;F.comment;F.atRule;F.rule;F.decl;F.root;F.CssSyntaxError;F.Declaration;F.Container;F.Processor;F.Document;F.Comment;F.Warning;F.AtRule;F.Result;F.Input;F.Rule;F.Root;F.Node;class ei{constructor(...e){se(this,"parentElement",null),se(this,"parentNode",null),se(this,"ownerDocument"),se(this,"firstChild",null),se(this,"lastChild",null),se(this,"previousSibling",null),se(this,"nextSibling",null),se(this,"ELEMENT_NODE",1),se(this,"TEXT_NODE",3),se(this,"nodeType"),se(this,"nodeName"),se(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 ei){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"}}function X(s,e,t=document){const r={capture:!0,passive:!0};return t.addEventListener(s,e,r),()=>t.removeEventListener(s,e,r)}const De=`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 Ji={map:{},getId(){return console.error(De),-1},getNode(){return console.error(De),null},removeNodeFromMap(){console.error(De)},has(){return console.error(De),!1},reset(){console.error(De)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(Ji=new Proxy(Ji,{get(s,e,t){return e==="map"&&console.error(De),Reflect.get(s,e,t)}}));function bt(s,e,t={}){let r=null,i=0;return function(...n){const o=Date.now();!i&&t.leading===!1&&(i=o);const l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function Tr(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>Tr(s,e,n||{},!0)}let Sr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Sr=()=>new Date().getTime());function Ho(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=I.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=I.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function Yo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Zo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Jo(s){return s?s.nodeType===s.ELEMENT_NODE?s:I.parentElement(s):null}function K(s,e,t,r){if(!s)return!1;const i=Jo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(hr(i,e,r))return!0}catch(n){}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function _f(s,e){return e.getId(s)!==-1}function Jr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===ct}function Xo(s,e){if(it(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=I.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Xo(r,e):!0}function Os(s){return!!s.changedTouches}function Lf(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 Ko(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function qo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function Rs(s){return s?s instanceof ei&&"shadowRoot"in s?!!s.shadowRoot:!!I.shadowRoot(s):!1}class Pf{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(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 Qo(s){var e;let t=null;return"getRootNode"in s&&((e=I.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&I.host(I.getRootNode(s))&&(t=I.host(I.getRootNode(s))),t}function Df(s){let e=s,t;for(;t=Qo(e);)e=t;return e}function Ff(s){const e=s.ownerDocument;if(!e)return!1;const t=Df(s);return I.contains(e,t)}function ea(s){const e=s.ownerDocument;return e?I.contains(e,s)||Ff(s):!1}const at=()=>"_rrweb_is_debug"in window&&window._rrweb_is_debug?window._rrweb_is_debug:!1,Q=(...s)=>{at()&&console.log("[recapt:rrweb]",...s)},Xi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function ta(s=8){let e="";for(let t=0;t<s;t++)e+=Xi.charAt(Math.floor(Math.random()*Xi.length));return e}let lt;function Bf(s){lt=s}function Uf(){lt=void 0}const A=s=>lt?(...t)=>{try{return s(...t)}catch(r){if(lt&<(r)===!0)return;throw r}}:s;class Ki{constructor(e){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.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 Wf{constructor(e){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new Ki(Cn)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ki(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}destroy(){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap}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 O.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:O.IncrementalSnapshot,data:{source:x.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case O.Meta:case O.Load:case O.DomContentLoaded:return!1;case O.Plugin:return t;case O.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case O.IncrementalSnapshot:switch(t.data.source){case x.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 x.Drag:case x.TouchMove:case x.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case x.ViewportResize:return!1;case x.MediaInteraction:case x.MouseInteraction:case x.Scroll:case x.CanvasMutation:case x.Input:return this.replaceIds(t.data,e,["id"]),t;case x.StyleSheetRule:case x.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case x.Font:return t;case x.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case x.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!==cn.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}const ra=class ir{constructor(){if(y(this,"docsObservers",new WeakSet),y(this,"shadowRootsObservers",new WeakSet),y(this,"docObservers",new WeakMap),ir.instance)return ir.instance;ir.instance=this}observeIframe(e,t,r){const i=this.docObservers.get(e);i&&(Q(e,"iframe is already observed, cleaning up and registering again"),i());const n=ta();t(n),this.docObservers.set(e,()=>{r(n)})}canRegisterDocObserver(e){return this.docsObservers.has(e)?!1:(this.docsObservers.add(e),!0)}canRegisterShadowRootObserver(e){return this.shadowRootsObservers.has(e)?!1:(this.shadowRootsObservers.add(e),!0)}destroy(){this.docsObservers=new WeakSet,this.shadowRootsObservers=new WeakSet,this.docObservers=new WeakMap}};y(ra,"instance");let zf=ra;const Es=new zf,sa=class nr{constructor(){if(y(this,"mutTracker"),y(this,"exitMutTracker"),y(this,"interval",50),y(this,"exitInterval",100),y(this,"mutThreshold",250),y(this,"inGlobalStorm",!1),y(this,"currentStormStartedAt",-1),y(this,"stormTimeLimit",5e3),y(this,"debounceTimeout",null),y(this,"debounceTimeoutMs",250),y(this,"handleStormFinishMethods",{}),nr.instance)return nr.instance;nr.instance=this,Q("MutationRateLimiter, init"),this.reset()}resetTracker(){this.mutTracker={muts:0,ts:-1}}resetExitTracker(){this.exitMutTracker={muts:0,requested:-1}}reset(){this.resetTracker(),this.resetExitTracker(),this.currentStormStartedAt=-1}stormStopped(e){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.inGlobalStorm=!1,this.reset();for(const[t,r]of Object.entries(this.handleStormFinishMethods))t!==e&&r();this.handleStormFinishMethods={}}handleStormExit(e,t){const r=Date.now();if(this.exitMutTracker.requested===-1)this.exitMutTracker={requested:r,muts:e};else if(this.exitMutTracker.muts+=e,r-this.exitMutTracker.requested>this.exitInterval)return this.exitMutTracker.muts>=this.mutThreshold?(Q("MutationRateLimiter, exit cooldown failed, continuing with storm",{mutTracker:this.mutTracker,exitMutTracker:this.exitMutTracker}),this.mutTracker.ts=r,this.mutTracker.muts+=this.exitMutTracker.muts,this.resetExitTracker(),!0):(Q("MutationRateLimiter, detected global storm exit.",{mutTracker:this.mutTracker,exitMutTracker:this.exitMutTracker}),this.stormStopped(t),!1);return!0}isInGlobalStorm(){return this.inGlobalStorm}doDebounce(){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.inGlobalStorm&&(this.debounceTimeout=setTimeout(()=>{this.debounceTimeout=null,Q("MutationRateLimiter, stopping storm because of debounce"),this.stormStopped()},this.debounceTimeoutMs))}isStorming(e,t){t.bufId in this.handleStormFinishMethods||(this.handleStormFinishMethods[t.bufId]=t.handleStormFinish.bind(t));const r=Date.now();if(this.inGlobalStorm)return this.doDebounce(),r-this.currentStormStartedAt>this.stormTimeLimit?(Q("MutationRateLimiter, storm time limit reached, stopping storm"),this.stormStopped(t.bufId),!1):r-this.mutTracker.ts>this.interval?this.handleStormExit(e,t.bufId):(this.mutTracker.muts+=e,this.mutTracker.ts=r,!0);if(this.mutTracker.ts===-1)this.mutTracker.muts=e;else if(r-this.mutTracker.ts<=this.interval&&(this.mutTracker.muts+=e,this.mutTracker.muts>=this.mutThreshold))return this.inGlobalStorm=!0,Q("MutationRateLimiter, detected global rolling storm"),this.currentStormStartedAt=r,this.doDebounce(),!0;return this.mutTracker.ts=r,!1}};y(sa,"instance");let Gf=sa;const qi=new Gf,ia=class or{constructor(){if(y(this,"lastFullSnapshot",-1),y(this,"intervalBetweenSnapshots",150),y(this,"debounceTimeout",null),y(this,"debounceTime",10),or.instance)return or.instance;or.instance=this}requestFullSnapshot(){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>{this.debounceTimeout=null,this.takeSnapshot()},this.debounceTime)}takeSnapshot(){if(Date.now()-this.lastFullSnapshot<this.intervalBetweenSnapshots){Q("StormSnapshotManager, takeSnapshot: too soon");return}Q("StormSnapshotManager, takeSnapshot: taking full snapshot"),Cd(),this.lastFullSnapshot=Date.now()}};y(ia,"instance");let jf=ia;const Vf=new jf;function Qi(s){return"__ln"in s}class Hf{constructor(){y(this,"length",0),y(this,"head",null),y(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&&Qi(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&&Qi(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 en=(s,e)=>`${s}@${e}`;class Yf{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"canvasManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"bufId",ta()),y(this,"stormBatches",[]),y(this,"stormInfo",null),y(this,"stormSettings",{batchSize:50,timeout:50,mutationLimit:800}),y(this,"debounceStormFinish",()=>{this.stormInfo&&(qi.isInGlobalStorm()||(this.stormInfo.timeout=setTimeout(this.handleStormFinish,this.stormSettings.timeout)))}),y(this,"handleStormMutations",(e,t=!0)=>{const r=Date.now();this.stormInfo==null&&(Q("detected probable mutation storm start","buffer id:",this.bufId),this.stormInfo={startedAt:r,totalMutations:0,stormExceededLimit:!1},t&&this.debounceStormFinish()),this.stormInfo.totalMutations+=e.length,this.stormInfo.totalMutations>=this.stormSettings.mutationLimit?(this.stormInfo.stormExceededLimit=!0,this.stormBatches=[]):this.stormBatches.push({ts:r,mutations:e}),clearTimeout(this.stormInfo.timeout),t&&e.length<this.stormSettings.batchSize?this.handleStormFinish():this.debounceStormFinish()}),y(this,"handleStormFinish",()=>{if(!this.stormInfo)return;const{stormExceededLimit:e}=this.stormInfo;if(Q("mutation storm finished","totalMutations:",this.stormInfo.totalMutations,"stormExceededLimit:",e,"storm duration:",Date.now()-this.stormInfo.startedAt,"ms","buffer id:",this.bufId),clearTimeout(this.stormInfo.timeout),this.stormInfo=null,e)this.stormBatches=[],Vf.requestFullSnapshot();else{let t=[];for(const r of this.stormBatches)t.push(...r.mutations);this.stormBatches=[],this.processInternalMutations(t,!0)}}),y(this,"processInternalMutations",(e,t=!1)=>{if(!t){if(qi.isStorming(e.length,this)){this.handleStormMutations(e,!1);return}(this.stormInfo!=null||e.length>=this.stormSettings.batchSize)&&this.handleStormMutations(e);return}for(const r of e)this.processMutation(r);this.emit()}),y(this,"processMutations",e=>{this.processInternalMutations(e)}),y(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Hf,i=u=>{let h=u,f=ct;for(;f===ct;)h=h&&h.nextSibling,f=h&&this.mirror.getId(h);return f},n=u=>{const h=I.parentNode(u);if(!h||!ea(u))return;let f=!1;if(u.nodeType===Node.TEXT_NODE){const d=h.tagName;if(d==="TEXTAREA")return;d==="STYLE"&&this.addedSet.has(h)&&(f=!0)}const p=it(h)?this.mirror.getId(Qo(u)):this.mirror.getId(h),g=i(u);if(p===-1||g===-1)return r.addNode(u);const m=Be(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:d=>{Ko(d,this.mirror)&&this.iframeManager.addIframe(d),qo(d,this.mirror)&&this.stylesheetManager.trackLinkElement(d),Rs(u)&&this.shadowDomManager.addShadowRoot(I.shadowRoot(u),this.doc)},onIframeLoad:(d,w)=>{this.iframeManager.attachIframe(d,w),this.shadowDomManager.observeAttachShadow(d)},onStylesheetLoad:(d,w)=>{this.stylesheetManager.attachLinkElement(d,w)},cssCaptured:f});m&&(e.push({parentId:p,nextId:g,node:m}),t.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const u of this.movedSet)tn(this.removesSubTreeCache,u,this.mirror)&&!this.movedSet.has(I.parentNode(u))||n(u);for(const u of this.addedSet)!rn(this.droppedSet,u)&&!tn(this.removesSubTreeCache,u,this.mirror)||rn(this.movedSet,u)?n(u):this.droppedSet.add(u);let o=null;for(;r.length;){let u=null;if(o){const h=this.mirror.getId(I.parentNode(o.value)),f=i(o.value);h!==-1&&f!==-1&&(u=o)}if(!u){let h=r.tail;for(;h;){const f=h;if(h=h.previous,f){const p=this.mirror.getId(I.parentNode(f.value));if(i(f.value)===-1)continue;if(p!==-1){u=f;break}else{const m=f.value,d=I.parentNode(m);if(d&&d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const w=I.host(d);if(this.mirror.getId(w)!==-1){u=f;break}}}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}const l=[];for(const u of this.texts){const h=u.node,f=I.parentNode(h);f&&f.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(f);const p=this.mirror.getId(h);!t.has(p)&&this.mirror.has(p)&&l.push({id:p,value:u.value})}const a=[];for(const u of this.attributes){const{attributes:h}=u;if(typeof h.style=="string"){const p=JSON.stringify(u.styleDiff),g=JSON.stringify(u._unchangedStyles);p.length<h.style.length&&(p+g).split("var(").length===h.style.split("var(").length&&(h.style=u.styleDiff)}const f=this.mirror.getId(u.node);!t.has(f)&&this.mirror.has(f)&&a.push({id:f,attributes:h})}const c={texts:l,attributes:a,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))}),y(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(I.childNodes(e),i=>I.textContent(i)||"").join("");t.attributes.value=lr({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:ur(e),value:r,maskInputFn:this.maskInputFn})}),y(this,"processMutation",e=>{if(!Jr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=I.textContent(e.target);!K(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:xn(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Jo(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 o=ur(t);i=lr({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(K(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"),!In(t.tagName,r))if(n.attributes[r]=vn(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 o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const a=t.style.getPropertyValue(l),c=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||c!==o.style.getPropertyPriority(l)?c===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,c]:n._unchangedStyles[l]=[a,c]}for(const l of Array.from(o.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(K(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}for(let o=0;o<e.addedNodes.length;o++)this.genAdds(e.addedNodes[o],e.target);const t=it(e.target)?this.mirror.getId(I.host(e.target)):this.mirror.getId(e.target);if(K(e.target,this.blockClass,this.blockSelector,!1))return;const r=this.addedSet.has(e.target),i=Xo(e.target,this.mirror),n=it(e.target)&&nt(e.target)?!0:void 0;for(let o=0;o<e.removedNodes.length;o++){const l=e.removedNodes[o],a=this.mirror.getId(l);if(Jr(l,this.mirror,this.slimDOMOptions)||!_f(l,this.mirror))return;this.addedSet.has(l)?($s(this.addedSet,l),this.droppedSet.add(l)):r&&a===-1||i||(this.movedSet.has(l)&&this.movedMap[en(a,t)]?$s(this.movedSet,l):(this.removes.push({parentId:t,id:a,isShadow:n}),Zf(l,this.removesSubTreeCache))),this.mapRemoves.push(l)}break}}}),y(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Jr(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[en(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!K(e,this.blockClass,this.blockSelector,!1)){const r=I.childNodes(e);for(let i=0;i<r.length;i++)this.genAdds(r[i]);if(Rs(e)){const i=I.childNodes(I.shadowRoot(e));for(let n=0;n<i.length;n++){const o=i[n];this.processedNodeManager.add(o,this),this.genAdds(o,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 $s(s,e){s.delete(e);const t=I.childNodes(e);for(let r=0;r<t.length;r++)$s(s,t[r])}function Zf(s,e){const t=[s];for(;t.length;){const r=t.pop();if(e.has(r))continue;e.add(r);const i=I.childNodes(r);for(let n=0;n<i.length;n++)t.push(i[n])}}function tn(s,e,t){return s.size===0?!1:Jf(s,e)}function Jf(s,e,t){const r=I.parentNode(e);return r?s.has(r):!1}function rn(s,e){return s.size===0?!1:na(s,e)}function na(s,e){const t=I.parentNode(e);return t?s.has(t)?!0:na(s,t):!1}const Oe=[];function xt(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 oa(s,e){const t=new Yf;Oe.push(t),t.init(s);const r=new(fn())(A(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Xf({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 o=[],l;const a=bt(A(h=>{const f=Date.now()-l;s(o.map(p=>(p.timeOffset-=f,p)),h),o=[],l=null}),n),c=A(bt(A(h=>{const f=xt(h),{clientX:p,clientY:g}=Os(h)?h.changedTouches[0]:h;l||(l=Sr()),o.push({x:p,y:g,id:r.getId(f),timeOffset:Sr()-l}),a(typeof DragEvent!="undefined"&&h instanceof DragEvent?x.Drag:h instanceof MouseEvent?x.MouseMove:x.TouchMove)}),i,{trailing:!1})),u=[X("mousemove",c,t),X("touchmove",c,t),X("drag",c,t)];return A(()=>{u.forEach(h=>h())})}function Kf({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let a=null;const c=u=>h=>{const f=xt(h);if(K(f,r,i,!0))return;let p=null,g=u;if("pointerType"in h){switch(h.pointerType){case"mouse":p=ge.Mouse;break;case"touch":p=ge.Touch;break;case"pen":p=ge.Pen;break}p===ge.Touch?q[u]===q.MouseDown?g="TouchStart":q[u]===q.MouseUp&&(g="TouchEnd"):ge.Pen}else Os(h)&&(p=ge.Touch);p!==null?(a=p,(g.startsWith("Touch")&&p===ge.Touch||g.startsWith("Mouse")&&p===ge.Mouse)&&(p=null)):q[u]===q.Click&&(p=a,a=null);const m=Os(h)?h.changedTouches[0]:h;if(!m)return;const d=t.getId(f),{clientX:w,clientY:b}=m;A(s)(M({type:q[g],id:d,x:w,y:b},p!==null&&{pointerType:p}))};return Object.keys(q).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&o[u]!==!1).forEach(u=>{let h=Re(u);const f=c(u);if(window.PointerEvent)switch(q[u]){case q.MouseDown:case q.MouseUp:h=h.replace("mouse","pointer");break;case q.TouchStart:case q.TouchEnd:return}l.push(X(h,f,e))}),A(()=>{l.forEach(u=>u())})}function aa({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const o=A(bt(A(l=>{const a=xt(l);if(!a||K(a,r,i,!0))return;const c=t.getId(a);if(a===e&&e.defaultView){const u=Ho(e.defaultView);s({id:c,x:u.left,y:u.top})}else s({id:c,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return X("scroll",o,e)}function qf({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=A(bt(A(()=>{const n=Yo(),o=Zo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return X("resize",i,e)}const Qf=["INPUT","TEXTAREA","SELECT"],sn=new WeakMap;function ed({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:c,userTriggeredOnInput:u}){function h(b){let S=xt(b);const R=b.isTrusted,U=S&&S.tagName;if(S&&U==="OPTION"&&(S=I.parentElement(S)),!S||!U||Qf.indexOf(U)<0||K(S,r,i,!0)||S.classList.contains(n)||o&&S.matches(o))return;let z=S.value,H=!1;const P=ur(S)||"";P==="radio"||P==="checkbox"?H=S.checked:(l[U.toLowerCase()]||l[P])&&(z=lr({element:S,maskInputOptions:l,tagName:U,type:P,value:z,maskInputFn:a})),f(S,u?{text:z,isChecked:H,userTriggered:R}:{text:z,isChecked:H});const W=S.name;P==="radio"&&W&&H&&e.querySelectorAll(`input[type="radio"][name="${W}"]`).forEach(V=>{if(V!==S){const ee=V.value;f(V,u?{text:ee,isChecked:!H,userTriggered:!1}:{text:ee,isChecked:!H})}})}function f(b,S){const R=sn.get(b);if(!R||R.text!==S.text||R.isChecked!==S.isChecked){sn.set(b,S);const U=t.getId(b);A(s)(re(M({},S),{id:U}))}}const g=(c.input==="last"?["change"]:["input","change"]).map(b=>X(b,A(h),e)),m=e.defaultView;if(!m)return()=>{g.forEach(b=>b())};const d=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[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 d&&d.set&&g.push(...w.map(b=>Tr(b[0],b[1],{set(){A(h)({target:this,isTrusted:!1})}},!1,m))),A(()=>{g.forEach(b=>b())})}function Cr(s){const e=[];function t(r,i){if(Zt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Zt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Zt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Zt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function Ce(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function td({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:A((u,h,f)=>{const[p,g]=f,{id:m,styleId:d}=Ce(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,adds:[{rule:p,index:g}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,f=this.cssRules.length){const p=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[p,f])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:A((u,h,f)=>{const[p]=f,{id:g,styleId:m}=Ce(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,removes:[{index:p}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:A((u,h,f)=>{const[p]=f,{id:g,styleId:m}=Ce(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replace:p}),u.apply(h,f)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:A((u,h,f)=>{const[p]=f,{id:g,styleId:m}=Ce(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replaceSync:p}),u.apply(h,f)})}));const a={};Jt("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Jt("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Jt("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Jt("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(a).forEach(([u,h])=>{c[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(c[u].insertRule,{apply:A((f,p,g)=>{const[m,d]=g,{id:w,styleId:b}=Ce(p.parentStyleSheet,e,t.styleMirror);return(w&&w!==-1||b&&b!==-1)&&s({id:w,styleId:b,adds:[{rule:m,index:[...Cr(p),d||0]}]}),f.apply(p,g)})}),h.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:A((f,p,g)=>{const[m]=g,{id:d,styleId:w}=Ce(p.parentStyleSheet,e,t.styleMirror);return(d&&d!==-1||w&&w!==-1)&&s({id:d,styleId:w,removes:[{index:[...Cr(p),m]}]}),f.apply(p,g)})})}),A(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,h])=>{h.prototype.insertRule=c[u].insertRule,h.prototype.deleteRule=c[u].deleteRule})})}function la({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(I.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,a=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var c;return(c=a.get)==null?void 0:c.call(this)},set(c){var u;const h=(u=a.set)==null?void 0:u.call(this,c);if(o!==null&&o!==-1)try{e.adoptStyleSheets(c,o)}catch(f){}return h}}),A(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function rd({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:A((l,a,c)=>{var u;const[h,f,p]=c;if(t.has(h))return n.apply(a,[h,f,p]);const{id:g,styleId:m}=Ce((u=a.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:f,priority:p},index:Cr(a.parentRule)}),l.apply(a,c)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:A((l,a,c)=>{var u;const[h]=c;if(t.has(h))return o.apply(a,[h]);const{id:f,styleId:p}=Ce((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||p&&p!==-1)&&s({id:f,styleId:p,remove:{property:h},index:Cr(a.parentRule)}),l.apply(a,c)})}),A(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function sd({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const o=A(a=>bt(A(c=>{const u=xt(c);if(!u||K(u,e,t,!0))return;const{currentTime:h,volume:f,muted:p,playbackRate:g,loop:m}=u;s({type:a,id:r.getId(u),currentTime:h,volume:f,muted:p,playbackRate:g,loop:m})}),i.media||500)),l=[X("play",o(Pe.Play),n),X("pause",o(Pe.Pause),n),X("seeked",o(Pe.Seeked),n),X("volumechange",o(Pe.VolumeChange),n),X("ratechange",o(Pe.RateChange),n)];return A(()=>{l.forEach(a=>a())})}function id({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,c,u){const h=new n(a,c,u);return i.set(h,{family:a,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};const o=Ee(e.fonts,"add",function(l){return function(a){return setTimeout(A(()=>{const c=i.get(a);c&&(s(c),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),A(()=>{r.forEach(l=>l())})}function nd(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let o=!0;const l=A(()=>{const a=e.getSelection();if(!a||o&&(a!=null&&a.isCollapsed))return;o=a.isCollapsed||!1;const c=[],u=a.rangeCount||0;for(let h=0;h<u;h++){const f=a.getRangeAt(h),{startContainer:p,startOffset:g,endContainer:m,endOffset:d}=f;K(p,r,i,!0)||K(m,r,i,!0)||c.push({start:t.getId(p),startOffset:g,end:t.getId(m),endOffset:d})}n({ranges:c})});return l(),X("selectionchange",l)}function od({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:Ee(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function ad(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:h,fontCb:f,selectionCb:p,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),o(...m)},s.inputCb=(...m)=>{e.input&&e.input(...m),l(...m)},s.mediaInteractionCb=(...m)=>{e.mediaInteaction&&e.mediaInteaction(...m),a(...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),f(...m)},s.selectionCb=(...m)=>{e.selection&&e.selection(...m),p(...m)},s.customElementCb=(...m)=>{e.customElement&&e.customElement(...m),g(...m)}}function ld(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};ad(s,e);let r;s.recordDOM&&(r=oa(s,s.doc));const i=Xf(s),n=Kf(s),o=aa(s),l=qf(s,{win:t}),a=ed(s),c=sd(s);let u=()=>{},h=()=>{},f=()=>{},p=()=>{};s.recordDOM&&(u=td(s,{win:t}),h=la(s,s.doc),f=rd(s,{win:t}),s.collectFonts&&(p=id(s)));const g=nd(s),m=od(s),d=[];for(const w of s.plugins)d.push(w.observer(w.callback,t,w.options));return A(()=>{Oe.forEach(w=>w.reset()),r==null||r.disconnect(),i(),n(),o(),l(),a(),c(),u(),h(),f(),p(),g(),m(),d.forEach(w=>w())})}function Zt(s){return typeof window[s]!="undefined"}function Jt(s){return!!(typeof window[s]!="undefined"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ud=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var Xt=0;Xt<Ue.length;Xt++)ud[Ue.charCodeAt(Xt)]=Xt;var cd=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Ue[e[t]>>2],i+=Ue[(e[t]&3)<<4|e[t+1]>>4],i+=Ue[(e[t+1]&15)<<2|e[t+2]>>6],i+=Ue[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 nn=new Map;function hd(s,e){let t=nn.get(s);return t||(t=new Map,nn.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const ua=(s,e,t)=>{if(!s||!(ha(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=hd(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function ar(s,e,t){if(s instanceof Array)return s.map(r=>ar(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=cd(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[ar(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:[ar(s.data,e,t),s.width,s.height]};if(ha(s,e)||typeof s=="object"){const r=s.constructor.name,i=ua(s,e,t);return{rr_type:r,index:i}}}}return s}const ca=(s,e,t)=>s.map(r=>ar(r,e,t)),ha=(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 fd(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;const l=Ee(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...c){return K(this.canvas,t,r,!0)||setTimeout(()=>{const u=ca(c,e,this);s(this.canvas,{type:ze["2D"],property:o,args:u})},0),a.apply(this,c)}});i.push(l)}catch(l){const a=Tr(e.CanvasRenderingContext2D.prototype,o,{set(c){s(this.canvas,{type:ze["2D"],property:o,args:[c],setter:!0})}});i.push(a)}return()=>{i.forEach(o=>o())}}function dd(s){return s==="experimental-webgl"?"webgl":s}function on(s,e,t,r){const i=[];try{const n=Ee(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!K(this,e,t,!0)){const c=dd(l);if("__context"in this||(this.__context=c),r&&["webgl","webgl2"].includes(c))if(a[0]&&typeof a[0]=="object"){const u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch(n){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function an(s,e,t,r,i,n){const o=[],l=Object.getOwnPropertyNames(s);for(const a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;const c=Ee(s,a,function(u){return function(...h){const f=u.apply(this,h);if(ua(f,n,this),"tagName"in this.canvas&&!K(this.canvas,r,i,!0)){const p=ca(h,n,this),g={type:e,property:a,args:p};t(this.canvas,g)}return f}});o.push(c)}catch(c){const u=Tr(s,a,{set(h){t(this.canvas,{type:e,property:a,args:[h],setter:!0})}});o.push(u)}return o}function pd(s,e,t,r){const i=[];return i.push(...an(e.WebGLRenderingContext.prototype,ze.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext!="undefined"&&i.push(...an(e.WebGL2RenderingContext.prototype,ze.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const fa="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",md=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),ln=typeof self!="undefined"&&self.Blob&&new Blob([md(fa)],{type:"text/javascript;charset=utf-8"});function gd(s){let e;try{if(e=ln&&(self.URL||self.webkitURL).createObjectURL(ln),!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,"+fa,{name:s==null?void 0:s.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class yd{constructor(e){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(a,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(c)});const{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&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 o=on(t,r,i,!0),l=new Map,a=new gd;a.onmessage=g=>{const{id:m}=g.data;if(l.set(m,!1),!("base64"in g.data))return;const{base64:d,type:w,width:b,height:S}=g.data;this.mutationCb({id:m,type:ze["2D"],commands:[{property:"clearRect",args:[0,0,b,S]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:d}],type:w}]},0,0]}]})};const c=1e3/e;let u=0,h;const f=()=>{const g=[];return t.document.querySelectorAll("canvas").forEach(m=>{K(m,r,i,!0)||g.push(m)}),g},p=g=>{if(u&&g-u<c){h=requestAnimationFrame(p);return}u=g,f().forEach(async m=>{var d;const w=this.mirror.getId(m);if(l.get(w)||m.width===0||m.height===0)return;if(l.set(w,!0),["webgl","webgl2"].includes(m.__context)){const S=m.getContext(m.__context);((d=S==null?void 0:S.getContextAttributes())==null?void 0:d.preserveDrawingBuffer)===!1&&S.clear(S.COLOR_BUFFER_BIT)}const b=await createImageBitmap(m);a.postMessage({id:w,bitmap:b,width:m.width,height:m.height,dataURLOptions:n.dataURLOptions},[b])}),h=requestAnimationFrame(p)};h=requestAnimationFrame(p),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=on(e,t,r,!1),n=fd(this.processMutation.bind(this),e,t,r),o=pd(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}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(o=>{const c=o,{type:l}=c;return Te(c,["type"])}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class wd{constructor(){y(this,"nodeMap",new WeakMap),y(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(){}}class bd{constructor(e){y(this,"shadowDoms",new WeakSet),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(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(!nt(e)||!Es.canRegisterShadowRootObserver(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),Q("Adding mutation observer for shadowRoot",e.host,"restoreHandlers",this.restoreHandlers.length);const r=oa(re(M({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(aa(re(M({},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(I.host(e))),this.restoreHandlers.push(la({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(Ee(e.prototype,"attachShadow",function(i){return function(n){const o=i.call(this,n),l=I.shadowRoot(this);return l&&ea(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class Sd{constructor(e){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new Pf),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 o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:yn(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}let B,st,Xr,ut=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((ai=s.contentWindow)==null?void 0:ai.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){at()&&console.debug("Unable to override Array.from",s)}const oe=qa();function xe(s={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,hooks:d,packFn:w,sampling:b={},dataURLOptions:S={},mousemoveWait:R,recordDOM:U=!0,recordCanvas:z=!1,recordCrossOriginIframes:H=!1,recordAfter:P=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:W=!1,collectFonts:V=!1,inlineImages:ee=!1,plugins:ue,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:Je=new Set([]),errorHandler:Xe}=s;Bf(Xe);const G=H?window.parent===window:!0;let te=!1;if(!G)try{window.parent.document&&(te=!1)}catch(N){te=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!te)return()=>{};R!==void 0&&b.mousemove===void 0&&(b.mousemove=R),oe.reset();const be=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}:f!==void 0?f:{password:!0},ce=p===!0||p==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:p==="all",headMetaDescKeywords:p==="all",headTitleMutations:p==="all"}:p||{};Lf();let Mt,Me=0;const ti=N=>{for(const ie of ue||[])ie.eventProcessor&&(N=ie.eventProcessor(N));return w&&!te&&(N=w(N)),N};B=(N,ie,L)=>{var ke;var he;const Y=N;if(Y.timestamp=(ke=L==null?void 0:L.overrideTimestamp)!=null?ke:Sr(),(he=Oe[0])!=null&&he.isFrozen()&&Y.type!==O.FullSnapshot&&!(Y.type===O.IncrementalSnapshot&&Y.data.source===x.Mutation)&&Oe.forEach(Z=>Z.unfreeze()),G)e==null||e(ti(Y),ie);else if(te){const Z={type:"rrweb",event:ti(Y),origin:window.location.origin,isCheckout:ie};window.parent.postMessage(Z,"*")}if(Y.type===O.FullSnapshot)Mt=Y,Me=0;else if(Y.type===O.IncrementalSnapshot){if(Y.data.source===x.Mutation&&Y.data.isAttachIframe)return;Me++;const Z=r&&Me>=r,ne=t&&Y.timestamp-Mt.timestamp>t;(Z||ne)&&st(!0)}};const At=N=>{B({type:O.IncrementalSnapshot,data:M({source:x.Mutation},N)})},ri=N=>B({type:O.IncrementalSnapshot,data:M({source:x.Scroll},N)}),si=N=>B({type:O.IncrementalSnapshot,data:M({source:x.CanvasMutation},N)}),da=N=>B({type:O.IncrementalSnapshot,data:M({source:x.AdoptedStyleSheet},N)}),Ae=new Sd({mutationCb:At,adoptedStyleSheetCb:da}),Se=new Wf({mirror:oe,mutationCb:At,stylesheetManager:Ae,recordCrossOriginIframes:H,wrappedEmit:B});for(const N of ue||[])N.getMirror&&N.getMirror({nodeMirror:oe,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});const _r=new wd;Xr=new yd({recordCanvas:z,mutationCb:si,win:window,blockClass:i,blockSelector:n,mirror:oe,sampling:b.canvas,dataURLOptions:S});const Ot=new bd({mutationCb:At,scrollCb:ri,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:be,dataURLOptions:S,maskTextFn:m,maskInputFn:g,recordCanvas:z,inlineImages:ee,sampling:b,slimDOMOptions:ce,iframeManager:Se,stylesheetManager:Ae,canvasManager:Xr,keepIframeSrcFn:E,processedNodeManager:_r},mirror:oe});st=(N=!1)=>{if(!U)return;B({type:O.Meta,data:{href:window.location.href,width:Zo(),height:Yo()}},N),Ae.reset(),Ot.init(),Oe.forEach(L=>L.lock());const ie=Dl(document,{mirror:oe,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:be,maskTextFn:m,maskInputFn:g,slimDOM:ce,dataURLOptions:S,recordCanvas:z,inlineImages:ee,onSerialize:L=>{Ko(L,oe)&&Se.addIframe(L),qo(L,oe)&&Ae.trackLinkElement(L),Rs(L)&&Ot.addShadowRoot(I.shadowRoot(L),document)},onIframeLoad:(L,he)=>{Se.attachIframe(L,he),Ot.observeAttachShadow(L)},onStylesheetLoad:(L,he)=>{Ae.attachLinkElement(L,he)},keepIframeSrcFn:E});if(!ie){at()&&console.warn("Failed to snapshot the document");return}B({type:O.FullSnapshot,data:{node:ie,initialOffset:Ho(window)}},N),Oe.forEach(L=>L.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ae.adoptStyleSheets(document.adoptedStyleSheets,oe.getId(document))};try{const N=[],ie=Z=>{var ne;return A(ld)({mutationCb:At,mousemoveCb:($,Lr)=>B({type:O.IncrementalSnapshot,data:{source:Lr,positions:$}}),mouseInteractionCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.MouseInteraction},$)}),scrollCb:ri,viewportResizeCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.ViewportResize},$)}),inputCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.Input},$)}),mediaInteractionCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.MediaInteraction},$)}),styleSheetRuleCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.StyleSheetRule},$)}),styleDeclarationCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.StyleDeclaration},$)}),canvasMutationCb:si,fontCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.Font},$)}),selectionCb:$=>{B({type:O.IncrementalSnapshot,data:M({source:x.Selection},$)})},customElementCb:$=>{B({type:O.IncrementalSnapshot,data:M({source:x.CustomElement},$)})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:c,maskInputOptions:be,inlineStylesheet:u,sampling:b,recordDOM:U,recordCanvas:z,inlineImages:ee,userTriggeredOnInput:W,collectFonts:V,doc:Z,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:E,blockSelector:n,slimDOMOptions:ce,dataURLOptions:S,mirror:oe,iframeManager:Se,stylesheetManager:Ae,shadowDomManager:Ot,processedNodeManager:_r,canvasManager:Xr,ignoreCSSAttributes:Je,plugins:((ne=ue==null?void 0:ue.filter($=>$.observer))==null?void 0:ne.map($=>({observer:$.observer,options:$.options,callback:Lr=>B({type:O.Plugin,data:{plugin:$.name,payload:Lr}})})))||[]},d)},L={};Se.addLoadListener(Z=>{try{Es.observeIframe(Z.contentDocument,ne=>{const $=ie(Z.contentDocument);L[ne]=$,Q(Z.contentDocument,"did register handler on iframe. current registered handlers",Object.keys(L).length)},ne=>{const $=L[ne];$&&$(),delete L[ne],Q(Z.contentDocument,"did cleanup for regisited handler on iframe. current registered handlers",Object.keys(L).length)})}catch(ne){at()&&(console.warn("internal error"),console.warn(ne))}});let he=null;const Y=()=>{he=Date.now(),st(),N.push(ie(document)),ut=!0},ke=()=>{window.removeEventListener("load",ke),!(!ut||he==null)&&(Date.now()-he<=10||st())};return window.addEventListener("load",ke),document.readyState==="interactive"||document.readyState==="complete"?(document.readyState==="complete"&&window.removeEventListener("load",ke),Y()):(N.push(X("DOMContentLoaded",()=>{B({type:O.DomContentLoaded,data:{}}),P==="DOMContentLoaded"&&Y()})),N.push(X("load",()=>{B({type:O.Load,data:{}}),P==="load"&&Y()},window))),()=>{N.forEach(Z=>Z()),Object.values(L).forEach(Z=>Z()),_r.destroy(),Se.destroy(),Es.destroy(),ut=!1,Uf()}}catch(N){at()&&(console.warn("internal error1"),console.warn(N))}}xe.addCustomEvent=(s,e)=>{if(!ut)throw new Error("please add custom event after start recording");B({type:O.Custom,data:{tag:s,payload:e}})};xe.freezePage=()=>{Oe.forEach(s=>s.freeze())};xe.takeFullSnapshot=s=>{if(!ut)throw new Error("please take full snapshot after start recording");st(s)};xe.mirror=oe;var un;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(un||(un={}));const{addCustomEvent:tp}=xe,{freezePage:rp}=xe,{takeFullSnapshot:Cd}=xe;exports.record=xe;
|
|
58
|
+
or you can use record.mirror to access the mirror instance during recording.`;let Ji={map:{},getId(){return console.error(De),-1},getNode(){return console.error(De),null},removeNodeFromMap(){console.error(De)},has(){return console.error(De),!1},reset(){console.error(De)}};typeof window!="undefined"&&window.Proxy&&window.Reflect&&(Ji=new Proxy(Ji,{get(s,e,t){return e==="map"&&console.error(De),Reflect.get(s,e,t)}}));function bt(s,e,t={}){let r=null,i=0;return function(...n){const o=Date.now();!i&&t.leading===!1&&(i=o);const l=e-(o-i),a=this;l<=0||l>e?(r&&(clearTimeout(r),r=null),i=o,s.apply(a,n)):!r&&t.trailing!==!1&&(r=setTimeout(()=>{i=t.leading===!1?0:Date.now(),r=null,s.apply(a,n)},l))}}function Tr(s,e,t,r,i=window){const n=i.Object.getOwnPropertyDescriptor(s,e);return i.Object.defineProperty(s,e,r?t:{set(o){setTimeout(()=>{t.set.call(this,o)},0),n&&n.set&&n.set.call(this,o)}}),()=>Tr(s,e,n||{},!0)}let Sr=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Sr=()=>new Date().getTime());function Ho(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=I.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=I.parentElement(n.body))==null?void 0:r.scrollTop)||((i=n==null?void 0:n.body)==null?void 0:i.scrollTop)||0}}function Yo(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Zo(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Jo(s){return s?s.nodeType===s.ELEMENT_NODE?s:I.parentElement(s):null}function K(s,e,t,r){if(!s)return!1;const i=Jo(s);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(hr(i,e,r))return!0}catch(n){}return!!(t&&(i.matches(t)||r&&i.closest(t)!==null))}function _f(s,e){return e.getId(s)!==-1}function Jr(s,e,t){return s.tagName==="TITLE"&&t.headTitleMutations?!0:e.getId(s)===ct}function Xo(s,e){if(it(s))return!1;const t=e.getId(s);if(!e.has(t))return!0;const r=I.parentNode(s);return r&&r.nodeType===s.DOCUMENT_NODE?!1:r?Xo(r,e):!0}function Os(s){return!!s.changedTouches}function Lf(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 Ko(s,e){return!!(s.nodeName==="IFRAME"&&e.getMeta(s))}function qo(s,e){return!!(s.nodeName==="LINK"&&s.nodeType===s.ELEMENT_NODE&&s.getAttribute&&s.getAttribute("rel")==="stylesheet"&&e.getMeta(s))}function Rs(s){return s?s instanceof ei&&"shadowRoot"in s?!!s.shadowRoot:!!I.shadowRoot(s):!1}class Pf{constructor(){y(this,"id",1),y(this,"styleIDMap",new WeakMap),y(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 Qo(s){var e;let t=null;return"getRootNode"in s&&((e=I.getRootNode(s))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&I.host(I.getRootNode(s))&&(t=I.host(I.getRootNode(s))),t}function Df(s){let e=s,t;for(;t=Qo(e);)e=t;return e}function Ff(s){const e=s.ownerDocument;if(!e)return!1;const t=Df(s);return I.contains(e,t)}function ea(s){const e=s.ownerDocument;return e?I.contains(e,s)||Ff(s):!1}const at=()=>"_rrweb_is_debug"in window&&window._rrweb_is_debug?window._rrweb_is_debug:!1,Q=(...s)=>{at()&&console.log("[recapt:rrweb]",...s)},Xi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function ta(s=8){let e="";for(let t=0;t<s;t++)e+=Xi.charAt(Math.floor(Math.random()*Xi.length));return e}let lt;function Bf(s){lt=s}function Uf(){lt=void 0}const A=s=>lt?(...t)=>{try{return s(...t)}catch(r){if(lt&<(r)===!0)return;throw r}}:s;class Ki{constructor(e){y(this,"iframeIdToRemoteIdMap",new WeakMap),y(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=e}getId(e,t,r,i){const n=r||this.getIdToRemoteIdMap(e),o=i||this.getRemoteIdToIdMap(e);let l=n.get(t);return l||(l=this.generateIdFn(),n.set(t,l),o.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 Wf{constructor(e){y(this,"iframes",new WeakMap),y(this,"crossOriginIframeMap",new WeakMap),y(this,"crossOriginIframeMirror",new Ki(Cn)),y(this,"crossOriginIframeStyleMirror"),y(this,"crossOriginIframeRootIdMap",new WeakMap),y(this,"mirror"),y(this,"mutationCb"),y(this,"wrappedEmit"),y(this,"loadListener"),y(this,"stylesheetManager"),y(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ki(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}destroy(){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap}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 O.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:O.IncrementalSnapshot,data:{source:x.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case O.Meta:case O.Load:case O.DomContentLoaded:return!1;case O.Plugin:return t;case O.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case O.IncrementalSnapshot:switch(t.data.source){case x.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 x.Drag:case x.TouchMove:case x.MouseMove:return t.data.positions.forEach(i=>{this.replaceIds(i,e,["id"])}),t;case x.ViewportResize:return!1;case x.MediaInteraction:case x.MouseInteraction:case x.Scroll:case x.CanvasMutation:case x.Input:return this.replaceIds(t.data,e,["id"]),t;case x.StyleSheetRule:case x.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case x.Font:return t;case x.Selection:return t.data.ranges.forEach(i=>{this.replaceIds(i,e,["start","end"])}),t;case x.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!==cn.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}}const ra=class ir{constructor(){if(y(this,"docsObservers",new WeakSet),y(this,"shadowRootsObservers",new WeakSet),y(this,"docObservers",new WeakMap),ir.instance)return ir.instance;ir.instance=this}observeIframe(e,t,r){const i=this.docObservers.get(e);i&&(Q(e,"iframe is already observed, cleaning up and registering again"),i());const n=ta();t(n),this.docObservers.set(e,()=>{r(n)})}canRegisterDocObserver(e){return this.docsObservers.has(e)?!1:(this.docsObservers.add(e),!0)}canRegisterShadowRootObserver(e){return this.shadowRootsObservers.has(e)?!1:(this.shadowRootsObservers.add(e),!0)}destroy(){this.docsObservers=new WeakSet,this.shadowRootsObservers=new WeakSet,this.docObservers=new WeakMap}};y(ra,"instance");let zf=ra;const Es=new zf,sa=class nr{constructor(){if(y(this,"mutTracker"),y(this,"exitMutTracker"),y(this,"interval",50),y(this,"exitInterval",100),y(this,"mutThreshold",350),y(this,"inGlobalStorm",!1),y(this,"currentStormStartedAt",-1),y(this,"stormTimeLimit",5e3),y(this,"debounceTimeout",null),y(this,"debounceTimeoutMs",250),y(this,"handleStormFinishMethods",{}),nr.instance)return nr.instance;nr.instance=this,Q("MutationRateLimiter, init"),this.reset()}resetTracker(){this.mutTracker={muts:0,ts:-1}}resetExitTracker(){this.exitMutTracker={muts:0,requested:-1}}reset(){this.resetTracker(),this.resetExitTracker(),this.currentStormStartedAt=-1}stormStopped(e){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.inGlobalStorm=!1,this.reset();for(const[t,r]of Object.entries(this.handleStormFinishMethods))t!==e&&r();this.handleStormFinishMethods={}}handleStormExit(e,t){const r=Date.now();if(this.exitMutTracker.requested===-1)this.exitMutTracker={requested:r,muts:e};else if(this.exitMutTracker.muts+=e,r-this.exitMutTracker.requested>this.exitInterval)return this.exitMutTracker.muts>=this.mutThreshold?(Q("MutationRateLimiter, exit cooldown failed, continuing with storm",{mutTracker:this.mutTracker,exitMutTracker:this.exitMutTracker}),this.mutTracker.ts=r,this.mutTracker.muts+=this.exitMutTracker.muts,this.resetExitTracker(),!0):(Q("MutationRateLimiter, detected global storm exit.",{mutTracker:this.mutTracker,exitMutTracker:this.exitMutTracker}),this.stormStopped(t),!1);return!0}isInGlobalStorm(){return this.inGlobalStorm}doDebounce(){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.inGlobalStorm&&(this.debounceTimeout=setTimeout(()=>{this.debounceTimeout=null,Q("MutationRateLimiter, stopping storm because of debounce"),this.stormStopped()},this.debounceTimeoutMs))}isStorming(e,t){t.bufId in this.handleStormFinishMethods||(this.handleStormFinishMethods[t.bufId]=t.handleStormFinish.bind(t));const r=Date.now();if(this.inGlobalStorm)return this.doDebounce(),r-this.currentStormStartedAt>this.stormTimeLimit?(Q("MutationRateLimiter, storm time limit reached, stopping storm"),this.stormStopped(t.bufId),!1):r-this.mutTracker.ts>this.interval?this.handleStormExit(e,t.bufId):(this.mutTracker.muts+=e,this.mutTracker.ts=r,!0);if(this.mutTracker.ts===-1)this.mutTracker.muts=e;else if(r-this.mutTracker.ts<=this.interval&&(this.mutTracker.muts+=e,this.mutTracker.muts>=this.mutThreshold))return this.inGlobalStorm=!0,Q("MutationRateLimiter, detected global rolling storm"),this.currentStormStartedAt=r,this.doDebounce(),!0;return this.mutTracker.ts=r,!1}};y(sa,"instance");let Gf=sa;const qi=new Gf,ia=class or{constructor(){if(y(this,"lastFullSnapshot",-1),y(this,"intervalBetweenSnapshots",150),y(this,"debounceTimeout",null),y(this,"debounceTime",10),or.instance)return or.instance;or.instance=this}requestFullSnapshot(){this.debounceTimeout&&clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>{this.debounceTimeout=null,this.takeSnapshot()},this.debounceTime)}takeSnapshot(){if(Date.now()-this.lastFullSnapshot<this.intervalBetweenSnapshots){Q("StormSnapshotManager, takeSnapshot: too soon");return}Q("StormSnapshotManager, takeSnapshot: taking full snapshot"),Cd(),this.lastFullSnapshot=Date.now()}};y(ia,"instance");let jf=ia;const Vf=new jf;function Qi(s){return"__ln"in s}class Hf{constructor(){y(this,"length",0),y(this,"head",null),y(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&&Qi(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&&Qi(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 en=(s,e)=>`${s}@${e}`;class Yf{constructor(){y(this,"frozen",!1),y(this,"locked",!1),y(this,"texts",[]),y(this,"attributes",[]),y(this,"attributeMap",new WeakMap),y(this,"removes",[]),y(this,"mapRemoves",[]),y(this,"movedMap",{}),y(this,"addedSet",new Set),y(this,"movedSet",new Set),y(this,"droppedSet",new Set),y(this,"removesSubTreeCache",new Set),y(this,"mutationCb"),y(this,"blockClass"),y(this,"blockSelector"),y(this,"maskTextClass"),y(this,"maskTextSelector"),y(this,"inlineStylesheet"),y(this,"maskInputOptions"),y(this,"maskTextFn"),y(this,"maskInputFn"),y(this,"keepIframeSrcFn"),y(this,"recordCanvas"),y(this,"inlineImages"),y(this,"slimDOMOptions"),y(this,"dataURLOptions"),y(this,"doc"),y(this,"mirror"),y(this,"iframeManager"),y(this,"stylesheetManager"),y(this,"shadowDomManager"),y(this,"canvasManager"),y(this,"processedNodeManager"),y(this,"unattachedDoc"),y(this,"bufId",ta()),y(this,"stormBatches",[]),y(this,"stormInfo",null),y(this,"stormSettings",{batchSize:250,timeout:50,mutationLimit:800}),y(this,"debounceStormFinish",()=>{this.stormInfo&&(qi.isInGlobalStorm()||(this.stormInfo.timeout=setTimeout(this.handleStormFinish,this.stormSettings.timeout)))}),y(this,"handleStormMutations",(e,t=!0)=>{const r=Date.now();this.stormInfo==null&&(Q("detected probable mutation storm start","buffer id:",this.bufId),this.stormInfo={startedAt:r,totalMutations:0,stormExceededLimit:!1},t&&this.debounceStormFinish()),this.stormInfo.totalMutations+=e.length,this.stormInfo.totalMutations>=this.stormSettings.mutationLimit?(this.stormInfo.stormExceededLimit=!0,this.stormBatches=[]):this.stormBatches.push({ts:r,mutations:e}),clearTimeout(this.stormInfo.timeout),t&&e.length<this.stormSettings.batchSize?this.handleStormFinish():this.debounceStormFinish()}),y(this,"handleStormFinish",()=>{if(!this.stormInfo)return;const{stormExceededLimit:e}=this.stormInfo;if(Q("mutation storm finished","totalMutations:",this.stormInfo.totalMutations,"stormExceededLimit:",e,"storm duration:",Date.now()-this.stormInfo.startedAt,"ms","buffer id:",this.bufId),clearTimeout(this.stormInfo.timeout),this.stormInfo=null,e)this.stormBatches=[],Vf.requestFullSnapshot();else{let t=[];for(const r of this.stormBatches)t.push(...r.mutations);this.stormBatches=[],this.processInternalMutations(t,!0)}}),y(this,"processInternalMutations",(e,t=!1)=>{if(!t){if(qi.isStorming(e.length,this)){this.handleStormMutations(e,!1);return}(this.stormInfo!=null||e.length>=this.stormSettings.batchSize)&&this.handleStormMutations(e);return}for(const r of e)this.processMutation(r);this.emit()}),y(this,"processMutations",e=>{this.processInternalMutations(e)}),y(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=new Set,r=new Hf,i=u=>{let h=u,f=ct;for(;f===ct;)h=h&&h.nextSibling,f=h&&this.mirror.getId(h);return f},n=u=>{const h=I.parentNode(u);if(!h||!ea(u))return;let f=!1;if(u.nodeType===Node.TEXT_NODE){const d=h.tagName;if(d==="TEXTAREA")return;d==="STYLE"&&this.addedSet.has(h)&&(f=!0)}const p=it(h)?this.mirror.getId(Qo(u)):this.mirror.getId(h),g=i(u);if(p===-1||g===-1)return r.addNode(u);const m=Be(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:d=>{Ko(d,this.mirror)&&this.iframeManager.addIframe(d),qo(d,this.mirror)&&this.stylesheetManager.trackLinkElement(d),Rs(u)&&this.shadowDomManager.addShadowRoot(I.shadowRoot(u),this.doc)},onIframeLoad:(d,w)=>{this.iframeManager.attachIframe(d,w),this.shadowDomManager.observeAttachShadow(d)},onStylesheetLoad:(d,w)=>{this.stylesheetManager.attachLinkElement(d,w)},cssCaptured:f});m&&(e.push({parentId:p,nextId:g,node:m}),t.add(m.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const u of this.movedSet)tn(this.removesSubTreeCache,u,this.mirror)&&!this.movedSet.has(I.parentNode(u))||n(u);for(const u of this.addedSet)!rn(this.droppedSet,u)&&!tn(this.removesSubTreeCache,u,this.mirror)||rn(this.movedSet,u)?n(u):this.droppedSet.add(u);let o=null;for(;r.length;){let u=null;if(o){const h=this.mirror.getId(I.parentNode(o.value)),f=i(o.value);h!==-1&&f!==-1&&(u=o)}if(!u){let h=r.tail;for(;h;){const f=h;if(h=h.previous,f){const p=this.mirror.getId(I.parentNode(f.value));if(i(f.value)===-1)continue;if(p!==-1){u=f;break}else{const m=f.value,d=I.parentNode(m);if(d&&d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const w=I.host(d);if(this.mirror.getId(w)!==-1){u=f;break}}}}}}if(!u){for(;r.head;)r.removeNode(r.head.value);break}o=u.previous,r.removeNode(u.value),n(u.value)}const l=[];for(const u of this.texts){const h=u.node,f=I.parentNode(h);f&&f.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(f);const p=this.mirror.getId(h);!t.has(p)&&this.mirror.has(p)&&l.push({id:p,value:u.value})}const a=[];for(const u of this.attributes){const{attributes:h}=u;if(typeof h.style=="string"){const p=JSON.stringify(u.styleDiff),g=JSON.stringify(u._unchangedStyles);p.length<h.style.length&&(p+g).split("var(").length===h.style.split("var(").length&&(h.style=u.styleDiff)}const f=this.mirror.getId(u.node);!t.has(f)&&this.mirror.has(f)&&a.push({id:f,attributes:h})}const c={texts:l,attributes:a,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))}),y(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(I.childNodes(e),i=>I.textContent(i)||"").join("");t.attributes.value=lr({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:ur(e),value:r,maskInputFn:this.maskInputFn})}),y(this,"processMutation",e=>{if(!Jr(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=I.textContent(e.target);!K(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:xn(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Jo(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 o=ur(t);i=lr({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:o,value:i,maskInputFn:this.maskInputFn})}if(K(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"),!In(t.tagName,r))if(n.attributes[r]=vn(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 o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(const l of Array.from(t.style)){const a=t.style.getPropertyValue(l),c=t.style.getPropertyPriority(l);a!==o.style.getPropertyValue(l)||c!==o.style.getPropertyPriority(l)?c===""?n.styleDiff[l]=a:n.styleDiff[l]=[a,c]:n._unchangedStyles[l]=[a,c]}for(const l of Array.from(o.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(K(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}for(let o=0;o<e.addedNodes.length;o++)this.genAdds(e.addedNodes[o],e.target);const t=it(e.target)?this.mirror.getId(I.host(e.target)):this.mirror.getId(e.target);if(K(e.target,this.blockClass,this.blockSelector,!1))return;const r=this.addedSet.has(e.target),i=Xo(e.target,this.mirror),n=it(e.target)&&nt(e.target)?!0:void 0;for(let o=0;o<e.removedNodes.length;o++){const l=e.removedNodes[o],a=this.mirror.getId(l);if(Jr(l,this.mirror,this.slimDOMOptions)||!_f(l,this.mirror))return;this.addedSet.has(l)?($s(this.addedSet,l),this.droppedSet.add(l)):r&&a===-1||i||(this.movedSet.has(l)&&this.movedMap[en(a,t)]?$s(this.movedSet,l):(this.removes.push({parentId:t,id:a,isShadow:n}),Zf(l,this.removesSubTreeCache))),this.mapRemoves.push(l)}break}}}),y(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(Jr(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[en(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);if(!K(e,this.blockClass,this.blockSelector,!1)){const r=I.childNodes(e);for(let i=0;i<r.length;i++)this.genAdds(r[i]);if(Rs(e)){const i=I.childNodes(I.shadowRoot(e));for(let n=0;n<i.length;n++){const o=i[n];this.processedNodeManager.add(o,this),this.genAdds(o,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 $s(s,e){s.delete(e);const t=I.childNodes(e);for(let r=0;r<t.length;r++)$s(s,t[r])}function Zf(s,e){const t=[s];for(;t.length;){const r=t.pop();if(e.has(r))continue;e.add(r);const i=I.childNodes(r);for(let n=0;n<i.length;n++)t.push(i[n])}}function tn(s,e,t){return s.size===0?!1:Jf(s,e)}function Jf(s,e,t){const r=I.parentNode(e);return r?s.has(r):!1}function rn(s,e){return s.size===0?!1:na(s,e)}function na(s,e){const t=I.parentNode(e);return t?s.has(t)?!0:na(s,t):!1}const Oe=[];function xt(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 oa(s,e){const t=new Yf;Oe.push(t),t.init(s);const r=new(fn())(A(t.processMutations.bind(t)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function Xf({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 o=[],l;const a=bt(A(h=>{const f=Date.now()-l;s(o.map(p=>(p.timeOffset-=f,p)),h),o=[],l=null}),n),c=A(bt(A(h=>{const f=xt(h),{clientX:p,clientY:g}=Os(h)?h.changedTouches[0]:h;l||(l=Sr()),o.push({x:p,y:g,id:r.getId(f),timeOffset:Sr()-l}),a(typeof DragEvent!="undefined"&&h instanceof DragEvent?x.Drag:h instanceof MouseEvent?x.MouseMove:x.TouchMove)}),i,{trailing:!1})),u=[X("mousemove",c,t),X("touchmove",c,t),X("drag",c,t)];return A(()=>{u.forEach(h=>h())})}function Kf({mouseInteractionCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){if(n.mouseInteraction===!1)return()=>{};const o=n.mouseInteraction===!0||n.mouseInteraction===void 0?{}:n.mouseInteraction,l=[];let a=null;const c=u=>h=>{const f=xt(h);if(K(f,r,i,!0))return;let p=null,g=u;if("pointerType"in h){switch(h.pointerType){case"mouse":p=ge.Mouse;break;case"touch":p=ge.Touch;break;case"pen":p=ge.Pen;break}p===ge.Touch?q[u]===q.MouseDown?g="TouchStart":q[u]===q.MouseUp&&(g="TouchEnd"):ge.Pen}else Os(h)&&(p=ge.Touch);p!==null?(a=p,(g.startsWith("Touch")&&p===ge.Touch||g.startsWith("Mouse")&&p===ge.Mouse)&&(p=null)):q[u]===q.Click&&(p=a,a=null);const m=Os(h)?h.changedTouches[0]:h;if(!m)return;const d=t.getId(f),{clientX:w,clientY:b}=m;A(s)(M({type:q[g],id:d,x:w,y:b},p!==null&&{pointerType:p}))};return Object.keys(q).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&o[u]!==!1).forEach(u=>{let h=Re(u);const f=c(u);if(window.PointerEvent)switch(q[u]){case q.MouseDown:case q.MouseUp:h=h.replace("mouse","pointer");break;case q.TouchStart:case q.TouchEnd:return}l.push(X(h,f,e))}),A(()=>{l.forEach(u=>u())})}function aa({scrollCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,sampling:n}){const o=A(bt(A(l=>{const a=xt(l);if(!a||K(a,r,i,!0))return;const c=t.getId(a);if(a===e&&e.defaultView){const u=Ho(e.defaultView);s({id:c,x:u.left,y:u.top})}else s({id:c,x:a.scrollLeft,y:a.scrollTop})}),n.scroll||100));return X("scroll",o,e)}function qf({viewportResizeCb:s},{win:e}){let t=-1,r=-1;const i=A(bt(A(()=>{const n=Yo(),o=Zo();(t!==n||r!==o)&&(s({width:Number(o),height:Number(n)}),t=n,r=o)}),200));return X("resize",i,e)}const Qf=["INPUT","TEXTAREA","SELECT"],sn=new WeakMap;function ed({inputCb:s,doc:e,mirror:t,blockClass:r,blockSelector:i,ignoreClass:n,ignoreSelector:o,maskInputOptions:l,maskInputFn:a,sampling:c,userTriggeredOnInput:u}){function h(b){let S=xt(b);const R=b.isTrusted,U=S&&S.tagName;if(S&&U==="OPTION"&&(S=I.parentElement(S)),!S||!U||Qf.indexOf(U)<0||K(S,r,i,!0)||S.classList.contains(n)||o&&S.matches(o))return;let z=S.value,H=!1;const P=ur(S)||"";P==="radio"||P==="checkbox"?H=S.checked:(l[U.toLowerCase()]||l[P])&&(z=lr({element:S,maskInputOptions:l,tagName:U,type:P,value:z,maskInputFn:a})),f(S,u?{text:z,isChecked:H,userTriggered:R}:{text:z,isChecked:H});const W=S.name;P==="radio"&&W&&H&&e.querySelectorAll(`input[type="radio"][name="${W}"]`).forEach(V=>{if(V!==S){const ee=V.value;f(V,u?{text:ee,isChecked:!H,userTriggered:!1}:{text:ee,isChecked:!H})}})}function f(b,S){const R=sn.get(b);if(!R||R.text!==S.text||R.isChecked!==S.isChecked){sn.set(b,S);const U=t.getId(b);A(s)(re(M({},S),{id:U}))}}const g=(c.input==="last"?["change"]:["input","change"]).map(b=>X(b,A(h),e)),m=e.defaultView;if(!m)return()=>{g.forEach(b=>b())};const d=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),w=[[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 d&&d.set&&g.push(...w.map(b=>Tr(b[0],b[1],{set(){A(h)({target:this,isTrusted:!1})}},!1,m))),A(()=>{g.forEach(b=>b())})}function Cr(s){const e=[];function t(r,i){if(Zt("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Zt("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Zt("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Zt("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){const o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return t(s,e)}function Ce(s,e,t){let r,i;return s?(s.ownerNode?r=e.getId(s.ownerNode):i=t.getId(s),{styleId:i,id:r}):{}}function td({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:A((u,h,f)=>{const[p,g]=f,{id:m,styleId:d}=Ce(h,e,t.styleMirror);return(m&&m!==-1||d&&d!==-1)&&s({id:m,styleId:d,adds:[{rule:p,index:g}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,f=this.cssRules.length){const p=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[p,f])};const n=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(n,{apply:A((u,h,f)=>{const[p]=f,{id:g,styleId:m}=Ce(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,removes:[{index:p}]}),u.apply(h,f)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:A((u,h,f)=>{const[p]=f,{id:g,styleId:m}=Ce(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replace:p}),u.apply(h,f)})}));let l;r.CSSStyleSheet.prototype.replaceSync&&(l=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:A((u,h,f)=>{const[p]=f,{id:g,styleId:m}=Ce(h,e,t.styleMirror);return(g&&g!==-1||m&&m!==-1)&&s({id:g,styleId:m,replaceSync:p}),u.apply(h,f)})}));const a={};Jt("CSSGroupingRule")?a.CSSGroupingRule=r.CSSGroupingRule:(Jt("CSSMediaRule")&&(a.CSSMediaRule=r.CSSMediaRule),Jt("CSSConditionRule")&&(a.CSSConditionRule=r.CSSConditionRule),Jt("CSSSupportsRule")&&(a.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(a).forEach(([u,h])=>{c[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(c[u].insertRule,{apply:A((f,p,g)=>{const[m,d]=g,{id:w,styleId:b}=Ce(p.parentStyleSheet,e,t.styleMirror);return(w&&w!==-1||b&&b!==-1)&&s({id:w,styleId:b,adds:[{rule:m,index:[...Cr(p),d||0]}]}),f.apply(p,g)})}),h.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:A((f,p,g)=>{const[m]=g,{id:d,styleId:w}=Ce(p.parentStyleSheet,e,t.styleMirror);return(d&&d!==-1||w&&w!==-1)&&s({id:d,styleId:w,removes:[{index:[...Cr(p),m]}]}),f.apply(p,g)})})}),A(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=n,o&&(r.CSSStyleSheet.prototype.replace=o),l&&(r.CSSStyleSheet.prototype.replaceSync=l),Object.entries(a).forEach(([u,h])=>{h.prototype.insertRule=c[u].insertRule,h.prototype.deleteRule=c[u].deleteRule})})}function la({mirror:s,stylesheetManager:e},t){var r,i,n;let o=null;t.nodeName==="#document"?o=s.getId(t):o=s.getId(I.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,a=l!=null&&l.prototype?Object.getOwnPropertyDescriptor(l==null?void 0:l.prototype,"adoptedStyleSheets"):void 0;return o===null||o===-1||!l||!a?()=>{}:(Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var c;return(c=a.get)==null?void 0:c.call(this)},set(c){var u;const h=(u=a.set)==null?void 0:u.call(this,c);if(o!==null&&o!==-1)try{e.adoptStyleSheets(c,o)}catch(f){}return h}}),A(()=>{Object.defineProperty(t,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})}))}function rd({styleDeclarationCb:s,mirror:e,ignoreCSSAttributes:t,stylesheetManager:r},{win:i}){const n=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(n,{apply:A((l,a,c)=>{var u;const[h,f,p]=c;if(t.has(h))return n.apply(a,[h,f,p]);const{id:g,styleId:m}=Ce((u=a.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:f,priority:p},index:Cr(a.parentRule)}),l.apply(a,c)})});const o=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:A((l,a,c)=>{var u;const[h]=c;if(t.has(h))return o.apply(a,[h]);const{id:f,styleId:p}=Ce((u=a.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(f&&f!==-1||p&&p!==-1)&&s({id:f,styleId:p,remove:{property:h},index:Cr(a.parentRule)}),l.apply(a,c)})}),A(()=>{i.CSSStyleDeclaration.prototype.setProperty=n,i.CSSStyleDeclaration.prototype.removeProperty=o})}function sd({mediaInteractionCb:s,blockClass:e,blockSelector:t,mirror:r,sampling:i,doc:n}){const o=A(a=>bt(A(c=>{const u=xt(c);if(!u||K(u,e,t,!0))return;const{currentTime:h,volume:f,muted:p,playbackRate:g,loop:m}=u;s({type:a,id:r.getId(u),currentTime:h,volume:f,muted:p,playbackRate:g,loop:m})}),i.media||500)),l=[X("play",o(Pe.Play),n),X("pause",o(Pe.Pause),n),X("seeked",o(Pe.Seeked),n),X("volumechange",o(Pe.VolumeChange),n),X("ratechange",o(Pe.RateChange),n)];return A(()=>{l.forEach(a=>a())})}function id({fontCb:s,doc:e}){const t=e.defaultView;if(!t)return()=>{};const r=[],i=new WeakMap,n=t.FontFace;t.FontFace=function(a,c,u){const h=new n(a,c,u);return i.set(h,{family:a,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),h};const o=Ee(e.fonts,"add",function(l){return function(a){return setTimeout(A(()=>{const c=i.get(a);c&&(s(c),i.delete(a))}),0),l.apply(this,[a])}});return r.push(()=>{t.FontFace=n}),r.push(o),A(()=>{r.forEach(l=>l())})}function nd(s){const{doc:e,mirror:t,blockClass:r,blockSelector:i,selectionCb:n}=s;let o=!0;const l=A(()=>{const a=e.getSelection();if(!a||o&&(a!=null&&a.isCollapsed))return;o=a.isCollapsed||!1;const c=[],u=a.rangeCount||0;for(let h=0;h<u;h++){const f=a.getRangeAt(h),{startContainer:p,startOffset:g,endContainer:m,endOffset:d}=f;K(p,r,i,!0)||K(m,r,i,!0)||c.push({start:t.getId(p),startOffset:g,end:t.getId(m),endOffset:d})}n({ranges:c})});return l(),X("selectionchange",l)}function od({doc:s,customElementCb:e}){const t=s.defaultView;return!t||!t.customElements?()=>{}:Ee(t.customElements,"define",function(i){return function(n,o,l){try{e({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return i.apply(this,[n,o,l])}})}function ad(s,e){const{mutationCb:t,mousemoveCb:r,mouseInteractionCb:i,scrollCb:n,viewportResizeCb:o,inputCb:l,mediaInteractionCb:a,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:h,fontCb:f,selectionCb:p,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),o(...m)},s.inputCb=(...m)=>{e.input&&e.input(...m),l(...m)},s.mediaInteractionCb=(...m)=>{e.mediaInteaction&&e.mediaInteaction(...m),a(...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),f(...m)},s.selectionCb=(...m)=>{e.selection&&e.selection(...m),p(...m)},s.customElementCb=(...m)=>{e.customElement&&e.customElement(...m),g(...m)}}function ld(s,e={}){const t=s.doc.defaultView;if(!t)return()=>{};ad(s,e);let r;s.recordDOM&&(r=oa(s,s.doc));const i=Xf(s),n=Kf(s),o=aa(s),l=qf(s,{win:t}),a=ed(s),c=sd(s);let u=()=>{},h=()=>{},f=()=>{},p=()=>{};s.recordDOM&&(u=td(s,{win:t}),h=la(s,s.doc),f=rd(s,{win:t}),s.collectFonts&&(p=id(s)));const g=nd(s),m=od(s),d=[];for(const w of s.plugins)d.push(w.observer(w.callback,t,w.options));return A(()=>{Oe.forEach(w=>w.reset()),r==null||r.disconnect(),i(),n(),o(),l(),a(),c(),u(),h(),f(),p(),g(),m(),d.forEach(w=>w())})}function Zt(s){return typeof window[s]!="undefined"}function Jt(s){return!!(typeof window[s]!="undefined"&&window[s].prototype&&"insertRule"in window[s].prototype&&"deleteRule"in window[s].prototype)}var Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ud=typeof Uint8Array=="undefined"?[]:new Uint8Array(256);for(var Xt=0;Xt<Ue.length;Xt++)ud[Ue.charCodeAt(Xt)]=Xt;var cd=function(s){var e=new Uint8Array(s),t,r=e.length,i="";for(t=0;t<r;t+=3)i+=Ue[e[t]>>2],i+=Ue[(e[t]&3)<<4|e[t+1]>>4],i+=Ue[(e[t+1]&15)<<2|e[t+2]>>6],i+=Ue[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 nn=new Map;function hd(s,e){let t=nn.get(s);return t||(t=new Map,nn.set(s,t)),t.has(e)||t.set(e,[]),t.get(e)}const ua=(s,e,t)=>{if(!s||!(ha(s,e)||typeof s=="object"))return;const r=s.constructor.name,i=hd(t,r);let n=i.indexOf(s);return n===-1&&(n=i.length,i.push(s)),n};function ar(s,e,t){if(s instanceof Array)return s.map(r=>ar(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=cd(s);return{rr_type:r,base64:i}}else{if(s instanceof DataView)return{rr_type:s.constructor.name,args:[ar(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:[ar(s.data,e,t),s.width,s.height]};if(ha(s,e)||typeof s=="object"){const r=s.constructor.name,i=ua(s,e,t);return{rr_type:r,index:i}}}}return s}const ca=(s,e,t)=>s.map(r=>ar(r,e,t)),ha=(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 fd(s,e,t,r){const i=[],n=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const o of n)try{if(typeof e.CanvasRenderingContext2D.prototype[o]!="function")continue;const l=Ee(e.CanvasRenderingContext2D.prototype,o,function(a){return function(...c){return K(this.canvas,t,r,!0)||setTimeout(()=>{const u=ca(c,e,this);s(this.canvas,{type:ze["2D"],property:o,args:u})},0),a.apply(this,c)}});i.push(l)}catch(l){const a=Tr(e.CanvasRenderingContext2D.prototype,o,{set(c){s(this.canvas,{type:ze["2D"],property:o,args:[c],setter:!0})}});i.push(a)}return()=>{i.forEach(o=>o())}}function dd(s){return s==="experimental-webgl"?"webgl":s}function on(s,e,t,r){const i=[];try{const n=Ee(s.HTMLCanvasElement.prototype,"getContext",function(o){return function(l,...a){if(!K(this,e,t,!0)){const c=dd(l);if("__context"in this||(this.__context=c),r&&["webgl","webgl2"].includes(c))if(a[0]&&typeof a[0]=="object"){const u=a[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[l,...a])}});i.push(n)}catch(n){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(n=>n())}}function an(s,e,t,r,i,n){const o=[],l=Object.getOwnPropertyNames(s);for(const a of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(a))try{if(typeof s[a]!="function")continue;const c=Ee(s,a,function(u){return function(...h){const f=u.apply(this,h);if(ua(f,n,this),"tagName"in this.canvas&&!K(this.canvas,r,i,!0)){const p=ca(h,n,this),g={type:e,property:a,args:p};t(this.canvas,g)}return f}});o.push(c)}catch(c){const u=Tr(s,a,{set(h){t(this.canvas,{type:e,property:a,args:[h],setter:!0})}});o.push(u)}return o}function pd(s,e,t,r){const i=[];return i.push(...an(e.WebGLRenderingContext.prototype,ze.WebGL,s,t,r,e)),typeof e.WebGL2RenderingContext!="undefined"&&i.push(...an(e.WebGL2RenderingContext.prototype,ze.WebGL2,s,t,r,e)),()=>{i.forEach(n=>n())}}const fa="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",md=s=>Uint8Array.from(atob(s),e=>e.charCodeAt(0)),ln=typeof self!="undefined"&&self.Blob&&new Blob([md(fa)],{type:"text/javascript;charset=utf-8"});function gd(s){let e;try{if(e=ln&&(self.URL||self.webkitURL).createObjectURL(ln),!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,"+fa,{name:s==null?void 0:s.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}class yd{constructor(e){y(this,"pendingCanvasMutations",new Map),y(this,"rafStamps",{latestId:0,invokeId:null}),y(this,"mirror"),y(this,"mutationCb"),y(this,"resetObservers"),y(this,"frozen",!1),y(this,"locked",!1),y(this,"processMutation",(a,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(c)});const{sampling:t="all",win:r,blockClass:i,blockSelector:n,recordCanvas:o,dataURLOptions:l}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&t==="all"&&this.initCanvasMutationObserver(r,i,n),o&&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 o=on(t,r,i,!0),l=new Map,a=new gd;a.onmessage=g=>{const{id:m}=g.data;if(l.set(m,!1),!("base64"in g.data))return;const{base64:d,type:w,width:b,height:S}=g.data;this.mutationCb({id:m,type:ze["2D"],commands:[{property:"clearRect",args:[0,0,b,S]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:d}],type:w}]},0,0]}]})};const c=1e3/e;let u=0,h;const f=()=>{const g=[];return t.document.querySelectorAll("canvas").forEach(m=>{K(m,r,i,!0)||g.push(m)}),g},p=g=>{if(u&&g-u<c){h=requestAnimationFrame(p);return}u=g,f().forEach(async m=>{var d;const w=this.mirror.getId(m);if(l.get(w)||m.width===0||m.height===0)return;if(l.set(w,!0),["webgl","webgl2"].includes(m.__context)){const S=m.getContext(m.__context);((d=S==null?void 0:S.getContextAttributes())==null?void 0:d.preserveDrawingBuffer)===!1&&S.clear(S.COLOR_BUFFER_BIT)}const b=await createImageBitmap(m);a.postMessage({id:w,bitmap:b,width:m.width,height:m.height,dataURLOptions:n.dataURLOptions},[b])}),h=requestAnimationFrame(p)};h=requestAnimationFrame(p),this.resetObservers=()=>{o(),cancelAnimationFrame(h)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=on(e,t,r,!1),n=fd(this.processMutation.bind(this),e,t,r),o=pd(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{i(),n(),o()}}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(o=>{const c=o,{type:l}=c;return Te(c,["type"])}),{type:n}=r[0];this.mutationCb({id:t,type:n,commands:i}),this.pendingCanvasMutations.delete(e)}}class wd{constructor(){y(this,"nodeMap",new WeakMap),y(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(){}}class bd{constructor(e){y(this,"shadowDoms",new WeakSet),y(this,"mutationCb"),y(this,"scrollCb"),y(this,"bypassOptions"),y(this,"mirror"),y(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(!nt(e)||!Es.canRegisterShadowRootObserver(e)||this.shadowDoms.has(e))return;this.shadowDoms.add(e),Q("Adding mutation observer for shadowRoot",e.host,"restoreHandlers",this.restoreHandlers.length);const r=oa(re(M({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(aa(re(M({},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(I.host(e))),this.restoreHandlers.push(la({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(Ee(e.prototype,"attachShadow",function(i){return function(n){const o=i.call(this,n),l=I.shadowRoot(this);return l&&ea(this)&&r.addShadowRoot(l,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}class Sd{constructor(e){y(this,"trackedLinkElements",new WeakSet),y(this,"mutationCb"),y(this,"adoptedStyleSheetCb"),y(this,"styleMirror",new Pf),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 o;this.styleMirror.has(n)?o=this.styleMirror.getId(n):(o=this.styleMirror.add(n),i.push({styleId:o,rules:Array.from(n.rules||CSSRule,(l,a)=>({rule:yn(l,n.href),index:a}))})),r.styleIds.push(o)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}let B,st,Xr,ut=!1;try{if(Array.from([1],s=>s*2)[0]!==2){const s=document.createElement("iframe");document.body.appendChild(s),Array.from=((ai=s.contentWindow)==null?void 0:ai.Array.from)||Array.from,document.body.removeChild(s)}}catch(s){at()&&console.debug("Unable to override Array.from",s)}const oe=qa();function xe(s={}){const{emit:e,checkoutEveryNms:t,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:n=null,ignoreClass:o="rr-ignore",ignoreSelector:l=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,hooks:d,packFn:w,sampling:b={},dataURLOptions:S={},mousemoveWait:R,recordDOM:U=!0,recordCanvas:z=!1,recordCrossOriginIframes:H=!1,recordAfter:P=s.recordAfter==="DOMContentLoaded"?s.recordAfter:"load",userTriggeredOnInput:W=!1,collectFonts:V=!1,inlineImages:ee=!1,plugins:ue,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:Je=new Set([]),errorHandler:Xe}=s;Bf(Xe);const G=H?window.parent===window:!0;let te=!1;if(!G)try{window.parent.document&&(te=!1)}catch(N){te=!0}if(G&&!e)throw new Error("emit function is required");if(!G&&!te)return()=>{};R!==void 0&&b.mousemove===void 0&&(b.mousemove=R),oe.reset();const be=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}:f!==void 0?f:{password:!0},ce=p===!0||p==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:p==="all",headMetaDescKeywords:p==="all",headTitleMutations:p==="all"}:p||{};Lf();let Mt,Me=0;const ti=N=>{for(const ie of ue||[])ie.eventProcessor&&(N=ie.eventProcessor(N));return w&&!te&&(N=w(N)),N};B=(N,ie,L)=>{var ke;var he;const Y=N;if(Y.timestamp=(ke=L==null?void 0:L.overrideTimestamp)!=null?ke:Sr(),(he=Oe[0])!=null&&he.isFrozen()&&Y.type!==O.FullSnapshot&&!(Y.type===O.IncrementalSnapshot&&Y.data.source===x.Mutation)&&Oe.forEach(Z=>Z.unfreeze()),G)e==null||e(ti(Y),ie);else if(te){const Z={type:"rrweb",event:ti(Y),origin:window.location.origin,isCheckout:ie};window.parent.postMessage(Z,"*")}if(Y.type===O.FullSnapshot)Mt=Y,Me=0;else if(Y.type===O.IncrementalSnapshot){if(Y.data.source===x.Mutation&&Y.data.isAttachIframe)return;Me++;const Z=r&&Me>=r,ne=t&&Y.timestamp-Mt.timestamp>t;(Z||ne)&&st(!0)}};const At=N=>{B({type:O.IncrementalSnapshot,data:M({source:x.Mutation},N)})},ri=N=>B({type:O.IncrementalSnapshot,data:M({source:x.Scroll},N)}),si=N=>B({type:O.IncrementalSnapshot,data:M({source:x.CanvasMutation},N)}),da=N=>B({type:O.IncrementalSnapshot,data:M({source:x.AdoptedStyleSheet},N)}),Ae=new Sd({mutationCb:At,adoptedStyleSheetCb:da}),Se=new Wf({mirror:oe,mutationCb:At,stylesheetManager:Ae,recordCrossOriginIframes:H,wrappedEmit:B});for(const N of ue||[])N.getMirror&&N.getMirror({nodeMirror:oe,crossOriginIframeMirror:Se.crossOriginIframeMirror,crossOriginIframeStyleMirror:Se.crossOriginIframeStyleMirror});const _r=new wd;Xr=new yd({recordCanvas:z,mutationCb:si,win:window,blockClass:i,blockSelector:n,mirror:oe,sampling:b.canvas,dataURLOptions:S});const Ot=new bd({mutationCb:At,scrollCb:ri,bypassOptions:{blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:be,dataURLOptions:S,maskTextFn:m,maskInputFn:g,recordCanvas:z,inlineImages:ee,sampling:b,slimDOMOptions:ce,iframeManager:Se,stylesheetManager:Ae,canvasManager:Xr,keepIframeSrcFn:E,processedNodeManager:_r},mirror:oe});st=(N=!1)=>{if(!U)return;B({type:O.Meta,data:{href:window.location.href,width:Zo(),height:Yo()}},N),Ae.reset(),Ot.init(),Oe.forEach(L=>L.lock());const ie=Dl(document,{mirror:oe,blockClass:i,blockSelector:n,maskTextClass:a,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:be,maskTextFn:m,maskInputFn:g,slimDOM:ce,dataURLOptions:S,recordCanvas:z,inlineImages:ee,onSerialize:L=>{Ko(L,oe)&&Se.addIframe(L),qo(L,oe)&&Ae.trackLinkElement(L),Rs(L)&&Ot.addShadowRoot(I.shadowRoot(L),document)},onIframeLoad:(L,he)=>{Se.attachIframe(L,he),Ot.observeAttachShadow(L)},onStylesheetLoad:(L,he)=>{Ae.attachLinkElement(L,he)},keepIframeSrcFn:E});if(!ie){at()&&console.warn("Failed to snapshot the document");return}B({type:O.FullSnapshot,data:{node:ie,initialOffset:Ho(window)}},N),Oe.forEach(L=>L.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ae.adoptStyleSheets(document.adoptedStyleSheets,oe.getId(document))};try{const N=[],ie=Z=>{var ne;return A(ld)({mutationCb:At,mousemoveCb:($,Lr)=>B({type:O.IncrementalSnapshot,data:{source:Lr,positions:$}}),mouseInteractionCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.MouseInteraction},$)}),scrollCb:ri,viewportResizeCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.ViewportResize},$)}),inputCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.Input},$)}),mediaInteractionCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.MediaInteraction},$)}),styleSheetRuleCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.StyleSheetRule},$)}),styleDeclarationCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.StyleDeclaration},$)}),canvasMutationCb:si,fontCb:$=>B({type:O.IncrementalSnapshot,data:M({source:x.Font},$)}),selectionCb:$=>{B({type:O.IncrementalSnapshot,data:M({source:x.Selection},$)})},customElementCb:$=>{B({type:O.IncrementalSnapshot,data:M({source:x.CustomElement},$)})},blockClass:i,ignoreClass:o,ignoreSelector:l,maskTextClass:a,maskTextSelector:c,maskInputOptions:be,inlineStylesheet:u,sampling:b,recordDOM:U,recordCanvas:z,inlineImages:ee,userTriggeredOnInput:W,collectFonts:V,doc:Z,maskInputFn:g,maskTextFn:m,keepIframeSrcFn:E,blockSelector:n,slimDOMOptions:ce,dataURLOptions:S,mirror:oe,iframeManager:Se,stylesheetManager:Ae,shadowDomManager:Ot,processedNodeManager:_r,canvasManager:Xr,ignoreCSSAttributes:Je,plugins:((ne=ue==null?void 0:ue.filter($=>$.observer))==null?void 0:ne.map($=>({observer:$.observer,options:$.options,callback:Lr=>B({type:O.Plugin,data:{plugin:$.name,payload:Lr}})})))||[]},d)},L={};Se.addLoadListener(Z=>{try{Es.observeIframe(Z.contentDocument,ne=>{const $=ie(Z.contentDocument);L[ne]=$,Q(Z.contentDocument,"did register handler on iframe. current registered handlers",Object.keys(L).length)},ne=>{const $=L[ne];$&&$(),delete L[ne],Q(Z.contentDocument,"did cleanup for regisited handler on iframe. current registered handlers",Object.keys(L).length)})}catch(ne){at()&&(console.warn("internal error"),console.warn(ne))}});let he=null;const Y=()=>{he=Date.now(),st(),N.push(ie(document)),ut=!0},ke=()=>{window.removeEventListener("load",ke),!(!ut||he==null)&&(Date.now()-he<=10||st())};return window.addEventListener("load",ke),document.readyState==="interactive"||document.readyState==="complete"?(document.readyState==="complete"&&window.removeEventListener("load",ke),Y()):(N.push(X("DOMContentLoaded",()=>{B({type:O.DomContentLoaded,data:{}}),P==="DOMContentLoaded"&&Y()})),N.push(X("load",()=>{B({type:O.Load,data:{}}),P==="load"&&Y()},window))),()=>{N.forEach(Z=>Z()),Object.values(L).forEach(Z=>Z()),_r.destroy(),Se.destroy(),Es.destroy(),ut=!1,Uf()}}catch(N){at()&&(console.warn("internal error1"),console.warn(N))}}xe.addCustomEvent=(s,e)=>{if(!ut)throw new Error("please add custom event after start recording");B({type:O.Custom,data:{tag:s,payload:e}})};xe.freezePage=()=>{Oe.forEach(s=>s.freeze())};xe.takeFullSnapshot=s=>{if(!ut)throw new Error("please take full snapshot after start recording");st(s)};xe.mirror=oe;var un;(function(s){s[s.NotStarted=0]="NotStarted",s[s.Running=1]="Running",s[s.Stopped=2]="Stopped"})(un||(un={}));const{addCustomEvent:tp}=xe,{freezePage:rp}=xe,{takeFullSnapshot:Cd}=xe;exports.record=xe;
|
|
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") {
|