Socket
Socket
Sign inDemoInstall

rrweb

Package Overview
Dependencies
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rrweb - npm Package Compare versions

Comparing version 0.9.13 to 0.9.14

2

dist/record/rrweb-record.min.js

@@ -15,3 +15,3 @@ var rrwebRecord=function(){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function r(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}!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 a=1,i=RegExp("[^a-z1-6-_]");function u(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(s).join(""):null}catch(e){return null}}function s(e){return function(e){return"styleSheet"in e}(e)?u(e.styleSheet)||"":e.cssText}var l,c,d,p,f,h=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,m=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/,v=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(h,(function(e,n,o,r,a,i){var u,s=o||a||i,l=n||r||"";if(!s)return e;if(!m.test(s))return"url("+l+s+l+")";if(v.test(s))return"url("+l+s+l+")";if("/"===s[0])return"url("+l+(((u=t).indexOf("//")>-1?u.split("/").slice(0,3).join("/"):u.split("/")[0]).split("?")[0]+s)+l+")";var c=t.split("/"),d=s.split("/");c.pop();for(var p=0,f=d;p<f.length;p++){var h=f[p];"."!==h&&(".."===h?c.pop():c.push(h))}return"url("+l+c.join("/")+l+")"}))}function g(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function b(e,t,n){return"src"===t||"href"===t&&n?g(e,n):"srcset"===t&&n?function(e,t){return""===t.trim()?t:t.split(",").map((function(t){var n=t.trimLeft().trimRight().split(" ");return 2===n.length?g(e,n[0])+" "+n[1]:1===n.length?""+g(e,n[0]):""})).join(", ")}(e,n):"style"===t&&n?y(n,location.href):n}function C(t,n){var o,r=n.doc,a=n.blockClass,s=n.blockSelector,l=n.inlineStylesheet,c=n.maskInputOptions,d=void 0===c?{}:c,p=n.recordCanvas;switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:for(var f=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else e.classList.forEach((function(e){if(t.test(e))return!0}));return!!n&&e.matches(n)}(t,a,s),h=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return i.test(t)?"div":t}(t),m={},v=0,g=Array.from(t.attributes);v<g.length;v++){var C=g[v],S=C.name,w=C.value;m[S]=b(r,S,w)}if("link"===h&&l){var k,E=Array.from(r.styleSheets).find((function(e){return e.href===t.href}));(k=u(E))&&(delete m.rel,delete m.href,m._cssText=y(k,E.href))}if("style"===h&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(k=u(t.sheet))&&(m._cssText=y(k,location.href));if("input"===h||"textarea"===h||"select"===h){w=t.value;"radio"!==m.type&&"checkbox"!==m.type&&"submit"!==m.type&&"button"!==m.type&&w?m.value=d[m.type]||d[h]?"*".repeat(w.length):w:t.checked&&(m.checked=t.checked)}if("option"===h){var M=t.parentElement;m.value===M.value&&(m.selected=t.selected)}if("canvas"===h&&p&&(m.rr_dataURL=t.toDataURL()),"audio"!==h&&"video"!==h||(m.rr_mediaState=t.paused?"paused":"played"),t.scrollLeft&&(m.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(m.rr_scrollTop=t.scrollTop),f){var I=t.getBoundingClientRect(),O=I.width,x=I.height;m={class:m.class,rr_width:O+"px",rr_height:x+"px"}}return{type:e.Element,tagName:h,attributes:m,childNodes:[],isSVG:(o=t,"svg"===o.tagName||o instanceof SVGElement||void 0),needBlock:f};case t.TEXT_NODE:var N=t.parentNode&&t.parentNode.tagName,T=t.textContent,_="STYLE"===N||void 0;return _&&T&&(T=y(T,location.href)),"SCRIPT"===N&&(T="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:T||"",isStyle:_};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||""};default:return!1}}function S(e){return void 0===e?"":e.toLowerCase()}function w(t,n){var o,r=n.doc,i=n.map,u=n.blockClass,s=n.blockSelector,l=n.skipChild,c=void 0!==l&&l,d=n.inlineStylesheet,p=void 0===d||d,f=n.maskInputOptions,h=void 0===f?{}:f,m=n.slimDOMOptions,v=n.recordCanvas,y=void 0!==v&&v,g=n.preserveWhiteSpace,b=void 0===g||g,k=C(t,{doc:r,blockClass:u,blockSelector:s,inlineStylesheet:p,maskInputOptions:h,recordCanvas:y});if(!k)return console.warn(t,"not serialized"),null;o="__sn"in t?t.__sn.id:!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(S(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===S(t.attributes.name)||"icon"===S(t.attributes.rel)||"apple-touch-icon"===S(t.attributes.rel)||"shortcut icon"===S(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&S(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(S(t.attributes.property).match(/^(og|twitter|fb):/)||S(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===S(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===S(t.attributes.name)||"googlebot"===S(t.attributes.name)||"bingbot"===S(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===S(t.attributes.name)||"generator"===S(t.attributes.name)||"framework"===S(t.attributes.name)||"publisher"===S(t.attributes.name)||"progid"===S(t.attributes.name)||S(t.attributes.property).match(/^article:/)||S(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===S(t.attributes.name)||"yandex-verification"===S(t.attributes.name)||"csrf-token"===S(t.attributes.name)||"p:domain_verify"===S(t.attributes.name)||"verify-v1"===S(t.attributes.name)||"verification"===S(t.attributes.name)||"shopify-checkout-api-token"===S(t.attributes.name)))return!0}}return!1}(k,m)&&(b||k.type!==e.Text||k.isStyle||k.textContent.replace(/^\s+|\s+$/gm,"").length)?a++:-2;var E=Object.assign(k,{id:o});if(t.__sn=E,-2===o)return null;i[o]=t;var M=!c;if(E.type===e.Element&&(M=M&&!E.needBlock,delete E.needBlock),(E.type===e.Document||E.type===e.Element)&&M){m.headWhitespace&&k.type===e.Element&&"head"===k.tagName&&(b=!1);for(var I=0,O=Array.from(t.childNodes);I<O.length;I++){var x=w(O[I],{doc:r,map:i,blockClass:u,blockSelector:s,skipChild:c,inlineStylesheet:p,maskInputOptions:h,slimDOMOptions:m,recordCanvas:y,preserveWhiteSpace:b});x&&E.childNodes.push(x)}}return E}function k(e,t,n){void 0===n&&(n=document);var o={capture:!0,passive:!0};return n.addEventListener(e,t,o),function(){return n.removeEventListener(e,t,o)}}!function(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"}(l||(l={})),function(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"}(c||(c={})),function(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"}(d||(d={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause"}(p||(p={})),function(e){e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change"}(f||(f={}));var E={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return E.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete E.map[t],e.childNodes&&e.childNodes.forEach((function(e){return E.removeNodeFromMap(e)}))},has:function(e){return E.map.hasOwnProperty(e)}};function M(e,t,n){void 0===n&&(n={});var o=null,r=0;return function(a){var i=Date.now();r||!1!==n.leading||(r=i);var u=t-(i-r),s=this,l=arguments;u<=0||u>t?(o&&(window.clearTimeout(o),o=null),r=i,e.apply(s,l)):o||!1===n.trailing||(o=window.setTimeout((function(){r=!1===n.leading?0:Date.now(),o=null,e.apply(s,l)}),u))}}function I(e,t,n,o,r){void 0===r&&(r=window);var a=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,o?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 I(e,t,a||{},!0)}}function O(e,t,n){try{if(!(t in e))return function(){};var o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,function(){e[t]=o}}catch(e){return function(){}}}function x(){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 T(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;return"string"==typeof t?n=e.classList.contains(t):e.classList.forEach((function(e){t.test(e)&&(n=!0)})),n||T(e.parentNode,t)}return e.nodeType,e.TEXT_NODE,T(e.parentNode,t)}function _(e){return"__sn"in e&&-2===e.__sn.id}function L(e){return Boolean(e.changedTouches)}function D(e){return"__ln"in e}var R=function(){function e(){this.length=0,this.head=null}return e.prototype.get=function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t},e.prototype.addNode=function(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&D(e.previousSibling)){var n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&D(e.nextSibling)){n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++},e.prototype.removeNode=function(e){var 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--)},e}(),F=function(e,t){return e+"@"+t};function A(e){return"__sn"in e}function z(e,t){e.delete(t),t.childNodes.forEach((function(t){return z(e,t)}))}function P(e,t){var n=t.parentNode;if(!n)return!1;var o=E.getId(n);return!!e.some((function(e){return e.id===o}))||P(e,n)}function j(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||j(e,n))}function H(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var n=e.localName;if(!n)break;n=n.toLowerCase();var o=e.parentElement,r=[];if(o.children&&o.children.length>0)for(var a=0;a<o.children.length;a++){var i=o.children[a];i.localName&&i.localName.toLowerCase&&i.localName.toLowerCase()===n&&r.push(i)}r.length>1&&(n+=":eq("+r.indexOf(e)+")"),t=n+(t?">"+t:""),e=o}return t}function V(e,t){var n={numOfKeysLimit:50};Object.assign(n,t);var o=[],r=[];return JSON.stringify(e,(function(e,t){if(o.length>0){var a=o.indexOf(this);~a?o.splice(a+1):o.push(this),~a?r.splice(a,1/0,e):r.push(e),~o.indexOf(t)&&(t=o[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,o.indexOf(t)).join(".")+"]")}else o.push(t);if(null==t)return t;if(function(e){return"object"==typeof e&&Object.keys(e).length>n.numOfKeysLimit||"function"==typeof e}(t))return function(e){var t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=t.slice(0,n.stringLengthLimit)+"...");return t}(t);if(t instanceof Event){var i={};for(var u in t){var s=t[u];Array.isArray(s)?i[u]=H(s.length?s[0]:null):i[u]=s}return i}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t}))}var W=new(function(){function e(){var e=this;this.frozen=!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=function(t){t.forEach(e.processMutation),e.frozen||e.emit()},this.emit=function(){for(var t,o,r,a,i=[],u=new R,s=function(t){for(var n=t,o=-2;-2===o;)o=(n=n&&n.nextSibling)&&E.getId(n);return-1===o&&T(t.nextSibling,e.blockClass)&&(o=null),o},l=function(t){if(t.parentNode){var n=E.getId(t.parentNode),o=s(t);if(-1===n||-1===o)return u.addNode(t);var r=w(t,{doc:document,map:E.map,blockClass:e.blockClass,blockSelector:e.blockSelector,skipChild:!0,inlineStylesheet:e.inlineStylesheet,maskInputOptions:e.maskInputOptions,slimDOMOptions:e.slimDOMOptions,recordCanvas:e.recordCanvas});r&&i.push({parentId:n,nextId:o,node:r})}};e.mapRemoves.length;)E.removeNodeFromMap(e.mapRemoves.shift());try{for(var c=n(e.movedSet),d=c.next();!d.done;d=c.next()){var p=d.value;P(e.removes,p)&&!e.movedSet.has(p.parentNode)||l(p)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(t)throw t.error}}try{for(var f=n(e.addedSet),h=f.next();!h.done;h=f.next()){p=h.value;j(e.droppedSet,p)||P(e.removes,p)?j(e.movedSet,p)?l(p):e.droppedSet.add(p):l(p)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}for(var m=null;u.length;){var v=null;if(m){var y=E.getId(m.value.parentNode),g=s(m.value);-1!==y&&-1!==g&&(v=m)}if(!v)for(var b=u.length-1;b>=0;b--){var C=u.get(b);y=E.getId(C.value.parentNode),g=s(C.value);if(-1!==y&&-1!==g){v=C;break}}if(!v)break;m=v.previous,u.removeNode(v.value),l(v.value)}var S={texts:e.texts.map((function(e){return{id:E.getId(e.node),value:e.value}})).filter((function(e){return E.has(e.id)})),attributes:e.attributes.map((function(e){return{id:E.getId(e.node),attributes:e.attributes}})).filter((function(e){return E.has(e.id)})),removes:e.removes,adds:i};(S.texts.length||S.attributes.length||S.removes.length||S.adds.length)&&(e.texts=[],e.attributes=[],e.removes=[],e.addedSet=new Set,e.movedSet=new Set,e.droppedSet=new Set,e.movedMap={},e.emissionCallback(S))},this.processMutation=function(t){if(!_(t.target))switch(t.type){case"characterData":var n=t.target.textContent;T(t.target,e.blockClass)||n===t.oldValue||e.texts.push({value:n,node:t.target});break;case"attributes":n=t.target.getAttribute(t.attributeName);if(T(t.target,e.blockClass)||n===t.oldValue)return;var o=e.attributes.find((function(e){return e.node===t.target}));o||(o={node:t.target,attributes:{}},e.attributes.push(o)),o.attributes[t.attributeName]=b(document,t.attributeName,n);break;case"childList":t.addedNodes.forEach((function(n){return e.genAdds(n,t.target)})),t.removedNodes.forEach((function(n){var o=E.getId(n),r=E.getId(t.target);T(n,e.blockClass)||T(t.target,e.blockClass)||_(n)||(e.addedSet.has(n)?(z(e.addedSet,n),e.droppedSet.add(n)):e.addedSet.has(t.target)&&-1===o||function e(t){var n=E.getId(t);return!E.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode))}(t.target)||(e.movedSet.has(n)&&e.movedMap[F(o,r)]?z(e.movedSet,n):e.removes.push({parentId:r,id:o})),e.mapRemoves.push(n))}))}},this.genAdds=function(t,n){if(!(T(t,e.blockClass)||n&&T(n,e.blockClass))){if(A(t)){if(_(t))return;e.movedSet.add(t);var o=null;n&&A(n)&&(o=n.__sn.id),o&&(e.movedMap[F(t.__sn.id,o)]=!0)}else e.addedSet.add(t),e.droppedSet.delete(t);t.childNodes.forEach((function(t){return e.genAdds(t)}))}}}return e.prototype.init=function(e,t,n,o,r,a,i){this.blockClass=t,this.blockSelector=n,this.inlineStylesheet=o,this.maskInputOptions=r,this.recordCanvas=a,this.slimDOMOptions=i,this.emissionCallback=e},e.prototype.freeze=function(){this.frozen=!0},e.prototype.unfreeze=function(){this.frozen=!1},e.prototype.isFrozen=function(){return this.frozen},e}());function U(e,t,n){if(!1===n.mouseInteraction)return function(){};var o=!0===n.mouseInteraction||void 0===n.mouseInteraction?{}:n.mouseInteraction,r=[];return Object.keys(d).filter((function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]})).forEach((function(n){var o=n.toLowerCase(),a=function(n){return function(o){if(!T(o.target,t)){var r=E.getId(o.target),a=L(o)?o.changedTouches[0]:o,i=a.clientX,u=a.clientY;e({type:d[n],id:r,x:i,y:u})}}}(n);r.push(k(o,a))})),function(){r.forEach((function(e){return e()}))}}var q,B=["INPUT","TEXTAREA","SELECT"],X=new WeakMap;function Y(e,o){void 0===o&&(o={}),function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,i=e.scrollCb,u=e.viewportResizeCb,s=e.inputCb,l=e.mediaInteractionCb,c=e.styleSheetRuleCb,d=e.canvasMutationCb,p=e.fontCb,f=e.logCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,r(e)),n.apply(void 0,r(e))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,r(e)),o.apply(void 0,r(e))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,r(e)),a.apply(void 0,r(e))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,r(e)),i.apply(void 0,r(e))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,r(e)),u.apply(void 0,r(e))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,r(e)),s.apply(void 0,r(e))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,r(e)),l.apply(void 0,r(e))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,r(e)),c.apply(void 0,r(e))},e.canvasMutationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.canvasMutation&&t.canvasMutation.apply(t,r(e)),d.apply(void 0,r(e))},e.fontCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.font&&t.font.apply(t,r(e)),p.apply(void 0,r(e))},e.logCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.log&&t.log.apply(t,r(e)),f.apply(void 0,r(e))}}(e,o);var a,i,u=function(e,t,n,o,r,a,i){W.init(e,t,n,o,r,a,i);var u=new MutationObserver(W.processMutations.bind(W));return u.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),u}(e.mutationCb,e.blockClass,e.blockSelector,e.inlineStylesheet,e.maskInputOptions,e.recordCanvas,e.slimDOMOptions),s=function(e,t){if(!1===t.mousemove)return function(){};var n,o="number"==typeof t.mousemove?t.mousemove:50,r=[],a=M((function(t){var o=Date.now()-n;e(r.map((function(e){return e.timeOffset-=o,e})),t?c.TouchMove:c.MouseMove),r=[],n=null}),500),i=M((function(e){var t=e.target,o=L(e)?e.changedTouches[0]:e,i=o.clientX,u=o.clientY;n||(n=Date.now()),r.push({x:i,y:u,id:E.getId(t),timeOffset:Date.now()-n}),a(L(e))}),o,{trailing:!1}),u=[k("mousemove",i),k("touchmove",i)];return function(){u.forEach((function(e){return e()}))}}(e.mousemoveCb,e.sampling),l=U(e.mouseInteractionCb,e.blockClass,e.sampling),d=(a=e.scrollCb,i=e.blockClass,k("scroll",M((function(e){if(e.target&&!T(e.target,i)){var t=E.getId(e.target);if(e.target===document){var n=document.scrollingElement||document.documentElement;a({id:t,x:n.scrollLeft,y:n.scrollTop})}else a({id:t,x:e.target.scrollLeft,y:e.target.scrollTop})}}),e.sampling.scroll||100))),f=function(e){var t=-1,n=-1;return k("resize",M((function(){var o=x(),r=N();t===o&&n==r||(e({width:Number(r),height:Number(o)}),t=o,n=r)}),200),window)}(e.viewportResizeCb),h=function(e,n,o,a,i,u){function s(e){var t=e.target;if(t&&t.tagName&&!(B.indexOf(t.tagName)<0)&&!T(t,n)){var r=t.type;if("password"!==r&&!t.classList.contains(o)){var u=t.value,s=!1;"radio"===r||"checkbox"===r?s=t.checked:(a[t.tagName.toLowerCase()]||a[r])&&(u=i?i(u):"*".repeat(u.length)),l(t,{text:u,isChecked:s});var c=t.name;"radio"===r&&c&&s&&document.querySelectorAll('input[type="radio"][name="'+c+'"]').forEach((function(e){e!==t&&l(e,{text:e.value,isChecked:!s})}))}}}function l(n,o){var r=X.get(n);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){X.set(n,o);var a=E.getId(n);e(t(t({},o),{id:a}))}}var c=("last"===u.input?["change"]:["input","change"]).map((function(e){return k(e,s)})),d=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),p=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"]];return d&&d.set&&c.push.apply(c,r(p.map((function(e){return I(e[0],e[1],{set:function(){s({target:this})}})})))),function(){c.forEach((function(e){return e()}))}}(e.inputCb,e.blockClass,e.ignoreClass,e.maskInputOptions,e.maskInputFn,e.sampling),m=function(e,t){var n=function(n){return function(o){var r=o.target;r&&!T(r,t)&&e({type:"play"===n?p.Play:p.Pause,id:E.getId(r)})}},o=[k("play",n("play")),k("pause",n("pause"))];return function(){o.forEach((function(e){return e()}))}}(e.mediaInteractionCb,e.blockClass),v=function(e){var t=CSSStyleSheet.prototype.insertRule;CSSStyleSheet.prototype.insertRule=function(n,o){var r=E.getId(this.ownerNode);return-1!==r&&e({id:r,adds:[{rule:n,index:o}]}),t.apply(this,arguments)};var n=CSSStyleSheet.prototype.deleteRule;return CSSStyleSheet.prototype.deleteRule=function(t){var o=E.getId(this.ownerNode);return-1!==o&&e({id:o,removes:[{index:t}]}),n.apply(this,arguments)},function(){CSSStyleSheet.prototype.insertRule=t,CSSStyleSheet.prototype.deleteRule=n}}(e.styleSheetRuleCb),y=e.recordCanvas?function(e,t){var o,a,i=Object.getOwnPropertyNames(CanvasRenderingContext2D.prototype),u=[],s=function(n){try{if("function"!=typeof CanvasRenderingContext2D.prototype[n])return"continue";var o=O(CanvasRenderingContext2D.prototype,n,(function(o){return function(){for(var a=this,i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];return T(this.canvas,t)||setTimeout((function(){var t=r(i);"drawImage"===n&&t[0]&&t[0]instanceof HTMLCanvasElement&&(t[0]=t[0].toDataURL()),e({id:E.getId(a.canvas),property:n,args:t})}),0),o.apply(this,i)}}));u.push(o)}catch(t){var a=I(CanvasRenderingContext2D.prototype,n,{set:function(t){e({id:E.getId(this.canvas),property:n,args:[t],setter:!0})}});u.push(a)}};try{for(var l=n(i),c=l.next();!c.done;c=l.next()){s(c.value)}}catch(e){o={error:e}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}return function(){u.forEach((function(e){return e()}))}}(e.canvasMutationCb,e.blockClass):function(){},g=e.collectFonts?function(e){var t=[],n=new WeakMap,o=FontFace;window.FontFace=function(e,t,r){var a=new o(e,t,r);return n.set(a,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),a};var r=O(document.fonts,"add",(function(t){return function(o){return setTimeout((function(){var t=n.get(o);t&&(e(t),n.delete(o))}),0),t.apply(this,[o])}}));return t.push((function(){window.FonFace=o})),t.push(r),function(){t.forEach((function(e){return e()}))}}(e.fontCb):function(){},b=e.logOptions?function(e,t){var o,a,i=this,u=t.logger;if(!u)return function(){};var s=0,l=[];if(t.level.includes("error")&&window){var c=window.onerror;window.onerror=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];c&&c.apply(i,n);var r=[];n[n.length-1]instanceof Error&&(r=m(n[n.length-1].stack,0));var a=[V(n[0],t.stringifyOptions)];e({level:"error",trace:r,payload:a})},l.push((function(){window.onerror=c}))}try{for(var d=n(t.level),p=d.next();!p.done;p=d.next()){var f=p.value;l.push(h(u,f))}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}return function(){l.forEach((function(e){return e()}))};function h(n,o){var a=this;return n[o]?O(n,o,(function(n){return function(){for(var i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];n.apply(a,i);try{var l=m((new Error).stack),c=i.map((function(e){return V(e,t.stringifyOptions)}));++s<t.lengthThreshold?e({level:o,trace:l,payload:c}):s===t.lengthThreshold&&e({level:"warn",trace:[],payload:[V("The number of log records reached the threshold.")]})}catch(e){n.apply(void 0,r(["rrweb logger error:",e],i))}}})):function(){}}function m(e,t){void 0===t&&(t=1);var n=[];return e&&(n=e.split("at").splice(1+t).map((function(e){return e.trim()}))),n}}(e.logCb,e.logOptions):function(){};return function(){u.disconnect(),s(),l(),d(),f(),h(),m(),v(),y(),g(),b()}}function K(e){return t(t({},e),{timestamp:Date.now()})}function $(e){void 0===e&&(e={});var n=e.emit,r=e.checkoutEveryNms,a=e.checkoutEveryNth,i=e.blockClass,u=void 0===i?"rr-block":i,s=e.blockSelector,d=void 0===s?null:s,p=e.ignoreClass,f=void 0===p?"rr-ignore":p,h=e.inlineStylesheet,m=void 0===h||h,v=e.maskAllInputs,y=e.maskInputOptions,g=e.slimDOMOptions,b=e.maskInputFn,C=e.hooks,S=e.packFn,M=e.sampling,I=void 0===M?{}:M,O=e.mousemoveWait,T=e.recordCanvas,_=void 0!==T&&T,L=e.collectFonts,D=void 0!==L&&L,R=e.recordLog,F=void 0!==R&&R;if(!n)throw new Error("emit function is required");void 0!==O&&void 0===I.mousemove&&(I.mousemove=O);var A,z,P=!0===v?{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}:void 0!==y?y:{},j=!0===g||"all"===g?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===g,headMetaDescKeywords:"all"===g}:g||{},H={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:console},V=F?!0===F?H:Object.assign({},H,F):{};void 0===A&&(A=window),"NodeList"in A&&!A.NodeList.prototype.forEach&&(A.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in A&&!A.DOMTokenList.prototype.forEach&&(A.DOMTokenList.prototype.forEach=Array.prototype.forEach);var U=0;function B(e){var t,n,r,a;void 0===e&&(e=!1),q(K({type:l.Meta,data:{href:window.location.href,width:N(),height:x()}}),e);var i=W.isFrozen();W.freeze();var s=o(function(e,t){var n=t||{},o=n.blockClass,r=void 0===o?"rr-block":o,a=n.inlineStylesheet,i=void 0===a||a,u=n.recordCanvas,s=void 0!==u&&u,l=n.blockSelector,c=void 0===l?null:l,d=n.maskAllInputs,p=void 0!==d&&d,f=n.slimDOM,h=void 0!==f&&f,m={};return[w(e,{doc:e,map:m,blockClass:r,blockSelector:c,skipChild:!1,inlineStylesheet:i,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===p?{}:p,slimDOMOptions:!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===h,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===h?{}:h,recordCanvas:s}),m]}(document,{blockClass:u,blockSelector:d,inlineStylesheet:m,maskAllInputs:P,slimDOM:j,recordCanvas:_}),2),c=s[0],p=s[1];if(!c)return console.warn("Failed to snapshot the document");E.map=p,q(K({type:l.FullSnapshot,data:{node:c,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.parentElement)||void 0===a?void 0:a.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}})),i||(W.emit(),W.unfreeze())}q=function(e,t){if(!W.isFrozen()||e.type===l.FullSnapshot||e.type===l.IncrementalSnapshot&&e.data.source===c.Mutation||(W.emit(),W.unfreeze()),n(S?S(e):e,t),e.type===l.FullSnapshot)z=e,U=0;else if(e.type===l.IncrementalSnapshot){U++;var o=a&&U>=a,i=r&&e.timestamp-z.timestamp>r;(o||i)&&B(!0)}};try{var X=[];X.push(k("DOMContentLoaded",(function(){q(K({type:l.DomContentLoaded,data:{}}))})));var $=function(){B(),X.push(Y({mutationCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Mutation},e)}))},mousemoveCb:function(e,t){return q(K({type:l.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.MouseInteraction},e)}))},scrollCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Scroll},e)}))},viewportResizeCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.ViewportResize},e)}))},inputCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Input},e)}))},mediaInteractionCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.StyleSheetRule},e)}))},canvasMutationCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.CanvasMutation},e)}))},fontCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Font},e)}))},logCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Log},e)}))},blockClass:u,blockSelector:d,ignoreClass:f,maskInputOptions:P,maskInputFn:b,inlineStylesheet:m,sampling:I,recordCanvas:_,collectFonts:D,slimDOMOptions:j,logOptions:V},C))};return"interactive"===document.readyState||"complete"===document.readyState?$():X.push(k("load",(function(){q(K({type:l.Load,data:{}})),$()}),window)),function(){X.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}return $.addCustomEvent=function(e,t){if(!q)throw new Error("please add custom event after start recording");q(K({type:l.Custom,data:{tag:e,payload:t}}))},$.freezePage=function(){W.freeze()},$}();
***************************************************************************** */var e,t=function(){return(t=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function n(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function r(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}!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 a=1,i=RegExp("[^a-z1-6-_]");function u(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).map(s).join(""):null}catch(e){return null}}function s(e){return function(e){return"styleSheet"in e}(e)?u(e.styleSheet)||"":e.cssText}var l,c,d,p,f,h=/url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm,m=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,v=/^(data:)([^,]*),(.*)/i;function y(e,t){return(e||"").replace(h,(function(e,n,o,r,a,i){var u,s=o||a||i,l=n||r||"";if(!s)return e;if(!m.test(s))return"url("+l+s+l+")";if(v.test(s))return"url("+l+s+l+")";if("/"===s[0])return"url("+l+(((u=t).indexOf("//")>-1?u.split("/").slice(0,3).join("/"):u.split("/")[0]).split("?")[0]+s)+l+")";var c=t.split("/"),d=s.split("/");c.pop();for(var p=0,f=d;p<f.length;p++){var h=f[p];"."!==h&&(".."===h?c.pop():c.push(h))}return"url("+l+c.join("/")+l+")"}))}function g(e,t){if(!t||""===t.trim())return t;var n=e.createElement("a");return n.href=t,n.href}function b(e,t,n){return"src"===t||("href"===t||"xlink:href"===t)&&n?g(e,n):"srcset"===t&&n?function(e,t){return""===t.trim()?t:t.split(",").map((function(t){var n=t.trimLeft().trimRight().split(" ");return 2===n.length?g(e,n[0])+" "+n[1]:1===n.length?""+g(e,n[0]):""})).join(", ")}(e,n):"style"===t&&n?y(n,location.href):n}function C(t,n){var o,r=n.doc,a=n.blockClass,s=n.blockSelector,l=n.inlineStylesheet,c=n.maskInputOptions,d=void 0===c?{}:c,p=n.recordCanvas;switch(t.nodeType){case t.DOCUMENT_NODE:return{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId};case t.ELEMENT_NODE:for(var f=function(e,t,n){if("string"==typeof t){if(e.classList.contains(t))return!0}else e.classList.forEach((function(e){if(t.test(e))return!0}));return!!n&&e.matches(n)}(t,a,s),h=function(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return i.test(t)?"div":t}(t),m={},v=0,g=Array.from(t.attributes);v<g.length;v++){var C=g[v],S=C.name,w=C.value;m[S]=b(r,S,w)}if("link"===h&&l){var k,E=Array.from(r.styleSheets).find((function(e){return e.href===t.href}));(k=u(E))&&(delete m.rel,delete m.href,m._cssText=y(k,E.href))}if("style"===h&&t.sheet&&!(t.innerText||t.textContent||"").trim().length)(k=u(t.sheet))&&(m._cssText=y(k,location.href));if("input"===h||"textarea"===h||"select"===h){w=t.value;"radio"!==m.type&&"checkbox"!==m.type&&"submit"!==m.type&&"button"!==m.type&&w?m.value=d[m.type]||d[h]?"*".repeat(w.length):w:t.checked&&(m.checked=t.checked)}if("option"===h){var M=t.parentElement;m.value===M.value&&(m.selected=t.selected)}if("canvas"===h&&p&&(m.rr_dataURL=t.toDataURL()),"audio"!==h&&"video"!==h||(m.rr_mediaState=t.paused?"paused":"played"),t.scrollLeft&&(m.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(m.rr_scrollTop=t.scrollTop),f){var I=t.getBoundingClientRect(),O=I.width,x=I.height;m={class:m.class,rr_width:O+"px",rr_height:x+"px"}}return{type:e.Element,tagName:h,attributes:m,childNodes:[],isSVG:(o=t,"svg"===o.tagName||o instanceof SVGElement||void 0),needBlock:f};case t.TEXT_NODE:var N=t.parentNode&&t.parentNode.tagName,T=t.textContent,_="STYLE"===N||void 0;return _&&T&&(T=y(T,location.href)),"SCRIPT"===N&&(T="SCRIPT_PLACEHOLDER"),{type:e.Text,textContent:T||"",isStyle:_};case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:""};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||""};default:return!1}}function S(e){return void 0===e?"":e.toLowerCase()}function w(t,n){var o,r=n.doc,i=n.map,u=n.blockClass,s=n.blockSelector,l=n.skipChild,c=void 0!==l&&l,d=n.inlineStylesheet,p=void 0===d||d,f=n.maskInputOptions,h=void 0===f?{}:f,m=n.slimDOMOptions,v=n.recordCanvas,y=void 0!==v&&v,g=n.preserveWhiteSpace,b=void 0===g||g,k=C(t,{doc:r,blockClass:u,blockSelector:s,inlineStylesheet:p,maskInputOptions:h,recordCanvas:y});if(!k)return console.warn(t,"not serialized"),null;o="__sn"in t?t.__sn.id:!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&"preload"===t.attributes.rel&&"script"===t.attributes.as))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(S(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===S(t.attributes.name)||"icon"===S(t.attributes.rel)||"apple-touch-icon"===S(t.attributes.rel)||"shortcut icon"===S(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&S(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(S(t.attributes.property).match(/^(og|twitter|fb):/)||S(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===S(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===S(t.attributes.name)||"googlebot"===S(t.attributes.name)||"bingbot"===S(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===S(t.attributes.name)||"generator"===S(t.attributes.name)||"framework"===S(t.attributes.name)||"publisher"===S(t.attributes.name)||"progid"===S(t.attributes.name)||S(t.attributes.property).match(/^article:/)||S(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===S(t.attributes.name)||"yandex-verification"===S(t.attributes.name)||"csrf-token"===S(t.attributes.name)||"p:domain_verify"===S(t.attributes.name)||"verify-v1"===S(t.attributes.name)||"verification"===S(t.attributes.name)||"shopify-checkout-api-token"===S(t.attributes.name)))return!0}}return!1}(k,m)&&(b||k.type!==e.Text||k.isStyle||k.textContent.replace(/^\s+|\s+$/gm,"").length)?a++:-2;var E=Object.assign(k,{id:o});if(t.__sn=E,-2===o)return null;i[o]=t;var M=!c;if(E.type===e.Element&&(M=M&&!E.needBlock,delete E.needBlock),(E.type===e.Document||E.type===e.Element)&&M){m.headWhitespace&&k.type===e.Element&&"head"===k.tagName&&(b=!1);for(var I=0,O=Array.from(t.childNodes);I<O.length;I++){var x=w(O[I],{doc:r,map:i,blockClass:u,blockSelector:s,skipChild:c,inlineStylesheet:p,maskInputOptions:h,slimDOMOptions:m,recordCanvas:y,preserveWhiteSpace:b});x&&E.childNodes.push(x)}}return E}function k(e,t,n){void 0===n&&(n=document);var o={capture:!0,passive:!0};return n.addEventListener(e,t,o),function(){return n.removeEventListener(e,t,o)}}!function(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"}(l||(l={})),function(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"}(c||(c={})),function(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"}(d||(d={})),function(e){e[e.Play=0]="Play",e[e.Pause=1]="Pause"}(p||(p={})),function(e){e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change"}(f||(f={}));var E={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return E.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete E.map[t],e.childNodes&&e.childNodes.forEach((function(e){return E.removeNodeFromMap(e)}))},has:function(e){return E.map.hasOwnProperty(e)}};function M(e,t,n){void 0===n&&(n={});var o=null,r=0;return function(a){var i=Date.now();r||!1!==n.leading||(r=i);var u=t-(i-r),s=this,l=arguments;u<=0||u>t?(o&&(window.clearTimeout(o),o=null),r=i,e.apply(s,l)):o||!1===n.trailing||(o=window.setTimeout((function(){r=!1===n.leading?0:Date.now(),o=null,e.apply(s,l)}),u))}}function I(e,t,n,o,r){void 0===r&&(r=window);var a=r.Object.getOwnPropertyDescriptor(e,t);return r.Object.defineProperty(e,t,o?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 I(e,t,a||{},!0)}}function O(e,t,n){try{if(!(t in e))return function(){};var o=e[t],r=n(o);return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:o}})),e[t]=r,function(){e[t]=o}}catch(e){return function(){}}}function x(){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 T(e,t){if(!e)return!1;if(e.nodeType===e.ELEMENT_NODE){var n=!1;return"string"==typeof t?n=e.classList.contains(t):e.classList.forEach((function(e){t.test(e)&&(n=!0)})),n||T(e.parentNode,t)}return e.nodeType,e.TEXT_NODE,T(e.parentNode,t)}function _(e){return"__sn"in e&&-2===e.__sn.id}function L(e){return Boolean(e.changedTouches)}function D(e){return"__ln"in e}var R=function(){function e(){this.length=0,this.head=null}return e.prototype.get=function(e){if(e>=this.length)throw new Error("Position outside of list range");for(var t=this.head,n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t},e.prototype.addNode=function(e){var t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&D(e.previousSibling)){var n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&D(e.nextSibling)){n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;this.length++},e.prototype.removeNode=function(e){var 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--)},e}(),F=function(e,t){return e+"@"+t};function A(e){return"__sn"in e}function z(e,t){e.delete(t),t.childNodes.forEach((function(t){return z(e,t)}))}function P(e,t){var n=t.parentNode;if(!n)return!1;var o=E.getId(n);return!!e.some((function(e){return e.id===o}))||P(e,n)}function j(e,t){var n=t.parentNode;return!!n&&(!!e.has(n)||j(e,n))}function H(e){if(!e||!e.outerHTML)return"";for(var t="";e.parentElement;){var n=e.localName;if(!n)break;n=n.toLowerCase();var o=e.parentElement,r=[];if(o.children&&o.children.length>0)for(var a=0;a<o.children.length;a++){var i=o.children[a];i.localName&&i.localName.toLowerCase&&i.localName.toLowerCase()===n&&r.push(i)}r.length>1&&(n+=":eq("+r.indexOf(e)+")"),t=n+(t?">"+t:""),e=o}return t}function V(e,t){var n={numOfKeysLimit:50};Object.assign(n,t);var o=[],r=[];return JSON.stringify(e,(function(e,t){if(o.length>0){var a=o.indexOf(this);~a?o.splice(a+1):o.push(this),~a?r.splice(a,1/0,e):r.push(e),~o.indexOf(t)&&(t=o[0]===t?"[Circular ~]":"[Circular ~."+r.slice(0,o.indexOf(t)).join(".")+"]")}else o.push(t);if(null==t)return t;if(function(e){return"object"==typeof e&&Object.keys(e).length>n.numOfKeysLimit||"function"==typeof e}(t))return function(e){var t=e.toString();n.stringLengthLimit&&t.length>n.stringLengthLimit&&(t=t.slice(0,n.stringLengthLimit)+"...");return t}(t);if(t instanceof Event){var i={};for(var u in t){var s=t[u];Array.isArray(s)?i[u]=H(s.length?s[0]:null):i[u]=s}return i}return t instanceof Node?t instanceof HTMLElement?t?t.outerHTML:"":t.nodeName:t}))}var W=new(function(){function e(){var e=this;this.frozen=!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=function(t){t.forEach(e.processMutation),e.frozen||e.emit()},this.emit=function(){for(var t,o,r,a,i=[],u=new R,s=function(t){for(var n=t,o=-2;-2===o;)o=(n=n&&n.nextSibling)&&E.getId(n);return-1===o&&T(t.nextSibling,e.blockClass)&&(o=null),o},l=function(t){if(t.parentNode&&document.contains(t)){var n=E.getId(t.parentNode),o=s(t);if(-1===n||-1===o)return u.addNode(t);var r=w(t,{doc:document,map:E.map,blockClass:e.blockClass,blockSelector:e.blockSelector,skipChild:!0,inlineStylesheet:e.inlineStylesheet,maskInputOptions:e.maskInputOptions,slimDOMOptions:e.slimDOMOptions,recordCanvas:e.recordCanvas});r&&i.push({parentId:n,nextId:o,node:r})}};e.mapRemoves.length;)E.removeNodeFromMap(e.mapRemoves.shift());try{for(var c=n(e.movedSet),d=c.next();!d.done;d=c.next()){var p=d.value;P(e.removes,p)&&!e.movedSet.has(p.parentNode)||l(p)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(t)throw t.error}}try{for(var f=n(e.addedSet),h=f.next();!h.done;h=f.next()){p=h.value;j(e.droppedSet,p)||P(e.removes,p)?j(e.movedSet,p)?l(p):e.droppedSet.add(p):l(p)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}for(var m=null;u.length;){var v=null;if(m){var y=E.getId(m.value.parentNode),g=s(m.value);-1!==y&&-1!==g&&(v=m)}if(!v)for(var b=u.length-1;b>=0;b--){var C=u.get(b);y=E.getId(C.value.parentNode),g=s(C.value);if(-1!==y&&-1!==g){v=C;break}}if(!v){for(;u.head;)u.removeNode(u.head.value);break}m=v.previous,u.removeNode(v.value),l(v.value)}var S={texts:e.texts.map((function(e){return{id:E.getId(e.node),value:e.value}})).filter((function(e){return E.has(e.id)})),attributes:e.attributes.map((function(e){return{id:E.getId(e.node),attributes:e.attributes}})).filter((function(e){return E.has(e.id)})),removes:e.removes,adds:i};(S.texts.length||S.attributes.length||S.removes.length||S.adds.length)&&(e.texts=[],e.attributes=[],e.removes=[],e.addedSet=new Set,e.movedSet=new Set,e.droppedSet=new Set,e.movedMap={},e.emissionCallback(S))},this.processMutation=function(t){if(!_(t.target))switch(t.type){case"characterData":var n=t.target.textContent;T(t.target,e.blockClass)||n===t.oldValue||e.texts.push({value:n,node:t.target});break;case"attributes":n=t.target.getAttribute(t.attributeName);if(T(t.target,e.blockClass)||n===t.oldValue)return;var o=e.attributes.find((function(e){return e.node===t.target}));o||(o={node:t.target,attributes:{}},e.attributes.push(o)),o.attributes[t.attributeName]=b(document,t.attributeName,n);break;case"childList":t.addedNodes.forEach((function(n){return e.genAdds(n,t.target)})),t.removedNodes.forEach((function(n){var o=E.getId(n),r=E.getId(t.target);T(n,e.blockClass)||T(t.target,e.blockClass)||_(n)||(e.addedSet.has(n)?(z(e.addedSet,n),e.droppedSet.add(n)):e.addedSet.has(t.target)&&-1===o||function e(t){var n=E.getId(t);return!E.has(n)||(!t.parentNode||t.parentNode.nodeType!==t.DOCUMENT_NODE)&&(!t.parentNode||e(t.parentNode))}(t.target)||(e.movedSet.has(n)&&e.movedMap[F(o,r)]?z(e.movedSet,n):e.removes.push({parentId:r,id:o})),e.mapRemoves.push(n))}))}},this.genAdds=function(t,n){if(!(T(t,e.blockClass)||n&&T(n,e.blockClass))){if(A(t)){if(_(t))return;e.movedSet.add(t);var o=null;n&&A(n)&&(o=n.__sn.id),o&&(e.movedMap[F(t.__sn.id,o)]=!0)}else e.addedSet.add(t),e.droppedSet.delete(t);t.childNodes.forEach((function(t){return e.genAdds(t)}))}}}return e.prototype.init=function(e,t,n,o,r,a,i){this.blockClass=t,this.blockSelector=n,this.inlineStylesheet=o,this.maskInputOptions=r,this.recordCanvas=a,this.slimDOMOptions=i,this.emissionCallback=e},e.prototype.freeze=function(){this.frozen=!0},e.prototype.unfreeze=function(){this.frozen=!1},e.prototype.isFrozen=function(){return this.frozen},e}());function U(e,t,n){if(!1===n.mouseInteraction)return function(){};var o=!0===n.mouseInteraction||void 0===n.mouseInteraction?{}:n.mouseInteraction,r=[];return Object.keys(d).filter((function(e){return Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==o[e]})).forEach((function(n){var o=n.toLowerCase(),a=function(n){return function(o){if(!T(o.target,t)){var r=E.getId(o.target),a=L(o)?o.changedTouches[0]:o,i=a.clientX,u=a.clientY;e({type:d[n],id:r,x:i,y:u})}}}(n);r.push(k(o,a))})),function(){r.forEach((function(e){return e()}))}}var q,B=["INPUT","TEXTAREA","SELECT"],X=new WeakMap;function Y(e,o){void 0===o&&(o={}),function(e,t){var n=e.mutationCb,o=e.mousemoveCb,a=e.mouseInteractionCb,i=e.scrollCb,u=e.viewportResizeCb,s=e.inputCb,l=e.mediaInteractionCb,c=e.styleSheetRuleCb,d=e.canvasMutationCb,p=e.fontCb,f=e.logCb;e.mutationCb=function(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];t.mutation&&t.mutation.apply(t,r(e)),n.apply(void 0,r(e))},e.mousemoveCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mousemove&&t.mousemove.apply(t,r(e)),o.apply(void 0,r(e))},e.mouseInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mouseInteraction&&t.mouseInteraction.apply(t,r(e)),a.apply(void 0,r(e))},e.scrollCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.scroll&&t.scroll.apply(t,r(e)),i.apply(void 0,r(e))},e.viewportResizeCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.viewportResize&&t.viewportResize.apply(t,r(e)),u.apply(void 0,r(e))},e.inputCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.input&&t.input.apply(t,r(e)),s.apply(void 0,r(e))},e.mediaInteractionCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.mediaInteaction&&t.mediaInteaction.apply(t,r(e)),l.apply(void 0,r(e))},e.styleSheetRuleCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.styleSheetRule&&t.styleSheetRule.apply(t,r(e)),c.apply(void 0,r(e))},e.canvasMutationCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.canvasMutation&&t.canvasMutation.apply(t,r(e)),d.apply(void 0,r(e))},e.fontCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.font&&t.font.apply(t,r(e)),p.apply(void 0,r(e))},e.logCb=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];t.log&&t.log.apply(t,r(e)),f.apply(void 0,r(e))}}(e,o);var a,i,u=function(e,t,n,o,r,a,i){W.init(e,t,n,o,r,a,i);var u=new MutationObserver(W.processMutations.bind(W));return u.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),u}(e.mutationCb,e.blockClass,e.blockSelector,e.inlineStylesheet,e.maskInputOptions,e.recordCanvas,e.slimDOMOptions),s=function(e,t){if(!1===t.mousemove)return function(){};var n,o="number"==typeof t.mousemove?t.mousemove:50,r=[],a=M((function(t){var o=Date.now()-n;e(r.map((function(e){return e.timeOffset-=o,e})),t?c.TouchMove:c.MouseMove),r=[],n=null}),500),i=M((function(e){var t=e.target,o=L(e)?e.changedTouches[0]:e,i=o.clientX,u=o.clientY;n||(n=Date.now()),r.push({x:i,y:u,id:E.getId(t),timeOffset:Date.now()-n}),a(L(e))}),o,{trailing:!1}),u=[k("mousemove",i),k("touchmove",i)];return function(){u.forEach((function(e){return e()}))}}(e.mousemoveCb,e.sampling),l=U(e.mouseInteractionCb,e.blockClass,e.sampling),d=(a=e.scrollCb,i=e.blockClass,k("scroll",M((function(e){if(e.target&&!T(e.target,i)){var t=E.getId(e.target);if(e.target===document){var n=document.scrollingElement||document.documentElement;a({id:t,x:n.scrollLeft,y:n.scrollTop})}else a({id:t,x:e.target.scrollLeft,y:e.target.scrollTop})}}),e.sampling.scroll||100))),f=function(e){var t=-1,n=-1;return k("resize",M((function(){var o=x(),r=N();t===o&&n==r||(e({width:Number(r),height:Number(o)}),t=o,n=r)}),200),window)}(e.viewportResizeCb),h=function(e,n,o,a,i,u){function s(e){var t=e.target;if(t&&t.tagName&&!(B.indexOf(t.tagName)<0)&&!T(t,n)){var r=t.type;if("password"!==r&&!t.classList.contains(o)){var u=t.value,s=!1;"radio"===r||"checkbox"===r?s=t.checked:(a[t.tagName.toLowerCase()]||a[r])&&(u=i?i(u):"*".repeat(u.length)),l(t,{text:u,isChecked:s});var c=t.name;"radio"===r&&c&&s&&document.querySelectorAll('input[type="radio"][name="'+c+'"]').forEach((function(e){e!==t&&l(e,{text:e.value,isChecked:!s})}))}}}function l(n,o){var r=X.get(n);if(!r||r.text!==o.text||r.isChecked!==o.isChecked){X.set(n,o);var a=E.getId(n);e(t(t({},o),{id:a}))}}var c=("last"===u.input?["change"]:["input","change"]).map((function(e){return k(e,s)})),d=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),p=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"]];return d&&d.set&&c.push.apply(c,r(p.map((function(e){return I(e[0],e[1],{set:function(){s({target:this})}})})))),function(){c.forEach((function(e){return e()}))}}(e.inputCb,e.blockClass,e.ignoreClass,e.maskInputOptions,e.maskInputFn,e.sampling),m=function(e,t){var n=function(n){return function(o){var r=o.target;r&&!T(r,t)&&e({type:"play"===n?p.Play:p.Pause,id:E.getId(r)})}},o=[k("play",n("play")),k("pause",n("pause"))];return function(){o.forEach((function(e){return e()}))}}(e.mediaInteractionCb,e.blockClass),v=function(e){var t=CSSStyleSheet.prototype.insertRule;CSSStyleSheet.prototype.insertRule=function(n,o){var r=E.getId(this.ownerNode);return-1!==r&&e({id:r,adds:[{rule:n,index:o}]}),t.apply(this,arguments)};var n=CSSStyleSheet.prototype.deleteRule;return CSSStyleSheet.prototype.deleteRule=function(t){var o=E.getId(this.ownerNode);return-1!==o&&e({id:o,removes:[{index:t}]}),n.apply(this,arguments)},function(){CSSStyleSheet.prototype.insertRule=t,CSSStyleSheet.prototype.deleteRule=n}}(e.styleSheetRuleCb),y=e.recordCanvas?function(e,t){var o,a,i=Object.getOwnPropertyNames(CanvasRenderingContext2D.prototype),u=[],s=function(n){try{if("function"!=typeof CanvasRenderingContext2D.prototype[n])return"continue";var o=O(CanvasRenderingContext2D.prototype,n,(function(o){return function(){for(var a=this,i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];return T(this.canvas,t)||setTimeout((function(){var t=r(i);"drawImage"===n&&t[0]&&t[0]instanceof HTMLCanvasElement&&(t[0]=t[0].toDataURL()),e({id:E.getId(a.canvas),property:n,args:t})}),0),o.apply(this,i)}}));u.push(o)}catch(t){var a=I(CanvasRenderingContext2D.prototype,n,{set:function(t){e({id:E.getId(this.canvas),property:n,args:[t],setter:!0})}});u.push(a)}};try{for(var l=n(i),c=l.next();!c.done;c=l.next()){s(c.value)}}catch(e){o={error:e}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}return function(){u.forEach((function(e){return e()}))}}(e.canvasMutationCb,e.blockClass):function(){},g=e.collectFonts?function(e){var t=[],n=new WeakMap,o=FontFace;window.FontFace=function(e,t,r){var a=new o(e,t,r);return n.set(a,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),a};var r=O(document.fonts,"add",(function(t){return function(o){return setTimeout((function(){var t=n.get(o);t&&(e(t),n.delete(o))}),0),t.apply(this,[o])}}));return t.push((function(){window.FonFace=o})),t.push(r),function(){t.forEach((function(e){return e()}))}}(e.fontCb):function(){},b=e.logOptions?function(e,t){var o,a,i=this,u=t.logger;if(!u)return function(){};var s=0,l=[];if(t.level.includes("error")&&window){var c=window.onerror;window.onerror=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];c&&c.apply(i,n);var r=[];n[n.length-1]instanceof Error&&(r=m(n[n.length-1].stack,0));var a=[V(n[0],t.stringifyOptions)];e({level:"error",trace:r,payload:a})},l.push((function(){window.onerror=c}))}try{for(var d=n(t.level),p=d.next();!p.done;p=d.next()){var f=p.value;l.push(h(u,f))}}catch(e){o={error:e}}finally{try{p&&!p.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}return function(){l.forEach((function(e){return e()}))};function h(n,o){var a=this;return n[o]?O(n,o,(function(n){return function(){for(var i=[],u=0;u<arguments.length;u++)i[u]=arguments[u];n.apply(a,i);try{var l=m((new Error).stack),c=i.map((function(e){return V(e,t.stringifyOptions)}));++s<t.lengthThreshold?e({level:o,trace:l,payload:c}):s===t.lengthThreshold&&e({level:"warn",trace:[],payload:[V("The number of log records reached the threshold.")]})}catch(e){n.apply(void 0,r(["rrweb logger error:",e],i))}}})):function(){}}function m(e,t){void 0===t&&(t=1);var n=[];return e&&(n=e.split("at").splice(1+t).map((function(e){return e.trim()}))),n}}(e.logCb,e.logOptions):function(){};return function(){u.disconnect(),s(),l(),d(),f(),h(),m(),v(),y(),g(),b()}}function K(e){return t(t({},e),{timestamp:Date.now()})}function $(e){void 0===e&&(e={});var n=e.emit,r=e.checkoutEveryNms,a=e.checkoutEveryNth,i=e.blockClass,u=void 0===i?"rr-block":i,s=e.blockSelector,d=void 0===s?null:s,p=e.ignoreClass,f=void 0===p?"rr-ignore":p,h=e.inlineStylesheet,m=void 0===h||h,v=e.maskAllInputs,y=e.maskInputOptions,g=e.slimDOMOptions,b=e.maskInputFn,C=e.hooks,S=e.packFn,M=e.sampling,I=void 0===M?{}:M,O=e.mousemoveWait,T=e.recordCanvas,_=void 0!==T&&T,L=e.collectFonts,D=void 0!==L&&L,R=e.recordLog,F=void 0!==R&&R;if(!n)throw new Error("emit function is required");void 0!==O&&void 0===I.mousemove&&(I.mousemove=O);var A,z,P=!0===v?{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}:void 0!==y?y:{},j=!0===g||"all"===g?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===g,headMetaDescKeywords:"all"===g}:g||{},H={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:console},V=F?!0===F?H:Object.assign({},H,F):{};void 0===A&&(A=window),"NodeList"in A&&!A.NodeList.prototype.forEach&&(A.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in A&&!A.DOMTokenList.prototype.forEach&&(A.DOMTokenList.prototype.forEach=Array.prototype.forEach);var U=0;function B(e){var t,n,r,a;void 0===e&&(e=!1),q(K({type:l.Meta,data:{href:window.location.href,width:N(),height:x()}}),e);var i=W.isFrozen();W.freeze();var s=o(function(e,t){var n=t||{},o=n.blockClass,r=void 0===o?"rr-block":o,a=n.inlineStylesheet,i=void 0===a||a,u=n.recordCanvas,s=void 0!==u&&u,l=n.blockSelector,c=void 0===l?null:l,d=n.maskAllInputs,p=void 0!==d&&d,f=n.slimDOM,h=void 0!==f&&f,m={};return[w(e,{doc:e,map:m,blockClass:r,blockSelector:c,skipChild:!1,inlineStylesheet:i,maskInputOptions:!0===p?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:!1===p?{}:p,slimDOMOptions:!0===h||"all"===h?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===h,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===h?{}:h,recordCanvas:s}),m]}(document,{blockClass:u,blockSelector:d,inlineStylesheet:m,maskAllInputs:P,slimDOM:j,recordCanvas:_}),2),c=s[0],p=s[1];if(!c)return console.warn("Failed to snapshot the document");E.map=p,q(K({type:l.FullSnapshot,data:{node:c,initialOffset:{left:void 0!==window.pageXOffset?window.pageXOffset:(null===document||void 0===document?void 0:document.documentElement.scrollLeft)||(null===(n=null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===document||void 0===document?void 0:document.body.scrollLeft)||0,top:void 0!==window.pageYOffset?window.pageYOffset:(null===document||void 0===document?void 0:document.documentElement.scrollTop)||(null===(a=null===(r=null===document||void 0===document?void 0:document.body)||void 0===r?void 0:r.parentElement)||void 0===a?void 0:a.scrollTop)||(null===document||void 0===document?void 0:document.body.scrollTop)||0}}})),i||(W.emit(),W.unfreeze())}q=function(e,t){if(!W.isFrozen()||e.type===l.FullSnapshot||e.type===l.IncrementalSnapshot&&e.data.source===c.Mutation||(W.emit(),W.unfreeze()),n(S?S(e):e,t),e.type===l.FullSnapshot)z=e,U=0;else if(e.type===l.IncrementalSnapshot){U++;var o=a&&U>=a,i=r&&e.timestamp-z.timestamp>r;(o||i)&&B(!0)}};try{var X=[];X.push(k("DOMContentLoaded",(function(){q(K({type:l.DomContentLoaded,data:{}}))})));var $=function(){B(),X.push(Y({mutationCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Mutation},e)}))},mousemoveCb:function(e,t){return q(K({type:l.IncrementalSnapshot,data:{source:t,positions:e}}))},mouseInteractionCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.MouseInteraction},e)}))},scrollCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Scroll},e)}))},viewportResizeCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.ViewportResize},e)}))},inputCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Input},e)}))},mediaInteractionCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.MediaInteraction},e)}))},styleSheetRuleCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.StyleSheetRule},e)}))},canvasMutationCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.CanvasMutation},e)}))},fontCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Font},e)}))},logCb:function(e){return q(K({type:l.IncrementalSnapshot,data:t({source:c.Log},e)}))},blockClass:u,blockSelector:d,ignoreClass:f,maskInputOptions:P,maskInputFn:b,inlineStylesheet:m,sampling:I,recordCanvas:_,collectFonts:D,slimDOMOptions:j,logOptions:V},C))};return"interactive"===document.readyState||"complete"===document.readyState?$():X.push(k("load",(function(){q(K({type:l.Load,data:{}})),$()}),window)),function(){X.forEach((function(e){return e()}))}}catch(e){console.warn(e)}}return $.addCustomEvent=function(e,t){if(!q)throw new Error("please add custom event after start recording");q(K({type:l.Custom,data:{tag:e,payload:t}}))},$.freezePage=function(){W.freeze()},$}();
//# sourceMappingURL=rrweb-record.min.js.map

