!function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function n(e){for(var n=1;n=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;A(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},e}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){a(i,r,o,s,c,"next",e)}function c(e){a(i,r,o,s,c,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}var m;function v(e){var t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function y(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function I(e){try{var t=e.rules||e.cssRules;return t?((n=Array.from(t).map(C).join("")).includes(" background-clip: text;")&&!n.includes(" -webkit-background-clip: text;")&&(n=n.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),n):null}catch(e){return null}var n}function C(e){var t;if(function(e){return"styleSheet"in e}(e))try{t=I(e.styleSheet)||function(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url(".concat(JSON.stringify(e.href),")")];return""===e.layerName?n.push("layer"):e.layerName&&n.push("layer(".concat(e.layerName,")")),e.supportsText&&n.push("supports(".concat(e.supportsText,")")),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(e){}return function(e){if(e.includes(":")){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}return e}(t||e.cssText)}!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"}(m||(m={}));var b=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-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,n=this.getId(e);this.idNodeMap.delete(n),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 n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var r=this.nodeMetaMap.get(n);r&&this.nodeMetaMap.set(t,r)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function S(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,o=e.type,a=e.value,i=e.maskInputFn,s=a||"",c=o&&A(o);return(n[r.toLowerCase()]||c&&n[c])&&(s=i?i(s,t):"*".repeat(s.length)),s}function A(e){return e.toLowerCase()}var w="__rrweb_original__";function k(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?A(t):null}var M,T,O=1,N=new RegExp("[^a-z0-9-_:]"),E=-2;function R(){return O++}var x=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,L=/^(?:[a-z+]+:)?\/\//i,F=/^www\..*/i,D=/^(data:)([^,]*),(.*)/i;function B(e,t){return(e||"").replace(x,(function(e,n,r,o,a,i){var s,c=r||a||i,u=n||o||"";if(!c)return e;if(L.test(c)||F.test(c))return"url(".concat(u).concat(c).concat(u,")");if(D.test(c))return"url(".concat(u).concat(c).concat(u,")");if("/"===c[0])return"url(".concat(u).concat((s=t,(s.indexOf("//")>-1?s.split("/").slice(0,3).join("/"):s.split("/")[0]).split("?")[0]+c)).concat(u,")");var l=t.split("/"),d=c.split("/");l.pop();for(var p=0,f=d;p=t.length);){var a=r(W);if(","===a.slice(-1))a=V(e,a.substring(0,a.length-1)),o.push(a);else{var i="";a=V(e,a);for(var s=!1;;){var c=t.charAt(n);if(""===c){o.push((a+i).trim());break}if(s)")"===c&&(s=!1);else{if(","===c){n+=1,o.push((a+i).trim());break}"("===c&&(s=!0)}i+=c,n+=1}}}return o.join(", ")}(e,r):"style"===n?B(r,U()):"object"===t&&"data"===n?V(e,r):r:V(e,r):r}function _(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function j(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&j(e.parentNode,t,n);for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}return!!n&&j(e.parentNode,t,n)}function P(e,t,n){try{var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===r)return!1;if("string"==typeof t){if(r.classList.contains(t))return!0;if(r.closest(".".concat(t)))return!0}else if(j(r,t,!0))return!0;if(n){if(r.matches(n))return!0;if(r.closest(n))return!0}}catch(e){}return!1}function H(e,t){var n=t.doc,r=t.mirror,o=t.blockClass,a=t.blockSelector,i=t.maskTextClass,s=t.maskTextSelector,c=t.inlineStylesheet,u=t.maskInputOptions,l=void 0===u?{}:u,d=t.maskTextFn,p=t.maskInputFn,f=t.dataURLOptions,h=void 0===f?{}:f,g=t.inlineImages,v=t.recordCanvas,y=t.keepIframeSrcFn,C=t.newlyAddedElement,b=void 0!==C&&C,O=function(e,t){if(!t.hasNode(e))return;var n=t.getId(e);return 1===n?void 0:n}(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:m.Document,childNodes:[],compatMode:e.compatMode}:{type:m.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:m.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:O};case e.ELEMENT_NODE:return function(e,t){for(var n=t.doc,r=t.blockClass,o=t.blockSelector,a=t.inlineStylesheet,i=t.maskInputOptions,s=void 0===i?{}:i,c=t.maskInputFn,u=t.dataURLOptions,l=void 0===u?{}:u,d=t.inlineImages,p=t.recordCanvas,f=t.keepIframeSrcFn,h=t.newlyAddedElement,g=void 0!==h&&h,v=t.rootId,y=function(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var o=e.classList[r];if(t.test(o))return!0}if(n)return e.matches(n)}catch(e){}return!1}(e,r,o),C=function(e){if(e instanceof HTMLFormElement)return"form";var t=A(e.tagName);return N.test(t)?"div":t}(e),b={},O=e.attributes.length,E=0;E2&&void 0!==arguments[2]?arguments[2]:document,r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var z="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.",Q={map:{},getId:function(){return console.error(z),-1},getNode:function(){return console.error(z),null},removeNodeFromMap:function(){console.error(z)},has:function(){return console.error(z),!1},reset:function(){console.error(z)}};function X(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=null,o=0;return function(){for(var a=arguments.length,i=new Array(a),s=0;st?(r&&(clearTimeout(r),r=null),o=c,e.apply(l,i)):r||!1===n.trailing||(r=setTimeout((function(){o=!1===n.leading?0:Date.now(),r=null,e.apply(l,i)}),u))}}function $(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:window,a=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,r?n:{set:function(e){var t=this;setTimeout((function(){n.set.call(t,e)}),0),a&&a.set&&a.set.call(this,e)}}),function(){return $(e,t,a||{},!0)}}function ee(e,t,n){try{if(!(t in e))return function(){};var r=e[t],o=n(r);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=o,function(){e[t]=r}}catch(e){return function(){}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Q=new Proxy(Q,{get:function(e,t,n){return"map"===t&&console.error(z),Reflect.get(e,t,n)}}));var te=Date.now;function ne(e){var t,n,r,o,a,i,s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==s?void 0:s.documentElement.scrollLeft)||(null===(n=null===(t=null==s?void 0:s.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(r=null==s?void 0:s.body)||void 0===r?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==s?void 0:s.documentElement.scrollTop)||(null===(a=null===(o=null==s?void 0:s.body)||void 0===o?void 0:o.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(i=null==s?void 0:s.body)||void 0===i?void 0:i.scrollTop)||0}}function re(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function oe(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function ae(e,t,n,r){if(!e)return!1;var o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(r&&null!==o.closest("."+t))return!0}else if(j(o,t,r))return!0}catch(e){}if(n){if(o.matches(n))return!0;if(r&&null!==o.closest(n))return!0}return!1}function ie(e,t){return t.getId(e)===E}function se(e,t){if(v(e))return!1;var n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||se(e.parentNode,t))}function ce(e){return Boolean(e.changedTouches)}function ue(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function le(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function de(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(te=function(){return(new Date).getTime()});var pe=function(){function e(){s(this,e),this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}return u(e,[{key:"getId",value:function(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}},{key:"has",value:function(e){return this.styleIDMap.has(e)}},{key:"add",value:function(e,t){return this.has(e)?this.getId(e):(n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n);var n}},{key:"getStyle",value:function(e){return this.idStyleMap.get(e)||null}},{key:"reset",value:function(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}},{key:"generateId",value:function(){return this.id++}}]),e}();function fe(e){var t,n,r=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function he(e){var t=e.ownerDocument;if(!t)return!1;var n=function(e){for(var t,n=e;t=fe(n);)n=t;return n}(e);return t.contains(n)}function ge(e){var t=e.ownerDocument;return!!t&&(t.contains(e)||he(e))}var me=function(e){return 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}(me||{}),ve=function(e){return 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}(ve||{}),ye=function(e){return 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}(ye||{}),Ie=function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e}(Ie||{}),Ce=function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e}(Ce||{});function be(e){return"__ln"in e}var Se,Ae=function(){function e(){s(this,e),this.length=0,this.head=null,this.tail=null}return u(e,[{key:"get",value:function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=e.doc.defaultView;if(!n)return function(){};!function(e,t){var n=e.mutationCb,r=e.mousemoveCb,o=e.mouseInteractionCb,a=e.scrollCb,i=e.viewportResizeCb,s=e.inputCb,c=e.mediaInteractionCb,u=e.styleSheetRuleCb,l=e.styleDeclarationCb,d=e.canvasMutationCb,p=e.fontCb,f=e.selectionCb;e.mutationCb=function(){t.mutation&&t.mutation.apply(t,arguments),n.apply(void 0,arguments)},e.mousemoveCb=function(){t.mousemove&&t.mousemove.apply(t,arguments),r.apply(void 0,arguments)},e.mouseInteractionCb=function(){t.mouseInteraction&&t.mouseInteraction.apply(t,arguments),o.apply(void 0,arguments)},e.scrollCb=function(){t.scroll&&t.scroll.apply(t,arguments),a.apply(void 0,arguments)},e.viewportResizeCb=function(){t.viewportResize&&t.viewportResize.apply(t,arguments),i.apply(void 0,arguments)},e.inputCb=function(){t.input&&t.input.apply(t,arguments),s.apply(void 0,arguments)},e.mediaInteractionCb=function(){t.mediaInteaction&&t.mediaInteaction.apply(t,arguments),c.apply(void 0,arguments)},e.styleSheetRuleCb=function(){t.styleSheetRule&&t.styleSheetRule.apply(t,arguments),u.apply(void 0,arguments)},e.styleDeclarationCb=function(){t.styleDeclaration&&t.styleDeclaration.apply(t,arguments),l.apply(void 0,arguments)},e.canvasMutationCb=function(){t.canvasMutation&&t.canvasMutation.apply(t,arguments),d.apply(void 0,arguments)},e.fontCb=function(){t.font&&t.font.apply(t,arguments),p.apply(void 0,arguments)},e.selectionCb=function(){t.selection&&t.selection.apply(t,arguments),f.apply(void 0,arguments)}}(e,t);var r,o=Be(e,e.doc),a=function(e){var t=e.mousemoveCb,n=e.sampling,r=e.doc,o=e.mirror;if(!1===n.mousemove)return function(){};var a,i="number"==typeof n.mousemove?n.mousemove:50,s="number"==typeof n.mousemoveCallback?n.mousemoveCallback:500,c=[],u=X(Le((function(e){var n=Date.now()-a;t(c.map((function(e){return e.timeOffset-=n,e})),e),c=[],a=null})),s),l=Le(X(Le((function(e){var t=De(e),n=ce(e)?e.changedTouches[0]:e,r=n.clientX,i=n.clientY;a||(a=te()),c.push({x:r,y:i,id:o.getId(t),timeOffset:te()-a}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?ve.Drag:e instanceof MouseEvent?ve.MouseMove:ve.TouchMove)})),i,{trailing:!1})),d=[q("mousemove",l,r),q("touchmove",l,r),q("drag",l,r)];return Le((function(){d.forEach((function(e){return e()}))}))}(e),i=We(e),s=Ge(e),c=function(e,t){var n=e.viewportResizeCb,r=t.win,o=-1,a=-1;return q("resize",Le(X(Le((function(){var e=re(),t=oe();o===e&&a===t||(n({width:Number(t),height:Number(e)}),o=e,a=t)})),200)),r)}(e,{win:n}),u=function(e){var t=e.inputCb,n=e.doc,r=e.mirror,o=e.blockClass,a=e.blockSelector,i=e.ignoreClass,s=e.ignoreSelector,c=e.maskInputOptions,u=e.maskInputFn,l=e.sampling,d=e.userTriggeredOnInput;function f(e){var t=De(e),r=e.isTrusted,l=t&&t.tagName;if(t&&"OPTION"===l&&(t=t.parentElement),t&&l&&!(Ze.indexOf(l)<0)&&!ae(t,o,a,!0)&&!(t.classList.contains(i)||s&&t.matches(s))){var p=t.value,f=!1,g=k(t)||"";"radio"===g||"checkbox"===g?f=t.checked:(c[l.toLowerCase()]||c[g])&&(p=S({element:t,maskInputOptions:c,tagName:l,type:g,value:p,maskInputFn:u})),h(t,Le(Ve)({text:p,isChecked:f,userTriggered:r},d));var m=t.name;"radio"===g&&m&&f&&n.querySelectorAll('input[type="radio"][name="'.concat(m,'"]')).forEach((function(e){e!==t&&h(e,Le(Ve)({text:e.value,isChecked:!f,userTriggered:!1},d))}))}}function h(e,n){var o=Ue.get(e);if(!o||o.text!==n.text||o.isChecked!==n.isChecked){Ue.set(e,n);var a=r.getId(e);Le(t)(Object.assign(Object.assign({},n),{id:a}))}}var g=("last"===l.input?["change"]:["input","change"]).map((function(e){return q(e,Le(f),n)})),m=n.defaultView;if(!m)return function(){g.forEach((function(e){return e()}))};var v=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),y=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return v&&v.set&&g.push.apply(g,p(y.map((function(e){return $(e[0],e[1],{set:function(){Le(f)({target:this,isTrusted:!1})}},!1,m)})))),Le((function(){g.forEach((function(e){return e()}))}))}(e),l=function(e){var t=e.mediaInteractionCb,n=e.blockClass,r=e.blockSelector,o=e.mirror,a=e.sampling,i=e.doc,s=Le((function(e){return X(Le((function(a){var i=De(a);if(i&&!ae(i,n,r,!0)){var s=i.currentTime,c=i.volume,u=i.muted,l=i.playbackRate;t({type:e,id:o.getId(i),currentTime:s,volume:c,muted:u,playbackRate:l})}})),a.media||500)})),c=[q("play",s(0),i),q("pause",s(1),i),q("seeked",s(2),i),q("volumechange",s(3),i),q("ratechange",s(4),i)];return Le((function(){c.forEach((function(e){return e()}))}))}(e),f=function(e,t){var n=e.styleSheetRuleCb,r=e.mirror,o=e.stylesheetManager,a=t.win;if(!a.CSSStyleSheet||!a.CSSStyleSheet.prototype)return function(){};var i=a.CSSStyleSheet.prototype.insertRule;a.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:Le((function(e,t,a){var i=d(a,2),s=i[0],c=i[1],u=_e(t,r,o.styleMirror),l=u.id,p=u.styleId;return(l&&-1!==l||p&&-1!==p)&&n({id:l,styleId:p,adds:[{rule:s,index:c}]}),e.apply(t,a)}))});var s,c,u=a.CSSStyleSheet.prototype.deleteRule;a.CSSStyleSheet.prototype.deleteRule=new Proxy(u,{apply:Le((function(e,t,a){var i=d(a,1)[0],s=_e(t,r,o.styleMirror),c=s.id,u=s.styleId;return(c&&-1!==c||u&&-1!==u)&&n({id:c,styleId:u,removes:[{index:i}]}),e.apply(t,a)}))}),a.CSSStyleSheet.prototype.replace&&(s=a.CSSStyleSheet.prototype.replace,a.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:Le((function(e,t,a){var i=d(a,1)[0],s=_e(t,r,o.styleMirror),c=s.id,u=s.styleId;return(c&&-1!==c||u&&-1!==u)&&n({id:c,styleId:u,replace:i}),e.apply(t,a)}))})),a.CSSStyleSheet.prototype.replaceSync&&(c=a.CSSStyleSheet.prototype.replaceSync,a.CSSStyleSheet.prototype.replaceSync=new Proxy(c,{apply:Le((function(e,t,a){var i=d(a,1)[0],s=_e(t,r,o.styleMirror),c=s.id,u=s.styleId;return(c&&-1!==c||u&&-1!==u)&&n({id:c,styleId:u,replaceSync:i}),e.apply(t,a)}))}));var l={};Ye("CSSGroupingRule")?l.CSSGroupingRule=a.CSSGroupingRule:(Ye("CSSMediaRule")&&(l.CSSMediaRule=a.CSSMediaRule),Ye("CSSConditionRule")&&(l.CSSConditionRule=a.CSSConditionRule),Ye("CSSSupportsRule")&&(l.CSSSupportsRule=a.CSSSupportsRule));var f={};return Object.entries(l).forEach((function(e){var t=d(e,2),a=t[0],i=t[1];f[a]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(f[a].insertRule,{apply:Le((function(e,t,a){var i=d(a,2),s=i[0],c=i[1],u=_e(t.parentStyleSheet,r,o.styleMirror),l=u.id,f=u.styleId;return(l&&-1!==l||f&&-1!==f)&&n({id:l,styleId:f,adds:[{rule:s,index:[].concat(p(Ke(t)),[c||0])}]}),e.apply(t,a)}))}),i.prototype.deleteRule=new Proxy(f[a].deleteRule,{apply:Le((function(e,t,a){var i=d(a,1)[0],s=_e(t.parentStyleSheet,r,o.styleMirror),c=s.id,u=s.styleId;return(c&&-1!==c||u&&-1!==u)&&n({id:c,styleId:u,removes:[{index:[].concat(p(Ke(t)),[i])}]}),e.apply(t,a)}))})})),Le((function(){a.CSSStyleSheet.prototype.insertRule=i,a.CSSStyleSheet.prototype.deleteRule=u,s&&(a.CSSStyleSheet.prototype.replace=s),c&&(a.CSSStyleSheet.prototype.replaceSync=c),Object.entries(l).forEach((function(e){var t=d(e,2),n=t[0],r=t[1];r.prototype.insertRule=f[n].insertRule,r.prototype.deleteRule=f[n].deleteRule}))}))}(e,{win:n}),h=je(e,e.doc),m=function(e,t){var n=e.styleDeclarationCb,r=e.mirror,o=e.ignoreCSSAttributes,a=e.stylesheetManager,i=t.win,s=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:Le((function(e,t,i){var c,u=d(i,3),l=u[0],p=u[1],f=u[2];if(o.has(l))return s.apply(t,[l,p,f]);var h=_e(null===(c=t.parentRule)||void 0===c?void 0:c.parentStyleSheet,r,a.styleMirror),g=h.id,m=h.styleId;return(g&&-1!==g||m&&-1!==m)&&n({id:g,styleId:m,set:{property:l,value:p,priority:f},index:Ke(t.parentRule)}),e.apply(t,i)}))});var c=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:Le((function(e,t,i){var s,u=d(i,1)[0];if(o.has(u))return c.apply(t,[u]);var l=_e(null===(s=t.parentRule)||void 0===s?void 0:s.parentStyleSheet,r,a.styleMirror),p=l.id,f=l.styleId;return(p&&-1!==p||f&&-1!==f)&&n({id:p,styleId:f,remove:{property:u},index:Ke(t.parentRule)}),e.apply(t,i)}))}),Le((function(){i.CSSStyleDeclaration.prototype.setProperty=s,i.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),v=e.collectFonts?function(e){var t=e.fontCb,n=e.doc,r=n.defaultView;if(!r)return function(){};var o=[],a=new WeakMap,i=r.FontFace;r.FontFace=function(e,t,n){var r=new i(e,t,n);return a.set(r,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),r};var s=ee(n.fonts,"add",(function(e){return function(n){return setTimeout(Le((function(){var e=a.get(n);e&&(t(e),a.delete(n))})),0),e.apply(this,[n])}}));return o.push((function(){r.FontFace=i})),o.push(s),Le((function(){o.forEach((function(e){return e()}))}))}(e):function(){},y=function(e){var t=e.doc,n=e.mirror,r=e.blockClass,o=e.blockSelector,a=e.selectionCb,i=!0,s=Le((function(){var e=t.getSelection();if(!(!e||i&&(null==e?void 0:e.isCollapsed))){i=e.isCollapsed||!1;for(var s=[],c=e.rangeCount||0,u=0;u0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}},{key:"handleMessage",value:function(e){var t=e;if("rrweb"===t.data.type&&t.origin===t.data.origin&&e.source){var n=this.crossOriginIframeMap.get(e.source);if(n){var r=this.transformCrossOriginEvent(n,t.data.event);r&&this.wrappedEmit(r,t.data.isCheckout)}}}},{key:"transformCrossOriginEvent",value:function(e,t){var n,r=this;switch(t.type){case me.FullSnapshot:this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);var o=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(t.data.node,o),{timestamp:t.timestamp,type:me.IncrementalSnapshot,data:{source:ve.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}};case me.Meta:case me.Load:case me.DomContentLoaded:return!1;case me.Plugin:return t;case me.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case me.IncrementalSnapshot:switch(t.data.source){case ve.Mutation:return t.data.adds.forEach((function(t){r.replaceIds(t,e,["parentId","nextId","previousId"]),r.replaceIdOnNode(t.node,e);var n=r.crossOriginIframeRootIdMap.get(e);n&&r.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((function(t){r.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((function(t){r.replaceIds(t,e,["id"])})),t.data.texts.forEach((function(t){r.replaceIds(t,e,["id"])})),t;case ve.Drag:case ve.TouchMove:case ve.MouseMove:return t.data.positions.forEach((function(t){r.replaceIds(t,e,["id"])})),t;case ve.ViewportResize:return!1;case ve.MediaInteraction:case ve.MouseInteraction:case ve.Scroll:case ve.CanvasMutation:case ve.Input:return this.replaceIds(t.data,e,["id"]),t;case ve.StyleSheetRule:case ve.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case ve.Font:return t;case ve.Selection:return t.data.ranges.forEach((function(t){r.replaceIds(t,e,["start","end"])})),t;case ve.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((function(t){r.replaceStyleIds(t,e,["styleId"])})),t}}}},{key:"replace",value:function(e,t,n,r){var o,a=g(r);try{for(a.s();!(o=a.n()).done;){var i=o.value;(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]))}}catch(e){a.e(e)}finally{a.f()}return t}},{key:"replaceIds",value:function(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}},{key:"replaceStyleIds",value:function(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}},{key:"replaceIdOnNode",value:function(e,t){var n=this;this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((function(e){n.replaceIdOnNode(e,t)}))}},{key:"patchRootIdOnNode",value:function(e,t){var n=this;e.type===m.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((function(e){n.patchRootIdOnNode(e,t)}))}}]),e}(),ze=function(){function e(t){s(this,e),this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}return u(e,[{key:"init",value:function(){this.reset(),this.patchAttachShadow(Element,document)}},{key:"addShadowRoot",value:function(e,t){var n=this;if(y(e)&&!this.shadowDoms.has(e)){this.shadowDoms.add(e);var r=Be(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((function(){return r.disconnect()})),this.restoreHandlers.push(Ge(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((function(){e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&n.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,n.mirror.getId(e.host)),n.restoreHandlers.push(je({mirror:n.mirror,stylesheetManager:n.bypassOptions.stylesheetManager},e))}),0)}}},{key:"observeAttachShadow",value:function(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}},{key:"patchAttachShadow",value:function(e,t){var n=this;this.restoreHandlers.push(ee(e.prototype,"attachShadow",(function(e){return function(r){var o=e.call(this,r);return this.shadowRoot&&ge(this)&&n.addShadowRoot(this.shadowRoot,t),o}})))}},{key:"reset",value:function(){this.restoreHandlers.forEach((function(e){try{e()}catch(e){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}]),e}();function Qe(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,s)}c((r=r.apply(e,t||[])).next())}))}for(var Xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$e="undefined"==typeof Uint8Array?[]:new Uint8Array(256),et=0;et>2],o+=Xe[(3&n[t])<<4|n[t+1]>>4],o+=Xe[(15&n[t+1])<<2|n[t+2]>>6],o+=Xe[63&n[t+2]];return r%3==2?o=o.substring(0,o.length-1)+"=":r%3==1&&(o=o.substring(0,o.length-2)+"=="),o},nt=new Map;var rt=function(e,t,n){if(e&&(it(e,t)||"object"===o(e))){var r=function(e,t){var n=nt.get(e);return n||(n=new Map,nt.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name),a=r.indexOf(e);return-1===a&&(a=r.length,r.push(e)),a}};function ot(e,t,n){if(e instanceof Array)return e.map((function(e){return ot(e,t,n)}));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:tt(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ot(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement)return{rr_type:e.constructor.name,src:e.src};if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}return e instanceof ImageData?{rr_type:e.constructor.name,args:[ot(e.data,t,n),e.width,e.height]}:it(e,t)||"object"===o(e)?{rr_type:e.constructor.name,index:rt(e,t,n)}:e}var at=function(e,t,n){return p(e).map((function(e){return ot(e,t,n)}))},it=function(e,t){var n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((function(e){return"function"==typeof t[e]}));return Boolean(n.find((function(n){return e instanceof t[n]})))};function st(e,t,n,r){var a=[];try{var i=ee(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(a){for(var i=arguments.length,s=new Array(i>1?i-1:0),c=1;c0&&(r.styles=o),this.adoptedStyleSheetCb(r)}}},{key:"reset",value:function(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}},{key:"trackStylesheetInLinkElement",value:function(e){}}]),e}(),Ct=function(){function e(){s(this,e),this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}return u(e,[{key:"periodicallyClear",value:function(){var e=this;requestAnimationFrame((function(){e.clear(),e.loop&&e.periodicallyClear()}))}},{key:"inOtherBuffer",value:function(e,t){var n=this.nodeMap.get(e);return n&&Array.from(n).some((function(e){return e!==t}))}},{key:"add",value:function(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}},{key:"clear",value:function(){this.nodeMap=new WeakMap}},{key:"destroy",value:function(){this.loop=!1}}]),e}();function bt(e){return Object.assign(Object.assign({},e),{timestamp:te()})}var St=!1,At=new b;function wt(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.emit,n=e.checkoutEveryNms,r=e.checkoutEveryNth,o=e.blockClass,a=void 0===o?"rr-block":o,i=e.blockSelector,s=void 0===i?null:i,c=e.ignoreClass,u=void 0===c?"rr-ignore":c,l=e.ignoreSelector,d=void 0===l?null:l,p=e.maskTextClass,f=void 0===p?"rr-mask":p,h=e.maskTextSelector,m=void 0===h?null:h,v=e.inlineStylesheet,y=void 0===v||v,I=e.maskAllInputs,C=e.maskInputOptions,S=e.slimDOMOptions,A=e.maskInputFn,w=e.maskTextFn,k=e.hooks,M=e.packFn,T=e.sampling,O=void 0===T?{}:T,N=e.dataURLOptions,E=void 0===N?{}:N,R=e.mousemoveWait,x=e.recordCanvas,L=void 0!==x&&x,F=e.recordCrossOriginIframes,D=void 0!==F&&F,B=e.recordAfter,W=void 0===B?"DOMContentLoaded"===e.recordAfter?e.recordAfter:"load":B,G=e.userTriggeredOnInput,V=void 0!==G&&G,Z=e.collectFonts,U=void 0!==Z&&Z,K=e.inlineImages,_=void 0!==K&&K,j=e.plugins,P=e.keepIframeSrcFn,H=void 0===P?function(){return!1}:P,Y=e.ignoreCSSAttributes,z=void 0===Y?new Set([]):Y;Re(e.errorHandler);var Q=!D||window.parent===window,X=!1;if(!Q)try{window.parent.document&&(X=!1)}catch(e){X=!0}if(Q&&!t)throw new Error("emit function is required");void 0!==R&&void 0===O.mousemove&&(O.mousemove=R),At.reset();var $,ee=!0===I?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==C?C:{password:!0},te=!0===S||"all"===S?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===S,headMetaDescKeywords:"all"===S}:S||{};!function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window;"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(){for(var t=arguments.length,n=new Array(t),r=0;r=r,c=n&&e.timestamp-$.timestamp>n;(s||c)&>(!0)}};var se,ce=function(e){ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.Mutation},e)}))},pe=function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.Scroll},e)}))},fe=function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.CanvasMutation},e)}))},he=new It({mutationCb:ce,adoptedStyleSheetCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.AdoptedStyleSheet},e)}))}}),ge=new qe({mirror:At,mutationCb:ce,stylesheetManager:he,recordCrossOriginIframes:D,wrappedEmit:ht}),ye=g(j||[]);try{for(ye.s();!(se=ye.n()).done;){var Ie=se.value;Ie.getMirror&&Ie.getMirror({nodeMirror:At,crossOriginIframeMirror:ge.crossOriginIframeMirror,crossOriginIframeStyleMirror:ge.crossOriginIframeStyleMirror})}}catch(e){ye.e(e)}finally{ye.f()}var Ce=new Ct;mt=new yt({recordCanvas:L,mutationCb:fe,win:window,blockClass:a,blockSelector:s,mirror:At,sampling:O.canvas,dataURLOptions:E});var be=new ze({mutationCb:ce,scrollCb:pe,bypassOptions:{blockClass:a,blockSelector:s,maskTextClass:f,maskTextSelector:m,inlineStylesheet:y,maskInputOptions:ee,dataURLOptions:E,maskTextFn:w,maskInputFn:A,recordCanvas:L,inlineImages:_,sampling:O,slimDOMOptions:te,iframeManager:ge,stylesheetManager:he,canvasManager:mt,keepIframeSrcFn:H,processedNodeManager:Ce},mirror:At});gt=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];ht(bt({type:me.Meta,data:{href:window.location.href,width:oe(),height:re()}}),e),he.reset(),be.init(),Fe.forEach((function(e){return e.lock()}));var t=function(e,t){var n=t||{},r=n.mirror,o=void 0===r?new b:r,a=n.blockClass,i=void 0===a?"rr-block":a,s=n.blockSelector,c=void 0===s?null:s,u=n.maskTextClass,l=void 0===u?"rr-mask":u,d=n.maskTextSelector,p=void 0===d?null:d,f=n.inlineStylesheet,h=void 0===f||f,g=n.inlineImages,m=void 0!==g&&g,v=n.recordCanvas,y=void 0!==v&&v,I=n.maskAllInputs,C=void 0!==I&&I,S=n.maskTextFn,A=n.maskInputFn,w=n.slimDOM,k=void 0!==w&&w,M=n.dataURLOptions,T=n.preserveWhiteSpace,O=n.onSerialize,N=n.onIframeLoad,E=n.iframeLoadTimeout,R=n.onStylesheetLoad,x=n.stylesheetLoadTimeout,L=n.keepIframeSrcFn;return J(e,{doc:e,mirror:o,blockClass:i,blockSelector:c,maskTextClass:l,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:!0===C?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===C?{password:!0}:C,maskTextFn:S,maskInputFn:A,slimDOMOptions:!0===k||"all"===k?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===k,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===k?{}:k,dataURLOptions:M,inlineImages:m,recordCanvas:y,preserveWhiteSpace:T,onSerialize:O,onIframeLoad:N,iframeLoadTimeout:E,onStylesheetLoad:R,stylesheetLoadTimeout:x,keepIframeSrcFn:void 0===L?function(){return!1}:L,newlyAddedElement:!1})}(document,{mirror:At,blockClass:a,blockSelector:s,maskTextClass:f,maskTextSelector:m,inlineStylesheet:y,maskAllInputs:ee,maskTextFn:w,slimDOM:te,dataURLOptions:E,recordCanvas:L,inlineImages:_,onSerialize:function(e){ue(e,At)&&ge.addIframe(e),le(e,At)&&he.trackLinkElement(e),de(e)&&be.addShadowRoot(e.shadowRoot,document)},onIframeLoad:function(e,t){ge.attachIframe(e,t),be.observeAttachShadow(e)},onStylesheetLoad:function(e,t){he.attachLinkElement(e,t)},keepIframeSrcFn:H});if(!t)return console.warn("Failed to snapshot the document");ht(bt({type:me.FullSnapshot,data:{node:t,initialOffset:ne(window)}}),e),Fe.forEach((function(e){return e.unlock()})),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&he.adoptStyleSheets(document.adoptedStyleSheets,At.getId(document))};try{var Se=[],Ae=function(e){var t;return Le(Pe)({mutationCb:ce,mousemoveCb:function(e,t){return ht(bt({type:me.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.MouseInteraction},e)}))},scrollCb:pe,viewportResizeCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.ViewportResize},e)}))},inputCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.Input},e)}))},mediaInteractionCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.StyleSheetRule},e)}))},styleDeclarationCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.StyleDeclaration},e)}))},canvasMutationCb:fe,fontCb:function(e){return ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.Font},e)}))},selectionCb:function(e){ht(bt({type:me.IncrementalSnapshot,data:Object.assign({source:ve.Selection},e)}))},blockClass:a,ignoreClass:u,ignoreSelector:d,maskTextClass:f,maskTextSelector:m,maskInputOptions:ee,inlineStylesheet:y,sampling:O,recordCanvas:L,inlineImages:_,userTriggeredOnInput:V,collectFonts:U,doc:e,maskInputFn:A,maskTextFn:w,keepIframeSrcFn:H,blockSelector:s,slimDOMOptions:te,dataURLOptions:E,mirror:At,iframeManager:ge,stylesheetManager:he,shadowDomManager:be,processedNodeManager:Ce,canvasManager:mt,ignoreCSSAttributes:z,plugins:(null===(t=null==j?void 0:j.filter((function(e){return e.observer})))||void 0===t?void 0:t.map((function(e){return{observer:e.observer,options:e.options,callback:function(t){return ht(bt({type:me.Plugin,data:{plugin:e.name,payload:t}}))}}})))||[]},k)};ge.addLoadListener((function(e){try{Se.push(Ae(e.contentDocument))}catch(e){console.warn(e)}}));var we=function(){gt(),Se.push(Ae(document)),St=!0};return"interactive"===document.readyState||"complete"===document.readyState?we():(Se.push(q("DOMContentLoaded",(function(){ht(bt({type:me.DomContentLoaded,data:{}})),"DOMContentLoaded"===W&&we()}))),Se.push(q("load",(function(){ht(bt({type:me.Load,data:{}})),"load"===W&&we()}),window))),function(){Se.forEach((function(e){return e()})),Ce.destroy(),St=!1,xe()}}catch(e){console.warn(e)}}wt.addCustomEvent=function(e,t){if(!St)throw new Error("please add custom event after start recording");ht(bt({type:me.Custom,data:{tag:e,payload:t}}))},wt.freezePage=function(){Fe.forEach((function(e){return e.freeze()}))},wt.takeFullSnapshot=function(e){if(!St)throw new Error("please take full snapshot after start recording");gt(e)},wt.mirror=At;var kt=function(){function e(t){s(this,e),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}return u(e,[{key:"toString",value:function(){var e=this.lineNumber||"",t=this.columnNumber||"";return this.functionName?"".concat(this.functionName," (").concat(this.fileName,":").concat(e,":").concat(t,")"):"".concat(this.fileName,":").concat(e,":").concat(t)}}]),e}(),Mt=/(^|@)\S+:\d+/,Tt=/^\s*at .*(\S+:\d+|\(native\))/m,Ot=/^(eval@)?(\[native code])?$/,Nt={parse:function(e){return e?void 0!==e.stacktrace||void 0!==e["opera#sourceloc"]?this.parseOpera(e):e.stack&&e.stack.match(Tt)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!t)throw new Error("Cannot parse given url: ".concat(e));return[t[1],t[2]||void 0,t[3]||void 0]},parseV8OrIE:function(e){return e.stack.split("\n").filter((function(e){return!!e.match(Tt)}),this).map((function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var t=e.replace(/^\s+/,"").replace(/\(eval code/g,"("),n=t.match(/ (\((.+):(\d+):(\d+)\)$)/),r=(t=n?t.replace(n[0],""):t).split(/\s+/).slice(1),o=this.extractLocation(n?n[1]:r.pop()),a=r.join(" ")||void 0,i=["eval",""].indexOf(o[0])>-1?void 0:o[0];return new kt({functionName:a,fileName:i,lineNumber:o[1],columnNumber:o[2]})}),this)},parseFFOrSafari:function(e){return e.stack.split("\n").filter((function(e){return!e.match(Ot)}),this).map((function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new kt({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,o=this.extractLocation(e.replace(t,""));return new kt({functionName:r,fileName:o[0],lineNumber:o[1],columnNumber:o[2]})}),this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf("\n")>-1&&e.message.split("\n").length>e.stacktrace.split("\n").length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var t=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split("\n"),r=[],o=2,a=n.length;o/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new kt({functionName:r,fileName:n[0],lineNumber:n[1],columnNumber:n[2]})}),this)}};function Et(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var n=e.localName;if(!n)break;n=n.toLowerCase();var r=e.parentElement,o=[];if(r.children&&r.children.length>0)for(var a=0;a1&&(n+=":eq(".concat(o.indexOf(e),")")),t=n+(t?">"+t:""),e=r}return t}function Rt(e){return"[object Object]"===Object.prototype.toString.call(e)}function xt(e,t){if(0===t)return!0;for(var n=0,r=Object.keys(e);n0){var a=r.indexOf(this);~a?r.splice(a+1):r.push(this),~a?o.splice(a,1/0,e):o.push(e),~r.indexOf(t)&&(t=r[0]===t?"[Circular ~]":"[Circular ~."+o.slice(0,r.indexOf(t)).join(".")+"]")}else r.push(t);if(null===t)return t;if(void 0===t)return"undefined";if(function(e){if(Rt(e)&&Object.keys(e).length>n.numOfKeysLimit)return!0;if("function"==typeof e)return!0;if(Rt(e)&&xt(e,n.depthOfLimit))return!0;return!1}(t))return function(e){var t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t="".concat(t.slice(0,n.stringLengthLimit),"..."));return t}(t);if(t instanceof Event){var i={};for(var s in t){var c=t[s];Array.isArray(c)?i[s]=Et(c.length?c[0]:null):i[s]=c}return i}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t instanceof Error?t.stack?t.stack+"\nEnd of stack for Error object":t.name+": "+t.message:t}))}var Ft={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Dt(e,t,n){var r,o=n?Object.assign({},Ft,n):Ft,a=o.logger;if(!a)return function(){};r="string"==typeof a?t[a]:a;var i=0,s=!1,c=[];if(o.level.includes("error")){var u=function(t){var n=t.message,r=t.error,a=Nt.parse(r).map((function(e){return e.toString()})),i=[Lt(n,o.stringifyOptions)];e({level:"error",trace:a,payload:i})};t.addEventListener("error",u),c.push((function(){t.removeEventListener("error",u)}));var l=function(t){var n,r;t.reason instanceof Error?(n=t.reason,r=[Lt("Uncaught (in promise) ".concat(n.name,": ").concat(n.message),o.stringifyOptions)]):(n=new Error,r=[Lt("Uncaught (in promise)",o.stringifyOptions),Lt(t.reason,o.stringifyOptions)]);var a=Nt.parse(n).map((function(e){return e.toString()}));e({level:"error",trace:a,payload:r})};t.addEventListener("unhandledrejection",l),c.push((function(){t.removeEventListener("unhandledrejection",l)}))}var d,p=g(o.level);try{for(p.s();!(d=p.n()).done;){var f=d.value;c.push(h(r,f))}}catch(e){p.e(e)}finally{p.f()}return function(){c.forEach((function(e){return e()}))};function h(t,n){var r=this;return t[n]?ee(t,n,(function(t){return function(){for(var a=arguments.length,c=new Array(a),u=0;u1?n-1:0),o=1;o=0;n-=1)if(t(e[n]))return e[n]}function $t(e,t,n){if(n.recordInitialRequests){var r=t.performance.getEntries().filter((function(e){return qt(e)||zt(e)&&n.initiatorTypes.includes(e.initiatorType)}));e({requests:r.flatMap((function(e){return an(e,void 0,void 0,{},!0)})),isInitial:!0})}var o=new t.PerformanceObserver((function(t){var r=t.getEntries().filter((function(e){return qt(e)||zt(e)&&n.initiatorTypes.includes(e.initiatorType)&&function(e){return!n.recordBody&&!n.recordHeaders||"xmlhttprequest"!==e.initiatorType&&"fetch"!==e.initiatorType}(e)}));e({requests:r.flatMap((function(e){return an(e,void 0,void 0,{})}))})})),a=PerformanceObserver.supportedEntryTypes.filter((function(e){return n.performanceEntryTypeToObserve.includes(e)}));return o.observe({entryTypes:a}),function(){o.disconnect()}}function en(e,t){return!!t&&(Kt(t)||t[e])}function tn(e,t,n){function r(e){var t=Object.keys(n).find((function(e){return"content-type"===e.toLowerCase()})),r=t&&n[t];return e.some((function(e){return null==r?void 0:r.includes(e)}))}if(!t)return!1;if(Kt(t))return!0;if(Gt(t))return r(t);var o=t[e];return Kt(o)?o:r(o)}function nn(e,t,n,r,o){return rn.apply(this,arguments)}function rn(){return rn=i(r().mark((function e(t,n,o,a,i){var s,c,u,l=arguments;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!((s=l.length>5&&void 0!==l[5]?l[5]:0)>10)){e.next=4;break}return Yt.warn("Failed to get performance entry for request",{url:o,initiatorType:n}),e.abrupt("return",null);case 4:if(c=t.performance.getEntriesByName(o),u=Xt(c,(function(e){return zt(e)&&e.initiatorType===n&&(!a||e.startTime>=a)&&(!i||e.startTime<=i)}))){e.next=10;break}return e.next=9,new Promise((function(e){return setTimeout(e,50*s)}));case 9:return e.abrupt("return",nn(t,n,o,a,i,s+1));case 10:return e.abrupt("return",u);case 11:case"end":return e.stop()}}),e)}))),rn.apply(this,arguments)}var on=function(e){return"navigation"===e.entryType||"resource"===e.entryType};function an(e,t,r,o,a){var i=Math.floor(Date.now()-performance.now()),s=Math.floor(i+e.startTime),c=[n(n({},e.toJSON()),{},{startTime:Math.round(e.startTime),endTime:Math.round(e.responseEnd),timeOrigin:i,timestamp:s,method:t,initiatorType:e.initiatorType,status:r,requestHeaders:o.requestHeaders,requestBody:o.requestBody,responseHeaders:o.responseHeaders,responseBody:o.responseBody,isInitial:a})];if(on(e)){var u,l=g(e.serverTiming||[]);try{for(l.s();!(u=l.n()).done;){var d=u.value;c.push({timeOrigin:i,timestamp:s,startTime:Math.round(e.startTime),name:d.name,duration:d.duration,entryType:"serverTiming"})}}catch(e){l.e(e)}finally{l.f()}}return c}function sn(e,t,o){if(!("performance"in t))return function(){};var a=o?Object.assign({},Jt,o):Jt,s=function(t){var r=[];t.requests.forEach((function(e){var t=a.maskRequestFn(e);t&&r.push(t)})),(r.length>0||t.isInitial)&&e(n(n({},t),{},{requests:r}))},c=$t(s,t,a),u=function(){},l=function(){};return(a.recordHeaders||a.recordBody)&&(u=function(e,t,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return function(){};var r=en("request",n.recordHeaders),o=en("response",n.recordHeaders),a=Qt(t.XMLHttpRequest.prototype,"open",(function(a){return function(i,s){var c,u,l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],d=arguments.length>3?arguments[3]:void 0,p=arguments.length>4?arguments[4]:void 0,f=this,h=new Request(s),g={},m={},v=f.setRequestHeader.bind(f);f.setRequestHeader=function(e,t){return m[e]=t,v(e,t)},r&&(g.requestHeaders=m);var y=f.send.bind(f);f.send=function(e){return tn("request",n.recordBody,m)&&(Zt(e)||Ut(e)?g.requestBody=null:g.requestBody=e),c=t.performance.now(),y(e)},f.addEventListener("readystatechange",(function(){if(f.readyState===f.DONE){u=t.performance.now();var r={};f.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((function(e){var t=e.split(": "),n=t.shift(),o=t.join(": ");n&&(r[n]=o)})),o&&(g.responseHeaders=r),tn("response",n.recordBody,r)&&(Zt(f.response)||Ut(f.response)?g.responseBody=null:g.responseBody=f.response),nn(t,"xmlhttprequest",h.url,c,u).then((function(t){if(!Ut(t)){var n=an(t,h.method,null==f?void 0:f.status,g);e({requests:n})}})).catch((function(){}))}})),a.call(f,i,s,l,d,p)}}));return function(){a()}}(s,t,a),l=function(e,t,n){if(!n.initiatorTypes.includes("fetch"))return function(){};var o=en("request",n.recordHeaders),a=en("response",n.recordHeaders),s=Qt(t,"fetch",(function(s){return function(){var c=i(r().mark((function i(c,u){var l,d,p,f,h,g,m,v;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return l=new Request(c,u),p={},r.prev=2,g={},l.headers.forEach((function(e,t){g[t]=e})),o&&(p.requestHeaders=g),tn("request",n.recordBody,g)&&(Zt(l.body)||Ut(l.body)?p.requestBody=null:p.requestBody=l.body),f=t.performance.now(),r.next=10,s(l);case 10:if(d=r.sent,h=t.performance.now(),m={},d.headers.forEach((function(e,t){m[t]=e})),a&&(p.responseHeaders=m),!tn("response",n.recordBody,m)){r.next=25;break}return r.prev=16,r.next=19,d.clone().text();case 19:v=r.sent,r.next=24;break;case 22:r.prev=22,r.t0=r.catch(16);case 24:Zt(d.body)||Ut(d.body)?p.responseBody=null:p.responseBody=v;case 25:return r.abrupt("return",d);case 26:return r.prev=26,nn(t,"fetch",l.url,f,h).then((function(t){var n;if(!Ut(t)){var r=an(t,l.method,null===(n=d)||void 0===n?void 0:n.status,p);e({requests:r})}})).catch((function(){})),r.finish(26);case 29:case"end":return r.stop()}}),i,null,[[2,,26,29],[16,22]])})));return function(e,t){return c.apply(this,arguments)}}()}));return function(){s()}}(s,t,a)),function(){c(),u(),l()}}var cn="rrweb/network@1",un=function(e){return{name:cn,observer:sn,options:e}};_t&&(_t.rrweb={record:wt,version:"v2",rrwebVersion:"2.0.0-alpha.11"},_t.rrwebConsoleRecord={getRecordConsolePlugin:function(e){return{name:"rrweb/console@1",observer:Dt,options:e}}},_t.getRecordNetworkPlugin=un),e.NETWORK_PLUGIN_NAME=cn,e.default=wt,e.findLast=Xt,e.getRecordNetworkPlugin=un,e.patch=Qt,Object.defineProperty(e,"__esModule",{value:!0})}({}); //# sourceMappingURL=recorder-v2.js.map