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.6.8 to 0.6.9

1

dist/rrweb.js

@@ -333,2 +333,3 @@ var rrweb = (function (exports) {

if (n.type === NodeType.Document) {
doc.close();
doc.open();

@@ -335,0 +336,0 @@ node = doc;

2

dist/rrweb.min.js

@@ -1,2 +0,2 @@

var rrweb=function(e){"use strict";var t,n=function(){return(n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!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"}(t||(t={}));var r=1;var i=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function a(e,t){return e.replace(i,function(e,n,r){if(!o.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(((i=t).indexOf("//")>-1?i.split("/").slice(0,3).join("/"):i.split("/")[0]).split("?")[0]+r)+"')";var i,a=t.split("/"),s=r.split("/");a.pop();for(var u=0,c=s;u<c.length;u++){var d=c[u];"."!==d&&(".."===d?a.pop():a.push(d))}return"url('"+a.join("/")+"')"})}function s(e,t){var n=e.createElement("a");return n.href=t,n.href}var u="rr-block";function c(e,n){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var r=e.classList.contains(u),i=e.tagName.toLowerCase(),o={},c=0,d=Array.from(e.attributes);c<d.length;c++){var l=d[c],p=l.name,h=l.value;o[p]="src"===p||"href"===p?s(n,h):h}if("link"===i){var m=Array.from(n.styleSheets).find(function(t){return t.href===e.href}),f=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(m);f&&(o={_cssText:a(f,m.href)})}if("input"===i||"textarea"===i||"select"===i){h=e.value;"radio"!==o.type&&"checkbox"!==o.type&&h?o.value=h:e.checked&&(o.checked=e.checked)}if("option"===i){var v=e.parentElement;o.value===v.value&&(o.selected=e.selected)}if(r){var y=e.getBoundingClientRect(),g=y.width,b=y.height;o.rr_width=g+"px",o.rr_height=b+"px"}return{type:t.Element,tagName:i,attributes:o,childNodes:[],isSVG:(C=e,"svg"===C.tagName||C instanceof SVGElement||void 0),needBlock:r};case e.TEXT_NODE:var w=e.parentNode&&e.parentNode.tagName,E=e.textContent,N="STYLE"===w||void 0;return N&&E&&(E=a(E,location.href)),"SCRIPT"===w&&(E="SCRIPT_PLACEHOLDER"),{type:t.Text,textContent:E||"",isStyle:N};case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:""};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||""};default:return!1}var C}function d(e,n,i,o){void 0===o&&(o=!1);var a=c(e,n);if(!a)return console.warn(e,"not serialized"),null;var s=Object.assign(a,{id:r++});e.__sn=s,i[s.id]=e;var u=!o;if(s.type===t.Element&&(u=u&&!s.needBlock,delete s.needBlock),(s.type===t.Document||s.type===t.Element)&&u)for(var l=0,p=Array.from(e.childNodes);l<p.length;l++){var h=d(p[l],n,i);h&&s.childNodes.push(h)}return s}function l(e){r=1;var t={};return[d(e,e,t),t]}var p={script:"noscript"};var h=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,m=/([^\\]):hover/g;function f(e){return e.replace(h,function(e,t,n){if(m.test(t)){var r=t.replace(m,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function v(e,n){switch(e.type){case t.Document:return n.implementation.createDocument(null,"",null);case t.DocumentType:return n.implementation.createDocumentType(e.name,e.publicId,e.systemId);case t.Element:var r=function(e){var t=p[e.tagName]?p[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e),i=void 0;for(var o in i=e.isSVG?n.createElementNS("http://www.w3.org/2000/svg",r):n.createElement(r),e.attributes)if(e.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var a=e.attributes[o];a="boolean"==typeof a?"":a;var s="textarea"===r&&"value"===o,u="style"===r&&"_cssText"===o;if(u&&(a=f(a)),s||u){var c=n.createTextNode(a);i.appendChild(c);continue}if("iframe"===r&&"src"===o)continue;try{i.setAttribute(o,a)}catch(e){}}else e.attributes.rr_width&&(i.style.width=e.attributes.rr_width),e.attributes.rr_height&&(i.style.height=e.attributes.rr_height);return i;case t.Text:return n.createTextNode(e.isStyle?f(e.textContent):e.textContent);case t.CDATA:return n.createCDATASection(e.textContent);case t.Comment:return n.createComment(e.textContent);default:return null}}function y(e,n,r,i){void 0===i&&(i=!1);var o=v(e,n);if(!o)return null;if(e.type===t.Document&&(n.open(),o=n),o.__sn=e,r[e.id]=o,(e.type===t.Document||e.type===t.Element)&&!i)for(var a=0,s=e.childNodes;a<s.length;a++){var u=s[a],c=y(u,n,r);c?o.appendChild(c):console.warn("Failed to rebuild",u)}return o}function g(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var b,w,E,N={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return N.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete N.map[t],e.childNodes&&e.childNodes.forEach(function(e){return N.removeNodeFromMap(e)})},has:function(e){return N.map.hasOwnProperty(e)}};function C(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(){var o=Date.now();i||!1!==n.leading||(i=o);var a=t-(o-i),s=this,u=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),i=o,e.apply(s,u)):r||!1===n.trailing||(r=window.setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(s,u)},a))}}function I(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function T(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function x(e){var t=[];return Object.keys(E).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),i=function(t){return function(n){var r=N.getId(n.target),i=n.clientX,o=n.clientY;e({type:E[t],id:r,x:i,y:o})}}(n);t.push(g(r,i))}),function(){t.forEach(function(e){return e()})}}!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"}(b||(b={})),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"}(w||(w={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(E||(E={}));var M=["INPUT","TEXTAREA","SELECT"],D=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],S="rr-ignore",k=new WeakMap;function A(e){function t(e){var t=e.target;if(t&&t.tagName&&!(M.indexOf(t.tagName)<0)){var n=t.type;if("password"!==n&&!t.classList.contains(S)){var i=t.value,o=!1;"radio"!==n&&"checkbox"!==n||(o=t.checked),r(t,{text:i,isChecked:o});var a=t.name;"radio"===n&&a&&o&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&r(e,{text:e.value,isChecked:!o})})}}}function r(t,r){var i=k.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){k.set(t,r);var o=N.getId(t);e(n({},r,{id:o}))}}var i=["input","change"].map(function(e){return g(e,t)}),o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return o&&o.set&&i.push.apply(i,D.map(function(e){return function e(t,n,r){var i=Object.getOwnPropertyDescriptor(t,n);return Object.defineProperty(t,n,{set:function(e){var t=this;setTimeout(function(){r.set.call(t,e)},0),i&&i.set&&i.set.call(this,e)}}),function(){return e(t,n,i||{})}}(e[0],e[1],{set:function(){t({target:this})}})})),function(){i.forEach(function(e){return e()})}}function O(e){var t,n,r=(t=e.mutationCb,(n=new MutationObserver(function(e){var n=[],r=[],i=[],o=[],a=[],s=new Set,u=function(e){s.add(e),e.childNodes.forEach(function(e){return u(e)})};e.forEach(function(e){var t=e.type,o=e.target,c=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(h=o.textContent)!==c&&n.push({value:h,node:o});break;case"attributes":var h;if((h=o.getAttribute(p))===c)return;var m=r.find(function(e){return e.node===o});m||(m={node:o,attributes:{}},r.push(m)),m.attributes[p]=h;case"childList":d.forEach(function(e){return u(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(o)&&!N.getId(e)||i.push({parentId:N.getId(o),id:N.getId(e)}),N.removeNodeFromMap(e)})}}),i=i.map(function(e){return e.parentNode&&(e.parentId=N.getId(e.parentNode),delete e.parentNode),e});var c=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||c(t))},l=function(e){var t=e.parentNode;if(!t)return!1;var n=N.getId(t);return!!i.some(function(e){return e.id===n})||l(t)};Array.from(s).forEach(function(e){c(e)||l(e)?a.push(e):o.push({parentId:N.getId(e.parentNode),previousId:e.previousSibling?N.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?N.getId(e.nextSibling):e.nextSibling,node:d(e,document,N.map,!0)})}),t({texts:n.map(function(e){return{id:N.getId(e.node),value:e.value}}).filter(function(e){return N.has(e.id)}),attributes:r.map(function(e){return{id:N.getId(e.node),attributes:e.attributes}}).filter(function(e){return N.has(e.id)}),removes:i,adds:o})})).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n),i=function(e){var t,n=[],r=C(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return g("mousemove",C(function(e){var i=e.clientX,o=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:i,y:o,id:N.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}(e.mousemoveCb),o=x(e.mouseInteractionCb),a=function(e){return g("scroll",C(function(t){if(t.target){var n=N.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}(e.scrollCb),s=function(e){return g("resize",C(function(){var t=I(),n=T();e({width:Number(n),height:Number(t)})},200),window)}(e.viewportResizeCb),u=A(e.inputCb);return function(){r.disconnect(),i(),o(),a(),s(),u()}}function L(e){return n({},e,{timestamp:Date.now()})}function _(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var R=Object.freeze({default:_}),F=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,i=this;this.raf=requestAnimationFrame(function o(a){for(e=a-t;n.length;){var s=n[0],u=s.delay/r.speed;if(!(e>=u))break;n.shift(),s.doAction()}n.length>0&&(i.raf=requestAnimationFrame(o))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),z=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],j=_||R,P={speed:1,root:document.body,loadTimeout:0},B=function(){function e(e,t){if(this.events=[],this.config=P,this.emitter=j(),this.baselineTime=0,this.missingNodeRetryMap={},e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new F(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach(function(n){t.config[n]=e[n]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n],o=i.timestamp<this.baselineTime,a=this.getCastFn(i,o);o?a():t.push({doAction:a,delay:this.getDelay(i)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n];if(!(i.timestamp<=this.lastPlayedEvent.timestamp||i===this.lastPlayedEvent)){var o=this.getCastFn(i);t.push({doAction:o,delay:this.getDelay(i)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===b.IncrementalSnapshot&&e.data.source===w.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case b.DomContentLoaded:case b.Load:break;case b.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case b.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case b.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e,e===r.events[r.events.length-1]&&r.emitter.emit("finish")}},e.prototype.rebuildFullSnapshot=function(e){var t,n,r;Object.keys(this.missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.missingNodeRetryMap),this.missingNodeRetryMap={},N.map=(t=e.data.node,n=this.iframe.contentDocument,r={},[y(t,n,r),r])[1];var i=document.createElement("style"),o=this.iframe.contentDocument,a=o.documentElement,s=o.head;a.insertBefore(i,s);for(var u=0;u<z.length;u++)i.sheet.insertRule(z[u],u);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var r=this,i=e.data;switch(i.source){case w.Mutation:i.removes.forEach(function(e){var t=N.getNode(e.id);if(t){var n=N.getNode(e.parentId);N.removeNodeFromMap(t),n&&n.removeChild(t)}});var o=n({},this.missingNodeRetryMap);i.adds.forEach(function(e){var t=y(e.node,r.iframe.contentDocument,N.map,!0),n=N.getNode(e.parentId),i=null,a=null;e.previousId&&(i=N.getNode(e.previousId)),e.nextId&&(a=N.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(i&&i.nextSibling&&i.nextSibling.parentNode?n.insertBefore(t,i.nextSibling):a&&a.parentNode?n.insertBefore(t,a):n.appendChild(t),(e.previousId||e.nextId)&&r.resolveMissingNode(o,n,t,e)):o[e.node.id]={node:t,mutation:e}}),Object.keys(o).length&&Object.assign(this.missingNodeRetryMap,o),i.texts.forEach(function(e){N.getNode(e.id).textContent=e.value}),i.attributes.forEach(function(e){var t=N.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case w.MouseMove:t||i.positions.forEach(function(t){var n={doAction:function(){r.mouse.style.left=t.x+"px",r.mouse.style.top=t.y+"px";var e=N.getNode(t.id);e&&r.hoverElements(e)},delay:t.timeOffset+e.timestamp-r.baselineTime};r.timer.addAction(n)});break;case w.MouseInteraction:if(-1===i.id)break;var a=new Event(E[i.type].toLowerCase()),s=N.getNode(i.id);switch(i.type){case E.Blur:s.blur();break;case E.Focus:s.focus({preventScroll:!0});break;case E.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:s.dispatchEvent(a)}break;case w.Scroll:if(-1===i.id)break;if((s=N.getNode(i.id))===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:i.y,left:i.x,behavior:t?"instant":"smooth"});else try{s.scrollTop=i.y,s.scrollLeft=i.x}catch(e){}break;case w.ViewportResize:this.emitter.emit("resize",{width:i.width,height:i.height});break;case w.Input:if(-1===i.id)break;(s=N.getNode(i.id)).checked=i.isChecked,s.value=i.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var u=a,c=u.node,d=u.mutation;t.insertBefore(c,n),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}if(s){var l=s;c=l.node,d=l.mutation;t.insertBefore(c,n.nextSibling),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();return e.record=function(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var r=[];r.push(g("DOMContentLoaded",function(){t(L({type:b.DomContentLoaded,data:{}}))}));var i=function(){t(L({type:b.Meta,data:{href:window.location.href,width:T(),height:I()}}));var e=l(document),i=e[0],o=e[1];if(!i)return console.warn("Failed to snapshot the document");N.map=o,t(L({type:b.FullSnapshot,data:{node:i,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),r.push(O({mutationCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Mutation},e)}))},mousemoveCb:function(e){return t(L({type:b.IncrementalSnapshot,data:{source:w.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.MouseInteraction},e)}))},scrollCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Scroll},e)}))},viewportResizeCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.ViewportResize},e)}))},inputCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?i():r.push(g("load",function(){t(L({type:b.Load,data:{}})),i()},window)),function(){r.forEach(function(e){return e()})}}catch(e){console.warn(e)}},e.Replayer=B,e.mirror=N,e}({});
var rrweb=function(e){"use strict";var t,n=function(){return(n=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!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"}(t||(t={}));var r=1;var i=/url\((['"]|)([^'"]*)\1\)/gm,o=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function a(e,t){return e.replace(i,function(e,n,r){if(!o.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(((i=t).indexOf("//")>-1?i.split("/").slice(0,3).join("/"):i.split("/")[0]).split("?")[0]+r)+"')";var i,a=t.split("/"),s=r.split("/");a.pop();for(var c=0,u=s;c<u.length;c++){var d=u[c];"."!==d&&(".."===d?a.pop():a.push(d))}return"url('"+a.join("/")+"')"})}function s(e,t){var n=e.createElement("a");return n.href=t,n.href}var c="rr-block";function u(e,n){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:t.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:t.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var r=e.classList.contains(c),i=e.tagName.toLowerCase(),o={},u=0,d=Array.from(e.attributes);u<d.length;u++){var l=d[u],p=l.name,h=l.value;o[p]="src"===p||"href"===p?s(n,h):h}if("link"===i){var m=Array.from(n.styleSheets).find(function(t){return t.href===e.href}),f=function(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}(m);f&&(o={_cssText:a(f,m.href)})}if("input"===i||"textarea"===i||"select"===i){h=e.value;"radio"!==o.type&&"checkbox"!==o.type&&h?o.value=h:e.checked&&(o.checked=e.checked)}if("option"===i){var v=e.parentElement;o.value===v.value&&(o.selected=e.selected)}if(r){var y=e.getBoundingClientRect(),g=y.width,b=y.height;o.rr_width=g+"px",o.rr_height=b+"px"}return{type:t.Element,tagName:i,attributes:o,childNodes:[],isSVG:(C=e,"svg"===C.tagName||C instanceof SVGElement||void 0),needBlock:r};case e.TEXT_NODE:var w=e.parentNode&&e.parentNode.tagName,E=e.textContent,N="STYLE"===w||void 0;return N&&E&&(E=a(E,location.href)),"SCRIPT"===w&&(E="SCRIPT_PLACEHOLDER"),{type:t.Text,textContent:E||"",isStyle:N};case e.CDATA_SECTION_NODE:return{type:t.CDATA,textContent:""};case e.COMMENT_NODE:return{type:t.Comment,textContent:e.textContent||""};default:return!1}var C}function d(e,n,i,o){void 0===o&&(o=!1);var a=u(e,n);if(!a)return console.warn(e,"not serialized"),null;var s=Object.assign(a,{id:r++});e.__sn=s,i[s.id]=e;var c=!o;if(s.type===t.Element&&(c=c&&!s.needBlock,delete s.needBlock),(s.type===t.Document||s.type===t.Element)&&c)for(var l=0,p=Array.from(e.childNodes);l<p.length;l++){var h=d(p[l],n,i);h&&s.childNodes.push(h)}return s}function l(e){r=1;var t={};return[d(e,e,t),t]}var p={script:"noscript"};var h=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,m=/([^\\]):hover/g;function f(e){return e.replace(h,function(e,t,n){if(m.test(t)){var r=t.replace(m,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function v(e,n){switch(e.type){case t.Document:return n.implementation.createDocument(null,"",null);case t.DocumentType:return n.implementation.createDocumentType(e.name,e.publicId,e.systemId);case t.Element:var r=function(e){var t=p[e.tagName]?p[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e),i=void 0;for(var o in i=e.isSVG?n.createElementNS("http://www.w3.org/2000/svg",r):n.createElement(r),e.attributes)if(e.attributes.hasOwnProperty(o)&&!o.startsWith("rr_")){var a=e.attributes[o];a="boolean"==typeof a?"":a;var s="textarea"===r&&"value"===o,c="style"===r&&"_cssText"===o;if(c&&(a=f(a)),s||c){var u=n.createTextNode(a);i.appendChild(u);continue}if("iframe"===r&&"src"===o)continue;try{i.setAttribute(o,a)}catch(e){}}else e.attributes.rr_width&&(i.style.width=e.attributes.rr_width),e.attributes.rr_height&&(i.style.height=e.attributes.rr_height);return i;case t.Text:return n.createTextNode(e.isStyle?f(e.textContent):e.textContent);case t.CDATA:return n.createCDATASection(e.textContent);case t.Comment:return n.createComment(e.textContent);default:return null}}function y(e,n,r,i){void 0===i&&(i=!1);var o=v(e,n);if(!o)return null;if(e.type===t.Document&&(n.close(),n.open(),o=n),o.__sn=e,r[e.id]=o,(e.type===t.Document||e.type===t.Element)&&!i)for(var a=0,s=e.childNodes;a<s.length;a++){var c=s[a],u=y(c,n,r);u?o.appendChild(u):console.warn("Failed to rebuild",c)}return o}function g(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var b,w,E,N={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return N.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete N.map[t],e.childNodes&&e.childNodes.forEach(function(e){return N.removeNodeFromMap(e)})},has:function(e){return N.map.hasOwnProperty(e)}};function C(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(){var o=Date.now();i||!1!==n.leading||(i=o);var a=t-(o-i),s=this,c=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),i=o,e.apply(s,c)):r||!1===n.trailing||(r=window.setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(s,c)},a))}}function I(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function T(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function x(e){var t=[];return Object.keys(E).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),i=function(t){return function(n){var r=N.getId(n.target),i=n.clientX,o=n.clientY;e({type:E[t],id:r,x:i,y:o})}}(n);t.push(g(r,i))}),function(){t.forEach(function(e){return e()})}}!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"}(b||(b={})),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"}(w||(w={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(E||(E={}));var M=["INPUT","TEXTAREA","SELECT"],D=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],S="rr-ignore",k=new WeakMap;function A(e){function t(e){var t=e.target;if(t&&t.tagName&&!(M.indexOf(t.tagName)<0)){var n=t.type;if("password"!==n&&!t.classList.contains(S)){var i=t.value,o=!1;"radio"!==n&&"checkbox"!==n||(o=t.checked),r(t,{text:i,isChecked:o});var a=t.name;"radio"===n&&a&&o&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&r(e,{text:e.value,isChecked:!o})})}}}function r(t,r){var i=k.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){k.set(t,r);var o=N.getId(t);e(n({},r,{id:o}))}}var i=["input","change"].map(function(e){return g(e,t)}),o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return o&&o.set&&i.push.apply(i,D.map(function(e){return function e(t,n,r){var i=Object.getOwnPropertyDescriptor(t,n);return Object.defineProperty(t,n,{set:function(e){var t=this;setTimeout(function(){r.set.call(t,e)},0),i&&i.set&&i.set.call(this,e)}}),function(){return e(t,n,i||{})}}(e[0],e[1],{set:function(){t({target:this})}})})),function(){i.forEach(function(e){return e()})}}function O(e){var t,n,r=(t=e.mutationCb,(n=new MutationObserver(function(e){var n=[],r=[],i=[],o=[],a=[],s=new Set,c=function(e){s.add(e),e.childNodes.forEach(function(e){return c(e)})};e.forEach(function(e){var t=e.type,o=e.target,u=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(h=o.textContent)!==u&&n.push({value:h,node:o});break;case"attributes":var h;if((h=o.getAttribute(p))===u)return;var m=r.find(function(e){return e.node===o});m||(m={node:o,attributes:{}},r.push(m)),m.attributes[p]=h;case"childList":d.forEach(function(e){return c(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(o)&&!N.getId(e)||i.push({parentId:N.getId(o),id:N.getId(e)}),N.removeNodeFromMap(e)})}}),i=i.map(function(e){return e.parentNode&&(e.parentId=N.getId(e.parentNode),delete e.parentNode),e});var u=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||u(t))},l=function(e){var t=e.parentNode;if(!t)return!1;var n=N.getId(t);return!!i.some(function(e){return e.id===n})||l(t)};Array.from(s).forEach(function(e){u(e)||l(e)?a.push(e):o.push({parentId:N.getId(e.parentNode),previousId:e.previousSibling?N.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?N.getId(e.nextSibling):e.nextSibling,node:d(e,document,N.map,!0)})}),t({texts:n.map(function(e){return{id:N.getId(e.node),value:e.value}}).filter(function(e){return N.has(e.id)}),attributes:r.map(function(e){return{id:N.getId(e.node),attributes:e.attributes}}).filter(function(e){return N.has(e.id)}),removes:i,adds:o})})).observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n),i=function(e){var t,n=[],r=C(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return g("mousemove",C(function(e){var i=e.clientX,o=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:i,y:o,id:N.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}(e.mousemoveCb),o=x(e.mouseInteractionCb),a=function(e){return g("scroll",C(function(t){if(t.target){var n=N.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}(e.scrollCb),s=function(e){return g("resize",C(function(){var t=I(),n=T();e({width:Number(n),height:Number(t)})},200),window)}(e.viewportResizeCb),c=A(e.inputCb);return function(){r.disconnect(),i(),o(),a(),s(),c()}}function L(e){return n({},e,{timestamp:Date.now()})}function _(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var R=Object.freeze({default:_}),F=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,i=this;this.raf=requestAnimationFrame(function o(a){for(e=a-t;n.length;){var s=n[0],c=s.delay/r.speed;if(!(e>=c))break;n.shift(),s.doAction()}n.length>0&&(i.raf=requestAnimationFrame(o))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),z=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],j=_||R,P={speed:1,root:document.body,loadTimeout:0},B=function(){function e(e,t){if(this.events=[],this.config=P,this.emitter=j(),this.baselineTime=0,this.missingNodeRetryMap={},e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new F(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach(function(n){t.config[n]=e[n]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n],o=i.timestamp<this.baselineTime,a=this.getCastFn(i,o);o?a():t.push({doAction:a,delay:this.getDelay(i)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n];if(!(i.timestamp<=this.lastPlayedEvent.timestamp||i===this.lastPlayedEvent)){var o=this.getCastFn(i);t.push({doAction:o,delay:this.getDelay(i)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===b.IncrementalSnapshot&&e.data.source===w.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case b.DomContentLoaded:case b.Load:break;case b.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case b.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case b.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e,e===r.events[r.events.length-1]&&r.emitter.emit("finish")}},e.prototype.rebuildFullSnapshot=function(e){var t,n,r;Object.keys(this.missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.missingNodeRetryMap),this.missingNodeRetryMap={},N.map=(t=e.data.node,n=this.iframe.contentDocument,r={},[y(t,n,r),r])[1];var i=document.createElement("style"),o=this.iframe.contentDocument,a=o.documentElement,s=o.head;a.insertBefore(i,s);for(var c=0;c<z.length;c++)i.sheet.insertRule(z[c],c);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var r=this,i=e.data;switch(i.source){case w.Mutation:i.removes.forEach(function(e){var t=N.getNode(e.id);if(t){var n=N.getNode(e.parentId);N.removeNodeFromMap(t),n&&n.removeChild(t)}});var o=n({},this.missingNodeRetryMap);i.adds.forEach(function(e){var t=y(e.node,r.iframe.contentDocument,N.map,!0),n=N.getNode(e.parentId),i=null,a=null;e.previousId&&(i=N.getNode(e.previousId)),e.nextId&&(a=N.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(i&&i.nextSibling&&i.nextSibling.parentNode?n.insertBefore(t,i.nextSibling):a&&a.parentNode?n.insertBefore(t,a):n.appendChild(t),(e.previousId||e.nextId)&&r.resolveMissingNode(o,n,t,e)):o[e.node.id]={node:t,mutation:e}}),Object.keys(o).length&&Object.assign(this.missingNodeRetryMap,o),i.texts.forEach(function(e){N.getNode(e.id).textContent=e.value}),i.attributes.forEach(function(e){var t=N.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case w.MouseMove:t||i.positions.forEach(function(t){var n={doAction:function(){r.mouse.style.left=t.x+"px",r.mouse.style.top=t.y+"px";var e=N.getNode(t.id);e&&r.hoverElements(e)},delay:t.timeOffset+e.timestamp-r.baselineTime};r.timer.addAction(n)});break;case w.MouseInteraction:if(-1===i.id)break;var a=new Event(E[i.type].toLowerCase()),s=N.getNode(i.id);switch(i.type){case E.Blur:s.blur();break;case E.Focus:s.focus({preventScroll:!0});break;case E.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:s.dispatchEvent(a)}break;case w.Scroll:if(-1===i.id)break;if((s=N.getNode(i.id))===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:i.y,left:i.x,behavior:t?"instant":"smooth"});else try{s.scrollTop=i.y,s.scrollLeft=i.x}catch(e){}break;case w.ViewportResize:this.emitter.emit("resize",{width:i.width,height:i.height});break;case w.Input:if(-1===i.id)break;(s=N.getNode(i.id)).checked=i.isChecked,s.value=i.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var c=a,u=c.node,d=c.mutation;t.insertBefore(u,n),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,u,d)}if(s){var l=s;u=l.node,d=l.mutation;t.insertBefore(u,n.nextSibling),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,u,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();return e.record=function(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var r=[];r.push(g("DOMContentLoaded",function(){t(L({type:b.DomContentLoaded,data:{}}))}));var i=function(){t(L({type:b.Meta,data:{href:window.location.href,width:T(),height:I()}}));var e=l(document),i=e[0],o=e[1];if(!i)return console.warn("Failed to snapshot the document");N.map=o,t(L({type:b.FullSnapshot,data:{node:i,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),r.push(O({mutationCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Mutation},e)}))},mousemoveCb:function(e){return t(L({type:b.IncrementalSnapshot,data:{source:w.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.MouseInteraction},e)}))},scrollCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Scroll},e)}))},viewportResizeCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.ViewportResize},e)}))},inputCb:function(e){return t(L({type:b.IncrementalSnapshot,data:n({source:w.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?i():r.push(g("load",function(){t(L({type:b.Load,data:{}})),i()},window)),function(){r.forEach(function(e){return e()})}}catch(e){console.warn(e)}},e.Replayer=B,e.mirror=N,e}({});
//# sourceMappingURL=rrweb.min.js.map

@@ -330,2 +330,3 @@ /*! *****************************************************************************

if (n.type === NodeType.Document) {
doc.close();
doc.open();

@@ -332,0 +333,0 @@ node = doc;

@@ -1,2 +0,2 @@

var NodeType,__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!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"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,n,r){if(!RELATIVE_PATH.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(extractOrigin(t)+r)+"')";var i=t.split("/"),o=r.split("/");i.pop();for(var a=0,s=o;a<s.length;a++){var u=s[a];"."!==u&&(".."===u?i.pop():i.push(u))}return"url('"+i.join("/")+"')"})}function absoluteToDoc(e,t){var n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var n=e.classList.contains(BLOCK_CLASS),r=e.tagName.toLowerCase(),i={},o=0,a=Array.from(e.attributes);o<a.length;o++){var s=a[o],u=s.name,c=s.value;i[u]="src"===u||"href"===u?absoluteToDoc(t,c):c}if("link"===r){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),l=getCssRulesString(d);l&&(i={_cssText:absoluteToStylesheet(l,d.href)})}if("input"===r||"textarea"===r||"select"===r){c=e.value;"radio"!==i.type&&"checkbox"!==i.type&&c?i.value=c:e.checked&&(i.checked=e.checked)}if("option"===r){var p=e.parentElement;i.value===p.value&&(i.selected=e.selected)}if(n){var m=e.getBoundingClientRect(),h=m.width,f=m.height;i.rr_width=h+"px",i.rr_height=f+"px"}return{type:NodeType.Element,tagName:r,attributes:i,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:n};case e.TEXT_NODE:var v=e.parentNode&&e.parentNode.tagName,y=e.textContent,g="STYLE"===v||void 0;return g&&y&&(y=absoluteToStylesheet(y,location.href)),"SCRIPT"===v&&(y="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:y||"",isStyle:g};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,n,r){void 0===r&&(r=!1);var i=serializeNode(e,t);if(!i)return console.warn(e,"not serialized"),null;var o=Object.assign(i,{id:genId()});e.__sn=o,n[o.id]=e;var a=!r;if(o.type===NodeType.Element&&(a=a&&!o.needBlock,delete o.needBlock),(o.type===NodeType.Document||o.type===NodeType.Element)&&a)for(var s=0,u=Array.from(e.childNodes);s<u.length;s++){var c=serializeNodeWithId(u[s],t,n);c&&o.childNodes.push(c)}return o}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}var tagMap={script:"noscript"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var CSS_SELECTOR=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){return e.replace(CSS_SELECTOR,function(e,t,n){if(HOVER_SELECTOR.test(t)){var r=t.replace(HOVER_SELECTOR,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function buildNode(e,t){switch(e.type){case NodeType.Document:return t.implementation.createDocument(null,"",null);case NodeType.DocumentType:return t.implementation.createDocumentType(e.name,e.publicId,e.systemId);case NodeType.Element:var n=getTagName(e),r=void 0;for(var i in r=e.isSVG?t.createElementNS("http://www.w3.org/2000/svg",n):t.createElement(n),e.attributes)if(e.attributes.hasOwnProperty(i)&&!i.startsWith("rr_")){var o=e.attributes[i];o="boolean"==typeof o?"":o;var a="textarea"===n&&"value"===i,s="style"===n&&"_cssText"===i;if(s&&(o=addHoverClass(o)),a||s){var u=t.createTextNode(o);r.appendChild(u);continue}if("iframe"===n&&"src"===i)continue;try{r.setAttribute(i,o)}catch(e){}}else e.attributes.rr_width&&(r.style.width=e.attributes.rr_width),e.attributes.rr_height&&(r.style.height=e.attributes.rr_height);return r;case NodeType.Text:return t.createTextNode(e.isStyle?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return t.createCDATASection(e.textContent);case NodeType.Comment:return t.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t,n,r){void 0===r&&(r=!1);var i=buildNode(e,t);if(!i)return null;if(e.type===NodeType.Document&&(t.open(),i=t),i.__sn=e,n[e.id]=i,(e.type===NodeType.Document||e.type===NodeType.Element)&&!r)for(var o=0,a=e.childNodes;o<a.length;o++){var s=a[o],u=buildNodeWithSN(s,t,n);u?i.appendChild(u):console.warn("Failed to rebuild",s)}return i}function rebuild(e,t){var n={};return[buildNodeWithSN(e,t,n),n]}function on(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var EventType,IncrementalSource,MouseInteractions,mirror={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return mirror.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete mirror.map[t],e.childNodes&&e.childNodes.forEach(function(e){return mirror.removeNodeFromMap(e)})},has:function(e){return mirror.map.hasOwnProperty(e)}};function throttle(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(){var o=Date.now();i||!1!==n.leading||(i=o);var a=t-(o-i),s=this,u=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),i=o,e.apply(s,u)):r||!1===n.trailing||(r=window.setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(s,u)},a))}}function hookSetter(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,{set:function(e){var t=this;setTimeout(function(){n.set.call(t,e)},0),r&&r.set&&r.set.call(this,e)}}),function(){return hookSetter(e,t,r||{})}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function initMutationObserver(e){var t=new MutationObserver(function(t){var n=[],r=[],i=[],o=[],a=[],s=new Set,u=function(e){s.add(e),e.childNodes.forEach(function(e){return u(e)})};t.forEach(function(e){var t=e.type,o=e.target,c=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(m=o.textContent)!==c&&n.push({value:m,node:o});break;case"attributes":var m;if((m=o.getAttribute(p))===c)return;var h=r.find(function(e){return e.node===o});h||(h={node:o,attributes:{}},r.push(h)),h.attributes[p]=m;case"childList":d.forEach(function(e){return u(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(o)&&!mirror.getId(e)||i.push({parentId:mirror.getId(o),id:mirror.getId(e)}),mirror.removeNodeFromMap(e)})}}),i=i.map(function(e){return e.parentNode&&(e.parentId=mirror.getId(e.parentNode),delete e.parentNode),e});var c=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||c(t))},d=function(e){var t=e.parentNode;if(!t)return!1;var n=mirror.getId(t);return!!i.some(function(e){return e.id===n})||d(t)};Array.from(s).forEach(function(e){c(e)||d(e)?a.push(e):o.push({parentId:mirror.getId(e.parentNode),previousId:e.previousSibling?mirror.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?mirror.getId(e.nextSibling):e.nextSibling,node:serializeNodeWithId(e,document,mirror.map,!0)})}),e({texts:n.map(function(e){return{id:mirror.getId(e.node),value:e.value}}).filter(function(e){return mirror.has(e.id)}),attributes:r.map(function(e){return{id:mirror.getId(e.node),attributes:e.attributes}}).filter(function(e){return mirror.has(e.id)}),removes:i,adds:o})});return t.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),t}function initMousemoveObserver(e){var t,n=[],r=throttle(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return on("mousemove",throttle(function(e){var i=e.clientX,o=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:i,y:o,id:mirror.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}function initMouseInteractionObserver(e){var t=[];return Object.keys(MouseInteractions).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),i=function(t){return function(n){var r=mirror.getId(n.target),i=n.clientX,o=n.clientY;e({type:MouseInteractions[t],id:r,x:i,y:o})}}(n);t.push(on(r,i))}),function(){t.forEach(function(e){return e()})}}function initScrollObserver(e){return on("scroll",throttle(function(t){if(t.target){var n=mirror.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}function initViewportResizeObserver(e){return on("resize",throttle(function(){var t=getWindowHeight(),n=getWindowWidth();e({width:Number(n),height:Number(t)})},200),window)}!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"}(EventType||(EventType={})),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"}(IncrementalSource||(IncrementalSource={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(MouseInteractions||(MouseInteractions={}));var INPUT_TAGS=["INPUT","TEXTAREA","SELECT"],HOOK_PROPERTIES=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],IGNORE_CLASS="rr-ignore",lastInputValueMap=new WeakMap;function initInputObserver(e){function t(e){var t=e.target;if(t&&t.tagName&&!(INPUT_TAGS.indexOf(t.tagName)<0)){var r=t.type;if("password"!==r&&!t.classList.contains(IGNORE_CLASS)){var i=t.value,o=!1;"radio"!==r&&"checkbox"!==r||(o=t.checked),n(t,{text:i,isChecked:o});var a=t.name;"radio"===r&&a&&o&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&n(e,{text:e.value,isChecked:!o})})}}}function n(t,n){var r=lastInputValueMap.get(t);if(!r||r.text!==n.text||r.isChecked!==n.isChecked){lastInputValueMap.set(t,n);var i=mirror.getId(t);e(__assign({},n,{id:i}))}}var r=["input","change"].map(function(e){return on(e,t)}),i=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return i&&i.set&&r.push.apply(r,HOOK_PROPERTIES.map(function(e){return hookSetter(e[0],e[1],{set:function(){t({target:this})}})})),function(){r.forEach(function(e){return e()})}}function initObservers(e){var t=initMutationObserver(e.mutationCb),n=initMousemoveObserver(e.mousemoveCb),r=initMouseInteractionObserver(e.mouseInteractionCb),i=initScrollObserver(e.scrollCb),o=initViewportResizeObserver(e.viewportResizeCb),a=initInputObserver(e.inputCb);return function(){t.disconnect(),n(),r(),i(),o(),a()}}function wrapEvent(e){return __assign({},e,{timestamp:Date.now()})}function record(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var n=[];n.push(on("DOMContentLoaded",function(){t(wrapEvent({type:EventType.DomContentLoaded,data:{}}))}));var r=function(){t(wrapEvent({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}));var e=snapshot(document),r=e[0],i=e[1];if(!r)return console.warn("Failed to snapshot the document");mirror.map=i,t(wrapEvent({type:EventType.FullSnapshot,data:{node:r,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),n.push(initObservers({mutationCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Mutation},e)}))},mousemoveCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MouseInteraction},e)}))},scrollCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Scroll},e)}))},viewportResizeCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.ViewportResize},e)}))},inputCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?r():n.push(on("load",function(){t(wrapEvent({type:EventType.Load,data:{}})),r()},window)),function(){n.forEach(function(e){return e()})}}catch(e){console.warn(e)}}function mitt(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var mittProxy=Object.freeze({default:mitt}),Timer=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,i=this;this.raf=requestAnimationFrame(function o(a){for(e=a-t;n.length;){var s=n[0],u=s.delay/r.speed;if(!(e>=u))break;n.shift(),s.doAction()}n.length>0&&(i.raf=requestAnimationFrame(o))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),rules=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],mitt$1=mitt||mittProxy,defaultConfig={speed:1,root:document.body,loadTimeout:0},Replayer=function(){function e(e,t){if(this.events=[],this.config=defaultConfig,this.emitter=mitt$1(),this.baselineTime=0,this.missingNodeRetryMap={},e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new Timer(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach(function(n){t.config[n]=e[n]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n],o=i.timestamp<this.baselineTime,a=this.getCastFn(i,o);o?a():t.push({doAction:a,delay:this.getDelay(i)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n];if(!(i.timestamp<=this.lastPlayedEvent.timestamp||i===this.lastPlayedEvent)){var o=this.getCastFn(i);t.push({doAction:o,delay:this.getDelay(i)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===EventType.IncrementalSnapshot&&e.data.source===IncrementalSource.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case EventType.DomContentLoaded:case EventType.Load:break;case EventType.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case EventType.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case EventType.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e,e===r.events[r.events.length-1]&&r.emitter.emit("finish")}},e.prototype.rebuildFullSnapshot=function(e){Object.keys(this.missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.missingNodeRetryMap),this.missingNodeRetryMap={},mirror.map=rebuild(e.data.node,this.iframe.contentDocument)[1];var t=document.createElement("style"),n=this.iframe.contentDocument,r=n.documentElement,i=n.head;r.insertBefore(t,i);for(var o=0;o<rules.length;o++)t.sheet.insertRule(rules[o],o);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var n=this,r=e.data;switch(r.source){case IncrementalSource.Mutation:r.removes.forEach(function(e){var t=mirror.getNode(e.id);if(t){var n=mirror.getNode(e.parentId);mirror.removeNodeFromMap(t),n&&n.removeChild(t)}});var i=__assign({},this.missingNodeRetryMap);r.adds.forEach(function(e){var t=buildNodeWithSN(e.node,n.iframe.contentDocument,mirror.map,!0),r=mirror.getNode(e.parentId),o=null,a=null;e.previousId&&(o=mirror.getNode(e.previousId)),e.nextId&&(a=mirror.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?r.insertBefore(t,o.nextSibling):a&&a.parentNode?r.insertBefore(t,a):r.appendChild(t),(e.previousId||e.nextId)&&n.resolveMissingNode(i,r,t,e)):i[e.node.id]={node:t,mutation:e}}),Object.keys(i).length&&Object.assign(this.missingNodeRetryMap,i),r.texts.forEach(function(e){mirror.getNode(e.id).textContent=e.value}),r.attributes.forEach(function(e){var t=mirror.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case IncrementalSource.MouseMove:t||r.positions.forEach(function(t){var r={doAction:function(){n.mouse.style.left=t.x+"px",n.mouse.style.top=t.y+"px";var e=mirror.getNode(t.id);e&&n.hoverElements(e)},delay:t.timeOffset+e.timestamp-n.baselineTime};n.timer.addAction(r)});break;case IncrementalSource.MouseInteraction:if(-1===r.id)break;var o=new Event(MouseInteractions[r.type].toLowerCase()),a=mirror.getNode(r.id);switch(r.type){case MouseInteractions.Blur:a.blur();break;case MouseInteractions.Focus:a.focus({preventScroll:!0});break;case MouseInteractions.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:a.dispatchEvent(o)}break;case IncrementalSource.Scroll:if(-1===r.id)break;if((a=mirror.getNode(r.id))===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:r.y,left:r.x,behavior:t?"instant":"smooth"});else try{a.scrollTop=r.y,a.scrollLeft=r.x}catch(e){}break;case IncrementalSource.ViewportResize:this.emitter.emit("resize",{width:r.width,height:r.height});break;case IncrementalSource.Input:if(-1===r.id)break;(a=mirror.getNode(r.id)).checked=r.isChecked,a.value=r.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var u=a,c=u.node,d=u.mutation;t.insertBefore(c,n),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}if(s){var l=s;c=l.node,d=l.mutation;t.insertBefore(c,n.nextSibling),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();export{record,Replayer,mirror};
var NodeType,__assign=function(){return(__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};!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"}(NodeType||(NodeType={}));var _id=1;function genId(){return _id++}function resetId(){_id=1}function getCssRulesString(e){try{var t=e.rules||e.cssRules;return t?Array.from(t).reduce(function(e,t){return e+t.cssText},""):null}catch(e){return null}}function extractOrigin(e){return(e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0]).split("?")[0]}var URL_IN_CSS_REF=/url\((['"]|)([^'"]*)\1\)/gm,RELATIVE_PATH=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/).*/;function absoluteToStylesheet(e,t){return e.replace(URL_IN_CSS_REF,function(e,n,r){if(!RELATIVE_PATH.test(r))return"url('"+r+"')";if("/"===r[0])return"url('"+(extractOrigin(t)+r)+"')";var i=t.split("/"),o=r.split("/");i.pop();for(var a=0,s=o;a<s.length;a++){var u=s[a];"."!==u&&(".."===u?i.pop():i.push(u))}return"url('"+i.join("/")+"')"})}function absoluteToDoc(e,t){var n=e.createElement("a");return n.href=t,n.href}function isSVGElement(e){return"svg"===e.tagName||e instanceof SVGElement}var BLOCK_CLASS="rr-block";function serializeNode(e,t){switch(e.nodeType){case e.DOCUMENT_NODE:return{type:NodeType.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:NodeType.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId};case e.ELEMENT_NODE:for(var n=e.classList.contains(BLOCK_CLASS),r=e.tagName.toLowerCase(),i={},o=0,a=Array.from(e.attributes);o<a.length;o++){var s=a[o],u=s.name,c=s.value;i[u]="src"===u||"href"===u?absoluteToDoc(t,c):c}if("link"===r){var d=Array.from(t.styleSheets).find(function(t){return t.href===e.href}),l=getCssRulesString(d);l&&(i={_cssText:absoluteToStylesheet(l,d.href)})}if("input"===r||"textarea"===r||"select"===r){c=e.value;"radio"!==i.type&&"checkbox"!==i.type&&c?i.value=c:e.checked&&(i.checked=e.checked)}if("option"===r){var p=e.parentElement;i.value===p.value&&(i.selected=e.selected)}if(n){var m=e.getBoundingClientRect(),h=m.width,f=m.height;i.rr_width=h+"px",i.rr_height=f+"px"}return{type:NodeType.Element,tagName:r,attributes:i,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:n};case e.TEXT_NODE:var v=e.parentNode&&e.parentNode.tagName,y=e.textContent,g="STYLE"===v||void 0;return g&&y&&(y=absoluteToStylesheet(y,location.href)),"SCRIPT"===v&&(y="SCRIPT_PLACEHOLDER"),{type:NodeType.Text,textContent:y||"",isStyle:g};case e.CDATA_SECTION_NODE:return{type:NodeType.CDATA,textContent:""};case e.COMMENT_NODE:return{type:NodeType.Comment,textContent:e.textContent||""};default:return!1}}function serializeNodeWithId(e,t,n,r){void 0===r&&(r=!1);var i=serializeNode(e,t);if(!i)return console.warn(e,"not serialized"),null;var o=Object.assign(i,{id:genId()});e.__sn=o,n[o.id]=e;var a=!r;if(o.type===NodeType.Element&&(a=a&&!o.needBlock,delete o.needBlock),(o.type===NodeType.Document||o.type===NodeType.Element)&&a)for(var s=0,u=Array.from(e.childNodes);s<u.length;s++){var c=serializeNodeWithId(u[s],t,n);c&&o.childNodes.push(c)}return o}function snapshot(e){resetId();var t={};return[serializeNodeWithId(e,e,t),t]}var tagMap={script:"noscript"};function getTagName(e){var t=tagMap[e.tagName]?tagMap[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}var CSS_SELECTOR=/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g,HOVER_SELECTOR=/([^\\]):hover/g;function addHoverClass(e){return e.replace(CSS_SELECTOR,function(e,t,n){if(HOVER_SELECTOR.test(t)){var r=t.replace(HOVER_SELECTOR,"$1.\\:hover");return t.replace(/\s*$/,"")+", "+r.replace(/^\s*/,"")+n}return e})}function buildNode(e,t){switch(e.type){case NodeType.Document:return t.implementation.createDocument(null,"",null);case NodeType.DocumentType:return t.implementation.createDocumentType(e.name,e.publicId,e.systemId);case NodeType.Element:var n=getTagName(e),r=void 0;for(var i in r=e.isSVG?t.createElementNS("http://www.w3.org/2000/svg",n):t.createElement(n),e.attributes)if(e.attributes.hasOwnProperty(i)&&!i.startsWith("rr_")){var o=e.attributes[i];o="boolean"==typeof o?"":o;var a="textarea"===n&&"value"===i,s="style"===n&&"_cssText"===i;if(s&&(o=addHoverClass(o)),a||s){var u=t.createTextNode(o);r.appendChild(u);continue}if("iframe"===n&&"src"===i)continue;try{r.setAttribute(i,o)}catch(e){}}else e.attributes.rr_width&&(r.style.width=e.attributes.rr_width),e.attributes.rr_height&&(r.style.height=e.attributes.rr_height);return r;case NodeType.Text:return t.createTextNode(e.isStyle?addHoverClass(e.textContent):e.textContent);case NodeType.CDATA:return t.createCDATASection(e.textContent);case NodeType.Comment:return t.createComment(e.textContent);default:return null}}function buildNodeWithSN(e,t,n,r){void 0===r&&(r=!1);var i=buildNode(e,t);if(!i)return null;if(e.type===NodeType.Document&&(t.close(),t.open(),i=t),i.__sn=e,n[e.id]=i,(e.type===NodeType.Document||e.type===NodeType.Element)&&!r)for(var o=0,a=e.childNodes;o<a.length;o++){var s=a[o],u=buildNodeWithSN(s,t,n);u?i.appendChild(u):console.warn("Failed to rebuild",s)}return i}function rebuild(e,t){var n={};return[buildNodeWithSN(e,t,n),n]}function on(e,t,n){void 0===n&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(e,t,r),function(){return n.removeEventListener(e,t,r)}}var EventType,IncrementalSource,MouseInteractions,mirror={map:{},getId:function(e){return e.__sn?e.__sn.id:-1},getNode:function(e){return mirror.map[e]||null},removeNodeFromMap:function(e){var t=e.__sn&&e.__sn.id;delete mirror.map[t],e.childNodes&&e.childNodes.forEach(function(e){return mirror.removeNodeFromMap(e)})},has:function(e){return mirror.map.hasOwnProperty(e)}};function throttle(e,t,n){void 0===n&&(n={});var r=null,i=0;return function(){var o=Date.now();i||!1!==n.leading||(i=o);var a=t-(o-i),s=this,u=arguments;a<=0||a>t?(r&&(window.clearTimeout(r),r=null),i=o,e.apply(s,u)):r||!1===n.trailing||(r=window.setTimeout(function(){i=!1===n.leading?0:Date.now(),r=null,e.apply(s,u)},a))}}function hookSetter(e,t,n){var r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,{set:function(e){var t=this;setTimeout(function(){n.set.call(t,e)},0),r&&r.set&&r.set.call(this,e)}}),function(){return hookSetter(e,t,r||{})}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function initMutationObserver(e){var t=new MutationObserver(function(t){var n=[],r=[],i=[],o=[],a=[],s=new Set,u=function(e){s.add(e),e.childNodes.forEach(function(e){return u(e)})};t.forEach(function(e){var t=e.type,o=e.target,c=e.oldValue,d=e.addedNodes,l=e.removedNodes,p=e.attributeName;switch(t){case"characterData":(m=o.textContent)!==c&&n.push({value:m,node:o});break;case"attributes":var m;if((m=o.getAttribute(p))===c)return;var h=r.find(function(e){return e.node===o});h||(h={node:o,attributes:{}},r.push(h)),h.attributes[p]=m;case"childList":d.forEach(function(e){return u(e)}),l.forEach(function(e){s.has(e)?(s.delete(e),a.push(e)):s.has(o)&&!mirror.getId(e)||i.push({parentId:mirror.getId(o),id:mirror.getId(e)}),mirror.removeNodeFromMap(e)})}}),i=i.map(function(e){return e.parentNode&&(e.parentId=mirror.getId(e.parentNode),delete e.parentNode),e});var c=function(e){var t=e.parentNode;return!!t&&(!!a.some(function(e){return e===t})||c(t))},d=function(e){var t=e.parentNode;if(!t)return!1;var n=mirror.getId(t);return!!i.some(function(e){return e.id===n})||d(t)};Array.from(s).forEach(function(e){c(e)||d(e)?a.push(e):o.push({parentId:mirror.getId(e.parentNode),previousId:e.previousSibling?mirror.getId(e.previousSibling):e.previousSibling,nextId:e.nextSibling?mirror.getId(e.nextSibling):e.nextSibling,node:serializeNodeWithId(e,document,mirror.map,!0)})}),e({texts:n.map(function(e){return{id:mirror.getId(e.node),value:e.value}}).filter(function(e){return mirror.has(e.id)}),attributes:r.map(function(e){return{id:mirror.getId(e.node),attributes:e.attributes}}).filter(function(e){return mirror.has(e.id)}),removes:i,adds:o})});return t.observe(document,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),t}function initMousemoveObserver(e){var t,n=[],r=throttle(function(){var r=Date.now()-t;e(n.map(function(e){return e.timeOffset-=r,e})),n=[],t=null},500);return on("mousemove",throttle(function(e){var i=e.clientX,o=e.clientY,a=e.target;t||(t=Date.now()),n.push({x:i,y:o,id:mirror.getId(a),timeOffset:Date.now()-t}),r()},20,{trailing:!1}))}function initMouseInteractionObserver(e){var t=[];return Object.keys(MouseInteractions).filter(function(e){return Number.isNaN(Number(e))}).forEach(function(n){var r=n.toLowerCase(),i=function(t){return function(n){var r=mirror.getId(n.target),i=n.clientX,o=n.clientY;e({type:MouseInteractions[t],id:r,x:i,y:o})}}(n);t.push(on(r,i))}),function(){t.forEach(function(e){return e()})}}function initScrollObserver(e){return on("scroll",throttle(function(t){if(t.target){var n=mirror.getId(t.target);t.target===document?e({id:n,x:document.documentElement.scrollLeft,y:document.documentElement.scrollTop}):e({id:n,x:t.target.scrollLeft,y:t.target.scrollTop})}},100))}function initViewportResizeObserver(e){return on("resize",throttle(function(){var t=getWindowHeight(),n=getWindowWidth();e({width:Number(n),height:Number(t)})},200),window)}!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"}(EventType||(EventType={})),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"}(IncrementalSource||(IncrementalSource={})),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=8]="TouchMove",e[e.TouchEnd=9]="TouchEnd"}(MouseInteractions||(MouseInteractions={}));var INPUT_TAGS=["INPUT","TEXTAREA","SELECT"],HOOK_PROPERTIES=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"]],IGNORE_CLASS="rr-ignore",lastInputValueMap=new WeakMap;function initInputObserver(e){function t(e){var t=e.target;if(t&&t.tagName&&!(INPUT_TAGS.indexOf(t.tagName)<0)){var r=t.type;if("password"!==r&&!t.classList.contains(IGNORE_CLASS)){var i=t.value,o=!1;"radio"!==r&&"checkbox"!==r||(o=t.checked),n(t,{text:i,isChecked:o});var a=t.name;"radio"===r&&a&&o&&document.querySelectorAll('input[type="radio"][name="'+a+'"]').forEach(function(e){e!==t&&n(e,{text:e.value,isChecked:!o})})}}}function n(t,n){var r=lastInputValueMap.get(t);if(!r||r.text!==n.text||r.isChecked!==n.isChecked){lastInputValueMap.set(t,n);var i=mirror.getId(t);e(__assign({},n,{id:i}))}}var r=["input","change"].map(function(e){return on(e,t)}),i=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");return i&&i.set&&r.push.apply(r,HOOK_PROPERTIES.map(function(e){return hookSetter(e[0],e[1],{set:function(){t({target:this})}})})),function(){r.forEach(function(e){return e()})}}function initObservers(e){var t=initMutationObserver(e.mutationCb),n=initMousemoveObserver(e.mousemoveCb),r=initMouseInteractionObserver(e.mouseInteractionCb),i=initScrollObserver(e.scrollCb),o=initViewportResizeObserver(e.viewportResizeCb),a=initInputObserver(e.inputCb);return function(){t.disconnect(),n(),r(),i(),o(),a()}}function wrapEvent(e){return __assign({},e,{timestamp:Date.now()})}function record(e){void 0===e&&(e={});var t=e.emit;if(!t)throw new Error("emit function is required");try{var n=[];n.push(on("DOMContentLoaded",function(){t(wrapEvent({type:EventType.DomContentLoaded,data:{}}))}));var r=function(){t(wrapEvent({type:EventType.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}));var e=snapshot(document),r=e[0],i=e[1];if(!r)return console.warn("Failed to snapshot the document");mirror.map=i,t(wrapEvent({type:EventType.FullSnapshot,data:{node:r,initialOffset:{left:document.documentElement.scrollLeft,top:document.documentElement.scrollTop}}})),n.push(initObservers({mutationCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Mutation},e)}))},mousemoveCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:{source:IncrementalSource.MouseMove,positions:e}}))},mouseInteractionCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.MouseInteraction},e)}))},scrollCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Scroll},e)}))},viewportResizeCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.ViewportResize},e)}))},inputCb:function(e){return t(wrapEvent({type:EventType.IncrementalSnapshot,data:__assign({source:IncrementalSource.Input},e)}))}}))};return"interactive"===document.readyState||"complete"===document.readyState?r():n.push(on("load",function(){t(wrapEvent({type:EventType.Load,data:{}})),r()},window)),function(){n.forEach(function(e){return e()})}}catch(e){console.warn(e)}}function mitt(e){return e=e||Object.create(null),{on:function(t,n){(e[t]||(e[t]=[])).push(n)},off:function(t,n){e[t]&&e[t].splice(e[t].indexOf(n)>>>0,1)},emit:function(t,n){(e[t]||[]).slice().map(function(e){e(n)}),(e["*"]||[]).slice().map(function(e){e(t,n)})}}}var mittProxy=Object.freeze({default:mitt}),Timer=function(){function e(e,t){void 0===t&&(t=[]),this.actions=t,this.config=e}return e.prototype.addAction=function(e){var t=this.findActionIndex(e);this.actions.splice(t,0,e)},e.prototype.addActions=function(e){var t;(t=this.actions).push.apply(t,e)},e.prototype.start=function(){this.actions.sort(function(e,t){return e.delay-t.delay});var e=0,t=performance.now(),n=this.actions,r=this.config,i=this;this.raf=requestAnimationFrame(function o(a){for(e=a-t;n.length;){var s=n[0],u=s.delay/r.speed;if(!(e>=u))break;n.shift(),s.doAction()}n.length>0&&(i.raf=requestAnimationFrame(o))})},e.prototype.clear=function(){this.raf&&cancelAnimationFrame(this.raf),this.actions.length=0},e.prototype.findActionIndex=function(e){for(var t=0,n=this.actions.length-1;t<=n;){var r=Math.floor((t+n)/2);if(this.actions[r].delay<e.delay)t=r+1;else{if(!(this.actions[r].delay>e.delay))return r;n=r-1}}return t},e}(),rules=["iframe, .rr-block { background: #ccc }","noscript { display: none !important; }"],mitt$1=mitt||mittProxy,defaultConfig={speed:1,root:document.body,loadTimeout:0},Replayer=function(){function e(e,t){if(this.events=[],this.config=defaultConfig,this.emitter=mitt$1(),this.baselineTime=0,this.missingNodeRetryMap={},e.length<2)throw new Error("Replayer need at least 2 events.");this.events=e,this.handleResize=this.handleResize.bind(this),this.timer=new Timer(this.config),this.setConfig(Object.assign({},t)),this.setupDom(),this.emitter.on("resize",this.handleResize)}return e.prototype.on=function(e,t){this.emitter.on(e,t)},e.prototype.setConfig=function(e){var t=this;Object.keys(e).forEach(function(n){t.config[n]=e[n]})},e.prototype.getMetaData=function(){var e=this.events[0];return{totalTime:this.events[this.events.length-1].timestamp-e.timestamp}},e.prototype.play=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n],o=i.timestamp<this.baselineTime,a=this.getCastFn(i,o);o?a():t.push({doAction:a,delay:this.getDelay(i)})}this.timer.addActions(t),this.timer.start()},e.prototype.pause=function(){this.timer.clear(),this.emitter.emit("pause")},e.prototype.resume=function(e){void 0===e&&(e=0),this.timer.clear(),this.baselineTime=this.events[0].timestamp+e;for(var t=new Array,n=0,r=this.events;n<r.length;n++){var i=r[n];if(!(i.timestamp<=this.lastPlayedEvent.timestamp||i===this.lastPlayedEvent)){var o=this.getCastFn(i);t.push({doAction:o,delay:this.getDelay(i)})}}this.timer.addActions(t),this.timer.start(),this.emitter.emit("resume")},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),this.iframe=document.createElement("iframe"),this.iframe.setAttribute("sandbox","allow-same-origin"),this.wrapper.appendChild(this.iframe)},e.prototype.handleResize=function(e){this.iframe.width=e.width+"px",this.iframe.height=e.height+"px"},e.prototype.getDelay=function(e){if(e.type===EventType.IncrementalSnapshot&&e.data.source===IncrementalSource.MouseMove){var t=e.data.positions[0].timeOffset;return e.timestamp+t-this.baselineTime}return e.timestamp-this.baselineTime},e.prototype.getCastFn=function(e,t){var n,r=this;switch(void 0===t&&(t=!1),e.type){case EventType.DomContentLoaded:case EventType.Load:break;case EventType.Meta:n=function(){return r.emitter.emit("resize",{width:e.data.width,height:e.data.height})};break;case EventType.FullSnapshot:n=function(){r.rebuildFullSnapshot(e),r.iframe.contentWindow.scrollTo(e.data.initialOffset)};break;case EventType.IncrementalSnapshot:n=function(){r.applyIncremental(e,t)}}return function(){n&&n(),r.lastPlayedEvent=e,e===r.events[r.events.length-1]&&r.emitter.emit("finish")}},e.prototype.rebuildFullSnapshot=function(e){Object.keys(this.missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.missingNodeRetryMap),this.missingNodeRetryMap={},mirror.map=rebuild(e.data.node,this.iframe.contentDocument)[1];var t=document.createElement("style"),n=this.iframe.contentDocument,r=n.documentElement,i=n.head;r.insertBefore(t,i);for(var o=0;o<rules.length;o++)t.sheet.insertRule(rules[o],o);this.waitForStylesheetLoad()},e.prototype.waitForStylesheetLoad=function(){var e=this,t=this.iframe.contentDocument.head;if(t){var n,r=new Set;t.querySelectorAll('link[rel="stylesheet"]').forEach(function(t){t.sheet||(0===r.size&&(e.pause(),e.emitter.emit("wait-stylesheet"),n=window.setTimeout(function(){e.resume(),n=-1},e.config.loadTimeout)),r.add(t),t.addEventListener("load",function(){r.delete(t),0===r.size&&-1!==n&&(e.resume(),e.emitter.emit("stylesheet-loaded"),n&&window.clearTimeout(n))}))})}},e.prototype.applyIncremental=function(e,t){var n=this,r=e.data;switch(r.source){case IncrementalSource.Mutation:r.removes.forEach(function(e){var t=mirror.getNode(e.id);if(t){var n=mirror.getNode(e.parentId);mirror.removeNodeFromMap(t),n&&n.removeChild(t)}});var i=__assign({},this.missingNodeRetryMap);r.adds.forEach(function(e){var t=buildNodeWithSN(e.node,n.iframe.contentDocument,mirror.map,!0),r=mirror.getNode(e.parentId),o=null,a=null;e.previousId&&(o=mirror.getNode(e.previousId)),e.nextId&&(a=mirror.getNode(e.nextId)),-1!==e.previousId&&-1!==e.nextId?(o&&o.nextSibling&&o.nextSibling.parentNode?r.insertBefore(t,o.nextSibling):a&&a.parentNode?r.insertBefore(t,a):r.appendChild(t),(e.previousId||e.nextId)&&n.resolveMissingNode(i,r,t,e)):i[e.node.id]={node:t,mutation:e}}),Object.keys(i).length&&Object.assign(this.missingNodeRetryMap,i),r.texts.forEach(function(e){mirror.getNode(e.id).textContent=e.value}),r.attributes.forEach(function(e){var t=mirror.getNode(e.id);for(var n in e.attributes)if("string"==typeof n){var r=e.attributes[n];r?t.setAttribute(n,r):t.removeAttribute(n)}});break;case IncrementalSource.MouseMove:t||r.positions.forEach(function(t){var r={doAction:function(){n.mouse.style.left=t.x+"px",n.mouse.style.top=t.y+"px";var e=mirror.getNode(t.id);e&&n.hoverElements(e)},delay:t.timeOffset+e.timestamp-n.baselineTime};n.timer.addAction(r)});break;case IncrementalSource.MouseInteraction:if(-1===r.id)break;var o=new Event(MouseInteractions[r.type].toLowerCase()),a=mirror.getNode(r.id);switch(r.type){case MouseInteractions.Blur:a.blur();break;case MouseInteractions.Focus:a.focus({preventScroll:!0});break;case MouseInteractions.Click:t||(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active"));break;default:a.dispatchEvent(o)}break;case IncrementalSource.Scroll:if(-1===r.id)break;if((a=mirror.getNode(r.id))===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:r.y,left:r.x,behavior:t?"instant":"smooth"});else try{a.scrollTop=r.y,a.scrollLeft=r.x}catch(e){}break;case IncrementalSource.ViewportResize:this.emitter.emit("resize",{width:r.width,height:r.height});break;case IncrementalSource.Input:if(-1===r.id)break;(a=mirror.getNode(r.id)).checked=r.isChecked,a.value=r.text}},e.prototype.resolveMissingNode=function(e,t,n,r){var i=r.previousId,o=r.nextId,a=i&&e[i],s=o&&e[o];if(a){var u=a,c=u.node,d=u.mutation;t.insertBefore(c,n),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}if(s){var l=s;c=l.node,d=l.mutation;t.insertBefore(c,n.nextSibling),delete e[d.node.id],delete this.missingNodeRetryMap[d.node.id],(d.previousId||d.nextId)&&this.resolveMissingNode(e,t,c,d)}},e.prototype.hoverElements=function(e){this.iframe.contentDocument.querySelectorAll(".\\:hover").forEach(function(e){e.classList.remove(":hover")});for(var t=e;t;)t.classList.add(":hover"),t=t.parentElement},e}();export{record,Replayer,mirror};
//# sourceMappingURL=rrweb.min.js.map

@@ -334,2 +334,3 @@ 'use strict';

if (n.type === NodeType.Document) {
doc.close();
doc.open();

@@ -336,0 +337,0 @@ node = doc;

{
"name": "rrweb",
"version": "0.6.8",
"version": "0.6.9",
"description": "record and replay the web",

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

"mitt": "^1.1.3",
"rrweb-snapshot": "^0.6.10"
"rrweb-snapshot": "^0.6.11"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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