@@ -29,3 +29,3 @@ var rrwebReplay=function(e){"use strict";

and limitations under the License.
***************************************************************************** */!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(E||(E={}));var C={type:"xstate.init"};function N(e){return void 0===e?[]:[].concat(e)}function I(e){return{type:"xstate.assign",assignment:e}}function _(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function k(e){return function(t){return e===t}}function A(e){return"string"==typeof e?{type:e}:e}function O(e,t){return{value:e,context:t,actions:[],changed:!1,matches:k(e)}}function D(e,t){void 0===t&&(t={});var n={config:e,_options:t,initialState:{value:e.initial,actions:N(e.states[e.initial].entry).map((function(e){return _(e,t.actions)})),context:e.context,matches:k(e.initial)},transition:function(t,r){var i,o,a="string"==typeof t?{value:t,context:e.context}:t,s=a.value,l=a.context,c=A(r),u=e.states[s];if(u.on){var f=N(u.on[c.type]),d=function(t){if(void 0===t)return{value:O(s,l)};var r="string"==typeof t?{target:t}:t,i=r.target,o=void 0===i?s:i,a=r.actions,f=void 0===a?[]:a,d=r.cond,p=l;if((void 0===d?function(){return!0}:d)(l,c)){var h=e.states[o],v=!1,m=[].concat(u.exit,f,h.entry).filter((function(e){return e})).map((function(e){return _(e,n._options.actions)})).filter((function(e){if("xstate.assign"===e.type){v=!0;var t=Object.assign({},p);return"function"==typeof e.assignment?t=e.assignment(p,c):Object.keys(e.assignment).forEach((function(n){t[n]="function"==typeof e.assignment[n]?e.assignment[n](p,c):e.assignment[n]})),p=t,!1}return!0}));return{value:{value:o,context:p,actions:m,changed:o!==s||m.length>0||v,matches:k(o)}}}};try{for(var p=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(f),h=p.next();!h.done;h=p.next()){var v=d(h.value);if("object"==typeof v)return v.value}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}return O(s,l)}};return n}var L=function(e,t){return e.actions.forEach((function(n){var r=n.exec;return r&&r(e.context,t)}))};function F(e){var t=e.initialState,n=E.NotStarted,r=new Set,i={_machine:e,send:function(i){n===E.Running&&(t=e.transition(t,i),L(t,A(i)),r.forEach((function(e){return e(t)})))},subscribe:function(e){return r.add(e),e(t),{unsubscribe:function(){return r.delete(e)}}},start:function(r){if(r){var o="object"==typeof r?r:{context:e.config.context,value:r};t={value:o.value,actions:[],context:o.context,matches:k(o.value)}}return n=E.Running,L(t,C),i},stop:function(){return n=E.Stopped,r.clear(),i},get state(){return t},get status(){return n}};return i}var P={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return P.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete P.map[t],e.childNodes&&e.childNodes.forEach((function(e){return P.removeNodeFromMap(e)}))},has:function(e){return P.map.hasOwnProperty(e)}};var R=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),n={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(n.parent=t,t.children[n.id]=n):this.tree[n.id]=n,this.indexes.set(n.id,n)},e.prototype.remove=function(e){var t=this,n=this.indexes.get(e.parentId),r=this.indexes.get(e.id),i=function(e){t.removeIdSet.add(e);var n=P.getNode(e);null==n||n.childNodes.forEach((function(e){"__sn"in e&&i(e.__sn.id)}))},o=function(n){t.removeIdSet.add(n.id),Object.values(n.children).forEach((function(e){return o(e)}));var r=t.indexes.get(n.id);if(r){var i=r.parent;i&&(delete r.parent,delete i.children[r.id],t.indexes.delete(e.id))}};r?n?(delete r.parent,delete n.children[r.id],this.indexes.delete(e.id),o(r)):(delete this.tree[r.id],this.indexes.delete(r.id),o(r)):(this.removeNodeMutations.push(e),i(e.id))},e.prototype.text=function(e){var t=this.indexes.get(e.id);t?t.texts.push(e):this.textMutations.push(e)},e.prototype.attribute=function(e){var t=this.indexes.get(e.id);t?t.attributes.push(e):this.attributeMutations.push(e)},e.prototype.scroll=function(e){this.scrollMap.set(e.id,e)},e.prototype.input=function(e){this.inputMap.set(e.id,e)},e.prototype.flush=function(){var e,t,n,i,o=this,a=this.tree,s=this.removeNodeMutations,l=this.textMutations,c=this.attributeMutations,u={source:y.Mutation,removes:s,texts:l,attributes:c,adds:[]},f=function(e,t){t&&o.removeIdSet.add(e.id),u.texts=u.texts.concat(t?[]:e.texts).filter((function(e){return!o.removeIdSet.has(e.id)})),u.attributes=u.attributes.concat(t?[]:e.attributes).filter((function(e){return!o.removeIdSet.has(e.id)})),o.removeIdSet.has(e.id)||o.removeIdSet.has(e.mutation.parentId)||t?Object.values(e.children).forEach((function(e){return f(e,!0)})):(u.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return f(e,!1)})))};Object.values(a).forEach((function(e){return f(e,!1)}));try{for(var d=r(this.scrollMap.keys()),p=d.next();!p.done;p=d.next()){var h=p.value;this.removeIdSet.has(h)&&this.scrollMap.delete(h)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}try{for(var v=r(this.inputMap.keys()),m=v.next();!m.done;m=v.next()){h=m.value;this.removeIdSet.has(h)&&this.inputMap.delete(h)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}var g=new Map(this.scrollMap),b=new Map(this.inputMap);return this.reset(),{mutationData:u,scrollMap:g,inputMap:b}},e.prototype.reset=function(){this.tree=[],this.indexes=new Map,this.removeNodeMutations=[],this.textMutations=[],this.attributeMutations=[],this.removeIdSet=new Set,this.scrollMap=new Map,this.inputMap=new Map},e}();function j(e){var t,n,i={},o=function(e,t){var n={value:e,parent:t,children:[]};return i[e.node.id]=n,n},a=[];try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var c=l.value,u=c.nextId,f=c.parentId;if(u&&u in i){var d=i[u];if(d.parent){var p=d.parent.children.indexOf(d);d.parent.children.splice(p,0,o(c,d.parent))}else{p=a.indexOf(d);a.splice(p,0,o(c,null))}}else if(f in i){var h=i[f];h.children.push(o(c,h))}else a.push(o(c,null))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}function B(e,t){t(e.value);for(var n=e.children.length-1;n>=0;n--)B(e.children[n],t)}function U(e,t){var i=t.getCastFn,o=t.emitter;return F(D({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:I({lastPlayedEvent:function(e,t){return"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}}),recordTimeOffset:I((function(e,t){var r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),n(n({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})})),play:function(e){var t,n,a,s,l;console.warn("play");var c=e.timer,u=e.events,f=e.baselineTime,d=e.lastPlayedEvent;c.clear();try{for(var p=r(u),h=p.next();!h.done;h=p.next()){M(h.value,f)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var v=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.type===m.Meta&&r.timestamp<=t)return e.slice(n)}return e}(u,f),g=new Array,b=function(e){var t=null==d?void 0:d.timestamp;if((null==d?void 0:d.type)===m.IncrementalSnapshot&&d.data.source===y.MouseMove&&(t=d.timestamp+(null===(l=d.data.positions[0])||void 0===l?void 0:l.timeOffset)),t&&t<f&&(e.timestamp<=t||e===d))return"continue";var n=e.timestamp<f;if(n&&!function(e){switch(e.type){case m.DomContentLoaded:case m.Load:case m.Custom:return!1;case m.FullSnapshot:case m.Meta:return!0}switch(e.data.source){case y.MouseMove:case y.MouseInteraction:case y.TouchMove:case y.MediaInteraction:return!1;case y.ViewportResize:case y.StyleSheetRule:case y.Scroll:case y.Input:return!0}return!0}(e))return"continue";var r=i(e,n);n?r():g.push({doAction:function(){r(),o.emit(w.EventCast,e)},delay:e.delay})};try{for(var x=r(v),S=x.next();!S.done;S=x.next()){b(S.value)}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}o.emit(w.Flush),c.addActions(g),c.start()},pause:function(e){e.timer.clear()},resetLastPlayedEvent:I((function(e){return n(n({},e),{lastPlayedEvent:null})})),startLive:I({baselineTime:function(e,t){return e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),addEvent:I((function(e,t){var r=e.baselineTime,a=e.timer,s=e.events;if("ADD_EVENT"===t.type){var l=t.payload.event;M(l,r),s.push(l);var c=l.timestamp<r,u=i(l,c);c?u():(a.addAction({doAction:function(){u(),o.emit(w.EventCast,l)},delay:l.delay}),a.isActive()||a.start())}return n(n({},e),{events:s})}))}}))}var V=v||x,W={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"},z={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0},Y=function(){function e(e,n){var o=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=V(),this.legacy_missingNodeRetryMap={},this.imageMap=new Map,!(null==n?void 0:n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");var a={speed:1,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:W,logConfig:z};this.config=Object.assign({},a,n),this.config.logConfig.replayLogger||(this.config.logConfig.replayLogger=this.getConsoleLogger()),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.emitter.on(w.Resize,this.handleResize),this.setupDom(),this.treeIndex=new R,this.fragmentParentMap=new Map,this.elementStateMap=new Map,this.emitter.on(w.Flush,(function(){var e,n,a,s,l,c,u=o.treeIndex.flush(),f=u.scrollMap,d=u.inputMap;try{for(var p=r(o.fragmentParentMap.entries()),h=p.next();!h.done;h=p.next()){var v=i(h.value,2),m=v[0],y=v[1];P.map[y.__sn.id]=y,y.__sn.type===t.Element&&"textarea"===y.__sn.tagName&&m.textContent&&(y.value=m.textContent),y.appendChild(m),o.restoreState(y)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}o.fragmentParentMap.clear(),o.elementStateMap.clear();try{for(var g=r(f.values()),b=g.next();!b.done;b=g.next()){var w=b.value;o.applyScroll(w)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}try{for(var x=r(d.values()),S=x.next();!S.done;S=x.next()){w=S.value;o.applyInput(w)}}catch(e){l={error:e}}finally{try{S&&!S.done&&(c=x.return)&&c.call(x)}finally{if(l)throw l.error}}}));var s=new T([],(null==n?void 0:n.speed)||a.speed);this.service=U({events:e.map((function(e){return n&&n.unpackFn?n.unpackFn(e):e})),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){o.emitter.emit(w.StateChange,{player:e})})),this.speedService=F(D({id:"speed",context:{normalSpeed:-1,timer:s},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:function(e,t){"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:I({normalSpeed:function(e){return e.timer.speed}}),restoreSpeed:function(e){e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((function(e){o.emitter.emit(w.StateChange,{speed:e})}));var l=this.service.state.context.events.find((function(e){return e.type===m.Meta})),c=this.service.state.context.events.find((function(e){return e.type===m.FullSnapshot}));if(l){var u=l.data,f=u.width,d=u.height;setTimeout((function(){o.emitter.emit(w.Resize,{width:f,height:d})}),0)}c&&setTimeout((function(){o.rebuildFullSnapshot(c),o.iframe.contentWindow.scrollTo(c.data.initialOffset)}),1)}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return this.emitter.on(e,t),this},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(n){t.config[n]=e[n]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))},e.prototype.getMetaData=function(){var e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}},e.prototype.getCurrentTime=function(){return this.timer.timeOffset+this.getTimeOffset()},e.prototype.getTimeOffset=function(){var e=this.service.state.context;return e.baselineTime-e.events[0].timestamp},e.prototype.play=function(e){var t;void 0===e&&(e=0),this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.remove("rrweb-paused"),this.emitter.emit(w.Start)},e.prototype.pause=function(e){var t;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(w.Pause)},e.prototype.resume=function(e){void 0===e&&(e=0),console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(w.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,n=this.config.unpackFn?this.config.unpackFn(e):e;Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:n}})}))},e.prototype.enableInteract=function(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"},e.prototype.disableInteract=function(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"},e.prototype.setupDom=function(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");var e,t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(S(this.iframe.contentWindow,this.iframe.contentDocument),void 0===(e=this.iframe.contentWindow)&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach))},e.prototype.handleResize=function(e){var t,n;this.iframe.style.display="inherit";try{for(var i=r([this.mouseTail,this.iframe]),o=i.next();!o.done;o=i.next()){var a=o.value;a&&(a.setAttribute("width",String(e.width)),a.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.getCastFn=function(e,t){var n,i=this;switch(void 0===t&&(t=!1),e.type){case m.DomContentLoaded:case m.Load:break;case m.Custom:n=function(){i.emitter.emit(w.CustomEvent,e)};break;case m.Meta:n=function(){return i.emitter.emit(w.Resize,{width:e.data.width,height:e.data.height})};break;case m.FullSnapshot:n=function(){i.rebuildFullSnapshot(e,t),i.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case m.IncrementalSnapshot:n=function(){var n,o;if(i.applyIncremental(e,t),!t&&(e===i.nextUserInteractionEvent&&(i.nextUserInteractionEvent=null,i.backToNormal()),i.config.skipInactive&&!i.nextUserInteractionEvent)){try{for(var a=r(i.service.state.context.events),s=a.next();!s.done;s=a.next()){var l=s.value;if(!(l.timestamp<=e.timestamp)&&i.isUserInteraction(l)){l.delay-e.delay>1e4*i.speedService.state.context.timer.speed&&(i.nextUserInteractionEvent=l);break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}if(i.nextUserInteractionEvent){var c=i.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(c/5e3),360)};i.speedService.send({type:"FAST_FORWARD",payload:u}),i.emitter.emit(w.SkipStart,u)}}}}return function(){if(n&&n(),i.service.send({type:"CAST_EVENT",payload:{event:e}}),e===i.service.state.context.events[i.service.state.context.events.length-1]){var t=function(){i.backToNormal(),i.service.send("END"),i.emitter.emit(w.Finish)};e.type===m.IncrementalSnapshot&&e.data.source===y.MouseMove&&e.data.positions.length?setTimeout((function(){t()}),Math.max(0,50-e.data.positions[0].timeOffset)):t()}}},e.prototype.rebuildFullSnapshot=function(e,t){if(void 0===t&&(t=!1),!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={},P.map=h(e.data.node,{doc:this.iframe.contentDocument})[1];var n=document.createElement("style"),r=this.iframe.contentDocument,i=r.documentElement,o=r.head;i.insertBefore(n,o);var a,s=(a=this.config.blockClass,["iframe, ."+a+" { background: #ccc }","noscript { display: none !important; }"]).concat(this.config.insertStyleRules);this.config.pauseAnimation&&s.push("html.rrweb-paused * { animation-play-state: paused !important; }"),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused");for(var l=0;l<s.length;l++)n.sheet.insertRule(s[l],l);this.emitter.emit(w.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.waitForStylesheetLoad=function(){var e,t=this,n=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(n){var r,i=new Set,o=this.service.state,a=function(){o=t.service.state};this.emitter.on(w.Start,a),this.emitter.on(w.Pause,a);var s=function(){t.emitter.off(w.Start,a),t.emitter.off(w.Pause,a)};n.querySelectorAll('link[rel="stylesheet"]').forEach((function(e){e.sheet||(i.add(e),e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==r&&(o.matches("playing")&&t.play(t.getCurrentTime()),t.emitter.emit(w.LoadStylesheetEnd),r&&window.clearTimeout(r),s())})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(w.LoadStylesheetStart),r=window.setTimeout((function(){o.matches("playing")&&t.play(t.getCurrentTime()),r=-1,s()}),this.config.loadTimeout))}},e.prototype.preloadAllImages=function(){var e,t,n=this,i=this.service.state,o=function(){i=n.service.state};this.emitter.on(w.Start,o),this.emitter.on(w.Pause,o);var a=0,s=0;try{for(var l=r(this.service.state.context.events),c=l.next();!c.done;c=l.next()){var u=c.value;if(u.type===m.IncrementalSnapshot&&u.data.source===y.CanvasMutation&&"drawImage"===u.data.property&&"string"==typeof u.data.args[0]&&!this.imageMap.has(u)){a++;var f=document.createElement("img");f.src=u.data.args[0],this.imageMap.set(u,f),f.onload=function(){++s===a&&(i.matches("playing")&&n.play(n.getCurrentTime()),n.emitter.off(w.Start,o),n.emitter.off(w.Pause,o))}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}a!==s&&this.service.send({type:"PAUSE"})},e.prototype.applyIncremental=function(e,t){var n,r,i=this,o=e.data;switch(o.source){case y.Mutation:t&&(o.adds.forEach((function(e){return i.treeIndex.add(e)})),o.texts.forEach((function(e){return i.treeIndex.text(e)})),o.attributes.forEach((function(e){return i.treeIndex.attribute(e)})),o.removes.forEach((function(e){return i.treeIndex.remove(e)}))),this.applyMutation(o,t);break;case y.MouseMove:if(t){var a=o.positions[o.positions.length-1];this.moveAndHover(o,a.x,a.y,a.id)}else o.positions.forEach((function(t){var n={doAction:function(){i.moveAndHover(o,t.x,t.y,t.id)},delay:t.timeOffset+e.timestamp-i.service.state.context.baselineTime};i.timer.addAction(n)})),this.timer.addAction({doAction:function(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case y.MouseInteraction:if(-1===o.id)break;var s=new Event(g[o.type].toLowerCase());if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);this.emitter.emit(w.MouseInteraction,{type:o.type,target:m});var l=this.config.triggerFocus;switch(o.type){case g.Blur:"blur"in m&&m.blur();break;case g.Focus:l&&m.focus&&m.focus({preventScroll:!0});break;case g.Click:case g.TouchStart:case g.TouchEnd:t||(this.moveAndHover(o,o.x,o.y,o.id),this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:m.dispatchEvent(s)}break;case y.Scroll:if(-1===o.id)break;if(t){this.treeIndex.scroll(o);break}this.applyScroll(o);break;case y.ViewportResize:this.emitter.emit(w.Resize,{width:o.width,height:o.height});break;case y.Input:if(-1===o.id)break;if(t){this.treeIndex.input(o);break}this.applyInput(o);break;case y.MediaInteraction:if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var c=m;try{o.type===b.Pause&&c.pause(),o.type===b.Play&&(c.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?c.play():c.addEventListener("canplay",(function(){c.play()})))}catch(e){this.config.showWarning&&console.warn("Failed to replay media interactions: "+(e.message||e))}break;case y.StyleSheetRule:if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var u=m,f=m.parentNode,d=this.fragmentParentMap.has(f),p=void 0;if(d){var h=this.fragmentParentMap.get(m.parentNode);p=document.createTextNode(""),f.replaceChild(p,m),h.appendChild(m)}var v=u.sheet;o.adds&&o.adds.forEach((function(e){var t=e.rule,n=e.index;try{var r=void 0===n?void 0:Math.min(n,v.rules.length);try{v.insertRule(t,r)}catch(e){}}catch(e){}})),o.removes&&o.removes.forEach((function(e){var t=e.index;try{v.deleteRule(t)}catch(e){}})),d&&p&&f.replaceChild(m,p);break;case y.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var m;if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);try{var x=m.getContext("2d");if(o.setter)return void(x[o.property]=o.args[0]);var S=x[o.property];if("drawImage"===o.property&&"string"==typeof o.args[0]){var E=this.imageMap.get(e);o.args[0]=E,S.apply(x,o.args)}else S.apply(x,o.args)}catch(e){this.warnCanvasMutationFailed(o,o.id,e)}break;case y.Font:try{var T=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(T)}catch(e){this.config.showWarning&&console.warn(e)}break;case y.Log:try{var M=e.data,C=this.config.logConfig.replayLogger;"function"==typeof C[M.level]&&C[M.level](M)}catch(e){this.config.showWarning&&console.warn(e)}}},e.prototype.applyMutation=function(e,t){var i,o,a=this;e.removes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);var r=P.getNode(t.parentId);if(!r)return a.warnNodeNotFound(e,t.parentId);if(P.removeNodeFromMap(n),r){var i=a.fragmentParentMap.get(r);if(i&&i.contains(n))i.removeChild(n);else if(a.fragmentParentMap.has(n)){var o=a.fragmentParentMap.get(n);r.removeChild(o),a.fragmentParentMap.delete(n)}else r.removeChild(n)}}));var s=n({},this.legacy_missingNodeRetryMap),l=[];var c=function(e){if(!a.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var n=P.getNode(e.parentId);if(!n)return l.push(e);var r=null;if(a.iframe.contentDocument.contains?r=a.iframe.contentDocument.contains(n):a.iframe.contentDocument.body.contains&&(r=a.iframe.contentDocument.body.contains(n)),t&&r){var i=document.createDocumentFragment();for(P.map[e.parentId]=i,a.fragmentParentMap.set(i,n),a.storeState(n);n.firstChild;)i.appendChild(n.firstChild);n=i}var o=null,c=null;if(e.previousId&&(o=P.getNode(e.previousId)),e.nextId&&(c=P.getNode(e.nextId)),function(e){var t=null;return e.nextId&&(t=P.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t}(e))return l.push(e);var u=p(e.node,{doc:a.iframe.contentDocument,map:P.map,skipChild:!0,hackCss:!0});-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?n.insertBefore(u,o.nextSibling):c&&c.parentNode?n.contains(c)?n.insertBefore(u,c):n.insertBefore(u,null):n.appendChild(u),(e.previousId||e.nextId)&&a.legacy_resolveMissingNode(s,n,u,e)):s[e.node.id]={node:u,mutation:e}};e.adds.forEach((function(e){c(e)}));for(var u=Date.now();l.length;){var f=j(l);if(l.length=0,Date.now()-u>500){this.warn("Timeout in the loop, please check the resolve tree data:",f);break}try{for(var d=(i=void 0,r(f)),h=d.next();!h.done;h=d.next()){var v=h.value;P.getNode(v.value.parentId)?B(v,(function(e){c(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",v)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}Object.keys(s).length&&Object.assign(this.legacy_missingNodeRetryMap,s),e.texts.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),n.textContent=t.value})),e.attributes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);for(var r in a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),t.attributes)if("string"==typeof r){var i=t.attributes[r];try{null!==i?n.setAttribute(r,i):n.removeAttribute(r)}catch(e){a.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}}}))},e.prototype.applyScroll=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);if(t===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:"smooth"});else try{t.scrollTop=e.y,t.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.formatMessage=function(e){if(0===e.trace.length)return"";var t="\n\tat ";return t+=e.trace.join("\n\tat ")},e.prototype.getConsoleLogger=function(){var e,t,n=this,i={},a=function(e){i[e]="trace"===e?function(e){(console.log.__rrweb_original__?console.log.__rrweb_original__:console.log).apply(void 0,o(e.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(e)]))}:function(t){(console[e].__rrweb_original__?console[e].__rrweb_original__:console[e]).apply(void 0,o(t.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(t)]))}};try{for(var s=r(this.config.logConfig.level),l=s.next();!l.done;l=s.next()){a(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return i},e.prototype.legacy_resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var l=a,c=l.node,u=l.mutation;t.insertBefore(c,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(s){var f=s;c=f.node,u=f.mutation;t.insertBefore(c,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}},e.prototype.moveAndHover=function(e,t,n,r){this.mouse.style.left=t+"px",this.mouse.style.top=n+"px",this.drawMouseTail({x:t,y:n});var i=P.getNode(r);if(!i)return this.debugNodeNotFound(e,r);this.hoverElements(i)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var n=!0===this.config.mouseTail?W:Object.assign({},W,this.config.mouseTail),r=n.lineCap,i=n.lineWidth,o=n.strokeStyle,a=n.duration,s=function(){if(t.mouseTail){var e=t.mouseTail.getContext("2d");e&&t.tailPositions.length&&(e.clearRect(0,0,t.mouseTail.width,t.mouseTail.height),e.beginPath(),e.lineWidth=i,e.lineCap=r,e.strokeStyle=o,e.moveTo(t.tailPositions[0].x,t.tailPositions[0].y),t.tailPositions.forEach((function(t){return e.lineTo(t.x,t.y)})),e.stroke())}};this.tailPositions.push(e),s(),setTimeout((function(){t.tailPositions=t.tailPositions.filter((function(t){return t!==e})),s()}),a)}},e.prototype.hoverElements=function(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((function(e){e.classList.remove(":hover")}));for(var n=e;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement},e.prototype.isUserInteraction=function(e){return e.type===m.IncrementalSnapshot&&(e.data.source>y.Mutation&&e.data.source<=y.Input)},e.prototype.backToNormal=function(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(w.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))},e.prototype.storeState=function(e){var t,n;if(e&&e.nodeType===e.ELEMENT_NODE){var i=e;(i.scrollLeft||i.scrollTop)&&this.elementStateMap.set(e,{scroll:[i.scrollLeft,i.scrollTop]});var o=i.children;try{for(var a=r(Array.from(o)),s=a.next();!s.done;s=a.next()){var l=s.value;this.storeState(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},e.prototype.restoreState=function(e){var t,n;if(e.nodeType===e.ELEMENT_NODE){var i=e;if(this.elementStateMap.has(e)){var o=this.elementStateMap.get(e);o.scroll&&(i.scrollLeft=o.scroll[0],i.scrollTop=o.scroll[1]),this.elementStateMap.delete(e)}var a=i.children;try{for(var s=r(Array.from(a)),l=s.next();!l.done;l=s.next()){var c=l.value;this.restoreState(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}}},e.prototype.warnNodeNotFound=function(e,t){this.warn("Node with id '"+t+"' not found in",e)},e.prototype.warnCanvasMutationFailed=function(e,t,n){this.warn("Has error on update canvas '"+t+"'",e,n)},e.prototype.debugNodeNotFound=function(e,t){this.debug("[replayer]","Node with id '"+t+"' not found in",e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showWarning&&console.warn.apply(console,o(["[replayer]"],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showDebug&&console.log.apply(console,o(["[replayer]"],e))},e}(),X=Uint8Array,H=Uint16Array,G=Uint32Array,q=new X([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),J=new X([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),K=new X([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$=function(e,t){for(var n=new H(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new G(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},Q=$(q,2),Z=Q[0],ee=Q[1];Z[28]=258,ee[258]=28;for(var te=$(J,0)[0],ne=new H(32768),re=0;re<32768;++re){var ie=(43690&re)>>>1|(21845&re)<<1;ie=(61680&(ie=(52428&ie)>>>2|(13107&ie)<<2))>>>4|(3855&ie)<<4,ne[re]=((65280&ie)>>>8|(255&ie)<<8)>>>1}var oe=function(e,t,n){for(var r=e.length,i=0,o=new H(t);i<r;++i)++o[e[i]-1];var a,s=new H(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(n){a=new H(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],u=t-e[i],f=s[e[i]-1]++<<u,d=f|(1<<u)-1;f<=d;++f)a[ne[f]>>>l]=c}else for(a=new H(r),i=0;i<r;++i)a[i]=ne[s[e[i]-1]++]>>>15-e[i];return a},ae=new X(288);for(re=0;re<144;++re)ae[re]=8;for(re=144;re<256;++re)ae[re]=9;for(re=256;re<280;++re)ae[re]=7;for(re=280;re<288;++re)ae[re]=8;var se=new X(32);for(re=0;re<32;++re)se[re]=5;oe(ae,9,0);var le=oe(ae,9,1),ce=(oe(se,5,0),oe(se,5,1)),ue=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},fe=function(e,t,n){var r=t/8>>0;return(e[r]|e[r+1]<<8)>>>(7&t)&n},de=function(e,t){var n=t/8>>0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>>(7&t)},pe=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof H?H:e instanceof G?G:X)(n-t);return r.set(e.subarray(t,n)),r},he=new G(256);for(re=0;re<256;++re){for(var ve=re,me=9;--me;)ve=(1&ve&&3988292384)^ve>>>1;he[re]=ve}function ye(e,t){return function(e,t,n){var r=e.length,i=!t||n,o=!n||n.i;n||(n={}),t||(t=new X(3*r));var a=function(e){var n=t.length;if(e>n){var r=new X(Math.max(2*n,e));r.set(t),t=r}},s=n.f||0,l=n.p||0,c=n.b||0,u=n.l,f=n.d,d=n.m,p=n.n;if(s&&!u)return t;var h,v=8*r;do{if(!u){n.f=s=fe(e,l,1);var m=fe(e,l+1,3);if(l+=3,!m){var y=e[(I=((h=l)/8>>0)+(7&h&&1)+4)-4]|e[I-3]<<8,g=I+y;if(g>r){if(o)throw"unexpected EOF";break}i&&a(c+y),t.set(e.subarray(I,g),c),n.b=c+=y,n.p=l=8*g;continue}if(1==m)u=le,f=ce,d=9,p=5;else{if(2!=m)throw"invalid block type";var b=fe(e,l,31)+257,w=fe(e,l+10,15)+4,x=b+fe(e,l+5,31)+1;l+=14;for(var S=new X(x),E=new X(19),T=0;T<w;++T)E[K[T]]=fe(e,l+3*T,7);l+=3*w;var M=ue(E),C=(1<<M)-1;if(!o&&l+x*(M+7)>v)break;var N=oe(E,M,1);for(T=0;T<x;){var I,_=N[fe(e,l,C)];if(l+=15&_,(I=_>>>4)<16)S[T++]=I;else{var k=0,A=0;for(16==I?(A=3+fe(e,l,3),l+=2,k=S[T-1]):17==I?(A=3+fe(e,l,7),l+=3):18==I&&(A=11+fe(e,l,127),l+=7);A--;)S[T++]=k}}var O=S.subarray(0,b),D=S.subarray(b);d=ue(O),p=ue(D),u=oe(O,d,1),f=oe(D,p,1)}if(l>v)throw"unexpected EOF"}i&&a(c+131072);for(var L=(1<<d)-1,F=(1<<p)-1,P=d+p+18;o||l+P<v;){var R=(k=u[de(e,l)&L])>>>4;if((l+=15&k)>v)throw"unexpected EOF";if(!k)throw"invalid length/literal";if(R<256)t[c++]=R;else{if(256==R){u=null;break}var j=R-254;if(R>264){var B=q[T=R-257];j=fe(e,l,(1<<B)-1)+Z[T],l+=B}var U=f[de(e,l)&F],V=U>>>4;if(!U)throw"invalid distance";l+=15&U;D=te[V];if(V>3){B=J[V];D+=de(e,l)&(1<<B)-1,l+=B}if(l>v)throw"unexpected EOF";i&&a(c+131072);for(var W=c+j;c<W;c+=4)t[c]=t[c-D],t[c+1]=t[c+1-D],t[c+2]=t[c+2-D],t[c+3]=t[c+3-D];c=W}}n.l=u,n.p=l,n.b=c,u&&(s=1,n.m=d,n.d=f,n.n=p)}while(!s);return c==t.length?t:pe(t,0,c)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}return e.Replayer=Y,e.unpack=function(e){if("string"!=typeof e)return e;try{if((t=JSON.parse(e)).timestamp)return t}catch(e){}try{var t;if("v1"===(t=JSON.parse(function(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var r=0;r<e.length;){var i=e[r++];i<128||t?n+=String.fromCharCode(i):i<224?n+=String.fromCharCode((31&i)<<6|63&e[r++]):i<240?n+=String.fromCharCode((15&i)<<12|(63&e[r++])<<6|63&e[r++]):(i=((15&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}return n}(ye(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new X(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},a=0;a<n;++a){if(i+5>r.length){var s=new X(i+8+(n-a<<1));s.set(r),r=s}var l=e.charCodeAt(a);l<128||t?o(l):l<2048?(o(192|l>>>6),o(128|63&l)):l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|63&l)):(o(224|l>>>12),o(128|l>>>6&63),o(128|63&l))}return pe(r,0,i)}(e,!0))))).v)return t;throw new Error("These events were packed with packer "+t.v+" which is incompatible with current packer v1.")}catch(e){throw console.error(e),new Error("Unknown data format.")}},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
***************************************************************************** */!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(E||(E={}));var C={type:"xstate.init"};function N(e){return void 0===e?[]:[].concat(e)}function I(e){return{type:"xstate.assign",assignment:e}}function _(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function k(e){return function(t){return e===t}}function A(e){return"string"==typeof e?{type:e}:e}function O(e,t){return{value:e,context:t,actions:[],changed:!1,matches:k(e)}}function D(e,t){void 0===t&&(t={});var n={config:e,_options:t,initialState:{value:e.initial,actions:N(e.states[e.initial].entry).map((function(e){return _(e,t.actions)})),context:e.context,matches:k(e.initial)},transition:function(t,r){var i,o,a="string"==typeof t?{value:t,context:e.context}:t,s=a.value,l=a.context,c=A(r),u=e.states[s];if(u.on){var f=N(u.on[c.type]),d=function(t){if(void 0===t)return{value:O(s,l)};var r="string"==typeof t?{target:t}:t,i=r.target,o=void 0===i?s:i,a=r.actions,f=void 0===a?[]:a,d=r.cond,p=l;if((void 0===d?function(){return!0}:d)(l,c)){var h=e.states[o],v=!1,m=[].concat(u.exit,f,h.entry).filter((function(e){return e})).map((function(e){return _(e,n._options.actions)})).filter((function(e){if("xstate.assign"===e.type){v=!0;var t=Object.assign({},p);return"function"==typeof e.assignment?t=e.assignment(p,c):Object.keys(e.assignment).forEach((function(n){t[n]="function"==typeof e.assignment[n]?e.assignment[n](p,c):e.assignment[n]})),p=t,!1}return!0}));return{value:{value:o,context:p,actions:m,changed:o!==s||m.length>0||v,matches:k(o)}}}};try{for(var p=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(f),h=p.next();!h.done;h=p.next()){var v=d(h.value);if("object"==typeof v)return v.value}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}return O(s,l)}};return n}var L=function(e,t){return e.actions.forEach((function(n){var r=n.exec;return r&&r(e.context,t)}))};function F(e){var t=e.initialState,n=E.NotStarted,r=new Set,i={_machine:e,send:function(i){n===E.Running&&(t=e.transition(t,i),L(t,A(i)),r.forEach((function(e){return e(t)})))},subscribe:function(e){return r.add(e),e(t),{unsubscribe:function(){return r.delete(e)}}},start:function(r){if(r){var o="object"==typeof r?r:{context:e.config.context,value:r};t={value:o.value,actions:[],context:o.context,matches:k(o.value)}}return n=E.Running,L(t,C),i},stop:function(){return n=E.Stopped,r.clear(),i},get state(){return t},get status(){return n}};return i}var P={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return P.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete P.map[t],e.childNodes&&e.childNodes.forEach((function(e){return P.removeNodeFromMap(e)}))},has:function(e){return P.map.hasOwnProperty(e)}};var R=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),n={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(n.parent=t,t.children[n.id]=n):this.tree[n.id]=n,this.indexes.set(n.id,n)},e.prototype.remove=function(e){var t=this,n=this.indexes.get(e.parentId),r=this.indexes.get(e.id),i=function(e){t.removeIdSet.add(e);var n=P.getNode(e);null==n||n.childNodes.forEach((function(e){"__sn"in e&&i(e.__sn.id)}))},o=function(n){t.removeIdSet.add(n.id),Object.values(n.children).forEach((function(e){return o(e)}));var r=t.indexes.get(n.id);if(r){var i=r.parent;i&&(delete r.parent,delete i.children[r.id],t.indexes.delete(e.id))}};r?n?(delete r.parent,delete n.children[r.id],this.indexes.delete(e.id),o(r)):(delete this.tree[r.id],this.indexes.delete(r.id),o(r)):(this.removeNodeMutations.push(e),i(e.id))},e.prototype.text=function(e){var t=this.indexes.get(e.id);t?t.texts.push(e):this.textMutations.push(e)},e.prototype.attribute=function(e){var t=this.indexes.get(e.id);t?t.attributes.push(e):this.attributeMutations.push(e)},e.prototype.scroll=function(e){this.scrollMap.set(e.id,e)},e.prototype.input=function(e){this.inputMap.set(e.id,e)},e.prototype.flush=function(){var e,t,n,i,o=this,a=this.tree,s=this.removeNodeMutations,l=this.textMutations,c=this.attributeMutations,u={source:y.Mutation,removes:s,texts:l,attributes:c,adds:[]},f=function(e,t){t&&o.removeIdSet.add(e.id),u.texts=u.texts.concat(t?[]:e.texts).filter((function(e){return!o.removeIdSet.has(e.id)})),u.attributes=u.attributes.concat(t?[]:e.attributes).filter((function(e){return!o.removeIdSet.has(e.id)})),o.removeIdSet.has(e.id)||o.removeIdSet.has(e.mutation.parentId)||t?Object.values(e.children).forEach((function(e){return f(e,!0)})):(u.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return f(e,!1)})))};Object.values(a).forEach((function(e){return f(e,!1)}));try{for(var d=r(this.scrollMap.keys()),p=d.next();!p.done;p=d.next()){var h=p.value;this.removeIdSet.has(h)&&this.scrollMap.delete(h)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}try{for(var v=r(this.inputMap.keys()),m=v.next();!m.done;m=v.next()){h=m.value;this.removeIdSet.has(h)&&this.inputMap.delete(h)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}var g=new Map(this.scrollMap),b=new Map(this.inputMap);return this.reset(),{mutationData:u,scrollMap:g,inputMap:b}},e.prototype.reset=function(){this.tree=[],this.indexes=new Map,this.removeNodeMutations=[],this.textMutations=[],this.attributeMutations=[],this.removeIdSet=new Set,this.scrollMap=new Map,this.inputMap=new Map},e}();function j(e){var t,n,i={},o=function(e,t){var n={value:e,parent:t,children:[]};return i[e.node.id]=n,n},a=[];try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var c=l.value,u=c.nextId,f=c.parentId;if(u&&u in i){var d=i[u];if(d.parent){var p=d.parent.children.indexOf(d);d.parent.children.splice(p,0,o(c,d.parent))}else{p=a.indexOf(d);a.splice(p,0,o(c,null))}}else if(f in i){var h=i[f];h.children.push(o(c,h))}else a.push(o(c,null))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}function B(e,t){t(e.value);for(var n=e.children.length-1;n>=0;n--)B(e.children[n],t)}function U(e,t){var i=t.getCastFn,o=t.emitter;return F(D({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:I({lastPlayedEvent:function(e,t){return"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}}),recordTimeOffset:I((function(e,t){var r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),n(n({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})})),play:function(e){var t,n,a,s,l;console.warn("play");var c=e.timer,u=e.events,f=e.baselineTime,d=e.lastPlayedEvent;c.clear();try{for(var p=r(u),h=p.next();!h.done;h=p.next()){M(h.value,f)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var v=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.type===m.Meta&&r.timestamp<=t)return e.slice(n)}return e}(u,f),g=new Array,b=function(e){var t=null==d?void 0:d.timestamp;if((null==d?void 0:d.type)===m.IncrementalSnapshot&&d.data.source===y.MouseMove&&(t=d.timestamp+(null===(l=d.data.positions[0])||void 0===l?void 0:l.timeOffset)),t&&t<f&&(e.timestamp<=t||e===d))return"continue";var n=e.timestamp<f;if(n&&!function(e){switch(e.type){case m.DomContentLoaded:case m.Load:case m.Custom:return!1;case m.FullSnapshot:case m.Meta:return!0}switch(e.data.source){case y.MouseMove:case y.MouseInteraction:case y.TouchMove:case y.MediaInteraction:return!1;case y.ViewportResize:case y.StyleSheetRule:case y.Scroll:case y.Input:return!0}return!0}(e))return"continue";var r=i(e,n);n?r():g.push({doAction:function(){r(),o.emit(w.EventCast,e)},delay:e.delay})};try{for(var x=r(v),S=x.next();!S.done;S=x.next()){b(S.value)}}catch(e){a={error:e}}finally{try{S&&!S.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}o.emit(w.Flush),c.addActions(g),c.start()},pause:function(e){e.timer.clear()},resetLastPlayedEvent:I((function(e){return n(n({},e),{lastPlayedEvent:null})})),startLive:I({baselineTime:function(e,t){return e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),addEvent:I((function(e,t){var r=e.baselineTime,a=e.timer,s=e.events;if("ADD_EVENT"===t.type){var l=t.payload.event;M(l,r),s.push(l);var c=l.timestamp<r,u=i(l,c);c?u():(a.addAction({doAction:function(){u(),o.emit(w.EventCast,l)},delay:l.delay}),a.isActive()||a.start())}return n(n({},e),{events:s})}))}}))}var V=v||x,W={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"},z={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0},Y=function(){function e(e,n){var o=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=V(),this.legacy_missingNodeRetryMap={},this.imageMap=new Map,!(null==n?void 0:n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");var a={speed:1,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:W,logConfig:z};this.config=Object.assign({},a,n),this.config.logConfig.replayLogger||(this.config.logConfig.replayLogger=this.getConsoleLogger()),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.emitter.on(w.Resize,this.handleResize),this.setupDom(),this.treeIndex=new R,this.fragmentParentMap=new Map,this.elementStateMap=new Map,this.emitter.on(w.Flush,(function(){var e,n,a,s,l,c,u=o.treeIndex.flush(),f=u.scrollMap,d=u.inputMap;try{for(var p=r(o.fragmentParentMap.entries()),h=p.next();!h.done;h=p.next()){var v=i(h.value,2),m=v[0],y=v[1];P.map[y.__sn.id]=y,y.__sn.type===t.Element&&"textarea"===y.__sn.tagName&&m.textContent&&(y.value=m.textContent),y.appendChild(m),o.restoreState(y)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}o.fragmentParentMap.clear(),o.elementStateMap.clear();try{for(var g=r(f.values()),b=g.next();!b.done;b=g.next()){var w=b.value;o.applyScroll(w)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}try{for(var x=r(d.values()),S=x.next();!S.done;S=x.next()){w=S.value;o.applyInput(w)}}catch(e){l={error:e}}finally{try{S&&!S.done&&(c=x.return)&&c.call(x)}finally{if(l)throw l.error}}}));var s=new T([],(null==n?void 0:n.speed)||a.speed);this.service=U({events:e.map((function(e){return n&&n.unpackFn?n.unpackFn(e):e})),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){o.emitter.emit(w.StateChange,{player:e})})),this.speedService=F(D({id:"speed",context:{normalSpeed:-1,timer:s},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:function(e,t){"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:I({normalSpeed:function(e){return e.timer.speed}}),restoreSpeed:function(e){e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((function(e){o.emitter.emit(w.StateChange,{speed:e})}));var l=this.service.state.context.events.find((function(e){return e.type===m.Meta})),c=this.service.state.context.events.find((function(e){return e.type===m.FullSnapshot}));if(l){var u=l.data,f=u.width,d=u.height;setTimeout((function(){o.emitter.emit(w.Resize,{width:f,height:d})}),0)}c&&setTimeout((function(){o.rebuildFullSnapshot(c),o.iframe.contentWindow.scrollTo(c.data.initialOffset)}),1)}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return this.emitter.on(e,t),this},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(n){t.config[n]=e[n]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))},e.prototype.getMetaData=function(){var e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}},e.prototype.getCurrentTime=function(){return this.timer.timeOffset+this.getTimeOffset()},e.prototype.getTimeOffset=function(){var e=this.service.state.context;return e.baselineTime-e.events[0].timestamp},e.prototype.play=function(e){var t;void 0===e&&(e=0),this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.remove("rrweb-paused"),this.emitter.emit(w.Start)},e.prototype.pause=function(e){var t;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(w.Pause)},e.prototype.resume=function(e){void 0===e&&(e=0),console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(w.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,n=this.config.unpackFn?this.config.unpackFn(e):e;Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:n}})}))},e.prototype.enableInteract=function(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"},e.prototype.disableInteract=function(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"},e.prototype.setupDom=function(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");var e,t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(S(this.iframe.contentWindow,this.iframe.contentDocument),void 0===(e=this.iframe.contentWindow)&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach))},e.prototype.handleResize=function(e){var t,n;this.iframe.style.display="inherit";try{for(var i=r([this.mouseTail,this.iframe]),o=i.next();!o.done;o=i.next()){var a=o.value;a&&(a.setAttribute("width",String(e.width)),a.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.getCastFn=function(e,t){var n,i=this;switch(void 0===t&&(t=!1),e.type){case m.DomContentLoaded:case m.Load:break;case m.Custom:n=function(){i.emitter.emit(w.CustomEvent,e)};break;case m.Meta:n=function(){return i.emitter.emit(w.Resize,{width:e.data.width,height:e.data.height})};break;case m.FullSnapshot:n=function(){i.rebuildFullSnapshot(e,t),i.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case m.IncrementalSnapshot:n=function(){var n,o;if(i.applyIncremental(e,t),!t&&(e===i.nextUserInteractionEvent&&(i.nextUserInteractionEvent=null,i.backToNormal()),i.config.skipInactive&&!i.nextUserInteractionEvent)){try{for(var a=r(i.service.state.context.events),s=a.next();!s.done;s=a.next()){var l=s.value;if(!(l.timestamp<=e.timestamp)&&i.isUserInteraction(l)){l.delay-e.delay>1e4*i.speedService.state.context.timer.speed&&(i.nextUserInteractionEvent=l);break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}if(i.nextUserInteractionEvent){var c=i.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(c/5e3),360)};i.speedService.send({type:"FAST_FORWARD",payload:u}),i.emitter.emit(w.SkipStart,u)}}}}return function(){if(n&&n(),i.service.send({type:"CAST_EVENT",payload:{event:e}}),e===i.service.state.context.events[i.service.state.context.events.length-1]){var t=function(){i.backToNormal(),i.service.send("END"),i.emitter.emit(w.Finish)};e.type===m.IncrementalSnapshot&&e.data.source===y.MouseMove&&e.data.positions.length?setTimeout((function(){t()}),Math.max(0,50-e.data.positions[0].timeOffset)):t()}}},e.prototype.rebuildFullSnapshot=function(e,t){if(void 0===t&&(t=!1),!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={},P.map=h(e.data.node,{doc:this.iframe.contentDocument})[1];var n=document.createElement("style"),r=this.iframe.contentDocument,i=r.documentElement,o=r.head;i.insertBefore(n,o);var a,s=(a=this.config.blockClass,["iframe, ."+a+" { background: #ccc }","noscript { display: none !important; }"]).concat(this.config.insertStyleRules);this.config.pauseAnimation&&s.push("html.rrweb-paused * { animation-play-state: paused !important; }"),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused");for(var l=0;l<s.length;l++)n.sheet.insertRule(s[l],l);this.emitter.emit(w.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.waitForStylesheetLoad=function(){var e,t=this,n=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(n){var r,i=new Set,o=this.service.state,a=function(){o=t.service.state};this.emitter.on(w.Start,a),this.emitter.on(w.Pause,a);var s=function(){t.emitter.off(w.Start,a),t.emitter.off(w.Pause,a)};n.querySelectorAll('link[rel="stylesheet"]').forEach((function(e){e.sheet||(i.add(e),e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==r&&(o.matches("playing")&&t.play(t.getCurrentTime()),t.emitter.emit(w.LoadStylesheetEnd),r&&window.clearTimeout(r),s())})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(w.LoadStylesheetStart),r=window.setTimeout((function(){o.matches("playing")&&t.play(t.getCurrentTime()),r=-1,s()}),this.config.loadTimeout))}},e.prototype.preloadAllImages=function(){var e,t,n=this,i=this.service.state,o=function(){i=n.service.state};this.emitter.on(w.Start,o),this.emitter.on(w.Pause,o);var a=0,s=0;try{for(var l=r(this.service.state.context.events),c=l.next();!c.done;c=l.next()){var u=c.value;if(u.type===m.IncrementalSnapshot&&u.data.source===y.CanvasMutation&&"drawImage"===u.data.property&&"string"==typeof u.data.args[0]&&!this.imageMap.has(u)){a++;var f=document.createElement("img");f.src=u.data.args[0],this.imageMap.set(u,f),f.onload=function(){++s===a&&(i.matches("playing")&&n.play(n.getCurrentTime()),n.emitter.off(w.Start,o),n.emitter.off(w.Pause,o))}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}a!==s&&this.service.send({type:"PAUSE"})},e.prototype.applyIncremental=function(e,t){var n,r,i=this,o=e.data;switch(o.source){case y.Mutation:t&&(o.adds.forEach((function(e){return i.treeIndex.add(e)})),o.texts.forEach((function(e){return i.treeIndex.text(e)})),o.attributes.forEach((function(e){return i.treeIndex.attribute(e)})),o.removes.forEach((function(e){return i.treeIndex.remove(e)}))),this.applyMutation(o,t);break;case y.MouseMove:if(t){var a=o.positions[o.positions.length-1];this.moveAndHover(o,a.x,a.y,a.id)}else o.positions.forEach((function(t){var n={doAction:function(){i.moveAndHover(o,t.x,t.y,t.id)},delay:t.timeOffset+e.timestamp-i.service.state.context.baselineTime};i.timer.addAction(n)})),this.timer.addAction({doAction:function(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case y.MouseInteraction:if(-1===o.id)break;var s=new Event(g[o.type].toLowerCase());if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);this.emitter.emit(w.MouseInteraction,{type:o.type,target:m});var l=this.config.triggerFocus;switch(o.type){case g.Blur:"blur"in m&&m.blur();break;case g.Focus:l&&m.focus&&m.focus({preventScroll:!0});break;case g.Click:case g.TouchStart:case g.TouchEnd:t||(this.moveAndHover(o,o.x,o.y,o.id),this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:m.dispatchEvent(s)}break;case y.Scroll:if(-1===o.id)break;if(t){this.treeIndex.scroll(o);break}this.applyScroll(o);break;case y.ViewportResize:this.emitter.emit(w.Resize,{width:o.width,height:o.height});break;case y.Input:if(-1===o.id)break;if(t){this.treeIndex.input(o);break}this.applyInput(o);break;case y.MediaInteraction:if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var c=m;try{o.type===b.Pause&&c.pause(),o.type===b.Play&&(c.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?c.play():c.addEventListener("canplay",(function(){c.play()})))}catch(e){this.config.showWarning&&console.warn("Failed to replay media interactions: "+(e.message||e))}break;case y.StyleSheetRule:if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var u=m,f=m.parentNode,d=this.fragmentParentMap.has(f),p=void 0;if(d){var h=this.fragmentParentMap.get(m.parentNode);p=document.createTextNode(""),f.replaceChild(p,m),h.appendChild(m)}var v=u.sheet;o.adds&&o.adds.forEach((function(e){var t=e.rule,n=e.index;try{var r=void 0===n?void 0:Math.min(n,v.rules.length);try{v.insertRule(t,r)}catch(e){}}catch(e){}})),o.removes&&o.removes.forEach((function(e){var t=e.index;try{v.deleteRule(t)}catch(e){}})),d&&p&&f.replaceChild(m,p);break;case y.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var m;if(!(m=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);try{var x=m.getContext("2d");if(o.setter)return void(x[o.property]=o.args[0]);var S=x[o.property];if("drawImage"===o.property&&"string"==typeof o.args[0]){var E=this.imageMap.get(e);o.args[0]=E,S.apply(x,o.args)}else S.apply(x,o.args)}catch(e){this.warnCanvasMutationFailed(o,o.id,e)}break;case y.Font:try{var T=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(T)}catch(e){this.config.showWarning&&console.warn(e)}break;case y.Log:try{var M=e.data,C=this.config.logConfig.replayLogger;"function"==typeof C[M.level]&&C[M.level](M)}catch(e){this.config.showWarning&&console.warn(e)}}},e.prototype.applyMutation=function(e,t){var i,o,a=this;e.removes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);var r=P.getNode(t.parentId);if(!r)return a.warnNodeNotFound(e,t.parentId);if(P.removeNodeFromMap(n),r){var i=a.fragmentParentMap.get(r);if(i&&i.contains(n))i.removeChild(n);else if(a.fragmentParentMap.has(n)){var o=a.fragmentParentMap.get(n);r.removeChild(o),a.fragmentParentMap.delete(n)}else r.removeChild(n)}}));var s=n({},this.legacy_missingNodeRetryMap),l=[];var c=function(e){if(!a.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var n=P.getNode(e.parentId);if(!n)return l.push(e);var r=null;if(a.iframe.contentDocument.contains?r=a.iframe.contentDocument.contains(n):a.iframe.contentDocument.body.contains&&(r=a.iframe.contentDocument.body.contains(n)),t&&r){var i=document.createDocumentFragment();for(P.map[e.parentId]=i,a.fragmentParentMap.set(i,n),a.storeState(n);n.firstChild;)i.appendChild(n.firstChild);n=i}var o=null,c=null;if(e.previousId&&(o=P.getNode(e.previousId)),e.nextId&&(c=P.getNode(e.nextId)),function(e){var t=null;return e.nextId&&(t=P.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t}(e))return l.push(e);var u=p(e.node,{doc:a.iframe.contentDocument,map:P.map,skipChild:!0,hackCss:!0});-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?n.insertBefore(u,o.nextSibling):c&&c.parentNode?n.contains(c)?n.insertBefore(u,c):n.insertBefore(u,null):n.appendChild(u),(e.previousId||e.nextId)&&a.legacy_resolveMissingNode(s,n,u,e)):s[e.node.id]={node:u,mutation:e}};e.adds.forEach((function(e){c(e)}));for(var u=Date.now();l.length;){var f=j(l);if(l.length=0,Date.now()-u>500){this.warn("Timeout in the loop, please check the resolve tree data:",f);break}try{for(var d=(i=void 0,r(f)),h=d.next();!h.done;h=d.next()){var v=h.value;P.getNode(v.value.parentId)?B(v,(function(e){c(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",v)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}Object.keys(s).length&&Object.assign(this.legacy_missingNodeRetryMap,s),e.texts.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),n.textContent=t.value})),e.attributes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);for(var r in a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),t.attributes)if("string"==typeof r){var i=t.attributes[r];try{null!==i?n.setAttribute(r,i):n.removeAttribute(r)}catch(e){a.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}}}))},e.prototype.applyScroll=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);if(t===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:"smooth"});else try{t.scrollTop=e.y,t.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.formatMessage=function(e){if(0===e.trace.length)return"";var t="\n\tat ";return t+=e.trace.join("\n\tat ")},e.prototype.getConsoleLogger=function(){var e,t,n=this,i={},a=function(e){i[e]="trace"===e?function(e){(console.log.__rrweb_original__?console.log.__rrweb_original__:console.log).apply(void 0,o(e.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(e)]))}:function(t){(console[e].__rrweb_original__?console[e].__rrweb_original__:console[e]).apply(void 0,o(t.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(t)]))}};try{for(var s=r(this.config.logConfig.level),l=s.next();!l.done;l=s.next()){a(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return i},e.prototype.legacy_resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var l=a,c=l.node,u=l.mutation;t.insertBefore(c,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(s){var f=s;c=f.node,u=f.mutation;t.insertBefore(c,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}},e.prototype.moveAndHover=function(e,t,n,r){this.mouse.style.left=t+"px",this.mouse.style.top=n+"px",this.drawMouseTail({x:t,y:n});var i=P.getNode(r);if(!i)return this.debugNodeNotFound(e,r);this.hoverElements(i)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var n=!0===this.config.mouseTail?W:Object.assign({},W,this.config.mouseTail),r=n.lineCap,i=n.lineWidth,o=n.strokeStyle,a=n.duration,s=function(){if(t.mouseTail){var e=t.mouseTail.getContext("2d");e&&t.tailPositions.length&&(e.clearRect(0,0,t.mouseTail.width,t.mouseTail.height),e.beginPath(),e.lineWidth=i,e.lineCap=r,e.strokeStyle=o,e.moveTo(t.tailPositions[0].x,t.tailPositions[0].y),t.tailPositions.forEach((function(t){return e.lineTo(t.x,t.y)})),e.stroke())}};this.tailPositions.push(e),s(),setTimeout((function(){t.tailPositions=t.tailPositions.filter((function(t){return t!==e})),s()}),a/this.speedService.state.context.timer.speed)}},e.prototype.hoverElements=function(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((function(e){e.classList.remove(":hover")}));for(var n=e;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement},e.prototype.isUserInteraction=function(e){return e.type===m.IncrementalSnapshot&&(e.data.source>y.Mutation&&e.data.source<=y.Input)},e.prototype.backToNormal=function(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(w.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))},e.prototype.storeState=function(e){var t,n;if(e&&e.nodeType===e.ELEMENT_NODE){var i=e;(i.scrollLeft||i.scrollTop)&&this.elementStateMap.set(e,{scroll:[i.scrollLeft,i.scrollTop]});var o=i.children;try{for(var a=r(Array.from(o)),s=a.next();!s.done;s=a.next()){var l=s.value;this.storeState(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},e.prototype.restoreState=function(e){var t,n;if(e.nodeType===e.ELEMENT_NODE){var i=e;if(this.elementStateMap.has(e)){var o=this.elementStateMap.get(e);o.scroll&&(i.scrollLeft=o.scroll[0],i.scrollTop=o.scroll[1]),this.elementStateMap.delete(e)}var a=i.children;try{for(var s=r(Array.from(a)),l=s.next();!l.done;l=s.next()){var c=l.value;this.restoreState(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}}},e.prototype.warnNodeNotFound=function(e,t){this.warn("Node with id '"+t+"' not found in",e)},e.prototype.warnCanvasMutationFailed=function(e,t,n){this.warn("Has error on update canvas '"+t+"'",e,n)},e.prototype.debugNodeNotFound=function(e,t){this.debug("[replayer]","Node with id '"+t+"' not found in",e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showWarning&&console.warn.apply(console,o(["[replayer]"],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showDebug&&console.log.apply(console,o(["[replayer]"],e))},e}(),X=Uint8Array,H=Uint16Array,G=Uint32Array,q=new X([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),J=new X([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),K=new X([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$=function(e,t){for(var n=new H(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new G(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},Q=$(q,2),Z=Q[0],ee=Q[1];Z[28]=258,ee[258]=28;for(var te=$(J,0)[0],ne=new H(32768),re=0;re<32768;++re){var ie=(43690&re)>>>1|(21845&re)<<1;ie=(61680&(ie=(52428&ie)>>>2|(13107&ie)<<2))>>>4|(3855&ie)<<4,ne[re]=((65280&ie)>>>8|(255&ie)<<8)>>>1}var oe=function(e,t,n){for(var r=e.length,i=0,o=new H(t);i<r;++i)++o[e[i]-1];var a,s=new H(t);for(i=0;i<t;++i)s[i]=s[i-1]+o[i-1]<<1;if(n){a=new H(1<<t);var l=15-t;for(i=0;i<r;++i)if(e[i])for(var c=i<<4|e[i],u=t-e[i],f=s[e[i]-1]++<<u,d=f|(1<<u)-1;f<=d;++f)a[ne[f]>>>l]=c}else for(a=new H(r),i=0;i<r;++i)a[i]=ne[s[e[i]-1]++]>>>15-e[i];return a},ae=new X(288);for(re=0;re<144;++re)ae[re]=8;for(re=144;re<256;++re)ae[re]=9;for(re=256;re<280;++re)ae[re]=7;for(re=280;re<288;++re)ae[re]=8;var se=new X(32);for(re=0;re<32;++re)se[re]=5;oe(ae,9,0);var le=oe(ae,9,1),ce=(oe(se,5,0),oe(se,5,1)),ue=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},fe=function(e,t,n){var r=t/8>>0;return(e[r]|e[r+1]<<8)>>>(7&t)&n},de=function(e,t){var n=t/8>>0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>>(7&t)},pe=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof H?H:e instanceof G?G:X)(n-t);return r.set(e.subarray(t,n)),r},he=new G(256);for(re=0;re<256;++re){for(var ve=re,me=9;--me;)ve=(1&ve&&3988292384)^ve>>>1;he[re]=ve}function ye(e,t){return function(e,t,n){var r=e.length,i=!t||n,o=!n||n.i;n||(n={}),t||(t=new X(3*r));var a=function(e){var n=t.length;if(e>n){var r=new X(Math.max(2*n,e));r.set(t),t=r}},s=n.f||0,l=n.p||0,c=n.b||0,u=n.l,f=n.d,d=n.m,p=n.n;if(s&&!u)return t;var h,v=8*r;do{if(!u){n.f=s=fe(e,l,1);var m=fe(e,l+1,3);if(l+=3,!m){var y=e[(I=((h=l)/8>>0)+(7&h&&1)+4)-4]|e[I-3]<<8,g=I+y;if(g>r){if(o)throw"unexpected EOF";break}i&&a(c+y),t.set(e.subarray(I,g),c),n.b=c+=y,n.p=l=8*g;continue}if(1==m)u=le,f=ce,d=9,p=5;else{if(2!=m)throw"invalid block type";var b=fe(e,l,31)+257,w=fe(e,l+10,15)+4,x=b+fe(e,l+5,31)+1;l+=14;for(var S=new X(x),E=new X(19),T=0;T<w;++T)E[K[T]]=fe(e,l+3*T,7);l+=3*w;var M=ue(E),C=(1<<M)-1;if(!o&&l+x*(M+7)>v)break;var N=oe(E,M,1);for(T=0;T<x;){var I,_=N[fe(e,l,C)];if(l+=15&_,(I=_>>>4)<16)S[T++]=I;else{var k=0,A=0;for(16==I?(A=3+fe(e,l,3),l+=2,k=S[T-1]):17==I?(A=3+fe(e,l,7),l+=3):18==I&&(A=11+fe(e,l,127),l+=7);A--;)S[T++]=k}}var O=S.subarray(0,b),D=S.subarray(b);d=ue(O),p=ue(D),u=oe(O,d,1),f=oe(D,p,1)}if(l>v)throw"unexpected EOF"}i&&a(c+131072);for(var L=(1<<d)-1,F=(1<<p)-1,P=d+p+18;o||l+P<v;){var R=(k=u[de(e,l)&L])>>>4;if((l+=15&k)>v)throw"unexpected EOF";if(!k)throw"invalid length/literal";if(R<256)t[c++]=R;else{if(256==R){u=null;break}var j=R-254;if(R>264){var B=q[T=R-257];j=fe(e,l,(1<<B)-1)+Z[T],l+=B}var U=f[de(e,l)&F],V=U>>>4;if(!U)throw"invalid distance";l+=15&U;D=te[V];if(V>3){B=J[V];D+=de(e,l)&(1<<B)-1,l+=B}if(l>v)throw"unexpected EOF";i&&a(c+131072);for(var W=c+j;c<W;c+=4)t[c]=t[c-D],t[c+1]=t[c+1-D],t[c+2]=t[c+2-D],t[c+3]=t[c+3-D];c=W}}n.l=u,n.p=l,n.b=c,u&&(s=1,n.m=d,n.d=f,n.n=p)}while(!s);return c==t.length?t:pe(t,0,c)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}return e.Replayer=Y,e.unpack=function(e){if("string"!=typeof e)return e;try{if((t=JSON.parse(e)).timestamp)return t}catch(e){}try{var t;if("v1"===(t=JSON.parse(function(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var r=0;r<e.length;){var i=e[r++];i<128||t?n+=String.fromCharCode(i):i<224?n+=String.fromCharCode((31&i)<<6|63&e[r++]):i<240?n+=String.fromCharCode((15&i)<<12|(63&e[r++])<<6|63&e[r++]):(i=((15&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,n+=String.fromCharCode(55296|i>>10,56320|1023&i))}return n}(ye(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new X(e.length+(e.length>>>1)),i=0,o=function(e){r[i++]=e},a=0;a<n;++a){if(i+5>r.length){var s=new X(i+8+(n-a<<1));s.set(r),r=s}var l=e.charCodeAt(a);l<128||t?o(l):l<2048?(o(192|l>>>6),o(128|63&l)):l>55295&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),o(128|l>>>12&63),o(128|l>>>6&63),o(128|63&l)):(o(224|l>>>12),o(128|l>>>6&63),o(128|63&l))}return pe(r,0,i)}(e,!0))))).v)return t;throw new Error("These events were packed with packer "+t.v+" which is incompatible with current packer v1.")}catch(e){throw console.error(e),new Error("Unknown data format.")}},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=rrweb-replay-unpack.min.js.map

@@ -29,3 +29,3 @@ var rrwebReplay=function(e){"use strict";

and limitations under the License.
***************************************************************************** */!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(E||(E={}));var N={type:"xstate.init"};function C(e){return void 0===e?[]:[].concat(e)}function I(e){return{type:"xstate.assign",assignment:e}}function _(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function A(e){return function(t){return e===t}}function k(e){return"string"==typeof e?{type:e}:e}function L(e,t){return{value:e,context:t,actions:[],changed:!1,matches:A(e)}}function D(e,t){void 0===t&&(t={});var n={config:e,_options:t,initialState:{value:e.initial,actions:C(e.states[e.initial].entry).map((function(e){return _(e,t.actions)})),context:e.context,matches:A(e.initial)},transition:function(t,r){var i,o,a="string"==typeof t?{value:t,context:e.context}:t,s=a.value,l=a.context,c=k(r),u=e.states[s];if(u.on){var d=C(u.on[c.type]),f=function(t){if(void 0===t)return{value:L(s,l)};var r="string"==typeof t?{target:t}:t,i=r.target,o=void 0===i?s:i,a=r.actions,d=void 0===a?[]:a,f=r.cond,p=l;if((void 0===f?function(){return!0}:f)(l,c)){var h=e.states[o],m=!1,v=[].concat(u.exit,d,h.entry).filter((function(e){return e})).map((function(e){return _(e,n._options.actions)})).filter((function(e){if("xstate.assign"===e.type){m=!0;var t=Object.assign({},p);return"function"==typeof e.assignment?t=e.assignment(p,c):Object.keys(e.assignment).forEach((function(n){t[n]="function"==typeof e.assignment[n]?e.assignment[n](p,c):e.assignment[n]})),p=t,!1}return!0}));return{value:{value:o,context:p,actions:v,changed:o!==s||v.length>0||m,matches:A(o)}}}};try{for(var p=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(d),h=p.next();!h.done;h=p.next()){var m=f(h.value);if("object"==typeof m)return m.value}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}return L(s,l)}};return n}var O=function(e,t){return e.actions.forEach((function(n){var r=n.exec;return r&&r(e.context,t)}))};function F(e){var t=e.initialState,n=E.NotStarted,r=new Set,i={_machine:e,send:function(i){n===E.Running&&(t=e.transition(t,i),O(t,k(i)),r.forEach((function(e){return e(t)})))},subscribe:function(e){return r.add(e),e(t),{unsubscribe:function(){return r.delete(e)}}},start:function(r){if(r){var o="object"==typeof r?r:{context:e.config.context,value:r};t={value:o.value,actions:[],context:o.context,matches:A(o.value)}}return n=E.Running,O(t,N),i},stop:function(){return n=E.Stopped,r.clear(),i},get state(){return t},get status(){return n}};return i}var P={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return P.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete P.map[t],e.childNodes&&e.childNodes.forEach((function(e){return P.removeNodeFromMap(e)}))},has:function(e){return P.map.hasOwnProperty(e)}};var R=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),n={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(n.parent=t,t.children[n.id]=n):this.tree[n.id]=n,this.indexes.set(n.id,n)},e.prototype.remove=function(e){var t=this,n=this.indexes.get(e.parentId),r=this.indexes.get(e.id),i=function(e){t.removeIdSet.add(e);var n=P.getNode(e);null==n||n.childNodes.forEach((function(e){"__sn"in e&&i(e.__sn.id)}))},o=function(n){t.removeIdSet.add(n.id),Object.values(n.children).forEach((function(e){return o(e)}));var r=t.indexes.get(n.id);if(r){var i=r.parent;i&&(delete r.parent,delete i.children[r.id],t.indexes.delete(e.id))}};r?n?(delete r.parent,delete n.children[r.id],this.indexes.delete(e.id),o(r)):(delete this.tree[r.id],this.indexes.delete(r.id),o(r)):(this.removeNodeMutations.push(e),i(e.id))},e.prototype.text=function(e){var t=this.indexes.get(e.id);t?t.texts.push(e):this.textMutations.push(e)},e.prototype.attribute=function(e){var t=this.indexes.get(e.id);t?t.attributes.push(e):this.attributeMutations.push(e)},e.prototype.scroll=function(e){this.scrollMap.set(e.id,e)},e.prototype.input=function(e){this.inputMap.set(e.id,e)},e.prototype.flush=function(){var e,t,n,i,o=this,a=this.tree,s=this.removeNodeMutations,l=this.textMutations,c=this.attributeMutations,u={source:y.Mutation,removes:s,texts:l,attributes:c,adds:[]},d=function(e,t){t&&o.removeIdSet.add(e.id),u.texts=u.texts.concat(t?[]:e.texts).filter((function(e){return!o.removeIdSet.has(e.id)})),u.attributes=u.attributes.concat(t?[]:e.attributes).filter((function(e){return!o.removeIdSet.has(e.id)})),o.removeIdSet.has(e.id)||o.removeIdSet.has(e.mutation.parentId)||t?Object.values(e.children).forEach((function(e){return d(e,!0)})):(u.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return d(e,!1)})))};Object.values(a).forEach((function(e){return d(e,!1)}));try{for(var f=r(this.scrollMap.keys()),p=f.next();!p.done;p=f.next()){var h=p.value;this.removeIdSet.has(h)&&this.scrollMap.delete(h)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}try{for(var m=r(this.inputMap.keys()),v=m.next();!v.done;v=m.next()){h=v.value;this.removeIdSet.has(h)&&this.inputMap.delete(h)}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var g=new Map(this.scrollMap),b=new Map(this.inputMap);return this.reset(),{mutationData:u,scrollMap:g,inputMap:b}},e.prototype.reset=function(){this.tree=[],this.indexes=new Map,this.removeNodeMutations=[],this.textMutations=[],this.attributeMutations=[],this.removeIdSet=new Set,this.scrollMap=new Map,this.inputMap=new Map},e}();function j(e){var t,n,i={},o=function(e,t){var n={value:e,parent:t,children:[]};return i[e.node.id]=n,n},a=[];try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var c=l.value,u=c.nextId,d=c.parentId;if(u&&u in i){var f=i[u];if(f.parent){var p=f.parent.children.indexOf(f);f.parent.children.splice(p,0,o(c,f.parent))}else{p=a.indexOf(f);a.splice(p,0,o(c,null))}}else if(d in i){var h=i[d];h.children.push(o(c,h))}else a.push(o(c,null))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}function B(e,t){t(e.value);for(var n=e.children.length-1;n>=0;n--)B(e.children[n],t)}function V(e,t){var i=t.getCastFn,o=t.emitter;return F(D({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:I({lastPlayedEvent:function(e,t){return"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}}),recordTimeOffset:I((function(e,t){var r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),n(n({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})})),play:function(e){var t,n,a,s,l;console.warn("play");var c=e.timer,u=e.events,d=e.baselineTime,f=e.lastPlayedEvent;c.clear();try{for(var p=r(u),h=p.next();!h.done;h=p.next()){M(h.value,d)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var m=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.type===v.Meta&&r.timestamp<=t)return e.slice(n)}return e}(u,d),g=new Array,b=function(e){var t=null==f?void 0:f.timestamp;if((null==f?void 0:f.type)===v.IncrementalSnapshot&&f.data.source===y.MouseMove&&(t=f.timestamp+(null===(l=f.data.positions[0])||void 0===l?void 0:l.timeOffset)),t&&t<d&&(e.timestamp<=t||e===f))return"continue";var n=e.timestamp<d;if(n&&!function(e){switch(e.type){case v.DomContentLoaded:case v.Load:case v.Custom:return!1;case v.FullSnapshot:case v.Meta:return!0}switch(e.data.source){case y.MouseMove:case y.MouseInteraction:case y.TouchMove:case y.MediaInteraction:return!1;case y.ViewportResize:case y.StyleSheetRule:case y.Scroll:case y.Input:return!0}return!0}(e))return"continue";var r=i(e,n);n?r():g.push({doAction:function(){r(),o.emit(S.EventCast,e)},delay:e.delay})};try{for(var x=r(m),w=x.next();!w.done;w=x.next()){b(w.value)}}catch(e){a={error:e}}finally{try{w&&!w.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}o.emit(S.Flush),c.addActions(g),c.start()},pause:function(e){e.timer.clear()},resetLastPlayedEvent:I((function(e){return n(n({},e),{lastPlayedEvent:null})})),startLive:I({baselineTime:function(e,t){return e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),addEvent:I((function(e,t){var r=e.baselineTime,a=e.timer,s=e.events;if("ADD_EVENT"===t.type){var l=t.payload.event;M(l,r),s.push(l);var c=l.timestamp<r,u=i(l,c);c?u():(a.addAction({doAction:function(){u(),o.emit(S.EventCast,l)},delay:l.delay}),a.isActive()||a.start())}return n(n({},e),{events:s})}))}}))}var U=m||x,W={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"},z={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0},Y=function(){function e(e,n){var o=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=U(),this.legacy_missingNodeRetryMap={},this.imageMap=new Map,!(null==n?void 0:n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");var a={speed:1,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:W,logConfig:z};this.config=Object.assign({},a,n),this.config.logConfig.replayLogger||(this.config.logConfig.replayLogger=this.getConsoleLogger()),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.emitter.on(S.Resize,this.handleResize),this.setupDom(),this.treeIndex=new R,this.fragmentParentMap=new Map,this.elementStateMap=new Map,this.emitter.on(S.Flush,(function(){var e,n,a,s,l,c,u=o.treeIndex.flush(),d=u.scrollMap,f=u.inputMap;try{for(var p=r(o.fragmentParentMap.entries()),h=p.next();!h.done;h=p.next()){var m=i(h.value,2),v=m[0],y=m[1];P.map[y.__sn.id]=y,y.__sn.type===t.Element&&"textarea"===y.__sn.tagName&&v.textContent&&(y.value=v.textContent),y.appendChild(v),o.restoreState(y)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}o.fragmentParentMap.clear(),o.elementStateMap.clear();try{for(var g=r(d.values()),b=g.next();!b.done;b=g.next()){var S=b.value;o.applyScroll(S)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}try{for(var x=r(f.values()),w=x.next();!w.done;w=x.next()){S=w.value;o.applyInput(S)}}catch(e){l={error:e}}finally{try{w&&!w.done&&(c=x.return)&&c.call(x)}finally{if(l)throw l.error}}}));var s=new T([],(null==n?void 0:n.speed)||a.speed);this.service=V({events:e.map((function(e){return n&&n.unpackFn?n.unpackFn(e):e})),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){o.emitter.emit(S.StateChange,{player:e})})),this.speedService=F(D({id:"speed",context:{normalSpeed:-1,timer:s},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:function(e,t){"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:I({normalSpeed:function(e){return e.timer.speed}}),restoreSpeed:function(e){e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((function(e){o.emitter.emit(S.StateChange,{speed:e})}));var l=this.service.state.context.events.find((function(e){return e.type===v.Meta})),c=this.service.state.context.events.find((function(e){return e.type===v.FullSnapshot}));if(l){var u=l.data,d=u.width,f=u.height;setTimeout((function(){o.emitter.emit(S.Resize,{width:d,height:f})}),0)}c&&setTimeout((function(){o.rebuildFullSnapshot(c),o.iframe.contentWindow.scrollTo(c.data.initialOffset)}),1)}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return this.emitter.on(e,t),this},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(n){t.config[n]=e[n]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))},e.prototype.getMetaData=function(){var e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}},e.prototype.getCurrentTime=function(){return this.timer.timeOffset+this.getTimeOffset()},e.prototype.getTimeOffset=function(){var e=this.service.state.context;return e.baselineTime-e.events[0].timestamp},e.prototype.play=function(e){var t;void 0===e&&(e=0),this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.remove("rrweb-paused"),this.emitter.emit(S.Start)},e.prototype.pause=function(e){var t;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(S.Pause)},e.prototype.resume=function(e){void 0===e&&(e=0),console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(S.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,n=this.config.unpackFn?this.config.unpackFn(e):e;Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:n}})}))},e.prototype.enableInteract=function(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"},e.prototype.disableInteract=function(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"},e.prototype.setupDom=function(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");var e,t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(w(this.iframe.contentWindow,this.iframe.contentDocument),void 0===(e=this.iframe.contentWindow)&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach))},e.prototype.handleResize=function(e){var t,n;this.iframe.style.display="inherit";try{for(var i=r([this.mouseTail,this.iframe]),o=i.next();!o.done;o=i.next()){var a=o.value;a&&(a.setAttribute("width",String(e.width)),a.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.getCastFn=function(e,t){var n,i=this;switch(void 0===t&&(t=!1),e.type){case v.DomContentLoaded:case v.Load:break;case v.Custom:n=function(){i.emitter.emit(S.CustomEvent,e)};break;case v.Meta:n=function(){return i.emitter.emit(S.Resize,{width:e.data.width,height:e.data.height})};break;case v.FullSnapshot:n=function(){i.rebuildFullSnapshot(e,t),i.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case v.IncrementalSnapshot:n=function(){var n,o;if(i.applyIncremental(e,t),!t&&(e===i.nextUserInteractionEvent&&(i.nextUserInteractionEvent=null,i.backToNormal()),i.config.skipInactive&&!i.nextUserInteractionEvent)){try{for(var a=r(i.service.state.context.events),s=a.next();!s.done;s=a.next()){var l=s.value;if(!(l.timestamp<=e.timestamp)&&i.isUserInteraction(l)){l.delay-e.delay>1e4*i.speedService.state.context.timer.speed&&(i.nextUserInteractionEvent=l);break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}if(i.nextUserInteractionEvent){var c=i.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(c/5e3),360)};i.speedService.send({type:"FAST_FORWARD",payload:u}),i.emitter.emit(S.SkipStart,u)}}}}return function(){if(n&&n(),i.service.send({type:"CAST_EVENT",payload:{event:e}}),e===i.service.state.context.events[i.service.state.context.events.length-1]){var t=function(){i.backToNormal(),i.service.send("END"),i.emitter.emit(S.Finish)};e.type===v.IncrementalSnapshot&&e.data.source===y.MouseMove&&e.data.positions.length?setTimeout((function(){t()}),Math.max(0,50-e.data.positions[0].timeOffset)):t()}}},e.prototype.rebuildFullSnapshot=function(e,t){if(void 0===t&&(t=!1),!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={},P.map=h(e.data.node,{doc:this.iframe.contentDocument})[1];var n=document.createElement("style"),r=this.iframe.contentDocument,i=r.documentElement,o=r.head;i.insertBefore(n,o);var a,s=(a=this.config.blockClass,["iframe, ."+a+" { background: #ccc }","noscript { display: none !important; }"]).concat(this.config.insertStyleRules);this.config.pauseAnimation&&s.push("html.rrweb-paused * { animation-play-state: paused !important; }"),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused");for(var l=0;l<s.length;l++)n.sheet.insertRule(s[l],l);this.emitter.emit(S.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.waitForStylesheetLoad=function(){var e,t=this,n=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(n){var r,i=new Set,o=this.service.state,a=function(){o=t.service.state};this.emitter.on(S.Start,a),this.emitter.on(S.Pause,a);var s=function(){t.emitter.off(S.Start,a),t.emitter.off(S.Pause,a)};n.querySelectorAll('link[rel="stylesheet"]').forEach((function(e){e.sheet||(i.add(e),e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==r&&(o.matches("playing")&&t.play(t.getCurrentTime()),t.emitter.emit(S.LoadStylesheetEnd),r&&window.clearTimeout(r),s())})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(S.LoadStylesheetStart),r=window.setTimeout((function(){o.matches("playing")&&t.play(t.getCurrentTime()),r=-1,s()}),this.config.loadTimeout))}},e.prototype.preloadAllImages=function(){var e,t,n=this,i=this.service.state,o=function(){i=n.service.state};this.emitter.on(S.Start,o),this.emitter.on(S.Pause,o);var a=0,s=0;try{for(var l=r(this.service.state.context.events),c=l.next();!c.done;c=l.next()){var u=c.value;if(u.type===v.IncrementalSnapshot&&u.data.source===y.CanvasMutation&&"drawImage"===u.data.property&&"string"==typeof u.data.args[0]&&!this.imageMap.has(u)){a++;var d=document.createElement("img");d.src=u.data.args[0],this.imageMap.set(u,d),d.onload=function(){++s===a&&(i.matches("playing")&&n.play(n.getCurrentTime()),n.emitter.off(S.Start,o),n.emitter.off(S.Pause,o))}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}a!==s&&this.service.send({type:"PAUSE"})},e.prototype.applyIncremental=function(e,t){var n,r,i=this,o=e.data;switch(o.source){case y.Mutation:t&&(o.adds.forEach((function(e){return i.treeIndex.add(e)})),o.texts.forEach((function(e){return i.treeIndex.text(e)})),o.attributes.forEach((function(e){return i.treeIndex.attribute(e)})),o.removes.forEach((function(e){return i.treeIndex.remove(e)}))),this.applyMutation(o,t);break;case y.MouseMove:if(t){var a=o.positions[o.positions.length-1];this.moveAndHover(o,a.x,a.y,a.id)}else o.positions.forEach((function(t){var n={doAction:function(){i.moveAndHover(o,t.x,t.y,t.id)},delay:t.timeOffset+e.timestamp-i.service.state.context.baselineTime};i.timer.addAction(n)})),this.timer.addAction({doAction:function(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case y.MouseInteraction:if(-1===o.id)break;var s=new Event(g[o.type].toLowerCase());if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);this.emitter.emit(S.MouseInteraction,{type:o.type,target:v});var l=this.config.triggerFocus;switch(o.type){case g.Blur:"blur"in v&&v.blur();break;case g.Focus:l&&v.focus&&v.focus({preventScroll:!0});break;case g.Click:case g.TouchStart:case g.TouchEnd:t||(this.moveAndHover(o,o.x,o.y,o.id),this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:v.dispatchEvent(s)}break;case y.Scroll:if(-1===o.id)break;if(t){this.treeIndex.scroll(o);break}this.applyScroll(o);break;case y.ViewportResize:this.emitter.emit(S.Resize,{width:o.width,height:o.height});break;case y.Input:if(-1===o.id)break;if(t){this.treeIndex.input(o);break}this.applyInput(o);break;case y.MediaInteraction:if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var c=v;try{o.type===b.Pause&&c.pause(),o.type===b.Play&&(c.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?c.play():c.addEventListener("canplay",(function(){c.play()})))}catch(e){this.config.showWarning&&console.warn("Failed to replay media interactions: "+(e.message||e))}break;case y.StyleSheetRule:if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var u=v,d=v.parentNode,f=this.fragmentParentMap.has(d),p=void 0;if(f){var h=this.fragmentParentMap.get(v.parentNode);p=document.createTextNode(""),d.replaceChild(p,v),h.appendChild(v)}var m=u.sheet;o.adds&&o.adds.forEach((function(e){var t=e.rule,n=e.index;try{var r=void 0===n?void 0:Math.min(n,m.rules.length);try{m.insertRule(t,r)}catch(e){}}catch(e){}})),o.removes&&o.removes.forEach((function(e){var t=e.index;try{m.deleteRule(t)}catch(e){}})),f&&p&&d.replaceChild(v,p);break;case y.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var v;if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);try{var x=v.getContext("2d");if(o.setter)return void(x[o.property]=o.args[0]);var w=x[o.property];if("drawImage"===o.property&&"string"==typeof o.args[0]){var E=this.imageMap.get(e);o.args[0]=E,w.apply(x,o.args)}else w.apply(x,o.args)}catch(e){this.warnCanvasMutationFailed(o,o.id,e)}break;case y.Font:try{var T=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(T)}catch(e){this.config.showWarning&&console.warn(e)}break;case y.Log:try{var M=e.data,N=this.config.logConfig.replayLogger;"function"==typeof N[M.level]&&N[M.level](M)}catch(e){this.config.showWarning&&console.warn(e)}}},e.prototype.applyMutation=function(e,t){var i,o,a=this;e.removes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);var r=P.getNode(t.parentId);if(!r)return a.warnNodeNotFound(e,t.parentId);if(P.removeNodeFromMap(n),r){var i=a.fragmentParentMap.get(r);if(i&&i.contains(n))i.removeChild(n);else if(a.fragmentParentMap.has(n)){var o=a.fragmentParentMap.get(n);r.removeChild(o),a.fragmentParentMap.delete(n)}else r.removeChild(n)}}));var s=n({},this.legacy_missingNodeRetryMap),l=[];var c=function(e){if(!a.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var n=P.getNode(e.parentId);if(!n)return l.push(e);var r=null;if(a.iframe.contentDocument.contains?r=a.iframe.contentDocument.contains(n):a.iframe.contentDocument.body.contains&&(r=a.iframe.contentDocument.body.contains(n)),t&&r){var i=document.createDocumentFragment();for(P.map[e.parentId]=i,a.fragmentParentMap.set(i,n),a.storeState(n);n.firstChild;)i.appendChild(n.firstChild);n=i}var o=null,c=null;if(e.previousId&&(o=P.getNode(e.previousId)),e.nextId&&(c=P.getNode(e.nextId)),function(e){var t=null;return e.nextId&&(t=P.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t}(e))return l.push(e);var u=p(e.node,{doc:a.iframe.contentDocument,map:P.map,skipChild:!0,hackCss:!0});-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?n.insertBefore(u,o.nextSibling):c&&c.parentNode?n.contains(c)?n.insertBefore(u,c):n.insertBefore(u,null):n.appendChild(u),(e.previousId||e.nextId)&&a.legacy_resolveMissingNode(s,n,u,e)):s[e.node.id]={node:u,mutation:e}};e.adds.forEach((function(e){c(e)}));for(var u=Date.now();l.length;){var d=j(l);if(l.length=0,Date.now()-u>500){this.warn("Timeout in the loop, please check the resolve tree data:",d);break}try{for(var f=(i=void 0,r(d)),h=f.next();!h.done;h=f.next()){var m=h.value;P.getNode(m.value.parentId)?B(m,(function(e){c(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",m)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}Object.keys(s).length&&Object.assign(this.legacy_missingNodeRetryMap,s),e.texts.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),n.textContent=t.value})),e.attributes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);for(var r in a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),t.attributes)if("string"==typeof r){var i=t.attributes[r];try{null!==i?n.setAttribute(r,i):n.removeAttribute(r)}catch(e){a.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}}}))},e.prototype.applyScroll=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);if(t===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:"smooth"});else try{t.scrollTop=e.y,t.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.formatMessage=function(e){if(0===e.trace.length)return"";var t="\n\tat ";return t+=e.trace.join("\n\tat ")},e.prototype.getConsoleLogger=function(){var e,t,n=this,i={},a=function(e){i[e]="trace"===e?function(e){(console.log.__rrweb_original__?console.log.__rrweb_original__:console.log).apply(void 0,o(e.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(e)]))}:function(t){(console[e].__rrweb_original__?console[e].__rrweb_original__:console[e]).apply(void 0,o(t.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(t)]))}};try{for(var s=r(this.config.logConfig.level),l=s.next();!l.done;l=s.next()){a(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return i},e.prototype.legacy_resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var l=a,c=l.node,u=l.mutation;t.insertBefore(c,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(s){var d=s;c=d.node,u=d.mutation;t.insertBefore(c,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}},e.prototype.moveAndHover=function(e,t,n,r){this.mouse.style.left=t+"px",this.mouse.style.top=n+"px",this.drawMouseTail({x:t,y:n});var i=P.getNode(r);if(!i)return this.debugNodeNotFound(e,r);this.hoverElements(i)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var n=!0===this.config.mouseTail?W:Object.assign({},W,this.config.mouseTail),r=n.lineCap,i=n.lineWidth,o=n.strokeStyle,a=n.duration,s=function(){if(t.mouseTail){var e=t.mouseTail.getContext("2d");e&&t.tailPositions.length&&(e.clearRect(0,0,t.mouseTail.width,t.mouseTail.height),e.beginPath(),e.lineWidth=i,e.lineCap=r,e.strokeStyle=o,e.moveTo(t.tailPositions[0].x,t.tailPositions[0].y),t.tailPositions.forEach((function(t){return e.lineTo(t.x,t.y)})),e.stroke())}};this.tailPositions.push(e),s(),setTimeout((function(){t.tailPositions=t.tailPositions.filter((function(t){return t!==e})),s()}),a)}},e.prototype.hoverElements=function(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((function(e){e.classList.remove(":hover")}));for(var n=e;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement},e.prototype.isUserInteraction=function(e){return e.type===v.IncrementalSnapshot&&(e.data.source>y.Mutation&&e.data.source<=y.Input)},e.prototype.backToNormal=function(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(S.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))},e.prototype.storeState=function(e){var t,n;if(e&&e.nodeType===e.ELEMENT_NODE){var i=e;(i.scrollLeft||i.scrollTop)&&this.elementStateMap.set(e,{scroll:[i.scrollLeft,i.scrollTop]});var o=i.children;try{for(var a=r(Array.from(o)),s=a.next();!s.done;s=a.next()){var l=s.value;this.storeState(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},e.prototype.restoreState=function(e){var t,n;if(e.nodeType===e.ELEMENT_NODE){var i=e;if(this.elementStateMap.has(e)){var o=this.elementStateMap.get(e);o.scroll&&(i.scrollLeft=o.scroll[0],i.scrollTop=o.scroll[1]),this.elementStateMap.delete(e)}var a=i.children;try{for(var s=r(Array.from(a)),l=s.next();!l.done;l=s.next()){var c=l.value;this.restoreState(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}}},e.prototype.warnNodeNotFound=function(e,t){this.warn("Node with id '"+t+"' not found in",e)},e.prototype.warnCanvasMutationFailed=function(e,t,n){this.warn("Has error on update canvas '"+t+"'",e,n)},e.prototype.debugNodeNotFound=function(e,t){this.debug("[replayer]","Node with id '"+t+"' not found in",e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showWarning&&console.warn.apply(console,o(["[replayer]"],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showDebug&&console.log.apply(console,o(["[replayer]"],e))},e}();return e.Replayer=Y,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
***************************************************************************** */!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(E||(E={}));var N={type:"xstate.init"};function C(e){return void 0===e?[]:[].concat(e)}function I(e){return{type:"xstate.assign",assignment:e}}function _(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function A(e){return function(t){return e===t}}function k(e){return"string"==typeof e?{type:e}:e}function L(e,t){return{value:e,context:t,actions:[],changed:!1,matches:A(e)}}function D(e,t){void 0===t&&(t={});var n={config:e,_options:t,initialState:{value:e.initial,actions:C(e.states[e.initial].entry).map((function(e){return _(e,t.actions)})),context:e.context,matches:A(e.initial)},transition:function(t,r){var i,o,a="string"==typeof t?{value:t,context:e.context}:t,s=a.value,l=a.context,c=k(r),u=e.states[s];if(u.on){var d=C(u.on[c.type]),f=function(t){if(void 0===t)return{value:L(s,l)};var r="string"==typeof t?{target:t}:t,i=r.target,o=void 0===i?s:i,a=r.actions,d=void 0===a?[]:a,f=r.cond,p=l;if((void 0===f?function(){return!0}:f)(l,c)){var h=e.states[o],m=!1,v=[].concat(u.exit,d,h.entry).filter((function(e){return e})).map((function(e){return _(e,n._options.actions)})).filter((function(e){if("xstate.assign"===e.type){m=!0;var t=Object.assign({},p);return"function"==typeof e.assignment?t=e.assignment(p,c):Object.keys(e.assignment).forEach((function(n){t[n]="function"==typeof e.assignment[n]?e.assignment[n](p,c):e.assignment[n]})),p=t,!1}return!0}));return{value:{value:o,context:p,actions:v,changed:o!==s||v.length>0||m,matches:A(o)}}}};try{for(var p=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}(d),h=p.next();!h.done;h=p.next()){var m=f(h.value);if("object"==typeof m)return m.value}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}}return L(s,l)}};return n}var O=function(e,t){return e.actions.forEach((function(n){var r=n.exec;return r&&r(e.context,t)}))};function F(e){var t=e.initialState,n=E.NotStarted,r=new Set,i={_machine:e,send:function(i){n===E.Running&&(t=e.transition(t,i),O(t,k(i)),r.forEach((function(e){return e(t)})))},subscribe:function(e){return r.add(e),e(t),{unsubscribe:function(){return r.delete(e)}}},start:function(r){if(r){var o="object"==typeof r?r:{context:e.config.context,value:r};t={value:o.value,actions:[],context:o.context,matches:A(o.value)}}return n=E.Running,O(t,N),i},stop:function(){return n=E.Stopped,r.clear(),i},get state(){return t},get status(){return n}};return i}var P={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return P.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete P.map[t],e.childNodes&&e.childNodes.forEach((function(e){return P.removeNodeFromMap(e)}))},has:function(e){return P.map.hasOwnProperty(e)}};var R=function(){function e(){this.reset()}return e.prototype.add=function(e){var t=this.indexes.get(e.parentId),n={id:e.node.id,mutation:e,children:[],texts:[],attributes:[]};t?(n.parent=t,t.children[n.id]=n):this.tree[n.id]=n,this.indexes.set(n.id,n)},e.prototype.remove=function(e){var t=this,n=this.indexes.get(e.parentId),r=this.indexes.get(e.id),i=function(e){t.removeIdSet.add(e);var n=P.getNode(e);null==n||n.childNodes.forEach((function(e){"__sn"in e&&i(e.__sn.id)}))},o=function(n){t.removeIdSet.add(n.id),Object.values(n.children).forEach((function(e){return o(e)}));var r=t.indexes.get(n.id);if(r){var i=r.parent;i&&(delete r.parent,delete i.children[r.id],t.indexes.delete(e.id))}};r?n?(delete r.parent,delete n.children[r.id],this.indexes.delete(e.id),o(r)):(delete this.tree[r.id],this.indexes.delete(r.id),o(r)):(this.removeNodeMutations.push(e),i(e.id))},e.prototype.text=function(e){var t=this.indexes.get(e.id);t?t.texts.push(e):this.textMutations.push(e)},e.prototype.attribute=function(e){var t=this.indexes.get(e.id);t?t.attributes.push(e):this.attributeMutations.push(e)},e.prototype.scroll=function(e){this.scrollMap.set(e.id,e)},e.prototype.input=function(e){this.inputMap.set(e.id,e)},e.prototype.flush=function(){var e,t,n,i,o=this,a=this.tree,s=this.removeNodeMutations,l=this.textMutations,c=this.attributeMutations,u={source:y.Mutation,removes:s,texts:l,attributes:c,adds:[]},d=function(e,t){t&&o.removeIdSet.add(e.id),u.texts=u.texts.concat(t?[]:e.texts).filter((function(e){return!o.removeIdSet.has(e.id)})),u.attributes=u.attributes.concat(t?[]:e.attributes).filter((function(e){return!o.removeIdSet.has(e.id)})),o.removeIdSet.has(e.id)||o.removeIdSet.has(e.mutation.parentId)||t?Object.values(e.children).forEach((function(e){return d(e,!0)})):(u.adds.push(e.mutation),e.children&&Object.values(e.children).forEach((function(e){return d(e,!1)})))};Object.values(a).forEach((function(e){return d(e,!1)}));try{for(var f=r(this.scrollMap.keys()),p=f.next();!p.done;p=f.next()){var h=p.value;this.removeIdSet.has(h)&&this.scrollMap.delete(h)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}try{for(var m=r(this.inputMap.keys()),v=m.next();!v.done;v=m.next()){h=v.value;this.removeIdSet.has(h)&&this.inputMap.delete(h)}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}var g=new Map(this.scrollMap),b=new Map(this.inputMap);return this.reset(),{mutationData:u,scrollMap:g,inputMap:b}},e.prototype.reset=function(){this.tree=[],this.indexes=new Map,this.removeNodeMutations=[],this.textMutations=[],this.attributeMutations=[],this.removeIdSet=new Set,this.scrollMap=new Map,this.inputMap=new Map},e}();function j(e){var t,n,i={},o=function(e,t){var n={value:e,parent:t,children:[]};return i[e.node.id]=n,n},a=[];try{for(var s=r(e),l=s.next();!l.done;l=s.next()){var c=l.value,u=c.nextId,d=c.parentId;if(u&&u in i){var f=i[u];if(f.parent){var p=f.parent.children.indexOf(f);f.parent.children.splice(p,0,o(c,f.parent))}else{p=a.indexOf(f);a.splice(p,0,o(c,null))}}else if(d in i){var h=i[d];h.children.push(o(c,h))}else a.push(o(c,null))}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return a}function B(e,t){t(e.value);for(var n=e.children.length-1;n>=0;n--)B(e.children[n],t)}function V(e,t){var i=t.getCastFn,o=t.emitter;return F(D({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:I({lastPlayedEvent:function(e,t){return"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}}),recordTimeOffset:I((function(e,t){var r=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(r=t.payload.timeOffset),n(n({},e),{timeOffset:r,baselineTime:e.events[0].timestamp+r})})),play:function(e){var t,n,a,s,l;console.warn("play");var c=e.timer,u=e.events,d=e.baselineTime,f=e.lastPlayedEvent;c.clear();try{for(var p=r(u),h=p.next();!h.done;h=p.next()){M(h.value,d)}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}var m=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.type===v.Meta&&r.timestamp<=t)return e.slice(n)}return e}(u,d),g=new Array,b=function(e){var t=null==f?void 0:f.timestamp;if((null==f?void 0:f.type)===v.IncrementalSnapshot&&f.data.source===y.MouseMove&&(t=f.timestamp+(null===(l=f.data.positions[0])||void 0===l?void 0:l.timeOffset)),t&&t<d&&(e.timestamp<=t||e===f))return"continue";var n=e.timestamp<d;if(n&&!function(e){switch(e.type){case v.DomContentLoaded:case v.Load:case v.Custom:return!1;case v.FullSnapshot:case v.Meta:return!0}switch(e.data.source){case y.MouseMove:case y.MouseInteraction:case y.TouchMove:case y.MediaInteraction:return!1;case y.ViewportResize:case y.StyleSheetRule:case y.Scroll:case y.Input:return!0}return!0}(e))return"continue";var r=i(e,n);n?r():g.push({doAction:function(){r(),o.emit(S.EventCast,e)},delay:e.delay})};try{for(var x=r(m),w=x.next();!w.done;w=x.next()){b(w.value)}}catch(e){a={error:e}}finally{try{w&&!w.done&&(s=x.return)&&s.call(x)}finally{if(a)throw a.error}}o.emit(S.Flush),c.addActions(g),c.start()},pause:function(e){e.timer.clear()},resetLastPlayedEvent:I((function(e){return n(n({},e),{lastPlayedEvent:null})})),startLive:I({baselineTime:function(e,t){return e.timer.toggleLiveMode(!0),e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now()}}),addEvent:I((function(e,t){var r=e.baselineTime,a=e.timer,s=e.events;if("ADD_EVENT"===t.type){var l=t.payload.event;M(l,r),s.push(l);var c=l.timestamp<r,u=i(l,c);c?u():(a.addAction({doAction:function(){u(),o.emit(S.EventCast,l)},delay:l.delay}),a.isActive()||a.start())}return n(n({},e),{events:s})}))}}))}var U=m||x,W={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"},z={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],replayLogger:void 0},Y=function(){function e(e,n){var o=this;if(this.mouseTail=null,this.tailPositions=[],this.emitter=U(),this.legacy_missingNodeRetryMap={},this.imageMap=new Map,!(null==n?void 0:n.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");var a={speed:1,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:W,logConfig:z};this.config=Object.assign({},a,n),this.config.logConfig.replayLogger||(this.config.logConfig.replayLogger=this.getConsoleLogger()),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.emitter.on(S.Resize,this.handleResize),this.setupDom(),this.treeIndex=new R,this.fragmentParentMap=new Map,this.elementStateMap=new Map,this.emitter.on(S.Flush,(function(){var e,n,a,s,l,c,u=o.treeIndex.flush(),d=u.scrollMap,f=u.inputMap;try{for(var p=r(o.fragmentParentMap.entries()),h=p.next();!h.done;h=p.next()){var m=i(h.value,2),v=m[0],y=m[1];P.map[y.__sn.id]=y,y.__sn.type===t.Element&&"textarea"===y.__sn.tagName&&v.textContent&&(y.value=v.textContent),y.appendChild(v),o.restoreState(y)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(e)throw e.error}}o.fragmentParentMap.clear(),o.elementStateMap.clear();try{for(var g=r(d.values()),b=g.next();!b.done;b=g.next()){var S=b.value;o.applyScroll(S)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}try{for(var x=r(f.values()),w=x.next();!w.done;w=x.next()){S=w.value;o.applyInput(S)}}catch(e){l={error:e}}finally{try{w&&!w.done&&(c=x.return)&&c.call(x)}finally{if(l)throw l.error}}}));var s=new T([],(null==n?void 0:n.speed)||a.speed);this.service=V({events:e.map((function(e){return n&&n.unpackFn?n.unpackFn(e):e})),timer:s,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,emitter:this.emitter}),this.service.start(),this.service.subscribe((function(e){o.emitter.emit(S.StateChange,{player:e})})),this.speedService=F(D({id:"speed",context:{normalSpeed:-1,timer:s},initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:function(e,t){"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:I({normalSpeed:function(e){return e.timer.speed}}),restoreSpeed:function(e){e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((function(e){o.emitter.emit(S.StateChange,{speed:e})}));var l=this.service.state.context.events.find((function(e){return e.type===v.Meta})),c=this.service.state.context.events.find((function(e){return e.type===v.FullSnapshot}));if(l){var u=l.data,d=u.width,f=u.height;setTimeout((function(){o.emitter.emit(S.Resize,{width:d,height:f})}),0)}c&&setTimeout((function(){o.rebuildFullSnapshot(c),o.iframe.contentWindow.scrollTo(c.data.initialOffset)}),1)}return Object.defineProperty(e.prototype,"timer",{get:function(){return this.service.state.context.timer},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return this.emitter.on(e,t),this},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach((function(n){t.config[n]=e[n]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))},e.prototype.getMetaData=function(){var e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}},e.prototype.getCurrentTime=function(){return this.timer.timeOffset+this.getTimeOffset()},e.prototype.getTimeOffset=function(){var e=this.service.state.context;return e.baselineTime-e.events[0].timestamp},e.prototype.play=function(e){var t;void 0===e&&(e=0),this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.remove("rrweb-paused"),this.emitter.emit(S.Start)},e.prototype.pause=function(e){var t;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(t=this.iframe.contentDocument)||void 0===t||t.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(S.Pause)},e.prototype.resume=function(e){void 0===e&&(e=0),console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(S.Resume)},e.prototype.startLive=function(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})},e.prototype.addEvent=function(e){var t=this,n=this.config.unpackFn?this.config.unpackFn(e):e;Promise.resolve().then((function(){return t.service.send({type:"ADD_EVENT",payload:{event:n}})}))},e.prototype.enableInteract=function(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"},e.prototype.disableInteract=function(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"},e.prototype.setupDom=function(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");var e,t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(w(this.iframe.contentWindow,this.iframe.contentDocument),void 0===(e=this.iframe.contentWindow)&&(e=window),"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach))},e.prototype.handleResize=function(e){var t,n;this.iframe.style.display="inherit";try{for(var i=r([this.mouseTail,this.iframe]),o=i.next();!o.done;o=i.next()){var a=o.value;a&&(a.setAttribute("width",String(e.width)),a.setAttribute("height",String(e.height)))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},e.prototype.getCastFn=function(e,t){var n,i=this;switch(void 0===t&&(t=!1),e.type){case v.DomContentLoaded:case v.Load:break;case v.Custom:n=function(){i.emitter.emit(S.CustomEvent,e)};break;case v.Meta:n=function(){return i.emitter.emit(S.Resize,{width:e.data.width,height:e.data.height})};break;case v.FullSnapshot:n=function(){i.rebuildFullSnapshot(e,t),i.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case v.IncrementalSnapshot:n=function(){var n,o;if(i.applyIncremental(e,t),!t&&(e===i.nextUserInteractionEvent&&(i.nextUserInteractionEvent=null,i.backToNormal()),i.config.skipInactive&&!i.nextUserInteractionEvent)){try{for(var a=r(i.service.state.context.events),s=a.next();!s.done;s=a.next()){var l=s.value;if(!(l.timestamp<=e.timestamp)&&i.isUserInteraction(l)){l.delay-e.delay>1e4*i.speedService.state.context.timer.speed&&(i.nextUserInteractionEvent=l);break}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}if(i.nextUserInteractionEvent){var c=i.nextUserInteractionEvent.delay-e.delay,u={speed:Math.min(Math.round(c/5e3),360)};i.speedService.send({type:"FAST_FORWARD",payload:u}),i.emitter.emit(S.SkipStart,u)}}}}return function(){if(n&&n(),i.service.send({type:"CAST_EVENT",payload:{event:e}}),e===i.service.state.context.events[i.service.state.context.events.length-1]){var t=function(){i.backToNormal(),i.service.send("END"),i.emitter.emit(S.Finish)};e.type===v.IncrementalSnapshot&&e.data.source===y.MouseMove&&e.data.positions.length?setTimeout((function(){t()}),Math.max(0,50-e.data.positions[0].timeOffset)):t()}}},e.prototype.rebuildFullSnapshot=function(e,t){if(void 0===t&&(t=!1),!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={},P.map=h(e.data.node,{doc:this.iframe.contentDocument})[1];var n=document.createElement("style"),r=this.iframe.contentDocument,i=r.documentElement,o=r.head;i.insertBefore(n,o);var a,s=(a=this.config.blockClass,["iframe, ."+a+" { background: #ccc }","noscript { display: none !important; }"]).concat(this.config.insertStyleRules);this.config.pauseAnimation&&s.push("html.rrweb-paused * { animation-play-state: paused !important; }"),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused");for(var l=0;l<s.length;l++)n.sheet.insertRule(s[l],l);this.emitter.emit(S.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()},e.prototype.waitForStylesheetLoad=function(){var e,t=this,n=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(n){var r,i=new Set,o=this.service.state,a=function(){o=t.service.state};this.emitter.on(S.Start,a),this.emitter.on(S.Pause,a);var s=function(){t.emitter.off(S.Start,a),t.emitter.off(S.Pause,a)};n.querySelectorAll('link[rel="stylesheet"]').forEach((function(e){e.sheet||(i.add(e),e.addEventListener("load",(function(){i.delete(e),0===i.size&&-1!==r&&(o.matches("playing")&&t.play(t.getCurrentTime()),t.emitter.emit(S.LoadStylesheetEnd),r&&window.clearTimeout(r),s())})))})),i.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(S.LoadStylesheetStart),r=window.setTimeout((function(){o.matches("playing")&&t.play(t.getCurrentTime()),r=-1,s()}),this.config.loadTimeout))}},e.prototype.preloadAllImages=function(){var e,t,n=this,i=this.service.state,o=function(){i=n.service.state};this.emitter.on(S.Start,o),this.emitter.on(S.Pause,o);var a=0,s=0;try{for(var l=r(this.service.state.context.events),c=l.next();!c.done;c=l.next()){var u=c.value;if(u.type===v.IncrementalSnapshot&&u.data.source===y.CanvasMutation&&"drawImage"===u.data.property&&"string"==typeof u.data.args[0]&&!this.imageMap.has(u)){a++;var d=document.createElement("img");d.src=u.data.args[0],this.imageMap.set(u,d),d.onload=function(){++s===a&&(i.matches("playing")&&n.play(n.getCurrentTime()),n.emitter.off(S.Start,o),n.emitter.off(S.Pause,o))}}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}a!==s&&this.service.send({type:"PAUSE"})},e.prototype.applyIncremental=function(e,t){var n,r,i=this,o=e.data;switch(o.source){case y.Mutation:t&&(o.adds.forEach((function(e){return i.treeIndex.add(e)})),o.texts.forEach((function(e){return i.treeIndex.text(e)})),o.attributes.forEach((function(e){return i.treeIndex.attribute(e)})),o.removes.forEach((function(e){return i.treeIndex.remove(e)}))),this.applyMutation(o,t);break;case y.MouseMove:if(t){var a=o.positions[o.positions.length-1];this.moveAndHover(o,a.x,a.y,a.id)}else o.positions.forEach((function(t){var n={doAction:function(){i.moveAndHover(o,t.x,t.y,t.id)},delay:t.timeOffset+e.timestamp-i.service.state.context.baselineTime};i.timer.addAction(n)})),this.timer.addAction({doAction:function(){},delay:e.delay-(null===(n=o.positions[0])||void 0===n?void 0:n.timeOffset)});break;case y.MouseInteraction:if(-1===o.id)break;var s=new Event(g[o.type].toLowerCase());if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);this.emitter.emit(S.MouseInteraction,{type:o.type,target:v});var l=this.config.triggerFocus;switch(o.type){case g.Blur:"blur"in v&&v.blur();break;case g.Focus:l&&v.focus&&v.focus({preventScroll:!0});break;case g.Click:case g.TouchStart:case g.TouchEnd:t||(this.moveAndHover(o,o.x,o.y,o.id),this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:v.dispatchEvent(s)}break;case y.Scroll:if(-1===o.id)break;if(t){this.treeIndex.scroll(o);break}this.applyScroll(o);break;case y.ViewportResize:this.emitter.emit(S.Resize,{width:o.width,height:o.height});break;case y.Input:if(-1===o.id)break;if(t){this.treeIndex.input(o);break}this.applyInput(o);break;case y.MediaInteraction:if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var c=v;try{o.type===b.Pause&&c.pause(),o.type===b.Play&&(c.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA?c.play():c.addEventListener("canplay",(function(){c.play()})))}catch(e){this.config.showWarning&&console.warn("Failed to replay media interactions: "+(e.message||e))}break;case y.StyleSheetRule:if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);var u=v,d=v.parentNode,f=this.fragmentParentMap.has(d),p=void 0;if(f){var h=this.fragmentParentMap.get(v.parentNode);p=document.createTextNode(""),d.replaceChild(p,v),h.appendChild(v)}var m=u.sheet;o.adds&&o.adds.forEach((function(e){var t=e.rule,n=e.index;try{var r=void 0===n?void 0:Math.min(n,m.rules.length);try{m.insertRule(t,r)}catch(e){}}catch(e){}})),o.removes&&o.removes.forEach((function(e){var t=e.index;try{m.deleteRule(t)}catch(e){}})),f&&p&&d.replaceChild(v,p);break;case y.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;var v;if(!(v=P.getNode(o.id)))return this.debugNodeNotFound(o,o.id);try{var x=v.getContext("2d");if(o.setter)return void(x[o.property]=o.args[0]);var w=x[o.property];if("drawImage"===o.property&&"string"==typeof o.args[0]){var E=this.imageMap.get(e);o.args[0]=E,w.apply(x,o.args)}else w.apply(x,o.args)}catch(e){this.warnCanvasMutationFailed(o,o.id,e)}break;case y.Font:try{var T=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);null===(r=this.iframe.contentDocument)||void 0===r||r.fonts.add(T)}catch(e){this.config.showWarning&&console.warn(e)}break;case y.Log:try{var M=e.data,N=this.config.logConfig.replayLogger;"function"==typeof N[M.level]&&N[M.level](M)}catch(e){this.config.showWarning&&console.warn(e)}}},e.prototype.applyMutation=function(e,t){var i,o,a=this;e.removes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);var r=P.getNode(t.parentId);if(!r)return a.warnNodeNotFound(e,t.parentId);if(P.removeNodeFromMap(n),r){var i=a.fragmentParentMap.get(r);if(i&&i.contains(n))i.removeChild(n);else if(a.fragmentParentMap.has(n)){var o=a.fragmentParentMap.get(n);r.removeChild(o),a.fragmentParentMap.delete(n)}else r.removeChild(n)}}));var s=n({},this.legacy_missingNodeRetryMap),l=[];var c=function(e){if(!a.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");var n=P.getNode(e.parentId);if(!n)return l.push(e);var r=null;if(a.iframe.contentDocument.contains?r=a.iframe.contentDocument.contains(n):a.iframe.contentDocument.body.contains&&(r=a.iframe.contentDocument.body.contains(n)),t&&r){var i=document.createDocumentFragment();for(P.map[e.parentId]=i,a.fragmentParentMap.set(i,n),a.storeState(n);n.firstChild;)i.appendChild(n.firstChild);n=i}var o=null,c=null;if(e.previousId&&(o=P.getNode(e.previousId)),e.nextId&&(c=P.getNode(e.nextId)),function(e){var t=null;return e.nextId&&(t=P.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t}(e))return l.push(e);var u=p(e.node,{doc:a.iframe.contentDocument,map:P.map,skipChild:!0,hackCss:!0});-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?n.insertBefore(u,o.nextSibling):c&&c.parentNode?n.contains(c)?n.insertBefore(u,c):n.insertBefore(u,null):n.appendChild(u),(e.previousId||e.nextId)&&a.legacy_resolveMissingNode(s,n,u,e)):s[e.node.id]={node:u,mutation:e}};e.adds.forEach((function(e){c(e)}));for(var u=Date.now();l.length;){var d=j(l);if(l.length=0,Date.now()-u>500){this.warn("Timeout in the loop, please check the resolve tree data:",d);break}try{for(var f=(i=void 0,r(d)),h=f.next();!h.done;h=f.next()){var m=h.value;P.getNode(m.value.parentId)?B(m,(function(e){c(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",m)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}Object.keys(s).length&&Object.assign(this.legacy_missingNodeRetryMap,s),e.texts.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),n.textContent=t.value})),e.attributes.forEach((function(t){var n=P.getNode(t.id);if(!n)return a.warnNodeNotFound(e,t.id);for(var r in a.fragmentParentMap.has(n)&&(n=a.fragmentParentMap.get(n)),t.attributes)if("string"==typeof r){var i=t.attributes[r];try{null!==i?n.setAttribute(r,i):n.removeAttribute(r)}catch(e){a.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",e)}}}))},e.prototype.applyScroll=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);if(t===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:e.y,left:e.x,behavior:"smooth"});else try{t.scrollTop=e.y,t.scrollLeft=e.x}catch(e){}},e.prototype.applyInput=function(e){var t=P.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}},e.prototype.formatMessage=function(e){if(0===e.trace.length)return"";var t="\n\tat ";return t+=e.trace.join("\n\tat ")},e.prototype.getConsoleLogger=function(){var e,t,n=this,i={},a=function(e){i[e]="trace"===e?function(e){(console.log.__rrweb_original__?console.log.__rrweb_original__:console.log).apply(void 0,o(e.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(e)]))}:function(t){(console[e].__rrweb_original__?console[e].__rrweb_original__:console[e]).apply(void 0,o(t.payload.map((function(e){return JSON.parse(e)})),[n.formatMessage(t)]))}};try{for(var s=r(this.config.logConfig.level),l=s.next();!l.done;l=s.next()){a(l.value)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return i},e.prototype.legacy_resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var l=a,c=l.node,u=l.mutation;t.insertBefore(c,n),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}if(s){var d=s;c=d.node,u=d.mutation;t.insertBefore(c,n.nextSibling),delete e[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(e,t,c,u)}},e.prototype.moveAndHover=function(e,t,n,r){this.mouse.style.left=t+"px",this.mouse.style.top=n+"px",this.drawMouseTail({x:t,y:n});var i=P.getNode(r);if(!i)return this.debugNodeNotFound(e,r);this.hoverElements(i)},e.prototype.drawMouseTail=function(e){var t=this;if(this.mouseTail){var n=!0===this.config.mouseTail?W:Object.assign({},W,this.config.mouseTail),r=n.lineCap,i=n.lineWidth,o=n.strokeStyle,a=n.duration,s=function(){if(t.mouseTail){var e=t.mouseTail.getContext("2d");e&&t.tailPositions.length&&(e.clearRect(0,0,t.mouseTail.width,t.mouseTail.height),e.beginPath(),e.lineWidth=i,e.lineCap=r,e.strokeStyle=o,e.moveTo(t.tailPositions[0].x,t.tailPositions[0].y),t.tailPositions.forEach((function(t){return e.lineTo(t.x,t.y)})),e.stroke())}};this.tailPositions.push(e),s(),setTimeout((function(){t.tailPositions=t.tailPositions.filter((function(t){return t!==e})),s()}),a/this.speedService.state.context.timer.speed)}},e.prototype.hoverElements=function(e){var t;null===(t=this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((function(e){e.classList.remove(":hover")}));for(var n=e;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement},e.prototype.isUserInteraction=function(e){return e.type===v.IncrementalSnapshot&&(e.data.source>y.Mutation&&e.data.source<=y.Input)},e.prototype.backToNormal=function(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(S.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))},e.prototype.storeState=function(e){var t,n;if(e&&e.nodeType===e.ELEMENT_NODE){var i=e;(i.scrollLeft||i.scrollTop)&&this.elementStateMap.set(e,{scroll:[i.scrollLeft,i.scrollTop]});var o=i.children;try{for(var a=r(Array.from(o)),s=a.next();!s.done;s=a.next()){var l=s.value;this.storeState(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},e.prototype.restoreState=function(e){var t,n;if(e.nodeType===e.ELEMENT_NODE){var i=e;if(this.elementStateMap.has(e)){var o=this.elementStateMap.get(e);o.scroll&&(i.scrollLeft=o.scroll[0],i.scrollTop=o.scroll[1]),this.elementStateMap.delete(e)}var a=i.children;try{for(var s=r(Array.from(a)),l=s.next();!l.done;l=s.next()){var c=l.value;this.restoreState(c)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}}},e.prototype.warnNodeNotFound=function(e,t){this.warn("Node with id '"+t+"' not found in",e)},e.prototype.warnCanvasMutationFailed=function(e,t,n){this.warn("Has error on update canvas '"+t+"'",e,n)},e.prototype.debugNodeNotFound=function(e,t){this.debug("[replayer]","Node with id '"+t+"' not found in",e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showWarning&&console.warn.apply(console,o(["[replayer]"],e))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.config.showDebug&&console.log.apply(console,o(["[replayer]"],e))},e}();return e.Replayer=Y,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=rrweb-replay.min.js.map

@@ -56,3 +56,3 @@ var NodeType;

var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
var DATA_URI = /^(data:)([^,]*),(.*)/i;

@@ -127,3 +127,3 @@ function absoluteToStylesheet(cssText, href) {

function transformAttribute(doc, name, value) {
if (name === 'src' || (name === 'href' && value)) {
if (name === 'src' || ((name === 'href' || name === 'xlink:href') && value)) {
return absoluteToDoc(doc, value);

@@ -130,0 +130,0 @@ }

@@ -120,3 +120,3 @@ import { __values } from '../../node_modules/tslib/tslib.es6.js';

var pushAdd = function (n) {
if (!n.parentNode) {
if (!n.parentNode || !document.contains(n)) {
return;

@@ -212,2 +212,5 @@ }

if (!node) {
while (addList.head) {
addList.removeNode(addList.head.value);
}
break;

@@ -214,0 +217,0 @@ }

@@ -1141,3 +1141,3 @@ import { __values, __assign, __spread, __read } from '../../node_modules/tslib/tslib.es6.js';

draw();
}, duration);
}, duration / this.speedService.state.context.timer.speed);
};

@@ -1144,0 +1144,0 @@ Replayer.prototype.hoverElements = function (el) {

{
"name": "rrweb",
"version": "0.9.13",
"version": "0.9.14",
"description": "record and replay the web",

@@ -65,4 +65,4 @@ "scripts": {

"mitt": "^1.1.3",
"rrweb-snapshot": "^1.0.1"
"rrweb-snapshot": "^1.0.3"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc