UNPKG

rrweb

Version:
17 lines (15 loc) 83.7 kB
var rrwebReplay=function(ut){"use strict";var C;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(C||(C={}));function Ne(t){return t.nodeType===t.ELEMENT_NODE}class Rt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var n;if(!e)return-1;const s=(n=this.getMeta(e))===null||n===void 0?void 0:n.id;return s??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const s=n.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,n)}replace(e,n){const s=this.getNode(e);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Te(){return new Rt}function Se(t){return t.toLowerCase()}function be(t,e){return!t||!e||t.type!==e.type?!1:t.type===C.Document?t.compatMode===e.compatMode:t.type===C.DocumentType?t.name===e.name&&t.publicId===e.publicId&&t.systemId===e.systemId:t.type===C.Comment||t.type===C.Text||t.type===C.CDATA?t.textContent===e.textContent:t.type===C.Element?t.tagName===e.tagName&&JSON.stringify(t.attributes)===JSON.stringify(e.attributes)&&t.isSVG===e.isSVG&&t.needBlock===e.needBlock:!1}const xt=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function we(t,e={}){let n=1,s=1;function r(f){const p=f.match(/\n/g);p&&(n+=p.length);const M=f.lastIndexOf(` `);s=M===-1?s+f.length:f.length-M}function a(){const f={line:n,column:s};return p=>(p.position=new o(f),E(),p)}class o{constructor(p){this.start=p,this.end={line:n,column:s},this.source=e.source}}o.prototype.content=t;const i=[];function l(f){const p=new Error(`${e.source||""}:${n}:${s}: ${f}`);if(p.reason=f,p.filename=e.source,p.line=n,p.column=s,p.source=t,e.silent)i.push(p);else throw p}function c(){const f=h();return{type:"stylesheet",stylesheet:{source:e.source,rules:f,parsingErrors:i}}}function u(){return g(/^{\s*/)}function d(){return g(/^}/)}function h(){let f;const p=[];for(E(),N(p);t.length&&t.charAt(0)!=="}"&&(f=O()||K());)f&&(p.push(f),N(p));return p}function g(f){const p=f.exec(t);if(!p)return;const M=p[0];return r(M),t=t.slice(M.length),p}function E(){g(/^\s*/)}function N(f=[]){let p;for(;p=S();)p&&f.push(p),p=S();return f}function S(){const f=a();if(t.charAt(0)!=="/"||t.charAt(1)!=="*")return;let p=2;for(;t.charAt(p)!==""&&(t.charAt(p)!=="*"||t.charAt(p+1)!=="/");)++p;if(p+=2,t.charAt(p-1)==="")return l("End of comment missing");const M=t.slice(2,p-2);return s+=2,r(M),t=t.slice(p),s+=2,f({type:"comment",comment:M})}function m(){const f=g(/^([^{]+)/);if(f)return F(f[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,p=>p.replace(/,/g,"\u200C")).split(/\s*(?![^(]*\)),\s*/).map(p=>p.replace(/\u200C/g,","))}function y(){const f=a(),p=g(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!p)return;const M=F(p[0]);if(!g(/^:\s*/))return l("property missing ':'");const k=g(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),$=f({type:"declaration",property:M.replace(xt,""),value:k?F(k[0]).replace(xt,""):""});return g(/^[;\s]*/),$}function v(){const f=[];if(!u())return l("missing '{'");N(f);let p;for(;p=y();)p!==!1&&(f.push(p),N(f)),p=y();return d()?f:l("missing '}'")}function b(){let f;const p=[],M=a();for(;f=g(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)p.push(f[1]),g(/^,\s*/);if(p.length)return M({type:"keyframe",values:p,declarations:v()})}function A(){const f=a();let p=g(/^@([-\w]+)?keyframes\s*/);if(!p)return;const M=p[1];if(p=g(/^([-\w]+)\s*/),!p)return l("@keyframes missing name");const k=p[1];if(!u())return l("@keyframes missing '{'");let $,ct=N();for(;$=b();)ct.push($),ct=ct.concat(N());return d()?f({type:"keyframes",name:k,vendor:M,keyframes:ct}):l("@keyframes missing '}'")}function L(){const f=a(),p=g(/^@supports *([^{]+)/);if(!p)return;const M=F(p[1]);if(!u())return l("@supports missing '{'");const k=N().concat(h());return d()?f({type:"supports",supports:M,rules:k}):l("@supports missing '}'")}function U(){const f=a();if(!g(/^@host\s*/))return;if(!u())return l("@host missing '{'");const p=N().concat(h());return d()?f({type:"host",rules:p}):l("@host missing '}'")}function J(){const f=a(),p=g(/^@media *([^{]+)/);if(!p)return;const M=F(p[1]);if(!u())return l("@media missing '{'");const k=N().concat(h());return d()?f({type:"media",media:M,rules:k}):l("@media missing '}'")}function bt(){const f=a(),p=g(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(p)return f({type:"custom-media",name:F(p[1]),media:F(p[2])})}function wt(){const f=a();if(!g(/^@page */))return;const p=m()||[];if(!u())return l("@page missing '{'");let M=N(),k;for(;k=y();)M.push(k),M=M.concat(N());return d()?f({type:"page",selectors:p,declarations:M}):l("@page missing '}'")}function Dt(){const f=a(),p=g(/^@([-\w]+)?document *([^{]+)/);if(!p)return;const M=F(p[1]),k=F(p[2]);if(!u())return l("@document missing '{'");const $=N().concat(h());return d()?f({type:"document",document:k,vendor:M,rules:$}):l("@document missing '}'")}function Z(){const f=a();if(!g(/^@font-face\s*/))return;if(!u())return l("@font-face missing '{'");let p=N(),M;for(;M=y();)p.push(M),p=p.concat(N());return d()?f({type:"font-face",declarations:p}):l("@font-face missing '}'")}const lt=H("import"),Mt=H("charset"),Ct=H("namespace");function H(f){const p=new RegExp("^@"+f+"\\s*([^;]+);");return()=>{const M=a(),k=g(p);if(!k)return;const $={type:f};return $[f]=k[1].trim(),M($)}}function O(){if(t[0]==="@")return A()||J()||bt()||L()||lt()||Mt()||Ct()||Dt()||wt()||U()||Z()}function K(){const f=a(),p=m();return p?(N(),f({type:"rule",selectors:p,declarations:v()})):l("selector missing")}return dt(c())}function F(t){return t?t.replace(/^\s+|\s+$/g,""):""}function dt(t,e){const n=t&&typeof t.type=="string",s=n?t:e;for(const r of Object.keys(t)){const a=t[r];Array.isArray(a)?a.forEach(o=>{dt(o,s)}):a&&typeof a=="object"&&dt(a,s)}return n&&Object.defineProperty(t,"parent",{configurable:!0,writable:!0,enumerable:!1,value:e||null}),t}const At={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function De(t){let e=At[t.tagName]?At[t.tagName]:t.tagName;return e==="link"&&t.attributes._cssText&&(e="style"),e}function It(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ot=/(max|min)-device-(width|height)/,Me=new RegExp(Ot.source,"g"),kt=/([^\\]):hover/,Ce=new RegExp(kt.source,"g");function _t(t,e){const n=e?.stylesWithHoverClass.get(t);if(n)return n;const s=we(t,{silent:!0});if(!s.stylesheet)return t;const r=[],a=[];function o(l){"selectors"in l&&l.selectors&&l.selectors.forEach(c=>{kt.test(c)&&r.push(c)}),"media"in l&&l.media&&Ot.test(l.media)&&a.push(l.media),"rules"in l&&l.rules&&l.rules.forEach(o)}o(s.stylesheet);let i=t;if(r.length>0){const l=new RegExp(r.filter((c,u)=>r.indexOf(c)===u).sort((c,u)=>u.length-c.length).map(c=>It(c)).join("|"),"g");i=i.replace(l,c=>{const u=c.replace(Ce,"$1.\\:hover");return`${c}, ${u}`})}if(a.length>0){const l=new RegExp(a.filter((c,u)=>a.indexOf(c)===u).sort((c,u)=>u.length-c.length).map(c=>It(c)).join("|"),"g");i=i.replace(l,c=>c.replace(Me,"$1-$2"))}return e?.stylesWithHoverClass.set(t,i),i}function Lt(){return{stylesWithHoverClass:new Map}}function Re(t,e){var n;const{doc:s,hackCss:r,cache:a}=e;switch(t.type){case C.Document:return s.implementation.createDocument(null,"",null);case C.DocumentType:return s.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case C.Element:{const o=De(t);let i;t.isSVG?i=s.createElementNS("http://www.w3.org/2000/svg",o):(t.isCustom&&((n=s.defaultView)===null||n===void 0?void 0:n.customElements)&&!s.defaultView.customElements.get(t.tagName)&&s.defaultView.customElements.define(t.tagName,class extends s.defaultView.HTMLElement{}),i=s.createElement(o));const l={};for(const c in t.attributes){if(!Object.prototype.hasOwnProperty.call(t.attributes,c))continue;let u=t.attributes[c];if(o==="option"&&c==="selected"&&u===!1||u===null)continue;if(u===!0&&(u=""),c.startsWith("rr_")){l[c]=u;continue}const d=o==="textarea"&&c==="value",h=o==="style"&&c==="_cssText";if(h&&r&&typeof u=="string"&&(u=_t(u,a)),(d||h)&&typeof u=="string"){i.appendChild(s.createTextNode(u)),t.childNodes=[];continue}try{if(t.isSVG&&c==="xlink:href")i.setAttributeNS("http://www.w3.org/1999/xlink",c,u.toString());else if(c==="onload"||c==="onclick"||c.substring(0,7)==="onmouse")i.setAttribute("_"+c,u.toString());else if(o==="meta"&&t.attributes["http-equiv"]==="Content-Security-Policy"&&c==="content"){i.setAttribute("csp-content",u.toString());continue}else o==="link"&&(t.attributes.rel==="preload"||t.attributes.rel==="modulepreload")&&t.attributes.as==="script"||o==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js")||(o==="img"&&t.attributes.srcset&&t.attributes.rr_dataURL?i.setAttribute("rrweb-original-srcset",t.attributes.srcset):i.setAttribute(c,u.toString()))}catch{}}for(const c in l){const u=l[c];if(o==="canvas"&&c==="rr_dataURL"){const d=document.createElement("img");d.onload=()=>{const h=i.getContext("2d");h&&h.drawImage(d,0,0,d.width,d.height)},d.src=u.toString(),i.RRNodeType&&(i.rr_dataURL=u.toString())}else if(o==="img"&&c==="rr_dataURL"){const d=i;d.currentSrc.startsWith("data:")||(d.setAttribute("rrweb-original-src",t.attributes.src),d.src=u.toString())}if(c==="rr_width")i.style.width=u.toString();else if(c==="rr_height")i.style.height=u.toString();else if(c==="rr_mediaCurrentTime"&&typeof u=="number")i.currentTime=u;else if(c==="rr_mediaState")switch(u){case"played":i.play().catch(d=>console.warn("media playback error",d));break;case"paused":i.pause();break}}if(t.isShadowHost)if(!i.shadowRoot)i.attachShadow({mode:"open"});else for(;i.shadowRoot.firstChild;)i.shadowRoot.removeChild(i.shadowRoot.firstChild);return i}case C.Text:return s.createTextNode(t.isStyle&&r?_t(t.textContent,a):t.textContent);case C.CDATA:return s.createCDATASection(t.textContent);case C.Comment:return s.createComment(t.textContent);default:return null}}function z(t,e){const{doc:n,mirror:s,skipChild:r=!1,hackCss:a=!0,afterAppend:o,cache:i}=e;if(s.has(t.id)){const c=s.getNode(t.id),u=s.getMeta(c);if(be(u,t))return s.getNode(t.id)}let l=Re(t,{doc:n,hackCss:a,cache:i});if(!l)return null;if(t.rootId&&s.getNode(t.rootId)!==n&&s.replace(t.rootId,n),t.type===C.Document&&(n.close(),n.open(),t.compatMode==="BackCompat"&&t.childNodes&&t.childNodes[0].type!==C.DocumentType&&(t.childNodes[0].type===C.Element&&"xmlns"in t.childNodes[0].attributes&&t.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=n),s.add(l,t),(t.type===C.Document||t.type===C.Element)&&!r)for(const c of t.childNodes){const u=z(c,{doc:n,mirror:s,skipChild:!1,hackCss:a,afterAppend:o,cache:i});if(!u){console.warn("Failed to rebuild",c);continue}if(c.isShadow&&Ne(l)&&l.shadowRoot)l.shadowRoot.appendChild(u);else if(t.type===C.Document&&c.type==C.Element){const d=u;let h=null;d.childNodes.forEach(g=>{g.nodeName==="BODY"&&(h=g)}),h?(d.removeChild(h),l.appendChild(u),d.appendChild(h)):l.appendChild(u)}else l.appendChild(u);o&&o(u,c.id)}return l}function xe(t,e){function n(s){e(s)}for(const s of t.getIds())t.has(s)&&n(t.getNode(s))}function Ae(t,e){const n=e.getMeta(t);if(n?.type!==C.Element)return;const s=t;for(const r in n.attributes){if(!(Object.prototype.hasOwnProperty.call(n.attributes,r)&&r.startsWith("rr_")))continue;const a=n.attributes[r];r==="rr_scrollLeft"&&(s.scrollLeft=a),r==="rr_scrollTop"&&(s.scrollTop=a)}}function Ie(t,e){const{doc:n,onVisit:s,hackCss:r=!0,afterAppend:a,cache:o,mirror:i=new Rt}=e,l=z(t,{doc:n,mirror:i,skipChild:!1,hackCss:r,afterAppend:a,cache:o});return xe(i,c=>{s&&s(c),Ae(c,i)}),l}var T;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(T||(T={}));class Oe{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var n;if(!e)return-1;const s=(n=this.getMeta(e))===null||n===void 0?void 0:n.id;return s??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const s=n.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,n)}replace(e,n){const s=this.getNode(e);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function ke(){return new Oe}function _e(t){const e={},n=/;(?![^(]*\))/g,s=/:(.+)/,r=/\/\*.*?\*\//g;return t.replace(r,"").split(n).forEach(function(a){if(a){const o=a.split(s);o.length>1&&(e[ht(o[0].trim())]=o[1].trim())}}),e}function Pt(t){const e=[];for(const n in t){const s=t[n];if(typeof s!="string")continue;const r=$e(n);e.push(`${r}: ${s};`)}return e.join(" ")}const Le=/-([a-z])/g,Pe=/^--[a-zA-Z0-9-]+$/,ht=t=>Pe.test(t)?t:t.replace(Le,(e,n)=>n?n.toUpperCase():""),Fe=/\B([A-Z])/g,$e=t=>t.replace(Fe,"-$1").toLowerCase();class _{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=x.ELEMENT_NODE,this.TEXT_NODE=x.TEXT_NODE}get childNodes(){const e=[];let n=this.firstChild;for(;n;)e.push(n),n=n.nextSibling;return e}contains(e){if(e instanceof _){if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0}else return!1;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(e){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(e,n){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(e){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function Be(t){return class Ee extends t{constructor(...n){super(n),this.nodeType=x.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=T.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find(n=>n.RRNodeType===T.Element&&n.tagName==="HTML")||null}get body(){var n;return((n=this.documentElement)===null||n===void 0?void 0:n.childNodes.find(s=>s.RRNodeType===T.Element&&s.tagName==="BODY"))||null}get head(){var n;return((n=this.documentElement)===null||n===void 0?void 0:n.childNodes.find(s=>s.RRNodeType===T.Element&&s.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(n){const s=n.RRNodeType;if((s===T.Element||s===T.DocumentType)&&this.childNodes.some(a=>a.RRNodeType===s))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${s===T.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=mt(this,n);return r.parentElement=null,r}insertBefore(n,s){const r=n.RRNodeType;if((r===T.Element||r===T.DocumentType)&&this.childNodes.some(o=>o.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===T.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const a=Wt(this,n,s);return a.parentElement=null,a}removeChild(n){return jt(this,n)}open(){this.firstChild=null,this.lastChild=null}close(){}write(n){let s;if(n==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?s="-//W3C//DTD XHTML 1.0 Transitional//EN":n==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(s="-//W3C//DTD HTML 4.0 Transitional//EN"),s){const r=this.createDocumentType("html",s,"");this.open(),this.appendChild(r)}}createDocument(n,s,r){return new Ee}createDocumentType(n,s,r){const a=new(Ft(_))(n,s,r);return a.ownerDocument=this,a}createElement(n){const s=new($t(_))(n);return s.ownerDocument=this,s}createElementNS(n,s){return this.createElement(s)}createTextNode(n){const s=new(Bt(_))(n);return s.ownerDocument=this,s}createComment(n){const s=new(Ut(_))(n);return s.ownerDocument=this,s}createCDATASection(n){const s=new(Vt(_))(n);return s.ownerDocument=this,s}toString(){return"RRDocument"}}}function Ft(t){return class extends t{constructor(e,n,s){super(),this.nodeType=x.DOCUMENT_TYPE_NODE,this.RRNodeType=T.DocumentType,this.name=e,this.publicId=n,this.systemId=s,this.nodeName=e,this.textContent=null}toString(){return"RRDocumentType"}}}function $t(t){return class extends t{constructor(e){super(),this.nodeType=x.ELEMENT_NODE,this.RRNodeType=T.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach(n=>e+=n.textContent),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new Ve(this.attributes.class,e=>{this.attributes.class=e})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const e=this.attributes.style?_e(this.attributes.style):{},n=/\B([A-Z])/g;return e.setProperty=(s,r,a)=>{if(n.test(s))return;const o=ht(s);r?e[o]=r:delete e[o],a==="important"&&(e[o]+=" !important"),this.attributes.style=Pt(e)},e.removeProperty=s=>{if(n.test(s))return"";const r=ht(s),a=e[r]||"";return delete e[r],this.attributes.style=Pt(e),a},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,n){this.attributes[e]=n}setAttributeNS(e,n,s){this.setAttribute(n,s)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return mt(this,e)}insertBefore(e,n){return Wt(this,e,n)}removeChild(e){return jt(this,e)}attachShadow(e){const n=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=n,n}dispatchEvent(e){return!0}toString(){let e="";for(const n in this.attributes)e+=`${n}="${this.attributes[n]}" `;return`${this.tagName} ${e}`}}}function Ue(t){return class extends t{attachShadow(e){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function Bt(t){return class extends t{constructor(e){super(),this.nodeType=x.TEXT_NODE,this.nodeName="#text",this.RRNodeType=T.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Ut(t){return class extends t{constructor(e){super(),this.nodeType=x.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=T.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function Vt(t){return class extends t{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=x.CDATA_SECTION_NODE,this.RRNodeType=T.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class Ve{constructor(e,n){if(this.classes=[],this.add=(...s)=>{for(const r of s){const a=String(r);this.classes.indexOf(a)>=0||this.classes.push(a)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...s)=>{this.classes=this.classes.filter(r=>s.indexOf(r)===-1),this.onChange&&this.onChange(this.classes.join(" "))},e){const s=e.trim().split(/\s+/);this.classes.push(...s)}this.onChange=n}}function mt(t,e){return e.parentNode&&e.parentNode.removeChild(e),t.lastChild?(t.lastChild.nextSibling=e,e.previousSibling=t.lastChild):(t.firstChild=e,e.previousSibling=null),t.lastChild=e,e.nextSibling=null,e.parentNode=t,e.parentElement=t,e.ownerDocument=t.ownerDocument,e}function Wt(t,e,n){if(!n)return mt(t,e);if(n.parentNode!==t)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return e===n||(e.parentNode&&e.parentNode.removeChild(e),e.previousSibling=n.previousSibling,n.previousSibling=e,e.nextSibling=n,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,e.parentElement=t,e.parentNode=t,e.ownerDocument=t.ownerDocument),e}function jt(t,e){if(e.parentNode!==t)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return e.previousSibling?e.previousSibling.nextSibling=e.nextSibling:t.firstChild=e.nextSibling,e.nextSibling?e.nextSibling.previousSibling=e.previousSibling:t.lastChild=e.previousSibling,e.previousSibling=null,e.nextSibling=null,e.parentElement=null,e.parentNode=null,e}var x;(function(t){t[t.PLACEHOLDER=0]="PLACEHOLDER",t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(x||(x={}));const pt={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},We={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};let P=null;function tt(t,e,n,s=e.mirror||e.ownerDocument.mirror){t=je(t,e,n,s),Gt(t,e,n,s),Ge(t,e,n)}function je(t,e,n,s){var r;if(n.afterAppend&&!P&&(P=new WeakSet,setTimeout(()=>{P=null},0)),!ft(t,e)){const a=et(e,n.mirror,s);(r=t.parentNode)===null||r===void 0||r.replaceChild(a,t),t=a}switch(e.RRNodeType){case T.Document:{if(!V(t,e,n.mirror,s)){const a=s.getMeta(e);a&&(n.mirror.removeNodeFromMap(t),t.close(),t.open(),n.mirror.add(t,a),P?.add(t))}break}case T.Element:{const a=t,o=e;switch(o.tagName){case"IFRAME":{const i=t.contentDocument;if(!i)break;tt(i,e.contentDocument,n,s);break}}o.shadowRoot&&(a.shadowRoot||a.attachShadow({mode:"open"}),Gt(a.shadowRoot,o.shadowRoot,n,s)),Ye(a,o,s);break}}return t}function Ge(t,e,n){var s;switch(e.RRNodeType){case T.Document:{const r=e.scrollData;r&&n.applyScroll(r,!0);break}case T.Element:{const r=t,a=e;switch(a.scrollData&&n.applyScroll(a.scrollData,!0),a.inputData&&n.applyInput(a.inputData),a.tagName){case"AUDIO":case"VIDEO":{const o=t,i=a;i.paused!==void 0&&(i.paused?o.pause():o.play()),i.muted!==void 0&&(o.muted=i.muted),i.volume!==void 0&&(o.volume=i.volume),i.currentTime!==void 0&&(o.currentTime=i.currentTime),i.playbackRate!==void 0&&(o.playbackRate=i.playbackRate);break}case"CANVAS":{const o=e;if(o.rr_dataURL!==null){const i=document.createElement("img");i.onload=()=>{const l=r.getContext("2d");l&&l.drawImage(i,0,0,i.width,i.height)},i.src=o.rr_dataURL}o.canvasMutations.forEach(i=>n.applyCanvas(i.event,i.mutation,t));break}case"STYLE":{const o=r.sheet;o&&e.rules.forEach(i=>n.applyStyleSheetMutation(i,o));break}}break}case T.Text:case T.Comment:case T.CDATA:{t.textContent!==e.data&&(t.textContent=e.data);break}}P!=null&&P.has(t)&&(P.delete(t),(s=n.afterAppend)===null||s===void 0||s.call(n,t,n.mirror.getId(t)))}function Ye(t,e,n){const s=t.attributes,r=e.attributes;for(const a in r){const o=r[a],i=n.getMeta(e);if(i?.isSVG&&pt[a])t.setAttributeNS(pt[a],a,o);else if(e.tagName==="CANVAS"&&a==="rr_dataURL"){const l=document.createElement("img");l.src=o,l.onload=()=>{const c=t.getContext("2d");c&&c.drawImage(l,0,0,l.width,l.height)}}else{if(e.tagName==="IFRAME"&&a==="srcdoc")continue;t.setAttribute(a,o)}}for(const{name:a}of Array.from(s))a in r||t.removeAttribute(a);e.scrollLeft&&(t.scrollLeft=e.scrollLeft),e.scrollTop&&(t.scrollTop=e.scrollTop)}function Gt(t,e,n,s){const r=Array.from(t.childNodes),a=e.childNodes;if(r.length===0&&a.length===0)return;let o=0,i=r.length-1,l=0,c=a.length-1,u=r[o],d=r[i],h=a[l],g=a[c],E,N;for(;o<=i&&l<=c;)if(u===void 0)u=r[++o];else if(d===void 0)d=r[--i];else if(V(u,h,n.mirror,s))u=r[++o],h=a[++l];else if(V(d,g,n.mirror,s))d=r[--i],g=a[--c];else if(V(u,g,n.mirror,s)){try{t.insertBefore(u,d.nextSibling)}catch(y){console.warn(y)}u=r[++o],g=a[--c]}else if(V(d,h,n.mirror,s)){try{t.insertBefore(d,u)}catch(y){console.warn(y)}d=r[--i],h=a[++l]}else{if(!E){E={};for(let v=o;v<=i;v++){const b=r[v];b&&n.mirror.hasNode(b)&&(E[n.mirror.getId(b)]=v)}}N=E[s.getId(h)];const y=r[N];if(N!==void 0&&y&&V(y,h,n.mirror,s)){try{t.insertBefore(y,u)}catch(v){console.warn(v)}r[N]=void 0}else{const v=et(h,n.mirror,s);t.nodeName==="#document"&&u&&(v.nodeType===v.DOCUMENT_TYPE_NODE&&u.nodeType===u.DOCUMENT_TYPE_NODE||v.nodeType===v.ELEMENT_NODE&&u.nodeType===u.ELEMENT_NODE)&&(t.removeChild(u),n.mirror.removeNodeFromMap(u),u=r[++o]);try{t.insertBefore(v,u||null)}catch(b){console.warn(b)}}h=a[++l]}if(o>i){const y=a[c+1];let v=null;for(y&&(v=n.mirror.getNode(s.getId(y)));l<=c;++l){const b=et(a[l],n.mirror,s);try{t.insertBefore(b,v)}catch(A){console.warn(A)}}}else if(l>c)for(;o<=i;o++){const y=r[o];if(!(!y||y.parentNode!==t))try{t.removeChild(y),n.mirror.removeNodeFromMap(y)}catch(v){console.warn(v)}}let S=t.firstChild,m=e.firstChild;for(;S!==null&&m!==null;)tt(S,m,n,s),S=S.nextSibling,m=m.nextSibling}function et(t,e,n){const s=n.getId(t),r=n.getMeta(t);let a=null;if(s>-1&&(a=e.getNode(s)),a!==null&&ft(a,t))return a;switch(t.RRNodeType){case T.Document:a=new Document;break;case T.DocumentType:a=document.implementation.createDocumentType(t.name,t.publicId,t.systemId);break;case T.Element:{let o=t.tagName.toLowerCase();o=We[o]||o,r&&"isSVG"in r&&r?.isSVG?a=document.createElementNS(pt.svg,o):a=document.createElement(t.tagName);break}case T.Text:a=document.createTextNode(t.data);break;case T.Comment:a=document.createComment(t.data);break;case T.CDATA:a=document.createCDATASection(t.data);break}r&&e.add(a,Object.assign({},r));try{P?.add(a)}catch{}return a}function ft(t,e){return t.nodeType!==e.nodeType?!1:t.nodeType!==t.ELEMENT_NODE||t.tagName.toUpperCase()===e.tagName}function V(t,e,n,s){const r=n.getId(t),a=s.getId(e);return r===-1||r!==a?!1:ft(t,e)}class W extends Be(_){get unserializedId(){return this._unserializedId--}constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=nn(),this.scrollData=null,e&&(this.mirror=e)}createDocument(e,n,s){return new W}createDocumentType(e,n,s){const r=new He(e,n,s);return r.ownerDocument=this,r}createElement(e){const n=e.toUpperCase();let s;switch(n){case"AUDIO":case"VIDEO":s=new ze(n);break;case"IFRAME":s=new qe(n,this.mirror);break;case"CANVAS":s=new Xe(n);break;case"STYLE":s=new Qe(n);break;default:s=new X(n);break}return s.ownerDocument=this,s}createComment(e){const n=new Ze(e);return n.ownerDocument=this,n}createCDATASection(e){const n=new Ke(e);return n.ownerDocument=this,n}createTextNode(e){const n=new Je(e);return n.ownerDocument=this,n}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const He=Ft(_);class X extends $t(_){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class ze extends Ue(X){}class Xe extends X{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class Qe extends X{constructor(){super(...arguments),this.rules=[]}}class qe extends X{constructor(e,n){super(e),this.contentDocument=new W,this.contentDocument.mirror=n}}const Je=Bt(_),Ze=Ut(_),Ke=Vt(_);function tn(t){return t instanceof HTMLFormElement?"FORM":t.tagName.toUpperCase()}function Yt(t,e,n,s){let r;switch(t.nodeType){case x.DOCUMENT_NODE:s&&s.nodeName==="IFRAME"?r=s.contentDocument:(r=e,r.compatMode=t.compatMode);break;case x.DOCUMENT_TYPE_NODE:{const o=t;r=e.createDocumentType(o.name,o.publicId,o.systemId);break}case x.ELEMENT_NODE:{const o=t,i=tn(o);r=e.createElement(i);const l=r;for(const{name:c,value:u}of Array.from(o.attributes))l.attributes[c]=u;o.scrollLeft&&(l.scrollLeft=o.scrollLeft),o.scrollTop&&(l.scrollTop=o.scrollTop);break}case x.TEXT_NODE:r=e.createTextNode(t.textContent||"");break;case x.CDATA_SECTION_NODE:r=e.createCDATASection(t.data);break;case x.COMMENT_NODE:r=e.createComment(t.textContent||"");break;case x.DOCUMENT_FRAGMENT_NODE:r=s.attachShadow({mode:"open"});break;default:return null}let a=n.getMeta(t);return e instanceof W&&(a||(a=Ht(r,e.unserializedId),n.add(t,a)),e.mirror.add(r,Object.assign({},a))),r}function en(t,e=ke(),n=new W){function s(r,a){const o=Yt(r,n,e,a);if(o!==null)if(a?.nodeName!=="IFRAME"&&r.nodeType!==x.DOCUMENT_FRAGMENT_NODE&&(a?.appendChild(o),o.parentNode=a,o.parentElement=a),r.nodeName==="IFRAME"){const i=r.contentDocument;i&&s(i,o)}else(r.nodeType===x.DOCUMENT_NODE||r.nodeType===x.ELEMENT_NODE||r.nodeType===x.DOCUMENT_FRAGMENT_NODE)&&(r.nodeType===x.ELEMENT_NODE&&r.shadowRoot&&s(r.shadowRoot,o),r.childNodes.forEach(i=>s(i,o)))}return s(t,null),n}function nn(){return new sn}class sn{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var n;if(!e)return-1;const s=(n=this.getMeta(e))===null||n===void 0?void 0:n.id;return s??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach(s=>this.removeNodeFromMap(s))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,n){const s=n.id;this.idNodeMap.set(s,e),this.nodeMetaMap.set(e,n)}replace(e,n){const s=this.getNode(e);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(n,r)}this.idNodeMap.set(e,n)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Ht(t,e){switch(t.RRNodeType){case T.Document:return{id:e,type:t.RRNodeType,childNodes:[]};case T.DocumentType:{const n=t;return{id:e,type:t.RRNodeType,name:n.name,publicId:n.publicId,systemId:n.systemId}}case T.Element:return{id:e,type:t.RRNodeType,tagName:t.tagName.toLowerCase(),attributes:{},childNodes:[]};case T.Text:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case T.Comment:return{id:e,type:t.RRNodeType,textContent:t.textContent||""};case T.CDATA:return{id:e,type:t.RRNodeType,textContent:""}}}function zt(t){return{all:t=t||new Map,on:function(e,n){var s=t.get(e);s?s.push(n):t.set(e,[n])},off:function(e,n){var s=t.get(e);s&&(n?s.splice(s.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var s=t.get(e);s&&s.slice().map(function(r){r(n)}),(s=t.get("*"))&&s.slice().map(function(r){r(e,n)})}}}var on=Object.freeze({__proto__:null,default:zt});function rn(t=window,e=document){if("scrollBehavior"in e.documentElement.style&&t.__forceSmoothScrollPolyfill__!==!0)return;const n=t.HTMLElement||t.Element,s=468,r={scroll:t.scroll||t.scrollTo,scrollBy:t.scrollBy,elementScroll:n.prototype.scroll||l,scrollIntoView:n.prototype.scrollIntoView},a=t.performance&&t.performance.now?t.performance.now.bind(t.performance):Date.now;function o(m){const y=["MSIE ","Trident/","Edge/"];return new RegExp(y.join("|")).test(m)}const i=o(t.navigator.userAgent)?1:0;function l(m,y){this.scrollLeft=m,this.scrollTop=y}function c(m){return .5*(1-Math.cos(Math.PI*m))}function u(m){if(m===null||typeof m!="object"||m.behavior===void 0||m.behavior==="auto"||m.behavior==="instant")return!0;if(typeof m=="object"&&m.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+m.behavior+" is not a valid value for enumeration ScrollBehavior.")}function d(m,y){if(y==="Y")return m.clientHeight+i<m.scrollHeight;if(y==="X")return m.clientWidth+i<m.scrollWidth}function h(m,y){const v=t.getComputedStyle(m,null)["overflow"+y];return v==="auto"||v==="scroll"}function g(m){const y=d(m,"Y")&&h(m,"Y"),v=d(m,"X")&&h(m,"X");return y||v}function E(m){for(;m!==e.body&&g(m)===!1;)m=m.parentNode||m.host;return m}function N(m){const y=a();let v,b,A,L=(y-m.startTime)/s;L=L>1?1:L,v=c(L),b=m.startX+(m.x-m.startX)*v,A=m.startY+(m.y-m.startY)*v,m.method.call(m.scrollable,b,A),(b!==m.x||A!==m.y)&&t.requestAnimationFrame(N.bind(t,m))}function S(m,y,v){let b,A,L,U;const J=a();m===e.body?(b=t,A=t.scrollX||t.pageXOffset,L=t.scrollY||t.pageYOffset,U=r.scroll):(b=m,A=m.scrollLeft,L=m.scrollTop,U=l),N({scrollable:b,method:U,startTime:J,startX:A,startY:L,x:y,y:v})}t.scroll=t.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){r.scroll.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:t.scrollY||t.pageYOffset);return}S.call(t,e.body,arguments[0].left!==void 0?~~arguments[0].left:t.scrollX||t.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:t.scrollY||t.pageYOffset)}},t.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){r.scrollBy.call(t,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}S.call(t,e.body,~~arguments[0].left+(t.scrollX||t.pageXOffset),~~arguments[0].top+(t.scrollY||t.pageYOffset))}},n.prototype.scroll=n.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");r.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const m=arguments[0].left,y=arguments[0].top;S.call(this,this,typeof m>"u"?this.scrollLeft:~~m,typeof y>"u"?this.scrollTop:~~y)},n.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){r.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},n.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){r.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const m=E(this),y=m.getBoundingClientRect(),v=this.getBoundingClientRect();m!==e.body?(S.call(this,m,m.scrollLeft+v.left-y.left,m.scrollTop+v.top-y.top),t.getComputedStyle(m).position!=="fixed"&&t.scrollBy({left:y.left,top:y.top,behavior:"smooth"})):t.scrollBy({left:v.left,top:v.top,behavior:"smooth"})}}var R=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(R||{}),w=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(w||{}),I=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(I||{}),an=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(an||{}),nt=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(nt||{}),st=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(st||{}),D=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t.Destroy="destroy",t))(D||{});class ln{constructor(e=[],n){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=n.speed}addAction(e){const n=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const s=this.findActionIndex(e);this.actions.splice(s,0,e)}n&&(this.raf=requestAnimationFrame(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=requestAnimationFrame(this.rafCheck.bind(this))}rafCheck(){const e=performance.now();for(this.timeOffset+=(e-this.lastTimestamp)*this.speed,this.lastTimestamp=e;this.actions.length;){const n=this.actions[0];if(this.timeOffset>=n.delay)this.actions.shift(),n.doAction();else break}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return this.raf!==null}findActionIndex(e){let n=0,s=this.actions.length-1;for(;n<=s;){const r=Math.floor((n+s)/2);if(this.actions[r].delay<e.delay)n=r+1;else if(this.actions[r].delay>e.delay)s=r-1;else return r+1}return n}}function Xt(t,e){if(t.type===R.IncrementalSnapshot&&t.data.source===w.MouseMove&&t.data.positions&&t.data.positions.length){const n=t.data.positions[0].timeOffset,s=t.timestamp+n;return t.delay=s-e,s-e}return t.delay=t.timestamp-e,t.delay}/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function Qt(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s,r,a=n.call(t),o=[];try{for(;(e===void 0||e-- >0)&&!(s=a.next()).done;)o.push(s.value)}catch(i){r={error:i}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o}var j;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(j||(j={}));var qt={type:"xstate.init"};function gt(t){return t===void 0?[]:[].concat(t)}function G(t){return{type:"xstate.assign",assignment:t}}function Jt(t,e){return typeof(t=typeof t=="string"&&e&&e[t]?e[t]:t)=="string"?{type:t}:typeof t=="function"?{type:t.name,exec:t}:t}function ot(t){return function(e){return t===e}}function Zt(t){return typeof t=="string"?{type:t}:t}function Kt(t,e){return{value:t,context:e,actions:[],changed:!1,matches:ot(t)}}function te(t,e,n){var s=e,r=!1;return[t.filter(function(a){if(a.type==="xstate.assign"){r=!0;var o=Object.assign({},s);return typeof a.assignment=="function"?o=a.assignment(s,n):Object.keys(a.assignment).forEach(function(i){o[i]=typeof a.assignment[i]=="function"?a.assignment[i](s,n):a.assignment[i]}),s=o,!1}return!0}),s,r]}function ee(t,e){e===void 0&&(e={});var n=Qt(te(gt(t.states[t.initial].entry).map(function(o){return Jt(o,e.actions)}),t.context,qt),2),s=n[0],r=n[1],a={config:t,_options:e,initialState:{value:t.initial,actions:s,context:r,matches:ot(t.initial)},transition:function(o,i){var l,c,u=typeof o=="string"?{value:o,context:t.context}:o,d=u.value,h=u.context,g=Zt(i),E=t.states[d];if(E.on){var N=gt(E.on[g.type]);try{for(var S=function(O){var K=typeof Symbol=="function"&&Symbol.iterator,f=K&&O[K],p=0;if(f)return f.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&p>=O.length&&(O=void 0),{value:O&&O[p++],done:!O}}};throw new TypeError(K?"Object is not iterable.":"Symbol.iterator is not defined.")}(N),m=S.next();!m.done;m=S.next()){var y=m.value;if(y===void 0)return Kt(d,h);var v=typeof y=="string"?{target:y}:y,b=v.target,A=v.actions,L=A===void 0?[]:A,U=v.cond,J=U===void 0?function(){return!0}:U,bt=b===void 0,wt=b??d,Dt=t.states[wt];if(J(h,g)){var Z=Qt(te((bt?gt(L):[].concat(E.exit,L,Dt.entry).filter(function(O){return O})).map(function(O){return Jt(O,a._options.actions)}),h,g),3),lt=Z[0],Mt=Z[1],Ct=Z[2],H=b??d;return{value:H,context:Mt,actions:lt,changed:b!==d||lt.length>0||Ct,matches:ot(H)}}}}catch(O){l={error:O}}finally{try{m&&!m.done&&(c=S.return)&&c.call(S)}finally{if(l)throw l.error}}}return Kt(d,h)}};return a}var ne=function(t,e){return t.actions.forEach(function(n){var s=n.exec;return s&&s(t.context,e)})};function se(t){var e=t.initialState,n=j.NotStarted,s=new Set,r={_machine:t,send:function(a){n===j.Running&&(e=t.transition(e,a),ne(e,Zt(a)),s.forEach(function(o){return o(e)}))},subscribe:function(a){return s.add(a),a(e),{unsubscribe:function(){return s.delete(a)}}},start:function(a){if(a){var o=typeof a=="object"?a:{context:t.config.context,value:a};e={value:o.value,actions:[],context:o.context,matches:ot(o.value)}}return n=j.Running,ne(e,qt),r},stop:function(){return n=j.Stopped,s.clear(),r},get state(){return e},get status(){return n}};return r}var cn=Object.defineProperty,un=Object.defineProperties,dn=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,hn=Object.prototype.hasOwnProperty,mn=Object.prototype.propertyIsEnumerable,ie=(t,e,n)=>e in t?cn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yt=(t,e)=>{for(var n in e||(e={}))hn.call(e,n)&&ie(t,n,e[n]);if(oe)for(var n of oe(e))mn.call(e,n)&&ie(t,n,e[n]);return t},vt=(t,e)=>un(t,dn(e));function pn(t,e){for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.type===R.Meta&&s.timestamp<=e)return t.slice(n)}return t}function fn(t,{getCastFn:e,applyEventsSynchronously:n,emitter:s}){const r=ee({id:"player",context:t,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:G({lastPlayedEvent:(a,o)=>o.type==="CAST_EVENT"?o.payload.event:a.lastPlayedEvent}),recordTimeOffset:G((a,o)=>{let i=a.timeOffset;return"payload"in o&&"timeOffset"in o.payload&&(i=o.payload.timeOffset),vt(yt({},a),{timeOffset:i,baselineTime:a.events[0].timestamp+i})}),play(a){var o;const{timer:i,events:l,baselineTime:c,lastPlayedEvent:u}=a;i.clear();for(const E of l)Xt(E,c);const d=pn(l,c);let h=u?.timestamp;u?.type===R.IncrementalSnapshot&&u.data.source===w.MouseMove&&(h=u.timestamp+((o=u.data.positions[0])==null?void 0:o.timeOffset)),c<(h||0)&&s.emit(D.PlayBack);const g=new Array;for(const E of d)if(!(h&&h<c&&(E.timestamp<=h||E===u)))if(E.timestamp<c)g.push(E);else{const N=e(E,!1);i.addAction({doAction:()=>{N()},delay:E.delay})}n(g),s.emit(D.Flush),i.start()},pause(a){a.timer.clear()},resetLastPlayedEvent:G(a=>vt(yt({},a),{lastPlayedEvent:null})),startLive:G({baselineTime:(a,o)=>(a.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),addEvent:G((a,o)=>{const{baselineTime:i,timer:l,events:c}=a;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;Xt(u,i);let d=c.length-1;if(!c[d]||c[d].timestamp<=u.timestamp)c.push(u);else{let E=-1,N=0;for(;N<=d;){const S=Math.floor((N+d)/2);c[S].timestamp<=u.timestamp?N=S+1:d=S-1}E===-1&&(E=N),c.splice(E,0,u)}const h=u.timestamp<i,g=e(u,h);h?g():l.isActive()&&l.addAction({doAction:()=>{g()},delay:u.delay})}return vt(yt({},a),{events:c})})}});return se(r)}function gn(t){const e=ee({id:"speed",context:t,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:(n,s)=>{"payload"in s&&n.timer.setSpeed(s.payload.speed)},recordSpeed:G({normalSpeed:n=>n.timer.speed}),restoreSpeed:n=>{n.timer.setSpeed(n.normalSpeed)}}});return se(e)}const Y=`Please stop import mirror directly. Instead of that,\r now you can use replayer.getMirror() to access the mirror instance of a replayer,\r or you can use record.mirror to access the mirror instance during recording.`;let re={map:{},getId(){return console.error(Y),-1},getNode(){return console.error(Y),null},removeNodeFromMap(){console.error(Y)},has(){return console.error(Y),!1},reset(){console.error(Y)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(re=new Proxy(re,{get(t,e,n){return e==="map"&&console.error(Y),Reflect.get(t,e,n)}})),/[1-9][0-9]{12}/.test(Date.now().toString());function yn(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let n=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function vn(t){const e={},n=(r,a)=>{const o={value:r,parent:a,children:[]};return e[r.node.id]=o,o},s=[];for(const r of t){const{nextId:a,parentId:o}=r;if(a&&a in e){const i=e[a];if(i.parent){const l=i.parent.children.indexOf(i);i.parent.children.splice(l,0,n(r,i.parent))}else{const l=s.indexOf(i);s.splice(l,0,n(r,null))}continue}if(o in e){const i=e[o];i.children.push(n(r,i));continue}s.push(n(r,null))}return s}function ae(t,e){e(t.value);for(let n=t.children.length-1;n>=0;n--)ae(t.children[n],e)}function Et(t,e){return Boolean(t.nodeName==="IFRAME"&&e.getMeta(t))}function le(t,e){var n,s;const r=(s=(n=t.ownerDocument)==null?void 0:n.defaultView)==null?void 0:s.frameElement;if(!r||r===e)return{x:0,y:0,relativeScale:1,absoluteScale:1};const a=r.getBoundingClientRect(),o=le(r,e),i=a.height/r.clientHeight;return{x:a.x*o.relativeScale+o.x,y:a.y*o.relativeScale+o.y,relativeScale:i,absoluteScale:o.absoluteScale*i}}function it(t){return Boolean(t?.shadowRoot)}function Q(t,e){const n=t[e[0]];return e.length===1?n:Q(n.cssRules[e[1]].cssRules,e.slice(2))}function ce(t){const e=[...t],n=e.pop();return{positions:e,index:n}}function En(t){const e=new Set,n=[];for(let s=t.length;s--;){const r=t[s];e.has(r.id)||(n.push(r),e.add(r.id))}return n}class Nn{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var n;return(n=this.styleIDMap.get(e))!=null?n:-1}has(e){return