@screeb/rrweb 1.0.16 → 1.0.18

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.
@@ -1,8 +1,8 @@
1
1
  (function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrweb", [], f);} else if ("object" == typeof exports) {exports["rrweb"] = f();} else {g["rrweb"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
2
2
  "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Tr=Object.defineProperty,Dr=(e,t,s)=>t in e?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ce=(e,t,s)=>Dr(e,typeof t!="symbol"?t+"":t,s),x=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(x||{});function Ws(e){return e.nodeType===e.ELEMENT_NODE}function qe(e){return e?.host?.shadowRoot===e}function Qe(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Rr(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function xr(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const s=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?s.push("layer"):e.layerName&&s.push(`layer(${e.layerName})`),e.supportsText&&s.push(`supports(${e.supportsText})`),e.media.length&&s.push(e.media.mediaText),s.join(" ")+";"}function ut(e){try{const t=e.rules||e.cssRules;return t?Rr(Array.from(t,Bs).join("")):null}catch{return null}}function kr(e){let t="";for(let s=0;s<e.style.length;s++){const r=e.style,n=r[s],i=r.getPropertyPriority(n);t+=`${n}:${r.getPropertyValue(n)}${i?" !important":""};`}return`${e.selectorText} { ${t} }`}function Bs(e){let t;if(Ar(e))try{t=ut(e.styleSheet)||xr(e)}catch{}else if(_r(e)){let s=e.cssText;const r=e.selectorText.includes(":"),n=typeof e.style.all=="string"&&e.style.all;if(n&&(s=kr(e)),r&&(s=Or(s)),r||n)return s}return t||e.cssText}function Or(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Ar(e){return"styleSheet"in e}function _r(e){return"selectorText"in e}class Wt{constructor(){Ce(this,"idNodeMap",new Map),Ce(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const s=this.getId(t);this.idNodeMap.delete(s),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,s){const r=s.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,s)}replace(t,s){const r=this.getNode(t);if(r){const n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(s,n)}this.idNodeMap.set(t,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Us(){return new Wt}function bt({maskInputOptions:e,tagName:t,type:s}){return t==="OPTION"&&(t="SELECT"),!!(e[t.toLowerCase()]||s&&e[s]||s==="password"||t==="INPUT"&&!s&&e.text)}function Ke({isMasked:e,element:t,value:s,maskInputFn:r}){let n=s||"";return e?(r&&(n=r(n,t)),"*".repeat(n.length)):n}function De(e){return e.toLowerCase()}function Dt(e){return e.toUpperCase()}const ls="__rrweb_original__";function Lr(e){const t=e.getContext("2d");if(!t)return!0;const s=50;for(let r=0;r<e.width;r+=s)for(let n=0;n<e.height;n+=s){const i=t.getImageData,o=ls in i?i[ls]:i;if(new Uint32Array(o.call(t,r,n,Math.min(s,e.width-r),Math.min(s,e.height-n)).data.buffer).some(l=>l!==0))return!1}return!0}function Fr(e,t){return!e||!t||e.type!==t.type?!1:e.type===x.Document?e.compatMode===t.compatMode:e.type===x.DocumentType?e.name===t.name&&e.publicId===t.publicId&&e.systemId===t.systemId:e.type===x.Comment||e.type===x.Text||e.type===x.CDATA?e.textContent===t.textContent:e.type===x.Element?e.tagName===t.tagName&&JSON.stringify(e.attributes)===JSON.stringify(t.attributes)&&e.isSVG===t.isSVG&&e.needBlock===t.needBlock:!1}function Bt(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?De(t):null}function dt(e,t,s){return t==="INPUT"&&(s==="radio"||s==="checkbox")?e.getAttribute("value")||"":e.value}function Ut(e,t){let s;try{s=new URL(e,t??window.location.href)}catch{return null}const r=/\.([0-9a-z]+)(?:$)/i;return s.pathname.match(r)?.[1]??null}const cs={};function Vs(e){const t=cs[e];if(t)return t;const s=window.document;let r=window[e];if(s&&typeof s.createElement=="function")try{const n=s.createElement("iframe");n.hidden=!0,s.head.appendChild(n);const i=n.contentWindow;i&&i[e]&&(r=i[e]),s.head.removeChild(n)}catch{}return cs[e]=r.bind(window)}function Rt(...e){return Vs("setTimeout")(...e)}function Hs(...e){return Vs("clearTimeout")(...e)}function zs(e){try{return e.contentDocument}catch{}}let Pr=1;const Wr=new RegExp("[^a-z0-9-_:]"),et=-2;function Vt(){return Pr++}function Br(e){if(e instanceof HTMLFormElement)return"form";const t=De(e.tagName);return Wr.test(t)?"div":t}function Ur(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let ke,us;const Vr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Hr=/^(?:[a-z+]+:)?\/\//i,zr=/^www\..*/i,Gr=/^(data:)([^,]*),(.*)/i;function $r(e,t){if(!e||t.size===0)return e;try{const s=e.split(";"),r=[];for(let n of s){if(n=n.trim(),!n)continue;const i=n.indexOf(":");if(i===-1){r.push(n);continue}const o=n.slice(0,i).trim();t.has(o)||r.push(n)}return r.join("; ")+(r.length>0&&e.endsWith(";")?";":"")}catch(s){return console.warn("Error filtering CSS properties:",s),e}}function ht(e,t){return(e||"").replace(Vr,(s,r,n,i,o,a)=>{const l=n||o||a,c=r||i||"";if(!l)return s;if(Hr.test(l)||zr.test(l))return`url(${c}${l}${c})`;if(Gr.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${Ur(t)+l}${c})`;const u=t.split("/"),d=l.split("/");u.pop();for(const h of d)h!=="."&&(h===".."?u.pop():u.push(h));return`url(${c}${u.join("/")}${c})`})}const jr=/^[^ \t\n\r\u000c]+/,Yr=/^[, \t\n\r\u000c]+/;function Xr(e,t){if(t.trim()==="")return t;let s=0;function r(i){let o;const a=i.exec(t.substring(s));return a?(o=a[0],s+=o.length,o):""}const n=[];for(;r(Yr),!(s>=t.length);){let i=r(jr);if(i.slice(-1)===",")i=Le(e,i.substring(0,i.length-1)),n.push(i);else{let o="";i=Le(e,i);let a=!1;for(;;){const l=t.charAt(s);if(l===""){n.push((i+o).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){s+=1,n.push((i+o).trim());break}else l==="("&&(a=!0);o+=l,s+=1}}}return n.join(", ")}const ds=new WeakMap;function Le(e,t){return!t||t.trim()===""?t:vt(e,t)}function qr(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function vt(e,t){let s=ds.get(e);if(s||(s=e.createElement("a"),ds.set(e,s)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return s.setAttribute("href",t),s.href}function Gs(e,t,s,r,n,i,o){if(!r)return r;if(s==="src"||s==="href"&&!(t==="use"&&r[0]==="#"))return Le(e,r);if(s==="xlink:href"&&r[0]!=="#")return Le(e,r);if(s==="background"&&(t==="table"||t==="td"||t==="th"))return Le(e,r);if(s==="srcset")return Xr(e,r);if(s==="style"){let a=ht(r,vt(e));return o&&o.size>0&&(a=$r(a,o)),a}else if(t==="object"&&s==="data")return Le(e,r);return typeof i=="function"?i(s,r,n):r}function $s(e,t,s){return(e==="video"||e==="audio")&&t==="autoplay"}function Qr(e,t,s,r){try{if(r&&e.matches(r))return!1;if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(s)return e.matches(s)}catch{}return!1}function Jr(e,t){for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}return!1}function Ne(e,t,s=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>s?-1:t(e)?r:Ne(e.parentNode,t,s,r+1)}function Fe(e,t){return s=>{const r=s;if(r===null)return!1;try{if(e){if(typeof e=="string"){if(r.matches(`.${e}`))return!0}else if(Jr(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}function He(e,t,s,r,n,i){try{const o=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(o===null)return!1;if(o.tagName==="INPUT"){const c=o.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(c))return!0}let a=-1,l=-1;if(i){if(l=Ne(o,Fe(r,n)),l<0)return!0;a=Ne(o,Fe(t,s),l>=0?l:1/0)}else{if(a=Ne(o,Fe(t,s)),a<0)return!1;l=Ne(o,Fe(r,n),a>=0?a:1/0)}return a>=0?l>=0?a<=l:!0:l>=0?!1:!!i}catch{}return!!i}function Zr(e,t,s){const r=e.contentWindow;if(!r)return;let n=!1,i;try{i=r.document.readyState}catch{return}if(i!=="complete"){const a=Rt(()=>{n||(t(),n=!0)},s);e.addEventListener("load",()=>{Hs(a),n=!0,t()});return}const o="about:blank";if(r.location.href!==o||e.src===o||e.src==="")return Rt(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Kr(e,t,s){let r=!1,n;try{n=e.sheet}catch{return}if(n)return;const i=Rt(()=>{r||(t(),r=!0)},s);e.addEventListener("load",()=>{Hs(i),r=!0,t()})}function en(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:a,maskAttributeFn:l,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:h,inlineStylesheet:p,maskInputOptions:f={},maskTextFn:y,maskInputFn:g,dataURLOptions:m={},inlineImages:b,recordCanvas:E,keepIframeSrcFn:I,newlyAddedElement:U=!1,ignoreCSSAttributes:R}=t,w=tn(s,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:x.Document,childNodes:[],compatMode:e.compatMode}:{type:x.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:x.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:w};case e.ELEMENT_NODE:return rn(e,{doc:s,blockClass:n,blockSelector:i,unblockSelector:o,inlineStylesheet:p,maskAttributeFn:l,maskInputOptions:f,maskInputFn:g,dataURLOptions:m,inlineImages:b,recordCanvas:E,keepIframeSrcFn:I,newlyAddedElement:U,rootId:w,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:h,ignoreCSSAttributes:R});case e.TEXT_NODE:return sn(e,{doc:s,maskAllText:a,maskTextClass:c,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:h,maskTextFn:y,maskInputOptions:f,maskInputFn:g,rootId:w});case e.CDATA_SECTION_NODE:return{type:x.CDATA,textContent:"",rootId:w};case e.COMMENT_NODE:return{type:x.Comment,textContent:e.textContent||"",rootId:w};default:return!1}}function tn(e,t){if(!t.hasNode(e))return;const s=t.getId(e);return s===1?void 0:s}function sn(e,t){const{maskAllText:s,maskTextClass:r,unmaskTextClass:n,maskTextSelector:i,unmaskTextSelector:o,maskTextFn:a,maskInputOptions:l,maskInputFn:c,rootId:u}=t,d=e.parentNode&&e.parentNode.tagName;let h=e.textContent;const p=d==="STYLE"?!0:void 0,f=d==="SCRIPT"?!0:void 0,y=d==="TEXTAREA"?!0:void 0;if(p&&h){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(h=ut(e.parentNode.sheet))}catch(m){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${m}`,e)}h=ht(h,vt(t.doc))}f&&(h="SCRIPT_PLACEHOLDER");const g=He(e,r,i,n,o,s);if(!p&&!f&&!y&&h&&g&&(h=a?a(h,e.parentElement):h.replace(/[\S]/g,"*")),y&&h&&(l.textarea||g)&&(h=c?c(h,e.parentNode):h.replace(/[\S]/g,"*")),d==="OPTION"&&h){const m=bt({type:null,tagName:d,maskInputOptions:l});h=Ke({isMasked:He(e,r,i,n,o,m),element:e,value:h,maskInputFn:c})}return{type:x.Text,textContent:h||"",isStyle:p,rootId:u}}function rn(e,t){const{doc:s,blockClass:r,blockSelector:n,unblockSelector:i,inlineStylesheet:o,maskInputOptions:a={},maskAttributeFn:l,maskInputFn:c,dataURLOptions:u={},inlineImages:d,recordCanvas:h,keepIframeSrcFn:p,newlyAddedElement:f=!1,rootId:y,maskTextClass:g,unmaskTextClass:m,maskTextSelector:b,unmaskTextSelector:E,ignoreCSSAttributes:I}=t,U=Qr(e,r,n,i),R=Br(e);let w={};const _=e.attributes.length;for(let C=0;C<_;C++){const k=e.attributes[C];k.name&&!$s(R,k.name,k.value)&&(w[k.name]=Gs(s,R,De(k.name),k.value,e,l,I))}if(R==="link"&&o){const C=Array.from(s.styleSheets).find(V=>V.href===e.href);let k=null;C&&(k=ut(C)),k&&(w.rel=null,w.href=null,w.crossorigin=null,w._cssText=ht(k,C.href))}if(R==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const C=ut(e.sheet);C&&(w._cssText=ht(C,vt(s)))}if(R==="input"||R==="textarea"||R==="select"||R==="option"){const C=e,k=Bt(C),V=dt(C,Dt(R),k),Y=C.checked;if(k!=="submit"&&k!=="button"&&V){const q=He(C,g,b,m,E,bt({type:k,tagName:Dt(R),maskInputOptions:a}));w.value=Ke({isMasked:q,element:C,value:V,maskInputFn:c})}Y&&(w.checked=Y)}if(R==="option"&&(e.selected&&!a.select?w.selected=!0:delete w.selected),R==="canvas"&&h){if(e.__context==="2d")Lr(e)||(w.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const C=e.toDataURL(u.type,u.quality),k=s.createElement("canvas");k.width=e.width,k.height=e.height;const V=k.toDataURL(u.type,u.quality);C!==V&&(w.rr_dataURL=C)}}if(R==="img"&&d){ke||(ke=s.createElement("canvas"),us=ke.getContext("2d"));const C=e,k=C.currentSrc||C.getAttribute("src")||"<unknown-src>",V=C.crossOrigin,Y=()=>{C.removeEventListener("load",Y);try{ke.width=C.naturalWidth,ke.height=C.naturalHeight,us.drawImage(C,0,0),w.rr_dataURL=ke.toDataURL(u.type,u.quality)}catch(q){if(C.crossOrigin!=="anonymous"){C.crossOrigin="anonymous",C.complete&&C.naturalWidth!==0?Y():C.addEventListener("load",Y);return}else console.warn(`Cannot inline img src=${k}! Error: ${q}`)}C.crossOrigin==="anonymous"&&(V?w.crossOrigin=V:C.removeAttribute("crossorigin"))};C.complete&&C.naturalWidth!==0?Y():C.addEventListener("load",Y)}if((R==="audio"||R==="video")&&(w.rr_mediaState=e.paused?"paused":"played",w.rr_mediaCurrentTime=e.currentTime),f||(e.scrollLeft&&(w.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(w.rr_scrollTop=e.scrollTop)),U){const{width:C,height:k}=e.getBoundingClientRect();w={class:w.class,rr_width:`${C}px`,rr_height:`${k}px`}}R==="iframe"&&!p(w.src)&&(!U&&!zs(e)&&(w.rr_src=w.src),delete w.src);let Q;try{customElements.get(R)&&(Q=!0)}catch{}return{type:x.Element,tagName:R,attributes:w,childNodes:[],isSVG:qr(e)||void 0,needBlock:U,rootId:y,isCustom:Q}}function j(e){return e==null?"":e.toLowerCase()}function nn(e,t){if(t.comment&&e.type===x.Comment)return!0;if(e.type===x.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Ut(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(j(e.attributes.name).match(/^msapplication-tile(image|color)$/)||j(e.attributes.name)==="application-name"||j(e.attributes.rel)==="icon"||j(e.attributes.rel)==="apple-touch-icon"||j(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&j(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(j(e.attributes.property).match(/^(og|twitter|fb):/)||j(e.attributes.name).match(/^(og|twitter):/)||j(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(j(e.attributes.name)==="robots"||j(e.attributes.name)==="googlebot"||j(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(j(e.attributes.name)==="author"||j(e.attributes.name)==="generator"||j(e.attributes.name)==="framework"||j(e.attributes.name)==="publisher"||j(e.attributes.name)==="progid"||j(e.attributes.property).match(/^article:/)||j(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(j(e.attributes.name)==="google-site-verification"||j(e.attributes.name)==="yandex-verification"||j(e.attributes.name)==="csrf-token"||j(e.attributes.name)==="p:domain_verify"||j(e.attributes.name)==="verify-v1"||j(e.attributes.name)==="verification"||j(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Pe(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:d,skipChild:h=!1,inlineStylesheet:p=!0,maskInputOptions:f={},maskAttributeFn:y,maskTextFn:g,maskInputFn:m,slimDOMOptions:b,dataURLOptions:E={},inlineImages:I=!1,recordCanvas:U=!1,onSerialize:R,onIframeLoad:w,iframeLoadTimeout:_=5e3,onBlockedImageLoad:Q,onStylesheetLoad:C,stylesheetLoadTimeout:k=5e3,keepIframeSrcFn:V=()=>!1,newlyAddedElement:Y=!1,ignoreCSSAttributes:q}=t;let{preserveWhiteSpace:ne=!0}=t;const J=en(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,maskAllText:a,unblockSelector:o,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:d,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:y,maskTextFn:g,maskInputFn:m,dataURLOptions:E,inlineImages:I,recordCanvas:U,keepIframeSrcFn:V,newlyAddedElement:Y,ignoreCSSAttributes:q});if(!J)return console.warn(e,"not serialized"),null;let H;r.hasNode(e)?H=r.getId(e):nn(J,b)||!ne&&J.type===x.Text&&!J.isStyle&&!J.textContent.replace(/^\s+|\s+$/gm,"").length?H=et:H=Vt();const O=Object.assign(J,{id:H});if(r.add(e,O),H===et)return null;R&&R(e);let se=!h;if(O.type===x.Element){se=se&&!O.needBlock;const v=e.shadowRoot;v&&Qe(v)&&(O.isShadowHost=!0)}if((O.type===x.Document||O.type===x.Element)&&se){b.headWhitespace&&O.type===x.Element&&O.tagName==="head"&&(ne=!1);const v={doc:s,mirror:r,blockClass:n,blockSelector:i,maskAllText:a,unblockSelector:o,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:d,skipChild:h,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:y,maskTextFn:g,maskInputFn:m,slimDOMOptions:b,dataURLOptions:E,inlineImages:I,recordCanvas:U,preserveWhiteSpace:ne,onSerialize:R,onIframeLoad:w,iframeLoadTimeout:_,onBlockedImageLoad:Q,onStylesheetLoad:C,stylesheetLoadTimeout:k,keepIframeSrcFn:V,ignoreCSSAttributes:q},S=e.childNodes?Array.from(e.childNodes):[];for(const D of S){const L=Pe(D,v);L&&O.childNodes.push(L)}if(Ws(e)&&e.shadowRoot)for(const D of Array.from(e.shadowRoot.childNodes)){const L=Pe(D,v);L&&(Qe(e.shadowRoot)&&(L.isShadow=!0),O.childNodes.push(L))}}if(e.parentNode&&qe(e.parentNode)&&Qe(e.parentNode)&&(O.isShadow=!0),O.type===x.Element&&O.tagName==="iframe"&&!O.needBlock&&Zr(e,()=>{const v=zs(e);if(v&&w){const S=Pe(v,{doc:v,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:y,maskTextFn:g,maskInputFn:m,slimDOMOptions:b,dataURLOptions:E,inlineImages:I,recordCanvas:U,preserveWhiteSpace:ne,onSerialize:R,onIframeLoad:w,iframeLoadTimeout:_,onStylesheetLoad:C,stylesheetLoadTimeout:k,keepIframeSrcFn:V,ignoreCSSAttributes:q});S&&w(e,S)}},_),O.type===x.Element&&O.tagName==="img"&&!e.complete&&O.needBlock){const v=e,S=()=>{if(v.isConnected&&!v.complete&&Q)try{const D=v.getBoundingClientRect();D.width>0&&D.height>0&&Q(v,O,D)}catch{}v.removeEventListener("load",S)};v.isConnected&&v.addEventListener("load",S)}return O.type===x.Element&&O.tagName==="link"&&typeof O.attributes.rel=="string"&&(O.attributes.rel==="stylesheet"||O.attributes.rel==="preload"&&typeof O.attributes.href=="string"&&Ut(O.attributes.href)==="css")&&Kr(e,()=>{if(C){const v=Pe(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:a,maskTextClass:l,unmaskTextClass:c,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:p,maskInputOptions:f,maskAttributeFn:y,maskTextFn:g,maskInputFn:m,slimDOMOptions:b,dataURLOptions:E,inlineImages:I,recordCanvas:U,preserveWhiteSpace:ne,onSerialize:R,onIframeLoad:w,iframeLoadTimeout:_,onStylesheetLoad:C,stylesheetLoadTimeout:k,keepIframeSrcFn:V,ignoreCSSAttributes:q});v&&C(e,v)}},k),O.type===x.Element&&delete O.needBlock,O}function on(e,t){const{mirror:s=new Wt,blockClass:r="rr-block",blockSelector:n=null,unblockSelector:i=null,maskAllText:o=!1,maskTextClass:a="rr-mask",unmaskTextClass:l=null,maskTextSelector:c=null,unmaskTextSelector:u=null,inlineStylesheet:d=!0,inlineImages:h=!1,recordCanvas:p=!1,maskAllInputs:f=!1,maskAttributeFn:y,maskTextFn:g,maskInputFn:m,slimDOM:b=!1,dataURLOptions:E,preserveWhiteSpace:I,onSerialize:U,onIframeLoad:R,iframeLoadTimeout:w,onBlockedImageLoad:_,onStylesheetLoad:Q,stylesheetLoadTimeout:C,keepIframeSrcFn:k=()=>!1,ignoreCSSAttributes:V=new Set([])}=t||{};return Pe(e,{doc:e,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,maskAllText:o,maskTextClass:a,unmaskTextClass:l,maskTextSelector:c,unmaskTextSelector:u,skipChild:!1,inlineStylesheet:d,maskInputOptions:f===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0}:f===!1?{}:f,maskAttributeFn:y,maskTextFn:g,maskInputFn:m,slimDOMOptions:b===!0||b==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:b==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:b===!1?{}:b,dataURLOptions:E,inlineImages:h,recordCanvas:p,preserveWhiteSpace:I,onSerialize:U,onIframeLoad:R,iframeLoadTimeout:w,onBlockedImageLoad:_,onStylesheetLoad:Q,stylesheetLoadTimeout:C,keepIframeSrcFn:k,newlyAddedElement:!1,ignoreCSSAttributes:V})}const hs=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function an(e,t={}){let s=1,r=1;function n(v){const S=v.match(/\n/g);S&&(s+=S.length);const D=v.lastIndexOf(`
3
- `);r=D===-1?r+v.length:v.length-D}function i(){const v={line:s,column:r};return S=>(S.position=new a(v),y(),S)}const o=class js{constructor(S){Ce(this,"content"),Ce(this,"start"),Ce(this,"end"),Ce(this,"source"),this.start=S,this.end={line:s,column:r},this.source=t.source,this.content=js.content}};Ce(o,"content");let a=o;a.content=e;const l=[];function c(v){const S=new Error(`${t.source||""}:${s}:${r}: ${v}`);if(S.reason=v,S.filename=t.source,S.line=s,S.column=r,S.source=e,t.silent)l.push(S);else throw S}function u(){const v=p();return{type:"stylesheet",stylesheet:{source:t.source,rules:v,parsingErrors:l}}}function d(){return f(/^{\s*/)}function h(){return f(/^}/)}function p(){let v;const S=[];for(y(),g(S);e.length&&e.charAt(0)!=="}"&&(v=O()||se());)v&&(S.push(v),g(S));return S}function f(v){const S=v.exec(e);if(!S)return;const D=S[0];return n(D),e=e.slice(D.length),S}function y(){f(/^\s*/)}function g(v=[]){let S;for(;S=m();)S&&v.push(S),S=m();return v}function m(){const v=i();if(e.charAt(0)!=="/"||e.charAt(1)!=="*")return;let S=2;for(;e.charAt(S)!==""&&(e.charAt(S)!=="*"||e.charAt(S+1)!=="/");)++S;if(S+=2,e.charAt(S-1)==="")return c("End of comment missing");const D=e.slice(2,S-2);return r+=2,n(D),e=e.slice(S),r+=2,v({type:"comment",comment:D})}function b(){const v=f(/^([^{]+)/);if(!v)return;const S=de(v[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,ie=>ie.replace(/,/g,"\u200C")).split(/\s*(?![^(]*\)),\s*/);if(S.length<=1)return S.map(ie=>ie.replace(/\u200C/g,","));let D=0,L=0;const A=S.length,re=[];for(;D<A;){const ie=(S[D].match(/\(/g)||[]).length,$e=(S[D].match(/\)/g)||[]).length;let Ee=ie-$e;if(Ee>=1){let xe=!1;for(L=D+1;L<A;){const ge=(S[L].match(/\(/g)||[]).length,ye=(S[L].match(/\)/g)||[]).length-ge;if(ye===Ee){re.push(S.slice(D,L+1).join(",")),D=L+1,xe=!0;break}L++,Ee-=ye}if(xe)continue;S.slice(D,A).forEach(ge=>ge&&re.push(ge));break}S[D]&&re.push(S[D]),D++}return re.map(ie=>ie.replace(/\u200C/g,","))}function E(){const v=i(),S=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!S)return;const D=de(S[0]);if(!f(/^:\s*/))return c("property missing ':'");const L=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),A=v({type:"declaration",property:D.replace(hs,""),value:L?de(L[0]).replace(hs,""):""});return f(/^[;\s]*/),A}function I(){const v=[];if(!d())return c("missing '{'");g(v);let S;for(;S=E();)S!==!1&&(v.push(S),g(v)),S=E();return h()?v:c("missing '}'")}function U(){let v;const S=[],D=i();for(;v=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)S.push(v[1]),f(/^,\s*/);if(S.length)return D({type:"keyframe",values:S,declarations:I()})}function R(){const v=i();let S=f(/^@([-\w]+)?keyframes\s*/);if(!S)return;const D=S[1];if(S=f(/^([-\w]+)\s*/),!S)return c("@keyframes missing name");const L=S[1];if(!d())return c("@keyframes missing '{'");let A,re=g();for(;A=U();)re.push(A),re=re.concat(g());return h()?v({type:"keyframes",name:L,vendor:D,keyframes:re}):c("@keyframes missing '}'")}function w(){const v=i(),S=f(/^@supports *([^{]+)/);if(!S)return;const D=de(S[1]);if(!d())return c("@supports missing '{'");const L=g().concat(p());return h()?v({type:"supports",supports:D,rules:L}):c("@supports missing '}'")}function _(){const v=i();if(!f(/^@host\s*/))return;if(!d())return c("@host missing '{'");const D=g().concat(p());return h()?v({type:"host",rules:D}):c("@host missing '}'")}function Q(){const v=i(),S=f(/^@media *([^{]+)/);if(!S)return;const D=de(S[1]);if(!d())return c("@media missing '{'");const L=g().concat(p());return h()?v({type:"media",media:D,rules:L}):c("@media missing '}'")}function C(){const v=i(),S=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(S)return v({type:"custom-media",name:de(S[1]),media:de(S[2])})}function k(){const v=i();if(!f(/^@page */))return;const D=b()||[];if(!d())return c("@page missing '{'");let L=g(),A;for(;A=E();)L.push(A),L=L.concat(g());return h()?v({type:"page",selectors:D,declarations:L}):c("@page missing '}'")}function V(){const v=i(),S=f(/^@([-\w]+)?document *([^{]+)/);if(!S)return;const D=de(S[1]),L=de(S[2]);if(!d())return c("@document missing '{'");const A=g().concat(p());return h()?v({type:"document",document:L,vendor:D,rules:A}):c("@document missing '}'")}function Y(){const v=i();if(!f(/^@font-face\s*/))return;if(!d())return c("@font-face missing '{'");let D=g(),L;for(;L=E();)D.push(L),D=D.concat(g());return h()?v({type:"font-face",declarations:D}):c("@font-face missing '}'")}const q=H("import"),ne=H("charset"),J=H("namespace");function H(v){const S=new RegExp("^@"+v+"\\s*((?:"+[/[^\\]"(?:\\"|[^"])*"/.source,/[^\\]'(?:\\'|[^'])*'/.source,"[^;]"].join("|")+")+);");return()=>{const D=i(),L=f(S);if(!L)return;const A={type:v};return A[v]=L[1].trim(),D(A)}}function O(){if(e[0]==="@")return R()||Q()||C()||w()||q()||ne()||J()||V()||k()||_()||Y()}function se(){const v=i(),S=b();return S?(g(),v({type:"rule",selectors:S,declarations:I()})):c("selector missing")}return xt(u())}function de(e){return e?e.replace(/^\s+|\s+$/g,""):""}function xt(e,t){const s=e&&typeof e.type=="string",r=s?e:t;for(const n of Object.keys(e)){const i=e[n];Array.isArray(i)?i.forEach(o=>{xt(o,r)}):i&&typeof i=="object"&&xt(i,r)}return s&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const fs={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function ln(e){let t=fs[e.tagName]?fs[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ys=/([^\\]):hover/,un=new RegExp(Ys.source,"g");function ps(e,t){const s=t?.stylesWithHoverClass.get(e);if(s)return s;if(e.length>=1e6)return e;const r=an(e,{silent:!0});if(!r.stylesheet)return e;const n=[];if(r.stylesheet.rules.forEach(a=>{"selectors"in a&&(a.selectors||[]).forEach(l=>{Ys.test(l)&&n.push(l)})}),n.length===0)return e;const i=new RegExp(n.filter((a,l)=>n.indexOf(a)===l).sort((a,l)=>l.length-a.length).map(a=>cn(a)).join("|"),"g"),o=e.replace(i,a=>{const l=a.replace(un,"$1.\\:hover");return`${a}, ${l}`});return t?.stylesWithHoverClass.set(e,o),o}function ms(){return{stylesWithHoverClass:new Map}}function dn(e,t){const{doc:s,hackCss:r,cache:n}=t;switch(e.type){case x.Document:return s.implementation.createDocument(null,"",null);case x.DocumentType:return s.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case x.Element:{const i=ln(e);let o;e.isSVG?o=s.createElementNS("http://www.w3.org/2000/svg",i):(e.isCustom&&s.defaultView?.customElements&&!s.defaultView.customElements.get(e.tagName)&&s.defaultView.customElements.define(e.tagName,class extends s.defaultView.HTMLElement{}),o=s.createElement(i));const a={};for(const l in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,l))continue;let c=e.attributes[l];if(i==="option"&&l==="selected"&&c===!1||c===null)continue;if(c===!0&&(c=""),l.startsWith("rr_")){a[l]=c;continue}const u=i==="textarea"&&l==="value",d=i==="style"&&l==="_cssText";if(d&&r&&typeof c=="string"&&(c=ps(c,n)),(u||d)&&typeof c=="string"){const h=s.createTextNode(c);for(const p of Array.from(o.childNodes))p.nodeType===o.TEXT_NODE&&o.removeChild(p);o.appendChild(h);continue}try{if(e.isSVG&&l==="xlink:href")o.setAttributeNS("http://www.w3.org/1999/xlink",l,c.toString());else if(l==="onload"||l==="onclick"||l.substring(0,7)==="onmouse")o.setAttribute("_"+l,c.toString());else if(i==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&l==="content"){o.setAttribute("csp-content",c.toString());continue}else i==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||i==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Ut(e.attributes.href)==="js"||(i==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",e.attributes.srcset):o.setAttribute(l,c.toString()))}catch{}}for(const l in a){const c=a[l];if(i==="canvas"&&l==="rr_dataURL"){const u=s.createElement("img");u.onload=()=>{const d=o.getContext("2d");d&&d.drawImage(u,0,0,u.width,u.height)},u.src=c.toString(),o.RRNodeType&&(o.rr_dataURL=c.toString())}else if(i==="img"&&l==="rr_dataURL"){const u=o;u.currentSrc.startsWith("data:")||(u.setAttribute("rrweb-original-src",e.attributes.src),u.src=c.toString())}if(l==="rr_width")o.style.setProperty("width",c.toString());else if(l==="rr_height")o.style.setProperty("height",c.toString());else if(l==="rr_mediaCurrentTime"&&typeof c=="number")o.currentTime=c;else if(l==="rr_mediaState")switch(c){case"played":o.play().catch(u=>console.warn("media playback error",u));break;case"paused":o.pause();break}}if(e.isShadowHost)if(!o.shadowRoot)o.attachShadow({mode:"open"});else for(;o.shadowRoot.firstChild;)o.shadowRoot.removeChild(o.shadowRoot.firstChild);return o}case x.Text:return s.createTextNode(e.isStyle&&r?ps(e.textContent,n):e.textContent);case x.CDATA:return s instanceof XMLDocument?s.createCDATASection(e.textContent):null;case x.Comment:return s.createComment(e.textContent);default:return null}}function Je(e,t){const{doc:s,mirror:r,skipChild:n=!1,hackCss:i=!0,afterAppend:o,cache:a}=t;if(r.has(e.id)){const c=r.getNode(e.id),u=r.getMeta(c);if(Fr(u,e))return r.getNode(e.id)}let l=dn(e,{doc:s,hackCss:i,cache:a});if(!l)return null;if(e.rootId&&r.getNode(e.rootId)!==s&&r.replace(e.rootId,s),e.type===x.Document&&(s.close(),s.open(),e.compatMode==="BackCompat"&&e.childNodes&&e.childNodes[0].type!==x.DocumentType&&(e.childNodes[0].type===x.Element&&"xmlns"in e.childNodes[0].attributes&&e.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=s),r.add(l,e),(e.type===x.Document||e.type===x.Element)&&!n)for(const c of e.childNodes){const u=Je(c,{doc:s,mirror:r,skipChild:!1,hackCss:i,afterAppend:o,cache:a});if(!u){console.warn("Failed to rebuild",c);continue}if(c.isShadow&&Ws(l)&&l.shadowRoot)l.shadowRoot.appendChild(u);else if(e.type===x.Document&&c.type==x.Element){const d=u;let h=null;d.childNodes.forEach(p=>{p.nodeName==="BODY"&&(h=p)}),h?(d.removeChild(h),l.appendChild(u),d.appendChild(h)):l.appendChild(u)}else l.appendChild(u);o&&o(u,c.id)}return l}function hn(e,t){function s(r){t(r)}for(const r of e.getIds())e.has(r)&&s(e.getNode(r))}function fn(e,t){const s=t.getMeta(e);if(s?.type!==x.Element)return;const r=e;for(const n in s.attributes){if(!(Object.prototype.hasOwnProperty.call(s.attributes,n)&&n.startsWith("rr_")))continue;const i=s.attributes[n];n==="rr_scrollLeft"&&(r.scrollLeft=i),n==="rr_scrollTop"&&(r.scrollTop=i)}}function pn(e,t){const{doc:s,onVisit:r,hackCss:n=!0,afterAppend:i,cache:o,mirror:a=new Wt}=t,l=Je(e,{doc:s,mirror:a,skipChild:!1,hackCss:n,afterAppend:i,cache:o});return hn(a,c=>{r&&r(c),fn(c,a)}),l}function te(e,t,s=document){const r={capture:!0,passive:!0};return s.addEventListener(e,t,r),()=>s.removeEventListener(e,t,r)}const Oe=`Please stop import mirror directly. Instead of that,\r
3
+ `);r=D===-1?r+v.length:v.length-D}function i(){const v={line:s,column:r};return S=>(S.position=new a(v),y(),S)}const o=class js{constructor(S){Ce(this,"content"),Ce(this,"start"),Ce(this,"end"),Ce(this,"source"),this.start=S,this.end={line:s,column:r},this.source=t.source,this.content=js.content}};Ce(o,"content");let a=o;a.content=e;const l=[];function c(v){const S=new Error(`${t.source||""}:${s}:${r}: ${v}`);if(S.reason=v,S.filename=t.source,S.line=s,S.column=r,S.source=e,t.silent)l.push(S);else throw S}function u(){const v=p();return{type:"stylesheet",stylesheet:{source:t.source,rules:v,parsingErrors:l}}}function d(){return f(/^{\s*/)}function h(){return f(/^}/)}function p(){let v;const S=[];for(y(),g(S);e.length&&e.charAt(0)!=="}"&&(v=O()||se());)v&&(S.push(v),g(S));return S}function f(v){const S=v.exec(e);if(!S)return;const D=S[0];return n(D),e=e.slice(D.length),S}function y(){f(/^\s*/)}function g(v=[]){let S;for(;S=m();)S&&v.push(S),S=m();return v}function m(){const v=i();if(e.charAt(0)!=="/"||e.charAt(1)!=="*")return;let S=2;for(;e.charAt(S)!==""&&(e.charAt(S)!=="*"||e.charAt(S+1)!=="/");)++S;if(S+=2,e.charAt(S-1)==="")return c("End of comment missing");const D=e.slice(2,S-2);return r+=2,n(D),e=e.slice(S),r+=2,v({type:"comment",comment:D})}function b(){const v=f(/^([^{]+)/);if(!v)return;const S=he(v[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,ie=>ie.replace(/,/g,"\u200C")).split(/\s*(?![^(]*\)),\s*/);if(S.length<=1)return S.map(ie=>ie.replace(/\u200C/g,","));let D=0,L=0;const A=S.length,re=[];for(;D<A;){const ie=(S[D].match(/\(/g)||[]).length,$e=(S[D].match(/\)/g)||[]).length;let Ee=ie-$e;if(Ee>=1){let xe=!1;for(L=D+1;L<A;){const ge=(S[L].match(/\(/g)||[]).length,ye=(S[L].match(/\)/g)||[]).length-ge;if(ye===Ee){re.push(S.slice(D,L+1).join(",")),D=L+1,xe=!0;break}L++,Ee-=ye}if(xe)continue;S.slice(D,A).forEach(ge=>ge&&re.push(ge));break}S[D]&&re.push(S[D]),D++}return re.map(ie=>ie.replace(/\u200C/g,","))}function E(){const v=i(),S=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!S)return;const D=he(S[0]);if(!f(/^:\s*/))return c("property missing ':'");const L=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),A=v({type:"declaration",property:D.replace(hs,""),value:L?he(L[0]).replace(hs,""):""});return f(/^[;\s]*/),A}function I(){const v=[];if(!d())return c("missing '{'");g(v);let S;for(;S=E();)S!==!1&&(v.push(S),g(v)),S=E();return h()?v:c("missing '}'")}function U(){let v;const S=[],D=i();for(;v=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)S.push(v[1]),f(/^,\s*/);if(S.length)return D({type:"keyframe",values:S,declarations:I()})}function R(){const v=i();let S=f(/^@([-\w]+)?keyframes\s*/);if(!S)return;const D=S[1];if(S=f(/^([-\w]+)\s*/),!S)return c("@keyframes missing name");const L=S[1];if(!d())return c("@keyframes missing '{'");let A,re=g();for(;A=U();)re.push(A),re=re.concat(g());return h()?v({type:"keyframes",name:L,vendor:D,keyframes:re}):c("@keyframes missing '}'")}function w(){const v=i(),S=f(/^@supports *([^{]+)/);if(!S)return;const D=he(S[1]);if(!d())return c("@supports missing '{'");const L=g().concat(p());return h()?v({type:"supports",supports:D,rules:L}):c("@supports missing '}'")}function _(){const v=i();if(!f(/^@host\s*/))return;if(!d())return c("@host missing '{'");const D=g().concat(p());return h()?v({type:"host",rules:D}):c("@host missing '}'")}function Q(){const v=i(),S=f(/^@media *([^{]+)/);if(!S)return;const D=he(S[1]);if(!d())return c("@media missing '{'");const L=g().concat(p());return h()?v({type:"media",media:D,rules:L}):c("@media missing '}'")}function C(){const v=i(),S=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(S)return v({type:"custom-media",name:he(S[1]),media:he(S[2])})}function k(){const v=i();if(!f(/^@page */))return;const D=b()||[];if(!d())return c("@page missing '{'");let L=g(),A;for(;A=E();)L.push(A),L=L.concat(g());return h()?v({type:"page",selectors:D,declarations:L}):c("@page missing '}'")}function V(){const v=i(),S=f(/^@([-\w]+)?document *([^{]+)/);if(!S)return;const D=he(S[1]),L=he(S[2]);if(!d())return c("@document missing '{'");const A=g().concat(p());return h()?v({type:"document",document:L,vendor:D,rules:A}):c("@document missing '}'")}function Y(){const v=i();if(!f(/^@font-face\s*/))return;if(!d())return c("@font-face missing '{'");let D=g(),L;for(;L=E();)D.push(L),D=D.concat(g());return h()?v({type:"font-face",declarations:D}):c("@font-face missing '}'")}const q=H("import"),ne=H("charset"),J=H("namespace");function H(v){const S=new RegExp("^@"+v+"\\s*((?:"+[/[^\\]"(?:\\"|[^"])*"/.source,/[^\\]'(?:\\'|[^'])*'/.source,"[^;]"].join("|")+")+);");return()=>{const D=i(),L=f(S);if(!L)return;const A={type:v};return A[v]=L[1].trim(),D(A)}}function O(){if(e[0]==="@")return R()||Q()||C()||w()||q()||ne()||J()||V()||k()||_()||Y()}function se(){const v=i(),S=b();return S?(g(),v({type:"rule",selectors:S,declarations:I()})):c("selector missing")}return xt(u())}function he(e){return e?e.replace(/^\s+|\s+$/g,""):""}function xt(e,t){const s=e&&typeof e.type=="string",r=s?e:t;for(const n of Object.keys(e)){const i=e[n];Array.isArray(i)?i.forEach(o=>{xt(o,r)}):i&&typeof i=="object"&&xt(i,r)}return s&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const fs={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function ln(e){let t=fs[e.tagName]?fs[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function cn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const Ys=/([^\\]):hover/,un=new RegExp(Ys.source,"g");function ps(e,t){const s=t?.stylesWithHoverClass.get(e);if(s)return s;if(e.length>=1e6)return e;const r=an(e,{silent:!0});if(!r.stylesheet)return e;const n=[];if(r.stylesheet.rules.forEach(a=>{"selectors"in a&&(a.selectors||[]).forEach(l=>{Ys.test(l)&&n.push(l)})}),n.length===0)return e;const i=new RegExp(n.filter((a,l)=>n.indexOf(a)===l).sort((a,l)=>l.length-a.length).map(a=>cn(a)).join("|"),"g"),o=e.replace(i,a=>{const l=a.replace(un,"$1.\\:hover");return`${a}, ${l}`});return t?.stylesWithHoverClass.set(e,o),o}function ms(){return{stylesWithHoverClass:new Map}}function dn(e,t){const{doc:s,hackCss:r,cache:n}=t;switch(e.type){case x.Document:return s.implementation.createDocument(null,"",null);case x.DocumentType:return s.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case x.Element:{const i=ln(e);let o;e.isSVG?o=s.createElementNS("http://www.w3.org/2000/svg",i):(e.isCustom&&s.defaultView?.customElements&&!s.defaultView.customElements.get(e.tagName)&&s.defaultView.customElements.define(e.tagName,class extends s.defaultView.HTMLElement{}),o=s.createElement(i));const a={};for(const l in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,l))continue;let c=e.attributes[l];if(i==="option"&&l==="selected"&&c===!1||c===null)continue;if(c===!0&&(c=""),l.startsWith("rr_")){a[l]=c;continue}const u=i==="textarea"&&l==="value",d=i==="style"&&l==="_cssText";if(d&&r&&typeof c=="string"&&(c=ps(c,n)),(u||d)&&typeof c=="string"){const h=s.createTextNode(c);for(const p of Array.from(o.childNodes))p.nodeType===o.TEXT_NODE&&o.removeChild(p);o.appendChild(h);continue}try{if(e.isSVG&&l==="xlink:href")o.setAttributeNS("http://www.w3.org/1999/xlink",l,c.toString());else if(l==="onload"||l==="onclick"||l.substring(0,7)==="onmouse")o.setAttribute("_"+l,c.toString());else if(i==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&l==="content"){o.setAttribute("csp-content",c.toString());continue}else i==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||i==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Ut(e.attributes.href)==="js"||(i==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",e.attributes.srcset):o.setAttribute(l,c.toString()))}catch{}}for(const l in a){const c=a[l];if(i==="canvas"&&l==="rr_dataURL"){const u=s.createElement("img");u.onload=()=>{const d=o.getContext("2d");d&&d.drawImage(u,0,0,u.width,u.height)},u.src=c.toString(),o.RRNodeType&&(o.rr_dataURL=c.toString())}else if(i==="img"&&l==="rr_dataURL"){const u=o;u.currentSrc.startsWith("data:")||(u.setAttribute("rrweb-original-src",e.attributes.src),u.src=c.toString())}if(l==="rr_width")o.style.setProperty("width",c.toString());else if(l==="rr_height")o.style.setProperty("height",c.toString());else if(l==="rr_mediaCurrentTime"&&typeof c=="number")o.currentTime=c;else if(l==="rr_mediaState")switch(c){case"played":o.play().catch(u=>console.warn("media playback error",u));break;case"paused":o.pause();break}}if(e.isShadowHost)if(!o.shadowRoot)o.attachShadow({mode:"open"});else for(;o.shadowRoot.firstChild;)o.shadowRoot.removeChild(o.shadowRoot.firstChild);return o}case x.Text:return s.createTextNode(e.isStyle&&r?ps(e.textContent,n):e.textContent);case x.CDATA:return s instanceof XMLDocument?s.createCDATASection(e.textContent):null;case x.Comment:return s.createComment(e.textContent);default:return null}}function Je(e,t){const{doc:s,mirror:r,skipChild:n=!1,hackCss:i=!0,afterAppend:o,cache:a}=t;if(r.has(e.id)){const c=r.getNode(e.id),u=r.getMeta(c);if(Fr(u,e))return r.getNode(e.id)}let l=dn(e,{doc:s,hackCss:i,cache:a});if(!l)return null;if(e.rootId&&r.getNode(e.rootId)!==s&&r.replace(e.rootId,s),e.type===x.Document&&(s.close(),s.open(),e.compatMode==="BackCompat"&&e.childNodes&&e.childNodes[0].type!==x.DocumentType&&(e.childNodes[0].type===x.Element&&"xmlns"in e.childNodes[0].attributes&&e.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=s),r.add(l,e),(e.type===x.Document||e.type===x.Element)&&!n)for(const c of e.childNodes){const u=Je(c,{doc:s,mirror:r,skipChild:!1,hackCss:i,afterAppend:o,cache:a});if(!u){console.warn("Failed to rebuild",c);continue}if(c.isShadow&&Ws(l)&&l.shadowRoot)l.shadowRoot.appendChild(u);else if(e.type===x.Document&&c.type==x.Element){const d=u;let h=null;d.childNodes.forEach(p=>{p.nodeName==="BODY"&&(h=p)}),h?(d.removeChild(h),l.appendChild(u),d.appendChild(h)):l.appendChild(u)}else l.appendChild(u);o&&o(u,c.id)}return l}function hn(e,t){function s(r){t(r)}for(const r of e.getIds())e.has(r)&&s(e.getNode(r))}function fn(e,t){const s=t.getMeta(e);if(s?.type!==x.Element)return;const r=e;for(const n in s.attributes){if(!(Object.prototype.hasOwnProperty.call(s.attributes,n)&&n.startsWith("rr_")))continue;const i=s.attributes[n];n==="rr_scrollLeft"&&(r.scrollLeft=i),n==="rr_scrollTop"&&(r.scrollTop=i)}}function pn(e,t){const{doc:s,onVisit:r,hackCss:n=!0,afterAppend:i,cache:o,mirror:a=new Wt}=t,l=Je(e,{doc:s,mirror:a,skipChild:!1,hackCss:n,afterAppend:i,cache:o});return hn(a,c=>{r&&r(c),fn(c,a)}),l}function te(e,t,s=document){const r={capture:!0,passive:!0};return s.addEventListener(e,t,r),()=>s.removeEventListener(e,t,r)}const Oe=`Please stop import mirror directly. Instead of that,\r
4
4
  now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
5
- or you can use record.mirror to access the mirror instance during recording.`;let kt={map:{},getId(){return console.error(Oe),-1},getNode(){return console.error(Oe),null},removeNodeFromMap(){console.error(Oe)},has(){return console.error(Oe),!1},reset(){console.error(Oe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(kt=new Proxy(kt,{get(e,t,s){return t==="map"&&console.error(Oe),Reflect.get(e,t,s)}}));function ze(e,t,s={}){let r=null,n=0;return function(...i){const o=Date.now();!n&&s.leading===!1&&(n=o);const a=t-(o-n),l=this;a<=0||a>t?(r&&(ts(r),r=null),n=o,e.apply(l,i)):!r&&s.trailing!==!1&&(r=le(()=>{n=s.leading===!1?0:Date.now(),r=null,e.apply(l,i)},a))}}function st(e,t,s,r,n=window){const i=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,r?s:{set(o){le(()=>{s.set.call(this,o)},0),i&&i.set&&i.set.call(this,o)}}),()=>st(e,t,i||{},!0)}function Re(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],n=s(r);return typeof n=="function"&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=n,()=>{e[t]=r}}catch{return()=>{}}}let tt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(tt=()=>new Date().getTime());function Ht(e){const t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:t?.documentElement.scrollLeft||t?.body?.parentElement?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:t?.documentElement.scrollTop||t?.body?.parentElement?.scrollTop||t?.body?.scrollTop||0}}function zt(e){return e.innerHeight||e.document.documentElement?.clientHeight||e.document.body?.clientHeight}function Gt(e){return e.innerWidth||e.document.documentElement?.clientWidth||e.document.body?.clientWidth}function $t(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function Z(e,t,s,r,n){if(!e)return!1;const i=$t(e);if(!i)return!1;const o=Fe(t,s);if(!n){const c=r&&i.matches(r);return o(i)&&!c}const a=Ne(i,o);let l=-1;return a<0?!1:(r&&(l=Ne(i,Fe(null,r))),a>-1&&l<0?!0:a<l)}function Xs(e,t){return t.getId(e)!==-1}function lt(e,t){return t.getId(e)===et}function jt(e,t){if(qe(e))return!1;const s=t.getId(e);return t.has(s)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?jt(e.parentNode,t):!0:!0}function ft(e){return!!e.changedTouches}function Yt(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=(...t)=>{let s=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===s)return!0;while(s=s&&s.parentNode);return!1})}function qs(e){const t={},s=(n,i)=>{const o={value:n,parent:i,children:[]};return t[n.node.id]=o,o},r=[];for(const n of e){const{nextId:i,parentId:o}=n;if(i&&i in t){const a=t[i];if(a.parent){const l=a.parent.children.indexOf(a);a.parent.children.splice(l,0,s(n,a.parent))}else{const l=r.indexOf(a);r.splice(l,0,s(n,null))}continue}if(o in t){const a=t[o];a.children.push(s(n,a));continue}r.push(s(n,null))}return r}function Xt(e,t){t(e.value);for(let s=e.children.length-1;s>=0;s--)Xt(e.children[s],t)}function Ve(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function qt(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Qt(e,t){const s=e.ownerDocument?.defaultView?.frameElement;if(!s||s===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const r=s.getBoundingClientRect(),n=Qt(s,t),i=r.height/s.clientHeight;return{x:r.x*n.relativeScale+n.x,y:r.y*n.relativeScale+n.y,relativeScale:i,absoluteScale:n.absoluteScale*i}}function be(e){return!!e?.shadowRoot}function We(e,t){const s=e[t[0]];return t.length===1?s:We(s.cssRules[t[1]].cssRules,t.slice(2))}function Ot(e){const t=[...e],s=t.pop();return{positions:t,index:s}}function Qs(e){const t=new Set,s=[];for(let r=e.length;r--;){const n=e[r];t.has(n.id)||(s.push(n),t.add(n.id))}return s}class Jt{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,s){if(this.has(t))return this.getId(t);let r;return s===void 0?r=this.id++:r=s,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Zt(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function Js(e){let t=e,s;for(;s=Zt(t);)t=s;return t}function Zs(e){const t=e.ownerDocument;if(!t)return!1;const s=Js(e);return t.contains(s)}function Kt(e){const t=e.ownerDocument;return t?t.contains(e)||Zs(e):!1}const gs={};function es(e){const t=gs[e];if(t)return t;const s=window.document;let r=window[e];if(s&&typeof s.createElement=="function")try{const n=s.createElement("iframe");n.hidden=!0,s.head.appendChild(n);const i=n.contentWindow;i&&i[e]&&(r=i[e]),s.head.removeChild(n)}catch{}return gs[e]=r.bind(window)}function ae(...e){return es("requestAnimationFrame")(...e)}function le(...e){return es("setTimeout")(...e)}function ts(...e){return es("clearTimeout")(...e)}const mn=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Jt,get _mirror(){return kt},clearTimeout:ts,closestElementOfNode:$t,getBaseDimension:Qt,getNestedRule:We,getPositionsAndIndex:Ot,getRootShadowHost:Js,getShadowHost:Zt,getWindowHeight:zt,getWindowScroll:Ht,getWindowWidth:Gt,hasShadowRoot:be,hookSetter:st,inDom:Kt,isAncestorRemoved:jt,isBlocked:Z,isIgnored:lt,isSerialized:Xs,isSerializedIframe:Ve,isSerializedStylesheet:qt,iterateResolveTree:Xt,legacy_isTouchEvent:ft,get nowTimestamp(){return tt},on:te,onRequestAnimationFrame:ae,patch:Re,polyfill:Yt,queueToResolveTrees:qs,setTimeout:le,shadowHostInDom:Zs,throttle:ze,uniqueTextMutations:Qs},Symbol.toStringTag,{value:"Module"}));var T=(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))(T||{}),M=(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[e.CustomElement=16]="CustomElement",e))(M||{}),B=(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))(B||{}),he=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(he||{}),me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(me||{}),fe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(fe||{}),$=(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))($||{}),gn=Object.defineProperty,yn=(e,t,s)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,N=(e,t,s)=>yn(e,typeof t!="symbol"?t+"":t,s),Sn=Object.defineProperty,bn=(e,t,s)=>t in e?Sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ys=(e,t,s)=>bn(e,typeof t!="symbol"?t+"":t,s),W=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(W||{});let vn=class{constructor(){ys(this,"idNodeMap",new Map),ys(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const s=this.getId(t);this.idNodeMap.delete(s),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,s){const r=s.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,s)}replace(t,s){const r=this.getNode(t);if(r){const n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(s,n)}this.idNodeMap.set(t,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function En(){return new vn}function wn(e){const t={},s=/;(?![^(]*\))/g,r=/:(.+)/,n=/\/\*.*?\*\//g;return e.replace(n,"").split(s).forEach(function(i){if(i){const o=i.split(r);o.length>1&&(t[At(o[0].trim())]=o[1].trim())}}),t}function Ss(e){const t=[];for(const s in e){const r=e[s];if(typeof r!="string")continue;const n=In(s);t.push(`${n}: ${r};`)}return t.join(" ")}const Mn=/-([a-z])/g,Cn=/^--[a-zA-Z0-9-]+$/,At=e=>Cn.test(e)?e:e.replace(Mn,(t,s)=>s?s.toUpperCase():""),Nn=/\B([A-Z])/g,In=e=>e.replace(Nn,"-$1").toLowerCase();class ve{constructor(...t){N(this,"parentElement",null),N(this,"parentNode",null),N(this,"ownerDocument"),N(this,"firstChild",null),N(this,"lastChild",null),N(this,"previousSibling",null),N(this,"nextSibling",null),N(this,"ELEMENT_NODE",1),N(this,"TEXT_NODE",3),N(this,"nodeType"),N(this,"nodeName"),N(this,"RRNodeType")}get childNodes(){const t=[];let s=this.firstChild;for(;s;)t.push(s),s=s.nextSibling;return t}contains(t){if(t instanceof ve){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,s){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}class ss extends ve{constructor(...t){super(t),N(this,"nodeType",9),N(this,"nodeName","#document"),N(this,"compatMode","CSS1Compat"),N(this,"RRNodeType",W.Document),N(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(t=>t.RRNodeType===W.Element&&t.tagName==="HTML")||null}get body(){return this.documentElement?.childNodes.find(t=>t.RRNodeType===W.Element&&t.tagName==="BODY")||null}get head(){return this.documentElement?.childNodes.find(t=>t.RRNodeType===W.Element&&t.tagName==="HEAD")||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(t){const s=t.RRNodeType;if((s===W.Element||s===W.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===s))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${s===W.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=ns(this,t);return r.parentElement=null,r}insertBefore(t,s){const r=t.RRNodeType;if((r===W.Element||r===W.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===W.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const n=rr(this,t,s);return n.parentElement=null,n}removeChild(t){return nr(this,t)}open(){this.firstChild=null,this.lastChild=null}close(){}write(t){let s;if(t==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?s="-//W3C//DTD XHTML 1.0 Transitional//EN":t==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(s="-//W3C//DTD HTML 4.0 Transitional//EN"),s){const r=this.createDocumentType("html",s,"");this.open(),this.appendChild(r)}}createDocument(t,s,r){return new ss}createDocumentType(t,s,r){const n=new Ks(t,s,r);return n.ownerDocument=this,n}createElement(t){const s=new rs(t);return s.ownerDocument=this,s}createElementNS(t,s){return this.createElement(s)}createTextNode(t){const s=new er(t);return s.ownerDocument=this,s}createComment(t){const s=new tr(t);return s.ownerDocument=this,s}createCDATASection(t){const s=new sr(t);return s.ownerDocument=this,s}toString(){return"RRDocument"}}class Ks extends ve{constructor(t,s,r){super(),N(this,"nodeType",10),N(this,"RRNodeType",W.DocumentType),N(this,"name"),N(this,"publicId"),N(this,"systemId"),N(this,"textContent",null),this.name=t,this.publicId=s,this.systemId=r,this.nodeName=t}toString(){return"RRDocumentType"}}class rs extends ve{constructor(t){super(),N(this,"nodeType",1),N(this,"RRNodeType",W.Element),N(this,"tagName"),N(this,"attributes",{}),N(this,"shadowRoot",null),N(this,"scrollLeft"),N(this,"scrollTop"),this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let t="";return this.childNodes.forEach(s=>t+=s.textContent),t}set textContent(t){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(t))}get classList(){return new Dn(this.attributes.class,t=>{this.attributes.class=t})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const t=this.attributes.style?wn(this.attributes.style):{},s=/\B([A-Z])/g;return t.setProperty=(r,n,i)=>{if(s.test(r))return;const o=At(r);n?t[o]=n:delete t[o],i==="important"&&(t[o]+=" !important"),this.attributes.style=Ss(t)},t.removeProperty=r=>{if(s.test(r))return"";const n=At(r),i=t[n]||"";return delete t[n],this.attributes.style=Ss(t),i},t}getAttribute(t){return this.attributes[t]||null}setAttribute(t,s){this.attributes[t]=s}setAttributeNS(t,s,r){this.setAttribute(s,r)}removeAttribute(t){delete this.attributes[t]}appendChild(t){return ns(this,t)}insertBefore(t,s){return rr(this,t,s)}removeChild(t){return nr(this,t)}attachShadow(t){const s=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=s,s}dispatchEvent(t){return!0}toString(){let t="";for(const s in this.attributes)t+=`${s}="${this.attributes[s]}" `;return`${this.tagName} ${t}`}}class Tn extends rs{constructor(){super(...arguments),N(this,"currentTime"),N(this,"volume"),N(this,"paused"),N(this,"muted"),N(this,"playbackRate"),N(this,"loop")}attachShadow(t){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}class er extends ve{constructor(t){super(),N(this,"nodeType",3),N(this,"nodeName","#text"),N(this,"RRNodeType",W.Text),N(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRText text=${JSON.stringify(this.data)}`}}class tr extends ve{constructor(t){super(),N(this,"nodeType",8),N(this,"nodeName","#comment"),N(this,"RRNodeType",W.Comment),N(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}class sr extends ve{constructor(t){super(),N(this,"nodeName","#cdata-section"),N(this,"nodeType",4),N(this,"RRNodeType",W.CDATA),N(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}class Dn{constructor(t,s){if(N(this,"onChange"),N(this,"classes",[]),N(this,"add",(...r)=>{for(const n of r){const i=String(n);this.classes.indexOf(i)>=0||this.classes.push(i)}this.onChange&&this.onChange(this.classes.join(" "))}),N(this,"remove",(...r)=>{this.classes=this.classes.filter(n=>r.indexOf(n)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),t){const r=t.trim().split(/\s+/);this.classes.push(...r)}this.onChange=s}}function ns(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 rr(e,t,s){if(!s)return ns(e,t);if(s.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===s||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=s.previousSibling,s.previousSibling=t,t.nextSibling=s,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function nr(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 oe=(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",e))(oe||{});function ee(e){try{return e.contentDocument}catch{}}function ir(e){try{return e.contentWindow}catch{}}const _t={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Rn={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 Ie=null;function pt(e,t,s,r=t.mirror||t.ownerDocument.mirror){e=xn(e,t,s,r),or(e,t,s,r),kn(e,t,s)}function xn(e,t,s,r){if(s.afterAppend&&!Ie&&(Ie=new WeakSet,setTimeout(()=>{Ie=null},0)),!is(e,t)){const n=mt(t,s.mirror,r);e.parentNode?.replaceChild(n,e),e=n}switch(t.RRNodeType){case W.Document:{if(!Ae(e,t,s.mirror,r)){const n=r.getMeta(t);n&&(s.mirror.removeNodeFromMap(e),e.close(),e.open(),s.mirror.add(e,n),Ie?.add(e))}break}case W.Element:{const n=e,i=t;switch(i.tagName){case"IFRAME":{const o=ee(e);if(!o)break;pt(o,t.contentDocument,s,r);break}}i.shadowRoot&&(n.shadowRoot||n.attachShadow({mode:"open"}),or(n.shadowRoot,i.shadowRoot,s,r)),On(n,i,r);break}}return e}function kn(e,t,s){switch(t.RRNodeType){case W.Document:{const r=t.scrollData;r&&s.applyScroll(r,!0);break}case W.Element:{const r=e,n=t;switch(n.scrollData&&s.applyScroll(n.scrollData,!0),n.inputData&&s.applyInput(n.inputData),n.tagName){case"AUDIO":case"VIDEO":{const i=e,o=n;if(o.paused!==void 0){const a=o.paused?i.pause():i.play();typeof a?.catch=="function"&&a.catch(l=>{console.warn(l)})}o.muted!==void 0&&(i.muted=o.muted),o.volume!==void 0&&(i.volume=o.volume),o.currentTime!==void 0&&(i.currentTime=o.currentTime),o.playbackRate!==void 0&&(i.playbackRate=o.playbackRate);break}case"CANVAS":{const i=t;if(i.rr_dataURL!==null){const o=document.createElement("img");o.onload=()=>{const a=r.getContext("2d");a&&a.drawImage(o,0,0,o.width,o.height)},o.src=i.rr_dataURL}i.canvasMutations.forEach(o=>s.applyCanvas(o.event,o.mutation,e));break}case"STYLE":{const i=r.sheet;i&&t.rules.forEach(o=>s.applyStyleSheetMutation(o,i));break}}break}case W.Text:case W.Comment:case W.CDATA:{e.textContent!==t.data&&(e.textContent=t.data);break}}Ie?.has(e)&&(Ie.delete(e),s.afterAppend?.(e,s.mirror.getId(e)))}function On(e,t,s){const r=e.attributes,n=t.attributes;for(const i in n){const o=n[i];if(s.getMeta(t)?.isSVG&&_t[i])e.setAttributeNS(_t[i],i,o);else if(t.tagName==="CANVAS"&&i==="rr_dataURL"){const l=document.createElement("img");l.src=o,l.onload=()=>{const c=e.getContext("2d");c&&c.drawImage(l,0,0,l.width,l.height)}}else{if(t.tagName==="IFRAME"&&i==="srcdoc")continue;try{e.setAttribute(i,o)}catch(l){console.warn(l)}}}for(const{name:i}of Array.from(r))i in n||e.removeAttribute(i);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}function or(e,t,s,r){const n=Array.from(e.childNodes),i=t.childNodes;if(n.length===0&&i.length===0)return;let o=0,a=n.length-1,l=0,c=i.length-1,u=n[o],d=n[a],h=i[l],p=i[c],f,y;for(;o<=a&&l<=c;)if(u===void 0)u=n[++o];else if(d===void 0)d=n[--a];else if(Ae(u,h,s.mirror,r))u=n[++o],h=i[++l];else if(Ae(d,p,s.mirror,r))d=n[--a],p=i[--c];else if(Ae(u,p,s.mirror,r)){try{Ye(e,u,d.nextSibling)}catch(b){console.warn(b)}u=n[++o],p=i[--c]}else if(Ae(d,h,s.mirror,r)){try{Ye(e,d,u)}catch(b){console.warn(b)}d=n[--a],h=i[++l]}else{if(!f){f={};for(let E=o;E<=a;E++){const I=n[E];I&&s.mirror.hasNode(I)&&(f[s.mirror.getId(I)]=E)}}y=f[r.getId(h)];const b=n[y];if(y!==void 0&&b&&Ae(b,h,s.mirror,r)){try{Ye(e,b,u)}catch(E){console.warn(E)}n[y]=void 0}else{const E=mt(h,s.mirror,r);e.nodeName==="#document"&&u&&(E.nodeType===E.DOCUMENT_TYPE_NODE&&u.nodeType===u.DOCUMENT_TYPE_NODE||E.nodeType===E.ELEMENT_NODE&&u.nodeType===u.ELEMENT_NODE)&&(e.removeChild(u),s.mirror.removeNodeFromMap(u),u=n[++o]);try{Ye(e,E,u||null)}catch(I){console.warn(I)}}h=i[++l]}if(o>a){const b=i[c+1];let E=null;for(b&&(E=s.mirror.getNode(r.getId(b)));l<=c;++l){const I=mt(i[l],s.mirror,r);try{Ye(e,I,E)}catch(U){console.warn(U)}}}else if(l>c)for(;o<=a;o++){const b=n[o];if(!(!b||b.parentNode!==e))try{e.removeChild(b),s.mirror.removeNodeFromMap(b)}catch(E){console.warn(E)}}let g=e.firstChild,m=t.firstChild;for(;g!==null&&m!==null;)pt(g,m,s,r),g=g.nextSibling,m=m.nextSibling}function mt(e,t,s){const r=s.getId(e),n=s.getMeta(e);let i=null;if(r>-1&&(i=t.getNode(r)),i!==null&&is(i,e))return i;switch(e.RRNodeType){case W.Document:i=new Document;break;case W.DocumentType:i=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case W.Element:{let o=e.tagName.toLowerCase();o=Rn[o]||o,n&&"isSVG"in n&&n?.isSVG?i=document.createElementNS(_t.svg,o):i=document.createElement(e.tagName);break}case W.Text:i=document.createTextNode(e.data);break;case W.Comment:i=document.createComment(e.data);break;case W.CDATA:i=document.createCDATASection(e.data);break}n&&t.add(i,{...n});try{Ie?.add(i)}catch{}return i}function is(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName}function Ae(e,t,s,r){const n=s.getId(e),i=r.getId(t);return n===-1||n!==i?!1:is(e,t)}function An(e){const t=e.sheet?.cssRules;if(!t||!t.length)return;const s=new CSSStyleSheet;s.replaceSync(e.innerText);const r={};for(let i=0;i<s.cssRules.length;i++)r[s.cssRules[i].cssText]=s.cssRules[i];const n=[];for(let i=0;i<t?.length;i++){const o=t[i].cssText;r[o]||n.push({index:i,cssRuleText:o})}return n}function Ye(e,t,s){let r;t.nodeName==="STYLE"&&(r=An(t)),e.insertBefore(t,s),r&&r.length&&r.forEach(({cssRuleText:n,index:i})=>{t.sheet?.insertRule(n,i)})}class Ge extends ss{constructor(t){super(),N(this,"UNSERIALIZED_STARTING_ID",-2),N(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),N(this,"mirror",Gn()),N(this,"scrollData",null),t&&(this.mirror=t)}get unserializedId(){return this._unserializedId--}createDocument(t,s,r){return new Ge}createDocumentType(t,s,r){const n=new _n(t,s,r);return n.ownerDocument=this,n}createElement(t){const s=t.toUpperCase();let r;switch(s){case"AUDIO":case"VIDEO":r=new Ln(s);break;case"IFRAME":r=new Wn(s,this.mirror);break;case"CANVAS":r=new Fn(s);break;case"STYLE":r=new Pn(s);break;default:r=new Et(s);break}return r.ownerDocument=this,r}createComment(t){const s=new Un(t);return s.ownerDocument=this,s}createCDATASection(t){const s=new Vn(t);return s.ownerDocument=this,s}createTextNode(t){const s=new Bn(t);return s.ownerDocument=this,s}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const _n=Ks;class Et extends rs{constructor(){super(...arguments),N(this,"inputData",null),N(this,"scrollData",null)}}class Ln extends Tn{}class Fn extends Et{constructor(){super(...arguments),N(this,"rr_dataURL",null),N(this,"canvasMutations",[])}getContext(){return null}}class Pn extends Et{constructor(){super(...arguments),N(this,"rules",[])}}class Wn extends Et{constructor(t,s){super(t),N(this,"contentDocument",new Ge),this.contentDocument.mirror=s}}const Bn=er,Un=tr,Vn=sr;function Hn(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function ar(e,t,s,r){let n;switch(e.nodeType){case oe.DOCUMENT_NODE:r&&r.nodeName==="IFRAME"?n=r.contentDocument:(n=t,n.compatMode=e.compatMode);break;case oe.DOCUMENT_TYPE_NODE:{const o=e;n=t.createDocumentType(o.name,o.publicId,o.systemId);break}case oe.ELEMENT_NODE:{const o=e,a=Hn(o);n=t.createElement(a);const l=n;for(const{name:c,value:u}of Array.from(o.attributes))l.attributes[c]=u;o.scrollLeft&&(l.scrollLeft=o.scrollLeft),o.scrollTop&&(l.scrollTop=o.scrollTop);break}case oe.TEXT_NODE:n=t.createTextNode(e.textContent||"");break;case oe.CDATA_SECTION_NODE:n=t.createCDATASection(e.data);break;case oe.COMMENT_NODE:n=t.createComment(e.textContent||"");break;case oe.DOCUMENT_FRAGMENT_NODE:n=r.attachShadow({mode:"open"});break;default:return null}let i=s.getMeta(e);return t instanceof Ge&&(i||(i=lr(n,t.unserializedId),s.add(e,i)),t.mirror.add(n,{...i})),n}function zn(e,t=En(),s=new Ge){function r(n,i){const o=ar(n,s,t,i);if(o!==null)if(i?.nodeName!=="IFRAME"&&n.nodeType!==oe.DOCUMENT_FRAGMENT_NODE&&(i?.appendChild(o),o.parentNode=i,o.parentElement=i),n.nodeName==="IFRAME"){const a=ee(n);a&&r(a,o)}else(n.nodeType===oe.DOCUMENT_NODE||n.nodeType===oe.ELEMENT_NODE||n.nodeType===oe.DOCUMENT_FRAGMENT_NODE)&&(n.nodeType===oe.ELEMENT_NODE&&n.shadowRoot&&r(n.shadowRoot,o),n.childNodes.forEach(a=>r(a,o)))}return r(e,null),s}function Gn(){return new $n}class $n{constructor(){N(this,"idNodeMap",new Map),N(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const s=this.getId(t);this.idNodeMap.delete(s),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,s){const r=s.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,s)}replace(t,s){const r=this.getNode(t);if(r){const n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(s,n)}this.idNodeMap.set(t,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function lr(e,t){switch(e.RRNodeType){case W.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case W.DocumentType:{const s=e;return{id:t,type:e.RRNodeType,name:s.name,publicId:s.publicId,systemId:s.systemId}}case W.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case W.Text:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case W.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case W.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function bs(e){return"__ln"in e}class jn{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let s=this.head;for(let r=0;r<t;r++)s=s?.next||null;return s}addNode(t){const s={value:t,previous:null,next:null};if(t.__ln=s,t.previousSibling&&bs(t.previousSibling)){const r=t.previousSibling.__ln.next;s.next=r,s.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=s,r&&(r.previous=s)}else if(t.nextSibling&&bs(t.nextSibling)&&t.nextSibling.__ln.previous){const r=t.nextSibling.__ln.previous;s.previous=r,s.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=s,r&&(r.next=s)}else this.head&&(this.head.previous=s),s.next=this.head,this.head=s;s.next===null&&(this.tail=s),this.length++}removeNode(t){const s=t.__ln;this.head&&(s.previous?(s.previous.next=s.next,s.next?s.next.previous=s.previous:this.tail=s.previous):(this.head=s.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const vs=(e,t)=>`${e}@${t}`;class Yn{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],s=new Set,r=new jn,n=l=>{let c=l,u=et;for(;u===et;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},i=l=>{if(!l.parentNode||!Kt(l))return;const c=qe(l.parentNode)?this.mirror.getId(Zt(l)):this.mirror.getId(l.parentNode),u=n(l);if(c===-1||u===-1)return r.addNode(l);const d=Pe(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{Ve(h,this.mirror)&&!Z(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(h),qt(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),be(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(h,p)=>{Z(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(h,p),h.contentWindow&&this.canvasManager.addWindow(h.contentWindow),this.shadowDomManager.observeAttachShadow(h))},onStylesheetLoad:(h,p)=>{this.stylesheetManager.attachLinkElement(h,p)},onBlockedImageLoad:(h,p,{width:f,height:y})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:p.id,attributes:{style:{width:`${f}px`,height:`${y}px`}}}]})},ignoreCSSAttributes:this.ignoreCSSAttributes});d&&(t.push({parentId:c,nextId:u,node:d}),s.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)Es(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||i(l);for(const l of this.addedSet)!ws(this.droppedSet,l)&&!Es(this.removes,l,this.mirror)||ws(this.movedSet,l)?i(l):this.droppedSet.add(l);let o=null;for(;r.length;){let l=null;if(o){const c=this.mirror.getId(o.value.parentNode),u=n(o.value);c!==-1&&u!==-1&&(l=o)}if(!l){let c=r.tail;for(;c;){const u=c;if(c=c.previous,u){const d=this.mirror.getId(u.value.parentNode);if(n(u.value)===-1)continue;if(d!==-1){l=u;break}else{const p=u.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const f=p.parentNode.host;if(this.mirror.getId(f)!==-1){l=u;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}o=l.previous,r.removeNode(l.value),i(l.value)}const a={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!s.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:c}=l;if(typeof c.style=="string"){const u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!s.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=t=>{if(!lt(t.target,this.mirror))switch(t.type){case"characterData":{const s=t.target.textContent;!Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&s!==t.oldValue&&this.texts.push({value:He(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&s?this.maskTextFn?this.maskTextFn(s,$t(t.target)):s.replace(/[\S]/g,"*"):s,node:t.target});break}case"attributes":{const s=t.target;let r=t.attributeName,n=t.target.getAttribute(r);if(r==="value"){const o=Bt(s),a=s.tagName;n=dt(s,a,o);const l=bt({maskInputOptions:this.maskInputOptions,tagName:a,type:o}),c=He(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,l);n=Ke({isMasked:c,element:s,value:n,maskInputFn:this.maskInputFn})}if(Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||n===t.oldValue)return;let i=this.attributeMap.get(t.target);if(s.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(n))if(!ee(s))r="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),r==="type"&&s.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&s.setAttribute("data-rr-is-password","true"),!$s(s.tagName,r)&&(i.attributes[r]=Gs(this.doc,De(s.tagName),De(r),n,s,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");t.oldValue&&o.setAttribute("style",t.oldValue);for(const a of Array.from(s.style)){const l=s.style.getPropertyValue(a),c=s.style.getPropertyPriority(a);l!==o.style.getPropertyValue(a)||c!==o.style.getPropertyPriority(a)?c===""?i.styleDiff[a]=l:i.styleDiff[a]=[l,c]:i._unchangedStyles[a]=[l,c]}for(const a of Array.from(o.style))s.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}break}case"childList":{if(Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;t.addedNodes.forEach(s=>this.genAdds(s,t.target)),t.removedNodes.forEach(s=>{const r=this.mirror.getId(s),n=qe(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||lt(s,this.mirror)||!Xs(s,this.mirror)||(this.addedSet.has(s)?(Lt(this.addedSet,s),this.droppedSet.add(s)):this.addedSet.has(t.target)&&r===-1||jt(t.target,this.mirror)||(this.movedSet.has(s)&&this.movedMap[vs(r,n)]?Lt(this.movedSet,s):this.removes.push({parentId:n,id:r,isShadow:qe(t.target)&&Qe(t.target)?!0:void 0})),this.mapRemoves.push(s))});break}}},this.genAdds=(t,s)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(lt(t,this.mirror))return;this.movedSet.add(t);let r=null;s&&this.mirror.hasNode(s)&&(r=this.mirror.getId(s)),r&&r!==-1&&(this.movedMap[vs(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Z(t,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(t.childNodes&&t.childNodes.forEach(r=>this.genAdds(r)),be(t)&&t.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager","ignoreCSSAttributes"].forEach(s=>{this[s]=t[s]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Lt(e,t){e.delete(t),t.childNodes?.forEach(s=>Lt(e,s))}function Es(e,t,s){return e.length===0?!1:Xn(e,t,s)}function Xn(e,t,s){let r=t.parentNode;for(;r;){const n=s.getId(r);if(e.some(i=>i.id===n))return!0;r=r.parentNode}return!1}function ws(e,t){return e.size===0?!1:cr(e,t)}function cr(e,t){const{parentNode:s}=t;return s?e.has(s)?!0:cr(e,s):!1}let Ze;function ur(e){Ze=e}function qn(){Ze=void 0}const F=e=>Ze?(...s)=>{try{return e(...s)}catch(r){if(Ze&&Ze(r)===!0)return()=>{};throw r}}:e,Te=[];function rt(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function dr(e,t){const s=new Yn;Te.push(s),s.init(e);let r=e.win.MutationObserver||e.win.__rrMutationObserver;const n=e.win?.Zone?.__symbol__?.("MutationObserver");n&&e.win[n]&&(r=e.win[n]);const i=new r(F(o=>{e.onMutation&&e.onMutation(o)===!1||s.processMutations.bind(s)(o)}));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Qn({mousemoveCb:e,sampling:t,doc:s,mirror:r}){if(t.mousemove===!1)return()=>{};const n=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let o=[],a;const l=ze(F(d=>{const h=Date.now()-a;e(o.map(p=>(p.timeOffset-=h,p)),d),o=[],a=null}),i),c=F(ze(F(d=>{const h=rt(d),{clientX:p,clientY:f}=ft(d)?d.changedTouches[0]:d;a||(a=tt()),o.push({x:p,y:f,id:r.getId(h),timeOffset:tt()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?M.Drag:d instanceof MouseEvent?M.MouseMove:M.TouchMove)}),n,{trailing:!1})),u=[te("mousemove",c,s),te("touchmove",c,s),te("drag",c,s)];return F(()=>{u.forEach(d=>d())})}function Jn({mouseInteractionCb:e,doc:t,win:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const l=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,c=[];let u=null;const d=h=>p=>{const f=rt(p);if(Z(f,n,i,o,!0))return;let y=null,g=h;if("pointerType"in p){switch(p.pointerType){case"mouse":y=he.Mouse;break;case"touch":y=he.Touch;break;case"pen":y=he.Pen;break}y===he.Touch?B[h]===B.MouseDown?g="TouchStart":B[h]===B.MouseUp&&(g="TouchEnd"):he.Pen}else ft(p)&&(y=he.Touch);y!==null?(u=y,(g.startsWith("Touch")&&y===he.Touch||g.startsWith("Mouse")&&y===he.Mouse)&&(y=null)):B[h]===B.Click&&(y=u,u=null);const m=ft(p)?p.changedTouches[0]:p;if(!m)return;const b=r.getId(f),{clientX:E,clientY:I}=m;F(e)({type:B[g],id:b,x:E,y:I,...y!==null&&{pointerType:y}})};return Object.keys(B).filter(h=>Number.isNaN(Number(h))&&!h.endsWith("_Departed")&&l[h]!==!1).forEach(h=>{let p=De(h);const f=d(h);if(s.PointerEvent)switch(B[h]){case B.MouseDown:case B.MouseUp:p=p.replace("mouse","pointer");break;case B.TouchStart:case B.TouchEnd:return}c.push(te(p,f,t))}),F(()=>{c.forEach(h=>h())})}function hr({scrollCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,sampling:o}){const a=F(ze(F(l=>{const c=rt(l);if(!c||Z(c,r,n,i,!0))return;const u=s.getId(c);if(c===t&&t.defaultView){const d=Ht(t.defaultView);e({id:u,x:d.left,y:d.top})}else e({id:u,x:c.scrollLeft,y:c.scrollTop})}),o.scroll||100));return te("scroll",a,t)}function Zn({viewportResizeCb:e,win:t},{win:s}){let r=-1,n=-1;const i=F(ze(F(()=>{const o=zt(t),a=Gt(t);(r!==o||n!==a)&&(e({width:Number(a),height:Number(o)}),r=o,n=a)}),200));return te("resize",i,s)}const Kn=["INPUT","TEXTAREA","SELECT"],Ms=new WeakMap;function ei({inputCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:c,sampling:u,userTriggeredOnInput:d,maskTextClass:h,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:y}){function g(w){let _=rt(w);const Q=w.isTrusted,C=_&&Dt(_.tagName);if(C==="OPTION"&&(_=_.parentElement),!_||!C||Kn.indexOf(C)<0||Z(_,r,n,i,!0))return;const k=_;if(k.classList.contains(o)||a&&k.matches(a))return;const V=Bt(_);let Y=dt(k,C,V),q=!1;const ne=bt({maskInputOptions:l,tagName:C,type:V}),J=He(_,h,f,p,y,ne);(V==="radio"||V==="checkbox")&&(q=_.checked),Y=Ke({isMasked:J,element:_,value:Y,maskInputFn:c}),m(_,d?{text:Y,isChecked:q,userTriggered:Q}:{text:Y,isChecked:q});const H=_.name;V==="radio"&&H&&q&&t.querySelectorAll(`input[type="radio"][name="${H}"]`).forEach(O=>{if(O!==_){const se=Ke({isMasked:J,element:O,value:dt(O,C,V),maskInputFn:c});m(O,d?{text:se,isChecked:!q,userTriggered:!1}:{text:se,isChecked:!q})}})}function m(w,_){const Q=Ms.get(w);if(!Q||Q.text!==_.text||Q.isChecked!==_.isChecked){Ms.set(w,_);const C=s.getId(w);F(e)({..._,id:C})}}const E=(u.input==="last"?["change"]:["input","change"]).map(w=>te(w,F(g),t)),I=t.defaultView;if(!I)return()=>{E.forEach(w=>w())};const U=I.Object.getOwnPropertyDescriptor(I.HTMLInputElement.prototype,"value"),R=[[I.HTMLInputElement.prototype,"value"],[I.HTMLInputElement.prototype,"checked"],[I.HTMLSelectElement.prototype,"value"],[I.HTMLTextAreaElement.prototype,"value"],[I.HTMLSelectElement.prototype,"selectedIndex"],[I.HTMLOptionElement.prototype,"selected"]];return U&&U.set&&E.push(...R.map(w=>st(w[0],w[1],{set(){F(g)({target:this,isTrusted:!1})}},!1,I))),F(()=>{E.forEach(w=>w())})}function gt(e,t){const s=[];function r(n,i){if(it(e,"CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||it(e,"CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||it(e,"CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||it(e,"CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){const a=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(a)}else if(n.parentStyleSheet){const a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(a)}return i}return r(t,s)}function Se(e,t,s){let r,n;return e?(e.ownerNode?r=t.getId(e.ownerNode):n=s.getId(e),{styleId:n,id:r}):{}}function ti({styleSheetRuleCb:e,mirror:t,stylesheetManager:s},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const n=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(n,{apply:F((u,d,h)=>{const[p,f]=h,{id:y,styleId:g}=Se(d,t,s.styleMirror);return(y&&y!==-1||g&&g!==-1)&&e({id:y,styleId:g,adds:[{rule:p,index:f}]}),u.apply(d,h)})});const i=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:F((u,d,h)=>{const[p]=h,{id:f,styleId:y}=Se(d,t,s.styleMirror);return(f&&f!==-1||y&&y!==-1)&&e({id:f,styleId:y,removes:[{index:p}]}),u.apply(d,h)})});let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:F((u,d,h)=>{const[p]=h,{id:f,styleId:y}=Se(d,t,s.styleMirror);return(f&&f!==-1||y&&y!==-1)&&e({id:f,styleId:y,replace:p}),u.apply(d,h)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:F((u,d,h)=>{const[p]=h,{id:f,styleId:y}=Se(d,t,s.styleMirror);return(f&&f!==-1||y&&y!==-1)&&e({id:f,styleId:y,replaceSync:p}),u.apply(d,h)})}));const l={};ot(r,"CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(ot(r,"CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),ot(r,"CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),ot(r,"CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:F((h,p,f)=>{const[y,g]=f,{id:m,styleId:b}=Se(p.parentStyleSheet,t,s.styleMirror);return(m&&m!==-1||b&&b!==-1)&&e({id:m,styleId:b,adds:[{rule:y,index:[...gt(r,p),g||0]}]}),h.apply(p,f)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:F((h,p,f)=>{const[y]=f,{id:g,styleId:m}=Se(p.parentStyleSheet,t,s.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,removes:[{index:[...gt(r,p),y]}]}),h.apply(p,f)})})}),F(()=>{r.CSSStyleSheet.prototype.insertRule=n,r.CSSStyleSheet.prototype.deleteRule=i,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function fr({mirror:e,stylesheetManager:t},s){let r=null;s.nodeName==="#document"?r=e.getId(s):r=e.getId(s.host);const n=s.nodeName==="#document"?s.defaultView?.Document:s.ownerDocument?.defaultView?.ShadowRoot,i=n?.prototype?Object.getOwnPropertyDescriptor(n?.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!n||!i?()=>{}:(Object.defineProperty(s,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return i.get?.call(this)},set(o){const a=i.set?.call(this,o);if(r!==null&&r!==-1)try{t.adoptStyleSheets(o,r)}catch{}return a}}),F(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function si({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:r},{win:n}){const i=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:F((a,l,c)=>{const[u,d,h]=c;if(s.has(u))return i.apply(l,[u,d,h]);const{id:p,styleId:f}=Se(l.parentRule?.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,set:{property:u,value:d,priority:h},index:gt(n,l.parentRule)}),a.apply(l,c)})});const o=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:F((a,l,c)=>{const[u]=c;if(s.has(u))return o.apply(l,[u]);const{id:d,styleId:h}=Se(l.parentRule?.parentStyleSheet,t,r.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,remove:{property:u},index:gt(n,l.parentRule)}),a.apply(l,c)})}),F(()=>{n.CSSStyleDeclaration.prototype.setProperty=i,n.CSSStyleDeclaration.prototype.removeProperty=o})}function ri({mediaInteractionCb:e,blockClass:t,blockSelector:s,unblockSelector:r,mirror:n,sampling:i,doc:o}){const a=F(c=>ze(F(u=>{const d=rt(u);if(!d||Z(d,t,s,r,!0))return;const{currentTime:h,volume:p,muted:f,playbackRate:y}=d;e({type:c,id:n.getId(d),currentTime:h,volume:p,muted:f,playbackRate:y})}),i.media||500)),l=[te("play",a(fe.Play),o),te("pause",a(fe.Pause),o),te("seeked",a(fe.Seeked),o),te("volumechange",a(fe.VolumeChange),o),te("ratechange",a(fe.RateChange),o)];return F(()=>{l.forEach(c=>c())})}function ni({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const r=[],n=new WeakMap,i=s.FontFace;s.FontFace=function(l,c,u){const d=new i(l,c,u);return n.set(d,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};const o=Re(t.fonts,"add",function(a){return function(l){return le(F(()=>{const c=n.get(l);c&&(e(c),n.delete(l))}),0),a.apply(this,[l])}});return r.push(()=>{s.FontFace=i}),r.push(o),F(()=>{r.forEach(a=>a())})}function ii(e){const{doc:t,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,selectionCb:o}=e;let a=!0;const l=F(()=>{const c=t.getSelection();if(!c||a&&c?.isCollapsed)return;a=c.isCollapsed||!1;const u=[],d=c.rangeCount||0;for(let h=0;h<d;h++){const p=c.getRangeAt(h),{startContainer:f,startOffset:y,endContainer:g,endOffset:m}=p;Z(f,r,n,i,!0)||Z(g,r,n,i,!0)||u.push({start:s.getId(f),startOffset:y,end:s.getId(g),endOffset:m})}o({ranges:u})});return l(),te("selectionchange",l)}function oi({doc:e,customElementCb:t}){const s=e.defaultView;return!s||!s.customElements?()=>{}:Re(s.customElements,"define",function(n){return function(i,o,a){try{t({define:{name:i}})}catch{}return n.apply(this,[i,o,a])}})}function ai(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};let r;e.recordDOM&&(r=dr(e,e.doc));const n=Qn(e),i=Jn(e),o=hr(e),a=Zn(e,{win:s}),l=ei(e),c=ri(e);let u=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=ti(e,{win:s}),d=fr(e,e.doc),h=si(e,{win:s}),e.collectFonts&&(p=ni(e)));const f=ii(e),y=oi(e),g=[];for(const m of e.plugins)g.push(m.observer(m.callback,s,m.options));return F(()=>{Te.forEach(m=>m.reset()),r?.disconnect(),n(),i(),o(),a(),l(),c(),u(),d(),h(),p(),f(),y(),g.forEach(m=>m())})}function it(e,t){return typeof e[t]<"u"}function ot(e,t){return!!(typeof e[t]<"u"&&e[t].prototype&&"insertRule"in e[t].prototype&&"deleteRule"in e[t].prototype)}class Ft{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,s,r,n){const i=r||this.getIdToRemoteIdMap(t),o=n||this.getRemoteIdToIdMap(t);let a=i.get(s);return a||(a=this.generateIdFn(),i.set(s,a),o.set(a,s)),a}getIds(t,s){const r=this.getIdToRemoteIdMap(t),n=this.getRemoteIdToIdMap(t);return s.map(i=>this.getId(t,i,r,n))}getRemoteId(t,s,r){const n=r||this.getRemoteIdToIdMap(t);if(typeof s!="number")return s;const i=n.get(s);return i||-1}getRemoteIds(t,s){const r=this.getRemoteIdToIdMap(t);return s.map(n=>this.getRemoteId(t,n,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let s=this.iframeIdToRemoteIdMap.get(t);return s||(s=new Map,this.iframeIdToRemoteIdMap.set(t,s)),s}getRemoteIdToIdMap(t){let s=this.iframeRemoteIdToIdMap.get(t);return s||(s=new Map,this.iframeRemoteIdToIdMap.set(t,s)),s}}class li{constructor(){this.crossOriginIframeMirror=new Ft(Vt),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class ci{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ft(Vt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ft(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&t.win.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,s){this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:s}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&t.contentWindow?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(t);const r=ee(t);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(t){const s=t;if(s.data.type!=="rrweb"||s.origin!==s.data.origin||!t.source)return;const n=this.crossOriginIframeMap.get(t.source);if(!n)return;const i=this.transformCrossOriginEvent(n,s.data.event);i&&this.wrappedEmit(i,s.data.isCheckout)}transformCrossOriginEvent(t,s){switch(s.type){case T.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(s.data.node,t);const r=s.data.node.id;return this.crossOriginIframeRootIdMap.set(t,r),this.patchRootIdOnNode(s.data.node,r),{timestamp:s.timestamp,type:T.IncrementalSnapshot,data:{source:M.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:s.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case T.Meta:case T.Load:case T.DomContentLoaded:return!1;case T.Plugin:return s;case T.Custom:return this.replaceIds(s.data.payload,t,["id","parentId","previousId","nextId"]),s;case T.IncrementalSnapshot:switch(s.data.source){case M.Mutation:return s.data.adds.forEach(r=>{this.replaceIds(r,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,t);const n=this.crossOriginIframeRootIdMap.get(t);n&&this.patchRootIdOnNode(r.node,n)}),s.data.removes.forEach(r=>{this.replaceIds(r,t,["parentId","id"])}),s.data.attributes.forEach(r=>{this.replaceIds(r,t,["id"])}),s.data.texts.forEach(r=>{this.replaceIds(r,t,["id"])}),s;case M.Drag:case M.TouchMove:case M.MouseMove:return s.data.positions.forEach(r=>{this.replaceIds(r,t,["id"])}),s;case M.ViewportResize:return!1;case M.MediaInteraction:case M.MouseInteraction:case M.Scroll:case M.CanvasMutation:case M.Input:return this.replaceIds(s.data,t,["id"]),s;case M.StyleSheetRule:case M.StyleDeclaration:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleId"]),s;case M.Font:return s;case M.Selection:return s.data.ranges.forEach(r=>{this.replaceIds(r,t,["start","end"])}),s;case M.AdoptedStyleSheet:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleIds"]),s.data.styles?.forEach(r=>{this.replaceStyleIds(r,t,["styleId"])}),s}}return!1}replace(t,s,r,n){for(const i of n)!Array.isArray(s[i])&&typeof s[i]!="number"||(Array.isArray(s[i])?s[i]=t.getIds(r,s[i]):s[i]=t.getId(r,s[i]));return s}replaceIds(t,s,r){return this.replace(this.crossOriginIframeMirror,t,s,r)}replaceStyleIds(t,s,r){return this.replace(this.crossOriginIframeStyleMirror,t,s,r)}replaceIdOnNode(t,s){this.replaceIds(t,s,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,s)})}patchRootIdOnNode(t,s){t.type!==x.Document&&!t.rootId&&(t.rootId=s),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,s)})}}class ui{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class di{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,this.bypassOptions.win.document)}addShadowRoot(t,s){if(!Qe(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);const r=dr({...this.bypassOptions,doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(hr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),le(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(fr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){const s=ee(t),r=ir(t);!s||!r||this.patchAttachShadow(r.Element,s)}patchAttachShadow(t,s){const r=this;this.restoreHandlers.push(Re(t.prototype,"attachShadow",function(n){return function(i){const o=n.call(this,i);return this.shadowRoot&&Kt(this)&&r.addShadowRoot(this.shadowRoot,s),o}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}var Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var at=0;at<Be.length;at++)Xe[Be.charCodeAt(at)]=at;var hi=function(e){var t=new Uint8Array(e),s,r=t.length,n="";for(s=0;s<r;s+=3)n+=Be[t[s]>>2],n+=Be[(t[s]&3)<<4|t[s+1]>>4],n+=Be[(t[s+1]&15)<<2|t[s+2]>>6],n+=Be[t[s+2]&63];return r%3===2?n=n.substring(0,n.length-1)+"=":r%3===1&&(n=n.substring(0,n.length-2)+"=="),n},fi=function(e){var t=e.length*.75,s=e.length,r,n=0,i,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var c=new ArrayBuffer(t),u=new Uint8Array(c);for(r=0;r<s;r+=4)i=Xe[e.charCodeAt(r)],o=Xe[e.charCodeAt(r+1)],a=Xe[e.charCodeAt(r+2)],l=Xe[e.charCodeAt(r+3)],u[n++]=i<<2|o>>4,u[n++]=(o&15)<<4|a>>2,u[n++]=(a&3)<<6|l&63;return c};const Cs=new Map;function pi(e,t){let s=Cs.get(e);return s||(s=new Map,Cs.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}const pr=(e,t,s)=>{if(!e||!(gr(e,t)||typeof e=="object"))return;const r=e.constructor.name,n=pi(s,r);let i=n.indexOf(e);return i===-1&&(i=n.length,n.push(e)),i};function ct(e,t,s){if(e instanceof Array)return e.map(r=>ct(r,t,s));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const r=e.constructor.name,n=hi(e);return{rr_type:r,base64:n}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ct(e.buffer,t,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const r=e.constructor.name,{src:n}=e;return{rr_type:r,src:n}}else if(e instanceof HTMLCanvasElement){const r="HTMLImageElement",n=e.toDataURL();return{rr_type:r,src:n}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[ct(e.data,t,s),e.width,e.height]};if(gr(e,t)||typeof e=="object"){const r=e.constructor.name,n=pr(e,t,s);return{rr_type:r,index:n}}}}return e}const mr=(e,t,s)=>e.map(r=>ct(r,t,s)),gr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof t[n]=="function").find(n=>e instanceof t[n]);function mi(e,t,s,r,n){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const l=Re(t.CanvasRenderingContext2D.prototype,a,function(c){return function(...u){return Z(this.canvas,s,r,n,!0)||le(()=>{const d=mr(u,t,this);e(this.canvas,{type:me["2D"],property:a,args:d})},0),c.apply(this,u)}});i.push(l)}catch{const l=st(t.CanvasRenderingContext2D.prototype,a,{set(c){e(this.canvas,{type:me["2D"],property:a,args:[c],setter:!0})}});i.push(l)}return()=>{i.forEach(a=>a())}}function gi(e){return e==="experimental-webgl"?"webgl":e}function Ns(e,t,s,r,n){const i=[];try{const o=Re(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...c){if(!Z(this,t,s,r,!0)){const u=gi(l);if("__context"in this||(this.__context=u),n&&["webgl","webgl2"].includes(u))if(c[0]&&typeof c[0]=="object"){const d=c[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...c])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function Is(e,t,s,r,n,i,o,a){const l=[],c=Object.getOwnPropertyNames(e);for(const u of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if(typeof e[u]!="function")continue;const d=Re(e,u,function(h){return function(...p){const f=h.apply(this,p);if(pr(f,a,this),"tagName"in this.canvas&&!Z(this.canvas,r,n,i,!0)){const y=mr(p,a,this),g={type:t,property:u,args:y};s(this.canvas,g)}return f}});l.push(d)}catch{const d=st(e,u,{set(h){s(this.canvas,{type:t,property:u,args:[h],setter:!0})}});l.push(d)}return l}function yi(e,t,s,r,n,i){const o=[];return o.push(...Is(t.WebGLRenderingContext.prototype,me.WebGL,e,s,r,n,i,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...Is(t.WebGL2RenderingContext.prototype,me.WebGL2,e,s,r,n,i,t)),()=>{o.forEach(a=>a())}}const Si='for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};';function bi(){const e=new Blob([Si]);return URL.createObjectURL(e)}class Ts{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class vi{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(a,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(l)};const{enableManualSnapshot:s,sampling:r="all",win:n,recordCanvas:i,errorHandler:o}=t;t.sampling=r,this.mutationCb=t.mutationCb,this.mirror=t.mirror,this.options=t,o&&ur(o),(i&&typeof r=="number"||s)&&(this.worker=this.initFPSWorker()),this.addWindow(n),!s&&F(()=>{i&&r==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),i&&typeof r=="number"&&this.initCanvasFPSObserver()})()}reset(){this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,this.worker?.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(t){const{sampling:s="all",blockClass:r,blockSelector:n,unblockSelector:i,recordCanvas:o,enableManualSnapshot:a}=this.options;if(!this.windowsSet.has(t)){if(a){this.windowsSet.add(t),this.windows.push(new WeakRef(t));return}F(()=>{if(o&&s==="all"&&this.initCanvasMutationObserver(t,r,n,i),o&&typeof s=="number"){const l=Ns(t,r,n,i,!0);this.restoreHandlers.push(()=>{l()})}})(),this.windowsSet.add(t),this.windows.push(new WeakRef(t))}}addShadowRoot(t){this.shadowDoms.add(new WeakRef(t))}resetShadowRoots(){this.shadowDoms=new Set}snapshot(t,s){if(s?.skipRequestAnimationFrame){this.takeSnapshot(performance.now(),!0,t);return}ae(r=>this.takeSnapshot(r,!0,t))}initFPSWorker(){const t=new Worker(bi());return t.onmessage=s=>{const r=s.data,{id:n}=r;if(this.snapshotInProgressMap.set(n,!1),!("base64"in r))return;const{base64:i,type:o,width:a,height:l}=r;this.mutationCb({id:n,type:me["2D"],commands:[{property:"clearRect",args:[0,0,a,l]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:o}]},0,0,a,l]}]})},t}initCanvasFPSObserver(){let t;if(!this.windows.length&&!this.shadowDoms.size)return;const s=r=>{this.takeSnapshot(r,!1),t=ae(s)};t=ae(s),this.restoreHandlers.push(()=>{t&&cancelAnimationFrame(t)})}initCanvasMutationObserver(t,s,r,n){const i=Ns(t,s,r,n,!1),o=mi(this.processMutation.bind(this),t,s,r,n),a=yi(this.processMutation.bind(this),t,s,r,n,this.mirror);this.restoreHandlers.push(()=>{i(),o(),a()})}getCanvasElements(t,s,r){const n=[],i=o=>{o.querySelectorAll("canvas").forEach(a=>{Z(a,t,s,r,!0)||n.push(a)})};for(const o of this.windows){const a=o.deref();let l;try{l=a&&a.document}catch{}l&&i(l)}for(const o of this.shadowDoms){const a=o.deref();a&&i(a)}return n}takeSnapshot(t,s,r){const{sampling:n,blockClass:i,blockSelector:o,unblockSelector:a,dataURLOptions:l,maxCanvasSize:c}=this.options,d=1e3/(n==="all"?2:n||2);return this.lastSnapshotTime&&t-this.lastSnapshotTime<d?!1:(this.lastSnapshotTime=t,(r?[r]:this.getCanvasElements(i,o,a)).forEach(f=>{const y=this.mirror.getId(f);if(!(!this.mirror.hasNode(f)||!f.width||!f.height||this.snapshotInProgressMap.get(y))){if(this.snapshotInProgressMap.set(y,!0),!s&&["webgl","webgl2"].includes(f.__context)){const g=f.getContext(f.__context);g?.getContextAttributes()?.preserveDrawingBuffer===!1&&g.clear(g.COLOR_BUFFER_BIT)}createImageBitmap(f).then(g=>{this.worker?.postMessage({id:y,bitmap:g,width:f.width,height:f.height,dataURLOptions:l,maxCanvasSize:c},[g])}).catch(g=>{F(()=>{throw this.snapshotInProgressMap.delete(y),g})()})}}),!0)}startPendingCanvasMutationFlusher(){ae(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=s=>{this.rafStamps.latestId=s,ae(t)};ae(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,s)=>{const r=this.mirror.getId(s);this.flushPendingCanvasMutationFor(s,r)}),ae(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,s){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(t);if(!r||s===-1)return;const n=r.map(o=>{const{type:a,...l}=o;return l}),{type:i}=r[0];this.mutationCb({id:s,type:i,commands:n}),this.pendingCanvasMutations.delete(t)}}class Ei{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Jt,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,s){"_cssText"in s.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:s.id,attributes:s.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,s){if(t.length===0)return;const r={id:s,styleIds:[]},n=[];for(const i of t){let o;this.styleMirror.has(i)?o=this.styleMirror.getId(i):(o=this.styleMirror.add(i),n.push({styleId:o,rules:Array.from(i.rules||CSSRule,(a,l)=>({rule:Bs(a),index:l}))})),r.styleIds.push(o)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class wi{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(t,s){const r=this.nodeMap.get(t);return r&&Array.from(r).some(n=>n!==s)}add(t,s){this.active||(this.active=!0,ae(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(s))}destroy(){}}let X,yr,yt;try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const ue=Us();function os(e={}){const{emit:t,checkoutEveryNms:s,checkoutEveryNth:r,blockClass:n="rr-block",blockSelector:i=null,unblockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskAllText:c=!1,maskTextClass:u="rr-mask",unmaskTextClass:d=null,maskTextSelector:h=null,unmaskTextSelector:p=null,inlineStylesheet:f=!0,maskAllInputs:y,maskInputOptions:g,slimDOMOptions:m,maskAttributeFn:b,maskInputFn:E,maskTextFn:I,maxCanvasSize:U=null,packFn:R,sampling:w={},dataURLOptions:_={},mousemoveWait:Q,recordDOM:C=!0,recordCanvas:k=!1,recordCrossOriginIframes:V=!1,recordAfter:Y=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:q=!1,collectFonts:ne=!1,inlineImages:J=!1,win:H=window,plugins:O,keepIframeSrcFn:se=()=>!1,ignoreCSSAttributes:v=new Set([]),errorHandler:S,onMutation:D,getCanvasManager:L}=e,A=H;ur(S);const re=V?A.parent===A:!0;let ie=!1;if(!re)try{A.parent.document&&(ie=!1)}catch{ie=!0}if(re&&!t)throw new Error("emit function is required");if(!re&&!ie)return()=>{};Q!==void 0&&w.mousemove===void 0&&(w.mousemove=Q),ue.reset();const $e=y===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:g!==void 0?g:{},Ee=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all"}:m||{};Yt(A);let xe,ge=0;const wt=z=>{for(const ce of O||[])ce.eventProcessor&&(z=ce.eventProcessor(z));return R&&!ie&&(z=R(z)),z};X=(z,ce)=>{const P=z;if(P.timestamp=tt(),Te[0]?.isFrozen()&&P.type!==T.FullSnapshot&&!(P.type===T.IncrementalSnapshot&&P.data.source===M.Mutation)&&Te.forEach(K=>K.unfreeze()),re)t?.(wt(P),ce);else if(ie){const K={type:"rrweb",event:wt(P),origin:A.location.origin,isCheckout:ce};A.parent.postMessage(K,"*")}if(P.type===T.FullSnapshot)xe=P,ge=0;else if(P.type===T.IncrementalSnapshot){if(P.data.source===M.Mutation&&P.data.isAttachIframe)return;ge++;const K=r&&ge>=r,G=s&&xe&&P.timestamp-xe.timestamp>s;(K||G)&&Nt(!0)}},yr=X;const ye=z=>{X({type:T.IncrementalSnapshot,data:{source:M.Mutation,...z}})},as=z=>X({type:T.IncrementalSnapshot,data:{source:M.Scroll,...z}}),Nr=z=>X({type:T.IncrementalSnapshot,data:{source:M.CanvasMutation,...z}}),Ir=z=>X({type:T.IncrementalSnapshot,data:{source:M.AdoptedStyleSheet,...z}}),we=new Ei({mutationCb:ye,adoptedStyleSheetCb:Ir}),Me=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new li:new ci({win:A,mirror:ue,mutationCb:ye,stylesheetManager:we,recordCrossOriginIframes:V,wrappedEmit:X});for(const z of O||[])z.getMirror&&z.getMirror({nodeMirror:ue,crossOriginIframeMirror:Me.crossOriginIframeMirror,crossOriginIframeStyleMirror:Me.crossOriginIframeStyleMirror});const Mt=new wi,Ct=Ni(L,{mirror:ue,win:A,mutationCb:z=>X({type:T.IncrementalSnapshot,data:{source:M.CanvasMutation,...z}}),recordCanvas:k,blockClass:n,blockSelector:i,unblockSelector:o,maxCanvasSize:U,sampling:w.canvas,dataURLOptions:_,errorHandler:S}),nt=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new ui:new di({mutationCb:ye,scrollCb:as,bypassOptions:{win:A,onMutation:D,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,inlineStylesheet:f,maskInputOptions:$e,dataURLOptions:_,maskAttributeFn:b,maskTextFn:I,maskInputFn:E,recordCanvas:k,inlineImages:J,sampling:w,slimDOMOptions:Ee,iframeManager:Me,stylesheetManager:we,canvasManager:Ct,keepIframeSrcFn:se,processedNodeManager:Mt,ignoreCSSAttributes:v},mirror:ue}),Nt=(z=!1)=>{if(!C)return;X({type:T.Meta,data:{href:A.location.href,width:Gt(A),height:zt(A)}},z),we.reset(),nt.init(),Te.forEach(P=>P.lock());const ce=on(A.document,{mirror:ue,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,inlineStylesheet:f,maskAllInputs:$e,maskAttributeFn:b,maskInputFn:E,maskTextFn:I,slimDOM:Ee,dataURLOptions:_,recordCanvas:k,inlineImages:J,onSerialize:P=>{Ve(P,ue)&&Me.addIframe(P),qt(P,ue)&&we.trackLinkElement(P),be(P)&&nt.addShadowRoot(P.shadowRoot,document)},onIframeLoad:(P,K)=>{Me.attachIframe(P,K),P.contentWindow&&Ct.addWindow(P.contentWindow),nt.observeAttachShadow(P)},onStylesheetLoad:(P,K)=>{we.attachLinkElement(P,K)},onBlockedImageLoad:(P,K,{width:G,height:je})=>{ye({adds:[],removes:[],texts:[],attributes:[{id:K.id,attributes:{style:{width:`${G}px`,height:`${je}px`}}}]})},keepIframeSrcFn:se,ignoreCSSAttributes:v});if(!ce)return console.warn("Failed to snapshot the document");X({type:T.FullSnapshot,data:{node:ce,initialOffset:Ht(A)}}),Te.forEach(P=>P.unlock()),A.document.adoptedStyleSheets&&A.document.adoptedStyleSheets.length>0&&we.adoptStyleSheets(A.document.adoptedStyleSheets,ue.getId(A.document))};yt=Nt;try{const z=[],ce=K=>F(ai)({onMutation:D,mutationCb:ye,mousemoveCb:(G,je)=>X({type:T.IncrementalSnapshot,data:{source:je,positions:G}}),mouseInteractionCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.MouseInteraction,...G}}),scrollCb:as,viewportResizeCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.ViewportResize,...G}}),inputCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.Input,...G}}),mediaInteractionCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.MediaInteraction,...G}}),styleSheetRuleCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.StyleSheetRule,...G}}),styleDeclarationCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.StyleDeclaration,...G}}),canvasMutationCb:Nr,fontCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.Font,...G}}),selectionCb:G=>{X({type:T.IncrementalSnapshot,data:{source:M.Selection,...G}})},customElementCb:G=>{X({type:T.IncrementalSnapshot,data:{source:M.CustomElement,...G}})},blockClass:n,ignoreClass:a,ignoreSelector:l,maskAllText:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,maskInputOptions:$e,inlineStylesheet:f,sampling:w,recordDOM:C,recordCanvas:k,inlineImages:J,userTriggeredOnInput:q,collectFonts:ne,win:A,doc:K,maskAttributeFn:b,maskInputFn:E,maskTextFn:I,keepIframeSrcFn:se,blockSelector:i,unblockSelector:o,slimDOMOptions:Ee,dataURLOptions:_,mirror:ue,iframeManager:Me,stylesheetManager:we,shadowDomManager:nt,processedNodeManager:Mt,canvasManager:Ct,ignoreCSSAttributes:v,plugins:O?.filter(G=>G.observer)?.map(G=>({observer:G.observer,options:G.options,callback:je=>X({type:T.Plugin,data:{plugin:G.name,payload:je}})}))||[]},{});Me.addLoadListener(K=>{try{z.push(ce(K.contentDocument))}catch(G){console.warn(G)}});const P=()=>{Nt(),z.push(ce(A.document))};return A.document.readyState==="interactive"||A.document.readyState==="complete"?P():(z.push(te("DOMContentLoaded",()=>{X({type:T.DomContentLoaded,data:{}}),Y==="DOMContentLoaded"&&P()},A.document)),z.push(te("load",()=>{X({type:T.Load,data:{}}),Y==="load"&&P()},A))),()=>{z.forEach(K=>K()),Mt.destroy(),yt=void 0,qn()}}catch(z){console.warn(z)}}function Mi(e,t){if(!yr)throw new Error("please add custom event after start recording");X({type:T.Custom,data:{tag:e,payload:t}})}function Ci(){Te.forEach(e=>e.freeze())}function Sr(e){if(!yt)throw new Error("please take full snapshot after start recording");yt(e)}os.mirror=ue;os.takeFullSnapshot=Sr;function Ni(e,t){try{return e?e(t):new Ts}catch{return console.warn("Unable to initialize CanvasManager"),new Ts}}function br(e){return{all:e=e||new Map,on:function(t,s){var r=e.get(t);r?r.push(s):e.set(t,[s])},off:function(t,s){var r=e.get(t);r&&(s?r.splice(r.indexOf(s)>>>0,1):e.set(t,[]))},emit:function(t,s){var r=e.get(t);r&&r.slice().map(function(n){n(s)}),(r=e.get("*"))&&r.slice().map(function(n){n(t,s)})}}}const Ii=Object.freeze(Object.defineProperty({__proto__:null,default:br},Symbol.toStringTag,{value:"Module"}));function Ti(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&e.__forceSmoothScrollPolyfill__!==!0)return;const s=e.HTMLElement||e.Element,r=468,n={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:s.prototype.scroll||l,scrollIntoView:s.prototype.scrollIntoView},i=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;function o(m){const b=["MSIE ","Trident/","Edge/"];return new RegExp(b.join("|")).test(m)}const a=o(e.navigator.userAgent)?1:0;function l(m,b){this.scrollLeft=m,this.scrollTop=b}function c(m){return .5*(1-Math.cos(Math.PI*m))}function u(m){if(m===null||typeof m!="object"||m.behavior===void 0||m.behavior==="auto"||m.behavior==="instant")return!0;if(typeof m=="object"&&m.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+m.behavior+" is not a valid value for enumeration ScrollBehavior.")}function d(m,b){if(b==="Y")return m.clientHeight+a<m.scrollHeight;if(b==="X")return m.clientWidth+a<m.scrollWidth}function h(m,b){const E=e.getComputedStyle(m,null)["overflow"+b];return E==="auto"||E==="scroll"}function p(m){const b=d(m,"Y")&&h(m,"Y"),E=d(m,"X")&&h(m,"X");return b||E}function f(m){for(;m!==t.body&&p(m)===!1;)m=m.parentNode||m.host;return m}function y(m){const b=i();let E,I,U,R=(b-m.startTime)/r;R=R>1?1:R,E=c(R),I=m.startX+(m.x-m.startX)*E,U=m.startY+(m.y-m.startY)*E,m.method.call(m.scrollable,I,U),(I!==m.x||U!==m.y)&&e.requestAnimationFrame(y.bind(e,m))}function g(m,b,E){let I,U,R,w;const _=i();m===t.body?(I=e,U=e.scrollX||e.pageXOffset,R=e.scrollY||e.pageYOffset,w=n.scroll):(I=m,U=m.scrollLeft,R=m.scrollTop,w=l),y({scrollable:I,method:w,startTime:_,startX:U,startY:R,x:b,y:E})}e.scroll=e.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){n.scroll.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:e.scrollY||e.pageYOffset);return}g.call(e,t.body,arguments[0].left!==void 0?~~arguments[0].left:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:e.scrollY||e.pageYOffset)}},e.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){n.scrollBy.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}g.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset))}},s.prototype.scroll=s.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");n.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const m=arguments[0].left,b=arguments[0].top;g.call(this,this,typeof m>"u"?this.scrollLeft:~~m,typeof b>"u"?this.scrollTop:~~b)},s.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){n.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},s.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){n.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const m=f(this),b=m.getBoundingClientRect(),E=this.getBoundingClientRect();m!==t.body?(g.call(this,m,m.scrollLeft+E.left-b.left,m.scrollTop+E.top-b.top),e.getComputedStyle(m).position!=="fixed"&&e.scrollBy({left:b.left,top:b.top,behavior:"smooth"})):e.scrollBy({left:E.left,top:E.top,behavior:"smooth"})}}class Di{constructor(t=[],s){this.timeOffset=0,this.raf=null,this.actions=t,this.speed=s.speed}addAction(t){const s=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=t.delay)this.actions.push(t);else{const r=this.findActionIndex(t);this.actions.splice(r,0,t)}s&&(this.raf=ae(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=ae(this.rafCheck.bind(this))}rafCheck(){const t=performance.now();for(this.timeOffset+=(t-this.lastTimestamp)*this.speed,this.lastTimestamp=t;this.actions.length;){const s=this.actions[0];if(this.timeOffset>=s.delay)this.actions.shift(),s.doAction();else break}this.actions.length>0?this.raf=ae(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(t){this.speed=t}isActive(){return this.raf!==null}findActionIndex(t){let s=0,r=this.actions.length-1;for(;s<=r;){const n=Math.floor((s+r)/2);if(this.actions[n].delay<t.delay)s=n+1;else if(this.actions[n].delay>t.delay)r=n-1;else return n+1}return s}}function Ds(e,t){if(e.type===T.IncrementalSnapshot&&e.data.source===M.MouseMove&&e.data.positions&&e.data.positions.length){const s=e.data.positions[0].timeOffset,r=e.timestamp+s;return e.delay=r-t,r-t}return e.delay=e.timestamp-t,e.delay}/*! *****************************************************************************
5
+ or you can use record.mirror to access the mirror instance during recording.`;let kt={map:{},getId(){return console.error(Oe),-1},getNode(){return console.error(Oe),null},removeNodeFromMap(){console.error(Oe)},has(){return console.error(Oe),!1},reset(){console.error(Oe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(kt=new Proxy(kt,{get(e,t,s){return t==="map"&&console.error(Oe),Reflect.get(e,t,s)}}));function ze(e,t,s={}){let r=null,n=0;return function(...i){const o=Date.now();!n&&s.leading===!1&&(n=o);const a=t-(o-n),l=this;a<=0||a>t?(r&&(ts(r),r=null),n=o,e.apply(l,i)):!r&&s.trailing!==!1&&(r=ue(()=>{n=s.leading===!1?0:Date.now(),r=null,e.apply(l,i)},a))}}function st(e,t,s,r,n=window){const i=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,r?s:{set(o){ue(()=>{s.set.call(this,o)},0),i&&i.set&&i.set.call(this,o)}}),()=>st(e,t,i||{},!0)}function Re(e,t,s){try{if(!(t in e))return()=>{};const r=e[t],n=s(r);return typeof n=="function"&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=n,()=>{e[t]=r}}catch{return()=>{}}}let tt=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(tt=()=>new Date().getTime());function Ht(e){const t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:t?.documentElement.scrollLeft||t?.body?.parentElement?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:t?.documentElement.scrollTop||t?.body?.parentElement?.scrollTop||t?.body?.scrollTop||0}}function zt(e){return e.innerHeight||e.document.documentElement?.clientHeight||e.document.body?.clientHeight}function Gt(e){return e.innerWidth||e.document.documentElement?.clientWidth||e.document.body?.clientWidth}function $t(e){if(!e)return null;try{return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}catch{return null}}function Z(e,t,s,r,n){if(!e)return!1;const i=$t(e);if(!i)return!1;const o=Fe(t,s);if(!n){const c=r&&i.matches(r);return o(i)&&!c}const a=Ne(i,o);let l=-1;return a<0?!1:(r&&(l=Ne(i,Fe(null,r))),a>-1&&l<0?!0:a<l)}function Xs(e,t){return t.getId(e)!==-1}function lt(e,t){return t.getId(e)===et}function jt(e,t){if(qe(e))return!1;const s=t.getId(e);return t.has(s)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?jt(e.parentNode,t):!0:!0}function ft(e){return!!e.changedTouches}function Yt(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=(...t)=>{let s=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===s)return!0;while(s=s&&s.parentNode);return!1})}function qs(e){const t={},s=(n,i)=>{const o={value:n,parent:i,children:[]};return t[n.node.id]=o,o},r=[];for(const n of e){const{nextId:i,parentId:o}=n;if(i&&i in t){const a=t[i];if(a.parent){const l=a.parent.children.indexOf(a);a.parent.children.splice(l,0,s(n,a.parent))}else{const l=r.indexOf(a);r.splice(l,0,s(n,null))}continue}if(o in t){const a=t[o];a.children.push(s(n,a));continue}r.push(s(n,null))}return r}function Xt(e,t){t(e.value);for(let s=e.children.length-1;s>=0;s--)Xt(e.children[s],t)}function Ve(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function qt(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Qt(e,t){const s=e.ownerDocument?.defaultView?.frameElement;if(!s||s===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const r=s.getBoundingClientRect(),n=Qt(s,t),i=r.height/s.clientHeight;return{x:r.x*n.relativeScale+n.x,y:r.y*n.relativeScale+n.y,relativeScale:i,absoluteScale:n.absoluteScale*i}}function be(e){return!!e?.shadowRoot}function We(e,t){const s=e[t[0]];return t.length===1?s:We(s.cssRules[t[1]].cssRules,t.slice(2))}function Ot(e){const t=[...e],s=t.pop();return{positions:t,index:s}}function Qs(e){const t=new Set,s=[];for(let r=e.length;r--;){const n=e[r];t.has(n.id)||(s.push(n),t.add(n.id))}return s}class Jt{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,s){if(this.has(t))return this.getId(t);let r;return s===void 0?r=this.id++:r=s,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function Zt(e){let t=null;return e.getRootNode?.()?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(t=e.getRootNode().host),t}function Js(e){let t=e,s;for(;s=Zt(t);)t=s;return t}function Zs(e){const t=e.ownerDocument;if(!t)return!1;const s=Js(e);return t.contains(s)}function Kt(e){const t=e.ownerDocument;return t?t.contains(e)||Zs(e):!1}const gs={};function es(e){const t=gs[e];if(t)return t;const s=window.document;let r=window[e];if(s&&typeof s.createElement=="function")try{const n=s.createElement("iframe");n.hidden=!0,s.head.appendChild(n);const i=n.contentWindow;i&&i[e]&&(r=i[e]),s.head.removeChild(n)}catch{}return gs[e]=r.bind(window)}function ae(...e){return es("requestAnimationFrame")(...e)}function ue(...e){return es("setTimeout")(...e)}function ts(...e){return es("clearTimeout")(...e)}const mn=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Jt,get _mirror(){return kt},clearTimeout:ts,closestElementOfNode:$t,getBaseDimension:Qt,getNestedRule:We,getPositionsAndIndex:Ot,getRootShadowHost:Js,getShadowHost:Zt,getWindowHeight:zt,getWindowScroll:Ht,getWindowWidth:Gt,hasShadowRoot:be,hookSetter:st,inDom:Kt,isAncestorRemoved:jt,isBlocked:Z,isIgnored:lt,isSerialized:Xs,isSerializedIframe:Ve,isSerializedStylesheet:qt,iterateResolveTree:Xt,legacy_isTouchEvent:ft,get nowTimestamp(){return tt},on:te,onRequestAnimationFrame:ae,patch:Re,polyfill:Yt,queueToResolveTrees:qs,setTimeout:ue,shadowHostInDom:Zs,throttle:ze,uniqueTextMutations:Qs},Symbol.toStringTag,{value:"Module"}));var T=(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))(T||{}),M=(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[e.CustomElement=16]="CustomElement",e))(M||{}),B=(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))(B||{}),de=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(de||{}),me=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(me||{}),fe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(fe||{}),$=(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))($||{}),gn=Object.defineProperty,yn=(e,t,s)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,N=(e,t,s)=>yn(e,typeof t!="symbol"?t+"":t,s),Sn=Object.defineProperty,bn=(e,t,s)=>t in e?Sn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,ys=(e,t,s)=>bn(e,typeof t!="symbol"?t+"":t,s),W=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(W||{});let vn=class{constructor(){ys(this,"idNodeMap",new Map),ys(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const s=this.getId(t);this.idNodeMap.delete(s),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,s){const r=s.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,s)}replace(t,s){const r=this.getNode(t);if(r){const n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(s,n)}this.idNodeMap.set(t,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function En(){return new vn}function wn(e){const t={},s=/;(?![^(]*\))/g,r=/:(.+)/,n=/\/\*.*?\*\//g;return e.replace(n,"").split(s).forEach(function(i){if(i){const o=i.split(r);o.length>1&&(t[At(o[0].trim())]=o[1].trim())}}),t}function Ss(e){const t=[];for(const s in e){const r=e[s];if(typeof r!="string")continue;const n=In(s);t.push(`${n}: ${r};`)}return t.join(" ")}const Mn=/-([a-z])/g,Cn=/^--[a-zA-Z0-9-]+$/,At=e=>Cn.test(e)?e:e.replace(Mn,(t,s)=>s?s.toUpperCase():""),Nn=/\B([A-Z])/g,In=e=>e.replace(Nn,"-$1").toLowerCase();class ve{constructor(...t){N(this,"parentElement",null),N(this,"parentNode",null),N(this,"ownerDocument"),N(this,"firstChild",null),N(this,"lastChild",null),N(this,"previousSibling",null),N(this,"nextSibling",null),N(this,"ELEMENT_NODE",1),N(this,"TEXT_NODE",3),N(this,"nodeType"),N(this,"nodeName"),N(this,"RRNodeType")}get childNodes(){const t=[];let s=this.firstChild;for(;s;)t.push(s),s=s.nextSibling;return t}contains(t){if(t instanceof ve){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,s){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}class ss extends ve{constructor(...t){super(t),N(this,"nodeType",9),N(this,"nodeName","#document"),N(this,"compatMode","CSS1Compat"),N(this,"RRNodeType",W.Document),N(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(t=>t.RRNodeType===W.Element&&t.tagName==="HTML")||null}get body(){return this.documentElement?.childNodes.find(t=>t.RRNodeType===W.Element&&t.tagName==="BODY")||null}get head(){return this.documentElement?.childNodes.find(t=>t.RRNodeType===W.Element&&t.tagName==="HEAD")||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(t){const s=t.RRNodeType;if((s===W.Element||s===W.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===s))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${s===W.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const r=ns(this,t);return r.parentElement=null,r}insertBefore(t,s){const r=t.RRNodeType;if((r===W.Element||r===W.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===W.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const n=rr(this,t,s);return n.parentElement=null,n}removeChild(t){return nr(this,t)}open(){this.firstChild=null,this.lastChild=null}close(){}write(t){let s;if(t==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?s="-//W3C//DTD XHTML 1.0 Transitional//EN":t==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(s="-//W3C//DTD HTML 4.0 Transitional//EN"),s){const r=this.createDocumentType("html",s,"");this.open(),this.appendChild(r)}}createDocument(t,s,r){return new ss}createDocumentType(t,s,r){const n=new Ks(t,s,r);return n.ownerDocument=this,n}createElement(t){const s=new rs(t);return s.ownerDocument=this,s}createElementNS(t,s){return this.createElement(s)}createTextNode(t){const s=new er(t);return s.ownerDocument=this,s}createComment(t){const s=new tr(t);return s.ownerDocument=this,s}createCDATASection(t){const s=new sr(t);return s.ownerDocument=this,s}toString(){return"RRDocument"}}class Ks extends ve{constructor(t,s,r){super(),N(this,"nodeType",10),N(this,"RRNodeType",W.DocumentType),N(this,"name"),N(this,"publicId"),N(this,"systemId"),N(this,"textContent",null),this.name=t,this.publicId=s,this.systemId=r,this.nodeName=t}toString(){return"RRDocumentType"}}class rs extends ve{constructor(t){super(),N(this,"nodeType",1),N(this,"RRNodeType",W.Element),N(this,"tagName"),N(this,"attributes",{}),N(this,"shadowRoot",null),N(this,"scrollLeft"),N(this,"scrollTop"),this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let t="";return this.childNodes.forEach(s=>t+=s.textContent),t}set textContent(t){this.firstChild=null,this.lastChild=null,this.appendChild(this.ownerDocument.createTextNode(t))}get classList(){return new Dn(this.attributes.class,t=>{this.attributes.class=t})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const t=this.attributes.style?wn(this.attributes.style):{},s=/\B([A-Z])/g;return t.setProperty=(r,n,i)=>{if(s.test(r))return;const o=At(r);n?t[o]=n:delete t[o],i==="important"&&(t[o]+=" !important"),this.attributes.style=Ss(t)},t.removeProperty=r=>{if(s.test(r))return"";const n=At(r),i=t[n]||"";return delete t[n],this.attributes.style=Ss(t),i},t}getAttribute(t){return this.attributes[t]||null}setAttribute(t,s){this.attributes[t]=s}setAttributeNS(t,s,r){this.setAttribute(s,r)}removeAttribute(t){delete this.attributes[t]}appendChild(t){return ns(this,t)}insertBefore(t,s){return rr(this,t,s)}removeChild(t){return nr(this,t)}attachShadow(t){const s=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=s,s}dispatchEvent(t){return!0}toString(){let t="";for(const s in this.attributes)t+=`${s}="${this.attributes[s]}" `;return`${this.tagName} ${t}`}}class Tn extends rs{constructor(){super(...arguments),N(this,"currentTime"),N(this,"volume"),N(this,"paused"),N(this,"muted"),N(this,"playbackRate"),N(this,"loop")}attachShadow(t){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}class er extends ve{constructor(t){super(),N(this,"nodeType",3),N(this,"nodeName","#text"),N(this,"RRNodeType",W.Text),N(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRText text=${JSON.stringify(this.data)}`}}class tr extends ve{constructor(t){super(),N(this,"nodeType",8),N(this,"nodeName","#comment"),N(this,"RRNodeType",W.Comment),N(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}class sr extends ve{constructor(t){super(),N(this,"nodeName","#cdata-section"),N(this,"nodeType",4),N(this,"RRNodeType",W.CDATA),N(this,"data"),this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}class Dn{constructor(t,s){if(N(this,"onChange"),N(this,"classes",[]),N(this,"add",(...r)=>{for(const n of r){const i=String(n);this.classes.indexOf(i)>=0||this.classes.push(i)}this.onChange&&this.onChange(this.classes.join(" "))}),N(this,"remove",(...r)=>{this.classes=this.classes.filter(n=>r.indexOf(n)===-1),this.onChange&&this.onChange(this.classes.join(" "))}),t){const r=t.trim().split(/\s+/);this.classes.push(...r)}this.onChange=s}}function ns(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 rr(e,t,s){if(!s)return ns(e,t);if(s.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===s||(t.parentNode&&t.parentNode.removeChild(t),t.previousSibling=s.previousSibling,s.previousSibling=t,t.nextSibling=s,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,t.parentElement=e,t.parentNode=e,t.ownerDocument=e.ownerDocument),t}function nr(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 oe=(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",e))(oe||{});function ee(e){try{return e.contentDocument}catch{}}function ir(e){try{return e.contentWindow}catch{}}const _t={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"},Rn={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 Ie=null;function pt(e,t,s,r=t.mirror||t.ownerDocument.mirror){e=xn(e,t,s,r),or(e,t,s,r),kn(e,t,s)}function xn(e,t,s,r){if(s.afterAppend&&!Ie&&(Ie=new WeakSet,setTimeout(()=>{Ie=null},0)),!is(e,t)){const n=mt(t,s.mirror,r);e.parentNode?.replaceChild(n,e),e=n}switch(t.RRNodeType){case W.Document:{if(!Ae(e,t,s.mirror,r)){const n=r.getMeta(t);n&&(s.mirror.removeNodeFromMap(e),e.close(),e.open(),s.mirror.add(e,n),Ie?.add(e))}break}case W.Element:{const n=e,i=t;switch(i.tagName){case"IFRAME":{const o=ee(e);if(!o)break;pt(o,t.contentDocument,s,r);break}}i.shadowRoot&&(n.shadowRoot||n.attachShadow({mode:"open"}),or(n.shadowRoot,i.shadowRoot,s,r)),On(n,i,r);break}}return e}function kn(e,t,s){switch(t.RRNodeType){case W.Document:{const r=t.scrollData;r&&s.applyScroll(r,!0);break}case W.Element:{const r=e,n=t;switch(n.scrollData&&s.applyScroll(n.scrollData,!0),n.inputData&&s.applyInput(n.inputData),n.tagName){case"AUDIO":case"VIDEO":{const i=e,o=n;if(o.paused!==void 0){const a=o.paused?i.pause():i.play();typeof a?.catch=="function"&&a.catch(l=>{console.warn(l)})}o.muted!==void 0&&(i.muted=o.muted),o.volume!==void 0&&(i.volume=o.volume),o.currentTime!==void 0&&(i.currentTime=o.currentTime),o.playbackRate!==void 0&&(i.playbackRate=o.playbackRate);break}case"CANVAS":{const i=t;if(i.rr_dataURL!==null){const o=document.createElement("img");o.onload=()=>{const a=r.getContext("2d");a&&a.drawImage(o,0,0,o.width,o.height)},o.src=i.rr_dataURL}i.canvasMutations.forEach(o=>s.applyCanvas(o.event,o.mutation,e));break}case"STYLE":{const i=r.sheet;i&&t.rules.forEach(o=>s.applyStyleSheetMutation(o,i));break}}break}case W.Text:case W.Comment:case W.CDATA:{e.textContent!==t.data&&(e.textContent=t.data);break}}Ie?.has(e)&&(Ie.delete(e),s.afterAppend?.(e,s.mirror.getId(e)))}function On(e,t,s){const r=e.attributes,n=t.attributes;for(const i in n){const o=n[i];if(s.getMeta(t)?.isSVG&&_t[i])e.setAttributeNS(_t[i],i,o);else if(t.tagName==="CANVAS"&&i==="rr_dataURL"){const l=document.createElement("img");l.src=o,l.onload=()=>{const c=e.getContext("2d");c&&c.drawImage(l,0,0,l.width,l.height)}}else{if(t.tagName==="IFRAME"&&i==="srcdoc")continue;try{e.setAttribute(i,o)}catch(l){console.warn(l)}}}for(const{name:i}of Array.from(r))i in n||e.removeAttribute(i);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}function or(e,t,s,r){const n=Array.from(e.childNodes),i=t.childNodes;if(n.length===0&&i.length===0)return;let o=0,a=n.length-1,l=0,c=i.length-1,u=n[o],d=n[a],h=i[l],p=i[c],f,y;for(;o<=a&&l<=c;)if(u===void 0)u=n[++o];else if(d===void 0)d=n[--a];else if(Ae(u,h,s.mirror,r))u=n[++o],h=i[++l];else if(Ae(d,p,s.mirror,r))d=n[--a],p=i[--c];else if(Ae(u,p,s.mirror,r)){try{Ye(e,u,d.nextSibling)}catch(b){console.warn(b)}u=n[++o],p=i[--c]}else if(Ae(d,h,s.mirror,r)){try{Ye(e,d,u)}catch(b){console.warn(b)}d=n[--a],h=i[++l]}else{if(!f){f={};for(let E=o;E<=a;E++){const I=n[E];I&&s.mirror.hasNode(I)&&(f[s.mirror.getId(I)]=E)}}y=f[r.getId(h)];const b=n[y];if(y!==void 0&&b&&Ae(b,h,s.mirror,r)){try{Ye(e,b,u)}catch(E){console.warn(E)}n[y]=void 0}else{const E=mt(h,s.mirror,r);e.nodeName==="#document"&&u&&(E.nodeType===E.DOCUMENT_TYPE_NODE&&u.nodeType===u.DOCUMENT_TYPE_NODE||E.nodeType===E.ELEMENT_NODE&&u.nodeType===u.ELEMENT_NODE)&&(e.removeChild(u),s.mirror.removeNodeFromMap(u),u=n[++o]);try{Ye(e,E,u||null)}catch(I){console.warn(I)}}h=i[++l]}if(o>a){const b=i[c+1];let E=null;for(b&&(E=s.mirror.getNode(r.getId(b)));l<=c;++l){const I=mt(i[l],s.mirror,r);try{Ye(e,I,E)}catch(U){console.warn(U)}}}else if(l>c)for(;o<=a;o++){const b=n[o];if(!(!b||b.parentNode!==e))try{e.removeChild(b),s.mirror.removeNodeFromMap(b)}catch(E){console.warn(E)}}let g=e.firstChild,m=t.firstChild;for(;g!==null&&m!==null;)pt(g,m,s,r),g=g.nextSibling,m=m.nextSibling}function mt(e,t,s){const r=s.getId(e),n=s.getMeta(e);let i=null;if(r>-1&&(i=t.getNode(r)),i!==null&&is(i,e))return i;switch(e.RRNodeType){case W.Document:i=new Document;break;case W.DocumentType:i=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case W.Element:{let o=e.tagName.toLowerCase();o=Rn[o]||o,n&&"isSVG"in n&&n?.isSVG?i=document.createElementNS(_t.svg,o):i=document.createElement(e.tagName);break}case W.Text:i=document.createTextNode(e.data);break;case W.Comment:i=document.createComment(e.data);break;case W.CDATA:i=document.createCDATASection(e.data);break}n&&t.add(i,{...n});try{Ie?.add(i)}catch{}return i}function is(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType!==e.ELEMENT_NODE||e.tagName.toUpperCase()===t.tagName}function Ae(e,t,s,r){const n=s.getId(e),i=r.getId(t);return n===-1||n!==i?!1:is(e,t)}function An(e){const t=e.sheet?.cssRules;if(!t||!t.length)return;const s=new CSSStyleSheet;s.replaceSync(e.innerText);const r={};for(let i=0;i<s.cssRules.length;i++)r[s.cssRules[i].cssText]=s.cssRules[i];const n=[];for(let i=0;i<t?.length;i++){const o=t[i].cssText;r[o]||n.push({index:i,cssRuleText:o})}return n}function Ye(e,t,s){let r;t.nodeName==="STYLE"&&(r=An(t)),e.insertBefore(t,s),r&&r.length&&r.forEach(({cssRuleText:n,index:i})=>{t.sheet?.insertRule(n,i)})}class Ge extends ss{constructor(t){super(),N(this,"UNSERIALIZED_STARTING_ID",-2),N(this,"_unserializedId",this.UNSERIALIZED_STARTING_ID),N(this,"mirror",Gn()),N(this,"scrollData",null),t&&(this.mirror=t)}get unserializedId(){return this._unserializedId--}createDocument(t,s,r){return new Ge}createDocumentType(t,s,r){const n=new _n(t,s,r);return n.ownerDocument=this,n}createElement(t){const s=t.toUpperCase();let r;switch(s){case"AUDIO":case"VIDEO":r=new Ln(s);break;case"IFRAME":r=new Wn(s,this.mirror);break;case"CANVAS":r=new Fn(s);break;case"STYLE":r=new Pn(s);break;default:r=new Et(s);break}return r.ownerDocument=this,r}createComment(t){const s=new Un(t);return s.ownerDocument=this,s}createCDATASection(t){const s=new Vn(t);return s.ownerDocument=this,s}createTextNode(t){const s=new Bn(t);return s.ownerDocument=this,s}destroyTree(){this.firstChild=null,this.lastChild=null,this.mirror.reset()}open(){super.open(),this._unserializedId=this.UNSERIALIZED_STARTING_ID}}const _n=Ks;class Et extends rs{constructor(){super(...arguments),N(this,"inputData",null),N(this,"scrollData",null)}}class Ln extends Tn{}class Fn extends Et{constructor(){super(...arguments),N(this,"rr_dataURL",null),N(this,"canvasMutations",[])}getContext(){return null}}class Pn extends Et{constructor(){super(...arguments),N(this,"rules",[])}}class Wn extends Et{constructor(t,s){super(t),N(this,"contentDocument",new Ge),this.contentDocument.mirror=s}}const Bn=er,Un=tr,Vn=sr;function Hn(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function ar(e,t,s,r){let n;switch(e.nodeType){case oe.DOCUMENT_NODE:r&&r.nodeName==="IFRAME"?n=r.contentDocument:(n=t,n.compatMode=e.compatMode);break;case oe.DOCUMENT_TYPE_NODE:{const o=e;n=t.createDocumentType(o.name,o.publicId,o.systemId);break}case oe.ELEMENT_NODE:{const o=e,a=Hn(o);n=t.createElement(a);const l=n;for(const{name:c,value:u}of Array.from(o.attributes))l.attributes[c]=u;o.scrollLeft&&(l.scrollLeft=o.scrollLeft),o.scrollTop&&(l.scrollTop=o.scrollTop);break}case oe.TEXT_NODE:n=t.createTextNode(e.textContent||"");break;case oe.CDATA_SECTION_NODE:n=t.createCDATASection(e.data);break;case oe.COMMENT_NODE:n=t.createComment(e.textContent||"");break;case oe.DOCUMENT_FRAGMENT_NODE:n=r.attachShadow({mode:"open"});break;default:return null}let i=s.getMeta(e);return t instanceof Ge&&(i||(i=lr(n,t.unserializedId),s.add(e,i)),t.mirror.add(n,{...i})),n}function zn(e,t=En(),s=new Ge){function r(n,i){const o=ar(n,s,t,i);if(o!==null)if(i?.nodeName!=="IFRAME"&&n.nodeType!==oe.DOCUMENT_FRAGMENT_NODE&&(i?.appendChild(o),o.parentNode=i,o.parentElement=i),n.nodeName==="IFRAME"){const a=ee(n);a&&r(a,o)}else(n.nodeType===oe.DOCUMENT_NODE||n.nodeType===oe.ELEMENT_NODE||n.nodeType===oe.DOCUMENT_FRAGMENT_NODE)&&(n.nodeType===oe.ELEMENT_NODE&&n.shadowRoot&&r(n.shadowRoot,o),n.childNodes.forEach(a=>r(a,o)))}return r(e,null),s}function Gn(){return new $n}class $n{constructor(){N(this,"idNodeMap",new Map),N(this,"nodeMetaMap",new WeakMap)}getId(t){return t?this.getMeta(t)?.id??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const s=this.getId(t);this.idNodeMap.delete(s),t.childNodes&&t.childNodes.forEach(r=>this.removeNodeFromMap(r))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,s){const r=s.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,s)}replace(t,s){const r=this.getNode(t);if(r){const n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(s,n)}this.idNodeMap.set(t,s)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function lr(e,t){switch(e.RRNodeType){case W.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case W.DocumentType:{const s=e;return{id:t,type:e.RRNodeType,name:s.name,publicId:s.publicId,systemId:s.systemId}}case W.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case W.Text:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case W.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case W.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function bs(e){return"__ln"in e}class jn{constructor(){this.length=0,this.head=null,this.tail=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let s=this.head;for(let r=0;r<t;r++)s=s?.next||null;return s}addNode(t){const s={value:t,previous:null,next:null};if(t.__ln=s,t.previousSibling&&bs(t.previousSibling)){const r=t.previousSibling.__ln.next;s.next=r,s.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=s,r&&(r.previous=s)}else if(t.nextSibling&&bs(t.nextSibling)&&t.nextSibling.__ln.previous){const r=t.nextSibling.__ln.previous;s.previous=r,s.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=s,r&&(r.next=s)}else this.head&&(this.head.previous=s),s.next=this.head,this.head=s;s.next===null&&(this.tail=s),this.length++}removeNode(t){const s=t.__ln;this.head&&(s.previous?(s.previous.next=s.next,s.next?s.next.previous=s.previous:this.tail=s.previous):(this.head=s.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}}const vs=(e,t)=>`${e}@${t}`;class Yn{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],s=new Set,r=new jn,n=l=>{let c=l,u=et;for(;u===et;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},i=l=>{if(!l.parentNode||!Kt(l))return;const c=qe(l.parentNode)?this.mirror.getId(Zt(l)):this.mirror.getId(l.parentNode),u=n(l);if(c===-1||u===-1)return r.addNode(l);const d=Pe(l,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskAllText:this.maskAllText,unblockSelector:this.unblockSelector,maskTextClass:this.maskTextClass,unmaskTextClass:this.unmaskTextClass,maskTextSelector:this.maskTextSelector,unmaskTextSelector:this.unmaskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskAttributeFn:this.maskAttributeFn,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:h=>{Ve(h,this.mirror)&&!Z(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&this.iframeManager.addIframe(h),qt(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),be(l)&&this.shadowDomManager.addShadowRoot(l.shadowRoot,this.doc)},onIframeLoad:(h,p)=>{Z(h,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(this.iframeManager.attachIframe(h,p),h.contentWindow&&this.canvasManager.addWindow(h.contentWindow),this.shadowDomManager.observeAttachShadow(h))},onStylesheetLoad:(h,p)=>{this.stylesheetManager.attachLinkElement(h,p)},onBlockedImageLoad:(h,p,{width:f,height:y})=>{this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:p.id,attributes:{style:{width:`${f}px`,height:`${y}px`}}}]})},ignoreCSSAttributes:this.ignoreCSSAttributes});d&&(t.push({parentId:c,nextId:u,node:d}),s.add(d.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const l of this.movedSet)Es(this.removes,l,this.mirror)&&!this.movedSet.has(l.parentNode)||i(l);for(const l of this.addedSet)!ws(this.droppedSet,l)&&!Es(this.removes,l,this.mirror)||ws(this.movedSet,l)?i(l):this.droppedSet.add(l);let o=null;for(;r.length;){let l=null;if(o){const c=this.mirror.getId(o.value.parentNode),u=n(o.value);c!==-1&&u!==-1&&(l=o)}if(!l){let c=r.tail;for(;c;){const u=c;if(c=c.previous,u){const d=this.mirror.getId(u.value.parentNode);if(n(u.value)===-1)continue;if(d!==-1){l=u;break}else{const p=u.value;if(p.parentNode&&p.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const f=p.parentNode.host;if(this.mirror.getId(f)!==-1){l=u;break}}}}}}if(!l){for(;r.head;)r.removeNode(r.head.value);break}o=l.previous,r.removeNode(l.value),i(l.value)}const a={texts:this.texts.map(l=>({id:this.mirror.getId(l.node),value:l.value})).filter(l=>!s.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{const{attributes:c}=l;if(typeof c.style=="string"){const u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!s.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=t=>{if(!lt(t.target,this.mirror))switch(t.type){case"characterData":{const s=t.target.textContent;!Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)&&s!==t.oldValue&&this.texts.push({value:He(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,this.maskAllText)&&s?this.maskTextFn?this.maskTextFn(s,$t(t.target)):s.replace(/[\S]/g,"*"):s,node:t.target});break}case"attributes":{const s=t.target;let r=t.attributeName,n=t.target.getAttribute(r);if(r==="value"){const o=Bt(s),a=s.tagName;n=dt(s,a,o);const l=bt({maskInputOptions:this.maskInputOptions,tagName:a,type:o}),c=He(t.target,this.maskTextClass,this.maskTextSelector,this.unmaskTextClass,this.unmaskTextSelector,l);n=Ke({isMasked:c,element:s,value:n,maskInputFn:this.maskInputFn})}if(Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||n===t.oldValue)return;let i=this.attributeMap.get(t.target);if(s.tagName==="IFRAME"&&r==="src"&&!this.keepIframeSrcFn(n))if(!ee(s))r="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),r==="type"&&s.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&s.setAttribute("data-rr-is-password","true"),!$s(s.tagName,r)&&(i.attributes[r]=Gs(this.doc,De(s.tagName),De(r),n,s,this.maskAttributeFn),r==="style")){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");t.oldValue&&o.setAttribute("style",t.oldValue);for(const a of Array.from(s.style)){const l=s.style.getPropertyValue(a),c=s.style.getPropertyPriority(a);l!==o.style.getPropertyValue(a)||c!==o.style.getPropertyPriority(a)?c===""?i.styleDiff[a]=l:i.styleDiff[a]=[l,c]:i._unchangedStyles[a]=[l,c]}for(const a of Array.from(o.style))s.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}break}case"childList":{if(Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!0))return;t.addedNodes.forEach(s=>this.genAdds(s,t.target)),t.removedNodes.forEach(s=>{const r=this.mirror.getId(s),n=qe(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);Z(t.target,this.blockClass,this.blockSelector,this.unblockSelector,!1)||lt(s,this.mirror)||!Xs(s,this.mirror)||(this.addedSet.has(s)?(Lt(this.addedSet,s),this.droppedSet.add(s)):this.addedSet.has(t.target)&&r===-1||jt(t.target,this.mirror)||(this.movedSet.has(s)&&this.movedMap[vs(r,n)]?Lt(this.movedSet,s):this.removes.push({parentId:n,id:r,isShadow:qe(t.target)&&Qe(t.target)?!0:void 0})),this.mapRemoves.push(s))});break}}},this.genAdds=(t,s)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(lt(t,this.mirror))return;this.movedSet.add(t);let r=null;s&&this.mirror.hasNode(s)&&(r=this.mirror.getId(s)),r&&r!==-1&&(this.movedMap[vs(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);Z(t,this.blockClass,this.blockSelector,this.unblockSelector,!1)||(t.childNodes&&t.childNodes.forEach(r=>this.genAdds(r)),be(t)&&t.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","unblockSelector","maskAllText","maskTextClass","unmaskTextClass","maskTextSelector","unmaskTextSelector","inlineStylesheet","maskInputOptions","maskAttributeFn","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager","ignoreCSSAttributes"].forEach(s=>{this[s]=t[s]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Lt(e,t){e.delete(t),t.childNodes?.forEach(s=>Lt(e,s))}function Es(e,t,s){return e.length===0?!1:Xn(e,t,s)}function Xn(e,t,s){let r=t.parentNode;for(;r;){const n=s.getId(r);if(e.some(i=>i.id===n))return!0;r=r.parentNode}return!1}function ws(e,t){return e.size===0?!1:cr(e,t)}function cr(e,t){const{parentNode:s}=t;return s?e.has(s)?!0:cr(e,s):!1}let Ze;function ur(e){Ze=e}function qn(){Ze=void 0}const F=e=>Ze?(...s)=>{try{return e(...s)}catch(r){if(Ze&&Ze(r)===!0)return()=>{};throw r}}:e,Te=[];function rt(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function dr(e,t){const s=new Yn;Te.push(s),s.init(e);let r=e.win.MutationObserver||e.win.__rrMutationObserver;const n=e.win?.Zone?.__symbol__?.("MutationObserver");n&&e.win[n]&&(r=e.win[n]);const i=new r(F(o=>{e.onMutation&&e.onMutation(o)===!1||s.processMutations.bind(s)(o)}));return i.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),i}function Qn({mousemoveCb:e,sampling:t,doc:s,mirror:r}){if(t.mousemove===!1)return()=>{};const n=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let o=[],a;const l=ze(F(d=>{const h=Date.now()-a;e(o.map(p=>(p.timeOffset-=h,p)),d),o=[],a=null}),i),c=F(ze(F(d=>{const h=rt(d),{clientX:p,clientY:f}=ft(d)?d.changedTouches[0]:d;a||(a=tt()),o.push({x:p,y:f,id:r.getId(h),timeOffset:tt()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?M.Drag:d instanceof MouseEvent?M.MouseMove:M.TouchMove)}),n,{trailing:!1})),u=[te("mousemove",c,s),te("touchmove",c,s),te("drag",c,s)];return F(()=>{u.forEach(d=>d())})}function Jn({mouseInteractionCb:e,doc:t,win:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,sampling:a}){if(a.mouseInteraction===!1)return()=>{};const l=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,c=[];let u=null;const d=h=>p=>{const f=rt(p);if(Z(f,n,i,o,!0))return;let y=null,g=h;if("pointerType"in p){switch(p.pointerType){case"mouse":y=de.Mouse;break;case"touch":y=de.Touch;break;case"pen":y=de.Pen;break}y===de.Touch?B[h]===B.MouseDown?g="TouchStart":B[h]===B.MouseUp&&(g="TouchEnd"):de.Pen}else ft(p)&&(y=de.Touch);y!==null?(u=y,(g.startsWith("Touch")&&y===de.Touch||g.startsWith("Mouse")&&y===de.Mouse)&&(y=null)):B[h]===B.Click&&(y=u,u=null);const m=ft(p)?p.changedTouches[0]:p;if(!m)return;const b=r.getId(f),{clientX:E,clientY:I}=m;F(e)({type:B[g],id:b,x:E,y:I,...y!==null&&{pointerType:y}})};return Object.keys(B).filter(h=>Number.isNaN(Number(h))&&!h.endsWith("_Departed")&&l[h]!==!1).forEach(h=>{let p=De(h);const f=d(h);if(s.PointerEvent)switch(B[h]){case B.MouseDown:case B.MouseUp:p=p.replace("mouse","pointer");break;case B.TouchStart:case B.TouchEnd:return}c.push(te(p,f,t))}),F(()=>{c.forEach(h=>h())})}function hr({scrollCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,sampling:o}){const a=F(ze(F(l=>{const c=rt(l);if(!c||Z(c,r,n,i,!0))return;const u=s.getId(c);if(c===t&&t.defaultView){const d=Ht(t.defaultView);e({id:u,x:d.left,y:d.top})}else e({id:u,x:c.scrollLeft,y:c.scrollTop})}),o.scroll||100));return te("scroll",a,t)}function Zn({viewportResizeCb:e,win:t},{win:s}){let r=-1,n=-1;const i=F(ze(F(()=>{const o=zt(t),a=Gt(t);(r!==o||n!==a)&&(e({width:Number(a),height:Number(o)}),r=o,n=a)}),200));return te("resize",i,s)}const Kn=["INPUT","TEXTAREA","SELECT"],Ms=new WeakMap;function ei({inputCb:e,doc:t,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,ignoreClass:o,ignoreSelector:a,maskInputOptions:l,maskInputFn:c,sampling:u,userTriggeredOnInput:d,maskTextClass:h,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:y}){function g(w){let _=rt(w);const Q=w.isTrusted,C=_&&Dt(_.tagName);if(C==="OPTION"&&(_=_.parentElement),!_||!C||Kn.indexOf(C)<0||Z(_,r,n,i,!0))return;const k=_;if(k.classList.contains(o)||a&&k.matches(a))return;const V=Bt(_);let Y=dt(k,C,V),q=!1;const ne=bt({maskInputOptions:l,tagName:C,type:V}),J=He(_,h,f,p,y,ne);(V==="radio"||V==="checkbox")&&(q=_.checked),Y=Ke({isMasked:J,element:_,value:Y,maskInputFn:c}),m(_,d?{text:Y,isChecked:q,userTriggered:Q}:{text:Y,isChecked:q});const H=_.name;V==="radio"&&H&&q&&t.querySelectorAll(`input[type="radio"][name="${H}"]`).forEach(O=>{if(O!==_){const se=Ke({isMasked:J,element:O,value:dt(O,C,V),maskInputFn:c});m(O,d?{text:se,isChecked:!q,userTriggered:!1}:{text:se,isChecked:!q})}})}function m(w,_){const Q=Ms.get(w);if(!Q||Q.text!==_.text||Q.isChecked!==_.isChecked){Ms.set(w,_);const C=s.getId(w);F(e)({..._,id:C})}}const E=(u.input==="last"?["change"]:["input","change"]).map(w=>te(w,F(g),t)),I=t.defaultView;if(!I)return()=>{E.forEach(w=>w())};const U=I.Object.getOwnPropertyDescriptor(I.HTMLInputElement.prototype,"value"),R=[[I.HTMLInputElement.prototype,"value"],[I.HTMLInputElement.prototype,"checked"],[I.HTMLSelectElement.prototype,"value"],[I.HTMLTextAreaElement.prototype,"value"],[I.HTMLSelectElement.prototype,"selectedIndex"],[I.HTMLOptionElement.prototype,"selected"]];return U&&U.set&&E.push(...R.map(w=>st(w[0],w[1],{set(){F(g)({target:this,isTrusted:!1})}},!1,I))),F(()=>{E.forEach(w=>w())})}function gt(e,t){const s=[];function r(n,i){if(it(e,"CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||it(e,"CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||it(e,"CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||it(e,"CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){const a=Array.from(n.parentRule.cssRules).indexOf(n);i.unshift(a)}else if(n.parentStyleSheet){const a=Array.from(n.parentStyleSheet.cssRules).indexOf(n);i.unshift(a)}return i}return r(t,s)}function Se(e,t,s){let r,n;return e?(e.ownerNode?r=t.getId(e.ownerNode):n=s.getId(e),{styleId:n,id:r}):{}}function ti({styleSheetRuleCb:e,mirror:t,stylesheetManager:s},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const n=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(n,{apply:F((u,d,h)=>{const[p,f]=h,{id:y,styleId:g}=Se(d,t,s.styleMirror);return(y&&y!==-1||g&&g!==-1)&&e({id:y,styleId:g,adds:[{rule:p,index:f}]}),u.apply(d,h)})});const i=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:F((u,d,h)=>{const[p]=h,{id:f,styleId:y}=Se(d,t,s.styleMirror);return(f&&f!==-1||y&&y!==-1)&&e({id:f,styleId:y,removes:[{index:p}]}),u.apply(d,h)})});let o;r.CSSStyleSheet.prototype.replace&&(o=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(o,{apply:F((u,d,h)=>{const[p]=h,{id:f,styleId:y}=Se(d,t,s.styleMirror);return(f&&f!==-1||y&&y!==-1)&&e({id:f,styleId:y,replace:p}),u.apply(d,h)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:F((u,d,h)=>{const[p]=h,{id:f,styleId:y}=Se(d,t,s.styleMirror);return(f&&f!==-1||y&&y!==-1)&&e({id:f,styleId:y,replaceSync:p}),u.apply(d,h)})}));const l={};ot(r,"CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(ot(r,"CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),ot(r,"CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),ot(r,"CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:F((h,p,f)=>{const[y,g]=f,{id:m,styleId:b}=Se(p.parentStyleSheet,t,s.styleMirror);return(m&&m!==-1||b&&b!==-1)&&e({id:m,styleId:b,adds:[{rule:y,index:[...gt(r,p),g||0]}]}),h.apply(p,f)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:F((h,p,f)=>{const[y]=f,{id:g,styleId:m}=Se(p.parentStyleSheet,t,s.styleMirror);return(g&&g!==-1||m&&m!==-1)&&e({id:g,styleId:m,removes:[{index:[...gt(r,p),y]}]}),h.apply(p,f)})})}),F(()=>{r.CSSStyleSheet.prototype.insertRule=n,r.CSSStyleSheet.prototype.deleteRule=i,o&&(r.CSSStyleSheet.prototype.replace=o),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function fr({mirror:e,stylesheetManager:t},s){let r=null;s.nodeName==="#document"?r=e.getId(s):r=e.getId(s.host);const n=s.nodeName==="#document"?s.defaultView?.Document:s.ownerDocument?.defaultView?.ShadowRoot,i=n?.prototype?Object.getOwnPropertyDescriptor(n?.prototype,"adoptedStyleSheets"):void 0;return r===null||r===-1||!n||!i?()=>{}:(Object.defineProperty(s,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get(){return i.get?.call(this)},set(o){const a=i.set?.call(this,o);if(r!==null&&r!==-1)try{t.adoptStyleSheets(o,r)}catch{}return a}}),F(()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:i.configurable,enumerable:i.enumerable,get:i.get,set:i.set})}))}function si({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:s,stylesheetManager:r},{win:n}){const i=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:F((a,l,c)=>{const[u,d,h]=c;if(s.has(u))return i.apply(l,[u,d,h]);const{id:p,styleId:f}=Se(l.parentRule?.parentStyleSheet,t,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&e({id:p,styleId:f,set:{property:u,value:d,priority:h},index:gt(n,l.parentRule)}),a.apply(l,c)})});const o=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=new Proxy(o,{apply:F((a,l,c)=>{const[u]=c;if(s.has(u))return o.apply(l,[u]);const{id:d,styleId:h}=Se(l.parentRule?.parentStyleSheet,t,r.styleMirror);return(d&&d!==-1||h&&h!==-1)&&e({id:d,styleId:h,remove:{property:u},index:gt(n,l.parentRule)}),a.apply(l,c)})}),F(()=>{n.CSSStyleDeclaration.prototype.setProperty=i,n.CSSStyleDeclaration.prototype.removeProperty=o})}function ri({mediaInteractionCb:e,blockClass:t,blockSelector:s,unblockSelector:r,mirror:n,sampling:i,doc:o}){const a=F(c=>ze(F(u=>{const d=rt(u);if(!d||Z(d,t,s,r,!0))return;const{currentTime:h,volume:p,muted:f,playbackRate:y}=d;e({type:c,id:n.getId(d),currentTime:h,volume:p,muted:f,playbackRate:y})}),i.media||500)),l=[te("play",a(fe.Play),o),te("pause",a(fe.Pause),o),te("seeked",a(fe.Seeked),o),te("volumechange",a(fe.VolumeChange),o),te("ratechange",a(fe.RateChange),o)];return F(()=>{l.forEach(c=>c())})}function ni({fontCb:e,doc:t}){const s=t.defaultView;if(!s)return()=>{};const r=[],n=new WeakMap,i=s.FontFace;s.FontFace=function(l,c,u){const d=new i(l,c,u);return n.set(d,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};const o=Re(t.fonts,"add",function(a){return function(l){return ue(F(()=>{const c=n.get(l);c&&(e(c),n.delete(l))}),0),a.apply(this,[l])}});return r.push(()=>{s.FontFace=i}),r.push(o),F(()=>{r.forEach(a=>a())})}function ii(e){const{doc:t,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,selectionCb:o}=e;let a=!0;const l=F(()=>{const c=t.getSelection();if(!c||a&&c?.isCollapsed)return;a=c.isCollapsed||!1;const u=[],d=c.rangeCount||0;for(let h=0;h<d;h++){const p=c.getRangeAt(h),{startContainer:f,startOffset:y,endContainer:g,endOffset:m}=p;Z(f,r,n,i,!0)||Z(g,r,n,i,!0)||u.push({start:s.getId(f),startOffset:y,end:s.getId(g),endOffset:m})}o({ranges:u})});return l(),te("selectionchange",l)}function oi({doc:e,customElementCb:t}){const s=e.defaultView;return!s||!s.customElements?()=>{}:Re(s.customElements,"define",function(n){return function(i,o,a){try{t({define:{name:i}})}catch{}return n.apply(this,[i,o,a])}})}function ai(e,t={}){const s=e.doc.defaultView;if(!s)return()=>{};let r;e.recordDOM&&(r=dr(e,e.doc));const n=Qn(e),i=Jn(e),o=hr(e),a=Zn(e,{win:s}),l=ei(e),c=ri(e);let u=()=>{},d=()=>{},h=()=>{},p=()=>{};e.recordDOM&&(u=ti(e,{win:s}),d=fr(e,e.doc),h=si(e,{win:s}),e.collectFonts&&(p=ni(e)));const f=ii(e),y=oi(e),g=[];for(const m of e.plugins)g.push(m.observer(m.callback,s,m.options));return F(()=>{Te.forEach(m=>m.reset()),r?.disconnect(),n(),i(),o(),a(),l(),c(),u(),d(),h(),p(),f(),y(),g.forEach(m=>m())})}function it(e,t){return typeof e[t]<"u"}function ot(e,t){return!!(typeof e[t]<"u"&&e[t].prototype&&"insertRule"in e[t].prototype&&"deleteRule"in e[t].prototype)}class Ft{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,s,r,n){const i=r||this.getIdToRemoteIdMap(t),o=n||this.getRemoteIdToIdMap(t);let a=i.get(s);return a||(a=this.generateIdFn(),i.set(s,a),o.set(a,s)),a}getIds(t,s){const r=this.getIdToRemoteIdMap(t),n=this.getRemoteIdToIdMap(t);return s.map(i=>this.getId(t,i,r,n))}getRemoteId(t,s,r){const n=r||this.getRemoteIdToIdMap(t);if(typeof s!="number")return s;const i=n.get(s);return i||-1}getRemoteIds(t,s){const r=this.getRemoteIdToIdMap(t);return s.map(n=>this.getRemoteId(t,n,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let s=this.iframeIdToRemoteIdMap.get(t);return s||(s=new Map,this.iframeIdToRemoteIdMap.set(t,s)),s}getRemoteIdToIdMap(t){let s=this.iframeRemoteIdToIdMap.get(t);return s||(s=new Map,this.iframeRemoteIdToIdMap.set(t,s)),s}}class li{constructor(){this.crossOriginIframeMirror=new Ft(Vt),this.crossOriginIframeRootIdMap=new WeakMap}addIframe(){}addLoadListener(){}attachIframe(){}}class ci{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new Ft(Vt),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Ft(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&t.win.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,s){this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:s}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&t.contentWindow?.addEventListener("message",this.handleMessage.bind(this)),this.loadListener?.(t);const r=ee(t);r&&r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r))}handleMessage(t){const s=t;if(s.data.type!=="rrweb"||s.origin!==s.data.origin||!t.source)return;const n=this.crossOriginIframeMap.get(t.source);if(!n)return;const i=this.transformCrossOriginEvent(n,s.data.event);i&&this.wrappedEmit(i,s.data.isCheckout)}transformCrossOriginEvent(t,s){switch(s.type){case T.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(s.data.node,t);const r=s.data.node.id;return this.crossOriginIframeRootIdMap.set(t,r),this.patchRootIdOnNode(s.data.node,r),{timestamp:s.timestamp,type:T.IncrementalSnapshot,data:{source:M.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:s.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case T.Meta:case T.Load:case T.DomContentLoaded:return!1;case T.Plugin:return s;case T.Custom:return this.replaceIds(s.data.payload,t,["id","parentId","previousId","nextId"]),s;case T.IncrementalSnapshot:switch(s.data.source){case M.Mutation:return s.data.adds.forEach(r=>{this.replaceIds(r,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,t);const n=this.crossOriginIframeRootIdMap.get(t);n&&this.patchRootIdOnNode(r.node,n)}),s.data.removes.forEach(r=>{this.replaceIds(r,t,["parentId","id"])}),s.data.attributes.forEach(r=>{this.replaceIds(r,t,["id"])}),s.data.texts.forEach(r=>{this.replaceIds(r,t,["id"])}),s;case M.Drag:case M.TouchMove:case M.MouseMove:return s.data.positions.forEach(r=>{this.replaceIds(r,t,["id"])}),s;case M.ViewportResize:return!1;case M.MediaInteraction:case M.MouseInteraction:case M.Scroll:case M.CanvasMutation:case M.Input:return this.replaceIds(s.data,t,["id"]),s;case M.StyleSheetRule:case M.StyleDeclaration:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleId"]),s;case M.Font:return s;case M.Selection:return s.data.ranges.forEach(r=>{this.replaceIds(r,t,["start","end"])}),s;case M.AdoptedStyleSheet:return this.replaceIds(s.data,t,["id"]),this.replaceStyleIds(s.data,t,["styleIds"]),s.data.styles?.forEach(r=>{this.replaceStyleIds(r,t,["styleId"])}),s}}return!1}replace(t,s,r,n){for(const i of n)!Array.isArray(s[i])&&typeof s[i]!="number"||(Array.isArray(s[i])?s[i]=t.getIds(r,s[i]):s[i]=t.getId(r,s[i]));return s}replaceIds(t,s,r){return this.replace(this.crossOriginIframeMirror,t,s,r)}replaceStyleIds(t,s,r){return this.replace(this.crossOriginIframeStyleMirror,t,s,r)}replaceIdOnNode(t,s){this.replaceIds(t,s,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,s)})}patchRootIdOnNode(t,s){t.type!==x.Document&&!t.rootId&&(t.rootId=s),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,s)})}}class ui{init(){}addShadowRoot(){}observeAttachShadow(){}reset(){}}class di{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,this.bypassOptions.win.document)}addShadowRoot(t,s){if(!Qe(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t),this.bypassOptions.canvasManager.addShadowRoot(t);const r=dr({...this.bypassOptions,doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(hr({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),ue(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(fr({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){const s=ee(t),r=ir(t);!s||!r||this.patchAttachShadow(r.Element,s)}patchAttachShadow(t,s){const r=this;this.restoreHandlers.push(Re(t.prototype,"attachShadow",function(n){return function(i){const o=n.call(this,i);return this.shadowRoot&&Kt(this)&&r.addShadowRoot(this.shadowRoot,s),o}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet,this.bypassOptions.canvasManager.resetShadowRoots()}}var Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Xe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var at=0;at<Be.length;at++)Xe[Be.charCodeAt(at)]=at;var hi=function(e){var t=new Uint8Array(e),s,r=t.length,n="";for(s=0;s<r;s+=3)n+=Be[t[s]>>2],n+=Be[(t[s]&3)<<4|t[s+1]>>4],n+=Be[(t[s+1]&15)<<2|t[s+2]>>6],n+=Be[t[s+2]&63];return r%3===2?n=n.substring(0,n.length-1)+"=":r%3===1&&(n=n.substring(0,n.length-2)+"=="),n},fi=function(e){var t=e.length*.75,s=e.length,r,n=0,i,o,a,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var c=new ArrayBuffer(t),u=new Uint8Array(c);for(r=0;r<s;r+=4)i=Xe[e.charCodeAt(r)],o=Xe[e.charCodeAt(r+1)],a=Xe[e.charCodeAt(r+2)],l=Xe[e.charCodeAt(r+3)],u[n++]=i<<2|o>>4,u[n++]=(o&15)<<4|a>>2,u[n++]=(a&3)<<6|l&63;return c};const Cs=new Map;function pi(e,t){let s=Cs.get(e);return s||(s=new Map,Cs.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}const pr=(e,t,s)=>{if(!e||!(gr(e,t)||typeof e=="object"))return;const r=e.constructor.name,n=pi(s,r);let i=n.indexOf(e);return i===-1&&(i=n.length,n.push(e)),i};function ct(e,t,s){if(e instanceof Array)return e.map(r=>ct(r,t,s));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const r=e.constructor.name,n=hi(e);return{rr_type:r,base64:n}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[ct(e.buffer,t,s),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const r=e.constructor.name,{src:n}=e;return{rr_type:r,src:n}}else if(e instanceof HTMLCanvasElement){const r="HTMLImageElement",n=e.toDataURL();return{rr_type:r,src:n}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[ct(e.data,t,s),e.width,e.height]};if(gr(e,t)||typeof e=="object"){const r=e.constructor.name,n=pr(e,t,s);return{rr_type:r,index:n}}}}return e}const mr=(e,t,s)=>e.map(r=>ct(r,t,s)),gr=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof t[n]=="function").find(n=>e instanceof t[n]);function mi(e,t,s,r,n){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const l=Re(t.CanvasRenderingContext2D.prototype,a,function(c){return function(...u){return Z(this.canvas,s,r,n,!0)||ue(()=>{const d=mr(u,t,this);e(this.canvas,{type:me["2D"],property:a,args:d})},0),c.apply(this,u)}});i.push(l)}catch{const l=st(t.CanvasRenderingContext2D.prototype,a,{set(c){e(this.canvas,{type:me["2D"],property:a,args:[c],setter:!0})}});i.push(l)}return()=>{i.forEach(a=>a())}}function gi(e){return e==="experimental-webgl"?"webgl":e}function Ns(e,t,s,r,n){const i=[];try{const o=Re(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...c){if(!Z(this,t,s,r,!0)){const u=gi(l);if("__context"in this||(this.__context=u),n&&["webgl","webgl2"].includes(u))if(c[0]&&typeof c[0]=="object"){const d=c[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...c])}});i.push(o)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function Is(e,t,s,r,n,i,o,a){const l=[],c=Object.getOwnPropertyNames(e);for(const u of c)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if(typeof e[u]!="function")continue;const d=Re(e,u,function(h){return function(...p){const f=h.apply(this,p);if(pr(f,a,this),"tagName"in this.canvas&&!Z(this.canvas,r,n,i,!0)){const y=mr(p,a,this),g={type:t,property:u,args:y};s(this.canvas,g)}return f}});l.push(d)}catch{const d=st(e,u,{set(h){s(this.canvas,{type:t,property:u,args:[h],setter:!0})}});l.push(d)}return l}function yi(e,t,s,r,n,i){const o=[];return o.push(...Is(t.WebGLRenderingContext.prototype,me.WebGL,e,s,r,n,i,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...Is(t.WebGL2RenderingContext.prototype,me.WebGL2,e,s,r,n,i,t)),()=>{o.forEach(a=>a())}}const Si='for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s="";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+"=":r%3==1&&(s=s.substring(0,s.length-2)+"=="),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!("OffscreenCanvas"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+"-"+t;if("OffscreenCanvas"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext("2d");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return""}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext("bitmaprenderer"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:"low"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};';function bi(){const e=new Blob([Si]);return URL.createObjectURL(e)}class Ts{reset(){}freeze(){}unfreeze(){}lock(){}unlock(){}snapshot(){}addWindow(){}addShadowRoot(){}resetShadowRoots(){}}class vi{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.shadowDoms=new Set,this.windowsSet=new WeakSet,this.windows=[],this.restoreHandlers=[],this.frozen=!1,this.locked=!1,this.snapshotInProgressMap=new Map,this.worker=null,this.lastSnapshotTime=0,this.processMutation=(a,l)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(a)||this.pendingCanvasMutations.set(a,[]),this.pendingCanvasMutations.get(a).push(l)};const{enableManualSnapshot:s,sampling:r="all",win:n,recordCanvas:i,errorHandler:o}=t;t.sampling=r,this.mutationCb=t.mutationCb,this.mirror=t.mirror,this.options=t,o&&ur(o),(i&&typeof r=="number"||s)&&(this.worker=this.initFPSWorker()),this.addWindow(n),!s&&F(()=>{i&&r==="all"&&(this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher()),i&&typeof r=="number"&&this.initCanvasFPSObserver()})()}reset(){this.pendingCanvasMutations.clear(),this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.windowsSet=new WeakSet,this.windows=[],this.shadowDoms=new Set,this.worker?.terminate(),this.worker=null,this.snapshotInProgressMap=new Map}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}addWindow(t){const{sampling:s="all",blockClass:r,blockSelector:n,unblockSelector:i,recordCanvas:o,enableManualSnapshot:a}=this.options;if(!this.windowsSet.has(t)){if(a){this.windowsSet.add(t),this.windows.push(new WeakRef(t));return}F(()=>{if(o&&s==="all"&&this.initCanvasMutationObserver(t,r,n,i),o&&typeof s=="number"){const l=Ns(t,r,n,i,!0);this.restoreHandlers.push(()=>{l()})}})(),this.windowsSet.add(t),this.windows.push(new WeakRef(t))}}addShadowRoot(t){this.shadowDoms.add(new WeakRef(t))}resetShadowRoots(){this.shadowDoms=new Set}snapshot(t,s){if(s?.skipRequestAnimationFrame){this.takeSnapshot(performance.now(),!0,t);return}ae(r=>this.takeSnapshot(r,!0,t))}initFPSWorker(){const t=new Worker(bi());return t.onmessage=s=>{const r=s.data,{id:n}=r;if(this.snapshotInProgressMap.set(n,!1),!("base64"in r))return;const{base64:i,type:o,width:a,height:l}=r;this.mutationCb({id:n,type:me["2D"],commands:[{property:"clearRect",args:[0,0,a,l]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:o}]},0,0,a,l]}]})},t}initCanvasFPSObserver(){let t;if(!this.windows.length&&!this.shadowDoms.size)return;const s=r=>{this.takeSnapshot(r,!1),t=ae(s)};t=ae(s),this.restoreHandlers.push(()=>{t&&cancelAnimationFrame(t)})}initCanvasMutationObserver(t,s,r,n){const i=Ns(t,s,r,n,!1),o=mi(this.processMutation.bind(this),t,s,r,n),a=yi(this.processMutation.bind(this),t,s,r,n,this.mirror);this.restoreHandlers.push(()=>{i(),o(),a()})}getCanvasElements(t,s,r){const n=[],i=o=>{o.querySelectorAll("canvas").forEach(a=>{Z(a,t,s,r,!0)||n.push(a)})};for(const o of this.windows){const a=o.deref();let l;try{l=a&&a.document}catch{}l&&i(l)}for(const o of this.shadowDoms){const a=o.deref();a&&i(a)}return n}takeSnapshot(t,s,r){const{sampling:n,blockClass:i,blockSelector:o,unblockSelector:a,dataURLOptions:l,maxCanvasSize:c}=this.options,d=1e3/(n==="all"?2:n||2);return this.lastSnapshotTime&&t-this.lastSnapshotTime<d?!1:(this.lastSnapshotTime=t,(r?[r]:this.getCanvasElements(i,o,a)).forEach(f=>{const y=this.mirror.getId(f);if(!(!this.mirror.hasNode(f)||!f.width||!f.height||this.snapshotInProgressMap.get(y))){if(this.snapshotInProgressMap.set(y,!0),!s&&["webgl","webgl2"].includes(f.__context)){const g=f.getContext(f.__context);g?.getContextAttributes()?.preserveDrawingBuffer===!1&&g.clear(g.COLOR_BUFFER_BIT)}createImageBitmap(f).then(g=>{this.worker?.postMessage({id:y,bitmap:g,width:f.width,height:f.height,dataURLOptions:l,maxCanvasSize:c},[g])}).catch(g=>{F(()=>{throw this.snapshotInProgressMap.delete(y),g})()})}}),!0)}startPendingCanvasMutationFlusher(){ae(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=s=>{this.rafStamps.latestId=s,ae(t)};ae(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,s)=>{const r=this.mirror.getId(s);this.flushPendingCanvasMutationFor(s,r)}),ae(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,s){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(t);if(!r||s===-1)return;const n=r.map(o=>{const{type:a,...l}=o;return l}),{type:i}=r[0];this.mutationCb({id:s,type:i,commands:n}),this.pendingCanvasMutations.delete(t)}}class Ei{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Jt,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,s){"_cssText"in s.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:s.id,attributes:s.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,s){if(t.length===0)return;const r={id:s,styleIds:[]},n=[];for(const i of t){let o;this.styleMirror.has(i)?o=this.styleMirror.getId(i):(o=this.styleMirror.add(i),n.push({styleId:o,rules:Array.from(i.rules||CSSRule,(a,l)=>({rule:Bs(a),index:l}))})),r.styleIds.push(o)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class wi{constructor(){this.nodeMap=new WeakMap,this.active=!1}inOtherBuffer(t,s){const r=this.nodeMap.get(t);return r&&Array.from(r).some(n=>n!==s)}add(t,s){this.active||(this.active=!0,ae(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(s))}destroy(){}}let X,yr,yt;try{if(Array.from([1],e=>e*2)[0]!==2){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}const ce=Us();function os(e={}){const{emit:t,checkoutEveryNms:s,checkoutEveryNth:r,blockClass:n="rr-block",blockSelector:i=null,unblockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskAllText:c=!1,maskTextClass:u="rr-mask",unmaskTextClass:d=null,maskTextSelector:h=null,unmaskTextSelector:p=null,inlineStylesheet:f=!0,maskAllInputs:y,maskInputOptions:g,slimDOMOptions:m,maskAttributeFn:b,maskInputFn:E,maskTextFn:I,maxCanvasSize:U=null,packFn:R,sampling:w={},dataURLOptions:_={},mousemoveWait:Q,recordDOM:C=!0,recordCanvas:k=!1,recordCrossOriginIframes:V=!1,recordAfter:Y=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:q=!1,collectFonts:ne=!1,inlineImages:J=!1,win:H=window,plugins:O,keepIframeSrcFn:se=()=>!1,ignoreCSSAttributes:v=new Set([]),errorHandler:S,onMutation:D,getCanvasManager:L}=e,A=H;ur(S);const re=V?A.parent===A:!0;let ie=!1;if(!re)try{A.parent.document&&(ie=!1)}catch{ie=!0}if(re&&!t)throw new Error("emit function is required");if(!re&&!ie)return()=>{};Q!==void 0&&w.mousemove===void 0&&(w.mousemove=Q),ce.reset();const $e=y===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,radio:!0,checkbox:!0}:g!==void 0?g:{},Ee=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all"}:m||{};Yt(A);let xe,ge=0;const wt=z=>{for(const le of O||[])le.eventProcessor&&(z=le.eventProcessor(z));return R&&!ie&&(z=R(z)),z};X=(z,le)=>{const P=z;if(P.timestamp=tt(),Te[0]?.isFrozen()&&P.type!==T.FullSnapshot&&!(P.type===T.IncrementalSnapshot&&P.data.source===M.Mutation)&&Te.forEach(K=>K.unfreeze()),re)t?.(wt(P),le);else if(ie){const K={type:"rrweb",event:wt(P),origin:A.location.origin,isCheckout:le};A.parent.postMessage(K,"*")}if(P.type===T.FullSnapshot)xe=P,ge=0;else if(P.type===T.IncrementalSnapshot){if(P.data.source===M.Mutation&&P.data.isAttachIframe)return;ge++;const K=r&&ge>=r,G=s&&xe&&P.timestamp-xe.timestamp>s;(K||G)&&Nt(!0)}},yr=X;const ye=z=>{X({type:T.IncrementalSnapshot,data:{source:M.Mutation,...z}})},as=z=>X({type:T.IncrementalSnapshot,data:{source:M.Scroll,...z}}),Nr=z=>X({type:T.IncrementalSnapshot,data:{source:M.CanvasMutation,...z}}),Ir=z=>X({type:T.IncrementalSnapshot,data:{source:M.AdoptedStyleSheet,...z}}),we=new Ei({mutationCb:ye,adoptedStyleSheetCb:Ir}),Me=typeof __RRWEB_EXCLUDE_IFRAME__=="boolean"&&__RRWEB_EXCLUDE_IFRAME__?new li:new ci({win:A,mirror:ce,mutationCb:ye,stylesheetManager:we,recordCrossOriginIframes:V,wrappedEmit:X});for(const z of O||[])z.getMirror&&z.getMirror({nodeMirror:ce,crossOriginIframeMirror:Me.crossOriginIframeMirror,crossOriginIframeStyleMirror:Me.crossOriginIframeStyleMirror});const Mt=new wi,Ct=Ni(L,{mirror:ce,win:A,mutationCb:z=>X({type:T.IncrementalSnapshot,data:{source:M.CanvasMutation,...z}}),recordCanvas:k,blockClass:n,blockSelector:i,unblockSelector:o,maxCanvasSize:U,sampling:w.canvas,dataURLOptions:_,errorHandler:S}),nt=typeof __RRWEB_EXCLUDE_SHADOW_DOM__=="boolean"&&__RRWEB_EXCLUDE_SHADOW_DOM__?new ui:new di({mutationCb:ye,scrollCb:as,bypassOptions:{win:A,onMutation:D,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,inlineStylesheet:f,maskInputOptions:$e,dataURLOptions:_,maskAttributeFn:b,maskTextFn:I,maskInputFn:E,recordCanvas:k,inlineImages:J,sampling:w,slimDOMOptions:Ee,iframeManager:Me,stylesheetManager:we,canvasManager:Ct,keepIframeSrcFn:se,processedNodeManager:Mt,ignoreCSSAttributes:v},mirror:ce}),Nt=(z=!1)=>{if(!C)return;X({type:T.Meta,data:{href:A.location.href,width:Gt(A),height:zt(A)}},z),we.reset(),nt.init(),Te.forEach(P=>P.lock());const le=on(A.document,{mirror:ce,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,inlineStylesheet:f,maskAllInputs:$e,maskAttributeFn:b,maskInputFn:E,maskTextFn:I,slimDOM:Ee,dataURLOptions:_,recordCanvas:k,inlineImages:J,onSerialize:P=>{Ve(P,ce)&&Me.addIframe(P),qt(P,ce)&&we.trackLinkElement(P),be(P)&&nt.addShadowRoot(P.shadowRoot,document)},onIframeLoad:(P,K)=>{Me.attachIframe(P,K),P.contentWindow&&Ct.addWindow(P.contentWindow),nt.observeAttachShadow(P)},onStylesheetLoad:(P,K)=>{we.attachLinkElement(P,K)},onBlockedImageLoad:(P,K,{width:G,height:je})=>{ye({adds:[],removes:[],texts:[],attributes:[{id:K.id,attributes:{style:{width:`${G}px`,height:`${je}px`}}}]})},keepIframeSrcFn:se,ignoreCSSAttributes:v});if(!le)return console.warn("Failed to snapshot the document");X({type:T.FullSnapshot,data:{node:le,initialOffset:Ht(A)}}),Te.forEach(P=>P.unlock()),A.document.adoptedStyleSheets&&A.document.adoptedStyleSheets.length>0&&we.adoptStyleSheets(A.document.adoptedStyleSheets,ce.getId(A.document))};yt=Nt;try{const z=[],le=K=>F(ai)({onMutation:D,mutationCb:ye,mousemoveCb:(G,je)=>X({type:T.IncrementalSnapshot,data:{source:je,positions:G}}),mouseInteractionCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.MouseInteraction,...G}}),scrollCb:as,viewportResizeCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.ViewportResize,...G}}),inputCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.Input,...G}}),mediaInteractionCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.MediaInteraction,...G}}),styleSheetRuleCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.StyleSheetRule,...G}}),styleDeclarationCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.StyleDeclaration,...G}}),canvasMutationCb:Nr,fontCb:G=>X({type:T.IncrementalSnapshot,data:{source:M.Font,...G}}),selectionCb:G=>{X({type:T.IncrementalSnapshot,data:{source:M.Selection,...G}})},customElementCb:G=>{X({type:T.IncrementalSnapshot,data:{source:M.CustomElement,...G}})},blockClass:n,ignoreClass:a,ignoreSelector:l,maskAllText:c,maskTextClass:u,unmaskTextClass:d,maskTextSelector:h,unmaskTextSelector:p,maskInputOptions:$e,inlineStylesheet:f,sampling:w,recordDOM:C,recordCanvas:k,inlineImages:J,userTriggeredOnInput:q,collectFonts:ne,win:A,doc:K,maskAttributeFn:b,maskInputFn:E,maskTextFn:I,keepIframeSrcFn:se,blockSelector:i,unblockSelector:o,slimDOMOptions:Ee,dataURLOptions:_,mirror:ce,iframeManager:Me,stylesheetManager:we,shadowDomManager:nt,processedNodeManager:Mt,canvasManager:Ct,ignoreCSSAttributes:v,plugins:O?.filter(G=>G.observer)?.map(G=>({observer:G.observer,options:G.options,callback:je=>X({type:T.Plugin,data:{plugin:G.name,payload:je}})}))||[]},{});Me.addLoadListener(K=>{try{z.push(le(K.contentDocument))}catch(G){console.warn(G)}});const P=()=>{Nt(),z.push(le(A.document))};return A.document.readyState==="interactive"||A.document.readyState==="complete"?P():(z.push(te("DOMContentLoaded",()=>{X({type:T.DomContentLoaded,data:{}}),Y==="DOMContentLoaded"&&P()},A.document)),z.push(te("load",()=>{X({type:T.Load,data:{}}),Y==="load"&&P()},A))),()=>{z.forEach(K=>K()),Mt.destroy(),yt=void 0,qn()}}catch(z){console.warn(z)}}function Mi(e,t){if(!yr)throw new Error("please add custom event after start recording");X({type:T.Custom,data:{tag:e,payload:t}})}function Ci(){Te.forEach(e=>e.freeze())}function Sr(e){if(!yt)throw new Error("please take full snapshot after start recording");yt(e)}os.mirror=ce;os.takeFullSnapshot=Sr;function Ni(e,t){try{return e?e(t):new Ts}catch{return console.warn("Unable to initialize CanvasManager"),new Ts}}function br(e){return{all:e=e||new Map,on:function(t,s){var r=e.get(t);r?r.push(s):e.set(t,[s])},off:function(t,s){var r=e.get(t);r&&(s?r.splice(r.indexOf(s)>>>0,1):e.set(t,[]))},emit:function(t,s){var r=e.get(t);r&&r.slice().map(function(n){n(s)}),(r=e.get("*"))&&r.slice().map(function(n){n(t,s)})}}}const Ii=Object.freeze(Object.defineProperty({__proto__:null,default:br},Symbol.toStringTag,{value:"Module"}));function Ti(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&e.__forceSmoothScrollPolyfill__!==!0)return;const s=e.HTMLElement||e.Element,r=468,n={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:s.prototype.scroll||l,scrollIntoView:s.prototype.scrollIntoView},i=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;function o(m){const b=["MSIE ","Trident/","Edge/"];return new RegExp(b.join("|")).test(m)}const a=o(e.navigator.userAgent)?1:0;function l(m,b){this.scrollLeft=m,this.scrollTop=b}function c(m){return .5*(1-Math.cos(Math.PI*m))}function u(m){if(m===null||typeof m!="object"||m.behavior===void 0||m.behavior==="auto"||m.behavior==="instant")return!0;if(typeof m=="object"&&m.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+m.behavior+" is not a valid value for enumeration ScrollBehavior.")}function d(m,b){if(b==="Y")return m.clientHeight+a<m.scrollHeight;if(b==="X")return m.clientWidth+a<m.scrollWidth}function h(m,b){const E=e.getComputedStyle(m,null)["overflow"+b];return E==="auto"||E==="scroll"}function p(m){const b=d(m,"Y")&&h(m,"Y"),E=d(m,"X")&&h(m,"X");return b||E}function f(m){for(;m!==t.body&&p(m)===!1;)m=m.parentNode||m.host;return m}function y(m){const b=i();let E,I,U,R=(b-m.startTime)/r;R=R>1?1:R,E=c(R),I=m.startX+(m.x-m.startX)*E,U=m.startY+(m.y-m.startY)*E,m.method.call(m.scrollable,I,U),(I!==m.x||U!==m.y)&&e.requestAnimationFrame(y.bind(e,m))}function g(m,b,E){let I,U,R,w;const _=i();m===t.body?(I=e,U=e.scrollX||e.pageXOffset,R=e.scrollY||e.pageYOffset,w=n.scroll):(I=m,U=m.scrollLeft,R=m.scrollTop,w=l),y({scrollable:I,method:w,startTime:_,startX:U,startY:R,x:b,y:E})}e.scroll=e.scrollTo=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){n.scroll.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:e.scrollY||e.pageYOffset);return}g.call(e,t.body,arguments[0].left!==void 0?~~arguments[0].left:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:e.scrollY||e.pageYOffset)}},e.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])){n.scrollBy.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}g.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset))}},s.prototype.scroll=s.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(u(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");n.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const m=arguments[0].left,b=arguments[0].top;g.call(this,this,typeof m>"u"?this.scrollLeft:~~m,typeof b>"u"?this.scrollTop:~~b)},s.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(u(arguments[0])===!0){n.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},s.prototype.scrollIntoView=function(){if(u(arguments[0])===!0){n.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const m=f(this),b=m.getBoundingClientRect(),E=this.getBoundingClientRect();m!==t.body?(g.call(this,m,m.scrollLeft+E.left-b.left,m.scrollTop+E.top-b.top),e.getComputedStyle(m).position!=="fixed"&&e.scrollBy({left:b.left,top:b.top,behavior:"smooth"})):e.scrollBy({left:E.left,top:E.top,behavior:"smooth"})}}class Di{constructor(t=[],s){this.timeOffset=0,this.raf=null,this.actions=t,this.speed=s.speed}addAction(t){const s=this.raf===!0;if(!this.actions.length||this.actions[this.actions.length-1].delay<=t.delay)this.actions.push(t);else{const r=this.findActionIndex(t);this.actions.splice(r,0,t)}s&&(this.raf=ae(this.rafCheck.bind(this)))}start(){this.timeOffset=0,this.lastTimestamp=performance.now(),this.raf=ae(this.rafCheck.bind(this))}rafCheck(){const t=performance.now();for(this.timeOffset+=(t-this.lastTimestamp)*this.speed,this.lastTimestamp=t;this.actions.length;){const s=this.actions[0];if(this.timeOffset>=s.delay)this.actions.shift(),s.doAction();else break}this.actions.length>0?this.raf=ae(this.rafCheck.bind(this)):this.raf=!0}clear(){this.raf&&(this.raf!==!0&&cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(t){this.speed=t}isActive(){return this.raf!==null}findActionIndex(t){let s=0,r=this.actions.length-1;for(;s<=r;){const n=Math.floor((s+r)/2);if(this.actions[n].delay<t.delay)s=n+1;else if(this.actions[n].delay>t.delay)r=n-1;else return n+1}return s}}function Ds(e,t){if(e.type===T.IncrementalSnapshot&&e.data.source===M.MouseMove&&e.data.positions&&e.data.positions.length){const s=e.data.positions[0].timeOffset,r=e.timestamp+s;return e.delay=r-t,r-t}return e.delay=e.timestamp-t,e.delay}/*! *****************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
7
7
 
8
8
  Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
15
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
16
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
17
  PERFORMANCE OF THIS SOFTWARE.
18
- ***************************************************************************** */function Rs(e,t){var s=typeof Symbol=="function"&&e[Symbol.iterator];if(!s)return e;var r,n,i=s.call(e),o=[];try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(a){n={error:a}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(n)throw n.error}}return o}var Ue;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Ue||(Ue={}));var vr={type:"xstate.init"};function It(e){return e===void 0?[]:[].concat(e)}function _e(e){return{type:"xstate.assign",assignment:e}}function xs(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function St(e){return function(t){return e===t}}function Er(e){return typeof e=="string"?{type:e}:e}function ks(e,t){return{value:e,context:t,actions:[],changed:!1,matches:St(e)}}function Os(e,t,s){var r=t,n=!1;return[e.filter(function(i){if(i.type==="xstate.assign"){n=!0;var o=Object.assign({},r);return typeof i.assignment=="function"?o=i.assignment(r,s):Object.keys(i.assignment).forEach(function(a){o[a]=typeof i.assignment[a]=="function"?i.assignment[a](r,s):i.assignment[a]}),r=o,!1}return!0}),r,n]}function wr(e,t){t===void 0&&(t={});var s=Rs(Os(It(e.states[e.initial].entry).map(function(o){return xs(o,t.actions)}),e.context,vr),2),r=s[0],n=s[1],i={config:e,_options:t,initialState:{value:e.initial,actions:r,context:n,matches:St(e.initial)},transition:function(o,a){var l,c,u=typeof o=="string"?{value:o,context:e.context}:o,d=u.value,h=u.context,p=Er(a),f=e.states[d];if(f.on){var y=It(f.on[p.type]);try{for(var g=function(H){var O=typeof Symbol=="function"&&Symbol.iterator,se=O&&H[O],v=0;if(se)return se.call(H);if(H&&typeof H.length=="number")return{next:function(){return H&&v>=H.length&&(H=void 0),{value:H&&H[v++],done:!H}}};throw new TypeError(O?"Object is not iterable.":"Symbol.iterator is not defined.")}(y),m=g.next();!m.done;m=g.next()){var b=m.value;if(b===void 0)return ks(d,h);var E=typeof b=="string"?{target:b}:b,I=E.target,U=E.actions,R=U===void 0?[]:U,w=E.cond,_=w===void 0?function(){return!0}:w,Q=I===void 0,C=I??d,k=e.states[C];if(_(h,p)){var V=Rs(Os((Q?It(R):[].concat(f.exit,R,k.entry).filter(function(H){return H})).map(function(H){return xs(H,i._options.actions)}),h,p),3),Y=V[0],q=V[1],ne=V[2],J=I??d;return{value:J,context:q,actions:Y,changed:I!==d||Y.length>0||ne,matches:St(J)}}}}catch(H){l={error:H}}finally{try{m&&!m.done&&(c=g.return)&&c.call(g)}finally{if(l)throw l.error}}}return ks(d,h)}};return i}var As=function(e,t){return e.actions.forEach(function(s){var r=s.exec;return r&&r(e.context,t)})};function Mr(e){var t=e.initialState,s=Ue.NotStarted,r=new Set,n={_machine:e,send:function(i){s===Ue.Running&&(t=e.transition(t,i),As(t,Er(i)),r.forEach(function(o){return o(t)}))},subscribe:function(i){return r.add(i),i(t),{unsubscribe:function(){return r.delete(i)}}},start:function(i){if(i){var o=typeof i=="object"?i:{context:e.config.context,value:i};t={value:o.value,actions:[],context:o.context,matches:St(o.value)}}return s=Ue.Running,As(t,vr),n},stop:function(){return s=Ue.Stopped,r.clear(),n},get state(){return t},get status(){return s}};return n}function Ri(e,t){let s=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(n.type===T.FullSnapshot&&(s=!0),n.type===T.Meta&&s&&n.timestamp<=t)return e.slice(r)}return e}function xi(e,{getCastFn:t,applyEventsSynchronously:s,emitter:r}){const n=wr({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:_e({lastPlayedEvent:(i,o)=>o.type==="CAST_EVENT"?o.payload.event:i.lastPlayedEvent}),recordTimeOffset:_e((i,o)=>{let a=i.timeOffset;return"payload"in o&&"timeOffset"in o.payload&&(a=o.payload.timeOffset),{...i,timeOffset:a,baselineTime:i.events[0].timestamp+a}}),play(i){const{timer:o,events:a,baselineTime:l,lastPlayedEvent:c}=i;o.clear();for(const f of a)Ds(f,l);const u=Ri(a,l);let d=c?.timestamp;c?.type===T.IncrementalSnapshot&&c.data.source===M.MouseMove&&(d=c.timestamp+c.data.positions[0]?.timeOffset),l<(d||0)&&r.emit($.PlayBack);const h=new Array;let p=!1;for(const f of u){const y=f.type===T.FullSnapshot;if(d&&d<l&&(f.timestamp<=d||f===c)){y&&(p=!0);continue}if(f.timestamp<=l||y&&!p)y&&(p=!0),h.push(f);else{const g=t(f,!1);o.addAction({doAction:()=>{g()},delay:f.delay})}}s(h),r.emit($.Flush),o.start()},pause(i){i.timer.clear()},resetLastPlayedEvent:_e(i=>({...i,lastPlayedEvent:null})),startLive:_e({baselineTime:(i,o)=>(i.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),addEvent:_e((i,o)=>{const{baselineTime:a,timer:l,events:c}=i;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;Ds(u,a);let d=c.length-1;if(!c[d]||c[d].timestamp<=u.timestamp)c.push(u);else{let f=-1,y=0;for(;y<=d;){const g=Math.floor((y+d)/2);c[g].timestamp<=u.timestamp?y=g+1:d=g-1}f===-1&&(f=y),c.splice(f,0,u)}const h=u.timestamp<a,p=t(u,h);h?p():l.isActive()&&l.addAction({doAction:()=>{p()},delay:u.delay})}return{...i,events:c}})}});return Mr(n)}function ki(e){const t=wr({id:"speed",context:e,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:(s,r)=>{"payload"in r&&s.timer.setSpeed(r.payload.speed)},recordSpeed:_e({normalSpeed:s=>s.timer.speed}),restoreSpeed:s=>{s.timer.setSpeed(s.normalSpeed)}}});return Mr(t)}const Oi=e=>[`.${e} { background: currentColor }`,"noscript { display: none !important; }"],_s=new Map;function Cr(e,t){let s=_s.get(e);return s||(s=new Map,_s.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}function pe(e,t,s){return async r=>{if(r&&typeof r=="object"&&"rr_type"in r)if(s&&(s.isUnchanged=!1),r.rr_type==="ImageBitmap"&&"args"in r){const n=await pe(e,t,s)(r.args);return await createImageBitmap.apply(null,n)}else if("index"in r){if(s||t===null)return r;const{rr_type:n,index:i}=r;return Cr(t,n)[i]}else if("args"in r){const{rr_type:n,args:i}=r,o=window[n];return new o(...await Promise.all(i.map(pe(e,t,s))))}else{if("base64"in r)return fi(r.base64);if("src"in r){const n=e.get(r.src);if(n)return n;{const i=new Image;return i.src=r.src,e.set(r.src,i),i}}else if("data"in r&&r.rr_type==="Blob"){const n=await Promise.all(r.data.map(pe(e,t,s)));return new Blob(n,{type:r.type})}}else if(Array.isArray(r))return await Promise.all(r.map(pe(e,t,s)));return r}}function Ai(e,t){try{return t===me.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch{return null}}const _i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Li(e,t){if(!t?.constructor)return;const{name:s}=t.constructor;if(!_i.includes(s))return;const r=Cr(e,s);r.includes(t)||r.push(t)}async function Fi({mutation:e,target:t,type:s,imageMap:r,errorHandler:n}){try{const i=Ai(t,s);if(!i)return;if(e.setter){i[e.property]=e.args[0];return}const o=i[e.property],a=await Promise.all(e.args.map(pe(r,i))),l=o.apply(i,a);Li(i,l);const c=!1}catch(i){n(e,i)}}async function Pi({event:e,mutations:t,target:s,imageMap:r,errorHandler:n}){const i=s.getContext("2d");if(!i){n(t[0],new Error("Canvas context is null"));return}const o=t.map(async l=>Promise.all(l.args.map(pe(r,i))));(await Promise.all(o)).forEach((l,c)=>{const u=t[c];try{if(u.setter){i[u.property]=u.args[0];return}const d=i[u.property];u.property==="drawImage"&&typeof u.args[0]=="string"?(r.get(e),d.apply(i,u.args)):d.apply(i,l)}catch(d){n(u,d)}})}async function Pt({event:e,mutation:t,target:s,imageMap:r,canvasEventMap:n,errorHandler:i}){try{const o=n.get(e)||t,a="commands"in o?o.commands:[o];if([me.WebGL,me.WebGL2].includes(t.type)){for(let l=0;l<a.length;l++){const c=a[l];await Fi({mutation:c,type:t.type,target:s,imageMap:r,errorHandler:i})}return}await Pi({event:e,mutations:a,target:s,imageMap:r,errorHandler:i})}catch(o){i(t,o)}}const Ls=5*1e3,Wi=br||Ii,Fs="[replayer]";function Bi(e,t){let s=-1;if(e.length===0)return s;let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2);e[i].timestamp<=t?(s=i,r=i+1):n=i-1}return s}const Tt={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function Ui(e){return e.type==T.IncrementalSnapshot&&(e.data.source==M.TouchMove||e.data.source==M.MouseInteraction&&e.data.type==B.TouchStart)}function Ps(e){return"pointerId"in e&&typeof e.pointerId=="number"?e.pointerId:-1}class Vi{constructor(t,s){if(this.usingVirtualDom=!1,this.virtualDom=new Ge,this.emitter=Wi(),this.legacy_missingNodeRetryMap={},this.cache=ms(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=Us(),this.styleMirror=new Jt,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.pointers={},this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=a=>{this.iframe.style.display="inherit";for(const l of[...Object.values(this.pointers).flatMap(c=>c.mouseTail),this.iframe])l&&(l.setAttribute("width",String(a.width)),l.setAttribute("height",String(a.height)))},this.applyEventsSynchronously=a=>{for(const l of a){switch(l.type){case T.DomContentLoaded:case T.Load:case T.Custom:continue;case T.FullSnapshot:case T.Meta:case T.Plugin:case T.IncrementalSnapshot:break}this.getCastFn(l,!0)()}},this.getCastFn=(a,l=!1)=>{let c;switch(a.type){case T.DomContentLoaded:case T.Load:break;case T.Custom:c=()=>{this.emitter.emit($.CustomEvent,a)};break;case T.Meta:c=()=>this.emitter.emit($.Resize,{width:a.data.width,height:a.data.height});break;case T.FullSnapshot:c=()=>{if(this.firstFullSnapshot){if(this.firstFullSnapshot===a){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(a,l),this.iframe.contentWindow?.scrollTo(a.data.initialOffset),this.styleMirror.reset()};break;case T.IncrementalSnapshot:c=()=>{if(this.applyIncremental(a,l),!l&&(a===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const d of this.service.state.context.events)if(!(d.timestamp<=a.timestamp)&&this.isUserInteraction(d)){d.delay-a.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=d);break}if(this.nextUserInteractionEvent){const d=this.nextUserInteractionEvent.delay-a.delay,h={speed:Math.min(Math.round(d/Ls),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:h}),this.emitter.emit($.SkipStart,h)}}};break}return()=>{c&&c();for(const h of this.config.plugins||[])h.handler&&h.handler(a,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:a}});const d=this.service.state.context.events.length-1;if(!this.config.liveMode&&a===this.service.state.context.events[d]){const h=()=>{d<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit($.Finish))};let p=50;a.type===T.IncrementalSnapshot&&a.data.source===M.MouseMove&&a.data.positions.length&&(p+=Math.max(0,-a.data.positions[0].timeOffset)),le(h,p)}this.emitter.emit($.EventCast,a)}},!s?.liveMode&&t.length<2)throw new Error("Replayer need at least 2 events.");const r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Tt,useVirtualDom:!0,logger:console};this.config=Object.assign({},r,s),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on($.Resize,this.handleResize),this.setupDom();for(const a of this.config.plugins||[])a.getMirror&&a.getMirror({nodeMirror:this.mirror});this.emitter.on($.Flush,()=>{if(this.usingVirtualDom){const a={mirror:this.mirror,applyCanvas:(c,u,d)=>{Pt({event:c,mutation:u,target:d,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(c,u)=>{c.source===M.StyleSheetRule?this.applyStyleSheetRule(c,u):c.source===M.StyleDeclaration&&this.applyStyleDeclaration(c,u)},afterAppend:(c,u)=>{for(const d of this.config.plugins||[])d.onBuild&&d.onBuild(c,{id:u,replayer:this})}},l=ee(this.iframe);if(l)try{pt(l,this.virtualDom,a,this.virtualDom.mirror)}catch(c){console.warn(c)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const c in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[c],d=mt(u.node,this.mirror,this.virtualDom.mirror);pt(d,u.node,a,this.virtualDom.mirror),u.node=d}catch(u){this.warn(u)}this.constructedStyleMutations.forEach(c=>{this.applyStyleSheetMutation(c)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(c=>{this.applyAdoptedStyleSheet(c)}),this.adoptedStyleSheets=[]}for(const[a,{pointerPosition:l,touchActive:c}]of Object.entries(this.pointers)){const u=parseInt(a),d=this.pointers[u];l&&(this.moveAndHover(l.x,l.y,l.id,!0,l.debugData,u),d.pointerPosition=null),c===!0?d.pointerEl.classList.add("touch-active"):c===!1&&d.pointerEl.classList.remove("touch-active"),d.touchActive=null}if(this.lastMouseDownEvent){const[a,l]=this.lastMouseDownEvent;a.dispatchEvent(l)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on($.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()});const n=new Di([],{speed:this.config.speed});this.service=xi({events:t.map(a=>s&&s.unpackFn?s.unpackFn(a):a).sort((a,l)=>a.timestamp-l.timestamp),timer:n,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(a=>{this.emitter.emit($.StateChange,{player:a})}),this.speedService=ki({normalSpeed:-1,timer:n}),this.speedService.start(),this.speedService.subscribe(a=>{this.emitter.emit($.StateChange,{speed:a})});const i=this.service.state.context.events.find(a=>a.type===T.Meta),o=this.service.state.context.events.find(a=>a.type===T.FullSnapshot);if(i){const{width:a,height:l}=i.data;le(()=>{this.emitter.emit($.Resize,{width:a,height:l})},0)}o&&le(()=>{this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),this.iframe.contentWindow?.scrollTo(o.data.initialOffset))},1)}get timer(){return this.service.state.context.timer}createPointer(t,s){const r=document.createElement("canvas");r.classList.add("replayer-mouse-tail"),r.width=Number.parseFloat(this.iframe.width),r.height=Number.parseFloat(this.iframe.height),this.wrapper.insertBefore(r,this.iframe),r.style.display=this.config.mouseTail===!1?"none":"inherit";const n=document.createElement("div");n.classList.add("replayer-mouse"),this.pointers[t]={touchActive:null,pointerEl:n,tailPositions:[],pointerPosition:null,mouseTail:r},Ui(s)&&n.classList.add("touch-device"),this.wrapper.appendChild(n)}on(t,s){return this.emitter.on(t,s),this}off(t,s){return this.emitter.off(t,s),this}setConfig(t){const s=this.config.skipInactive;if(Object.keys(t).forEach(r=>{t[r],this.config[r]=t[r]}),this.config.skipInactive?s===!1&&this.config.skipInactive===!0&&this.reevaluateFastForward():this.backToNormal(),typeof t.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:t.speed}}),typeof t.mouseTail<"u")if(t.mouseTail===!1)for(const{mouseTail:r}of Object.values(this.pointers))r&&(r.style.display="none");else for(let{mouseTail:r}of Object.values(this.pointers))r||(r=document.createElement("canvas"),r.width=Number.parseFloat(this.iframe.width),r.height=Number.parseFloat(this.iframe.height),r.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(r,this.iframe)),r.style.display="inherit"}getMetaData(){const t=this.service.state.context.events[0],s=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:t.timestamp,endTime:s.timestamp,totalTime:s.timestamp-t.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:t,events:s}=this.service.state.context;return t-s[0].timestamp}getMirror(){return this.mirror}play(t=0){this.config.skipInactive&&this.speedService.state.matches("skipping")&&this.backToNormal(),this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:t}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:t}})),ee(this.iframe)?.getElementsByTagName("html")[0]?.classList.remove("rrweb-paused"),this.emitter.emit($.Start),this.config.skipInactive&&this.reevaluateFastForward()}pause(t){t===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof t=="number"&&(this.play(t),this.service.send({type:"PAUSE"})),ee(this.iframe)?.getElementsByTagName("html")[0]?.classList.add("rrweb-paused"),this.emitter.emit($.Pause)}resume(t=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(t),this.emitter.emit($.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit($.Destroy)}startLive(t){this.service.send({type:"TO_LIVE",payload:{baselineTime:t}})}addEvent(t){const s=this.config.unpackFn?this.config.unpackFn(t):t;Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:s}}))}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=ms()}reevaluateFastForward(){if(!this.config.skipInactive)return;this.nextUserInteractionEvent=null;const t=this.service.state.context.events,s=t[0];if(!s)return;const r=s.timestamp+this.getCurrentTime(),n=Bi(t,r);if(n===-1)return;const i=t[n],o=this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed;for(let a=n+1;a<t.length;a++){const l=t[a];if(this.isUserInteraction(l)){const c=l.timestamp-i.timestamp;if(c>o){this.nextUserInteractionEvent=l;const u={speed:Math.min(Math.round(c/Ls),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:u}),this.emitter.emit($.SkipStart,u)}break}}}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.iframe=document.createElement("iframe");const t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe);const s=ee(this.iframe),r=ir(this.iframe);r&&s&&(Ti(r,s),Yt(r))}rebuildFullSnapshot(t,s=!1){const r=ee(this.iframe);if(!r)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=(l,c)=>{this.collectIframeAndAttachDocument(n,l);for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:c,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),pn(t.data.node,{doc:r,afterAppend:i,cache:this.cache,mirror:this.mirror}),i(r,t.data.node.id);for(const{mutationInQueue:l,builtNode:c}of n)this.attachDocumentToIframe(l,c),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==l);const{documentElement:o,head:a}=r;if(this.insertStyleRules(o,a),!this.service.state.matches("playing")){const l=r.getElementsByTagName("html")[0];l&&l.classList.add("rrweb-paused")}this.emitter.emit($.FullsnapshotRebuilded,t),s||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(t,s){const r=Oi(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&r.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,lr(n,this.virtualDom.unserializedId)),t.insertBefore(n,s),n.rules.push({source:M.StyleSheetRule,adds:r.map((i,o)=>({rule:i,index:o}))})}else{const n=document.createElement("style");t.insertBefore(n,s);for(let i=0;i<r.length;i++)n.sheet?.insertRule(r[i],i)}}attachDocumentToIframe(t,s){const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,n=ee(s),i=[],o=(a,l)=>{this.collectIframeAndAttachDocument(i,a);const c=r.getMeta(a);if(c?.type===x.Element&&c?.tagName.toUpperCase()==="HTML"&&n){const{documentElement:u,head:d}=n;this.insertStyleRules(u,d)}if(!this.usingVirtualDom)for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:l,replayer:this})};Je(t.node,{doc:n,mirror:r,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(n,t.node.id);for(const{mutationInQueue:a,builtNode:l}of i)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==a)}collectIframeAndAttachDocument(t,s){if(Ve(s,this.mirror)){const r=this.newDocumentQueue.find(n=>n.parentId===this.mirror.getId(s));r&&t.push({mutationInQueue:r,builtNode:s})}}waitForStylesheetLoad(){const s=ee(this.iframe)?.head;if(s){const r=new Set;let n,i=this.service.state;const o=()=>{i=this.service.state};this.emitter.on($.Start,o),this.emitter.on($.Pause,o);const a=()=>{this.emitter.off($.Start,o),this.emitter.off($.Pause,o)};s.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(r.add(l),l.addEventListener("load",()=>{r.delete(l),r.size===0&&n!==-1&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit($.LoadStylesheetEnd),n&&ts(n),a())}))}),r.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit($.LoadStylesheetStart),n=le(()=>{i.matches("playing")&&this.play(this.getCurrentTime()),n=-1,a()},this.config.loadTimeout))}}async preloadAllImages(){const t=[];for(const s of this.service.state.context.events)s.type===T.IncrementalSnapshot&&s.data.source===M.CanvasMutation&&(t.push(this.deserializeAndPreloadCanvasEvents(s.data,s)),("commands"in s.data?s.data.commands:[s.data]).forEach(n=>{this.preloadImages(n,s)}));return Promise.all(t)}preloadImages(t,s){if(t.property==="drawImage"&&typeof t.args[0]=="string"&&!this.imageMap.has(s)){const r=document.createElement("canvas"),n=r.getContext("2d"),i=n?.createImageData(r.width,r.height);n?.putImageData(i,0,0)}}async deserializeAndPreloadCanvasEvents(t,s){if(!this.canvasEventMap.has(s)){const r={isUnchanged:!0};if("commands"in t){const n=await Promise.all(t.commands.map(async i=>{const o=await Promise.all(i.args.map(pe(this.imageMap,null,r)));return{...i,args:o}}));r.isUnchanged===!1&&this.canvasEventMap.set(s,{...t,commands:n})}else{const n=await Promise.all(t.args.map(pe(this.imageMap,null,r)));r.isUnchanged===!1&&this.canvasEventMap.set(s,{...t,args:n})}}}applyIncremental(t,s){const{data:r}=t;switch(r.source){case M.Mutation:{try{this.applyMutation(r,s)}catch(n){this.warn(`Exception in mutation ${n.message||n}`,r)}break}case M.Drag:case M.TouchMove:case M.MouseMove:{const n=Ps(r);this.pointers[n]||this.createPointer(n,t);const i=this.pointers[n];if(s){const o=r.positions[r.positions.length-1];i.pointerPosition={x:o.x,y:o.y,id:o.id,debugData:r}}else r.positions.forEach(o=>{const a={doAction:()=>{this.moveAndHover(o.x,o.y,o.id,s,r,n)},delay:o.timeOffset+t.timestamp-this.service.state.context.baselineTime};this.timer.addAction(a)}),this.timer.addAction({doAction(){},delay:t.delay-r.positions[0]?.timeOffset});break}case M.MouseInteraction:{const n=Ps(r);this.pointers[n]||this.createPointer(n,t);const i=this.pointers[n];if(r.id===-1)break;const o=new Event(De(B[r.type])),a=this.mirror.getNode(r.id);if(!a)return this.debugNodeNotFound(r,r.id);this.emitter.emit($.MouseInteraction,{type:r.type,target:a});const{triggerFocus:l}=this.config;switch(r.type){case B.Blur:"blur"in a&&a.blur();break;case B.Focus:l&&a.focus&&a.focus({preventScroll:!0});break;case B.Click:case B.TouchStart:case B.TouchEnd:case B.MouseDown:case B.MouseUp:s?(r.type===B.TouchStart?(i.touchActive=!0,Object.values(this.pointers).forEach(c=>{c!==i&&!c.touchActive&&(c.touchActive=!1)})):r.type===B.TouchEnd&&(i.touchActive=!1,i.pointerEl.remove(),i.mouseTail&&i.mouseTail.remove(),delete this.pointers[n]),r.type===B.MouseDown?this.lastMouseDownEvent=[a,o]:r.type===B.MouseUp&&(this.lastMouseDownEvent=null),i.pointerPosition={x:r.x||0,y:r.y||0,id:r.id,debugData:r}):(r.type===B.TouchStart&&(i.tailPositions.length=0),this.moveAndHover(r.x||0,r.y||0,r.id,s,r,n),r.type===B.Click?(i.pointerEl.classList.remove("active"),i.pointerEl.offsetWidth,i.pointerEl.classList.add("active")):r.type===B.TouchStart?(i.pointerEl.offsetWidth,i.pointerEl.classList.add("touch-active")):r.type===B.TouchEnd?(i.pointerEl.remove(),i.mouseTail&&i.mouseTail.remove(),delete this.pointers[n]):a.dispatchEvent(o));break;case B.TouchCancel:s?i.touchActive=!1:i.pointerEl.classList.remove("touch-active");break;default:a.dispatchEvent(o)}break}case M.Scroll:{if(r.id===-1)break;if(this.usingVirtualDom){const n=this.virtualDom.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);n.scrollData=r;break}this.applyScroll(r,s);break}case M.ViewportResize:this.emitter.emit($.Resize,{width:r.width,height:r.height});break;case M.Input:{if(r.id===-1)break;if(this.usingVirtualDom){const n=this.virtualDom.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);n.inputData=r;break}this.applyInput(r);break}case M.MediaInteraction:{const n=this.usingVirtualDom?this.virtualDom.mirror.getNode(r.id):this.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);const i=n;try{if(r.currentTime!==void 0&&(i.currentTime=r.currentTime),r.volume!==void 0&&(i.volume=r.volume),r.muted!==void 0&&(i.muted=r.muted),r.type===fe.Pause&&i.pause(),r.type===fe.Play){const o=i.play();typeof o?.catch=="function"&&o.catch(a=>{console.warn(a)})}r.type===fe.RateChange&&(i.playbackRate=r.playbackRate)}catch(o){this.warn(`Failed to replay media interactions: ${o.message||o}`)}break}case M.StyleSheetRule:case M.StyleDeclaration:{this.usingVirtualDom?r.styleId?this.constructedStyleMutations.push(r):r.id&&this.virtualDom.mirror.getNode(r.id)?.rules?.push(r):this.applyStyleSheetMutation(r);break}case M.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const n=this.virtualDom.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);n.canvasMutations.push({event:t,mutation:r})}else{const n=this.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);Pt({event:t,mutation:r,target:n,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case M.Font:{try{const n=new FontFace(r.family,r.buffer?new Uint8Array(JSON.parse(r.fontSource)):r.fontSource,r.descriptors);ee(this.iframe)?.fonts.add(n)}catch(n){this.warn(n)}break}case M.Selection:{if(s){this.lastSelectionData=r;break}this.applySelection(r);break}case M.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(r):this.applyAdoptedStyleSheet(r);break}}}applyMutation(t,s){if(this.config.useVirtualDom&&!this.usingVirtualDom&&s){this.usingVirtualDom=!0;const c=ee(this.iframe);if(c&&zn(c,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length)for(const u in this.legacy_missingNodeRetryMap)try{const d=this.legacy_missingNodeRetryMap[u],h=ar(d.node,this.virtualDom,this.mirror);h&&(d.node=h)}catch(d){this.warn(d)}}const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;t.removes=t.removes.filter(c=>r.getNode(c.id)?!0:(this.warnNodeNotFound(t,c.id),!1)),t.removes.forEach(c=>{const u=r.getNode(c.id);if(!u)return;let d=r.getNode(c.parentId);if(!d)return this.warnNodeNotFound(t,c.parentId);if(c.isShadow&&be(d)&&(d=d.shadowRoot),r.removeNodeFromMap(u),d)try{d.removeChild(u),this.usingVirtualDom&&u.nodeName==="#text"&&d.nodeName==="STYLE"&&d.rules?.length>0&&(d.rules=[])}catch(h){if(h instanceof DOMException)this.warn("parent could not remove child in mutation",d,u,t);else throw h}});const n={...this.legacy_missingNodeRetryMap},i=[],o=c=>{let u=null;return c.nextId&&(u=r.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!u},a=c=>{const u=ee(this.iframe);if(!u)return this.warn("Looks like your replayer has been destroyed.");let d=r.getNode(c.parentId);if(!d)return c.node.type===x.Document?this.newDocumentQueue.push(c):i.push(c);c.node.isShadow&&(be(d)||d.attachShadow({mode:"open"}),d=d.shadowRoot);let h=null,p=null;if(c.previousId&&(h=r.getNode(c.previousId)),c.nextId&&(p=r.getNode(c.nextId)),o(c))return i.push(c);if(c.node.rootId&&!r.getNode(c.node.rootId))return;const f=c.node.rootId?r.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:u;if(Ve(d,r)){this.attachDocumentToIframe(c,d);return}const y=(b,E)=>{if(!this.usingVirtualDom)for(const I of this.config.plugins||[])I.onBuild&&I.onBuild(b,{id:E,replayer:this})},g=Je(c.node,{doc:f,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:y});if(c.previousId===-1||c.nextId===-1){n[c.node.id]={node:g,mutation:c};return}const m=r.getMeta(d);if(m&&m.type===x.Element&&m.tagName==="textarea"&&c.node.type===x.Text){const b=Array.isArray(d.childNodes)?d.childNodes:Array.from(d.childNodes);for(const E of b)E.nodeType===d.TEXT_NODE&&d.removeChild(E)}else if(m?.type===x.Document){const b=d;c.node.type===x.DocumentType&&b.childNodes[0]?.nodeType===Node.DOCUMENT_TYPE_NODE&&b.removeChild(b.childNodes[0]),g.nodeName==="HTML"&&b.documentElement&&b.removeChild(b.documentElement)}if(h&&h.nextSibling&&h.nextSibling.parentNode?d.insertBefore(g,h.nextSibling):p&&p.parentNode?d.contains(p)?d.insertBefore(g,p):d.insertBefore(g,null):d.appendChild(g),y(g,c.node.id),this.usingVirtualDom&&g.nodeName==="#text"&&d.nodeName==="STYLE"&&d.rules?.length>0&&(d.rules=[]),Ve(g,this.mirror)){const b=this.mirror.getId(g),E=this.newDocumentQueue.find(I=>I.parentId===b);E&&(this.attachDocumentToIframe(E,g),this.newDocumentQueue=this.newDocumentQueue.filter(I=>I!==E))}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(n,d,g,c)};t.adds.forEach(c=>{a(c)});const l=Date.now();for(;i.length;){const c=qs(i);if(i.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(const u of c)r.getNode(u.value.parentId)?Xt(u,h=>{a(h)}):this.debug("Drop resolve tree since there is no parent for the root node.",u)}Object.keys(n).length&&Object.assign(this.legacy_missingNodeRetryMap,n),Qs(t.texts).forEach(c=>{const u=r.getNode(c.id);if(!u)return t.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(t,c.id);if(u.textContent=c.value,this.usingVirtualDom){const d=u.parentNode;d?.rules?.length>0&&(d.rules=[])}}),t.attributes.forEach(c=>{const u=r.getNode(c.id);if(!u)return t.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(t,c.id);for(const d in c.attributes)if(typeof d=="string"){const h=c.attributes[d];if(h===null)u.removeAttribute(d);else if(typeof h=="string")try{if(d==="_cssText"&&(u.nodeName==="LINK"||u.nodeName==="STYLE"))try{const p=r.getMeta(u),f=Je({...p,attributes:{...p.attributes,...c.attributes}},{doc:u.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache}),y=u.nextSibling,g=u.parentNode;if(f&&g){g.removeChild(u),g.insertBefore(f,y),r.replace(c.id,f);break}}catch{}u.nodeType!==3&&u.setAttribute(d,h)}catch(p){this.warn("An error occurred may due to the checkout feature.",p)}else if(d==="style"){const p=h,f=u;for(const y in p)if(p[y]===!1)f.style.removeProperty(y);else if(p[y]instanceof Array){const g=p[y];f.style.setProperty(y,g[0],g[1])}else{const g=p[y];f.style.setProperty(y,g)}}}})}applyScroll(t,s){const r=this.mirror.getNode(t.id);if(!r)return this.debugNodeNotFound(t,t.id);const n=this.mirror.getMeta(r),i=ee(this.iframe);if(r===i)this.iframe.contentWindow?.scrollTo({top:t.y,left:t.x,behavior:s?"auto":"smooth"});else if(n?.type===x.Document)r.defaultView?.scrollTo({top:t.y,left:t.x,behavior:s?"auto":"smooth"});else try{r.scrollTo({top:t.y,left:t.x,behavior:s?"auto":"smooth"})}catch{}}applyInput(t){const s=this.mirror.getNode(t.id);if(!s)return this.debugNodeNotFound(t,t.id);try{s.checked=t.isChecked,s.value=t.text}catch{}}applySelection(t){try{const s=new Set,r=t.ranges.map(({start:n,startOffset:i,end:o,endOffset:a})=>{const l=this.mirror.getNode(n),c=this.mirror.getNode(o);if(!l||!c)return;const u=new Range;u.setStart(l,i),u.setEnd(c,a);const h=l.ownerDocument?.getSelection();return h&&s.add(h),{range:u,selection:h}});s.forEach(n=>n.removeAllRanges()),r.forEach(n=>n&&n.selection?.addRange(n.range))}catch{}}applyStyleSheetMutation(t){let s=null;t.styleId?s=this.styleMirror.getStyle(t.styleId):t.id&&(s=this.mirror.getNode(t.id)?.sheet||null),s&&(t.source===M.StyleSheetRule?this.applyStyleSheetRule(t,s):t.source===M.StyleDeclaration&&this.applyStyleDeclaration(t,s))}applyStyleSheetRule(t,s){if(t.adds?.forEach(({rule:r,index:n})=>{try{if(Array.isArray(n)){const{positions:i,index:o}=Ot(n);We(s.cssRules,i).insertRule(r,o)}else{const i=n===void 0?void 0:Math.min(n,s.cssRules.length);s?.insertRule(r,i)}}catch{}}),t.removes?.forEach(({index:r})=>{try{if(Array.isArray(r)){const{positions:n,index:i}=Ot(r);We(s.cssRules,n).deleteRule(i||0)}else s?.deleteRule(r)}catch{}}),t.replace)try{s.replace?.(t.replace)}catch{}if(t.replaceSync)try{s.replaceSync?.(t.replaceSync)}catch{}}applyStyleDeclaration(t,s){if(t.set){const r=We(s.rules,t.index);r&&r.style&&r.style.setProperty(t.set.property,t.set.value,t.set.priority)}if(t.remove){const r=We(s.rules,t.index);r&&r.style&&r.style.removeProperty(t.remove.property)}}applyAdoptedStyleSheet(t){const s=this.mirror.getNode(t.id);if(!s)return;t.styles?.forEach(o=>{let a=null,l=null;if(be(s)?l=s.ownerDocument?.defaultView||null:s.nodeName==="#document"&&(l=s.defaultView),!!l)try{a=new l.CSSStyleSheet,this.styleMirror.add(a,o.styleId),this.applyStyleSheetRule({source:M.StyleSheetRule,adds:o.rules},a)}catch{}});const r=10;let n=0;const i=(o,a)=>{const l=a.map(c=>this.styleMirror.getStyle(c)).filter(c=>c!==null);be(o)?o.shadowRoot.adoptedStyleSheets=l:o.nodeName==="#document"&&(o.adoptedStyleSheets=l),l.length!==a.length&&n<r&&(le(()=>i(o,a),0+100*n),n++)};i(s,t.styleIds)}legacy_resolveMissingNode(t,s,r,n){const{previousId:i,nextId:o}=n,a=i&&t[i],l=o&&t[o];if(a){const{node:c,mutation:u}=a;s.insertBefore(c,r),delete t[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(t,s,c,u)}if(l){const{node:c,mutation:u}=l;s.insertBefore(c,r.nextSibling),delete t[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(t,s,c,u)}}moveAndHover(t,s,r,n,i,o){const a=this.mirror.getNode(r);if(!a)return this.debugNodeNotFound(i,r);const l=Qt(a,this.iframe),c=t*l.absoluteScale+l.x,u=s*l.absoluteScale+l.y,d=this.pointers[o];d&&d.pointerEl&&(d.pointerEl.style.left=`${c}px`,d.pointerEl.style.top=`${u}px`),n||this.drawMouseTail({x:c,y:u},o),this.hoverElements(a)}drawMouseTail(t,s){const r=this.pointers[s];if(!r||!r.mouseTail)return;const{lineCap:n,lineWidth:i,strokeStyle:o,duration:a}=this.config.mouseTail===!0?Tt:Object.assign({},Tt,this.config.mouseTail),l=()=>{if(!r||!r.mouseTail)return;const c=r.mouseTail,u=c.getContext("2d");!u||!r.tailPositions.length||(u.clearRect(0,0,c.width,c.height),u.beginPath(),u.lineWidth=i,u.lineCap=n,u.strokeStyle=o,u.moveTo(r.tailPositions[0].x,r.tailPositions[0].y),r.tailPositions.forEach(d=>u.lineTo(d.x,d.y)),u.stroke())};r.tailPositions.push(t),l(),le(()=>{s in this.pointers&&(r.tailPositions=r.tailPositions.filter(c=>c!==t),l())},a/this.speedService.state.context.timer.speed)}hoverElements(t){const s=ee(this.iframe),r=this.lastHoveredRootNode||s;r&&typeof r.querySelectorAll=="function"&&r.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover")}),this.lastHoveredRootNode=t.getRootNode();let n=t;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(t){return t.type!==T.IncrementalSnapshot?!1:t.data.source>M.Mutation&&t.data.source<=M.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit($.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(t,s){this.warn(`Node with id '${s}' not found. `,t)}warnCanvasMutationFailed(t,s){this.warn("Has error on canvas update",s,"canvas mutation:",t)}debugNodeNotFound(t,s){this.debug(`Node with id '${s}' not found. `,t)}warn(...t){this.config.showWarning&&this.config.logger.warn(Fs,...t)}debug(...t){this.config.showDebug&&this.config.logger.log(Fs,...t)}}exports.CanvasManager=vi;exports.EventType=T;exports.IncrementalSource=M;exports.MouseInteractions=B;exports.Replayer=Vi;exports.ReplayerEvents=$;exports.addCustomEvent=Mi;exports.canvasMutation=Pt;exports.deserializeArg=pe;exports.freezePage=Ci;exports.record=os;exports.takeFullSnapshot=Sr;exports.utils=mn;
18
+ ***************************************************************************** */function Rs(e,t){var s=typeof Symbol=="function"&&e[Symbol.iterator];if(!s)return e;var r,n,i=s.call(e),o=[];try{for(;(t===void 0||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(a){n={error:a}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(n)throw n.error}}return o}var Ue;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Ue||(Ue={}));var vr={type:"xstate.init"};function It(e){return e===void 0?[]:[].concat(e)}function _e(e){return{type:"xstate.assign",assignment:e}}function xs(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function St(e){return function(t){return e===t}}function Er(e){return typeof e=="string"?{type:e}:e}function ks(e,t){return{value:e,context:t,actions:[],changed:!1,matches:St(e)}}function Os(e,t,s){var r=t,n=!1;return[e.filter(function(i){if(i.type==="xstate.assign"){n=!0;var o=Object.assign({},r);return typeof i.assignment=="function"?o=i.assignment(r,s):Object.keys(i.assignment).forEach(function(a){o[a]=typeof i.assignment[a]=="function"?i.assignment[a](r,s):i.assignment[a]}),r=o,!1}return!0}),r,n]}function wr(e,t){t===void 0&&(t={});var s=Rs(Os(It(e.states[e.initial].entry).map(function(o){return xs(o,t.actions)}),e.context,vr),2),r=s[0],n=s[1],i={config:e,_options:t,initialState:{value:e.initial,actions:r,context:n,matches:St(e.initial)},transition:function(o,a){var l,c,u=typeof o=="string"?{value:o,context:e.context}:o,d=u.value,h=u.context,p=Er(a),f=e.states[d];if(f.on){var y=It(f.on[p.type]);try{for(var g=function(H){var O=typeof Symbol=="function"&&Symbol.iterator,se=O&&H[O],v=0;if(se)return se.call(H);if(H&&typeof H.length=="number")return{next:function(){return H&&v>=H.length&&(H=void 0),{value:H&&H[v++],done:!H}}};throw new TypeError(O?"Object is not iterable.":"Symbol.iterator is not defined.")}(y),m=g.next();!m.done;m=g.next()){var b=m.value;if(b===void 0)return ks(d,h);var E=typeof b=="string"?{target:b}:b,I=E.target,U=E.actions,R=U===void 0?[]:U,w=E.cond,_=w===void 0?function(){return!0}:w,Q=I===void 0,C=I??d,k=e.states[C];if(_(h,p)){var V=Rs(Os((Q?It(R):[].concat(f.exit,R,k.entry).filter(function(H){return H})).map(function(H){return xs(H,i._options.actions)}),h,p),3),Y=V[0],q=V[1],ne=V[2],J=I??d;return{value:J,context:q,actions:Y,changed:I!==d||Y.length>0||ne,matches:St(J)}}}}catch(H){l={error:H}}finally{try{m&&!m.done&&(c=g.return)&&c.call(g)}finally{if(l)throw l.error}}}return ks(d,h)}};return i}var As=function(e,t){return e.actions.forEach(function(s){var r=s.exec;return r&&r(e.context,t)})};function Mr(e){var t=e.initialState,s=Ue.NotStarted,r=new Set,n={_machine:e,send:function(i){s===Ue.Running&&(t=e.transition(t,i),As(t,Er(i)),r.forEach(function(o){return o(t)}))},subscribe:function(i){return r.add(i),i(t),{unsubscribe:function(){return r.delete(i)}}},start:function(i){if(i){var o=typeof i=="object"?i:{context:e.config.context,value:i};t={value:o.value,actions:[],context:o.context,matches:St(o.value)}}return s=Ue.Running,As(t,vr),n},stop:function(){return s=Ue.Stopped,r.clear(),n},get state(){return t},get status(){return s}};return n}function Ri(e,t){let s=!1;for(let r=e.length-1;r>=0;r--){const n=e[r];if(n.type===T.FullSnapshot&&(s=!0),n.type===T.Meta&&s&&n.timestamp<=t)return e.slice(r)}return e}function xi(e,{getCastFn:t,applyEventsSynchronously:s,emitter:r}){const n=wr({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:_e({lastPlayedEvent:(i,o)=>o.type==="CAST_EVENT"?o.payload.event:i.lastPlayedEvent}),recordTimeOffset:_e((i,o)=>{let a=i.timeOffset;return"payload"in o&&"timeOffset"in o.payload&&(a=o.payload.timeOffset),{...i,timeOffset:a,baselineTime:i.events[0].timestamp+a}}),play(i){const{timer:o,events:a,baselineTime:l,lastPlayedEvent:c}=i;o.clear();for(const f of a)Ds(f,l);const u=Ri(a,l);let d=c?.timestamp;c?.type===T.IncrementalSnapshot&&c.data.source===M.MouseMove&&(d=c.timestamp+c.data.positions[0]?.timeOffset),l<(d||0)&&r.emit($.PlayBack);const h=new Array;let p=!1;for(const f of u){const y=f.type===T.FullSnapshot;if(d&&d<l&&(f.timestamp<=d||f===c)){y&&(p=!0);continue}if(f.timestamp<=l||y&&!p)y&&(p=!0),h.push(f);else{const g=t(f,!1);o.addAction({doAction:()=>{g()},delay:f.delay})}}s(h),r.emit($.Flush),o.start()},pause(i){i.timer.clear()},resetLastPlayedEvent:_e(i=>({...i,lastPlayedEvent:null})),startLive:_e({baselineTime:(i,o)=>(i.timer.start(),o.type==="TO_LIVE"&&o.payload.baselineTime?o.payload.baselineTime:Date.now())}),addEvent:_e((i,o)=>{const{baselineTime:a,timer:l,events:c}=i;if(o.type==="ADD_EVENT"){const{event:u}=o.payload;Ds(u,a);let d=c.length-1;if(!c[d]||c[d].timestamp<=u.timestamp)c.push(u);else{let f=-1,y=0;for(;y<=d;){const g=Math.floor((y+d)/2);c[g].timestamp<=u.timestamp?y=g+1:d=g-1}f===-1&&(f=y),c.splice(f,0,u)}const h=u.timestamp<a,p=t(u,h);h?p():l.isActive()&&l.addAction({doAction:()=>{p()},delay:u.delay})}return{...i,events:c}})}});return Mr(n)}function ki(e){const t=wr({id:"speed",context:e,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:(s,r)=>{"payload"in r&&s.timer.setSpeed(r.payload.speed)},recordSpeed:_e({normalSpeed:s=>s.timer.speed}),restoreSpeed:s=>{s.timer.setSpeed(s.normalSpeed)}}});return Mr(t)}const Oi=e=>[`.${e} { background: currentColor }`,"noscript { display: none !important; }"],_s=new Map;function Cr(e,t){let s=_s.get(e);return s||(s=new Map,_s.set(e,s)),s.has(t)||s.set(t,[]),s.get(t)}function pe(e,t,s){return async r=>{if(r&&typeof r=="object"&&"rr_type"in r)if(s&&(s.isUnchanged=!1),r.rr_type==="ImageBitmap"&&"args"in r){const n=await pe(e,t,s)(r.args);return await createImageBitmap.apply(null,n)}else if("index"in r){if(s||t===null)return r;const{rr_type:n,index:i}=r;return Cr(t,n)[i]}else if("args"in r){const{rr_type:n,args:i}=r,o=window[n];return new o(...await Promise.all(i.map(pe(e,t,s))))}else{if("base64"in r)return fi(r.base64);if("src"in r){const n=e.get(r.src);if(n)return n;{const i=new Image;return i.src=r.src,e.set(r.src,i),i}}else if("data"in r&&r.rr_type==="Blob"){const n=await Promise.all(r.data.map(pe(e,t,s)));return new Blob(n,{type:r.type})}}else if(Array.isArray(r))return await Promise.all(r.map(pe(e,t,s)));return r}}function Ai(e,t){try{return t===me.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch{return null}}const _i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function Li(e,t){if(!t?.constructor)return;const{name:s}=t.constructor;if(!_i.includes(s))return;const r=Cr(e,s);r.includes(t)||r.push(t)}async function Fi({mutation:e,target:t,type:s,imageMap:r,errorHandler:n}){try{const i=Ai(t,s);if(!i)return;if(e.setter){i[e.property]=e.args[0];return}const o=i[e.property],a=await Promise.all(e.args.map(pe(r,i))),l=o.apply(i,a);Li(i,l);const c=!1}catch(i){n(e,i)}}async function Pi({event:e,mutations:t,target:s,imageMap:r,errorHandler:n}){const i=s.getContext("2d");if(!i){n(t[0],new Error("Canvas context is null"));return}const o=t.map(async l=>Promise.all(l.args.map(pe(r,i))));(await Promise.all(o)).forEach((l,c)=>{const u=t[c];try{if(u.setter){i[u.property]=u.args[0];return}const d=i[u.property];u.property==="drawImage"&&typeof u.args[0]=="string"?(r.get(e),d.apply(i,u.args)):d.apply(i,l)}catch(d){n(u,d)}})}async function Pt({event:e,mutation:t,target:s,imageMap:r,canvasEventMap:n,errorHandler:i}){try{const o=n.get(e)||t,a="commands"in o?o.commands:[o];if([me.WebGL,me.WebGL2].includes(t.type)){for(let l=0;l<a.length;l++){const c=a[l];await Fi({mutation:c,type:t.type,target:s,imageMap:r,errorHandler:i})}return}await Pi({event:e,mutations:a,target:s,imageMap:r,errorHandler:i})}catch(o){i(t,o)}}const Ls=5*1e3,Wi=br||Ii,Fs="[replayer]";function Bi(e,t){let s=-1;if(e.length===0)return s;let r=0,n=e.length-1;for(;r<=n;){const i=Math.floor((r+n)/2);e[i].timestamp<=t?(s=i,r=i+1):n=i-1}return s}const Tt={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function Ui(e){if(e.type!==T.IncrementalSnapshot)return!1;const t=e.data;return t.source===M.MouseInteraction&&t.type===B.TouchStart?t.pointerType===de.Touch:!1}function Ps(e){return"pointerId"in e&&typeof e.pointerId=="number"?e.pointerId:-1}class Vi{constructor(t,s){if(this.usingVirtualDom=!1,this.virtualDom=new Ge,this.emitter=Wi(),this.legacy_missingNodeRetryMap={},this.cache=ms(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=Us(),this.styleMirror=new Jt,this.firstFullSnapshot=null,this.newDocumentQueue=[],this.pointers={},this.lastMouseDownEvent=null,this.lastSelectionData=null,this.constructedStyleMutations=[],this.adoptedStyleSheets=[],this.handleResize=a=>{this.iframe.style.display="inherit";for(const l of[...Object.values(this.pointers).flatMap(c=>c.mouseTail),this.iframe])l&&(l.setAttribute("width",String(a.width)),l.setAttribute("height",String(a.height)))},this.applyEventsSynchronously=a=>{for(const l of a){switch(l.type){case T.DomContentLoaded:case T.Load:case T.Custom:continue;case T.FullSnapshot:case T.Meta:case T.Plugin:case T.IncrementalSnapshot:break}this.getCastFn(l,!0)()}},this.getCastFn=(a,l=!1)=>{let c;switch(a.type){case T.DomContentLoaded:case T.Load:break;case T.Custom:c=()=>{this.emitter.emit($.CustomEvent,a)};break;case T.Meta:c=()=>this.emitter.emit($.Resize,{width:a.data.width,height:a.data.height});break;case T.FullSnapshot:c=()=>{if(this.firstFullSnapshot){if(this.firstFullSnapshot===a){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(a,l),this.iframe.contentWindow?.scrollTo(a.data.initialOffset),this.styleMirror.reset()};break;case T.IncrementalSnapshot:c=()=>{if(this.applyIncremental(a,l),!l&&(a===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const d of this.service.state.context.events)if(!(d.timestamp<=a.timestamp)&&this.isUserInteraction(d)){d.delay-a.delay>this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=d);break}if(this.nextUserInteractionEvent){const d=this.nextUserInteractionEvent.delay-a.delay,h={speed:Math.min(Math.round(d/Ls),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:h}),this.emitter.emit($.SkipStart,h)}}};break}return()=>{c&&c();for(const h of this.config.plugins||[])h.handler&&h.handler(a,l,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:a}});const d=this.service.state.context.events.length-1;if(!this.config.liveMode&&a===this.service.state.context.events[d]){const h=()=>{d<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit($.Finish))};let p=50;a.type===T.IncrementalSnapshot&&a.data.source===M.MouseMove&&a.data.positions.length&&(p+=Math.max(0,-a.data.positions[0].timeOffset)),ue(h,p)}this.emitter.emit($.EventCast,a)}},!s?.liveMode&&t.length<2)throw new Error("Replayer need at least 2 events.");const r={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,inactivePeriodThreshold:10*1e3,showWarning:!0,showDebug:!1,blockClass:"rr-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:Tt,useVirtualDom:!0,logger:console};this.config=Object.assign({},r,s),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on($.Resize,this.handleResize),this.setupDom();for(const a of this.config.plugins||[])a.getMirror&&a.getMirror({nodeMirror:this.mirror});this.emitter.on($.Flush,()=>{if(this.usingVirtualDom){const a={mirror:this.mirror,applyCanvas:(c,u,d)=>{Pt({event:c,mutation:u,target:d,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this),applyStyleSheetMutation:(c,u)=>{c.source===M.StyleSheetRule?this.applyStyleSheetRule(c,u):c.source===M.StyleDeclaration&&this.applyStyleDeclaration(c,u)},afterAppend:(c,u)=>{for(const d of this.config.plugins||[])d.onBuild&&d.onBuild(c,{id:u,replayer:this})}},l=ee(this.iframe);if(l)try{pt(l,this.virtualDom,a,this.virtualDom.mirror)}catch(c){console.warn(c)}if(this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const c in this.legacy_missingNodeRetryMap)try{const u=this.legacy_missingNodeRetryMap[c],d=mt(u.node,this.mirror,this.virtualDom.mirror);pt(d,u.node,a,this.virtualDom.mirror),u.node=d}catch(u){this.warn(u)}this.constructedStyleMutations.forEach(c=>{this.applyStyleSheetMutation(c)}),this.constructedStyleMutations=[],this.adoptedStyleSheets.forEach(c=>{this.applyAdoptedStyleSheet(c)}),this.adoptedStyleSheets=[]}for(const[a,{pointerPosition:l,touchActive:c}]of Object.entries(this.pointers)){const u=parseInt(a),d=this.pointers[u];l&&(this.moveAndHover(l.x,l.y,l.id,!0,l.debugData,u),d.pointerPosition=null),c===!0?d.pointerEl.classList.add("touch-active"):c===!1&&d.pointerEl.classList.remove("touch-active"),d.touchActive=null}if(this.lastMouseDownEvent){const[a,l]=this.lastMouseDownEvent;a.dispatchEvent(l)}this.lastMouseDownEvent=null,this.lastSelectionData&&(this.applySelection(this.lastSelectionData),this.lastSelectionData=null)}),this.emitter.on($.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset(),this.styleMirror.reset()});const n=new Di([],{speed:this.config.speed});this.service=xi({events:t.map(a=>s&&s.unpackFn?s.unpackFn(a):a).sort((a,l)=>a.timestamp-l.timestamp),timer:n,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(a=>{this.emitter.emit($.StateChange,{player:a})}),this.speedService=ki({normalSpeed:-1,timer:n}),this.speedService.start(),this.speedService.subscribe(a=>{this.emitter.emit($.StateChange,{speed:a})});const i=this.service.state.context.events.find(a=>a.type===T.Meta),o=this.service.state.context.events.find(a=>a.type===T.FullSnapshot);if(i){const{width:a,height:l}=i.data;ue(()=>{this.emitter.emit($.Resize,{width:a,height:l})},0)}o&&ue(()=>{this.firstFullSnapshot||(this.firstFullSnapshot=o,this.rebuildFullSnapshot(o),this.iframe.contentWindow?.scrollTo(o.data.initialOffset))},1)}get timer(){return this.service.state.context.timer}createPointer(t,s){const r=document.createElement("canvas");r.classList.add("replayer-mouse-tail"),r.width=Number.parseFloat(this.iframe.width),r.height=Number.parseFloat(this.iframe.height),this.wrapper.insertBefore(r,this.iframe),r.style.display=this.config.mouseTail===!1?"none":"inherit";const n=document.createElement("div");n.classList.add("replayer-mouse"),this.pointers[t]={touchActive:null,pointerEl:n,tailPositions:[],pointerPosition:null,mouseTail:r},Ui(s)&&n.classList.add("touch-device"),this.wrapper.appendChild(n)}on(t,s){return this.emitter.on(t,s),this}off(t,s){return this.emitter.off(t,s),this}setConfig(t){const s=this.config.skipInactive;if(Object.keys(t).forEach(r=>{t[r],this.config[r]=t[r]}),this.config.skipInactive?s===!1&&this.config.skipInactive===!0&&this.reevaluateFastForward():this.backToNormal(),typeof t.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:t.speed}}),typeof t.mouseTail<"u")if(t.mouseTail===!1)for(const{mouseTail:r}of Object.values(this.pointers))r&&(r.style.display="none");else for(let{mouseTail:r}of Object.values(this.pointers))r||(r=document.createElement("canvas"),r.width=Number.parseFloat(this.iframe.width),r.height=Number.parseFloat(this.iframe.height),r.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(r,this.iframe)),r.style.display="inherit"}getMetaData(){const t=this.service.state.context.events[0],s=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:t.timestamp,endTime:s.timestamp,totalTime:s.timestamp-t.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:t,events:s}=this.service.state.context;return t-s[0].timestamp}getMirror(){return this.mirror}play(t=0){this.config.skipInactive&&this.speedService.state.matches("skipping")&&this.backToNormal(),this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:t}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:t}})),ee(this.iframe)?.getElementsByTagName("html")[0]?.classList.remove("rrweb-paused"),this.emitter.emit($.Start),this.config.skipInactive&&this.reevaluateFastForward()}pause(t){t===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof t=="number"&&(this.play(t),this.service.send({type:"PAUSE"})),ee(this.iframe)?.getElementsByTagName("html")[0]?.classList.add("rrweb-paused"),this.emitter.emit($.Pause)}resume(t=0){this.warn("The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface."),this.play(t),this.emitter.emit($.Resume)}destroy(){this.pause(),this.config.root.removeChild(this.wrapper),this.emitter.emit($.Destroy)}startLive(t){this.service.send({type:"TO_LIVE",payload:{baselineTime:t}})}addEvent(t){const s=this.config.unpackFn?this.config.unpackFn(t):t;Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:s}}))}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=ms()}reevaluateFastForward(){if(!this.config.skipInactive)return;this.nextUserInteractionEvent=null;const t=this.service.state.context.events,s=t[0];if(!s)return;const r=s.timestamp+this.getCurrentTime(),n=Bi(t,r);if(n===-1)return;const i=t[n],o=this.config.inactivePeriodThreshold*this.speedService.state.context.timer.speed;for(let a=n+1;a<t.length;a++){const l=t[a];if(this.isUserInteraction(l)){const c=l.timestamp-i.timestamp;if(c>o){this.nextUserInteractionEvent=l;const u={speed:Math.min(Math.round(c/Ls),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:u}),this.emitter.emit($.SkipStart,u)}break}}}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.iframe=document.createElement("iframe");const t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe);const s=ee(this.iframe),r=ir(this.iframe);r&&s&&(Ti(r,s),Yt(r))}rebuildFullSnapshot(t,s=!1){const r=ee(this.iframe);if(!r)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=(l,c)=>{this.collectIframeAndAttachDocument(n,l);for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(l,{id:c,replayer:this})};this.usingVirtualDom&&(this.virtualDom.destroyTree(),this.usingVirtualDom=!1),this.mirror.reset(),pn(t.data.node,{doc:r,afterAppend:i,cache:this.cache,mirror:this.mirror}),i(r,t.data.node.id);for(const{mutationInQueue:l,builtNode:c}of n)this.attachDocumentToIframe(l,c),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==l);const{documentElement:o,head:a}=r;if(this.insertStyleRules(o,a),!this.service.state.matches("playing")){const l=r.getElementsByTagName("html")[0];l&&l.classList.add("rrweb-paused")}this.emitter.emit($.FullsnapshotRebuilded,t),s||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(t,s){const r=Oi(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&r.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,lr(n,this.virtualDom.unserializedId)),t.insertBefore(n,s),n.rules.push({source:M.StyleSheetRule,adds:r.map((i,o)=>({rule:i,index:o}))})}else{const n=document.createElement("style");t.insertBefore(n,s);for(let i=0;i<r.length;i++)n.sheet?.insertRule(r[i],i)}}attachDocumentToIframe(t,s){const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,n=ee(s),i=[],o=(a,l)=>{this.collectIframeAndAttachDocument(i,a);const c=r.getMeta(a);if(c?.type===x.Element&&c?.tagName.toUpperCase()==="HTML"&&n){const{documentElement:u,head:d}=n;this.insertStyleRules(u,d)}if(!this.usingVirtualDom)for(const u of this.config.plugins||[])u.onBuild&&u.onBuild(a,{id:l,replayer:this})};Je(t.node,{doc:n,mirror:r,hackCss:!0,skipChild:!1,afterAppend:o,cache:this.cache}),o(n,t.node.id);for(const{mutationInQueue:a,builtNode:l}of i)this.attachDocumentToIframe(a,l),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==a)}collectIframeAndAttachDocument(t,s){if(Ve(s,this.mirror)){const r=this.newDocumentQueue.find(n=>n.parentId===this.mirror.getId(s));r&&t.push({mutationInQueue:r,builtNode:s})}}waitForStylesheetLoad(){const s=ee(this.iframe)?.head;if(s){const r=new Set;let n,i=this.service.state;const o=()=>{i=this.service.state};this.emitter.on($.Start,o),this.emitter.on($.Pause,o);const a=()=>{this.emitter.off($.Start,o),this.emitter.off($.Pause,o)};s.querySelectorAll('link[rel="stylesheet"]').forEach(l=>{l.sheet||(r.add(l),l.addEventListener("load",()=>{r.delete(l),r.size===0&&n!==-1&&(i.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit($.LoadStylesheetEnd),n&&ts(n),a())}))}),r.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit($.LoadStylesheetStart),n=ue(()=>{i.matches("playing")&&this.play(this.getCurrentTime()),n=-1,a()},this.config.loadTimeout))}}async preloadAllImages(){const t=[];for(const s of this.service.state.context.events)s.type===T.IncrementalSnapshot&&s.data.source===M.CanvasMutation&&(t.push(this.deserializeAndPreloadCanvasEvents(s.data,s)),("commands"in s.data?s.data.commands:[s.data]).forEach(n=>{this.preloadImages(n,s)}));return Promise.all(t)}preloadImages(t,s){if(t.property==="drawImage"&&typeof t.args[0]=="string"&&!this.imageMap.has(s)){const r=document.createElement("canvas"),n=r.getContext("2d"),i=n?.createImageData(r.width,r.height);n?.putImageData(i,0,0)}}async deserializeAndPreloadCanvasEvents(t,s){if(!this.canvasEventMap.has(s)){const r={isUnchanged:!0};if("commands"in t){const n=await Promise.all(t.commands.map(async i=>{const o=await Promise.all(i.args.map(pe(this.imageMap,null,r)));return{...i,args:o}}));r.isUnchanged===!1&&this.canvasEventMap.set(s,{...t,commands:n})}else{const n=await Promise.all(t.args.map(pe(this.imageMap,null,r)));r.isUnchanged===!1&&this.canvasEventMap.set(s,{...t,args:n})}}}applyIncremental(t,s){const{data:r}=t;switch(r.source){case M.Mutation:{try{this.applyMutation(r,s)}catch(n){this.warn(`Exception in mutation ${n.message||n}`,r)}break}case M.Drag:case M.TouchMove:case M.MouseMove:{const n=Ps(r);this.pointers[n]||this.createPointer(n,t);const i=this.pointers[n];if(s){const o=r.positions[r.positions.length-1];i.pointerPosition={x:o.x,y:o.y,id:o.id,debugData:r}}else r.positions.forEach(o=>{const a={doAction:()=>{this.moveAndHover(o.x,o.y,o.id,s,r,n)},delay:o.timeOffset+t.timestamp-this.service.state.context.baselineTime};this.timer.addAction(a)}),this.timer.addAction({doAction(){},delay:t.delay-r.positions[0]?.timeOffset});break}case M.MouseInteraction:{const n=Ps(r);this.pointers[n]||this.createPointer(n,t);const i=this.pointers[n];if(r.id===-1)break;const o=new Event(De(B[r.type])),a=this.mirror.getNode(r.id);if(!a)return this.debugNodeNotFound(r,r.id);this.emitter.emit($.MouseInteraction,{type:r.type,target:a});const{triggerFocus:l}=this.config;switch(r.type){case B.Blur:"blur"in a&&a.blur();break;case B.Focus:l&&a.focus&&a.focus({preventScroll:!0});break;case B.Click:case B.TouchStart:case B.TouchEnd:case B.MouseDown:case B.MouseUp:s?(r.type===B.TouchStart?(i.touchActive=!0,Object.values(this.pointers).forEach(c=>{c!==i&&!c.touchActive&&(c.touchActive=!1)})):r.type===B.TouchEnd&&(i.touchActive=!1,i.pointerEl.remove(),i.mouseTail&&i.mouseTail.remove(),delete this.pointers[n]),r.type===B.MouseDown?this.lastMouseDownEvent=[a,o]:r.type===B.MouseUp&&(this.lastMouseDownEvent=null),i.pointerPosition={x:r.x||0,y:r.y||0,id:r.id,debugData:r}):(r.type===B.TouchStart&&(i.tailPositions.length=0),this.moveAndHover(r.x||0,r.y||0,r.id,s,r,n),r.type===B.Click?(i.pointerEl.classList.remove("active"),i.pointerEl.offsetWidth,i.pointerEl.classList.add("active")):r.type===B.TouchStart?(i.pointerEl.offsetWidth,i.pointerEl.classList.add("touch-active")):r.type===B.TouchEnd?(i.pointerEl.remove(),i.mouseTail&&i.mouseTail.remove(),delete this.pointers[n]):a.dispatchEvent(o));break;case B.TouchCancel:s?i.touchActive=!1:i.pointerEl.classList.remove("touch-active");break;default:a.dispatchEvent(o)}break}case M.Scroll:{if(r.id===-1)break;if(this.usingVirtualDom){const n=this.virtualDom.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);n.scrollData=r;break}this.applyScroll(r,s);break}case M.ViewportResize:this.emitter.emit($.Resize,{width:r.width,height:r.height});break;case M.Input:{if(r.id===-1)break;if(this.usingVirtualDom){const n=this.virtualDom.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);n.inputData=r;break}this.applyInput(r);break}case M.MediaInteraction:{const n=this.usingVirtualDom?this.virtualDom.mirror.getNode(r.id):this.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);const i=n;try{if(r.currentTime!==void 0&&(i.currentTime=r.currentTime),r.volume!==void 0&&(i.volume=r.volume),r.muted!==void 0&&(i.muted=r.muted),r.type===fe.Pause&&i.pause(),r.type===fe.Play){const o=i.play();typeof o?.catch=="function"&&o.catch(a=>{console.warn(a)})}r.type===fe.RateChange&&(i.playbackRate=r.playbackRate)}catch(o){this.warn(`Failed to replay media interactions: ${o.message||o}`)}break}case M.StyleSheetRule:case M.StyleDeclaration:{this.usingVirtualDom?r.styleId?this.constructedStyleMutations.push(r):r.id&&this.virtualDom.mirror.getNode(r.id)?.rules?.push(r):this.applyStyleSheetMutation(r);break}case M.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const n=this.virtualDom.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);n.canvasMutations.push({event:t,mutation:r})}else{const n=this.mirror.getNode(r.id);if(!n)return this.debugNodeNotFound(r,r.id);Pt({event:t,mutation:r,target:n,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case M.Font:{try{const n=new FontFace(r.family,r.buffer?new Uint8Array(JSON.parse(r.fontSource)):r.fontSource,r.descriptors);ee(this.iframe)?.fonts.add(n)}catch(n){this.warn(n)}break}case M.Selection:{if(s){this.lastSelectionData=r;break}this.applySelection(r);break}case M.AdoptedStyleSheet:{this.usingVirtualDom?this.adoptedStyleSheets.push(r):this.applyAdoptedStyleSheet(r);break}}}applyMutation(t,s){if(this.config.useVirtualDom&&!this.usingVirtualDom&&s){this.usingVirtualDom=!0;const c=ee(this.iframe);if(c&&zn(c,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length)for(const u in this.legacy_missingNodeRetryMap)try{const d=this.legacy_missingNodeRetryMap[u],h=ar(d.node,this.virtualDom,this.mirror);h&&(d.node=h)}catch(d){this.warn(d)}}const r=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;t.removes=t.removes.filter(c=>r.getNode(c.id)?!0:(this.warnNodeNotFound(t,c.id),!1)),t.removes.forEach(c=>{const u=r.getNode(c.id);if(!u)return;let d=r.getNode(c.parentId);if(!d)return this.warnNodeNotFound(t,c.parentId);if(c.isShadow&&be(d)&&(d=d.shadowRoot),r.removeNodeFromMap(u),d)try{d.removeChild(u),this.usingVirtualDom&&u.nodeName==="#text"&&d.nodeName==="STYLE"&&d.rules?.length>0&&(d.rules=[])}catch(h){if(h instanceof DOMException)this.warn("parent could not remove child in mutation",d,u,t);else throw h}});const n={...this.legacy_missingNodeRetryMap},i=[],o=c=>{let u=null;return c.nextId&&(u=r.getNode(c.nextId)),c.nextId!==null&&c.nextId!==void 0&&c.nextId!==-1&&!u},a=c=>{const u=ee(this.iframe);if(!u)return this.warn("Looks like your replayer has been destroyed.");let d=r.getNode(c.parentId);if(!d)return c.node.type===x.Document?this.newDocumentQueue.push(c):i.push(c);c.node.isShadow&&(be(d)||d.attachShadow({mode:"open"}),d=d.shadowRoot);let h=null,p=null;if(c.previousId&&(h=r.getNode(c.previousId)),c.nextId&&(p=r.getNode(c.nextId)),o(c))return i.push(c);if(c.node.rootId&&!r.getNode(c.node.rootId))return;const f=c.node.rootId?r.getNode(c.node.rootId):this.usingVirtualDom?this.virtualDom:u;if(Ve(d,r)){this.attachDocumentToIframe(c,d);return}const y=(b,E)=>{if(!this.usingVirtualDom)for(const I of this.config.plugins||[])I.onBuild&&I.onBuild(b,{id:E,replayer:this})},g=Je(c.node,{doc:f,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache,afterAppend:y});if(c.previousId===-1||c.nextId===-1){n[c.node.id]={node:g,mutation:c};return}const m=r.getMeta(d);if(m&&m.type===x.Element&&m.tagName==="textarea"&&c.node.type===x.Text){const b=Array.isArray(d.childNodes)?d.childNodes:Array.from(d.childNodes);for(const E of b)E.nodeType===d.TEXT_NODE&&d.removeChild(E)}else if(m?.type===x.Document){const b=d;c.node.type===x.DocumentType&&b.childNodes[0]?.nodeType===Node.DOCUMENT_TYPE_NODE&&b.removeChild(b.childNodes[0]),g.nodeName==="HTML"&&b.documentElement&&b.removeChild(b.documentElement)}if(h&&h.nextSibling&&h.nextSibling.parentNode?d.insertBefore(g,h.nextSibling):p&&p.parentNode?d.contains(p)?d.insertBefore(g,p):d.insertBefore(g,null):d.appendChild(g),y(g,c.node.id),this.usingVirtualDom&&g.nodeName==="#text"&&d.nodeName==="STYLE"&&d.rules?.length>0&&(d.rules=[]),Ve(g,this.mirror)){const b=this.mirror.getId(g),E=this.newDocumentQueue.find(I=>I.parentId===b);E&&(this.attachDocumentToIframe(E,g),this.newDocumentQueue=this.newDocumentQueue.filter(I=>I!==E))}(c.previousId||c.nextId)&&this.legacy_resolveMissingNode(n,d,g,c)};t.adds.forEach(c=>{a(c)});const l=Date.now();for(;i.length;){const c=qs(i);if(i.length=0,Date.now()-l>500){this.warn("Timeout in the loop, please check the resolve tree data:",c);break}for(const u of c)r.getNode(u.value.parentId)?Xt(u,h=>{a(h)}):this.debug("Drop resolve tree since there is no parent for the root node.",u)}Object.keys(n).length&&Object.assign(this.legacy_missingNodeRetryMap,n),Qs(t.texts).forEach(c=>{const u=r.getNode(c.id);if(!u)return t.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(t,c.id);if(u.textContent=c.value,this.usingVirtualDom){const d=u.parentNode;d?.rules?.length>0&&(d.rules=[])}}),t.attributes.forEach(c=>{const u=r.getNode(c.id);if(!u)return t.removes.find(d=>d.id===c.id)?void 0:this.warnNodeNotFound(t,c.id);for(const d in c.attributes)if(typeof d=="string"){const h=c.attributes[d];if(h===null)u.removeAttribute(d);else if(typeof h=="string")try{if(d==="_cssText"&&(u.nodeName==="LINK"||u.nodeName==="STYLE"))try{const p=r.getMeta(u),f=Je({...p,attributes:{...p.attributes,...c.attributes}},{doc:u.ownerDocument,mirror:r,skipChild:!0,hackCss:!0,cache:this.cache}),y=u.nextSibling,g=u.parentNode;if(f&&g){g.removeChild(u),g.insertBefore(f,y),r.replace(c.id,f);break}}catch{}u.nodeType!==3&&u.setAttribute(d,h)}catch(p){this.warn("An error occurred may due to the checkout feature.",p)}else if(d==="style"){const p=h,f=u;for(const y in p)if(p[y]===!1)f.style.removeProperty(y);else if(p[y]instanceof Array){const g=p[y];f.style.setProperty(y,g[0],g[1])}else{const g=p[y];f.style.setProperty(y,g)}}}})}applyScroll(t,s){const r=this.mirror.getNode(t.id);if(!r)return this.debugNodeNotFound(t,t.id);const n=this.mirror.getMeta(r),i=ee(this.iframe);if(r===i)this.iframe.contentWindow?.scrollTo({top:t.y,left:t.x,behavior:s?"auto":"smooth"});else if(n?.type===x.Document)r.defaultView?.scrollTo({top:t.y,left:t.x,behavior:s?"auto":"smooth"});else try{r.scrollTo({top:t.y,left:t.x,behavior:s?"auto":"smooth"})}catch{}}applyInput(t){const s=this.mirror.getNode(t.id);if(!s)return this.debugNodeNotFound(t,t.id);try{s.checked=t.isChecked,s.value=t.text}catch{}}applySelection(t){try{const s=new Set,r=t.ranges.map(({start:n,startOffset:i,end:o,endOffset:a})=>{const l=this.mirror.getNode(n),c=this.mirror.getNode(o);if(!l||!c)return;const u=new Range;u.setStart(l,i),u.setEnd(c,a);const h=l.ownerDocument?.getSelection();return h&&s.add(h),{range:u,selection:h}});s.forEach(n=>n.removeAllRanges()),r.forEach(n=>n&&n.selection?.addRange(n.range))}catch{}}applyStyleSheetMutation(t){let s=null;t.styleId?s=this.styleMirror.getStyle(t.styleId):t.id&&(s=this.mirror.getNode(t.id)?.sheet||null),s&&(t.source===M.StyleSheetRule?this.applyStyleSheetRule(t,s):t.source===M.StyleDeclaration&&this.applyStyleDeclaration(t,s))}applyStyleSheetRule(t,s){if(t.adds?.forEach(({rule:r,index:n})=>{try{if(Array.isArray(n)){const{positions:i,index:o}=Ot(n);We(s.cssRules,i).insertRule(r,o)}else{const i=n===void 0?void 0:Math.min(n,s.cssRules.length);s?.insertRule(r,i)}}catch{}}),t.removes?.forEach(({index:r})=>{try{if(Array.isArray(r)){const{positions:n,index:i}=Ot(r);We(s.cssRules,n).deleteRule(i||0)}else s?.deleteRule(r)}catch{}}),t.replace)try{s.replace?.(t.replace)}catch{}if(t.replaceSync)try{s.replaceSync?.(t.replaceSync)}catch{}}applyStyleDeclaration(t,s){if(t.set){const r=We(s.rules,t.index);r&&r.style&&r.style.setProperty(t.set.property,t.set.value,t.set.priority)}if(t.remove){const r=We(s.rules,t.index);r&&r.style&&r.style.removeProperty(t.remove.property)}}applyAdoptedStyleSheet(t){const s=this.mirror.getNode(t.id);if(!s)return;t.styles?.forEach(o=>{let a=null,l=null;if(be(s)?l=s.ownerDocument?.defaultView||null:s.nodeName==="#document"&&(l=s.defaultView),!!l)try{a=new l.CSSStyleSheet,this.styleMirror.add(a,o.styleId),this.applyStyleSheetRule({source:M.StyleSheetRule,adds:o.rules},a)}catch{}});const r=10;let n=0;const i=(o,a)=>{const l=a.map(c=>this.styleMirror.getStyle(c)).filter(c=>c!==null);be(o)?o.shadowRoot.adoptedStyleSheets=l:o.nodeName==="#document"&&(o.adoptedStyleSheets=l),l.length!==a.length&&n<r&&(ue(()=>i(o,a),0+100*n),n++)};i(s,t.styleIds)}legacy_resolveMissingNode(t,s,r,n){const{previousId:i,nextId:o}=n,a=i&&t[i],l=o&&t[o];if(a){const{node:c,mutation:u}=a;s.insertBefore(c,r),delete t[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(t,s,c,u)}if(l){const{node:c,mutation:u}=l;s.insertBefore(c,r.nextSibling),delete t[u.node.id],delete this.legacy_missingNodeRetryMap[u.node.id],(u.previousId||u.nextId)&&this.legacy_resolveMissingNode(t,s,c,u)}}moveAndHover(t,s,r,n,i,o){const a=this.mirror.getNode(r);if(!a)return this.debugNodeNotFound(i,r);const l=Qt(a,this.iframe),c=t*l.absoluteScale+l.x,u=s*l.absoluteScale+l.y,d=this.pointers[o];d&&d.pointerEl&&(d.pointerEl.style.left=`${c}px`,d.pointerEl.style.top=`${u}px`),n||this.drawMouseTail({x:c,y:u},o),this.hoverElements(a)}drawMouseTail(t,s){const r=this.pointers[s];if(!r||!r.mouseTail)return;const{lineCap:n,lineWidth:i,strokeStyle:o,duration:a}=this.config.mouseTail===!0?Tt:Object.assign({},Tt,this.config.mouseTail),l=typeof performance<"u"?performance.now():Date.now(),c=a/this.speedService.state.context.timer.speed;r.tailPositions.push({x:t.x,y:t.y,t:l}),r.tailPositions=r.tailPositions.filter(h=>l-h.t<=c);const u=r.mouseTail,d=u.getContext("2d");if(d&&(d.clearRect(0,0,u.width,u.height),r.tailPositions.length>1)){d.lineWidth=i,d.lineCap=n,d.strokeStyle=o;for(let h=1;h<r.tailPositions.length;h++){const p=r.tailPositions[h-1],f=r.tailPositions[h],y=(l-f.t)/c,g=Math.max(0,1-y);g<=0||(d.globalAlpha=g,d.beginPath(),d.moveTo(p.x,p.y),d.lineTo(f.x,f.y),d.stroke())}d.globalAlpha=1}}hoverElements(t){const s=ee(this.iframe),r=this.lastHoveredRootNode||s;r&&typeof r.querySelectorAll=="function"&&r.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover")}),this.lastHoveredRootNode=t.getRootNode();let n=t;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(t){return t.type!==T.IncrementalSnapshot?!1:t.data.source>M.Mutation&&t.data.source<=M.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit($.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(t,s){this.warn(`Node with id '${s}' not found. `,t)}warnCanvasMutationFailed(t,s){this.warn("Has error on canvas update",s,"canvas mutation:",t)}debugNodeNotFound(t,s){this.debug(`Node with id '${s}' not found. `,t)}warn(...t){this.config.showWarning&&this.config.logger.warn(Fs,...t)}debug(...t){this.config.showDebug&&this.config.logger.log(Fs,...t)}}exports.CanvasManager=vi;exports.EventType=T;exports.IncrementalSource=M;exports.MouseInteractions=B;exports.Replayer=Vi;exports.ReplayerEvents=$;exports.addCustomEvent=Mi;exports.canvasMutation=Pt;exports.deserializeArg=pe;exports.freezePage=Ci;exports.record=os;exports.takeFullSnapshot=Sr;exports.utils=mn;
19
19
  ;if (typeof module.exports == "object" && typeof exports == "object") {
20
20
  var __cp = (to, from, except, desc) => {
21
21
  if ((from && typeof from === "object") || typeof from === "function") {