UNPKG

testchimp-js

Version:

TestChimp SDK for JS

2 lines 219 kB
/*! For license information please see testchimp-sdk.cjs.js.LICENSE.txt */ !function(){"use strict";var e,t={d:function(e,a){for(var o in a)t.o(a,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:a[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};function o(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function n(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function s(e){try{var t=e.rules||e.cssRules;return t?((a=Array.from(t).map(i).join("")).includes(" background-clip: text;")&&!a.includes(" -webkit-background-clip: text;")&&(a=a.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),a):null}catch(e){return null}var a}function i(e){var t=e.cssText;if(function(e){return"styleSheet"in e}(e))try{t=s(e.styleSheet)||t}catch(e){}return t}t.r(a),t.d(a,{TestChimpSDK:function(){return za},default:function(){return Ta}}),function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));var r=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var a=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=a?a:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,a=this.getId(e);this.idNodeMap.delete(a),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var a=t.id;this.idNodeMap.set(a,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var a=this.getNode(e);if(a){var o=this.nodeMetaMap.get(a);o&&this.nodeMetaMap.set(t,o)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function l(e){var t=e.maskInputOptions,a=e.tagName,o=e.type,n=e.value,s=e.maskInputFn,i=n||"";return(t[a.toLowerCase()]||t[o])&&(i=s?s(i):"*".repeat(i.length)),i}var c,u,d="__rrweb_original__",m=1,h=new RegExp("[^a-z0-9-_:]"),g=-2;function p(){return m++}var f=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,k=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,b=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(f,(function(e,a,o,n,s,i){var r,l=o||s||i,c=a||n||"";if(!l)return e;if(!k.test(l))return"url(".concat(c).concat(l).concat(c,")");if(b.test(l))return"url(".concat(c).concat(l).concat(c,")");if("/"===l[0])return"url(".concat(c).concat((r=t,(r.indexOf("//")>-1?r.split("/").slice(0,3).join("/"):r.split("/")[0]).split("?")[0]+l)).concat(c,")");var u=t.split("/"),d=l.split("/");u.pop();for(var m=0,h=d;m<h.length;m++){var g=h[m];"."!==g&&(".."===g?u.pop():u.push(g))}return"url(".concat(c).concat(u.join("/")).concat(c,")")}))}var v=/^[^ \t\n\r\u000c]+/,w=/^[, \t\n\r\u000c]+/;function x(e,t){if(!t||""===t.trim())return t;var a=e.createElement("a");return a.href=t,a.href}function I(){var e=document.createElement("a");return e.href="",e.href}function C(e,t,a,o){return"src"===a||"href"===a&&o&&("use"!==t||"#"!==o[0])||"xlink:href"===a&&o&&"#"!==o[0]?x(e,o):"background"!==a||!o||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===a&&o?function(e,t){if(""===t.trim())return t;var a=0;function o(e){var o,n=e.exec(t.substring(a));return n?(o=n[0],a+=o.length,o):""}for(var n=[];o(w),!(a>=t.length);){var s=o(v);if(","===s.slice(-1))s=x(e,s.substring(0,s.length-1)),n.push(s);else{var i="";s=x(e,s);for(var r=!1;;){var l=t.charAt(a);if(""===l){n.push((s+i).trim());break}if(r)")"===l&&(r=!1);else{if(","===l){a+=1,n.push((s+i).trim());break}"("===l&&(r=!0)}i+=l,a+=1}}}return n.join(", ")}(e,o):"style"===a&&o?y(o,I()):"object"===t&&"data"===a&&o?x(e,o):o:x(e,o)}function S(e,t,a){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!a&&S(e.parentNode,t,a);for(var o=e.classList.length;o--;){var n=e.classList[o];if(t.test(n))return!0}return!!a&&S(e.parentNode,t,a)}function A(e,t,a){var o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===o)return!1;if("string"==typeof t){if(o.classList.contains(t))return!0;if(o.closest(".".concat(t)))return!0}else if(S(o,t,!0))return!0;if(a){if(o.matches(a))return!0;if(o.closest(a))return!0}return!1}function j(e){return void 0===e?"":e.toLowerCase()}function z(t,a){var i,r=a.doc,m=a.mirror,f=a.blockClass,k=a.blockSelector,b=a.maskTextClass,v=a.maskTextSelector,w=a.skipChild,x=void 0!==w&&w,S=a.inlineStylesheet,T=void 0===S||S,M=a.maskInputOptions,R=void 0===M?{}:M,q=a.maskTextFn,E=a.maskInputFn,O=a.slimDOMOptions,L=a.dataURLOptions,N=void 0===L?{}:L,D=a.inlineImages,F=void 0!==D&&D,B=a.recordCanvas,W=void 0!==B&&B,P=a.onSerialize,U=a.onIframeLoad,G=a.iframeLoadTimeout,_=void 0===G?5e3:G,V=a.onStylesheetLoad,Z=a.stylesheetLoadTimeout,K=void 0===Z?5e3:Z,H=a.keepIframeSrcFn,J=void 0===H?function(){return!1}:H,Y=a.newlyAddedElement,X=void 0!==Y&&Y,Q=a.preserveWhiteSpace,$=void 0===Q||Q,ee=function(t,a){var o=a.doc,n=a.mirror,i=a.blockClass,r=a.blockSelector,m=a.maskTextClass,g=a.maskTextSelector,p=a.inlineStylesheet,f=a.maskInputOptions,k=void 0===f?{}:f,b=a.maskTextFn,v=a.maskInputFn,w=a.dataURLOptions,x=void 0===w?{}:w,S=a.inlineImages,j=a.recordCanvas,z=a.keepIframeSrcFn,T=a.newlyAddedElement,M=void 0!==T&&T,R=function(e,t){if(t.hasNode(e)){var a=t.getId(e);return 1===a?void 0:a}}(o,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode}:{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:R};case t.ELEMENT_NODE:return function(t,a){for(var o=a.doc,n=a.inlineStylesheet,i=a.maskInputOptions,r=void 0===i?{}:i,m=a.maskInputFn,g=a.dataURLOptions,p=void 0===g?{}:g,f=a.inlineImages,k=a.recordCanvas,b=a.keepIframeSrcFn,v=a.newlyAddedElement,w=void 0!==v&&v,x=a.rootId,S=function(e,t,a){if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var o=e.classList.length;o--;){var n=e.classList[o];if(t.test(n))return!0}return!!a&&e.matches(a)}(t,a.blockClass,a.blockSelector),A=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return h.test(t)?"div":t}(t),j={},z=t.attributes.length,T=0;T<z;T++){var M=t.attributes[T];j[M.name]=C(o,A,M.name,M.value)}if("link"===A&&n){var R=Array.from(o.styleSheets).find((function(e){return e.href===t.href})),q=null;R&&(q=s(R)),q&&(delete j.rel,delete j.href,j._cssText=y(q,R.href))}if("style"===A&&t.sheet&&!(t.innerText||t.textContent||"").trim().length&&(q=s(t.sheet))&&(j._cssText=y(q,I())),"input"===A||"textarea"===A||"select"===A){var E=t.value,O=t.checked;"radio"!==j.type&&"checkbox"!==j.type&&"submit"!==j.type&&"button"!==j.type&&E?j.value=l({type:j.type,tagName:A,value:E,maskInputOptions:r,maskInputFn:m}):O&&(j.checked=O)}if("option"===A&&(t.selected&&!r.select?j.selected=!0:delete j.selected),"canvas"===A&&k)if("2d"===t.__context)(function(e){var t=e.getContext("2d");if(!t)return!0;for(var a=0;a<e.width;a+=50)for(var o=0;o<e.height;o+=50){var n=t.getImageData,s=d in n?n[d]:n;if(new Uint32Array(s.call(t,a,o,Math.min(50,e.width-a),Math.min(50,e.height-o)).data.buffer).some((function(e){return 0!==e})))return!1}return!0})(t)||(j.rr_dataURL=t.toDataURL(p.type,p.quality));else if(!("__context"in t)){var L=t.toDataURL(p.type,p.quality),N=document.createElement("canvas");N.width=t.width,N.height=t.height,L!==N.toDataURL(p.type,p.quality)&&(j.rr_dataURL=L)}if("img"===A&&f){c||(c=o.createElement("canvas"),u=c.getContext("2d"));var D=t,F=D.crossOrigin;D.crossOrigin="anonymous";var B=function(){try{c.width=D.naturalWidth,c.height=D.naturalHeight,u.drawImage(D,0,0),j.rr_dataURL=c.toDataURL(p.type,p.quality)}catch(e){console.warn("Cannot inline img src=".concat(D.currentSrc,"! Error: ").concat(e))}F?j.crossOrigin=F:D.removeAttribute("crossorigin")};D.complete&&0!==D.naturalWidth?B():D.onload=B}if("audio"!==A&&"video"!==A||(j.rr_mediaState=t.paused?"paused":"played",j.rr_mediaCurrentTime=t.currentTime),w||(t.scrollLeft&&(j.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(j.rr_scrollTop=t.scrollTop)),S){var W=t.getBoundingClientRect(),P=W.width,U=W.height;j={class:j.class,rr_width:"".concat(P,"px"),rr_height:"".concat(U,"px")}}return"iframe"!==A||b(j.src)||(t.contentDocument||(j.rr_src=j.src),delete j.src),{type:e.Element,tagName:A,attributes:j,childNodes:[],isSVG:(G=t,Boolean("svg"===G.tagName||G.ownerSVGElement)||void 0),needBlock:S,rootId:x};var G}(t,{doc:o,blockClass:i,blockSelector:r,inlineStylesheet:p,maskInputOptions:k,maskInputFn:v,dataURLOptions:x,inlineImages:S,recordCanvas:j,keepIframeSrcFn:z,newlyAddedElement:M,rootId:R});case t.TEXT_NODE:return function(t,a){var o,n,s=a.maskTextClass,i=a.maskTextSelector,r=a.maskTextFn,l=a.rootId,c=t.parentNode&&t.parentNode.tagName,u=t.textContent,d="STYLE"===c||void 0,m="SCRIPT"===c||void 0;if(d&&u){try{t.nextSibling||t.previousSibling||(null===(o=t.parentNode.sheet)||void 0===o?void 0:o.cssRules)&&(u=(n=t.parentNode.sheet).cssRules?Array.from(n.cssRules).map((function(e){return e.cssText||""})).join(""):"")}catch(e){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(e),t)}u=y(u,I())}return m&&(u="SCRIPT_PLACEHOLDER"),!d&&!m&&u&&A(t,s,i)&&(u=r?r(u):u.replace(/[\S]/g,"*")),{type:e.Text,textContent:u||"",isStyle:d,rootId:l}}(t,{maskTextClass:m,maskTextSelector:g,maskTextFn:b,rootId:R});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:R};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:R};default:return!1}}(t,{doc:r,mirror:m,blockClass:f,blockSelector:k,maskTextClass:b,maskTextSelector:v,inlineStylesheet:T,maskInputOptions:R,maskTextFn:q,maskInputFn:E,dataURLOptions:N,inlineImages:F,recordCanvas:W,keepIframeSrcFn:J,newlyAddedElement:X});if(!ee)return console.warn(t,"not serialized"),null;i=m.hasNode(t)?m.getId(t):!function(t,a){if(a.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(a.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(a.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(j(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===j(t.attributes.name)||"icon"===j(t.attributes.rel)||"apple-touch-icon"===j(t.attributes.rel)||"shortcut icon"===j(t.attributes.rel))))return!0;if("meta"===t.tagName){if(a.headMetaDescKeywords&&j(t.attributes.name).match(/^description|keywords$/))return!0;if(a.headMetaSocial&&(j(t.attributes.property).match(/^(og|twitter|fb):/)||j(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===j(t.attributes.name)))return!0;if(a.headMetaRobots&&("robots"===j(t.attributes.name)||"googlebot"===j(t.attributes.name)||"bingbot"===j(t.attributes.name)))return!0;if(a.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(a.headMetaAuthorship&&("author"===j(t.attributes.name)||"generator"===j(t.attributes.name)||"framework"===j(t.attributes.name)||"publisher"===j(t.attributes.name)||"progid"===j(t.attributes.name)||j(t.attributes.property).match(/^article:/)||j(t.attributes.property).match(/^product:/)))return!0;if(a.headMetaVerification&&("google-site-verification"===j(t.attributes.name)||"yandex-verification"===j(t.attributes.name)||"csrf-token"===j(t.attributes.name)||"p:domain_verify"===j(t.attributes.name)||"verify-v1"===j(t.attributes.name)||"verification"===j(t.attributes.name)||"shopify-checkout-api-token"===j(t.attributes.name)))return!0}}return!1}(ee,O)&&($||ee.type!==e.Text||ee.isStyle||ee.textContent.replace(/^\s+|\s+$/gm,"").length)?p():g;var te=Object.assign(ee,{id:i});if(m.add(t,te),i===g)return null;P&&P(t);var ae=!x;if(te.type===e.Element){ae=ae&&!te.needBlock,delete te.needBlock;var oe=t.shadowRoot;oe&&n(oe)&&(te.isShadowHost=!0)}if((te.type===e.Document||te.type===e.Element)&&ae){O.headWhitespace&&te.type===e.Element&&"head"===te.tagName&&($=!1);for(var ne={doc:r,mirror:m,blockClass:f,blockSelector:k,maskTextClass:b,maskTextSelector:v,skipChild:x,inlineStylesheet:T,maskInputOptions:R,maskTextFn:q,maskInputFn:E,slimDOMOptions:O,dataURLOptions:N,inlineImages:F,recordCanvas:W,preserveWhiteSpace:$,onSerialize:P,onIframeLoad:U,iframeLoadTimeout:_,onStylesheetLoad:V,stylesheetLoadTimeout:K,keepIframeSrcFn:J},se=0,ie=Array.from(t.childNodes);se<ie.length;se++)(ce=z(ie[se],ne))&&te.childNodes.push(ce);if(function(e){return e.nodeType===e.ELEMENT_NODE}(t)&&t.shadowRoot)for(var re=0,le=Array.from(t.shadowRoot.childNodes);re<le.length;re++){var ce;(ce=z(le[re],ne))&&(n(t.shadowRoot)&&(ce.isShadow=!0),te.childNodes.push(ce))}}return t.parentNode&&o(t.parentNode)&&n(t.parentNode)&&(te.isShadow=!0),te.type===e.Element&&"iframe"===te.tagName&&function(e,t,a){var o=e.contentWindow;if(o){var n,s=!1;try{n=o.document.readyState}catch(e){return}if("complete"===n){var i="about:blank";if(o.location.href!==i||e.src===i||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}else{var r=setTimeout((function(){s||(t(),s=!0)}),a);e.addEventListener("load",(function(){clearTimeout(r),s=!0,t()}))}}}(t,(function(){var e=t.contentDocument;if(e&&U){var a=z(e,{doc:e,mirror:m,blockClass:f,blockSelector:k,maskTextClass:b,maskTextSelector:v,skipChild:!1,inlineStylesheet:T,maskInputOptions:R,maskTextFn:q,maskInputFn:E,slimDOMOptions:O,dataURLOptions:N,inlineImages:F,recordCanvas:W,preserveWhiteSpace:$,onSerialize:P,onIframeLoad:U,iframeLoadTimeout:_,onStylesheetLoad:V,stylesheetLoadTimeout:K,keepIframeSrcFn:J});a&&U(t,a)}}),_),te.type===e.Element&&"link"===te.tagName&&"stylesheet"===te.attributes.rel&&function(e,t,a){var o,n=!1;try{o=e.sheet}catch(e){return}if(!o){var s=setTimeout((function(){n||(t(),n=!0)}),a);e.addEventListener("load",(function(){clearTimeout(s),n=!0,t()}))}}(t,(function(){if(V){var e=z(t,{doc:r,mirror:m,blockClass:f,blockSelector:k,maskTextClass:b,maskTextSelector:v,skipChild:!1,inlineStylesheet:T,maskInputOptions:R,maskTextFn:q,maskInputFn:E,slimDOMOptions:O,dataURLOptions:N,inlineImages:F,recordCanvas:W,preserveWhiteSpace:$,onSerialize:P,onIframeLoad:U,iframeLoadTimeout:_,onStylesheetLoad:V,stylesheetLoadTimeout:K,keepIframeSrcFn:J});e&&V(t,e)}}),K),te}function T(e,t,a=document){const o={capture:!0,passive:!0};return a.addEventListener(e,t,o),()=>a.removeEventListener(e,t,o)}new RegExp(/([^\\]):hover/.source,"g");const M="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let R={map:{},getId(){return console.error(M),-1},getNode(){return console.error(M),null},removeNodeFromMap(){console.error(M)},has(){return console.error(M),!1},reset(){console.error(M)}};function q(e,t,a={}){let o=null,n=0;return function(...s){const i=Date.now();n||!1!==a.leading||(n=i);const r=t-(i-n),l=this;r<=0||r>t?(o&&(clearTimeout(o),o=null),n=i,e.apply(l,s)):o||!1===a.trailing||(o=setTimeout((()=>{n=!1===a.leading?0:Date.now(),o=null,e.apply(l,s)}),r))}}function E(e,t,a,o,n=window){const s=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,o?a:{set(e){setTimeout((()=>{a.set.call(this,e)}),0),s&&s.set&&s.set.call(this,e)}}),()=>E(e,t,s||{},!0)}function O(e,t,a){try{if(!(t in e))return()=>{};const o=e[t],n=a(o);return"function"==typeof n&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=n,()=>{e[t]=o}}catch(e){return()=>{}}}function L(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function N(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function D(e,t,a,o){if(!e)return!1;const n=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!n)return!1;if("string"==typeof t){if(n.classList.contains(t))return!0;if(o&&null!==n.closest("."+t))return!0}else if(S(n,t,o))return!0;if(a){if(e.matches(a))return!0;if(o&&null!==n.closest(a))return!0}return!1}function F(e,t){return t.getId(e)===g}function B(e,t){if(o(e))return!1;const a=t.getId(e);return!t.has(a)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||B(e.parentNode,t))}function W(e){return Boolean(e.changedTouches)}function P(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function U(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function G(e){return Boolean(null==e?void 0:e.shadowRoot)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(R=new Proxy(R,{get(e,t,a){return"map"===t&&console.error(M),Reflect.get(e,t,a)}}));class _{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let a;return a=void 0===t?this.id++:t,this.styleIDMap.set(e,a),this.idStyleMap.set(a,e),a}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}var V=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(V||{}),Z=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(Z||{}),K=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(K||{}),H=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(H||{});function J(e){return"__ln"in e}class Y{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let a=0;a<e;a++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&J(e.previousSibling)){const a=e.previousSibling.__ln.next;t.next=a,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,a&&(a.previous=t)}else if(e.nextSibling&&J(e.nextSibling)&&e.nextSibling.__ln.previous){const a=e.nextSibling.__ln.previous;t.previous=a,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,a&&(a.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=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.head=t.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const X=(e,t)=>`${e}@${t}`;class Q{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],t=new Y,a=e=>{let t=e,a=g;for(;a===g;)t=t&&t.nextSibling,a=t&&this.mirror.getId(t);return a},n=n=>{var s,i,r,l;let c=null;(null===(i=null===(s=n.getRootNode)||void 0===s?void 0:s.call(n))||void 0===i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&n.getRootNode().host&&(c=n.getRootNode().host);let u=c;for(;(null===(l=null===(r=null==u?void 0:u.getRootNode)||void 0===r?void 0:r.call(u))||void 0===l?void 0:l.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&u.getRootNode().host;)u=u.getRootNode().host;const d=!(this.doc.contains(n)||u&&this.doc.contains(u));if(!n.parentNode||d)return;const m=o(n.parentNode)?this.mirror.getId(c):this.mirror.getId(n.parentNode),h=a(n);if(-1===m||-1===h)return t.addNode(n);const g=z(n,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{P(e,this.mirror)&&this.iframeManager.addIframe(e),U(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),G(n)&&this.shadowDomManager.addShadowRoot(n.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});g&&e.push({parentId:m,nextId:h,node:g})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const e of Array.from(this.movedSet.values()))ee(this.removes,e,this.mirror)&&!this.movedSet.has(e.parentNode)||n(e);for(const e of Array.from(this.addedSet.values()))ae(this.droppedSet,e)||ee(this.removes,e,this.mirror)?ae(this.movedSet,e)?n(e):this.droppedSet.add(e):n(e);let s=null;for(;t.length;){let e=null;if(s){const t=this.mirror.getId(s.value.parentNode),o=a(s.value);-1!==t&&-1!==o&&(e=s)}if(!e)for(let o=t.length-1;o>=0;o--){const n=t.get(o);if(n){const t=this.mirror.getId(n.value.parentNode);if(-1===a(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const a=t.parentNode.host;if(-1!==this.mirror.getId(a)){e=n;break}}}}}if(!e){for(;t.head;)t.removeNode(t.head.value);break}s=e.previous,t.removeNode(e.value),n(e.value)}const i={texts:this.texts.map((e=>({id:this.mirror.getId(e.node),value:e.value}))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>({id:this.mirror.getId(e.node),attributes:e.attributes}))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(i.texts.length||i.attributes.length||i.removes.length||i.adds.length)&&(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(i))},this.processMutation=e=>{if(!F(e.target,this.mirror))switch(e.type){case"characterData":{const t=e.target.textContent;D(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:A(e.target,this.maskTextClass,this.maskTextSelector)&&t?this.maskTextFn?this.maskTextFn(t):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const t=e.target;let a=e.target.getAttribute(e.attributeName);if("value"===e.attributeName&&(a=l({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:a,maskInputFn:this.maskInputFn})),D(e.target,this.blockClass,this.blockSelector,!1)||a===e.oldValue)return;let o=this.attributes.find((t=>t.node===e.target));if("IFRAME"===t.tagName&&"src"===e.attributeName&&!this.keepIframeSrcFn(a)){if(t.contentDocument)return;e.attributeName="rr_src"}if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),"style"===e.attributeName){const a=this.doc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue),void 0!==o.attributes.style&&null!==o.attributes.style||(o.attributes.style={});const n=o.attributes.style;for(const e of Array.from(t.style)){const o=t.style.getPropertyValue(e),s=t.style.getPropertyPriority(e);o===a.style.getPropertyValue(e)&&s===a.style.getPropertyPriority(e)||(n[e]=""===s?o:[o,s])}for(const e of Array.from(a.style))""===t.style.getPropertyValue(e)&&(n[e]=!1)}else o.attributes[e.attributeName]=C(this.doc,t.tagName,e.attributeName,a);break}case"childList":if(D(e.target,this.blockClass,this.blockSelector,!0))return;e.addedNodes.forEach((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const a=this.mirror.getId(t),s=o(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);D(e.target,this.blockClass,this.blockSelector,!1)||F(t,this.mirror)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?($(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===a||B(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[X(a,s)]?$(this.movedSet,t):this.removes.push({parentId:s,id:a,isShadow:!(!o(e.target)||!n(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{if(this.mirror.hasNode(e)){if(F(e,this.mirror))return;this.movedSet.add(e);let a=null;t&&this.mirror.hasNode(t)&&(a=this.mirror.getId(t)),a&&-1!==a&&(this.movedMap[X(this.mirror.getId(e),a)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);D(e,this.blockClass,this.blockSelector,!1)||e.childNodes.forEach((e=>this.genAdds(e)))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager"].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 $(e,t){e.delete(t),t.childNodes.forEach((t=>$(e,t)))}function ee(e,t,a){return 0!==e.length&&te(e,t,a)}function te(e,t,a){const{parentNode:o}=t;if(!o)return!1;const n=a.getId(o);return!!e.some((e=>e.id===n))||te(e,o,a)}function ae(e,t){return 0!==e.size&&oe(e,t)}function oe(e,t){const{parentNode:a}=t;return!!a&&(!!e.has(a)||oe(e,a))}const ne=[],se="undefined"!=typeof CSSGroupingRule,ie="undefined"!=typeof CSSMediaRule,re="undefined"!=typeof CSSSupportsRule,le="undefined"!=typeof CSSConditionRule;function ce(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch(t){return e.target}}function ue(e,t){var a,o;const n=new Q;ne.push(n),n.init(e);let s=window.MutationObserver||window.__rrMutationObserver;const i=null===(o=null===(a=null===window||void 0===window?void 0:window.Zone)||void 0===a?void 0:a.__symbol__)||void 0===o?void 0:o.call(a,"MutationObserver");i&&window[i]&&(s=window[i]);const r=new s(n.processMutations.bind(n));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function de({scrollCb:e,doc:t,mirror:a,blockClass:o,blockSelector:n,sampling:s}){return T("scroll",q((s=>{const i=ce(s);if(!i||D(i,o,n,!0))return;const r=a.getId(i);if(i===t){const a=t.scrollingElement||t.documentElement;e({id:r,x:a.scrollLeft,y:a.scrollTop})}else e({id:r,x:i.scrollLeft,y:i.scrollTop})}),s.scroll||100),t)}function me(e,t){const a=Object.assign({},e);return t||delete a.userTriggered,a}const he=["INPUT","TEXTAREA","SELECT"],ge=new WeakMap;function pe(e){return function(e,t){if(se&&e.parentRule instanceof CSSGroupingRule||ie&&e.parentRule instanceof CSSMediaRule||re&&e.parentRule instanceof CSSSupportsRule||le&&e.parentRule instanceof CSSConditionRule){const a=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(a)}else if(e.parentStyleSheet){const a=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(a)}return t}(e,[])}function fe(e,t,a){let o,n;return e?(e.ownerNode?o=t.getId(e.ownerNode):n=a.getId(e),{styleId:n,id:o}):{}}function ke({mirror:e,stylesheetManager:t},a){var o,n,s;let i=null;i="#document"===a.nodeName?e.getId(a):e.getId(a.host);const r="#document"===a.nodeName?null===(o=a.defaultView)||void 0===o?void 0:o.Document:null===(s=null===(n=a.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===s?void 0:s.ShadowRoot,l=Object.getOwnPropertyDescriptor(null==r?void 0:r.prototype,"adoptedStyleSheets");return null!==i&&-1!==i&&r&&l?(Object.defineProperty(a,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null===(e=l.get)||void 0===e?void 0:e.call(this)},set(e){var a;const o=null===(a=l.set)||void 0===a?void 0:a.call(this,e);if(null!==i&&-1!==i)try{t.adoptStyleSheets(e,i)}catch(e){}return o}}),()=>{Object.defineProperty(a,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}):()=>{}}function be(e,t={}){const a=e.doc.defaultView;if(!a)return()=>{};!function(e,t){const{mutationCb:a,mousemoveCb:o,mouseInteractionCb:n,scrollCb:s,viewportResizeCb:i,inputCb:r,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:m,selectionCb:h}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),a(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),o(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),n(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),s(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),i(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),r(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),u(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),d(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),m(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),h(...e)}}(e,t);const o=ue(e,e.doc),n=function({mousemoveCb:e,sampling:t,doc:a,mirror:o}){if(!1===t.mousemove)return()=>{};const n="number"==typeof t.mousemove?t.mousemove:50,s="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let i,r=[];const l=q((t=>{const a=Date.now()-i;e(r.map((e=>(e.timeOffset-=a,e))),t),r=[],i=null}),s),c=q((e=>{const t=ce(e),{clientX:a,clientY:n}=W(e)?e.changedTouches[0]:e;i||(i=Date.now()),r.push({x:a,y:n,id:o.getId(t),timeOffset:Date.now()-i}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?Z.Drag:e instanceof MouseEvent?Z.MouseMove:Z.TouchMove)}),n,{trailing:!1}),u=[T("mousemove",c,a),T("touchmove",c,a),T("drag",c,a)];return()=>{u.forEach((e=>e()))}}(e),s=function({mouseInteractionCb:e,doc:t,mirror:a,blockClass:o,blockSelector:n,sampling:s}){if(!1===s.mouseInteraction)return()=>{};const i=!0===s.mouseInteraction||void 0===s.mouseInteraction?{}:s.mouseInteraction,r=[];return Object.keys(K).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==i[e])).forEach((s=>{const i=s.toLowerCase(),l=(t=>s=>{const i=ce(s);if(D(i,o,n,!0))return;const r=W(s)?s.changedTouches[0]:s;if(!r)return;const l=a.getId(i),{clientX:c,clientY:u}=r;e({type:K[t],id:l,x:c,y:u})})(s);r.push(T(i,l,t))})),()=>{r.forEach((e=>e()))}}(e),i=de(e),r=function({viewportResizeCb:e}){let t=-1,a=-1;return T("resize",q((()=>{const o=L(),n=N();t===o&&a===n||(e({width:Number(n),height:Number(o)}),t=o,a=n)}),200),window)}(e),c=function({inputCb:e,doc:t,mirror:a,blockClass:o,blockSelector:n,ignoreClass:s,maskInputOptions:i,maskInputFn:r,sampling:c,userTriggeredOnInput:u}){function d(e){let a=ce(e);const c=e.isTrusted;if(a&&"OPTION"===a.tagName&&(a=a.parentElement),!a||!a.tagName||he.indexOf(a.tagName)<0||D(a,o,n,!0))return;const d=a.type;if(a.classList.contains(s))return;let h=a.value,g=!1;"radio"===d||"checkbox"===d?g=a.checked:(i[a.tagName.toLowerCase()]||i[d])&&(h=l({maskInputOptions:i,tagName:a.tagName,type:d,value:h,maskInputFn:r})),m(a,me({text:h,isChecked:g,userTriggered:c},u));const p=a.name;"radio"===d&&p&&g&&t.querySelectorAll(`input[type="radio"][name="${p}"]`).forEach((e=>{e!==a&&m(e,me({text:e.value,isChecked:!g,userTriggered:!1},u))}))}function m(t,o){const n=ge.get(t);if(!n||n.text!==o.text||n.isChecked!==o.isChecked){ge.set(t,o);const n=a.getId(t);e(Object.assign(Object.assign({},o),{id:n}))}}const h=("last"===c.input?["change"]:["input","change"]).map((e=>T(e,d,t))),g=t.defaultView;if(!g)return()=>{h.forEach((e=>e()))};const p=g.Object.getOwnPropertyDescriptor(g.HTMLInputElement.prototype,"value"),f=[[g.HTMLInputElement.prototype,"value"],[g.HTMLInputElement.prototype,"checked"],[g.HTMLSelectElement.prototype,"value"],[g.HTMLTextAreaElement.prototype,"value"],[g.HTMLSelectElement.prototype,"selectedIndex"],[g.HTMLOptionElement.prototype,"selected"]];return p&&p.set&&h.push(...f.map((e=>E(e[0],e[1],{set(){d({target:this})}},!1,g)))),()=>{h.forEach((e=>e()))}}(e),u=function({mediaInteractionCb:e,blockClass:t,blockSelector:a,mirror:o,sampling:n}){const s=s=>q((n=>{const i=ce(n);if(!i||D(i,t,a,!0))return;const{currentTime:r,volume:l,muted:c,playbackRate:u}=i;e({type:s,id:o.getId(i),currentTime:r,volume:l,muted:c,playbackRate:u})}),n.media||500),i=[T("play",s(0)),T("pause",s(1)),T("seeked",s(2)),T("volumechange",s(3)),T("ratechange",s(4))];return()=>{i.forEach((e=>e()))}}(e),d=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:a},{win:o}){const n=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=function(o,s){const{id:i,styleId:r}=fe(this,t,a.styleMirror);return(i&&-1!==i||r&&-1!==r)&&e({id:i,styleId:r,adds:[{rule:o,index:s}]}),n.apply(this,[o,s])};const s=o.CSSStyleSheet.prototype.deleteRule;let i,r;o.CSSStyleSheet.prototype.deleteRule=function(o){const{id:n,styleId:i}=fe(this,t,a.styleMirror);return(n&&-1!==n||i&&-1!==i)&&e({id:n,styleId:i,removes:[{index:o}]}),s.apply(this,[o])},o.CSSStyleSheet.prototype.replace&&(i=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=function(o){const{id:n,styleId:s}=fe(this,t,a.styleMirror);return(n&&-1!==n||s&&-1!==s)&&e({id:n,styleId:s,replace:o}),i.apply(this,[o])}),o.CSSStyleSheet.prototype.replaceSync&&(r=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=function(o){const{id:n,styleId:s}=fe(this,t,a.styleMirror);return(n&&-1!==n||s&&-1!==s)&&e({id:n,styleId:s,replaceSync:o}),r.apply(this,[o])});const l={};se?l.CSSGroupingRule=o.CSSGroupingRule:(ie&&(l.CSSMediaRule=o.CSSMediaRule),le&&(l.CSSConditionRule=o.CSSConditionRule),re&&(l.CSSSupportsRule=o.CSSSupportsRule));const c={};return Object.entries(l).forEach((([o,n])=>{c[o]={insertRule:n.prototype.insertRule,deleteRule:n.prototype.deleteRule},n.prototype.insertRule=function(n,s){const{id:i,styleId:r}=fe(this.parentStyleSheet,t,a.styleMirror);return(i&&-1!==i||r&&-1!==r)&&e({id:i,styleId:r,adds:[{rule:n,index:[...pe(this),s||0]}]}),c[o].insertRule.apply(this,[n,s])},n.prototype.deleteRule=function(n){const{id:s,styleId:i}=fe(this.parentStyleSheet,t,a.styleMirror);return(s&&-1!==s||i&&-1!==i)&&e({id:s,styleId:i,removes:[{index:[...pe(this),n]}]}),c[o].deleteRule.apply(this,[n])}})),()=>{o.CSSStyleSheet.prototype.insertRule=n,o.CSSStyleSheet.prototype.deleteRule=s,i&&(o.CSSStyleSheet.prototype.replace=i),r&&(o.CSSStyleSheet.prototype.replaceSync=r),Object.entries(l).forEach((([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule}))}}(e,{win:a}),m=ke(e,e.doc),h=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:a,stylesheetManager:o},{win:n}){const s=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=function(n,i,r){var l;if(a.has(n))return s.apply(this,[n,i,r]);const{id:c,styleId:u}=fe(null===(l=this.parentRule)||void 0===l?void 0:l.parentStyleSheet,t,o.styleMirror);return(c&&-1!==c||u&&-1!==u)&&e({id:c,styleId:u,set:{property:n,value:i,priority:r},index:pe(this.parentRule)}),s.apply(this,[n,i,r])};const i=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=function(n){var s;if(a.has(n))return i.apply(this,[n]);const{id:r,styleId:l}=fe(null===(s=this.parentRule)||void 0===s?void 0:s.parentStyleSheet,t,o.styleMirror);return(r&&-1!==r||l&&-1!==l)&&e({id:r,styleId:l,remove:{property:n},index:pe(this.parentRule)}),i.apply(this,[n])},()=>{n.CSSStyleDeclaration.prototype.setProperty=s,n.CSSStyleDeclaration.prototype.removeProperty=i}}(e,{win:a}),g=e.collectFonts?function({fontCb:e,doc:t}){const a=t.defaultView;if(!a)return()=>{};const o=[],n=new WeakMap,s=a.FontFace;a.FontFace=function(e,t,a){const o=new s(e,t,a);return n.set(o,{family:e,buffer:"string"!=typeof t,descriptors:a,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),o};const i=O(t.fonts,"add",(function(t){return function(a){return setTimeout((()=>{const t=n.get(a);t&&(e(t),n.delete(a))}),0),t.apply(this,[a])}}));return o.push((()=>{a.FontFace=s})),o.push(i),()=>{o.forEach((e=>e()))}}(e):()=>{},p=function(e){const{doc:t,mirror:a,blockClass:o,blockSelector:n,selectionCb:s}=e;let i=!0;const r=()=>{const e=t.getSelection();if(!e||i&&(null==e?void 0:e.isCollapsed))return;i=e.isCollapsed||!1;const r=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const s=e.getRangeAt(t),{startContainer:i,startOffset:l,endContainer:c,endOffset:u}=s;D(i,o,n,!0)||D(c,o,n,!0)||r.push({start:a.getId(i),startOffset:l,end:a.getId(c),endOffset:u})}s({ranges:r})};return r(),T("selectionchange",r)}(e),f=[];for(const t of e.plugins)f.push(t.observer(t.callback,a,t.options));return()=>{ne.forEach((e=>e.reset())),o.disconnect(),n(),s(),i(),r(),c(),u(),d(),m(),h(),g(),p(),f.forEach((e=>e()))}}class ye{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,t,a,o){const n=a||this.getIdToRemoteIdMap(e),s=o||this.getRemoteIdToIdMap(e);let i=n.get(t);return i||(i=this.generateIdFn(),n.set(t,i),s.set(i,t)),i}getIds(e,t){const a=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,a,o)))}getRemoteId(e,t,a){const o=a||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;return o.get(t)||-1}getRemoteIds(e,t){const a=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,a)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}class ve{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new ye(p),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ye(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,t){var a;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(a=this.loadListener)||void 0===a||a.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){if("rrweb"===e.data.type){if(!e.source)return;const t=this.crossOriginIframeMap.get(e.source);if(!t)return;const a=this.transformCrossOriginEvent(t,e.data.event);a&&this.wrappedEmit(a,e.data.isCheckout)}}transformCrossOriginEvent(e,t){var a;switch(t.type){case V.FullSnapshot:return this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e),{timestamp:t.timestamp,type:V.IncrementalSnapshot,data:{source:Z.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case V.Meta:case V.Load:case V.DomContentLoaded:return!1;case V.Plugin:return t;case V.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case V.IncrementalSnapshot:switch(t.data.source){case Z.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Z.Drag:case Z.TouchMove:case Z.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case Z.ViewportResize:return!1;case Z.MediaInteraction:case Z.MouseInteraction:case Z.Scroll:case Z.CanvasMutation:case Z.Input:return this.replaceIds(t.data,e,["id"]),t;case Z.StyleSheetRule:case Z.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Z.Font:return t;case Z.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case Z.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(a=t.data.styles)||void 0===a||a.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}}replace(e,t,a,o){for(const n of o)(Array.isArray(t[n])||"number"==typeof t[n])&&(Array.isArray(t[n])?t[n]=e.getIds(a,t[n]):t[n]=e.getId(a,t[n]));return t}replaceIds(e,t,a){return this.replace(this.crossOriginIframeMirror,e,t,a)}replaceStyleIds(e,t,a){return this.replace(this.crossOriginIframeStyleMirror,e,t,a)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}}class we{constructor(e){this.shadowDoms=new WeakSet,this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const t=this;this.restorePatches.push(O(Element.prototype,"attachShadow",(function(e){return function(a){const o=e.call(this,a);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,this.ownerDocument),o}})))}addShadowRoot(e,t){n(e)&&(this.shadowDoms.has(e)||(this.shadowDoms.add(e),ue(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),de(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),ke({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)}),0)))}observeAttachShadow(e){if(e.contentWindow){const t=this;this.restorePatches.push(O(e.contentWindow.HTMLElement.prototype,"attachShadow",(function(a){return function(o){const n=a.call(this,o);return this.shadowRoot&&t.addShadowRoot(this.shadowRoot,e.contentDocument),n}})))}}reset(){this.restorePatches.forEach((e=>e())),this.shadowDoms=new WeakSet}}for(var xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ie="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Ce=0;Ce<64;Ce++)Ie[xe.charCodeAt(Ce)]=Ce;const Se=new Map,Ae=(e,t,a)=>{if(!e||!Te(e,t)&&"object"!=typeof e)return;const o=function(e,t){let a=Se.get(e);return a||(a=new Map,Se.set(e,a)),a.has(t)||a.set(t,[]),a.get(t)}(a,e.constructor.name);let n=o.indexOf(e);return-1===n&&(n=o.length,o.push(e)),n};function je(e,t,a){if(e instanceof Array)return e.map((e=>je(e,t,a)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const t=e.constructor.name,a=function(e){var t,a=new Uint8Array(e),o=a.length,n="";for(t=0;t<o;t+=3)n+=xe[a[t]>>2],n+=xe[(3&a[t])<<4|a[t+1]>>4],n+=xe[(15&a[t+1])<<2|a[t+2]>>6],n+=xe[63&a[t+2]];return o%3==2?n=n.substring(0,n.length-1)+"=":o%3==1&&(n=n.substring(0,n.length-2)+"=="),n}(e);return{rr_type:t,base64:a}}if(e instanceof DataView)return{rr_type:e.constructor.name,args:[je(e.buffer,t,a),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:a}=e;return{rr_type:t,src:a}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[je(e.data,t,a),e.width,e.height]}:Te(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:Ae(e,t,a)}:e}const ze=(e,t,a)=>[...e].map((e=>je(e,t,a))),Te=(e,t)=>{const a=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(a.find((a=>e instanceof t[a])))};function Me(e,t,a){const o=[];try{const n=O(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(o,...n){return D(this,t,a,!0)||"__context"in this||(this.__context=o),e.apply(this,[o,...n])}}));o.push(n)}catch(e){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach((e=>e()))}}function Re(e,t,a,o,n,s,i){const r=[],l=Object.getOwnPropertyNames(e);for(const s of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(s))try{if("function"!=typeof e[s])continue;const l=O(e,s,(function(e){return function(...r){const l=e.apply(this,r);if(Ae(l,i,this),!D(this.canvas,o,n,!0)){const e=ze([...r],i,this),o={type:t,property:s,args:e};a(this.canvas,o)}return l}}));r.push(l)}catch(o){const n=E(e,s,{set(e){a(this.canvas,{type:t,property:s,args:[e],setter:!0})}});r.push(n)}return r}var qe=null;try{var Ee="undefined"!=typeof module&&"function"==typeof module.require&&module.require("worker_threads")||"function"==typeof require&&require("worker_threads")||"function"==typeof require&&require("worker_threads");qe=Ee.Worker}catch(e){}var Oe,Le,Ne=(Oe="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJh