@amplitude/rrweb-player 2.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,140 @@
1
+ _Looking for a Vue.js version? Go here --> [@preflight-hq/rrweb-player-vue](https://github.com/Preflight-HQ/rrweb-player-vue)_
2
+
3
+ ---
4
+
5
+ # rrweb-player
6
+
7
+ Since rrweb's replayer only provides a basic UI, you can choose rrweb-replayer which is based on rrweb's public APIs but has a feature-rich replayer UI.
8
+
9
+ ## How is this different from `rrweb.Replayer`?
10
+
11
+ rrweb-player uses rrweb's Replayer under the hood, but as Replayer doesn't include any UI for controls, rrweb-player adds those.
12
+
13
+ ## Installation
14
+
15
+ rrweb-player can also be included with `<script>`:
16
+
17
+ ```html
18
+ <link
19
+ rel="stylesheet"
20
+ href="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css"
21
+ />
22
+ <script src="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/index.js"></script>
23
+ ```
24
+
25
+ Or installed by using NPM:
26
+
27
+ ```shell
28
+ npm install --save rrweb-player
29
+ ```
30
+
31
+ ```js
32
+ import rrwebPlayer from 'rrweb-player';
33
+ import 'rrweb-player/dist/style.css';
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```js
39
+ new rrwebPlayer({
40
+ target: document.body, // customizable root element
41
+ props: {
42
+ events,
43
+ },
44
+ });
45
+ ```
46
+
47
+ ## Options
48
+
49
+ | key | default | description |
50
+ | -------------- | ------------ | ------------------------------------------------------------------------------------------------------------------- |
51
+ | events | [] | the events for replaying |
52
+ | width | 1024 | the width of the replayer |
53
+ | height | 576 | the height of the replayer |
54
+ | maxScale | 1 | the maximum scale of the replayer (1 = 100%), set to 0 for unlimited |
55
+ | autoPlay | true | whether to autoplay |
56
+ | speed | 1 | The default speed to play at |
57
+ | speedOption | [1, 2, 4, 8] | speed options in UI |
58
+ | showController | true | whether to show the controller UI |
59
+ | tags | {} | customize the custom events style with a key-value map |
60
+ | inactiveColor | #D4D4D4 | Customize the color of inactive periods indicator in the progress bar with a valid CSS color string. |
61
+ | ... | - | all the [rrweb Replayer options](https://github.com/rrweb-io/rrweb/blob/master/guide.md#options-1) will be bypassed |
62
+
63
+ ## methods on the rrwebPlayer component
64
+
65
+ ```ts
66
+ addEventListener(event: string, handler: (params: any) => unknown): void;
67
+ ```
68
+
69
+ ```ts
70
+ addEvent(event: eventWithTime): void;
71
+ ```
72
+
73
+ ```ts
74
+ getMetaData() => {
75
+ startTime: number;
76
+ endTime: number;
77
+ totalTime: number;
78
+ }
79
+ ```
80
+
81
+ ```ts
82
+ getReplayer() => Replayer;
83
+ ```
84
+
85
+ ```ts
86
+ getMirror() => Mirror;
87
+ ```
88
+
89
+ Toggles between play/pause
90
+
91
+ ```ts
92
+ toggle();
93
+ ```
94
+
95
+ Sets speed of player
96
+
97
+ ```ts
98
+ setSpeed(speed: number)
99
+ ```
100
+
101
+ Turns on/off skip inactive
102
+
103
+ ```ts
104
+ toggleSkipInactive();
105
+ ```
106
+
107
+ Triggers resize, do this whenever you change width/height
108
+
109
+ ```ts
110
+ triggerResize();
111
+ ```
112
+
113
+ Plays replay
114
+
115
+ ```ts
116
+ play();
117
+ ```
118
+
119
+ Pauses replay
120
+
121
+ ```ts
122
+ pause();
123
+ ```
124
+
125
+ Go to a point in time and pause or play from then
126
+
127
+ ```ts
128
+ goto(timeOffset: number, play?: boolean)
129
+ ```
130
+
131
+ Plays from a time to a time and (optionally) loop
132
+
133
+ ```ts
134
+ playRange(
135
+ timeOffset: number,
136
+ endTimeOffset: number,
137
+ startLooping: boolean = false,
138
+ afterHook: undefined | (() => void) = undefined,
139
+ )
140
+ ```
package/dist/index.js ADDED
@@ -0,0 +1,30 @@
1
+ var rrwebPlayer=function(){"use strict";function e(){}function t(e,t){for(const n in t)e[n]=t[n];return e}function n(e){return e()}function i(){return Object.create(null)}function o(e){e.forEach(n)}function r(e){return"function"==typeof e}function s(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function a(e){const t={};for(const n in e)"$"!==n[0]&&(t[n]=e[n]);return t}function l(e,t){e.appendChild(t)}function c(e,t,n){e.insertBefore(t,n||null)}function u(e){e.parentNode&&e.parentNode.removeChild(e)}function d(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function h(e){return document.createElement(e)}function p(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function f(e){return document.createTextNode(e)}function m(){return f(" ")}function g(e,t,n,i){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}function v(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function y(e,t){t=""+t,e.data!==t&&(e.data=t)}function w(e,t,n,i){null==n?e.style.removeProperty(t):e.style.setProperty(t,n,i?"important":"")}function b(e,t,n){e.classList[n?"add":"remove"](t)}let E;function N(e){E=e}function S(){if(!E)throw new Error("Function called outside component initialization");return E}function T(e){S().$$.on_mount.push(e)}function D(e){S().$$.on_destroy.push(e)}function M(){const e=S();return(t,n,{cancelable:i=!1}={})=>{const o=e.$$.callbacks[t];if(o){const r=function(e,t,{bubbles:n=!1,cancelable:i=!1}={}){const o=document.createEvent("CustomEvent");return o.initCustomEvent(e,n,i,t),o}(t,n,{cancelable:i});return o.slice().forEach((t=>{t.call(e,r)})),!r.defaultPrevented}return!0}}const C=[],x=[];let R=[];const k=[],A=Promise.resolve();let I=!1;function O(e){R.push(e)}const _=new Set;let $=0;function L(){if(0!==$)return;const e=E;do{try{for(;$<C.length;){const e=C[$];$++,N(e),F(e.$$)}}catch(e){throw C.length=0,$=0,e}for(N(null),C.length=0,$=0;x.length;)x.pop()();for(let e=0;e<R.length;e+=1){const t=R[e];_.has(t)||(_.add(t),t())}R.length=0}while(C.length);for(;k.length;)k.pop()();I=!1,_.clear(),N(e)}function F(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(O)}}const P=new Set;let B;function U(){B={r:0,c:[],p:B}}function j(){B.r||o(B.c),B=B.p}function V(e,t){e&&e.i&&(P.delete(e),e.i(t))}function W(e,t,n,i){if(e&&e.o){if(P.has(e))return;P.add(e),B.c.push((()=>{P.delete(e),i&&(n&&e.d(1),i())})),e.o(t)}else i&&i()}function z(e){e&&e.c()}function G(e,t,i,s){const{fragment:a,after_update:l}=e.$$;a&&a.m(t,i),s||O((()=>{const t=e.$$.on_mount.map(n).filter(r);e.$$.on_destroy?e.$$.on_destroy.push(...t):o(t),e.$$.on_mount=[]})),l.forEach(O)}function H(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];R.forEach((i=>-1===e.indexOf(i)?t.push(i):n.push(i))),n.forEach((e=>e())),R=t}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Y(e,t){-1===e.$$.dirty[0]&&(C.push(e),I||(I=!0,A.then(L)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function q(t,n,r,s,a,l,c,d=[-1]){const h=E;N(t);const p=t.$$={fragment:null,ctx:[],props:l,update:e,not_equal:a,bound:i(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(n.context||(h?h.$$.context:[])),callbacks:i(),dirty:d,skip_bound:!1,root:n.target||h.$$.root};c&&c(p.root);let f=!1;if(p.ctx=r?r(t,n.props||{},((e,n,...i)=>{const o=i.length?i[0]:n;return p.ctx&&a(p.ctx[e],p.ctx[e]=o)&&(!p.skip_bound&&p.bound[e]&&p.bound[e](o),f&&Y(t,e)),n})):[],p.update(),f=!0,o(p.before_update),p.fragment=!!s&&s(p.ctx),n.target){if(n.hydrate){const e=function(e){return Array.from(e.childNodes)}(n.target);p.fragment&&p.fragment.l(e),e.forEach(u)}else p.fragment&&p.fragment.c();n.intro&&V(t.$$.fragment),G(t,n.target,n.anchor,n.customElement),L()}N(h)}class X{$destroy(){H(this,1),this.$destroy=e}$on(t,n){if(!r(n))return e;const i=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return i.push(n),()=>{const e=i.indexOf(n);-1!==e&&i.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}var Q;!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"}(Q||(Q={}));var J=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Z(){return new J}var K=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function ee(e,t){void 0===t&&(t={});var n=1,i=1;function o(e){var t=e.match(/\n/g);t&&(n+=t.length);var o=e.lastIndexOf("\n");i=-1===o?i+e.length:e.length-o}function r(){var e={line:n,column:i};return function(t){return t.position=new s(e),p(),t}}var s=function(e){this.start=e,this.end={line:n,column:i},this.source=t.source};s.prototype.content=e;var a=[];function l(o){var r=new Error("".concat(t.source||"",":").concat(n,":").concat(i,": ").concat(o));if(r.reason=o,r.filename=t.source,r.line=n,r.column=i,r.source=e,!t.silent)throw r;a.push(r)}function c(){return h(/^{\s*/)}function u(){return h(/^}/)}function d(){var t,n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=D()||M());)t&&(n.push(t),f(n));return n}function h(t){var n=t.exec(e);if(n){var i=n[0];return o(i),e=e.slice(i.length),n}}function p(){h(/^\s*/)}function f(e){var t;for(void 0===e&&(e=[]);t=m();)t&&e.push(t),t=m();return e}function m(){var t=r();if("/"===e.charAt(0)&&"*"===e.charAt(1)){for(var n=2;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return l("End of comment missing");var s=e.slice(2,n-2);return i+=2,o(s),e=e.slice(n),i+=2,t({type:"comment",comment:s})}}function g(){var e=h(/^([^{]+)/);if(e)return te(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function v(){var e=r(),t=h(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(t){var n=te(t[0]);if(!h(/^:\s*/))return l("property missing ':'");var i=h(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:n.replace(K,""),value:i?te(i[0]).replace(K,""):""});return h(/^[;\s]*/),o}}function y(){var e,t=[];if(!c())return l("missing '{'");for(f(t);e=v();)!1!==e&&(t.push(e),f(t)),e=v();return u()?t:l("missing '}'")}function w(){for(var e,t=[],n=r();e=h(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),h(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:y()})}var b,E=T("import"),N=T("charset"),S=T("namespace");function T(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var n=r(),i=h(t);if(i){var o={type:e};return o[e]=i[1].trim(),n(o)}}}function D(){if("@"===e[0])return function(){var e=r(),t=h(/^@([-\w]+)?keyframes\s*/);if(t){var n=t[1];if(!(t=h(/^([-\w]+)\s*/)))return l("@keyframes missing name");var i,o=t[1];if(!c())return l("@keyframes missing '{'");for(var s=f();i=w();)s.push(i),s=s.concat(f());return u()?e({type:"keyframes",name:o,vendor:n,keyframes:s}):l("@keyframes missing '}'")}}()||function(){var e=r(),t=h(/^@media *([^{]+)/);if(t){var n=te(t[1]);if(!c())return l("@media missing '{'");var i=f().concat(d());return u()?e({type:"media",media:n,rules:i}):l("@media missing '}'")}}()||function(){var e=r(),t=h(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:te(t[1]),media:te(t[2])})}()||function(){var e=r(),t=h(/^@supports *([^{]+)/);if(t){var n=te(t[1]);if(!c())return l("@supports missing '{'");var i=f().concat(d());return u()?e({type:"supports",supports:n,rules:i}):l("@supports missing '}'")}}()||E()||N()||S()||function(){var e=r(),t=h(/^@([-\w]+)?document *([^{]+)/);if(t){var n=te(t[1]),i=te(t[2]);if(!c())return l("@document missing '{'");var o=f().concat(d());return u()?e({type:"document",document:i,vendor:n,rules:o}):l("@document missing '}'")}}()||function(){var e=r();if(h(/^@page */)){var t=g()||[];if(!c())return l("@page missing '{'");for(var n,i=f();n=v();)i.push(n),i=i.concat(f());return u()?e({type:"page",selectors:t,declarations:i}):l("@page missing '}'")}}()||function(){var e=r();if(h(/^@host\s*/)){if(!c())return l("@host missing '{'");var t=f().concat(d());return u()?e({type:"host",rules:t}):l("@host missing '}'")}}()||function(){var e=r();if(h(/^@font-face\s*/)){if(!c())return l("@font-face missing '{'");for(var t,n=f();t=v();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):l("@font-face missing '}'")}}()}function M(){var e=r(),t=g();return t?(f(),e({type:"rule",selectors:t,declarations:y()})):l("selector missing")}return ne((b=d(),{type:"stylesheet",stylesheet:{source:t.source,rules:b,parsingErrors:a}}))}function te(e){return e?e.replace(/^\s+|\s+$/g,""):""}function ne(e,t){for(var n=e&&"string"==typeof e.type,i=n?e:t,o=0,r=Object.keys(e);o<r.length;o++){var s=e[r[o]];Array.isArray(s)?s.forEach((function(e){ne(e,i)})):s&&"object"==typeof s&&ne(s,i)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var ie={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"};var oe=/([^\\]):hover/,re=new RegExp(oe.source,"g");function se(e,t){var n=null==t?void 0:t.stylesWithHoverClass.get(e);if(n)return n;var i=ee(e,{silent:!0});if(!i.stylesheet)return e;var o=[];if(i.stylesheet.rules.forEach((function(e){"selectors"in e&&(e.selectors||[]).forEach((function(e){oe.test(e)&&o.push(e)}))})),0===o.length)return e;var r=new RegExp(o.filter((function(e,t){return o.indexOf(e)===t})).sort((function(e,t){return t.length-e.length})).map((function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})).join("|"),"g"),s=e.replace(r,(function(e){var t=e.replace(re,"$1.\\:hover");return"".concat(e,", ").concat(t)}));return null==t||t.stylesWithHoverClass.set(e,s),s}function ae(){return{stylesWithHoverClass:new Map}}function le(e,t){var n=t.doc,i=t.hackCss,o=t.cache;switch(e.type){case Q.Document:return n.implementation.createDocument(null,"",null);case Q.DocumentType:return n.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case Q.Element:var r,s=function(e){var t=ie[e.tagName]?ie[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(e);r=e.isSVG?n.createElementNS("http://www.w3.org/2000/svg",s):n.createElement(s);var a={};for(var l in e.attributes)if(Object.prototype.hasOwnProperty.call(e.attributes,l)){var c=e.attributes[l];if(("option"!==s||"selected"!==l||!1!==c)&&null!==c)if(!0===c&&(c=""),l.startsWith("rr_"))a[l]=c;else{var u="textarea"===s&&"value"===l,d="style"===s&&"_cssText"===l;if(d&&i&&"string"==typeof c&&(c=se(c,o)),!u&&!d||"string"!=typeof c)try{if(e.isSVG&&"xlink:href"===l)r.setAttributeNS("http://www.w3.org/1999/xlink",l,c.toString());else if("onload"===l||"onclick"===l||"onmouse"===l.substring(0,7))r.setAttribute("_"+l,c.toString());else{if("meta"===s&&"Content-Security-Policy"===e.attributes["http-equiv"]&&"content"===l){r.setAttribute("csp-content",c.toString());continue}("link"!==s||"preload"!==e.attributes.rel&&"modulepreload"!==e.attributes.rel||"script"!==e.attributes.as)&&("link"===s&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&e.attributes.href.endsWith(".js")||("img"===s&&e.attributes.srcset&&e.attributes.rr_dataURL?r.setAttribute("rrweb-original-srcset",e.attributes.srcset):r.setAttribute(l,c.toString())))}}catch(e){}else{for(var h=n.createTextNode(c),p=0,f=Array.from(r.childNodes);p<f.length;p++){var m=f[p];m.nodeType===r.TEXT_NODE&&r.removeChild(m)}r.appendChild(h)}}}var g=function(t){var n=a[t];if("canvas"===s&&"rr_dataURL"===t){var i=document.createElement("img");i.onload=function(){var e=r.getContext("2d");e&&e.drawImage(i,0,0,i.width,i.height)},i.src=n.toString(),r.RRNodeType&&(r.rr_dataURL=n.toString())}else if("img"===s&&"rr_dataURL"===t){var o=r;o.currentSrc.startsWith("data:")||(o.setAttribute("rrweb-original-src",e.attributes.src),o.src=n.toString())}if("rr_width"===t)r.style.width=n.toString();else if("rr_height"===t)r.style.height=n.toString();else if("rr_mediaCurrentTime"===t&&"number"==typeof n)r.currentTime=n;else if("rr_mediaState"===t)switch(n){case"played":r.play().catch((function(e){return console.warn("media playback error",e)}));break;case"paused":r.pause()}};for(var v in a)g(v);if(e.isShadowHost)if(r.shadowRoot)for(;r.shadowRoot.firstChild;)r.shadowRoot.removeChild(r.shadowRoot.firstChild);else r.attachShadow({mode:"open"});return r;case Q.Text:return n.createTextNode(e.isStyle&&i?se(e.textContent,o):e.textContent);case Q.CDATA:return n.createCDATASection(e.textContent);case Q.Comment:return n.createComment(e.textContent);default:return null}}function ce(e,t){var n=t.doc,i=t.mirror,o=t.skipChild,r=void 0!==o&&o,s=t.hackCss,a=void 0===s||s,l=t.afterAppend,c=t.cache;if(i.has(e.id)){var u=i.getNode(e.id);if(function(e,t){return!(!e||!t||e.type!==t.type)&&(e.type===Q.Document?e.compatMode===t.compatMode:e.type===Q.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===Q.Comment||e.type===Q.Text||e.type===Q.CDATA?e.textContent===t.textContent:e.type===Q.Element&&e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock)}(i.getMeta(u),e))return i.getNode(e.id)}var d=le(e,{doc:n,hackCss:a,cache:c});if(!d)return null;if(e.rootId&&i.getNode(e.rootId)!==n&&i.replace(e.rootId,n),e.type===Q.Document&&(n.close(),n.open(),"BackCompat"===e.compatMode&&e.childNodes&&e.childNodes[0].type!==Q.DocumentType&&(e.childNodes[0].type===Q.Element&&"xmlns"in e.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===e.childNodes[0].attributes.xmlns?n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):n.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),d=n),i.add(d,e),(e.type===Q.Document||e.type===Q.Element)&&!r)for(var h=function(t){var o=ce(t,{doc:n,mirror:i,skipChild:!1,hackCss:a,afterAppend:l,cache:c});if(!o)return console.warn("Failed to rebuild",t),"continue";if(t.isShadow&&function(e){return e.nodeType===e.ELEMENT_NODE}(d)&&d.shadowRoot)d.shadowRoot.appendChild(o);else if(e.type===Q.Document&&t.type==Q.Element){var r=o,s=null;r.childNodes.forEach((function(e){"BODY"===e.nodeName&&(s=e)})),s?(r.removeChild(s),d.appendChild(o),r.appendChild(s)):d.appendChild(o)}else d.appendChild(o);l&&l(o,t.id)},p=0,f=e.childNodes;p<f.length;p++){h(f[p])}return d}function ue(e,t){var n=t.doc,i=t.onVisit,o=t.hackCss,r=void 0===o||o,s=t.afterAppend,a=t.cache,l=t.mirror,c=void 0===l?new J:l,u=ce(e,{doc:n,mirror:c,skipChild:!1,hackCss:r,afterAppend:s,cache:a});return function(e,t){for(var n=0,i=e.getIds();n<i.length;n++){var o=i[n];e.has(o)&&t(e.getNode(o))}}(c,(function(e){i&&i(e),function(e,t){var n=t.getMeta(e);if((null==n?void 0:n.type)===Q.Element){var i=e;for(var o in n.attributes)if(Object.prototype.hasOwnProperty.call(n.attributes,o)&&o.startsWith("rr_")){var r=n.attributes[o];"rr_scrollLeft"===o&&(i.scrollLeft=r),"rr_scrollTop"===o&&(i.scrollTop=r)}}}(e,c)})),u}var de=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(de||{}),he=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))(he||{}),pe=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(pe||{}),fe=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(fe||{}),me=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e))(me||{});const ge="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let ve={map:{},getId:()=>(console.error(ge),-1),getNode:()=>(console.error(ge),null),removeNodeFromMap(){console.error(ge)},has:()=>(console.error(ge),!1),reset(){console.error(ge)}};function ye(e){const t={},n=(e,n)=>{const i={value:e,parent:n,children:[]};return t[e.node.id]=i,i},i=[];for(const o of e){const{nextId:e,parentId:r}=o;if(e&&e in t){const r=t[e];if(r.parent){const e=r.parent.children.indexOf(r);r.parent.children.splice(e,0,n(o,r.parent))}else{const e=i.indexOf(r);i.splice(e,0,n(o,null))}}else if(r in t){const e=t[r];e.children.push(n(o,e))}else i.push(n(o,null))}return i}function we(e,t){t(e.value);for(let n=e.children.length-1;n>=0;n--)we(e.children[n],t)}function be(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Ee(e,t){var n,i;const o=null===(i=null===(n=e.ownerDocument)||void 0===n?void 0:n.defaultView)||void 0===i?void 0:i.frameElement;if(!o||o===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const r=o.getBoundingClientRect(),s=Ee(o,t),a=r.height/o.clientHeight;return{x:r.x*s.relativeScale+s.x,y:r.y*s.relativeScale+s.y,relativeScale:a,absoluteScale:s.absoluteScale*a}}function Ne(e){return Boolean(null==e?void 0:e.shadowRoot)}function Se(e,t){const n=e[t[0]];return 1===t.length?n:Se(n.cssRules[t[1]].cssRules,t.slice(2))}function Te(e){const t=[...e],n=t.pop();return{positions:t,index:n}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(ve=new Proxy(ve,{get:(e,t,n)=>("map"===t&&console.error(ge),Reflect.get(e,t,n))})),/[1-9][0-9]{12}/.test(Date.now().toString());class De{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */function Me(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))}for(var Ce="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xe="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Re=0;Re<Ce.length;Re++)xe[Ce.charCodeAt(Re)]=Re;var ke;Z(),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"}(ke||(ke={}));var Ae=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(e){var t;if(!e)return-1;var n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-1},e.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},e.prototype.removeNodeFromMap=function(e){var t=this,n=this.getId(e);this.idNodeMap.delete(n),e.childNodes&&e.childNodes.forEach((function(e){return t.removeNodeFromMap(e)}))},e.prototype.has=function(e){return this.idNodeMap.has(e)},e.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},e.prototype.add=function(e,t){var n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)},e.prototype.replace=function(e,t){var n=this.getNode(e);if(n){var i=this.nodeMetaMap.get(n);i&&this.nodeMetaMap.set(t,i)}this.idNodeMap.set(e,t)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Ie(e){const t=[];for(const n in e){const i=e[n];if("string"!=typeof i)continue;const o=Fe(n);t.push(`${o}: ${i};`)}return t.join(" ")}const Oe=/-([a-z])/g,_e=/^--[a-zA-Z0-9-]+$/,$e=e=>_e.test(e)?e:e.replace(Oe,((e,t)=>t?t.toUpperCase():"")),Le=/\B([A-Z])/g,Fe=e=>e.replace(Le,"-$1").toLowerCase();class Pe{constructor(...e){this.parentElement=null,this.parentNode=null,this.firstChild=null,this.lastChild=null,this.previousSibling=null,this.nextSibling=null,this.ELEMENT_NODE=qe.ELEMENT_NODE,this.TEXT_NODE=qe.TEXT_NODE}get childNodes(){const e=[];let t=this.firstChild;for(;t;)e.push(t),t=t.nextSibling;return e}contains(e){if(!(e instanceof Pe))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;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,t){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(e){return class extends e{constructor(e,t,n){super(),this.nodeType=qe.DOCUMENT_TYPE_NODE,this.RRNodeType=ke.DocumentType,this.name=e,this.publicId=t,this.systemId=n,this.nodeName=e,this.textContent=null}toString(){return"RRDocumentType"}}}function Ue(e){return class extends e{constructor(e){super(),this.nodeType=qe.ELEMENT_NODE,this.RRNodeType=ke.Element,this.attributes={},this.shadowRoot=null,this.tagName=e.toUpperCase(),this.nodeName=e.toUpperCase()}get textContent(){let e="";return this.childNodes.forEach((t=>e+=t.textContent)),e}set textContent(e){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(e))}get classList(){return new ze(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?function(e){const t={},n=/:(.+)/;return e.replace(/\/\*.*?\*\//g,"").split(/;(?![^(]*\))/g).forEach((function(e){if(e){const i=e.split(n);i.length>1&&(t[$e(i[0].trim())]=i[1].trim())}})),t}(this.attributes.style):{},t=/\B([A-Z])/g;return e.setProperty=(n,i,o)=>{if(t.test(n))return;const r=$e(n);i?e[r]=i:delete e[r],"important"===o&&(e[r]+=" !important"),this.attributes.style=Ie(e)},e.removeProperty=n=>{if(t.test(n))return"";const i=$e(n),o=e[i]||"";return delete e[i],this.attributes.style=Ie(e),o},e}getAttribute(e){return this.attributes[e]||null}setAttribute(e,t){this.attributes[e]=t}setAttributeNS(e,t,n){this.setAttribute(t,n)}removeAttribute(e){delete this.attributes[e]}appendChild(e){return Ge(this,e)}insertBefore(e,t){return He(this,e,t)}removeChild(e){return Ye(this,e)}attachShadow(e){const t=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=t,t}dispatchEvent(e){return!0}toString(){let e="";for(const t in this.attributes)e+=`${t}="${this.attributes[t]}" `;return`${this.tagName} ${e}`}}}function je(e){return class extends e{constructor(e){super(),this.nodeType=qe.TEXT_NODE,this.nodeName="#text",this.RRNodeType=ke.Text,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Ve(e){return class extends e{constructor(e){super(),this.nodeType=qe.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=ke.Comment,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function We(e){return class extends e{constructor(e){super(),this.nodeName="#cdata-section",this.nodeType=qe.CDATA_SECTION_NODE,this.RRNodeType=ke.CDATA,this.data=e}get textContent(){return this.data}set textContent(e){this.data=e}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class ze{constructor(e,t){if(this.classes=[],this.add=(...e)=>{for(const t of e){const e=String(t);this.classes.indexOf(e)>=0||this.classes.push(e)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...e)=>{this.classes=this.classes.filter((t=>-1===e.indexOf(t))),this.onChange&&this.onChange(this.classes.join(" "))},e){const t=e.trim().split(/\s+/);this.classes.push(...t)}this.onChange=t}}function Ge(e,t){return t.parentNode&&t.parentNode.removeChild(t),e.lastChild?(e.lastChild.nextSibling=t,t.previousSibling=e.lastChild):(e.firstChild=t,t.previousSibling=null),e.lastChild=t,t.nextSibling=null,t.parentNode=e,t.parentElement=e,t.ownerDocument=e.ownerDocument,t}function He(e,t,n){if(!n)return Ge(e,t);if(n.parentNode!==e)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 t===n||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=n.previousSibling,n.previousSibling=t,t.nextSibling=n,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function Ye(e,t){if(t.parentNode!==e)throw new Error("Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.");return t.previousSibling?t.previousSibling.nextSibling=t.nextSibling:e.firstChild=t.nextSibling,t.nextSibling?t.nextSibling.previousSibling=t.previousSibling:e.lastChild=t.previousSibling,t.previousSibling=null,t.nextSibling=null,t.parentElement=null,t.parentNode=null,t}var qe;!function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"}(qe||(qe={}));const Xe={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Qe={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 Je=null;function Ze(e,t,n,i=t.mirror||t.ownerDocument.mirror){e=function(e,t,n,i){var o;n.afterAppend&&!Je&&(Je=new WeakSet,setTimeout((()=>{Je=null}),0));if(!tt(e,t)){const r=et(t,n.mirror,i);null===(o=e.parentNode)||void 0===o||o.replaceChild(r,e),e=r}switch(t.RRNodeType){case ke.Document:if(!nt(e,t,n.mirror,i)){const o=i.getMeta(t);o&&(n.mirror.removeNodeFromMap(e),e.close(),e.open(),n.mirror.add(e,o),null==Je||Je.add(e))}break;case ke.Element:{const o=e,r=t;switch(r.tagName){case"IFRAME":{const o=e.contentDocument;if(!o)break;Ze(o,t.contentDocument,n,i);break}}r.shadowRoot&&(o.shadowRoot||o.attachShadow({mode:"open"}),Ke(o.shadowRoot,r.shadowRoot,n,i));break}}return e}(e,t,n,i),Ke(e,t,n,i),function(e,t,n,i){var o;switch(t.RRNodeType){case ke.Document:{const e=t.scrollData;e&&n.applyScroll(e,!0);break}case ke.Element:{const o=e,r=t;switch(function(e,t,n){const i=e.attributes,o=t.attributes;for(const i in o){const r=o[i],s=n.getMeta(t);if((null==s?void 0:s.isSVG)&&Xe[i])e.setAttributeNS(Xe[i],i,r);else if("CANVAS"===t.tagName&&"rr_dataURL"===i){const t=document.createElement("img");t.src=r,t.onload=()=>{const n=e.getContext("2d");n&&n.drawImage(t,0,0,t.width,t.height)}}else{if("IFRAME"===t.tagName&&"srcdoc"===i)continue;e.setAttribute(i,r)}}for(const{name:t}of Array.from(i))t in o||e.removeAttribute(t);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}(o,r,i),r.scrollData&&n.applyScroll(r.scrollData,!0),r.inputData&&n.applyInput(r.inputData),r.tagName){case"AUDIO":case"VIDEO":{const t=e,n=r;void 0!==n.paused&&(n.paused?t.pause():t.play()),void 0!==n.muted&&(t.muted=n.muted),void 0!==n.volume&&(t.volume=n.volume),void 0!==n.currentTime&&(t.currentTime=n.currentTime),void 0!==n.playbackRate&&(t.playbackRate=n.playbackRate);break}case"CANVAS":{const i=t;if(null!==i.rr_dataURL){const e=document.createElement("img");e.onload=()=>{const t=o.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=i.rr_dataURL}i.canvasMutations.forEach((t=>n.applyCanvas(t.event,t.mutation,e)));break}case"STYLE":{const e=o.sheet;e&&t.rules.forEach((t=>n.applyStyleSheetMutation(t,e)));break}}break}case ke.Text:case ke.Comment:case ke.CDATA:e.textContent!==t.data&&(e.textContent=t.data)}(null==Je?void 0:Je.has(e))&&(Je.delete(e),null===(o=n.afterAppend)||void 0===o||o.call(n,e,n.mirror.getId(e)))}(e,t,n,i)}function Ke(e,t,n,i){const o=Array.from(e.childNodes),r=t.childNodes;if(0===o.length&&0===r.length)return;let s,a,l=0,c=o.length-1,u=0,d=r.length-1,h=o[l],p=o[c],f=r[u],m=r[d];for(;l<=c&&u<=d;)if(void 0===h)h=o[++l];else if(void 0===p)p=o[--c];else if(nt(h,f,n.mirror,i))h=o[++l],f=r[++u];else if(nt(p,m,n.mirror,i))p=o[--c],m=r[--d];else if(nt(h,m,n.mirror,i)){try{e.insertBefore(h,p.nextSibling)}catch(e){console.warn(e)}h=o[++l],m=r[--d]}else if(nt(p,f,n.mirror,i)){try{e.insertBefore(p,h)}catch(e){console.warn(e)}p=o[--c],f=r[++u]}else{if(!s){s={};for(let e=l;e<=c;e++){const t=o[e];t&&n.mirror.hasNode(t)&&(s[n.mirror.getId(t)]=e)}}a=s[i.getId(f)];const t=o[a];if(void 0!==a&&t&&nt(t,f,n.mirror,i)){try{e.insertBefore(t,h)}catch(e){console.warn(e)}o[a]=void 0}else{const t=et(f,n.mirror,i);"#document"===e.nodeName&&h&&(t.nodeType===t.DOCUMENT_TYPE_NODE&&h.nodeType===h.DOCUMENT_TYPE_NODE||t.nodeType===t.ELEMENT_NODE&&h.nodeType===h.ELEMENT_NODE)&&(e.removeChild(h),n.mirror.removeNodeFromMap(h),h=o[++l]);try{e.insertBefore(t,h||null)}catch(e){console.warn(e)}}f=r[++u]}if(l>c){const t=r[d+1];let o=null;for(t&&(o=n.mirror.getNode(i.getId(t)));u<=d;++u){const t=et(r[u],n.mirror,i);try{e.insertBefore(t,o)}catch(e){console.warn(e)}}}else if(u>d)for(;l<=c;l++){const t=o[l];if(t&&t.parentNode===e)try{e.removeChild(t),n.mirror.removeNodeFromMap(t)}catch(e){console.warn(e)}}let g=e.firstChild,v=t.firstChild;for(;null!==g&&null!==v;)Ze(g,v,n,i),g=g.nextSibling,v=v.nextSibling}function et(e,t,n){const i=n.getId(e),o=n.getMeta(e);let r=null;if(i>-1&&(r=t.getNode(i)),null!==r&&tt(r,e))return r;switch(e.RRNodeType){case ke.Document:r=new Document;break;case ke.DocumentType:r=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case ke.Element:{let t=e.tagName.toLowerCase();t=Qe[t]||t,r=o&&"isSVG"in o&&(null==o?void 0:o.isSVG)?document.createElementNS(Xe.svg,t):document.createElement(e.tagName);break}case ke.Text:r=document.createTextNode(e.data);break;case ke.Comment:r=document.createComment(e.data);break;case ke.CDATA:r=document.createCDATASection(e.data)}o&&t.add(r,Object.assign({},o));try{null==Je||Je.add(r)}catch(e){}return r}function tt(e,t){return e.nodeType===t.nodeType&&(e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName)}function nt(e,t,n,i){const o=n.getId(e),r=i.getId(t);return-1!==o&&o===r&&tt(e,t)}class it extends(function(e){return class t extends e{constructor(...e){super(e),this.nodeType=qe.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=ke.Document,this.textContent=null,this.ownerDocument=this}get documentElement(){return this.childNodes.find((e=>e.RRNodeType===ke.Element&&"HTML"===e.tagName))||null}get body(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===ke.Element&&"BODY"===e.tagName)))||null}get head(){var e;return(null===(e=this.documentElement)||void 0===e?void 0:e.childNodes.find((e=>e.RRNodeType===ke.Element&&"HEAD"===e.tagName)))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(e){const t=e.RRNodeType;if((t===ke.Element||t===ke.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===t)))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${t===ke.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const n=Ge(this,e);return n.parentElement=null,n}insertBefore(e,t){const n=e.RRNodeType;if((n===ke.Element||n===ke.DocumentType)&&this.childNodes.some((e=>e.RRNodeType===n)))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${n===ke.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const i=He(this,e,t);return i.parentElement=null,i}removeChild(e){return Ye(this,e)}open(){this.firstChild=null,this.lastChild=null}close(){}write(e){let t;if('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'===e?t="-//W3C//DTD XHTML 1.0 Transitional//EN":'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'===e&&(t="-//W3C//DTD HTML 4.0 Transitional//EN"),t){const e=this.createDocumentType("html",t,"");this.open(),this.appendChild(e)}}createDocument(e,n,i){return new t}createDocumentType(e,t,n){const i=new(Be(Pe))(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=new(Ue(Pe))(e);return t.ownerDocument=this,t}createElementNS(e,t){return this.createElement(t)}createTextNode(e){const t=new(je(Pe))(e);return t.ownerDocument=this,t}createComment(e){const t=new(Ve(Pe))(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new(We(Pe))(e);return t.ownerDocument=this,t}toString(){return"RRDocument"}}}(Pe)){get unserializedId(){return this._unserializedId--}constructor(e){super(),this.UNSERIALIZED_STARTING_ID=-2,this._unserializedId=this.UNSERIALIZED_STARTING_ID,this.mirror=new mt,this.scrollData=null,e&&(this.mirror=e)}createDocument(e,t,n){return new it}createDocumentType(e,t,n){const i=new ot(e,t,n);return i.ownerDocument=this,i}createElement(e){const t=e.toUpperCase();let n;switch(t){case"AUDIO":case"VIDEO":n=new st(t);break;case"IFRAME":n=new ct(t,this.mirror);break;case"CANVAS":n=new at(t);break;case"STYLE":n=new lt(t);break;default:n=new rt(t)}return n.ownerDocument=this,n}createComment(e){const t=new dt(e);return t.ownerDocument=this,t}createCDATASection(e){const t=new ht(e);return t.ownerDocument=this,t}createTextNode(e){const t=new ut(e);return t.ownerDocument=this,t}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const ot=Be(Pe);class rt extends(Ue(Pe)){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class st extends(function(e){return class extends e{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}}}(rt)){}class at extends rt{constructor(){super(...arguments),this.rr_dataURL=null,this.canvasMutations=[]}getContext(){return null}}class lt extends rt{constructor(){super(...arguments),this.rules=[]}}class ct extends rt{constructor(e,t){super(e),this.contentDocument=new it,this.contentDocument.mirror=t}}const ut=je(Pe),dt=Ve(Pe),ht=We(Pe);function pt(e,t,n,i){let o;switch(e.nodeType){case qe.DOCUMENT_NODE:i&&"IFRAME"===i.nodeName?o=i.contentDocument:(o=t,o.compatMode=e.compatMode);break;case qe.DOCUMENT_TYPE_NODE:{const n=e;o=t.createDocumentType(n.name,n.publicId,n.systemId);break}case qe.ELEMENT_NODE:{const n=e,i=function(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}(n);o=t.createElement(i);const r=o;for(const{name:e,value:t}of Array.from(n.attributes))r.attributes[e]=t;n.scrollLeft&&(r.scrollLeft=n.scrollLeft),n.scrollTop&&(r.scrollTop=n.scrollTop);break}case qe.TEXT_NODE:o=t.createTextNode(e.textContent||"");break;case qe.CDATA_SECTION_NODE:o=t.createCDATASection(e.data);break;case qe.COMMENT_NODE:o=t.createComment(e.textContent||"");break;case qe.DOCUMENT_FRAGMENT_NODE:o=i.attachShadow({mode:"open"});break;default:return null}let r=n.getMeta(e);return t instanceof it&&(r||(r=gt(o,t.unserializedId),n.add(e,r)),t.mirror.add(o,Object.assign({},r))),o}function ft(e,t=function(){return new Ae}(),n=new it){return function e(i,o){const r=pt(i,n,t,o);if(null!==r)if("IFRAME"!==(null==o?void 0:o.nodeName)&&i.nodeType!==qe.DOCUMENT_FRAGMENT_NODE&&(null==o||o.appendChild(r),r.parentNode=o,r.parentElement=o),"IFRAME"===i.nodeName){const t=i.contentDocument;t&&e(t,r)}else i.nodeType!==qe.DOCUMENT_NODE&&i.nodeType!==qe.ELEMENT_NODE&&i.nodeType!==qe.DOCUMENT_FRAGMENT_NODE||(i.nodeType===qe.ELEMENT_NODE&&i.shadowRoot&&e(i.shadowRoot,r),i.childNodes.forEach((t=>e(t,r))))}(e,null),n}class mt{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-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 t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function gt(e,t){switch(e.RRNodeType){case ke.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case ke.DocumentType:{const n=e;return{id:t,type:e.RRNodeType,name:n.name,publicId:n.publicId,systemId:n.systemId}}case ke.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case ke.Text:case ke.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case ke.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}var vt=Uint8Array,yt=Uint16Array,wt=Uint32Array,bt=new vt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Et=new vt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Nt=new vt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),St=function(e,t){for(var n=new yt(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var o=new wt(n[30]);for(i=1;i<30;++i)for(var r=n[i];r<n[i+1];++r)o[r]=r-n[i]<<5|i;return[n,o]},Tt=St(bt,2),Dt=Tt[0],Mt=Tt[1];Dt[28]=258,Mt[258]=28;for(var Ct=St(Et,0)[0],xt=new yt(32768),Rt=0;Rt<32768;++Rt){var kt=(43690&Rt)>>>1|(21845&Rt)<<1;kt=(61680&(kt=(52428&kt)>>>2|(13107&kt)<<2))>>>4|(3855&kt)<<4,xt[Rt]=((65280&kt)>>>8|(255&kt)<<8)>>>1}var At=function(e,t,n){for(var i=e.length,o=0,r=new yt(t);o<i;++o)++r[e[o]-1];var s,a=new yt(t);for(o=0;o<t;++o)a[o]=a[o-1]+r[o-1]<<1;if(n){s=new yt(1<<t);var l=15-t;for(o=0;o<i;++o)if(e[o])for(var c=o<<4|e[o],u=t-e[o],d=a[e[o]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)s[xt[d]>>>l]=c}else for(s=new yt(i),o=0;o<i;++o)s[o]=xt[a[e[o]-1]++]>>>15-e[o];return s},It=new vt(288);for(Rt=0;Rt<144;++Rt)It[Rt]=8;for(Rt=144;Rt<256;++Rt)It[Rt]=9;for(Rt=256;Rt<280;++Rt)It[Rt]=7;for(Rt=280;Rt<288;++Rt)It[Rt]=8;var Ot=new vt(32);for(Rt=0;Rt<32;++Rt)Ot[Rt]=5;var _t=At(It,9,1),$t=At(Ot,5,1),Lt=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ft=function(e,t,n){var i=t/8>>0;return(e[i]|e[i+1]<<8)>>>(7&t)&n},Pt=function(e,t){var n=t/8>>0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>>(7&t)},Bt=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var i=new(e instanceof yt?yt:e instanceof wt?wt:vt)(n-t);return i.set(e.subarray(t,n)),i};function Ut(e,t){return function(e,t,n){var i=e.length,o=!t||n,r=!n||n.i;n||(n={}),t||(t=new vt(3*i));var s,a=function(e){var n=t.length;if(e>n){var i=new vt(Math.max(2*n,e));i.set(t),t=i}},l=n.f||0,c=n.p||0,u=n.b||0,d=n.l,h=n.d,p=n.m,f=n.n,m=8*i;do{if(!d){n.f=l=Ft(e,c,1);var g=Ft(e,c+1,3);if(c+=3,!g){var v=e[(x=((s=c)/8>>0)+(7&s&&1)+4)-4]|e[x-3]<<8,y=x+v;if(y>i){if(r)throw"unexpected EOF";break}o&&a(u+v),t.set(e.subarray(x,y),u),n.b=u+=v,n.p=c=8*y;continue}if(1==g)d=_t,h=$t,p=9,f=5;else{if(2!=g)throw"invalid block type";var w=Ft(e,c,31)+257,b=Ft(e,c+10,15)+4,E=w+Ft(e,c+5,31)+1;c+=14;for(var N=new vt(E),S=new vt(19),T=0;T<b;++T)S[Nt[T]]=Ft(e,c+3*T,7);c+=3*b;var D=Lt(S),M=(1<<D)-1;if(!r&&c+E*(D+7)>m)break;var C=At(S,D,1);for(T=0;T<E;){var x,R=C[Ft(e,c,M)];if(c+=15&R,(x=R>>>4)<16)N[T++]=x;else{var k=0,A=0;for(16==x?(A=3+Ft(e,c,3),c+=2,k=N[T-1]):17==x?(A=3+Ft(e,c,7),c+=3):18==x&&(A=11+Ft(e,c,127),c+=7);A--;)N[T++]=k}}var I=N.subarray(0,w),O=N.subarray(w);p=Lt(I),f=Lt(O),d=At(I,p,1),h=At(O,f,1)}if(c>m)throw"unexpected EOF"}o&&a(u+131072);for(var _=(1<<p)-1,$=(1<<f)-1,L=p+f+18;r||c+L<m;){var F=(k=d[Pt(e,c)&_])>>>4;if((c+=15&k)>m)throw"unexpected EOF";if(!k)throw"invalid length/literal";if(F<256)t[u++]=F;else{if(256==F){d=null;break}var P=F-254;if(F>264){var B=bt[T=F-257];P=Ft(e,c,(1<<B)-1)+Dt[T],c+=B}var U=h[Pt(e,c)&$],j=U>>>4;if(!U)throw"invalid distance";if(c+=15&U,O=Ct[j],j>3&&(B=Et[j],O+=Pt(e,c)&(1<<B)-1,c+=B),c>m)throw"unexpected EOF";o&&a(u+131072);for(var V=u+P;u<V;u+=4)t[u]=t[u-O],t[u+1]=t[u+1-O],t[u+2]=t[u+2-O],t[u+3]=t[u+3-O];u=V}}n.l=d,n.p=c,n.b=u,d&&(l=1,n.m=p,n.d=h,n.n=f)}while(!l);return u==t.length?t:Bt(t,0,u)}((function(e){if(8!=(15&e[0])||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"}(e),e.subarray(2,-4)),t)}const jt=e=>{if("string"!=typeof e)return e;try{const t=JSON.parse(e);if(t.timestamp)return t}catch(e){}try{const t=JSON.parse(function(e,t){var n="";if(!t&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var i=0;i<e.length;){var o=e[i++];o<128||t?n+=String.fromCharCode(o):o<224?n+=String.fromCharCode((31&o)<<6|63&e[i++]):o<240?n+=String.fromCharCode((15&o)<<12|(63&e[i++])<<6|63&e[i++]):(o=((15&o)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536,n+=String.fromCharCode(55296|o>>10,56320|1023&o))}return n}(Ut(function(e,t){var n=e.length;if(!t&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new vt(e.length+(e.length>>>1)),o=0,r=function(e){i[o++]=e},s=0;s<n;++s){if(o+5>i.length){var a=new vt(o+8+(n-s<<1));a.set(i),i=a}var l=e.charCodeAt(s);l<128||t?r(l):l<2048?(r(192|l>>>6),r(128|63&l)):l>55295&&l<57344?(r(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++s))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return Bt(i,0,o)}(e,!0))));if("v1"===t.v)return t;throw new Error(`These events were packed with packer ${t.v} which is incompatible with current packer v1.`)}catch(e){throw console.error(e),new Error("Unknown data format.")}};function Vt(e){return{all:e=e||new Map,on:function(t,n){var i=e.get(t);i?i.push(n):e.set(t,[n])},off:function(t,n){var i=e.get(t);i&&(n?i.splice(i.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var i=e.get(t);i&&i.slice().map((function(e){e(n)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,n)}))}}}var Wt=Object.freeze({__proto__:null,default:Vt});const zt=new Map;function Gt(e,t){let n=zt.get(e);return n||(n=new Map,zt.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}function Ht(e,t,n){return i=>Me(this,void 0,void 0,(function*(){if(i&&"object"==typeof i&&"rr_type"in i){if(n&&(n.isUnchanged=!1),"ImageBitmap"===i.rr_type&&"args"in i){const o=yield Ht(e,t,n)(i.args);return yield createImageBitmap.apply(null,o)}if("index"in i){if(n||null===t)return i;const{rr_type:e,index:o}=i;return Gt(t,e)[o]}if("args"in i){const{rr_type:o,args:r}=i;return new(0,window[o])(...yield Promise.all(r.map(Ht(e,t,n))))}if("base64"in i)return function(e){var t,n,i,o,r,s=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);var c=new ArrayBuffer(s),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=xe[e.charCodeAt(t)],i=xe[e.charCodeAt(t+1)],o=xe[e.charCodeAt(t+2)],r=xe[e.charCodeAt(t+3)],u[l++]=n<<2|i>>4,u[l++]=(15&i)<<4|o>>2,u[l++]=(3&o)<<6|63&r;return c}(i.base64);if("src"in i){const t=e.get(i.src);if(t)return t;{const t=new Image;return t.src=i.src,e.set(i.src,t),t}}if("data"in i&&"Blob"===i.rr_type){const o=yield Promise.all(i.data.map(Ht(e,t,n)));return new Blob(o,{type:i.type})}}else if(Array.isArray(i)){return yield Promise.all(i.map(Ht(e,t,n)))}return i}))}const Yt=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function qt({mutation:e,target:t,type:n,imageMap:i,errorHandler:o}){return Me(this,void 0,void 0,(function*(){try{const o=function(e,t){try{return t===fe.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch(e){return null}}(t,n);if(!o)return;if(e.setter)return void(o[e.property]=e.args[0]);const r=o[e.property],s=yield Promise.all(e.args.map(Ht(i,o)));!function(e,t){if(!(null==t?void 0:t.constructor))return;const{name:n}=t.constructor;if(!Yt.includes(n))return;const i=Gt(e,n);i.includes(t)||i.push(t)}(o,r.apply(o,s))}catch(t){o(e,t)}}))}function Xt({event:e,mutation:t,target:n,imageMap:i,canvasEventMap:o,errorHandler:r}){return Me(this,void 0,void 0,(function*(){try{const s=o.get(e)||t,a="commands"in s?s.commands:[s];if([fe.WebGL,fe.WebGL2].includes(t.type)){for(let e=0;e<a.length;e++){const o=a[e];yield qt({mutation:o,type:t.type,target:n,imageMap:i,errorHandler:r})}return}yield function({event:e,mutations:t,target:n,imageMap:i,errorHandler:o}){return Me(this,void 0,void 0,(function*(){const r=n.getContext("2d");if(!r)return void o(t[0],new Error("Canvas context is null"));const s=t.map((e=>Me(this,void 0,void 0,(function*(){return Promise.all(e.args.map(Ht(i,r)))}))));(yield Promise.all(s)).forEach(((n,s)=>{const a=t[s];try{if(a.setter)return void(r[a.property]=a.args[0]);const t=r[a.property];"drawImage"===a.property&&"string"==typeof a.args[0]?(i.get(e),t.apply(r,a.args)):t.apply(r,n)}catch(e){o(a,e)}}))}))}({event:e,mutations:a,target:n,imageMap:i,errorHandler:r})}catch(e){r(t,e)}}))}
16
+ /*! *****************************************************************************
17
+ Copyright (c) Microsoft Corporation.
18
+
19
+ Permission to use, copy, modify, and/or distribute this software for any
20
+ purpose with or without fee is hereby granted.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
+ PERFORMANCE OF THIS SOFTWARE.
29
+ ***************************************************************************** */function Qt(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return s}var Jt;!function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"}(Jt||(Jt={}));var Zt={type:"xstate.init"};function Kt(e){return void 0===e?[]:[].concat(e)}function en(e){return{type:"xstate.assign",assignment:e}}function tn(e,t){return"string"==typeof(e="string"==typeof e&&t&&t[e]?t[e]:e)?{type:e}:"function"==typeof e?{type:e.name,exec:e}:e}function nn(e){return function(t){return e===t}}function on(e){return"string"==typeof e?{type:e}:e}function rn(e,t){return{value:e,context:t,actions:[],changed:!1,matches:nn(e)}}function sn(e,t,n){var i=t,o=!1;return[e.filter((function(e){if("xstate.assign"===e.type){o=!0;var t=Object.assign({},i);return"function"==typeof e.assignment?t=e.assignment(i,n):Object.keys(e.assignment).forEach((function(o){t[o]="function"==typeof e.assignment[o]?e.assignment[o](i,n):e.assignment[o]})),i=t,!1}return!0})),i,o]}function an(e,t){void 0===t&&(t={});var n=Qt(sn(Kt(e.states[e.initial].entry).map((function(e){return tn(e,t.actions)})),e.context,Zt),2),i=n[0],o=n[1],r={config:e,_options:t,initialState:{value:e.initial,actions:i,context:o,matches:nn(e.initial)},transition:function(t,n){var i,o,s="string"==typeof t?{value:t,context:e.context}:t,a=s.value,l=s.context,c=on(n),u=e.states[a];if(u.on){var d=Kt(u.on[c.type]);try{for(var h=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(d),p=h.next();!p.done;p=h.next()){var f=p.value;if(void 0===f)return rn(a,l);var m="string"==typeof f?{target:f}:f,g=m.target,v=m.actions,y=void 0===v?[]:v,w=m.cond,b=void 0===w?function(){return!0}:w,E=void 0===g,N=null!=g?g:a,S=e.states[N];if(b(l,c)){var T=Qt(sn((E?Kt(y):[].concat(u.exit,y,S.entry).filter((function(e){return e}))).map((function(e){return tn(e,r._options.actions)})),l,c),3),D=T[0],M=T[1],C=T[2],x=null!=g?g:a;return{value:x,context:M,actions:D,changed:g!==a||D.length>0||C,matches:nn(x)}}}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}}return rn(a,l)}};return r}var ln=function(e,t){return e.actions.forEach((function(n){var i=n.exec;return i&&i(e.context,t)}))};function cn(e){var t=e.initialState,n=Jt.NotStarted,i=new Set,o={_machine:e,send:function(o){n===Jt.Running&&(t=e.transition(t,o),ln(t,on(o)),i.forEach((function(e){return e(t)})))},subscribe:function(e){return i.add(e),e(t),{unsubscribe:function(){return i.delete(e)}}},start:function(i){if(i){var r="object"==typeof i?i:{context:e.config.context,value:i};t={value:r.value,actions:[],context:r.context,matches:nn(r.value)}}return n=Jt.Running,ln(t,Zt),o},stop:function(){return n=Jt.Stopped,i.clear(),o},get state(){return t},get status(){return n}};return o}class un{constructor(e=[],t){this.timeOffset=0,this.raf=null,this.actions=e,this.speed=t.speed}addAction(e){const t=!0===this.raf;if(!this.actions.length||this.actions[this.actions.length-1].delay<=e.delay)this.actions.push(e);else{const t=this.findActionIndex(e);this.actions.splice(t,0,e)}t&&(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 e=this.actions[0];if(!(this.timeOffset>=e.delay))break;this.actions.shift(),e.doAction()}this.actions.length>0?this.raf=requestAnimationFrame(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(!0!==this.raf&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(e){this.speed=e}isActive(){return null!==this.raf}findActionIndex(e){let t=0,n=this.actions.length-1;for(;t<=n;){const i=Math.floor((t+n)/2);if(this.actions[i].delay<e.delay)t=i+1;else{if(!(this.actions[i].delay>e.delay))return i+1;n=i-1}}return t}}function dn(e,t){if(e.type===de.IncrementalSnapshot&&e.data.source===he.MouseMove&&e.data.positions&&e.data.positions.length){const n=e.data.positions[0].timeOffset,i=e.timestamp+n;return e.delay=i-t,i-t}return e.delay=e.timestamp-t,e.delay}function hn(e,{getCastFn:t,applyEventsSynchronously:n,emitter:i}){const o=an({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:en({lastPlayedEvent:(e,t)=>"CAST_EVENT"===t.type?t.payload.event:e.lastPlayedEvent}),recordTimeOffset:en(((e,t)=>{let n=e.timeOffset;return"payload"in t&&"timeOffset"in t.payload&&(n=t.payload.timeOffset),Object.assign(Object.assign({},e),{timeOffset:n,baselineTime:e.events[0].timestamp+n})})),play(e){var o;const{timer:r,events:s,baselineTime:a,lastPlayedEvent:l}=e;r.clear();for(const e of s)dn(e,a);const c=function(e,t){for(let n=e.length-1;n>=0;n--){const i=e[n];if(i.type===de.Meta&&i.timestamp<=t)return e.slice(n)}return e}(s,a);let u=null==l?void 0:l.timestamp;(null==l?void 0:l.type)===de.IncrementalSnapshot&&l.data.source===he.MouseMove&&(u=l.timestamp+(null===(o=l.data.positions[0])||void 0===o?void 0:o.timeOffset)),a<(u||0)&&i.emit(me.PlayBack);const d=new Array;for(const e of c)if(!(u&&u<a&&(e.timestamp<=u||e===l)))if(e.timestamp<a)d.push(e);else{const n=t(e,!1);r.addAction({doAction:()=>{n()},delay:e.delay})}n(d),i.emit(me.Flush),r.start()},pause(e){e.timer.clear()},resetLastPlayedEvent:en((e=>Object.assign(Object.assign({},e),{lastPlayedEvent:null}))),startLive:en({baselineTime:(e,t)=>(e.timer.start(),"TO_LIVE"===t.type&&t.payload.baselineTime?t.payload.baselineTime:Date.now())}),addEvent:en(((e,n)=>{const{baselineTime:i,timer:o,events:r}=e;if("ADD_EVENT"===n.type){const{event:e}=n.payload;dn(e,i);let s=r.length-1;if(!r[s]||r[s].timestamp<=e.timestamp)r.push(e);else{let t=-1,n=0;for(;n<=s;){const t=Math.floor((n+s)/2);r[t].timestamp<=e.timestamp?n=t+1:s=t-1}-1===t&&(t=n),r.splice(t,0,e)}const a=e.timestamp<i,l=t(e,a);a?l():o.isActive()&&o.addAction({doAction:()=>{l()},delay:e.delay})}return Object.assign(Object.assign({},e),{events:r})}))}});return cn(o)}function pn(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&!0!==e.__forceSmoothScrollPolyfill__)return;const n=e.HTMLElement||e.Element,i={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:n.prototype.scroll||a,scrollIntoView:n.prototype.scrollIntoView},o=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;const r=(s=e.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(s)?1:0);var s;function a(e,t){this.scrollLeft=e,this.scrollTop=t}function l(e){if(null===e||"object"!=typeof e||void 0===e.behavior||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+e.behavior+" is not a valid value for enumeration ScrollBehavior.")}function c(e,t){return"Y"===t?e.clientHeight+r<e.scrollHeight:"X"===t?e.clientWidth+r<e.scrollWidth:void 0}function u(t,n){const i=e.getComputedStyle(t,null)["overflow"+n];return"auto"===i||"scroll"===i}function d(e){const t=c(e,"Y")&&u(e,"Y"),n=c(e,"X")&&u(e,"X");return t||n}function h(e){for(;e!==t.body&&!1===d(e);)e=e.parentNode||e.host;return e}function p(t){let n,i,r,s=(o()-t.startTime)/468;var a;s=s>1?1:s,a=s,n=.5*(1-Math.cos(Math.PI*a)),i=t.startX+(t.x-t.startX)*n,r=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,i,r),i===t.x&&r===t.y||e.requestAnimationFrame(p.bind(e,t))}function f(n,r,s){let l,c,u,d;const h=o();n===t.body?(l=e,c=e.scrollX||e.pageXOffset,u=e.scrollY||e.pageYOffset,d=i.scroll):(l=n,c=n.scrollLeft,u=n.scrollTop,d=a),p({scrollable:l,method:d,startTime:h,startX:c,startY:u,x:r,y:s})}e.scroll=e.scrollTo=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?f.call(e,t.body,void 0!==arguments[0].left?~~arguments[0].left:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:e.scrollY||e.pageYOffset):i.scroll.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:e.scrollX||e.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:e.scrollY||e.pageYOffset))},e.scrollBy=function(){void 0!==arguments[0]&&(l(arguments[0])?i.scrollBy.call(e,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):f.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)))},n.prototype.scroll=n.prototype.scrollTo=function(){if(void 0===arguments[0])return;if(!0===l(arguments[0])){if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");return void i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}const e=arguments[0].left,t=arguments[0].top;f.call(this,this,void 0===e?this.scrollLeft:~~e,void 0===t?this.scrollTop:~~t)},n.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==l(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},n.prototype.scrollIntoView=function(){if(!0===l(arguments[0]))return void i.scrollIntoView.call(this,void 0===arguments[0]||arguments[0]);const n=h(this),o=n.getBoundingClientRect(),r=this.getBoundingClientRect();n!==t.body?(f.call(this,n,n.scrollLeft+r.left-o.left,n.scrollTop+r.top-o.top),"fixed"!==e.getComputedStyle(n).position&&e.scrollBy({left:o.left,top:o.top,behavior:"smooth"})):e.scrollBy({left:r.left,top:r.top,behavior:"smooth"})}}const fn=Vt||Wt,mn="[replayer]",gn={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function vn(e){return e.type==de.IncrementalSnapshot&&(e.data.source==he.TouchMove||e.data.source==he.MouseInteraction&&e.data.type==pe.TouchStart)}class yn{get timer(){return this.service.state.context.timer}constructor(e,t){if(this.usingVirtualDom=!1,this.virtualDom=new it,this.mouseTail=null,this.tailPositions=[],this.emitter=fn(),this.legacy_missingNodeRetryMap={},this.cache=ae(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=Z(),this.styleMirror=new De,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=e=>{this.iframe.style.display="inherit";for(const t of[this.mouseTail,this.iframe])t&&(t.setAttribute("width",String(e.width)),t.setAttribute("height",String(e.height)))},this.applyEventsSynchronously=e=>{for(const t of e){switch(t.type){case de.DomContentLoaded:case de.Load:case de.Custom:continue;case de.FullSnapshot:case de.Meta:case de.Plugin:case de.IncrementalSnapshot:}this.getCastFn(t,!0)()}},this.getCastFn=(e,t=!1)=>{let n;switch(e.type){case de.DomContentLoaded:case de.Load:break;case de.Custom:n=()=>{this.emitter.emit(me.CustomEvent,e)};break;case de.Meta:n=()=>this.emitter.emit(me.Resize,{width:e.data.width,height:e.data.height});break;case de.FullSnapshot:n=()=>{var n;if(this.firstFullSnapshot){if(this.firstFullSnapshot===e)return void(this.firstFullSnapshot=!0)}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(e,t),null===(n=this.iframe.contentWindow)||void 0===n||n.scrollTo(e.data.initialOffset),this.styleMirror.reset()};break;case de.IncrementalSnapshot:n=()=>{if(this.applyIncremental(e,t),!t&&this.config.skipInactive&&!this.nextUserInteractionEvent){for(const t of this.service.state.context.events)if(!(t.timestamp<=e.timestamp)&&this.isUserInteraction(t)){t.delay-e.delay>1e4*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=t);break}if(this.nextUserInteractionEvent){const t=this.nextUserInteractionEvent.delay-e.delay;this.play(this.getCurrentTime()+t),this.nextUserInteractionEvent=null}}}}return()=>{n&&n();for(const n of this.config.plugins||[])n.handler&&n.handler(e,t,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:e}});const i=this.service.state.context.events.length-1;if(!this.config.liveMode&&e===this.service.state.context.events[i]){const t=()=>{i<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(me.Finish))};let n=50;e.type===de.IncrementalSnapshot&&e.data.source===he.MouseMove&&e.data.positions.length&&(n+=Math.max(0,-e.data.positions[0].timeOffset)),setTimeout(t,n)}this.emitter.emit(me.EventCast,e)}},!(null==t?void 0:t.liveMode)&&e.length<2)throw new Error("Replayer need at least 2 events.");const n={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:gn,useVirtualDom:!0,logger:console};this.config=Object.assign({},n,t),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(me.Resize,this.handleResize),this.setupDom();for(const e of this.config.plugins||[])e.getMirror&&e.getMirror({nodeMirror:this.mirror});this.emitter.on(me.Flush,(()=>{if(this.usingVirtualDom){const e={mirror:this.mirror,applyCanvas:(e,t,n)=>{Xt({event:e,mutation:t,target:n,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(e,t)=>{e.source===he.StyleSheetRule?this.applyStyleSheetRule(e,t):e.source===he.StyleDeclaration&&this.applyStyleDeclaration(e,t)},afterAppend:(e,t)=>{for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})}};if(this.iframe.contentDocument)try{Ze(this.iframe.contentDocument,this.virtualDom,e,this.virtualDom.mirror)}catch(e){console.warn(e)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const t in this.legacy_missingNodeRetryMap)try{const n=this.legacy_missingNodeRetryMap[t],i=et(n.node,this.mirror,this.virtualDom.mirror);Ze(i,n.node,e,this.virtualDom.mirror),n.node=i}catch(e){this.warn(e)}this.constructedStyleMutations.forEach((e=>{this.applyStyleSheetMutation(e)})),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach((e=>{this.applyAdoptedStyleSheet(e)})),this.adoptedStyleSheets=[]}if(this.mousePos&&(this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null),!0===this.touchActive?this.mouse.classList.add("touch-active"):!1===this.touchActive&&this.mouse.classList.remove("touch-active"),this.touchActive=null,this.lastMouseDownEvent){const[e,t]=this.lastMouseDownEvent;e.dispatchEvent(t)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)})),this.emitter.on(me.PlayBack,(()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()}));const i=new un([],{speed:this.config.speed});this.service=hn({events:e.map((e=>t&&t.unpackFn?t.unpackFn(e):e)).sort(((e,t)=>e.timestamp-t.timestamp)),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe((e=>{this.emitter.emit(me.StateChange,{player:e})})),this.speedService=cn(an({id:"speed",context:{normalSpeed:-1,timer:i},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:(e,t)=>{"payload"in t&&e.timer.setSpeed(t.payload.speed)},recordSpeed:en({normalSpeed:e=>e.timer.speed}),restoreSpeed:e=>{e.timer.setSpeed(e.normalSpeed)}}})),this.speedService.start(),this.speedService.subscribe((e=>{this.emitter.emit(me.StateChange,{speed:e})}));const o=this.service.state.context.events.find((e=>e.type===de.Meta)),r=this.service.state.context.events.find((e=>e.type===de.FullSnapshot));if(o){const{width:e,height:t}=o.data;setTimeout((()=>{this.emitter.emit(me.Resize,{width:e,height:t})}),0)}r&&setTimeout((()=>{var e;this.firstFullSnapshot||(this.firstFullSnapshot=r,this.rebuildFullSnapshot(r),null===(e=this.iframe.contentWindow)||void 0===e||e.scrollTo(r.data.initialOffset))}),1),this.service.state.context.events.find(vn)&&this.mouse.classList.add("touch-device")}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}setConfig(e){Object.keys(e).forEach((t=>{e[t],this.config[t]=e[t]})),this.config.skipInactive||this.backToNormal(),void 0!==e.speed&&this.speedService.send({type:"SET_SPEED",payload:{speed:e.speed}}),void 0!==e.mouseTail&&(!1===e.mouseTail?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getMetaData(){const e=this.service.state.context.events[0],t=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:e.timestamp,endTime:t.timestamp,totalTime:t.timestamp-e.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:e,events:t}=this.service.state.context;return e-t[0].timestamp}getMirror(){return this.mirror}play(e=0){var t,n;this.service.state.matches("paused")||this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:e}}),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.remove("rrweb-paused"),this.emitter.emit(me.Start)}pause(e){var t,n;void 0===e&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),"number"==typeof e&&(this.play(e),this.service.send({type:"PAUSE"})),null===(n=null===(t=this.iframe.contentDocument)||void 0===t?void 0:t.getElementsByTagName("html")[0])||void 0===n||n.classList.add("rrweb-paused"),this.emitter.emit(me.Pause)}resume(e=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(e),this.emitter.emit(me.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit(me.Destroy)}startLive(e){this.service.send({type:"TO_LIVE",payload:{baselineTime:e}})}addEvent(e){const t=this.config.unpackFn?this.config.unpackFn(e):e;vn(t)&&this.mouse.classList.add("touch-device"),Promise.resolve().then((()=>this.service.send({type:"ADD_EVENT",payload:{event:t}})))}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=ae()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),!1!==this.config.mouseTail&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const e=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&e.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",e.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(pn(this.iframe.contentWindow,this.iframe.contentDocument),function(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}(this.iframe.contentWindow))}rebuildFullSnapshot(e,t=!1){if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&this.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const n=[],i=(e,t)=>{this.collectIframeAndAttachDocument(n,e);for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),ue(e.data.node,{doc:this.iframe.contentDocument,afterAppend:i,cache:this.cache,mirror:this.mirror}),i(this.iframe.contentDocument,e.data.node.id);for(const{mutationInQueue:e,builtNode:t}of n)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e));const{documentElement:o,head:r}=this.iframe.contentDocument;this.insertStyleRules(o,r),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(me.FullsnapshotRebuilded,e),t||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(e,t){var n;const i=(o=this.config.blockClass,[`.${o} { background: currentColor }`,"noscript { display: none !important; }"]).concat(this.config.insertStyleRules);var o;if(this.config.pauseAnimation&&i.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const n=this.virtualDom.createElement("style");this.virtualDom.mirror.add(n,gt(n,this.virtualDom.unserializedId)),e.insertBefore(n,t),n.rules.push({source:he.StyleSheetRule,adds:i.map(((e,t)=>({rule:e,index:t})))})}else{const o=document.createElement("style");e.insertBefore(o,t);for(let e=0;e<i.length;e++)null===(n=o.sheet)||void 0===n||n.insertRule(i[e],e)}}attachDocumentToIframe(e,t){const n=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,i=[],o=(e,o)=>{this.collectIframeAndAttachDocument(i,e);const r=n.getMeta(e);if((null==r?void 0:r.type)===Q.Element&&"HTML"===(null==r?void 0:r.tagName.toUpperCase())){const{documentElement:e,head:n}=t.contentDocument;this.insertStyleRules(e,n)}if(!this.usingVirtualDom)for(const t of this.config.plugins||[])t.onBuild&&t.onBuild(e,{id:o,replayer:this})};ce(e.node,{doc:t.contentDocument,mirror:n,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(t.contentDocument,e.node.id);for(const{mutationInQueue:e,builtNode:t}of i)this.attachDocumentToIframe(e,t),this.newDocumentQueue=this.newDocumentQueue.filter((t=>t!==e))}collectIframeAndAttachDocument(e,t){if(be(t,this.mirror)){const n=this.newDocumentQueue.find((e=>e.parentId===this.mirror.getId(t)));n&&e.push({mutationInQueue:n,builtNode:t})}}waitForStylesheetLoad(){var e;const t=null===(e=this.iframe.contentDocument)||void 0===e?void 0:e.head;if(t){const e=new Set;let n,i=this.service.state;const o=()=>{i=this.service.state};this.emitter.on(me.Start,o),this.emitter.on(me.Pause,o);const r=()=>{this.emitter.off(me.Start,o),this.emitter.off(me.Pause,o)};t.querySelectorAll('link[rel="stylesheet"]').forEach((t=>{t.sheet||(e.add(t),t.addEventListener("load",(()=>{e.delete(t),0===e.size&&-1!==n&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(me.LoadStylesheetEnd),n&&clearTimeout(n),r())})))})),e.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(me.LoadStylesheetStart),n=setTimeout((()=>{i.matches("playing")&&this.play(this.getCurrentTime()),n=-1,r()}),this.config.loadTimeout))}}preloadAllImages(){return Me(this,void 0,void 0,(function*(){this.service.state;const e=()=>{this.service.state};this.emitter.on(me.Start,e),this.emitter.on(me.Pause,e);const t=[];for(const e of this.service.state.context.events)if(e.type===de.IncrementalSnapshot&&e.data.source===he.CanvasMutation){t.push(this.deserializeAndPreloadCanvasEvents(e.data,e));("commands"in e.data?e.data.commands:[e.data]).forEach((t=>{this.preloadImages(t,e)}))}return Promise.all(t)}))}preloadImages(e,t){if("drawImage"===e.property&&"string"==typeof e.args[0]&&!this.imageMap.has(t)){const t=document.createElement("canvas"),n=t.getContext("2d"),i=null==n?void 0:n.createImageData(t.width,t.height);null==i||i.data,JSON.parse(e.args[0]),null==n||n.putImageData(i,0,0)}}deserializeAndPreloadCanvasEvents(e,t){return Me(this,void 0,void 0,(function*(){if(!this.canvasEventMap.has(t)){const n={isUnchanged:!0};if("commands"in e){const i=yield Promise.all(e.commands.map((e=>Me(this,void 0,void 0,(function*(){const t=yield Promise.all(e.args.map(Ht(this.imageMap,null,n)));return Object.assign(Object.assign({},e),{args:t})})))));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{commands:i}))}else{const i=yield Promise.all(e.args.map(Ht(this.imageMap,null,n)));!1===n.isUnchanged&&this.canvasEventMap.set(t,Object.assign(Object.assign({},e),{args:i}))}}}))}applyIncremental(e,t){var n,i,o;const{data:r}=e;switch(r.source){case he.Mutation:try{this.applyMutation(r,t)}catch(e){this.warn(`Exception in mutation ${e.message||e}`,r)}break;case he.Drag:case he.TouchMove:case he.MouseMove:if(t){const e=r.positions[r.positions.length-1];this.mousePos={x:e.x,y:e.y,id:e.id,debugData:r}}else r.positions.forEach((n=>{const i={doAction:()=>{this.moveAndHover(n.x,n.y,n.id,t,r)},delay:n.timeOffset+e.timestamp-this.service.state.context.baselineTime};this.timer.addAction(i)})),this.timer.addAction({doAction(){},delay:e.delay-(null===(n=r.positions[0])||void 0===n?void 0:n.timeOffset)});break;case he.MouseInteraction:{if(-1===r.id)break;const e=new Event(pe[r.type].toLowerCase()),n=this.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);this.emitter.emit(me.MouseInteraction,{type:r.type,target:n});const{triggerFocus:i}=this.config;switch(r.type){case pe.Blur:"blur"in n&&n.blur();break;case pe.Focus:i&&n.focus&&n.focus({preventScroll:!0});break;case pe.Click:case pe.TouchStart:case pe.TouchEnd:case pe.MouseDown:case pe.MouseUp:t?(r.type===pe.TouchStart?this.touchActive=!0:r.type===pe.TouchEnd&&(this.touchActive=!1),r.type===pe.MouseDown?this.lastMouseDownEvent=[n,e]:r.type===pe.MouseUp&&(this.lastMouseDownEvent=null),this.mousePos={x:r.x,y:r.y,id:r.id,debugData:r}):(r.type===pe.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(r.x,r.y,r.id,t,r),r.type===pe.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):r.type===pe.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):r.type===pe.TouchEnd?this.mouse.classList.remove("touch-active"):n.dispatchEvent(e));break;case pe.TouchCancel:t?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:n.dispatchEvent(e)}break}case he.Scroll:if(-1===r.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(r.id);if(!e)return this.debugNodeNotFound(r,r.id);e.scrollData=r;break}this.applyScroll(r,t);break;case he.ViewportResize:this.emitter.emit(me.Resize,{width:r.width,height:r.height});break;case he.Input:if(-1===r.id)break;if(this.usingVirtualDom){const e=this.virtualDom.mirror.getNode(r.id);if(!e)return this.debugNodeNotFound(r,r.id);e.inputData=r;break}this.applyInput(r);break;case he.MediaInteraction:{const e=this.usingVirtualDom?this.virtualDom.mirror.getNode(r.id):this.mirror.getNode(r.id);if(!e)return this.debugNodeNotFound(r,r.id);const t=e;try{void 0!==r.currentTime&&(t.currentTime=r.currentTime),void 0!==r.volume&&(t.volume=r.volume),void 0!==r.muted&&(t.muted=r.muted),1===r.type&&t.pause(),0===r.type&&t.play(),4===r.type&&(t.playbackRate=r.playbackRate)}catch(e){this.warn(`Failed to replay media interactions: ${e.message||e}`)}break}case he.StyleSheetRule:case he.StyleDeclaration:this.usingVirtualDom?r.styleId?this.constructedStyleMutations.push(r):r.id&&(null===(i=this.virtualDom.mirror.getNode(r.id))||void 0===i||i.rules.push(r)):this.applyStyleSheetMutation(r);break;case he.CanvasMutation:if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const t=this.virtualDom.mirror.getNode(r.id);if(!t)return this.debugNodeNotFound(r,r.id);t.canvasMutations.push({event:e,mutation:r})}else{const t=this.mirror.getNode(r.id);if(!t)return this.debugNodeNotFound(r,r.id);Xt({event:e,mutation:r,target:t,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break;case he.Font:try{const e=new FontFace(r.family,r.buffer?new Uint8Array(JSON.parse(r.fontSource)):r.fontSource,r.descriptors);null===(o=this.iframe.contentDocument)||void 0===o||o.fonts.add(e)}catch(e){this.warn(e)}break;case he.Selection:if(t){this.lastSelectionData=r;break}this.applySelection(r);break;case he.AdoptedStyleSheet:this.usingVirtualDom?this.adoptedStyleSheets.push(r):this.applyAdoptedStyleSheet(r)}}applyMutation(e,t){if(this.config.useVirtualDom&&!this.usingVirtualDom&&t&&(this.usingVirtualDom=!0,ft(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const e in this.legacy_missingNodeRetryMap)try{const t=this.legacy_missingNodeRetryMap[e],n=pt(t.node,this.virtualDom,this.mirror);n&&(t.node=n)}catch(e){this.warn(e)}const n=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;e.removes=e.removes.filter((t=>!!n.getNode(t.id)||(this.warnNodeNotFound(e,t.id),!1))),e.removes.forEach((t=>{var i;const o=n.getNode(t.id);if(!o)return;let r=n.getNode(t.parentId);if(!r)return this.warnNodeNotFound(e,t.parentId);if(t.isShadow&&Ne(r)&&(r=r.shadowRoot),n.removeNodeFromMap(o),r)try{r.removeChild(o),this.usingVirtualDom&&"#text"===o.nodeName&&"STYLE"===r.nodeName&&(null===(i=r.rules)||void 0===i?void 0:i.length)>0&&(r.rules=[])}catch(t){if(!(t instanceof DOMException))throw t;this.warn("parent could not remove child in mutation",r,o,e)}}));const i=Object.assign({},this.legacy_missingNodeRetryMap),o=[],r=e=>{var t,r;if(!this.iframe.contentDocument)return this.warn("Looks like your replayer has been destroyed.");let s=n.getNode(e.parentId);if(!s)return e.node.type===Q.Document?this.newDocumentQueue.push(e):o.push(e);e.node.isShadow&&(Ne(s)||s.attachShadow({mode:"open"}),s=s.shadowRoot);let a=null,l=null;if(e.previousId&&(a=n.getNode(e.previousId)),e.nextId&&(l=n.getNode(e.nextId)),(e=>{let t=null;return e.nextId&&(t=n.getNode(e.nextId)),null!==e.nextId&&void 0!==e.nextId&&-1!==e.nextId&&!t})(e))return o.push(e);if(e.node.rootId&&!n.getNode(e.node.rootId))return;const c=e.node.rootId?n.getNode(e.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(be(s,n))return void this.attachDocumentToIframe(e,s);const u=(e,t)=>{if(!this.usingVirtualDom)for(const n of this.config.plugins||[])n.onBuild&&n.onBuild(e,{id:t,replayer:this})},d=ce(e.node,{doc:c,mirror:n,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:u});if(-1===e.previousId||-1===e.nextId)return void(i[e.node.id]={node:d,mutation:e});const h=n.getMeta(s);if(h&&h.type===Q.Element&&"textarea"===h.tagName&&e.node.type===Q.Text){const e=Array.isArray(s.childNodes)?s.childNodes:Array.from(s.childNodes);for(const t of e)t.nodeType===s.TEXT_NODE&&s.removeChild(t)}else if((null==h?void 0:h.type)===Q.Document){const n=s;e.node.type===Q.DocumentType&&(null===(t=n.childNodes[0])||void 0===t?void 0:t.nodeType)===Node.DOCUMENT_TYPE_NODE&&n.removeChild(n.childNodes[0]),"HTML"===d.nodeName&&n.documentElement&&n.removeChild(n.documentElement)}if(a&&a.nextSibling&&a.nextSibling.parentNode?s.insertBefore(d,a.nextSibling):l&&l.parentNode?s.contains(l)?s.insertBefore(d,l):s.insertBefore(d,null):s.appendChild(d),u(d,e.node.id),this.usingVirtualDom&&"#text"===d.nodeName&&"STYLE"===s.nodeName&&(null===(r=s.rules)||void 0===r?void 0:r.length)>0&&(s.rules=[]),be(d,this.mirror)){const e=this.mirror.getId(d),t=this.newDocumentQueue.find((t=>t.parentId===e));t&&(this.attachDocumentToIframe(t,d),this.newDocumentQueue=this.newDocumentQueue.filter((e=>e!==t)))}(e.previousId||e.nextId)&&this.legacy_resolveMissingNode(i,s,d,e)};e.adds.forEach((e=>{r(e)}));const s=Date.now();for(;o.length;){const e=ye(o);if(o.length=0,Date.now()-s>500){this.warn("Timeout in the loop, please check the resolve tree data:",e);break}for(const t of e){n.getNode(t.value.parentId)?we(t,(e=>{r(e)})):this.debug("Drop resolve tree since there is no parent for the root node.",t)}}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),function(e){const t=new Set,n=[];for(let i=e.length;i--;){const o=e[i];t.has(o.id)||(n.push(o),t.add(o.id))}return n}(e.texts).forEach((t=>{var i;const o=n.getNode(t.id);if(!o){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}if(o.textContent=t.value,this.usingVirtualDom){const e=o.parentNode;(null===(i=null==e?void 0:e.rules)||void 0===i?void 0:i.length)>0&&(e.rules=[])}})),e.attributes.forEach((t=>{const i=n.getNode(t.id);if(!i){if(e.removes.find((e=>e.id===t.id)))return;return this.warnNodeNotFound(e,t.id)}for(const e in t.attributes)if("string"==typeof e){const o=t.attributes[e];if(null===o)i.removeAttribute(e);else if("string"==typeof o)try{if("_cssText"===e&&("LINK"===i.nodeName||"STYLE"===i.nodeName))try{const e=n.getMeta(i);Object.assign(e.attributes,t.attributes);const o=ce(e,{doc:i.ownerDocument,mirror:n,skipChild:!0,hackCss:!0,cache:this.cache}),r=i.nextSibling,s=i.parentNode;if(o&&s){s.removeChild(i),s.insertBefore(o,r),n.replace(t.id,o);break}}catch(e){}i.setAttribute(e,o)}catch(e){this.warn("An error occurred may due to the checkout feature.",e)}else if("style"===e){const e=o,t=i;for(const n in e)if(!1===e[n])t.style.removeProperty(n);else if(e[n]instanceof Array){const i=e[n];t.style.setProperty(n,i[0],i[1])}else{const i=e[n];t.style.setProperty(n,i)}}}}))}applyScroll(e,t){var n,i;const o=this.mirror.getNode(e.id);if(!o)return this.debugNodeNotFound(e,e.id);const r=this.mirror.getMeta(o);if(o===this.iframe.contentDocument)null===(n=this.iframe.contentWindow)||void 0===n||n.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else if((null==r?void 0:r.type)===Q.Document)null===(i=o.defaultView)||void 0===i||i.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"});else try{o.scrollTo({top:e.y,left:e.x,behavior:t?"auto":"smooth"})}catch(e){}}applyInput(e){const t=this.mirror.getNode(e.id);if(!t)return this.debugNodeNotFound(e,e.id);try{t.checked=e.isChecked,t.value=e.text}catch(e){}}applySelection(e){try{const t=new Set,n=e.ranges.map((({start:e,startOffset:n,end:i,endOffset:o})=>{const r=this.mirror.getNode(e),s=this.mirror.getNode(i);if(!r||!s)return;const a=new Range;a.setStart(r,n),a.setEnd(s,o);const l=r.ownerDocument,c=null==l?void 0:l.getSelection();return c&&t.add(c),{range:a,selection:c}}));t.forEach((e=>e.removeAllRanges())),n.forEach((e=>{var t;return e&&(null===(t=e.selection)||void 0===t?void 0:t.addRange(e.range))}))}catch(e){}}applyStyleSheetMutation(e){var t;let n=null;e.styleId?n=this.styleMirror.getStyle(e.styleId):e.id&&(n=(null===(t=this.mirror.getNode(e.id))||void 0===t?void 0:t.sheet)||null),n&&(e.source===he.StyleSheetRule?this.applyStyleSheetRule(e,n):e.source===he.StyleDeclaration&&this.applyStyleDeclaration(e,n))}applyStyleSheetRule(e,t){var n,i,o,r;if(null===(n=e.adds)||void 0===n||n.forEach((({rule:e,index:n})=>{try{if(Array.isArray(n)){const{positions:i,index:o}=Te(n);Se(t.cssRules,i).insertRule(e,o)}else{const i=void 0===n?void 0:Math.min(n,t.cssRules.length);null==t||t.insertRule(e,i)}}catch(e){}})),null===(i=e.removes)||void 0===i||i.forEach((({index:e})=>{try{if(Array.isArray(e)){const{positions:n,index:i}=Te(e);Se(t.cssRules,n).deleteRule(i||0)}else null==t||t.deleteRule(e)}catch(e){}})),e.replace)try{null===(o=t.replace)||void 0===o||o.call(t,e.replace)}catch(e){}if(e.replaceSync)try{null===(r=t.replaceSync)||void 0===r||r.call(t,e.replaceSync)}catch(e){}}applyStyleDeclaration(e,t){if(e.set){Se(t.rules,e.index).style.setProperty(e.set.property,e.set.value,e.set.priority)}if(e.remove){Se(t.rules,e.index).style.removeProperty(e.remove.property)}}applyAdoptedStyleSheet(e){var t;const n=this.mirror.getNode(e.id);if(!n)return;null===(t=e.styles)||void 0===t||t.forEach((e=>{var t;let i=null,o=null;if(Ne(n)?o=(null===(t=n.ownerDocument)||void 0===t?void 0:t.defaultView)||null:"#document"===n.nodeName&&(o=n.defaultView),o)try{i=new o.CSSStyleSheet,this.styleMirror.add(i,e.styleId),this.applyStyleSheetRule({source:he.StyleSheetRule,adds:e.rules},i)}catch(e){}}));let i=0;const o=(e,t)=>{const n=t.map((e=>this.styleMirror.getStyle(e))).filter((e=>null!==e));Ne(e)?e.shadowRoot.adoptedStyleSheets=n:"#document"===e.nodeName&&(e.adoptedStyleSheets=n),n.length!==t.length&&i<10&&(setTimeout((()=>o(e,t)),0+100*i),i++)};o(n,e.styleIds)}legacy_resolveMissingNode(e,t,n,i){const{previousId:o,nextId:r}=i,s=o&&e[o],a=r&&e[r];if(s){const{node:i,mutation:o}=s;t.insertBefore(i,n),delete e[o.node.id],delete this.legacy_missingNodeRetryMap[o.node.id],(o.previousId||o.nextId)&&this.legacy_resolveMissingNode(e,t,i,o)}if(a){const{node:i,mutation:o}=a;t.insertBefore(i,n.nextSibling),delete e[o.node.id],delete this.legacy_missingNodeRetryMap[o.node.id],(o.previousId||o.nextId)&&this.legacy_resolveMissingNode(e,t,i,o)}}moveAndHover(e,t,n,i,o){const r=this.mirror.getNode(n);if(!r)return this.debugNodeNotFound(o,n);const s=Ee(r,this.iframe),a=e*s.absoluteScale+s.x,l=t*s.absoluteScale+s.y;this.mouse.style.left=`${a}px`,this.mouse.style.top=`${l}px`,i||this.drawMouseTail({x:a,y:l}),this.hoverElements(r)}drawMouseTail(e){if(!this.mouseTail)return;const{lineCap:t,lineWidth:n,strokeStyle:i,duration:o}=!0===this.config.mouseTail?gn:Object.assign({},gn,this.config.mouseTail),r=()=>{if(!this.mouseTail)return;const e=this.mouseTail.getContext("2d");e&&this.tailPositions.length&&(e.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),e.beginPath(),e.lineWidth=n,e.lineCap=t,e.strokeStyle=i,e.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach((t=>e.lineTo(t.x,t.y))),e.stroke())};this.tailPositions.push(e),r(),setTimeout((()=>{this.tailPositions=this.tailPositions.filter((t=>t!==e)),r()}),o/this.speedService.state.context.timer.speed)}hoverElements(e){var t;null===(t=this.lastHoveredRootNode||this.iframe.contentDocument)||void 0===t||t.querySelectorAll(".\\:hover").forEach((e=>{e.classList.remove(":hover")})),this.lastHoveredRootNode=e.getRootNode();let n=e;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(e){return e.type===de.IncrementalSnapshot&&(e.data.source>he.Mutation&&e.data.source<=he.Input)}backToNormal(){this.nextUserInteractionEvent=null,this.speedService.state.matches("normal")||(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(me.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(e,t){this.warn(`Node with id '${t}' not found. `,e)}warnCanvasMutationFailed(e,t){this.warn("Has error on canvas update",t,"canvas mutation:",e)}debugNodeNotFound(e,t){this.debug(`Node with id '${t}' not found. `,e)}warn(...e){this.config.showWarning&&this.config.logger.warn(mn,...e)}debug(...e){this.config.showDebug&&this.config.logger.log(mn,...e)}}function wn(e){let t="";return Object.keys(e).forEach((n=>{t+=`${n}: ${e[n]};`})),t}function bn(e,t=2){let n=String(e);const i=Math.pow(10,t-1);if(e<i)for(;String(i).length>n.length;)n=`0${e}`;return n}const En=6e4,Nn=36e5;function Sn(e){if(e<=0)return"00:00";const t=Math.floor(e/Nn);e%=Nn;const n=Math.floor(e/En);e%=En;const i=Math.floor(e/1e3);return t?`${bn(t)}:${bn(n)}:${bn(i)}`:`${bn(n)}:${bn(i)}`}function Tn(){let e=!1;return["fullscreen","webkitIsFullScreen","mozFullScreen","msFullscreenElement"].forEach((t=>{t in document&&(e=e||Boolean(document[t]))})),e}function Dn(e){return{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regExp","[object Undefined]":"undefined","[object Null]":"null","[object Object]":"object"}[Object.prototype.toString.call(e)]}function Mn(e){return e.type===de.IncrementalSnapshot&&(e.data.source>he.Mutation&&e.data.source<=he.Input)}function Cn(t){let n,i,o,r,s,a,d,p,w;return{c(){n=h("div"),i=h("input"),o=m(),r=h("label"),s=m(),a=h("span"),d=f(t[3]),v(i,"type","checkbox"),v(i,"id",t[2]),i.disabled=t[1],v(i,"class","svelte-9brlez"),v(r,"for",t[2]),v(r,"class","svelte-9brlez"),v(a,"class","label svelte-9brlez"),v(n,"class","switch svelte-9brlez"),b(n,"disabled",t[1])},m(e,u){c(e,n,u),l(n,i),i.checked=t[0],l(n,o),l(n,r),l(n,s),l(n,a),l(a,d),p||(w=g(i,"change",t[4]),p=!0)},p(e,[t]){4&t&&v(i,"id",e[2]),2&t&&(i.disabled=e[1]),1&t&&(i.checked=e[0]),4&t&&v(r,"for",e[2]),8&t&&y(d,e[3]),2&t&&b(n,"disabled",e[1])},i:e,o:e,d(e){e&&u(n),p=!1,w()}}}function xn(e,t,n){let{disabled:i}=t,{checked:o}=t,{id:r}=t,{label:s}=t;return e.$$set=e=>{"disabled"in e&&n(1,i=e.disabled),"checked"in e&&n(0,o=e.checked),"id"in e&&n(2,r=e.id),"label"in e&&n(3,s=e.label)},[o,i,r,s,function(){o=this.checked,n(0,o)}]}class Rn extends X{constructor(e){super(),q(this,e,xn,Cn,s,{disabled:1,checked:0,id:2,label:3})}}function kn(e,t,n){const i=e.slice();return i[39]=t[n],i}function An(e,t,n){const i=e.slice();return i[42]=t[n],i}function In(e,t,n){const i=e.slice();return i[45]=t[n],i}function On(e){let t,n,i,r,s,a,p,E,N,S,T,D,M,C,R,A,I,O,_,$,L,F,P,B,U,j,Y=Sn(e[6])+"",q=Sn(e[8].totalTime)+"",X=e[14],Q=[];for(let t=0;t<X.length;t+=1)Q[t]=_n(In(e,X,t));let J=e[9],Z=[];for(let t=0;t<J.length;t+=1)Z[t]=$n(An(e,J,t));function K(e,t){return"playing"===e[7]?Fn:Ln}let ee=K(e),te=ee(e),ne=e[3],ie=[];for(let t=0;t<ne.length;t+=1)ie[t]=Pn(kn(e,ne,t));function oe(t){e[30](t)}let re={id:"skip",disabled:"skipping"===e[10],label:"skip inactive"};return void 0!==e[0]&&(re.checked=e[0]),$=new Rn({props:re}),x.push((()=>function(e,t,n){const i=e.$$.props[t];void 0!==i&&(e.$$.bound[i]=n,n(e.$$.ctx[i]))}($,"checked",oe))),{c(){t=h("div"),n=h("div"),i=h("span"),r=f(Y),s=m(),a=h("div"),p=h("div"),E=m();for(let e=0;e<Q.length;e+=1)Q[e].c();N=m();for(let e=0;e<Z.length;e+=1)Z[e].c();S=m(),T=h("div"),D=m(),M=h("span"),C=f(q),R=m(),A=h("div"),I=h("button"),te.c(),O=m();for(let e=0;e<ie.length;e+=1)ie[e].c();_=m(),z($.$$.fragment),F=m(),P=h("button"),P.innerHTML='<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16"><defs><style type="text/css"></style></defs><path d="M916 380c-26.4 0-48-21.6-48-48L868 223.2 613.6 477.6c-18.4\n 18.4-48.8 18.4-68 0-18.4-18.4-18.4-48.8 0-68L800 156 692 156c-26.4\n 0-48-21.6-48-48 0-26.4 21.6-48 48-48l224 0c26.4 0 48 21.6 48 48l0\n 224C964 358.4 942.4 380 916 380zM231.2 860l108.8 0c26.4 0 48 21.6 48\n 48s-21.6 48-48 48l-224 0c-26.4 0-48-21.6-48-48l0-224c0-26.4 21.6-48\n 48-48 26.4 0 48 21.6 48 48L164 792l253.6-253.6c18.4-18.4 48.8-18.4\n 68 0 18.4 18.4 18.4 48.8 0 68L231.2 860z" p-id="1286"></path></svg>',v(i,"class","rr-timeline__time svelte-19ke1iv"),v(p,"class","rr-progress__step svelte-19ke1iv"),w(p,"width",e[13]),v(T,"class","rr-progress__handler svelte-19ke1iv"),w(T,"left",e[13]),v(a,"class","rr-progress svelte-19ke1iv"),b(a,"disabled","skipping"===e[10]),v(M,"class","rr-timeline__time svelte-19ke1iv"),v(n,"class","rr-timeline svelte-19ke1iv"),v(I,"class","svelte-19ke1iv"),v(P,"class","svelte-19ke1iv"),v(A,"class","rr-controller__btns svelte-19ke1iv"),v(t,"class","rr-controller svelte-19ke1iv")},m(o,u){c(o,t,u),l(t,n),l(n,i),l(i,r),l(n,s),l(n,a),l(a,p),e[27](p),l(a,E);for(let e=0;e<Q.length;e+=1)Q[e]&&Q[e].m(a,null);l(a,N);for(let e=0;e<Z.length;e+=1)Z[e]&&Z[e].m(a,null);l(a,S),l(a,T),e[28](a),l(n,D),l(n,M),l(M,C),l(t,R),l(t,A),l(A,I),te.m(I,null),l(A,O);for(let e=0;e<ie.length;e+=1)ie[e]&&ie[e].m(A,null);l(A,_),G($,A,null),l(A,F),l(A,P),B=!0,U||(j=[g(a,"click",e[16]),g(I,"click",e[4]),g(P,"click",e[31])],U=!0)},p(e,t){if((!B||64&t[0])&&Y!==(Y=Sn(e[6])+"")&&y(r,Y),(!B||8192&t[0])&&w(p,"width",e[13]),16384&t[0]){let n;for(X=e[14],n=0;n<X.length;n+=1){const i=In(e,X,n);Q[n]?Q[n].p(i,t):(Q[n]=_n(i),Q[n].c(),Q[n].m(a,N))}for(;n<Q.length;n+=1)Q[n].d(1);Q.length=X.length}if(512&t[0]){let n;for(J=e[9],n=0;n<J.length;n+=1){const i=An(e,J,n);Z[n]?Z[n].p(i,t):(Z[n]=$n(i),Z[n].c(),Z[n].m(a,S))}for(;n<Z.length;n+=1)Z[n].d(1);Z.length=J.length}if((!B||8192&t[0])&&w(T,"left",e[13]),(!B||1024&t[0])&&b(a,"disabled","skipping"===e[10]),(!B||256&t[0])&&q!==(q=Sn(e[8].totalTime)+"")&&y(C,q),ee!==(ee=K(e))&&(te.d(1),te=ee(e),te&&(te.c(),te.m(I,null))),1066&t[0]){let n;for(ne=e[3],n=0;n<ne.length;n+=1){const i=kn(e,ne,n);ie[n]?ie[n].p(i,t):(ie[n]=Pn(i),ie[n].c(),ie[n].m(A,_))}for(;n<ie.length;n+=1)ie[n].d(1);ie.length=ne.length}const n={};var i;1024&t[0]&&(n.disabled="skipping"===e[10]),!L&&1&t[0]&&(L=!0,n.checked=e[0],i=()=>L=!1,k.push(i)),$.$set(n)},i(e){B||(V($.$$.fragment,e),B=!0)},o(e){W($.$$.fragment,e),B=!1},d(n){n&&u(t),e[27](null),d(Q,n),d(Z,n),e[28](null),te.d(),d(ie,n),H($),U=!1,o(j)}}}function _n(e){let t,n;return{c(){t=h("div"),v(t,"title",n=e[45].name),w(t,"width",e[45].width),w(t,"height","4px"),w(t,"position","absolute"),w(t,"background",e[45].background),w(t,"left",e[45].position)},m(e,n){c(e,t,n)},p(e,i){16384&i[0]&&n!==(n=e[45].name)&&v(t,"title",n),16384&i[0]&&w(t,"width",e[45].width),16384&i[0]&&w(t,"background",e[45].background),16384&i[0]&&w(t,"left",e[45].position)},d(e){e&&u(t)}}}function $n(e){let t,n;return{c(){t=h("div"),v(t,"title",n=e[42].name),w(t,"width","10px"),w(t,"height","5px"),w(t,"position","absolute"),w(t,"top","2px"),w(t,"transform","translate(-50%, -50%)"),w(t,"background",e[42].background),w(t,"left",e[42].position)},m(e,n){c(e,t,n)},p(e,i){512&i[0]&&n!==(n=e[42].name)&&v(t,"title",n),512&i[0]&&w(t,"background",e[42].background),512&i[0]&&w(t,"left",e[42].position)},d(e){e&&u(t)}}}function Ln(e){let t,n;return{c(){t=p("svg"),n=p("path"),v(n,"d","M170.65984 896l0-768 640 384zM644.66944\n 512l-388.66944-233.32864 0 466.65728z"),v(t,"class","icon"),v(t,"viewBox","0 0 1024 1024"),v(t,"version","1.1"),v(t,"xmlns","http://www.w3.org/2000/svg"),v(t,"xmlns:xlink","http://www.w3.org/1999/xlink"),v(t,"width","16"),v(t,"height","16")},m(e,i){c(e,t,i),l(t,n)},d(e){e&&u(t)}}}function Fn(e){let t,n;return{c(){t=p("svg"),n=p("path"),v(n,"d","M682.65984 128q53.00224 0 90.50112 37.49888t37.49888 90.50112l0\n 512q0 53.00224-37.49888 90.50112t-90.50112\n 37.49888-90.50112-37.49888-37.49888-90.50112l0-512q0-53.00224\n 37.49888-90.50112t90.50112-37.49888zM341.34016 128q53.00224 0\n 90.50112 37.49888t37.49888 90.50112l0 512q0 53.00224-37.49888\n 90.50112t-90.50112\n 37.49888-90.50112-37.49888-37.49888-90.50112l0-512q0-53.00224\n 37.49888-90.50112t90.50112-37.49888zM341.34016 213.34016q-17.67424\n 0-30.16704 12.4928t-12.4928 30.16704l0 512q0 17.67424 12.4928\n 30.16704t30.16704 12.4928 30.16704-12.4928\n 12.4928-30.16704l0-512q0-17.67424-12.4928-30.16704t-30.16704-12.4928zM682.65984\n 213.34016q-17.67424 0-30.16704 12.4928t-12.4928 30.16704l0 512q0\n 17.67424 12.4928 30.16704t30.16704 12.4928 30.16704-12.4928\n 12.4928-30.16704l0-512q0-17.67424-12.4928-30.16704t-30.16704-12.4928z"),v(t,"class","icon"),v(t,"viewBox","0 0 1024 1024"),v(t,"version","1.1"),v(t,"xmlns","http://www.w3.org/2000/svg"),v(t,"xmlns:xlink","http://www.w3.org/1999/xlink"),v(t,"width","16"),v(t,"height","16")},m(e,i){c(e,t,i),l(t,n)},d(e){e&&u(t)}}}function Pn(e){let t,n,i,o,r,s,a=e[39]+"";function d(){return e[29](e[39])}return{c(){t=h("button"),n=f(a),i=f("x"),t.disabled=o="skipping"===e[10],v(t,"class","svelte-19ke1iv"),b(t,"active",e[39]===e[1]&&"skipping"!==e[10])},m(e,o){c(e,t,o),l(t,n),l(t,i),r||(s=g(t,"click",d),r=!0)},p(i,r){e=i,8&r[0]&&a!==(a=e[39]+"")&&y(n,a),1024&r[0]&&o!==(o="skipping"===e[10])&&(t.disabled=o),1034&r[0]&&b(t,"active",e[39]===e[1]&&"skipping"!==e[10])},d(e){e&&u(t),r=!1,s()}}}function Bn(e){let t,n,i=e[2]&&On(e);return{c(){i&&i.c(),t=f("")},m(e,o){i&&i.m(e,o),c(e,t,o),n=!0},p(e,n){e[2]?i?(i.p(e,n),4&n[0]&&V(i,1)):(i=On(e),i.c(),V(i,1),i.m(t.parentNode,t)):i&&(U(),W(i,1,1,(()=>{i=null})),j())},i(e){n||(V(i),n=!0)},o(e){W(i),n=!1},d(e){i&&i.d(e),e&&u(t)}}}function Un(e,t,n){return(100-(t-n)/(t-e)*100).toFixed(2)}function jn(e,t,n){const i=M();let o,r,s,a,l,c,u,d,h,p,{replayer:f}=t,{showController:m}=t,{autoPlay:g}=t,{skipInactive:v}=t,{speedOption:y}=t,{speed:w=(y.length?y[0]:1)}=t,{tags:b={}}=t,{inactiveColor:E}=t,N=0,C=null,R=!1,k=null;const A=()=>{C&&(cancelAnimationFrame(C),C=null)},I=()=>{"paused"===o&&(l?(f.play(),l=!1):f.play(N))},O=()=>{"playing"===o&&(f.pause(),R=!1)},_=(e,t)=>{n(6,N=e),R=!1,l=!1;("boolean"==typeof t?t:"playing"===o)?f.play(e):f.pause(e)},$=(e,t,i=!1,o)=>{k=i?{start:e,end:t}:null,n(6,N=e),R=t,c=o,f.play(e)},L=e=>{let t="playing"===o;n(1,w=e),t&&f.pause(),f.setConfig({speed:w}),t&&f.play(N)};var F;T((()=>{n(7,o=f.service.state.value),n(10,r=f.speedService.state.value),f.on("state-change",(e=>{const{player:t,speed:i}=e;if((null==t?void 0:t.value)&&o!==t.value)switch(n(7,o=t.value),o){case"playing":A(),C=requestAnimationFrame((function e(){n(6,N=f.getCurrentTime()),R&&N>=R&&(k?$(k.start,k.end,!0,void 0):(f.pause(),c&&(c(),c=null))),N<u.totalTime&&(C=requestAnimationFrame(e))}));break;case"paused":A()}(null==i?void 0:i.value)&&r!==i.value&&n(10,r=i.value)})),f.on("finish",(()=>{l=!0,c&&(c(),c=null)})),g&&f.play()})),F=()=>{v!==f.config.skipInactive&&f.setConfig({skipInactive:v})},S().$$.after_update.push(F),D((()=>{f.pause(),A()}));return e.$$set=e=>{"replayer"in e&&n(17,f=e.replayer),"showController"in e&&n(2,m=e.showController),"autoPlay"in e&&n(18,g=e.autoPlay),"skipInactive"in e&&n(0,v=e.skipInactive),"speedOption"in e&&n(3,y=e.speedOption),"speed"in e&&n(1,w=e.speed),"tags"in e&&n(19,b=e.tags),"inactiveColor"in e&&n(20,E=e.inactiveColor)},e.$$.update=()=>{if(64&e.$$.dirty[0]&&i("ui-update-current-time",{payload:N}),128&e.$$.dirty[0]&&i("ui-update-player-state",{payload:o}),131072&e.$$.dirty[0]&&n(8,u=f.getMetaData()),320&e.$$.dirty[0]){const e=Math.min(1,N/u.totalTime);n(13,d=100*e+"%"),i("ui-update-progress",{payload:e})}655360&e.$$.dirty[0]&&n(9,h=(()=>{const{context:e}=f.service.state,t=e.events.length,n=e.events[0].timestamp,i=e.events[t-1].timestamp,o=[];return e.events.forEach((e=>{if(e.type===de.Custom){const t={name:e.data.tag,background:b[e.data.tag]||"rgb(73, 80, 246)",position:`${Un(n,i,e.timestamp)}%`};o.push(t)}})),o})()),1179648&e.$$.dirty[0]&&n(14,p=(()=>{try{const{context:e}=f.service.state,t=e.events.length,n=e.events[0].timestamp,i=e.events[t-1].timestamp,o=function(e){const t=[];let n=e[0].timestamp;for(const i of e)Mn(i)&&(i.timestamp-n>1e4&&t.push([n,i.timestamp]),n=i.timestamp);return t}(e.events),r=(e,t,n,i)=>((i-n)/(t-e)*100).toFixed(2);return o.map((e=>({name:"inactive period",background:E,position:`${Un(n,i,e[0])}%`,width:`${r(n,i,e[0],e[1])}%`})))}catch(e){return[]}})())},[v,w,m,y,()=>{switch(o){case"playing":O();break;case"paused":I()}},L,N,o,u,h,r,s,a,d,p,i,e=>{if("skipping"===r)return;const t=s.getBoundingClientRect();let n=(e.clientX-t.left)/t.width;n<0?n=0:n>1&&(n=1);const i=u.totalTime*n;_(i)},f,g,b,E,I,O,_,$,()=>{n(0,v=!v)},()=>Promise.resolve().then((()=>{n(8,u=f.getMetaData())})),function(e){x[e?"unshift":"push"]((()=>{a=e,n(12,a)}))},function(e){x[e?"unshift":"push"]((()=>{s=e,n(11,s)}))},e=>L(e),function(e){v=e,n(0,v)},()=>i("fullscreen")]}class Vn extends X{constructor(e){super(),q(this,e,jn,Bn,s,{replayer:17,showController:2,autoPlay:18,skipInactive:0,speedOption:3,speed:1,tags:19,inactiveColor:20,toggle:4,play:21,pause:22,goto:23,playRange:24,setSpeed:5,toggleSkipInactive:25,triggerUpdateMeta:26},null,[-1,-1])}get toggle(){return this.$$.ctx[4]}get play(){return this.$$.ctx[21]}get pause(){return this.$$.ctx[22]}get goto(){return this.$$.ctx[23]}get playRange(){return this.$$.ctx[24]}get setSpeed(){return this.$$.ctx[5]}get toggleSkipInactive(){return this.$$.ctx[25]}get triggerUpdateMeta(){return this.$$.ctx[26]}}function Wn(e){let t,n,i={replayer:e[7],showController:e[3],autoPlay:e[1],speedOption:e[2],skipInactive:e[0],tags:e[4],inactiveColor:e[5]};return t=new Vn({props:i}),e[32](t),t.$on("fullscreen",e[33]),{c(){z(t.$$.fragment)},m(e,i){G(t,e,i),n=!0},p(e,n){const i={};128&n[0]&&(i.replayer=e[7]),8&n[0]&&(i.showController=e[3]),2&n[0]&&(i.autoPlay=e[1]),4&n[0]&&(i.speedOption=e[2]),1&n[0]&&(i.skipInactive=e[0]),16&n[0]&&(i.tags=e[4]),32&n[0]&&(i.inactiveColor=e[5]),t.$set(i)},i(e){n||(V(t.$$.fragment,e),n=!0)},o(e){W(t.$$.fragment,e),n=!1},d(n){e[32](null),H(t,n)}}}function zn(e){let t,n,i,o,r=e[7]&&Wn(e);return{c(){t=h("div"),n=h("div"),i=m(),r&&r.c(),v(n,"class","rr-player__frame"),v(n,"style",e[11]),v(t,"class","rr-player"),v(t,"style",e[12])},m(s,a){c(s,t,a),l(t,n),e[31](n),l(t,i),r&&r.m(t,null),e[34](t),o=!0},p(e,i){(!o||2048&i[0])&&v(n,"style",e[11]),e[7]?r?(r.p(e,i),128&i[0]&&V(r,1)):(r=Wn(e),r.c(),V(r,1),r.m(t,null)):r&&(U(),W(r,1,1,(()=>{r=null})),j()),(!o||4096&i[0])&&v(t,"style",e[12])},i(e){o||(V(r),o=!0)},o(e){W(r),o=!1},d(n){n&&u(t),e[31](null),r&&r.d(),e[34](null)}}}function Gn(e,n,i){let o,{width:r=1024}=n,{height:s=576}=n,{maxScale:l=1}=n,{events:c=[]}=n,{skipInactive:u=!0}=n,{autoPlay:d=!0}=n,{speedOption:h=[1,2,4,8]}=n,{speed:p=1}=n,{showController:f=!0}=n,{tags:m={}}=n,{inactiveColor:g="#D4D4D4"}=n;let v,y,w,b,E,N,S=r,M=s;const C=(e,t)=>{const n=[r/t.width,s/t.height];l&&n.push(l),e.style.transform=`scale(${Math.min(...n)})translate(-50%, -50%)`},R=()=>{var e;v&&(Tn()?document.exitFullscreen?document.exitFullscreen():document.mozExitFullscreen?document.mozExitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen():(e=v).requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen())};T((()=>{if(void 0!==h&&"array"!==Dn(h))throw new Error("speedOption must be array");if(h.forEach((e=>{if("number"!==Dn(e))throw new Error("item of speedOption must be number")})),h.indexOf(p)<0)throw new Error(`speed must be one of speedOption,\n current config:\n {\n ...\n speed: ${p},\n speedOption: [${h.toString()}]\n ...\n }\n `);var e;i(7,o=new yn(c,Object.assign({speed:p,root:y,unpackFn:jt},n))),o.on("resize",(e=>{C(o.wrapper,e)})),e=()=>{Tn()?setTimeout((()=>{S=r,M=s,i(13,r=v.offsetWidth),i(14,s=v.offsetHeight-(f?80:0)),C(o.wrapper,{width:o.iframe.offsetWidth,height:o.iframe.offsetHeight})}),0):(i(13,r=S),i(14,s=M),C(o.wrapper,{width:o.iframe.offsetWidth,height:o.iframe.offsetHeight}))},document.addEventListener("fullscreenchange",e),document.addEventListener("webkitfullscreenchange",e),document.addEventListener("mozfullscreenchange",e),document.addEventListener("MSFullscreenChange",e),w=()=>{document.removeEventListener("fullscreenchange",e),document.removeEventListener("webkitfullscreenchange",e),document.removeEventListener("mozfullscreenchange",e),document.removeEventListener("MSFullscreenChange",e)}})),D((()=>{w&&w()}));return e.$$set=e=>{i(39,n=t(t({},n),a(e))),"width"in e&&i(13,r=e.width),"height"in e&&i(14,s=e.height),"maxScale"in e&&i(15,l=e.maxScale),"events"in e&&i(16,c=e.events),"skipInactive"in e&&i(0,u=e.skipInactive),"autoPlay"in e&&i(1,d=e.autoPlay),"speedOption"in e&&i(2,h=e.speedOption),"speed"in e&&i(17,p=e.speed),"showController"in e&&i(3,f=e.showController),"tags"in e&&i(4,m=e.tags),"inactiveColor"in e&&i(5,g=e.inactiveColor)},e.$$.update=()=>{24576&e.$$.dirty[0]&&i(11,E=wn({width:`${r}px`,height:`${s}px`})),24584&e.$$.dirty[0]&&i(12,N=wn({width:`${r}px`,height:`${s+(f?80:0)}px`}))},n=a(n),[u,d,h,f,m,g,R,o,v,y,b,E,N,r,s,l,c,p,()=>o.getMirror(),()=>{C(o.wrapper,{width:o.iframe.offsetWidth,height:o.iframe.offsetHeight})},(e,t)=>{switch(o.on(e,t),e){case"ui-update-current-time":case"ui-update-progress":case"ui-update-player-state":b.$on(e,(({detail:e})=>t(e)))}},e=>{o.addEvent(e),b.triggerUpdateMeta()},()=>o.getMetaData(),()=>o,()=>{b.toggle()},e=>{b.setSpeed(e)},()=>{b.toggleSkipInactive()},()=>{b.play()},()=>{b.pause()},(e,t)=>{b.goto(e,t)},(e,t,n=!1,i)=>{b.playRange(e,t,n,i)},function(e){x[e?"unshift":"push"]((()=>{y=e,i(9,y)}))},function(e){x[e?"unshift":"push"]((()=>{b=e,i(10,b)}))},()=>R(),function(e){x[e?"unshift":"push"]((()=>{v=e,i(8,v)}))}]}class Hn extends X{constructor(e){super(),q(this,e,Gn,zn,s,{width:13,height:14,maxScale:15,events:16,skipInactive:0,autoPlay:1,speedOption:2,speed:17,showController:3,tags:4,inactiveColor:5,getMirror:18,triggerResize:19,toggleFullscreen:6,addEventListener:20,addEvent:21,getMetaData:22,getReplayer:23,toggle:24,setSpeed:25,toggleSkipInactive:26,play:27,pause:28,goto:29,playRange:30},null,[-1,-1])}get getMirror(){return this.$$.ctx[18]}get triggerResize(){return this.$$.ctx[19]}get toggleFullscreen(){return this.$$.ctx[6]}get addEventListener(){return this.$$.ctx[20]}get addEvent(){return this.$$.ctx[21]}get getMetaData(){return this.$$.ctx[22]}get getReplayer(){return this.$$.ctx[23]}get toggle(){return this.$$.ctx[24]}get setSpeed(){return this.$$.ctx[25]}get toggleSkipInactive(){return this.$$.ctx[26]}get play(){return this.$$.ctx[27]}get pause(){return this.$$.ctx[28]}get goto(){return this.$$.ctx[29]}get playRange(){return this.$$.ctx[30]}}return class extends Hn{constructor(e){super({target:e.target,props:e.data||e.props})}}}();
30
+ //# sourceMappingURL=index.js.map