@sentry-internal/rrweb
Version:
record and replay the web
5 lines • 152 kB
JavaScript
(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 };
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Nr=Object.defineProperty,Ir=(e,t,s)=>t in e?Nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t,s)=>Ir(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 Ps(e){return e.nodeType===e.ELEMENT_NODE}function Ye(e){return e?.host?.shadowRoot===e}function Xe(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Tr(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 Dr(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 ct(e){try{const t=e.rules||e.cssRules;return t?Tr(Array.from(t,Fs).join("")):null}catch{return null}}function Rr(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 Fs(e){let t;if(kr(e))try{t=ct(e.styleSheet)||Dr(e)}catch{}else if(Or(e)){let s=e.cssText;const r=e.selectorText.includes(":"),n=typeof e.style.all=="string"&&e.style.all;if(n&&(s=Rr(e)),r&&(s=xr(s)),r||n)return s}return t||e.cssText}function xr(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function kr(e){return"styleSheet"in e}function Or(e){return"selectorText"in e}class Wt{constructor(){Me(this,"idNodeMap",new Map),Me(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 Ws(){return new Wt}function St({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 Je({isMasked:e,element:t,value:s,maskInputFn:r}){let n=s||"";return e?(r&&(n=r(n,t)),"*".repeat(n.length)):n}function Te(e){return e.toLowerCase()}function Dt(e){return e.toUpperCase()}const as="__rrweb_original__";function Ar(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=as in i?i[as]: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 _r(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 Ut(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Te(t):null}function ut(e,t,s){return t==="INPUT"&&(s==="radio"||s==="checkbox")?e.getAttribute("value")||"":e.value}function Bt(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 ls={};function Us(e){const t=ls[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 ls[e]=r.bind(window)}function Rt(...e){return Us("setTimeout")(...e)}function Bs(...e){return Us("clearTimeout")(...e)}function Vs(e){try{return e.contentDocument}catch{}}let Lr=1;const Pr=new RegExp("[^a-z0-9-_:]"),Ze=-2;function Vt(){return Lr++}function Fr(e){if(e instanceof HTMLFormElement)return"form";const t=Te(e.tagName);return Pr.test(t)?"div":t}function Wr(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}let Re,cs;const Ur=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Br=/^(?:[a-z+]+:)?\/\//i,Vr=/^www\..*/i,Hr=/^(data:)([^,]*),(.*)/i;function dt(e,t){return(e||"").replace(Ur,(s,r,n,i,o,c)=>{const l=n||o||c,a=r||i||"";if(!l)return s;if(Br.test(l)||Vr.test(l))return`url(${a}${l}${a})`;if(Hr.test(l))return`url(${a}${l}${a})`;if(l[0]==="/")return`url(${a}${Wr(t)+l}${a})`;const u=t.split("/"),d=l.split("/");u.pop();for(const h of d)h!=="."&&(h===".."?u.pop():u.push(h));return`url(${a}${u.join("/")}${a})`})}const zr=/^[^ \t\n\r\u000c]+/,Gr=/^[, \t\n\r\u000c]+/;function $r(e,t){if(t.trim()==="")return t;let s=0;function r(i){let o;const c=i.exec(t.substring(s));return c?(o=c[0],s+=o.length,o):""}const n=[];for(;r(Gr),!(s>=t.length);){let i=r(zr);if(i.slice(-1)===",")i=Ae(e,i.substring(0,i.length-1)),n.push(i);else{let o="";i=Ae(e,i);let c=!1;for(;;){const l=t.charAt(s);if(l===""){n.push((i+o).trim());break}else if(c)l===")"&&(c=!1);else if(l===","){s+=1,n.push((i+o).trim());break}else l==="("&&(c=!0);o+=l,s+=1}}}return n.join(", ")}const us=new WeakMap;function Ae(e,t){return!t||t.trim()===""?t:bt(e,t)}function jr(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function bt(e,t){let s=us.get(e);if(s||(s=e.createElement("a"),us.set(e,s)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return s.setAttribute("href",t),s.href}function Hs(e,t,s,r,n,i){return r&&(s==="src"||s==="href"&&!(t==="use"&&r[0]==="#")||s==="xlink:href"&&r[0]!=="#"||s==="background"&&(t==="table"||t==="td"||t==="th")?Ae(e,r):s==="srcset"?$r(e,r):s==="style"?dt(r,bt(e)):t==="object"&&s==="data"?Ae(e,r):typeof i=="function"?i(s,r,n):r)}function zs(e,t,s){return(e==="video"||e==="audio")&&t==="autoplay"}function Gs(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 Yr(e,t){for(let s=e.classList.length;s--;){const r=e.classList[s];if(t.test(r))return!0}return!1}function Ce(e,t,s=1/0,r=0){return!e||e.nodeType!==e.ELEMENT_NODE||r>s?-1:t(e)?r:Ce(e.parentNode,t,s,r+1)}function _e(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(Yr(r,e))return!0}return!!(t&&r.matches(t))}catch{return!1}}}function Be(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 a=o.getAttribute("autocomplete");if(["current-password","new-password","cc-number","cc-exp","cc-exp-month","cc-exp-year","cc-csc"].includes(a))return!0}let c=-1,l=-1;if(i){if(l=Ce(o,_e(r,n)),l<0)return!0;c=Ce(o,_e(t,s),l>=0?l:1/0)}else{if(c=Ce(o,_e(t,s)),c<0)return!1;l=Ce(o,_e(r,n),c>=0?c:1/0)}return c>=0?l>=0?c<=l:!0:l>=0?!1:!!i}catch{}return!!i}function Xr(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 c=Rt(()=>{n||(t(),n=!0)},s);e.addEventListener("load",()=>{Bs(c),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 qr(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",()=>{Bs(i),r=!0,t()})}function Qr(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskAttributeFn:l,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:h,inlineStylesheet:m,maskInputOptions:f={},maskTextFn:b,maskInputFn:g,dataURLOptions:p={},inlineImages:S,recordCanvas:v,keepIframeSrcFn:N,newlyAddedElement:D=!1}=t,I=Jr(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:I};case e.ELEMENT_NODE:return Kr(e,{doc:s,blockClass:n,blockSelector:i,unblockSelector:o,inlineStylesheet:m,maskAttributeFn:l,maskInputOptions:f,maskInputFn:g,dataURLOptions:p,inlineImages:S,recordCanvas:v,keepIframeSrcFn:N,newlyAddedElement:D,rootId:I,maskAllText:c,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:h});case e.TEXT_NODE:return Zr(e,{doc:s,maskAllText:c,maskTextClass:a,unmaskTextClass:u,maskTextSelector:d,unmaskTextSelector:h,maskTextFn:b,maskInputOptions:f,maskInputFn:g,rootId:I});case e.CDATA_SECTION_NODE:return{type:x.CDATA,textContent:"",rootId:I};case e.COMMENT_NODE:return{type:x.Comment,textContent:e.textContent||"",rootId:I};default:return!1}}function Jr(e,t){if(!t.hasNode(e))return;const s=t.getId(e);return s===1?void 0:s}function Zr(e,t){const{maskAllText:s,maskTextClass:r,unmaskTextClass:n,maskTextSelector:i,unmaskTextSelector:o,maskTextFn:c,maskInputOptions:l,maskInputFn:a,rootId:u}=t,d=e.parentNode&&e.parentNode.tagName;let h=e.textContent;const m=d==="STYLE"?!0:void 0,f=d==="SCRIPT"?!0:void 0,b=d==="TEXTAREA"?!0:void 0;if(m&&h){try{e.nextSibling||e.previousSibling||e.parentNode.sheet?.cssRules&&(h=ct(e.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,e)}h=dt(h,bt(t.doc))}f&&(h="SCRIPT_PLACEHOLDER");const g=Be(e,r,i,n,o,s);if(!m&&!f&&!b&&h&&g&&(h=c?c(h,e.parentElement):h.replace(/[\S]/g,"*")),b&&h&&(l.textarea||g)&&(h=a?a(h,e.parentNode):h.replace(/[\S]/g,"*")),d==="OPTION"&&h){const p=St({type:null,tagName:d,maskInputOptions:l});h=Je({isMasked:Be(e,r,i,n,o,p),element:e,value:h,maskInputFn:a})}return{type:x.Text,textContent:h||"",isStyle:m,rootId:u}}function Kr(e,t){const{doc:s,blockClass:r,blockSelector:n,unblockSelector:i,inlineStylesheet:o,maskInputOptions:c={},maskAttributeFn:l,maskInputFn:a,dataURLOptions:u={},inlineImages:d,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:f=!1,rootId:b,maskTextClass:g,unmaskTextClass:p,maskTextSelector:S,unmaskTextSelector:v}=t,N=Gs(e,r,n,i),D=Fr(e);let I={};const O=e.attributes.length;for(let C=0;C<O;C++){const R=e.attributes[C];R.name&&!zs(D,R.name,R.value)&&(I[R.name]=Hs(s,D,Te(R.name),R.value,e,l))}if(D==="link"&&o){const C=Array.from(s.styleSheets).find(G=>G.href===e.href);let R=null;C&&(R=ct(C)),R&&(I.rel=null,I.href=null,I.crossorigin=null,I._cssText=dt(R,C.href))}if(D==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const C=ct(e.sheet);C&&(I._cssText=dt(C,bt(s)))}if(D==="input"||D==="textarea"||D==="select"||D==="option"){const C=e,R=Ut(C),G=ut(C,Dt(D),R),$=C.checked;if(R!=="submit"&&R!=="button"&&G){const q=Be(C,g,S,p,v,St({type:R,tagName:Dt(D),maskInputOptions:c}));I.value=Je({isMasked:q,element:C,value:G,maskInputFn:a})}$&&(I.checked=$)}if(D==="option"&&(e.selected&&!c.select?I.selected=!0:delete I.selected),D==="canvas"&&h){if(e.__context==="2d")Ar(e)||(I.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const C=e.toDataURL(u.type,u.quality),R=s.createElement("canvas");R.width=e.width,R.height=e.height;const G=R.toDataURL(u.type,u.quality);C!==G&&(I.rr_dataURL=C)}}if(D==="img"&&d){Re||(Re=s.createElement("canvas"),cs=Re.getContext("2d"));const C=e,R=C.currentSrc||C.getAttribute("src")||"<unknown-src>",G=C.crossOrigin,$=()=>{C.removeEventListener("load",$);try{Re.width=C.naturalWidth,Re.height=C.naturalHeight,cs.drawImage(C,0,0),I.rr_dataURL=Re.toDataURL(u.type,u.quality)}catch(q){if(C.crossOrigin!=="anonymous"){C.crossOrigin="anonymous",C.complete&&C.naturalWidth!==0?$():C.addEventListener("load",$);return}else console.warn(`Cannot inline img src=${R}! Error: ${q}`)}C.crossOrigin==="anonymous"&&(G?I.crossOrigin=G:C.removeAttribute("crossorigin"))};C.complete&&C.naturalWidth!==0?$():C.addEventListener("load",$)}if((D==="audio"||D==="video")&&(I.rr_mediaState=e.paused?"paused":"played",I.rr_mediaCurrentTime=e.currentTime),f||(e.scrollLeft&&(I.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(I.rr_scrollTop=e.scrollTop)),N){const{width:C,height:R}=e.getBoundingClientRect();I={class:I.class,rr_width:`${C}px`,rr_height:`${R}px`}}D==="iframe"&&!m(I.src)&&(!N&&!Vs(e)&&(I.rr_src=I.src),delete I.src);let A;try{customElements.get(D)&&(A=!0)}catch{}return{type:x.Element,tagName:D,attributes:I,childNodes:[],isSVG:jr(e)||void 0,needBlock:N,rootId:b,isCustom:A}}function Y(e){return e==null?"":e.toLowerCase()}function en(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"&&Bt(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(Y(e.attributes.name).match(/^msapplication-tile(image|color)$/)||Y(e.attributes.name)==="application-name"||Y(e.attributes.rel)==="icon"||Y(e.attributes.rel)==="apple-touch-icon"||Y(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&Y(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Y(e.attributes.property).match(/^(og|twitter|fb):/)||Y(e.attributes.name).match(/^(og|twitter):/)||Y(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(Y(e.attributes.name)==="robots"||Y(e.attributes.name)==="googlebot"||Y(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(Y(e.attributes.name)==="author"||Y(e.attributes.name)==="generator"||Y(e.attributes.name)==="framework"||Y(e.attributes.name)==="publisher"||Y(e.attributes.name)==="progid"||Y(e.attributes.property).match(/^article:/)||Y(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(Y(e.attributes.name)==="google-site-verification"||Y(e.attributes.name)==="yandex-verification"||Y(e.attributes.name)==="csrf-token"||Y(e.attributes.name)==="p:domain_verify"||Y(e.attributes.name)==="verify-v1"||Y(e.attributes.name)==="verification"||Y(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Le(e,t){const{doc:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:l,unmaskTextClass:a,maskTextSelector:u,unmaskTextSelector:d,skipChild:h=!1,inlineStylesheet:m=!0,maskInputOptions:f={},maskAttributeFn:b,maskTextFn:g,maskInputFn:p,slimDOMOptions:S,dataURLOptions:v={},inlineImages:N=!1,recordCanvas:D=!1,onSerialize:I,onIframeLoad:O,iframeLoadTimeout:A=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:R=5e3,keepIframeSrcFn:G=()=>!1,newlyAddedElement:$=!1}=t;let{preserveWhiteSpace:q=!0}=t;const J=Qr(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,maskAllText:c,unblockSelector:o,maskTextClass:l,unmaskTextClass:a,maskTextSelector:u,unmaskTextSelector:d,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:g,maskInputFn:p,dataURLOptions:v,inlineImages:N,recordCanvas:D,keepIframeSrcFn:G,newlyAddedElement:$});if(!J)return console.warn(e,"not serialized"),null;let re;r.hasNode(e)?re=r.getId(e):en(J,S)||!q&&J.type===x.Text&&!J.isStyle&&!J.textContent.replace(/^\s+|\s+$/gm,"").length?re=Ze:re=Vt();const P=Object.assign(J,{id:re});if(r.add(e,P),re===Ze)return null;I&&I(e);let B=!h;if(P.type===x.Element){B=B&&!P.needBlock,delete P.needBlock;const j=e.shadowRoot;j&&Xe(j)&&(P.isShadowHost=!0)}if((P.type===x.Document||P.type===x.Element)&&B){S.headWhitespace&&P.type===x.Element&&P.tagName==="head"&&(q=!1);const j={doc:s,mirror:r,blockClass:n,blockSelector:i,maskAllText:c,unblockSelector:o,maskTextClass:l,unmaskTextClass:a,maskTextSelector:u,unmaskTextSelector:d,skipChild:h,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:g,maskInputFn:p,slimDOMOptions:S,dataURLOptions:v,inlineImages:N,recordCanvas:D,preserveWhiteSpace:q,onSerialize:I,onIframeLoad:O,iframeLoadTimeout:A,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:G};for(const ee of Array.from(e.childNodes)){const w=Le(ee,j);w&&P.childNodes.push(w)}if(Ps(e)&&e.shadowRoot)for(const ee of Array.from(e.shadowRoot.childNodes)){const w=Le(ee,j);w&&(Xe(e.shadowRoot)&&(w.isShadow=!0),P.childNodes.push(w))}}return e.parentNode&&Ye(e.parentNode)&&Xe(e.parentNode)&&(P.isShadow=!0),P.type===x.Element&&P.tagName==="iframe"&&!Gs(e,n,i,o)&&Xr(e,()=>{const j=Vs(e);if(j&&O){const ee=Le(j,{doc:j,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:l,unmaskTextClass:a,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:g,maskInputFn:p,slimDOMOptions:S,dataURLOptions:v,inlineImages:N,recordCanvas:D,preserveWhiteSpace:q,onSerialize:I,onIframeLoad:O,iframeLoadTimeout:A,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:G});ee&&O(e,ee)}},A),P.type===x.Element&&P.tagName==="link"&&typeof P.attributes.rel=="string"&&(P.attributes.rel==="stylesheet"||P.attributes.rel==="preload"&&typeof P.attributes.href=="string"&&Bt(P.attributes.href)==="css")&&qr(e,()=>{if(C){const j=Le(e,{doc:s,mirror:r,blockClass:n,blockSelector:i,unblockSelector:o,maskAllText:c,maskTextClass:l,unmaskTextClass:a,maskTextSelector:u,unmaskTextSelector:d,skipChild:!1,inlineStylesheet:m,maskInputOptions:f,maskAttributeFn:b,maskTextFn:g,maskInputFn:p,slimDOMOptions:S,dataURLOptions:v,inlineImages:N,recordCanvas:D,preserveWhiteSpace:q,onSerialize:I,onIframeLoad:O,iframeLoadTimeout:A,onStylesheetLoad:C,stylesheetLoadTimeout:R,keepIframeSrcFn:G});j&&C(e,j)}},R),P}function tn(e,t){const{mirror:s=new Wt,blockClass:r="rr-block",blockSelector:n=null,unblockSelector:i=null,maskAllText:o=!1,maskTextClass:c="rr-mask",unmaskTextClass:l=null,maskTextSelector:a=null,unmaskTextSelector:u=null,inlineStylesheet:d=!0,inlineImages:h=!1,recordCanvas:m=!1,maskAllInputs:f=!1,maskAttributeFn:b,maskTextFn:g,maskInputFn:p,slimDOM:S=!1,dataURLOptions:v,preserveWhiteSpace:N,onSerialize:D,onIframeLoad:I,iframeLoadTimeout:O,onStylesheetLoad:A,stylesheetLoadTimeout:C,keepIframeSrcFn:R=()=>!1}=t||{};return Le(e,{doc:e,mirror:s,blockClass:r,blockSelector:n,unblockSelector:i,maskAllText:o,maskTextClass:c,unmaskTextClass:l,maskTextSelector:a,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:b,maskTextFn:g,maskInputFn:p,slimDOMOptions:S===!0||S==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:S==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:S===!1?{}:S,dataURLOptions:v,inlineImages:h,recordCanvas:m,preserveWhiteSpace:N,onSerialize:D,onIframeLoad:I,iframeLoadTimeout:O,onStylesheetLoad:A,stylesheetLoadTimeout:C,keepIframeSrcFn:R,newlyAddedElement:!1})}const ds=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function sn(e,t={}){let s=1,r=1;function n(w){const y=w.match(/\n/g);y&&(s+=y.length);const k=w.lastIndexOf(`
`);r=k===-1?r+w.length:w.length-k}function i(){const w={line:s,column:r};return y=>(y.position=new c(w),b(),y)}const o=class $s{constructor(y){Me(this,"content"),Me(this,"start"),Me(this,"end"),Me(this,"source"),this.start=y,this.end={line:s,column:r},this.source=t.source,this.content=$s.content}};Me(o,"content");let c=o;c.content=e;const l=[];function a(w){const y=new Error(`${t.source||""}:${s}:${r}: ${w}`);if(y.reason=w,y.filename=t.source,y.line=s,y.column=r,y.source=e,t.silent)l.push(y);else throw y}function u(){const w=m();return{type:"stylesheet",stylesheet:{source:t.source,rules:w,parsingErrors:l}}}function d(){return f(/^{\s*/)}function h(){return f(/^}/)}function m(){let w;const y=[];for(b(),g(y);e.length&&e.charAt(0)!=="}"&&(w=j()||ee());)w&&(y.push(w),g(y));return y}function f(w){const y=w.exec(e);if(!y)return;const k=y[0];return n(k),e=e.slice(k.length),y}function b(){f(/^\s*/)}function g(w=[]){let y;for(;y=p();)y&&w.push(y),y=p();return w}function p(){const w=i();if(e.charAt(0)!=="/"||e.charAt(1)!=="*")return;let y=2;for(;e.charAt(y)!==""&&(e.charAt(y)!=="*"||e.charAt(y+1)!=="/");)++y;if(y+=2,e.charAt(y-1)==="")return a("End of comment missing");const k=e.slice(2,y-2);return r+=2,n(k),e=e.slice(y),r+=2,w({type:"comment",comment:k})}function S(){const w=f(/^([^{]+)/);if(!w)return;const y=he(w[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,le=>le.replace(/,/g,"\u200C")).split(/\s*(?![^(]*\)),\s*/);if(y.length<=1)return y.map(le=>le.replace(/\u200C/g,","));let k=0,F=0;const Q=y.length,ne=[];for(;k<Q;){const le=(y[k].match(/\(/g)||[]).length,ze=(y[k].match(/\)/g)||[]).length;let ve=le-ze;if(ve>=1){let Ge=!1;for(F=k+1;F<Q;){const de=(y[F].match(/\(/g)||[]).length,st=(y[F].match(/\)/g)||[]).length-de;if(st===ve){ne.push(y.slice(k,F+1).join(",")),k=F+1,Ge=!0;break}F++,ve-=st}if(Ge)continue;y.slice(k,Q).forEach(de=>de&&ne.push(de));break}y[k]&&ne.push(y[k]),k++}return ne.map(le=>le.replace(/\u200C/g,","))}function v(){const w=i(),y=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!y)return;const k=he(y[0]);if(!f(/^:\s*/))return a("property missing ':'");const F=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),Q=w({type:"declaration",property:k.replace(ds,""),value:F?he(F[0]).replace(ds,""):""});return f(/^[;\s]*/),Q}function N(){const w=[];if(!d())return a("missing '{'");g(w);let y;for(;y=v();)y!==!1&&(w.push(y),g(w)),y=v();return h()?w:a("missing '}'")}function D(){let w;const y=[],k=i();for(;w=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)y.push(w[1]),f(/^,\s*/);if(y.length)return k({type:"keyframe",values:y,declarations:N()})}function I(){const w=i();let y=f(/^@([-\w]+)?keyframes\s*/);if(!y)return;const k=y[1];if(y=f(/^([-\w]+)\s*/),!y)return a("@keyframes missing name");const F=y[1];if(!d())return a("@keyframes missing '{'");let Q,ne=g();for(;Q=D();)ne.push(Q),ne=ne.concat(g());return h()?w({type:"keyframes",name:F,vendor:k,keyframes:ne}):a("@keyframes missing '}'")}function O(){const w=i(),y=f(/^@supports *([^{]+)/);if(!y)return;const k=he(y[1]);if(!d())return a("@supports missing '{'");const F=g().concat(m());return h()?w({type:"supports",supports:k,rules:F}):a("@supports missing '}'")}function A(){const w=i();if(!f(/^@host\s*/))return;if(!d())return a("@host missing '{'");const k=g().concat(m());return h()?w({type:"host",rules:k}):a("@host missing '}'")}function C(){const w=i(),y=f(/^@media *([^{]+)/);if(!y)return;const k=he(y[1]);if(!d())return a("@media missing '{'");const F=g().concat(m());return h()?w({type:"media",media:k,rules:F}):a("@media missing '}'")}function R(){const w=i(),y=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(y)return w({type:"custom-media",name:he(y[1]),media:he(y[2])})}function G(){const w=i();if(!f(/^@page */))return;const k=S()||[];if(!d())return a("@page missing '{'");let F=g(),Q;for(;Q=v();)F.push(Q),F=F.concat(g());return h()?w({type:"page",selectors:k,declarations:F}):a("@page missing '}'")}function $(){const w=i(),y=f(/^@([-\w]+)?document *([^{]+)/);if(!y)return;const k=he(y[1]),F=he(y[2]);if(!d())return a("@document missing '{'");const Q=g().concat(m());return h()?w({type:"document",document:F,vendor:k,rules:Q}):a("@document missing '}'")}function q(){const w=i();if(!f(/^@font-face\s*/))return;if(!d())return a("@font-face missing '{'");let k=g(),F;for(;F=v();)k.push(F),k=k.concat(g());return h()?w({type:"font-face",declarations:k}):a("@font-face missing '}'")}const J=B("import"),re=B("charset"),P=B("namespace");function B(w){const y=new RegExp("^@"+w+"\\s*((?:"+[/[^\\]"(?:\\"|[^"])*"/.source,/[^\\]'(?:\\'|[^'])*'/.source,"[^;]"].join("|")+")+);");return()=>{const k=i(),F=f(y);if(!F)return;const Q={type:w};return Q[w]=F[1].trim(),k(Q)}}function j(){if(e[0]==="@")return I()||C()||R()||O()||J()||re()||P()||$()||G()||A()||q()}function ee(){const w=i(),y=S();return y?(g(),w({type:"rule",selectors:y,declarations:N()})):a("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 hs={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 rn(e){let t=hs[e.tagName]?hs[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function nn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const js=/([^\\]):hover/,on=new RegExp(js.source,"g");function fs(e,t){const s=t?.stylesWithHoverClass.get(e);if(s)return s;if(e.length>=1e6)return e;const r=sn(e,{silent:!0});if(!r.stylesheet)return e;const n=[];if(r.stylesheet.rules.forEach(c=>{"selectors"in c&&(c.selectors||[]).forEach(l=>{js.test(l)&&n.push(l)})}),n.length===0)return e;const i=new RegExp(n.filter((c,l)=>n.indexOf(c)===l).sort((c,l)=>l.length-c.length).map(c=>nn(c)).join("|"),"g"),o=e.replace(i,c=>{const l=c.replace(on,"$1.\\:hover");return`${c}, ${l}`});return t?.stylesWithHoverClass.set(e,o),o}function ps(){return{stylesWithHoverClass:new Map}}function an(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=rn(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 c={};for(const l in e.attributes){if(!Object.prototype.hasOwnProperty.call(e.attributes,l))continue;let a=e.attributes[l];if(i==="option"&&l==="selected"&&a===!1||a===null)continue;if(a===!0&&(a=""),l.startsWith("rr_")){c[l]=a;continue}const u=i==="textarea"&&l==="value",d=i==="style"&&l==="_cssText";if(d&&r&&typeof a=="string"&&(a=fs(a,n)),(u||d)&&typeof a=="string"){const h=s.createTextNode(a);for(const m of Array.from(o.childNodes))m.nodeType===o.TEXT_NODE&&o.removeChild(m);o.appendChild(h);continue}try{if(e.isSVG&&l==="xlink:href")o.setAttributeNS("http://www.w3.org/1999/xlink",l,a.toString());else if(l==="onload"||l==="onclick"||l.substring(0,7)==="onmouse")o.setAttribute("_"+l,a.toString());else if(i==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&l==="content"){o.setAttribute("csp-content",a.toString());continue}else i==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")||i==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Bt(e.attributes.href)==="js"||(i==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?o.setAttribute("rrweb-original-srcset",e.attributes.srcset):o.setAttribute(l,a.toString()))}catch{}}for(const l in c){const a=c[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=a.toString(),o.RRNodeType&&(o.rr_dataURL=a.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=a.toString())}if(l==="rr_width")o.style.setProperty("width",a.toString());else if(l==="rr_height")o.style.setProperty("height",a.toString());else if(l==="rr_mediaCurrentTime"&&typeof a=="number")o.currentTime=a;else if(l==="rr_mediaState")switch(a){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?fs(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 qe(e,t){const{doc:s,mirror:r,skipChild:n=!1,hackCss:i=!0,afterAppend:o,cache:c}=t;if(r.has(e.id)){const a=r.getNode(e.id),u=r.getMeta(a);if(_r(u,e))return r.getNode(e.id)}let l=an(e,{doc:s,hackCss:i,cache:c});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 a of e.childNodes){const u=qe(a,{doc:s,mirror:r,skipChild:!1,hackCss:i,afterAppend:o,cache:c});if(!u){console.warn("Failed to rebuild",a);continue}if(a.isShadow&&Ps(l)&&l.shadowRoot)l.shadowRoot.appendChild(u);else if(e.type===x.Document&&a.type==x.Element){const d=u;let h=null;d.childNodes.forEach(m=>{m.nodeName==="BODY"&&(h=m)}),h?(d.removeChild(h),l.appendChild(u),d.appendChild(h)):l.appendChild(u)}else l.appendChild(u);o&&o(u,a.id)}return l}function ln(e,t){function s(r){t(r)}for(const r of e.getIds())e.has(r)&&s(e.getNode(r))}function cn(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 un(e,t){const{doc:s,onVisit:r,hackCss:n=!0,afterAppend:i,cache:o,mirror:c=new Wt}=t,l=qe(e,{doc:s,mirror:c,skipChild:!1,hackCss:n,afterAppend:i,cache:o});return ln(c,a=>{r&&r(a),cn(a,c)}),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 xe=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`;let kt={map:{},getId(){return console.error(xe),-1},getNode(){return console.error(xe),null},removeNodeFromMap(){console.error(xe)},has(){return console.error(xe),!1},reset(){console.error(xe)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(kt=new Proxy(kt,{get(e,t,s){return t==="map"&&console.error(xe),Reflect.get(e,t,s)}}));function Ve(e,t,s={}){let r=null,n=0;return function(...i){const o=Date.now();!n&&s.leading===!1&&(n=o);const c=t-(o-n),l=this;c<=0||c>t?(r&&(ts(r),r=null),n=o,e.apply(l,i)):!r&&s.trailing!==!1&&(r=ae(()=>{n=s.leading===!1?0:Date.now(),r=null,e.apply(l,i)},c))}}function et(e,t,s,r,n=window){const i=n.Object.getOwnPropertyDescriptor(e,t);return n.Object.defineProperty(e,t,r?s:{set(o){ae(()=>{s.set.call(this,o)},0),i&&i.set&&i.set.call(this,o)}}),()=>et(e,t,i||{},!0)}function De(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 Ke=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Ke=()=>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(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Gt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function $t(e){return e?e.nodeType===e.ELEMENT_NODE?e:e.parentElement:null}function Z(e,t,s,r,n){if(!e)return!1;const i=$t(e);if(!i)return!1;const o=_e(t,s);if(!n){const a=r&&i.matches(r);return o(i)&&!a}const c=Ce(i,o);let l=-1;return c<0?!1:(r&&(l=Ce(i,_e(null,r))),c>-1&&l<0?!0:c<l)}function Ys(e,t){return t.getId(e)!==-1}function at(e,t){return t.getId(e)===Ze}function jt(e,t){if(Ye(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 ht(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 Xs(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 c=t[i];if(c.parent){const l=c.parent.children.indexOf(c);c.parent.children.splice(l,0,s(n,c.parent))}else{const l=r.indexOf(c);r.splice(l,0,s(n,null))}continue}if(o in t){const c=t[o];c.children.push(s(n,c));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 Ue(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 Se(e){return!!e?.shadowRoot}function Pe(e,t){const s=e[t[0]];return t.length===1?s:Pe(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 Qs(e){let t=e,s;for(;s=Zt(t);)t=s;return t}function Js(e){const t=e.ownerDocument;if(!t)return!1;const s=Qs(e);return t.contains(s)}function Kt(e){const t=e.ownerDocument;return t?t.contains(e)||Js(e):!1}const ms={};function es(e){const t=ms[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 ms[e]=r.bind(window)}function oe(...e){return es("requestAnimationFrame")(...e)}function ae(...e){return es("setTimeout")(...e)}function ts(...e){return es("clearTimeout")(...e)}const dn=Object.freeze(Object.defineProperty({__proto__:null,StyleSheetMirror:Jt,get _mirror(){return kt},clearTimeout:ts,closestElementOfNode:$t,getBaseDimension:Qt,getNestedRule:Pe,getPositionsAndIndex:Ot,getRootShadowHost:Qs,getShadowHost:Zt,getWindowHeight:zt,getWindowScroll:Ht,getWindowWidth:Gt,hasShadowRoot:Se,hookSetter:et,inDom:Kt,isAncestorRemoved:jt,isBlocked:Z,isIgnored:at,isSerialized:Ys,isSerializedIframe:Ue,isSerializedStylesheet:qt,iterateResolveTree:Xt,legacy_isTouchEvent:ht,get nowTimestamp(){return Ke},on:te,onRequestAnimationFrame:oe,patch:De,polyfill:Yt,queueToResolveTrees:Xs,setTimeout:ae,shadowHostInDom:Js,throttle:Ve,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||{}),E=(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))(E||{}),U=(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))(U||{}),fe=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(fe||{}),ge=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ge||{}),pe=(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))(pe||{}),z=(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))(z||{}),hn=Object.defineProperty,fn=(e,t,s)=>t in e?hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,M=(e,t,s)=>fn(e,typeof t!="symbol"?t+"":t,s),pn=Object.defineProperty,mn=(e,t,s)=>t in e?pn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,gs=(e,t,s)=>mn(e,typeof t!="symbol"?t+"":t,s),L=(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))(L||{});let gn=class{constructor(){gs(this,"idNodeMap",new Map),gs(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 yn(){return new gn}function Sn(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 ys(e){const t=[];for(const s in e){const r=e[s];if(typeof r!="string")continue;const n=En(s);t.push(`${n}: ${r};`)}return t.join(" ")}const bn=/-([a-z])/g,vn=/^--[a-zA-Z0-9-]+$/,At=e=>vn.test(e)?e:e.replace(bn,(t,s)=>s?s.toUpperCase():""),wn=/\B([A-Z])/g,En=e=>e.replace(wn,"-$1").toLowerCase();class be{constructor(...t){M(this,"parentElement",null),M(this,"parentNode",null),M(this,"ownerDocument"),M(this,"firstChild",null),M(this,"lastChild",null),M(this,"previousSibling",null),M(this,"nextSibling",null),M(this,"ELEMENT_NODE",1),M(this,"TEXT_NODE",3),M(this,"nodeType"),M(this,"nodeName"),M(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 be){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 be{constructor(...t){super(t),M(this,"nodeType",9),M(this,"nodeName","#document"),M(this,"compatMode","CSS1Compat"),M(this,"RRNodeType",L.Document),M(this,"textContent",null),this.ownerDocument=this}get documentElement(){return this.childNodes.find(t=>t.RRNodeType===L.Element&&t.tagName==="HTML")||null}get body(){return this.documentElement?.childNodes.find(t=>t.RRNodeType===L.Element&&t.tagName==="BODY")||null}get head(){return this.documentElement?.childNodes.find(t=>t.RRNodeType===L.Element&&t.tagName==="HEAD")||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(t){const s=t.RRNodeType;if((s===L.Element||s===L.DocumentType)&&this.childNodes.some(n=>n.RRNodeType===s))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${s===L.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===L.Element||r===L.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===r))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${r===L.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);const n=sr(this,t,s);return n.parentElement=null,n}removeChild(t){return rr(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 Zs(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 Ks(t);return s.ownerDocument=this,s}createComment(t){const s=new er(t);return s.ownerDocument=this,s}createCDATASection(t){const s=new tr(t);return s.ownerDocument=this,s}toString(){return"RRDocument"}}class Zs extends be{constructor(t,s,r){super(),M(this,"nodeType",10),M(this,"RRNodeType",L.DocumentType),M(this,"name"),M(this,"publicId"),M(this,"systemId"),M(this,"textContent",null),this.name=t,this.publicId=s,this.systemId=r,this.nodeName=t}toString(){return"RRDocumentType"}}class rs extends be{constructor(t){super(),M(this,"nodeType",1),M(this,"RRNodeType",L.Element),M(this,"tagName"),M(this,"attributes",{}),M(this,"shadowRoot",null),M(this,"scrollLeft"),M(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 Cn(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?Sn(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=ys(t)},t.removeProperty=r=>{if(s.test(r))return"";const n=At(r),i=t[n]||"";return delete t[n],this.attributes.style=ys(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 sr(this,t,s)}removeChild(t){return rr(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 Mn extends rs{constructor(){super(...arguments),M(this,"currentTime"),M(this,"volume"),M(this,"paused"),M(this,"muted"),M(this,"playbackRate"),M(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 Ks extends be{constructor(t){super(),M(this,"nodeType",3),M(this,"nodeName","#text"),M(this,"RRNodeType",L.Text),M(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 er extends be{constructor(t){super(),M(this,"nodeType",8),M(this,"nodeName","#comment"),M(this,"RRNodeType",L.Comment),M(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 tr extends be{constructor(t){super(),M(this,"nodeName","#cdata-section"),M(this,"nodeType",4),M(this,"RRNodeType",L.CDATA),M(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 Cn{constructor(t,s){if(M(this,"onChange"),M(this,"classes",[]),M(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(" "))}),M(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 sr(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 rr(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.next