@sentry-internal/rrweb-snapshot
Advanced tools
Comparing version 2.9.0 to 2.10.0
@@ -1,2 +0,2 @@ | ||
var rrwebSnapshot=function(e){"use strict";var t;function n(e){return e.nodeType===e.ELEMENT_NODE}function r(e){const t=e?.host;return Boolean(t?.shadowRoot===e)}function o(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function s(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function a(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,i).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function i(e){let t;if(l(e))try{t=a(e.styleSheet)||s(e)}catch(e){}else if(u(e)&&e.selectorText.includes(":"))return c(e.cssText);return t||e.cssText}function c(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function l(e){return"styleSheet"in e}function u(e){return"selectorText"in e}e.NodeType=void 0,(t=e.NodeType||(e.NodeType={}))[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";class d{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){if(!e)return-1;const t=this.getMeta(e)?.id;return t??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function m({maskInputOptions:e,tagName:t,type:n}){return"OPTION"===t&&(t="SELECT"),Boolean(e[t.toLowerCase()]||n&&e[n]||"password"===n||"INPUT"===t&&!n&&e.text)}function p({isMasked:e,element:t,value:n,maskInputFn:r}){let o=n||"";return e?(r&&(o=r(o,t)),"*".repeat(o.length)):o}function f(e){return e.toLowerCase()}function h(e){return e.toUpperCase()}const y="__rrweb_original__";function g(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const o=t.getImageData,s=y in o?o[y]:o;if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0}function k(t,n){return!(!t||!n||t.type!==n.type)&&(t.type===e.NodeType.Document?t.compatMode===n.compatMode:t.type===e.NodeType.DocumentType?t.name===n.name&&t.publicId===n.publicId&&t.systemId===n.systemId:t.type===e.NodeType.Comment||t.type===e.NodeType.Text||t.type===e.NodeType.CDATA?t.textContent===n.textContent:t.type===e.NodeType.Element&&(t.tagName===n.tagName&&JSON.stringify(t.attributes)===JSON.stringify(n.attributes)&&t.isSVG===n.isSVG&&t.needBlock===n.needBlock))}function T(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?f(t):null}function b(e,t,n){return"INPUT"!==t||"radio"!==n&&"checkbox"!==n?e.value:e.getAttribute("value")||""}let N=1;const S=new RegExp("[^a-z0-9-_:]"),x=-2;function C(){return N++}let w,E;const I=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,v=/^(?:[a-z+]+:)?\/\//i,M=/^www\..*/i,L=/^(data:)([^,]*),(.*)/i;function A(e,t){return(e||"").replace(I,((e,n,r,o,s,a)=>{const i=r||s||a,c=n||o||"";if(!i)return e;if(v.test(i)||M.test(i))return`url(${c}${i}${c})`;if(L.test(i))return`url(${c}${i}${c})`;if("/"===i[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+i}${c})`;const l=t.split("/"),u=i.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const O=/^[^ \t\n\r\u000c]+/,D=/^[, \t\n\r\u000c]+/;function F(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function R(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function _(){const e=document.createElement("a");return e.href="",e.href}function $(e,t,n,r,o,s){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?F(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}const o=[];for(;r(D),!(n>=t.length);){let s=r(O);if(","===s.slice(-1))s=F(e,s.substring(0,s.length-1)),o.push(s);else{let r="";s=F(e,s);let a=!1;for(;;){const e=t.charAt(n);if(""===e){o.push((s+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,o.push((s+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n?A(r,_()):"object"===t&&"data"===n?F(e,r):"function"==typeof s?s(n,r,o):r:F(e,r):r}function U(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function W(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function P(e,t,n=1/0,r=0){return e?e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:P(e.parentNode,t,n,r+1):-1}function j(e,t){return n=>{const r=n;if(null===r)return!1;try{if(e)if("string"==typeof e){if(r.matches(`.${e}`))return!0}else if(W(r,e))return!0;return!(!t||!r.matches(t))}catch{return!1}}}function B(e,t,n,r,o,s){try{const a=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===a)return!1;let i=-1,c=-1;if(s){if(c=P(a,j(r,o)),c<0)return!0;i=P(a,j(t,n),c>=0?c:1/0)}else{if(i=P(a,j(t,n)),i<0)return!1;c=P(a,j(r,o),i>=0?i:1/0)}return i>=0?!(c>=0)||i<=c:!(c>=0)&&!!s}catch(e){}return!!s}function V(t,n){const{doc:r,mirror:o,blockClass:s,blockSelector:i,unblockSelector:c,maskAllText:l,maskAttributeFn:u,maskTextClass:d,unmaskTextClass:y,maskTextSelector:k,unmaskTextSelector:N,inlineStylesheet:x,maskInputOptions:C={},maskTextFn:I,maskInputFn:v,dataURLOptions:M={},inlineImages:L,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F=!1}=n,W=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(r,o);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.NodeType.Document,childNodes:[],compatMode:t.compatMode}:{type:e.NodeType.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:W};case t.ELEMENT_NODE:return function(t,n){const{doc:r,blockClass:o,blockSelector:s,unblockSelector:i,inlineStylesheet:c,maskInputOptions:l={},maskAttributeFn:u,maskInputFn:d,dataURLOptions:y={},inlineImages:k,recordCanvas:N,keepIframeSrcFn:x,newlyAddedElement:C=!1,rootId:I,maskAllText:v,maskTextClass:M,unmaskTextClass:L,maskTextSelector:O,unmaskTextSelector:D}=n,F=function(e,t,n,r){try{if(r&&e.matches(r))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(t,o,s,i),W=function(e){if(e instanceof HTMLFormElement)return"form";const t=f(e.tagName);return S.test(t)?"div":t}(t);let P={};const j=t.attributes.length;for(let e=0;e<j;e++){const n=t.attributes[e];U(W,n.name,n.value)||(P[n.name]=$(r,W,f(n.name),n.value,t,u))}if("link"===W&&c){const e=Array.from(r.styleSheets).find((e=>e.href===t.href));let n=null;e&&(n=a(e)),n&&(delete P.rel,delete P.href,P._cssText=A(n,e.href))}if("style"===W&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const e=a(t.sheet);e&&(P._cssText=A(e,_()))}if("input"===W||"textarea"===W||"select"===W||"option"===W){const e=t,n=T(e),r=b(e,h(W),n),o=e.checked;if("submit"!==n&&"button"!==n&&r){const t=B(e,M,O,L,D,m({type:n,tagName:h(W),maskInputOptions:l}));P.value=p({isMasked:t,element:e,value:r,maskInputFn:d})}o&&(P.checked=o)}"option"===W&&(t.selected&&!l.select?P.selected=!0:delete P.selected);if("canvas"===W&&N)if("2d"===t.__context)g(t)||(P.rr_dataURL=t.toDataURL(y.type,y.quality));else if(!("__context"in t)){const e=t.toDataURL(y.type,y.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(y.type,y.quality)&&(P.rr_dataURL=e)}if("img"===W&&k){w||(w=r.createElement("canvas"),E=w.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const o=()=>{e.removeEventListener("load",o);try{w.width=e.naturalWidth,w.height=e.naturalHeight,E.drawImage(e,0,0),P.rr_dataURL=w.toDataURL(y.type,y.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}n?P.crossOrigin=n:e.removeAttribute("crossorigin")};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}"audio"!==W&&"video"!==W||(P.rr_mediaState=t.paused?"paused":"played",P.rr_mediaCurrentTime=t.currentTime);C||(t.scrollLeft&&(P.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(P.rr_scrollTop=t.scrollTop));if(F){const{width:e,height:n}=t.getBoundingClientRect();P={class:P.class,rr_width:`${e}px`,rr_height:`${n}px`}}"iframe"!==W||x(P.src)||(t.contentDocument||(P.rr_src=P.src),delete P.src);let V;try{customElements.get(W)&&(V=!0)}catch(e){}return{type:e.NodeType.Element,tagName:W,attributes:P,childNodes:[],isSVG:R(t)||void 0,needBlock:F,rootId:I,isCustom:V}}(t,{doc:r,blockClass:s,blockSelector:i,unblockSelector:c,inlineStylesheet:x,maskAttributeFn:u,maskInputOptions:C,maskInputFn:v,dataURLOptions:M,inlineImages:L,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F,rootId:W,maskAllText:l,maskTextClass:d,unmaskTextClass:y,maskTextSelector:k,unmaskTextSelector:N});case t.TEXT_NODE:return function(t,n){const{maskAllText:r,maskTextClass:o,unmaskTextClass:s,maskTextSelector:i,unmaskTextSelector:c,maskTextFn:l,maskInputOptions:u,maskInputFn:d,rootId:f}=n,h=t.parentNode&&t.parentNode.tagName;let y=t.textContent;const g="STYLE"===h||void 0,k="SCRIPT"===h||void 0,T="TEXTAREA"===h||void 0;if(g&&y){try{t.nextSibling||t.previousSibling||t.parentNode.sheet?.cssRules&&(y=a(t.parentNode.sheet))}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}y=A(y,_())}k&&(y="SCRIPT_PLACEHOLDER");const b=B(t,o,i,s,c,r);g||k||T||!y||!b||(y=l?l(y):y.replace(/[\S]/g,"*"));T&&y&&(u.textarea||b)&&(y=d?d(y,t.parentNode):y.replace(/[\S]/g,"*"));if("OPTION"===h&&y){y=p({isMasked:B(t,o,i,s,c,m({type:null,tagName:h,maskInputOptions:u})),element:t,value:y,maskInputFn:d})}return{type:e.NodeType.Text,textContent:y||"",isStyle:g,rootId:f}}(t,{maskAllText:l,maskTextClass:d,unmaskTextClass:y,maskTextSelector:k,unmaskTextSelector:N,maskTextFn:I,maskInputOptions:C,maskInputFn:v,rootId:W});case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:W};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:W};default:return!1}}function G(e){return null==e?"":e.toLowerCase()}function H(t,s){const{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:d,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:y=!1,inlineStylesheet:g=!0,maskInputOptions:k={},maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w={},inlineImages:E=!1,recordCanvas:I=!1,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L=5e3,onStylesheetLoad:A,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:D=(()=>!1),newlyAddedElement:F=!1}=s;let{preserveWhiteSpace:R=!0}=s;const _=V(t,{doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:d,unblockSelector:u,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,dataURLOptions:w,inlineImages:E,recordCanvas:I,keepIframeSrcFn:D,newlyAddedElement:F});if(!_)return console.warn(t,"not serialized"),null;let $;$=i.hasNode(t)?i.getId(t):!function(t,n){if(n.comment&&t.type===e.NodeType.Comment)return!0;if(t.type===e.NodeType.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel||"modulepreload"===t.attributes.rel)&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(G(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===G(t.attributes.name)||"icon"===G(t.attributes.rel)||"apple-touch-icon"===G(t.attributes.rel)||"shortcut icon"===G(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&G(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(G(t.attributes.property).match(/^(og|twitter|fb):/)||G(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===G(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===G(t.attributes.name)||"googlebot"===G(t.attributes.name)||"bingbot"===G(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===G(t.attributes.name)||"generator"===G(t.attributes.name)||"framework"===G(t.attributes.name)||"publisher"===G(t.attributes.name)||"progid"===G(t.attributes.name)||G(t.attributes.property).match(/^article:/)||G(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===G(t.attributes.name)||"yandex-verification"===G(t.attributes.name)||"csrf-token"===G(t.attributes.name)||"p:domain_verify"===G(t.attributes.name)||"verify-v1"===G(t.attributes.name)||"verification"===G(t.attributes.name)||"shopify-checkout-api-token"===G(t.attributes.name)))return!0}}return!1}(_,S)&&(R||_.type!==e.NodeType.Text||_.isStyle||_.textContent.replace(/^\s+|\s+$/gm,"").length)?C():x;const U=Object.assign(_,{id:$});if(i.add(t,U),$===x)return null;v&&v(t);let W=!y;if(U.type===e.NodeType.Element){W=W&&!U.needBlock,delete U.needBlock;const e=t.shadowRoot;e&&o(e)&&(U.isShadowHost=!0)}if((U.type===e.NodeType.Document||U.type===e.NodeType.Element)&&W){S.headWhitespace&&U.type===e.NodeType.Element&&"head"===U.tagName&&(R=!1);const r={doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:d,unblockSelector:u,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:y,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w,inlineImages:E,recordCanvas:I,preserveWhiteSpace:R,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D};for(const e of Array.from(t.childNodes)){const t=H(e,r);t&&U.childNodes.push(t)}if(n(t)&&t.shadowRoot)for(const e of Array.from(t.shadowRoot.childNodes)){const n=H(e,r);n&&(o(t.shadowRoot)&&(n.isShadow=!0),U.childNodes.push(n))}}return t.parentNode&&r(t.parentNode)&&o(t.parentNode)&&(U.isShadow=!0),U.type===e.NodeType.Element&&"iframe"===U.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"!==o){const r=setTimeout((()=>{s||(t(),s=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),s=!0,t()}))}const a="about:blank";if(r.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(t,(()=>{const e=t.contentDocument;if(e&&M){const n=H(e,{doc:e,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:d,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w,inlineImages:E,recordCanvas:I,preserveWhiteSpace:R,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});n&&M(t,n)}}),L),U.type===e.NodeType.Element&&"link"===U.tagName&&"stylesheet"===U.attributes.rel&&function(e,t,n){let r,o=!1;try{r=e.sheet}catch(e){return}if(r)return;const s=setTimeout((()=>{o||(t(),o=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(s),o=!0,t()}))}(t,(()=>{if(A){const e=H(t,{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:d,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w,inlineImages:E,recordCanvas:I,preserveWhiteSpace:R,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});e&&A(t,e)}}),O),U}const z=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function q(e,t={}){let n=1,r=1;function o(e){const t=e.match(/\n/g);t&&(n+=t.length);const o=e.lastIndexOf("\n");r=-1===o?r+e.length:e.length-o}function s(){const e={line:n,column:r};return t=>(t.position=new a(e),p(),t)}class a{constructor(e){this.start=e,this.end={line:n,column:r},this.source=t.source}}a.prototype.content=e;const i=[];function c(o){const s=new Error(`${t.source||""}:${n}:${r}: ${o}`);if(s.reason=o,s.filename=t.source,s.line=n,s.column=r,s.source=e,!t.silent)throw s;i.push(s)}function l(){return m(/^{\s*/)}function u(){return m(/^}/)}function d(){let t;const n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=C()||w());)t&&(n.push(t),f(n));return n}function m(t){const n=t.exec(e);if(!n)return;const r=n[0];return o(r),e=e.slice(r.length),n}function p(){m(/^\s*/)}function f(e=[]){let t;for(;t=h();)t&&e.push(t),t=h();return e}function h(){const t=s();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const a=e.slice(2,n-2);return r+=2,o(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}function y(){const e=m(/^([^{]+)/);if(e)return Y(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,""))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function g(){const e=s(),t=m(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=Y(t[0]);if(!m(/^:\s*/))return c("property missing ':'");const r=m(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:n.replace(z,""),value:r?Y(r[0]).replace(z,""):""});return m(/^[;\s]*/),o}function k(){const e=[];if(!l())return c("missing '{'");let t;for(f(e);t=g();)!1!==t&&(e.push(t),f(e)),t=g();return u()?e:c("missing '}'")}function T(){let e;const t=[],n=s();for(;e=m(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),m(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:k()})}const b=x("import"),N=x("charset"),S=x("namespace");function x(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=s(),r=m(t);if(!r)return;const o={type:e};return o[e]=r[1].trim(),n(o)}}function C(){if("@"===e[0])return function(){const e=s();let t=m(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=m(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const r=t[1];if(!l())return c("@keyframes missing '{'");let o,a=f();for(;o=T();)a.push(o),a=a.concat(f());return u()?e({type:"keyframes",name:r,vendor:n,keyframes:a}):c("@keyframes missing '}'")}()||function(){const e=s(),t=m(/^@media *([^{]+)/);if(!t)return;const n=Y(t[1]);if(!l())return c("@media missing '{'");const r=f().concat(d());return u()?e({type:"media",media:n,rules:r}):c("@media missing '}'")}()||function(){const e=s(),t=m(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:Y(t[1]),media:Y(t[2])})}()||function(){const e=s(),t=m(/^@supports *([^{]+)/);if(!t)return;const n=Y(t[1]);if(!l())return c("@supports missing '{'");const r=f().concat(d());return u()?e({type:"supports",supports:n,rules:r}):c("@supports missing '}'")}()||b()||N()||S()||function(){const e=s(),t=m(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=Y(t[1]),r=Y(t[2]);if(!l())return c("@document missing '{'");const o=f().concat(d());return u()?e({type:"document",document:r,vendor:n,rules:o}):c("@document missing '}'")}()||function(){const e=s();if(!m(/^@page */))return;const t=y()||[];if(!l())return c("@page missing '{'");let n,r=f();for(;n=g();)r.push(n),r=r.concat(f());return u()?e({type:"page",selectors:t,declarations:r}):c("@page missing '}'")}()||function(){const e=s();if(!m(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=f().concat(d());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=s();if(!m(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=f();for(;t=g();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function w(){const e=s(),t=y();return t?(f(),e({type:"rule",selectors:t,declarations:k()})):c("selector missing")}return X(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:i}}}())}function Y(e){return e?e.replace(/^\s+|\s+$/g,""):""}function X(e,t){const n=e&&"string"==typeof e.type,r=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{X(e,r)})):n&&"object"==typeof n&&X(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const J={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"};const K=/([^\\]):hover/,Q=new RegExp(K.source,"g");function Z(e,t){const n=t?.stylesWithHoverClass.get(e);if(n)return n;if(e.length>=1e6)return e;const r=q(e,{silent:!0});if(!r.stylesheet)return e;const o=[];if(r.stylesheet.rules.forEach((e=>{"selectors"in e&&(e.selectors||[]).forEach((e=>{K.test(e)&&o.push(e)}))})),0===o.length)return e;const s=new RegExp(o.filter(((e,t)=>o.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("|"),"g"),a=e.replace(s,(e=>{const t=e.replace(Q,"$1.\\:hover");return`${e}, ${t}`}));return t?.stylesWithHoverClass.set(e,a),a}function ee(t,n){const{doc:r,hackCss:o,cache:s}=n;switch(t.type){case e.NodeType.Document:return r.implementation.createDocument(null,"",null);case e.NodeType.DocumentType:return r.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.NodeType.Element:{const e=function(e){let t=J[e.tagName]?J[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);let n;t.isSVG?n=r.createElementNS("http://www.w3.org/2000/svg",e):(t.isCustom&&r.defaultView?.customElements&&!r.defaultView.customElements.get(t.tagName)&&r.defaultView.customElements.define(t.tagName,class extends r.defaultView.HTMLElement{}),n=r.createElement(e));const a={};for(const i in t.attributes){if(!Object.prototype.hasOwnProperty.call(t.attributes,i))continue;let c=t.attributes[i];if("option"===e&&"selected"===i&&!1===c)continue;if(null===c)continue;if(!0===c&&(c=""),i.startsWith("rr_")){a[i]=c;continue}const l="textarea"===e&&"value"===i,u="style"===e&&"_cssText"===i;if(u&&o&&"string"==typeof c&&(c=Z(c,s)),!l&&!u||"string"!=typeof c)try{if(t.isSVG&&"xlink:href"===i)n.setAttributeNS("http://www.w3.org/1999/xlink",i,c.toString());else if("onload"===i||"onclick"===i||"onmouse"===i.substring(0,7))n.setAttribute("_"+i,c.toString());else{if("meta"===e&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===i){n.setAttribute("csp-content",c.toString());continue}("link"!==e||"preload"!==t.attributes.rel&&"modulepreload"!==t.attributes.rel||"script"!==t.attributes.as)&&("link"===e&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===e&&t.attributes.srcset&&t.attributes.rr_dataURL?n.setAttribute("rrweb-original-srcset",t.attributes.srcset):n.setAttribute(i,c.toString())))}}catch(e){}else{const e=r.createTextNode(c);for(const e of Array.from(n.childNodes))e.nodeType===n.TEXT_NODE&&n.removeChild(e);n.appendChild(e)}}for(const r in a){const o=a[r];if("canvas"===e&&"rr_dataURL"===r){const e=document.createElement("img");e.onload=()=>{const t=n.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=o.toString(),n.RRNodeType&&(n.rr_dataURL=o.toString())}else if("img"===e&&"rr_dataURL"===r){const e=n;e.currentSrc.startsWith("data:")||(e.setAttribute("rrweb-original-src",t.attributes.src),e.src=o.toString())}if("rr_width"===r)n.style.setProperty("width",o.toString());else if("rr_height"===r)n.style.setProperty("height",o.toString());else if("rr_mediaCurrentTime"===r&&"number"==typeof o)n.currentTime=o;else if("rr_mediaState"===r)switch(o){case"played":n.play().catch((e=>console.warn("media playback error",e)));break;case"paused":n.pause()}}if(t.isShadowHost)if(n.shadowRoot)for(;n.shadowRoot.firstChild;)n.shadowRoot.removeChild(n.shadowRoot.firstChild);else n.attachShadow({mode:"open"});return n}case e.NodeType.Text:return r.createTextNode(t.isStyle&&o?Z(t.textContent,s):t.textContent);case e.NodeType.CDATA:return r.createCDATASection(t.textContent);case e.NodeType.Comment:return r.createComment(t.textContent);default:return null}}function te(t,r){const{doc:o,mirror:s,skipChild:a=!1,hackCss:i=!0,afterAppend:c,cache:l}=r;if(s.has(t.id)){const e=s.getNode(t.id);if(k(s.getMeta(e),t))return s.getNode(t.id)}let u=ee(t,{doc:o,hackCss:i,cache:l});if(!u)return null;if(t.rootId&&s.getNode(t.rootId)!==o&&s.replace(t.rootId,o),t.type===e.NodeType.Document&&(o.close(),o.open(),"BackCompat"===t.compatMode&&t.childNodes&&t.childNodes[0].type!==e.NodeType.DocumentType&&(t.childNodes[0].type===e.NodeType.Element&&"xmlns"in t.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===t.childNodes[0].attributes.xmlns?o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=o),s.add(u,t),(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!a)for(const r of t.childNodes){const a=te(r,{doc:o,mirror:s,skipChild:!1,hackCss:i,afterAppend:c,cache:l});if(a){if(r.isShadow&&n(u)&&u.shadowRoot)u.shadowRoot.appendChild(a);else if(t.type===e.NodeType.Document&&r.type==e.NodeType.Element){const e=a;let t=null;e.childNodes.forEach((e=>{"BODY"===e.nodeName&&(t=e)})),t?(e.removeChild(t),u.appendChild(a),e.appendChild(t)):u.appendChild(a)}else u.appendChild(a);c&&c(a,r.id)}else console.warn("Failed to rebuild",r)}return u}return e.IGNORED_NODE=x,e.Mirror=d,e.addHoverClass=Z,e.buildNodeWithSN=te,e.classMatchesRegex=function(e,t,n){return!!e&&(n?P(e,(e=>W(e,t)))>=0:e.nodeType===e.ELEMENT_NODE&&W(e,t))},e.cleanupSnapshot=function(){N=1},e.createCache=function(){return{stylesWithHoverClass:new Map}},e.createMatchPredicate=j,e.createMirror=function(){return new d},e.distanceToMatch=P,e.escapeImportStatement=s,e.fixSafariColons=c,e.genId=C,e.getInputType=T,e.getInputValue=b,e.ignoreAttribute=U,e.is2DCanvasBlank=g,e.isCSSImportRule=l,e.isCSSStyleRule=u,e.isElement=n,e.isNativeShadowDom=o,e.isNodeMetaEqual=k,e.isShadowRoot=r,e.maskInputValue=p,e.needMaskingText=B,e.rebuild=function(t,n){const{doc:r,onVisit:o,hackCss:s=!0,afterAppend:a,cache:i,mirror:c=new d}=n,l=te(t,{doc:r,mirror:c,skipChild:!1,hackCss:s,afterAppend:a,cache:i});return function(e,t){for(const r of e.getIds())e.has(r)&&(n=e.getNode(r),t(n));var n}(c,(t=>{o&&o(t),function(t,n){const r=n.getMeta(t);if(r?.type!==e.NodeType.Element)return;const o=t;for(const e in r.attributes){if(!Object.prototype.hasOwnProperty.call(r.attributes,e)||!e.startsWith("rr_"))continue;const t=r.attributes[e];"rr_scrollLeft"===e&&(o.scrollLeft=t),"rr_scrollTop"===e&&(o.scrollTop=t)}}(t,c)})),l},e.serializeNodeWithId=H,e.shouldMaskInput=m,e.snapshot=function(e,t){const{mirror:n=new d,blockClass:r="rr-block",blockSelector:o=null,unblockSelector:s=null,maskAllText:a=!1,maskTextClass:i="rr-mask",unmaskTextClass:c=null,maskTextSelector:l=null,unmaskTextSelector:u=null,inlineStylesheet:m=!0,inlineImages:p=!1,recordCanvas:f=!1,maskAllInputs:h=!1,maskAttributeFn:y,maskTextFn:g,maskInputFn:k,slimDOM:T=!1,dataURLOptions:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:x,iframeLoadTimeout:C,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:I=(()=>!1)}=t||{};return H(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,unblockSelector:s,maskAllText:a,maskTextClass:i,unmaskTextClass:c,maskTextSelector:l,unmaskTextSelector:u,skipChild:!1,inlineStylesheet:m,maskInputOptions:!0===h?{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}:!1===h?{}:h,maskAttributeFn:y,maskTextFn:g,maskInputFn:k,slimDOMOptions:!0===T||"all"===T?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===T,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===T?{}:T,dataURLOptions:b,inlineImages:p,recordCanvas:f,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:x,iframeLoadTimeout:C,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:I,newlyAddedElement:!1})},e.stringifyRule=i,e.stringifyStylesheet=a,e.toLowerCase=f,e.toUpperCase=h,e.transformAttribute=$,e.visitSnapshot=function(t,n){!function t(r){n(r),r.type!==e.NodeType.Document&&r.type!==e.NodeType.Element||r.childNodes.forEach(t)}(t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var rrwebSnapshot=function(e){"use strict";var t;function n(e){return e.nodeType===e.ELEMENT_NODE}function r(e){const t=e?.host;return Boolean(t?.shadowRoot===e)}function o(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function s(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function a(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,i).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function i(e){let t;if(l(e))try{t=a(e.styleSheet)||s(e)}catch(e){}else if(u(e)&&e.selectorText.includes(":"))return c(e.cssText);return t||e.cssText}function c(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function l(e){return"styleSheet"in e}function u(e){return"selectorText"in e}e.NodeType=void 0,(t=e.NodeType||(e.NodeType={}))[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment";class d{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){if(!e)return-1;const t=this.getMeta(e)?.id;return t??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function m({maskInputOptions:e,tagName:t,type:n}){return"OPTION"===t&&(t="SELECT"),Boolean(e[t.toLowerCase()]||n&&e[n]||"password"===n||"INPUT"===t&&!n&&e.text)}function p({isMasked:e,element:t,value:n,maskInputFn:r}){let o=n||"";return e?(r&&(o=r(o,t)),"*".repeat(o.length)):o}function f(e){return e.toLowerCase()}function h(e){return e.toUpperCase()}const y="__rrweb_original__";function g(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const o=t.getImageData,s=y in o?o[y]:o;if(new Uint32Array(s.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0}function k(t,n){return!(!t||!n||t.type!==n.type)&&(t.type===e.NodeType.Document?t.compatMode===n.compatMode:t.type===e.NodeType.DocumentType?t.name===n.name&&t.publicId===n.publicId&&t.systemId===n.systemId:t.type===e.NodeType.Comment||t.type===e.NodeType.Text||t.type===e.NodeType.CDATA?t.textContent===n.textContent:t.type===e.NodeType.Element&&(t.tagName===n.tagName&&JSON.stringify(t.attributes)===JSON.stringify(n.attributes)&&t.isSVG===n.isSVG&&t.needBlock===n.needBlock))}function T(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?f(t):null}function b(e,t,n){return"INPUT"!==t||"radio"!==n&&"checkbox"!==n?e.value:e.getAttribute("value")||""}let N=1;const S=new RegExp("[^a-z0-9-_:]"),x=-2;function C(){return N++}let w,E;const I=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,v=/^(?:[a-z+]+:)?\/\//i,M=/^www\..*/i,L=/^(data:)([^,]*),(.*)/i;function A(e,t){return(e||"").replace(I,((e,n,r,o,s,a)=>{const i=r||s||a,c=n||o||"";if(!i)return e;if(v.test(i)||M.test(i))return`url(${c}${i}${c})`;if(L.test(i))return`url(${c}${i}${c})`;if("/"===i[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+i}${c})`;const l=t.split("/"),u=i.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const O=/^[^ \t\n\r\u000c]+/,D=/^[, \t\n\r\u000c]+/;function F(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function R(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function _(){const e=document.createElement("a");return e.href="",e.href}function $(e,t,n,r,o,s){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?F(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const o=e.exec(t.substring(n));return o?(r=o[0],n+=r.length,r):""}const o=[];for(;r(D),!(n>=t.length);){let s=r(O);if(","===s.slice(-1))s=F(e,s.substring(0,s.length-1)),o.push(s);else{let r="";s=F(e,s);let a=!1;for(;;){const e=t.charAt(n);if(""===e){o.push((s+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,o.push((s+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return o.join(", ")}(e,r):"style"===n?A(r,_()):"object"===t&&"data"===n?F(e,r):"function"==typeof s?s(n,r,o):r:F(e,r):r}function U(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function W(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function P(e,t,n=1/0,r=0){return e?e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:P(e.parentNode,t,n,r+1):-1}function j(e,t){return n=>{const r=n;if(null===r)return!1;try{if(e)if("string"==typeof e){if(r.matches(`.${e}`))return!0}else if(W(r,e))return!0;return!(!t||!r.matches(t))}catch{return!1}}}function B(e,t,n,r,o,s){try{const a=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===a)return!1;let i=-1,c=-1;if(s){if(c=P(a,j(r,o)),c<0)return!0;i=P(a,j(t,n),c>=0?c:1/0)}else{if(i=P(a,j(t,n)),i<0)return!1;c=P(a,j(r,o),i>=0?i:1/0)}return i>=0?!(c>=0)||i<=c:!(c>=0)&&!!s}catch(e){}return!!s}function V(t,n){const{doc:r,mirror:o,blockClass:s,blockSelector:i,unblockSelector:c,maskAllText:l,maskAttributeFn:u,maskTextClass:d,unmaskTextClass:y,maskTextSelector:k,unmaskTextSelector:N,inlineStylesheet:x,maskInputOptions:C={},maskTextFn:I,maskInputFn:v,dataURLOptions:M={},inlineImages:L,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F=!1}=n,W=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(r,o);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.NodeType.Document,childNodes:[],compatMode:t.compatMode}:{type:e.NodeType.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.NodeType.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:W};case t.ELEMENT_NODE:return function(t,n){const{doc:r,blockClass:o,blockSelector:s,unblockSelector:i,inlineStylesheet:c,maskInputOptions:l={},maskAttributeFn:u,maskInputFn:d,dataURLOptions:y={},inlineImages:k,recordCanvas:N,keepIframeSrcFn:x,newlyAddedElement:C=!1,rootId:I,maskAllText:v,maskTextClass:M,unmaskTextClass:L,maskTextSelector:O,unmaskTextSelector:D}=n,F=function(e,t,n,r){try{if(r&&e.matches(r))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(t,o,s,i),W=function(e){if(e instanceof HTMLFormElement)return"form";const t=f(e.tagName);return S.test(t)?"div":t}(t);let P={};const j=t.attributes.length;for(let e=0;e<j;e++){const n=t.attributes[e];n.name&&!U(W,n.name,n.value)&&(P[n.name]=$(r,W,f(n.name),n.value,t,u))}if("link"===W&&c){const e=Array.from(r.styleSheets).find((e=>e.href===t.href));let n=null;e&&(n=a(e)),n&&(delete P.rel,delete P.href,P._cssText=A(n,e.href))}if("style"===W&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const e=a(t.sheet);e&&(P._cssText=A(e,_()))}if("input"===W||"textarea"===W||"select"===W||"option"===W){const e=t,n=T(e),r=b(e,h(W),n),o=e.checked;if("submit"!==n&&"button"!==n&&r){const t=B(e,M,O,L,D,m({type:n,tagName:h(W),maskInputOptions:l}));P.value=p({isMasked:t,element:e,value:r,maskInputFn:d})}o&&(P.checked=o)}"option"===W&&(t.selected&&!l.select?P.selected=!0:delete P.selected);if("canvas"===W&&N)if("2d"===t.__context)g(t)||(P.rr_dataURL=t.toDataURL(y.type,y.quality));else if(!("__context"in t)){const e=t.toDataURL(y.type,y.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(y.type,y.quality)&&(P.rr_dataURL=e)}if("img"===W&&k){w||(w=r.createElement("canvas"),E=w.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const o=()=>{e.removeEventListener("load",o);try{w.width=e.naturalWidth,w.height=e.naturalHeight,E.drawImage(e,0,0),P.rr_dataURL=w.toDataURL(y.type,y.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}n?P.crossOrigin=n:e.removeAttribute("crossorigin")};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}"audio"!==W&&"video"!==W||(P.rr_mediaState=t.paused?"paused":"played",P.rr_mediaCurrentTime=t.currentTime);C||(t.scrollLeft&&(P.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(P.rr_scrollTop=t.scrollTop));if(F){const{width:e,height:n}=t.getBoundingClientRect();P={class:P.class,rr_width:`${e}px`,rr_height:`${n}px`}}"iframe"!==W||x(P.src)||(t.contentDocument||(P.rr_src=P.src),delete P.src);let V;try{customElements.get(W)&&(V=!0)}catch(e){}return{type:e.NodeType.Element,tagName:W,attributes:P,childNodes:[],isSVG:R(t)||void 0,needBlock:F,rootId:I,isCustom:V}}(t,{doc:r,blockClass:s,blockSelector:i,unblockSelector:c,inlineStylesheet:x,maskAttributeFn:u,maskInputOptions:C,maskInputFn:v,dataURLOptions:M,inlineImages:L,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F,rootId:W,maskAllText:l,maskTextClass:d,unmaskTextClass:y,maskTextSelector:k,unmaskTextSelector:N});case t.TEXT_NODE:return function(t,n){const{maskAllText:r,maskTextClass:o,unmaskTextClass:s,maskTextSelector:i,unmaskTextSelector:c,maskTextFn:l,maskInputOptions:u,maskInputFn:d,rootId:f}=n,h=t.parentNode&&t.parentNode.tagName;let y=t.textContent;const g="STYLE"===h||void 0,k="SCRIPT"===h||void 0,T="TEXTAREA"===h||void 0;if(g&&y){try{t.nextSibling||t.previousSibling||t.parentNode.sheet?.cssRules&&(y=a(t.parentNode.sheet))}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}y=A(y,_())}k&&(y="SCRIPT_PLACEHOLDER");const b=B(t,o,i,s,c,r);g||k||T||!y||!b||(y=l?l(y):y.replace(/[\S]/g,"*"));T&&y&&(u.textarea||b)&&(y=d?d(y,t.parentNode):y.replace(/[\S]/g,"*"));if("OPTION"===h&&y){y=p({isMasked:B(t,o,i,s,c,m({type:null,tagName:h,maskInputOptions:u})),element:t,value:y,maskInputFn:d})}return{type:e.NodeType.Text,textContent:y||"",isStyle:g,rootId:f}}(t,{maskAllText:l,maskTextClass:d,unmaskTextClass:y,maskTextSelector:k,unmaskTextSelector:N,maskTextFn:I,maskInputOptions:C,maskInputFn:v,rootId:W});case t.CDATA_SECTION_NODE:return{type:e.NodeType.CDATA,textContent:"",rootId:W};case t.COMMENT_NODE:return{type:e.NodeType.Comment,textContent:t.textContent||"",rootId:W};default:return!1}}function G(e){return null==e?"":e.toLowerCase()}function H(t,s){const{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:d,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:y=!1,inlineStylesheet:g=!0,maskInputOptions:k={},maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w={},inlineImages:E=!1,recordCanvas:I=!1,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L=5e3,onStylesheetLoad:A,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:D=(()=>!1),newlyAddedElement:F=!1}=s;let{preserveWhiteSpace:R=!0}=s;const _=V(t,{doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:d,unblockSelector:u,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,dataURLOptions:w,inlineImages:E,recordCanvas:I,keepIframeSrcFn:D,newlyAddedElement:F});if(!_)return console.warn(t,"not serialized"),null;let $;$=i.hasNode(t)?i.getId(t):!function(t,n){if(n.comment&&t.type===e.NodeType.Comment)return!0;if(t.type===e.NodeType.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel||"modulepreload"===t.attributes.rel)&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(G(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===G(t.attributes.name)||"icon"===G(t.attributes.rel)||"apple-touch-icon"===G(t.attributes.rel)||"shortcut icon"===G(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&G(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(G(t.attributes.property).match(/^(og|twitter|fb):/)||G(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===G(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===G(t.attributes.name)||"googlebot"===G(t.attributes.name)||"bingbot"===G(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===G(t.attributes.name)||"generator"===G(t.attributes.name)||"framework"===G(t.attributes.name)||"publisher"===G(t.attributes.name)||"progid"===G(t.attributes.name)||G(t.attributes.property).match(/^article:/)||G(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===G(t.attributes.name)||"yandex-verification"===G(t.attributes.name)||"csrf-token"===G(t.attributes.name)||"p:domain_verify"===G(t.attributes.name)||"verify-v1"===G(t.attributes.name)||"verification"===G(t.attributes.name)||"shopify-checkout-api-token"===G(t.attributes.name)))return!0}}return!1}(_,S)&&(R||_.type!==e.NodeType.Text||_.isStyle||_.textContent.replace(/^\s+|\s+$/gm,"").length)?C():x;const U=Object.assign(_,{id:$});if(i.add(t,U),$===x)return null;v&&v(t);let W=!y;if(U.type===e.NodeType.Element){W=W&&!U.needBlock,delete U.needBlock;const e=t.shadowRoot;e&&o(e)&&(U.isShadowHost=!0)}if((U.type===e.NodeType.Document||U.type===e.NodeType.Element)&&W){S.headWhitespace&&U.type===e.NodeType.Element&&"head"===U.tagName&&(R=!1);const r={doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:d,unblockSelector:u,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:y,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w,inlineImages:E,recordCanvas:I,preserveWhiteSpace:R,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D};for(const e of Array.from(t.childNodes)){const t=H(e,r);t&&U.childNodes.push(t)}if(n(t)&&t.shadowRoot)for(const e of Array.from(t.shadowRoot.childNodes)){const n=H(e,r);n&&(o(t.shadowRoot)&&(n.isShadow=!0),U.childNodes.push(n))}}return t.parentNode&&r(t.parentNode)&&o(t.parentNode)&&(U.isShadow=!0),U.type===e.NodeType.Element&&"iframe"===U.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let o,s=!1;try{o=r.document.readyState}catch(e){return}if("complete"!==o){const r=setTimeout((()=>{s||(t(),s=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),s=!0,t()}))}const a="about:blank";if(r.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(t,(()=>{const e=t.contentDocument;if(e&&M){const n=H(e,{doc:e,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:d,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w,inlineImages:E,recordCanvas:I,preserveWhiteSpace:R,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});n&&M(t,n)}}),L),U.type===e.NodeType.Element&&"link"===U.tagName&&"stylesheet"===U.attributes.rel&&function(e,t,n){let r,o=!1;try{r=e.sheet}catch(e){return}if(r)return;const s=setTimeout((()=>{o||(t(),o=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(s),o=!0,t()}))}(t,(()=>{if(A){const e=H(t,{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:d,maskTextClass:m,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:g,maskInputOptions:k,maskAttributeFn:T,maskTextFn:b,maskInputFn:N,slimDOMOptions:S,dataURLOptions:w,inlineImages:E,recordCanvas:I,preserveWhiteSpace:R,onSerialize:v,onIframeLoad:M,iframeLoadTimeout:L,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});e&&A(t,e)}}),O),U}const z=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function q(e,t={}){let n=1,r=1;function o(e){const t=e.match(/\n/g);t&&(n+=t.length);const o=e.lastIndexOf("\n");r=-1===o?r+e.length:e.length-o}function s(){const e={line:n,column:r};return t=>(t.position=new a(e),p(),t)}class a{constructor(e){this.start=e,this.end={line:n,column:r},this.source=t.source}}a.prototype.content=e;const i=[];function c(o){const s=new Error(`${t.source||""}:${n}:${r}: ${o}`);if(s.reason=o,s.filename=t.source,s.line=n,s.column=r,s.source=e,!t.silent)throw s;i.push(s)}function l(){return m(/^{\s*/)}function u(){return m(/^}/)}function d(){let t;const n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=C()||w());)t&&(n.push(t),f(n));return n}function m(t){const n=t.exec(e);if(!n)return;const r=n[0];return o(r),e=e.slice(r.length),n}function p(){m(/^\s*/)}function f(e=[]){let t;for(;t=h();)t&&e.push(t),t=h();return e}function h(){const t=s();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const a=e.slice(2,n-2);return r+=2,o(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}function y(){const e=m(/^([^{]+)/);if(e)return Y(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,""))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function g(){const e=s(),t=m(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=Y(t[0]);if(!m(/^:\s*/))return c("property missing ':'");const r=m(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),o=e({type:"declaration",property:n.replace(z,""),value:r?Y(r[0]).replace(z,""):""});return m(/^[;\s]*/),o}function k(){const e=[];if(!l())return c("missing '{'");let t;for(f(e);t=g();)!1!==t&&(e.push(t),f(e)),t=g();return u()?e:c("missing '}'")}function T(){let e;const t=[],n=s();for(;e=m(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),m(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:k()})}const b=x("import"),N=x("charset"),S=x("namespace");function x(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=s(),r=m(t);if(!r)return;const o={type:e};return o[e]=r[1].trim(),n(o)}}function C(){if("@"===e[0])return function(){const e=s();let t=m(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=m(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const r=t[1];if(!l())return c("@keyframes missing '{'");let o,a=f();for(;o=T();)a.push(o),a=a.concat(f());return u()?e({type:"keyframes",name:r,vendor:n,keyframes:a}):c("@keyframes missing '}'")}()||function(){const e=s(),t=m(/^@media *([^{]+)/);if(!t)return;const n=Y(t[1]);if(!l())return c("@media missing '{'");const r=f().concat(d());return u()?e({type:"media",media:n,rules:r}):c("@media missing '}'")}()||function(){const e=s(),t=m(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:Y(t[1]),media:Y(t[2])})}()||function(){const e=s(),t=m(/^@supports *([^{]+)/);if(!t)return;const n=Y(t[1]);if(!l())return c("@supports missing '{'");const r=f().concat(d());return u()?e({type:"supports",supports:n,rules:r}):c("@supports missing '}'")}()||b()||N()||S()||function(){const e=s(),t=m(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=Y(t[1]),r=Y(t[2]);if(!l())return c("@document missing '{'");const o=f().concat(d());return u()?e({type:"document",document:r,vendor:n,rules:o}):c("@document missing '}'")}()||function(){const e=s();if(!m(/^@page */))return;const t=y()||[];if(!l())return c("@page missing '{'");let n,r=f();for(;n=g();)r.push(n),r=r.concat(f());return u()?e({type:"page",selectors:t,declarations:r}):c("@page missing '}'")}()||function(){const e=s();if(!m(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=f().concat(d());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=s();if(!m(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=f();for(;t=g();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function w(){const e=s(),t=y();return t?(f(),e({type:"rule",selectors:t,declarations:k()})):c("selector missing")}return X(function(){const e=d();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:i}}}())}function Y(e){return e?e.replace(/^\s+|\s+$/g,""):""}function X(e,t){const n=e&&"string"==typeof e.type,r=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{X(e,r)})):n&&"object"==typeof n&&X(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const J={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"};const K=/([^\\]):hover/,Q=new RegExp(K.source,"g");function Z(e,t){const n=t?.stylesWithHoverClass.get(e);if(n)return n;if(e.length>=1e6)return e;const r=q(e,{silent:!0});if(!r.stylesheet)return e;const o=[];if(r.stylesheet.rules.forEach((e=>{"selectors"in e&&(e.selectors||[]).forEach((e=>{K.test(e)&&o.push(e)}))})),0===o.length)return e;const s=new RegExp(o.filter(((e,t)=>o.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("|"),"g"),a=e.replace(s,(e=>{const t=e.replace(Q,"$1.\\:hover");return`${e}, ${t}`}));return t?.stylesWithHoverClass.set(e,a),a}function ee(t,n){const{doc:r,hackCss:o,cache:s}=n;switch(t.type){case e.NodeType.Document:return r.implementation.createDocument(null,"",null);case e.NodeType.DocumentType:return r.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.NodeType.Element:{const e=function(e){let t=J[e.tagName]?J[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);let n;t.isSVG?n=r.createElementNS("http://www.w3.org/2000/svg",e):(t.isCustom&&r.defaultView?.customElements&&!r.defaultView.customElements.get(t.tagName)&&r.defaultView.customElements.define(t.tagName,class extends r.defaultView.HTMLElement{}),n=r.createElement(e));const a={};for(const i in t.attributes){if(!Object.prototype.hasOwnProperty.call(t.attributes,i))continue;let c=t.attributes[i];if("option"===e&&"selected"===i&&!1===c)continue;if(null===c)continue;if(!0===c&&(c=""),i.startsWith("rr_")){a[i]=c;continue}const l="textarea"===e&&"value"===i,u="style"===e&&"_cssText"===i;if(u&&o&&"string"==typeof c&&(c=Z(c,s)),!l&&!u||"string"!=typeof c)try{if(t.isSVG&&"xlink:href"===i)n.setAttributeNS("http://www.w3.org/1999/xlink",i,c.toString());else if("onload"===i||"onclick"===i||"onmouse"===i.substring(0,7))n.setAttribute("_"+i,c.toString());else{if("meta"===e&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===i){n.setAttribute("csp-content",c.toString());continue}("link"!==e||"preload"!==t.attributes.rel&&"modulepreload"!==t.attributes.rel||"script"!==t.attributes.as)&&("link"===e&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===e&&t.attributes.srcset&&t.attributes.rr_dataURL?n.setAttribute("rrweb-original-srcset",t.attributes.srcset):n.setAttribute(i,c.toString())))}}catch(e){}else{const e=r.createTextNode(c);for(const e of Array.from(n.childNodes))e.nodeType===n.TEXT_NODE&&n.removeChild(e);n.appendChild(e)}}for(const r in a){const o=a[r];if("canvas"===e&&"rr_dataURL"===r){const e=document.createElement("img");e.onload=()=>{const t=n.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=o.toString(),n.RRNodeType&&(n.rr_dataURL=o.toString())}else if("img"===e&&"rr_dataURL"===r){const e=n;e.currentSrc.startsWith("data:")||(e.setAttribute("rrweb-original-src",t.attributes.src),e.src=o.toString())}if("rr_width"===r)n.style.setProperty("width",o.toString());else if("rr_height"===r)n.style.setProperty("height",o.toString());else if("rr_mediaCurrentTime"===r&&"number"==typeof o)n.currentTime=o;else if("rr_mediaState"===r)switch(o){case"played":n.play().catch((e=>console.warn("media playback error",e)));break;case"paused":n.pause()}}if(t.isShadowHost)if(n.shadowRoot)for(;n.shadowRoot.firstChild;)n.shadowRoot.removeChild(n.shadowRoot.firstChild);else n.attachShadow({mode:"open"});return n}case e.NodeType.Text:return r.createTextNode(t.isStyle&&o?Z(t.textContent,s):t.textContent);case e.NodeType.CDATA:return r.createCDATASection(t.textContent);case e.NodeType.Comment:return r.createComment(t.textContent);default:return null}}function te(t,r){const{doc:o,mirror:s,skipChild:a=!1,hackCss:i=!0,afterAppend:c,cache:l}=r;if(s.has(t.id)){const e=s.getNode(t.id);if(k(s.getMeta(e),t))return s.getNode(t.id)}let u=ee(t,{doc:o,hackCss:i,cache:l});if(!u)return null;if(t.rootId&&s.getNode(t.rootId)!==o&&s.replace(t.rootId,o),t.type===e.NodeType.Document&&(o.close(),o.open(),"BackCompat"===t.compatMode&&t.childNodes&&t.childNodes[0].type!==e.NodeType.DocumentType&&(t.childNodes[0].type===e.NodeType.Element&&"xmlns"in t.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===t.childNodes[0].attributes.xmlns?o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):o.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=o),s.add(u,t),(t.type===e.NodeType.Document||t.type===e.NodeType.Element)&&!a)for(const r of t.childNodes){const a=te(r,{doc:o,mirror:s,skipChild:!1,hackCss:i,afterAppend:c,cache:l});if(a){if(r.isShadow&&n(u)&&u.shadowRoot)u.shadowRoot.appendChild(a);else if(t.type===e.NodeType.Document&&r.type==e.NodeType.Element){const e=a;let t=null;e.childNodes.forEach((e=>{"BODY"===e.nodeName&&(t=e)})),t?(e.removeChild(t),u.appendChild(a),e.appendChild(t)):u.appendChild(a)}else u.appendChild(a);c&&c(a,r.id)}else console.warn("Failed to rebuild",r)}return u}return e.IGNORED_NODE=x,e.Mirror=d,e.addHoverClass=Z,e.buildNodeWithSN=te,e.classMatchesRegex=function(e,t,n){return!!e&&(n?P(e,(e=>W(e,t)))>=0:e.nodeType===e.ELEMENT_NODE&&W(e,t))},e.cleanupSnapshot=function(){N=1},e.createCache=function(){return{stylesWithHoverClass:new Map}},e.createMatchPredicate=j,e.createMirror=function(){return new d},e.distanceToMatch=P,e.escapeImportStatement=s,e.fixSafariColons=c,e.genId=C,e.getInputType=T,e.getInputValue=b,e.ignoreAttribute=U,e.is2DCanvasBlank=g,e.isCSSImportRule=l,e.isCSSStyleRule=u,e.isElement=n,e.isNativeShadowDom=o,e.isNodeMetaEqual=k,e.isShadowRoot=r,e.maskInputValue=p,e.needMaskingText=B,e.rebuild=function(t,n){const{doc:r,onVisit:o,hackCss:s=!0,afterAppend:a,cache:i,mirror:c=new d}=n,l=te(t,{doc:r,mirror:c,skipChild:!1,hackCss:s,afterAppend:a,cache:i});return function(e,t){for(const r of e.getIds())e.has(r)&&(n=e.getNode(r),t(n));var n}(c,(t=>{o&&o(t),function(t,n){const r=n.getMeta(t);if(r?.type!==e.NodeType.Element)return;const o=t;for(const e in r.attributes){if(!Object.prototype.hasOwnProperty.call(r.attributes,e)||!e.startsWith("rr_"))continue;const t=r.attributes[e];"rr_scrollLeft"===e&&(o.scrollLeft=t),"rr_scrollTop"===e&&(o.scrollTop=t)}}(t,c)})),l},e.serializeNodeWithId=H,e.shouldMaskInput=m,e.snapshot=function(e,t){const{mirror:n=new d,blockClass:r="rr-block",blockSelector:o=null,unblockSelector:s=null,maskAllText:a=!1,maskTextClass:i="rr-mask",unmaskTextClass:c=null,maskTextSelector:l=null,unmaskTextSelector:u=null,inlineStylesheet:m=!0,inlineImages:p=!1,recordCanvas:f=!1,maskAllInputs:h=!1,maskAttributeFn:y,maskTextFn:g,maskInputFn:k,slimDOM:T=!1,dataURLOptions:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:x,iframeLoadTimeout:C,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:I=(()=>!1)}=t||{};return H(e,{doc:e,mirror:n,blockClass:r,blockSelector:o,unblockSelector:s,maskAllText:a,maskTextClass:i,unmaskTextClass:c,maskTextSelector:l,unmaskTextSelector:u,skipChild:!1,inlineStylesheet:m,maskInputOptions:!0===h?{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}:!1===h?{}:h,maskAttributeFn:y,maskTextFn:g,maskInputFn:k,slimDOMOptions:!0===T||"all"===T?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===T,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===T?{}:T,dataURLOptions:b,inlineImages:p,recordCanvas:f,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:x,iframeLoadTimeout:C,onStylesheetLoad:w,stylesheetLoadTimeout:E,keepIframeSrcFn:I,newlyAddedElement:!1})},e.stringifyRule=i,e.stringifyStylesheet=a,e.toLowerCase=f,e.toUpperCase=h,e.transformAttribute=$,e.visitSnapshot=function(t,n){!function t(r){n(r),r.type!==e.NodeType.Document&&r.type!==e.NodeType.Element||r.childNodes.forEach(t)}(t)},Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
@@ -1,2 +0,2 @@ | ||
var e;function t(e){return e.nodeType===e.ELEMENT_NODE}function n(e){const t=e?.host;return Boolean(t?.shadowRoot===e)}function r(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function s(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function o(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,a).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function a(e){let t;if(c(e))try{t=o(e.styleSheet)||s(e)}catch(e){}else if(l(e)&&e.selectorText.includes(":"))return i(e.cssText);return t||e.cssText}function i(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function c(e){return"styleSheet"in e}function l(e){return"selectorText"in e}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));class u{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){if(!e)return-1;const t=this.getMeta(e)?.id;return t??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function m(){return new u}function d({maskInputOptions:e,tagName:t,type:n}){return"OPTION"===t&&(t="SELECT"),Boolean(e[t.toLowerCase()]||n&&e[n]||"password"===n||"INPUT"===t&&!n&&e.text)}function p({isMasked:e,element:t,value:n,maskInputFn:r}){let s=n||"";return e?(r&&(s=r(s,t)),"*".repeat(s.length)):s}function f(e){return e.toLowerCase()}function h(e){return e.toUpperCase()}const g="__rrweb_original__";function k(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const s=t.getImageData,o=g in s?s[g]:s;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0}function y(t,n){return!(!t||!n||t.type!==n.type)&&(t.type===e.Document?t.compatMode===n.compatMode:t.type===e.DocumentType?t.name===n.name&&t.publicId===n.publicId&&t.systemId===n.systemId:t.type===e.Comment||t.type===e.Text||t.type===e.CDATA?t.textContent===n.textContent:t.type===e.Element&&(t.tagName===n.tagName&&JSON.stringify(t.attributes)===JSON.stringify(n.attributes)&&t.isSVG===n.isSVG&&t.needBlock===n.needBlock))}function T(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?f(t):null}function b(e,t,n){return"INPUT"!==t||"radio"!==n&&"checkbox"!==n?e.value:e.getAttribute("value")||""}let x=1;const S=new RegExp("[^a-z0-9-_:]"),C=-2;function w(){return x++}let N,E;const I=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,v=/^(?:[a-z+]+:)?\/\//i,L=/^www\..*/i,M=/^(data:)([^,]*),(.*)/i;function A(e,t){return(e||"").replace(I,((e,n,r,s,o,a)=>{const i=r||o||a,c=n||s||"";if(!i)return e;if(v.test(i)||L.test(i))return`url(${c}${i}${c})`;if(M.test(i))return`url(${c}${i}${c})`;if("/"===i[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+i}${c})`;const l=t.split("/"),u=i.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const O=/^[^ \t\n\r\u000c]+/,D=/^[, \t\n\r\u000c]+/;function F(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function _(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function R(){const e=document.createElement("a");return e.href="",e.href}function $(e,t,n,r,s,o){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?F(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const s=e.exec(t.substring(n));return s?(r=s[0],n+=r.length,r):""}const s=[];for(;r(D),!(n>=t.length);){let o=r(O);if(","===o.slice(-1))o=F(e,o.substring(0,o.length-1)),s.push(o);else{let r="";o=F(e,o);let a=!1;for(;;){const e=t.charAt(n);if(""===e){s.push((o+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,s.push((o+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return s.join(", ")}(e,r):"style"===n?A(r,R()):"object"===t&&"data"===n?F(e,r):"function"==typeof o?o(n,r,s):r:F(e,r):r}function U(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function W(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function P(e,t,n){return!!e&&(n?j(e,(e=>W(e,t)))>=0:e.nodeType===e.ELEMENT_NODE&&W(e,t))}function j(e,t,n=1/0,r=0){return e?e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:j(e.parentNode,t,n,r+1):-1}function B(e,t){return n=>{const r=n;if(null===r)return!1;try{if(e)if("string"==typeof e){if(r.matches(`.${e}`))return!0}else if(W(r,e))return!0;return!(!t||!r.matches(t))}catch{return!1}}}function G(e,t,n,r,s,o){try{const a=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===a)return!1;let i=-1,c=-1;if(o){if(c=j(a,B(r,s)),c<0)return!0;i=j(a,B(t,n),c>=0?c:1/0)}else{if(i=j(a,B(t,n)),i<0)return!1;c=j(a,B(r,s),i>=0?i:1/0)}return i>=0?!(c>=0)||i<=c:!(c>=0)&&!!o}catch(e){}return!!o}function H(t,n){const{doc:r,mirror:s,blockClass:a,blockSelector:i,unblockSelector:c,maskAllText:l,maskAttributeFn:u,maskTextClass:m,unmaskTextClass:g,maskTextSelector:y,unmaskTextSelector:x,inlineStylesheet:C,maskInputOptions:w={},maskTextFn:I,maskInputFn:v,dataURLOptions:L={},inlineImages:M,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F=!1}=n,W=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(r,s);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode}:{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:W};case t.ELEMENT_NODE:return function(t,n){const{doc:r,blockClass:s,blockSelector:a,unblockSelector:i,inlineStylesheet:c,maskInputOptions:l={},maskAttributeFn:u,maskInputFn:m,dataURLOptions:g={},inlineImages:y,recordCanvas:x,keepIframeSrcFn:C,newlyAddedElement:w=!1,rootId:I,maskAllText:v,maskTextClass:L,unmaskTextClass:M,maskTextSelector:O,unmaskTextSelector:D}=n,F=function(e,t,n,r){try{if(r&&e.matches(r))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(t,s,a,i),W=function(e){if(e instanceof HTMLFormElement)return"form";const t=f(e.tagName);return S.test(t)?"div":t}(t);let P={};const j=t.attributes.length;for(let e=0;e<j;e++){const n=t.attributes[e];U(W,n.name,n.value)||(P[n.name]=$(r,W,f(n.name),n.value,t,u))}if("link"===W&&c){const e=Array.from(r.styleSheets).find((e=>e.href===t.href));let n=null;e&&(n=o(e)),n&&(delete P.rel,delete P.href,P._cssText=A(n,e.href))}if("style"===W&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const e=o(t.sheet);e&&(P._cssText=A(e,R()))}if("input"===W||"textarea"===W||"select"===W||"option"===W){const e=t,n=T(e),r=b(e,h(W),n),s=e.checked;if("submit"!==n&&"button"!==n&&r){const t=G(e,L,O,M,D,d({type:n,tagName:h(W),maskInputOptions:l}));P.value=p({isMasked:t,element:e,value:r,maskInputFn:m})}s&&(P.checked=s)}"option"===W&&(t.selected&&!l.select?P.selected=!0:delete P.selected);if("canvas"===W&&x)if("2d"===t.__context)k(t)||(P.rr_dataURL=t.toDataURL(g.type,g.quality));else if(!("__context"in t)){const e=t.toDataURL(g.type,g.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(g.type,g.quality)&&(P.rr_dataURL=e)}if("img"===W&&y){N||(N=r.createElement("canvas"),E=N.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const s=()=>{e.removeEventListener("load",s);try{N.width=e.naturalWidth,N.height=e.naturalHeight,E.drawImage(e,0,0),P.rr_dataURL=N.toDataURL(g.type,g.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}n?P.crossOrigin=n:e.removeAttribute("crossorigin")};e.complete&&0!==e.naturalWidth?s():e.addEventListener("load",s)}"audio"!==W&&"video"!==W||(P.rr_mediaState=t.paused?"paused":"played",P.rr_mediaCurrentTime=t.currentTime);w||(t.scrollLeft&&(P.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(P.rr_scrollTop=t.scrollTop));if(F){const{width:e,height:n}=t.getBoundingClientRect();P={class:P.class,rr_width:`${e}px`,rr_height:`${n}px`}}"iframe"!==W||C(P.src)||(t.contentDocument||(P.rr_src=P.src),delete P.src);let B;try{customElements.get(W)&&(B=!0)}catch(e){}return{type:e.Element,tagName:W,attributes:P,childNodes:[],isSVG:_(t)||void 0,needBlock:F,rootId:I,isCustom:B}}(t,{doc:r,blockClass:a,blockSelector:i,unblockSelector:c,inlineStylesheet:C,maskAttributeFn:u,maskInputOptions:w,maskInputFn:v,dataURLOptions:L,inlineImages:M,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F,rootId:W,maskAllText:l,maskTextClass:m,unmaskTextClass:g,maskTextSelector:y,unmaskTextSelector:x});case t.TEXT_NODE:return function(t,n){const{maskAllText:r,maskTextClass:s,unmaskTextClass:a,maskTextSelector:i,unmaskTextSelector:c,maskTextFn:l,maskInputOptions:u,maskInputFn:m,rootId:f}=n,h=t.parentNode&&t.parentNode.tagName;let g=t.textContent;const k="STYLE"===h||void 0,y="SCRIPT"===h||void 0,T="TEXTAREA"===h||void 0;if(k&&g){try{t.nextSibling||t.previousSibling||t.parentNode.sheet?.cssRules&&(g=o(t.parentNode.sheet))}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}g=A(g,R())}y&&(g="SCRIPT_PLACEHOLDER");const b=G(t,s,i,a,c,r);k||y||T||!g||!b||(g=l?l(g):g.replace(/[\S]/g,"*"));T&&g&&(u.textarea||b)&&(g=m?m(g,t.parentNode):g.replace(/[\S]/g,"*"));if("OPTION"===h&&g){g=p({isMasked:G(t,s,i,a,c,d({type:null,tagName:h,maskInputOptions:u})),element:t,value:g,maskInputFn:m})}return{type:e.Text,textContent:g||"",isStyle:k,rootId:f}}(t,{maskAllText:l,maskTextClass:m,unmaskTextClass:g,maskTextSelector:y,unmaskTextSelector:x,maskTextFn:I,maskInputOptions:w,maskInputFn:v,rootId:W});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:W};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:W};default:return!1}}function V(e){return null==e?"":e.toLowerCase()}function z(s,o){const{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:m,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:g=!1,inlineStylesheet:k=!0,maskInputOptions:y={},maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N={},inlineImages:E=!1,recordCanvas:I=!1,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M=5e3,onStylesheetLoad:A,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:D=(()=>!1),newlyAddedElement:F=!1}=o;let{preserveWhiteSpace:_=!0}=o;const R=H(s,{doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:m,unblockSelector:u,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,dataURLOptions:N,inlineImages:E,recordCanvas:I,keepIframeSrcFn:D,newlyAddedElement:F});if(!R)return console.warn(s,"not serialized"),null;let $;$=i.hasNode(s)?i.getId(s):!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel||"modulepreload"===t.attributes.rel)&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(V(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===V(t.attributes.name)||"icon"===V(t.attributes.rel)||"apple-touch-icon"===V(t.attributes.rel)||"shortcut icon"===V(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&V(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(V(t.attributes.property).match(/^(og|twitter|fb):/)||V(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===V(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===V(t.attributes.name)||"googlebot"===V(t.attributes.name)||"bingbot"===V(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===V(t.attributes.name)||"generator"===V(t.attributes.name)||"framework"===V(t.attributes.name)||"publisher"===V(t.attributes.name)||"progid"===V(t.attributes.name)||V(t.attributes.property).match(/^article:/)||V(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===V(t.attributes.name)||"yandex-verification"===V(t.attributes.name)||"csrf-token"===V(t.attributes.name)||"p:domain_verify"===V(t.attributes.name)||"verify-v1"===V(t.attributes.name)||"verification"===V(t.attributes.name)||"shopify-checkout-api-token"===V(t.attributes.name)))return!0}}return!1}(R,S)&&(_||R.type!==e.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?w():C;const U=Object.assign(R,{id:$});if(i.add(s,U),$===C)return null;v&&v(s);let W=!g;if(U.type===e.Element){W=W&&!U.needBlock,delete U.needBlock;const e=s.shadowRoot;e&&r(e)&&(U.isShadowHost=!0)}if((U.type===e.Document||U.type===e.Element)&&W){S.headWhitespace&&U.type===e.Element&&"head"===U.tagName&&(_=!1);const n={doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:m,unblockSelector:u,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:g,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N,inlineImages:E,recordCanvas:I,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D};for(const e of Array.from(s.childNodes)){const t=z(e,n);t&&U.childNodes.push(t)}if(t(s)&&s.shadowRoot)for(const e of Array.from(s.shadowRoot.childNodes)){const t=z(e,n);t&&(r(s.shadowRoot)&&(t.isShadow=!0),U.childNodes.push(t))}}return s.parentNode&&n(s.parentNode)&&r(s.parentNode)&&(U.isShadow=!0),U.type===e.Element&&"iframe"===U.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let s,o=!1;try{s=r.document.readyState}catch(e){return}if("complete"!==s){const r=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),o=!0,t()}))}const a="about:blank";if(r.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(s,(()=>{const e=s.contentDocument;if(e&&L){const t=z(e,{doc:e,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:m,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N,inlineImages:E,recordCanvas:I,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});t&&L(s,t)}}),M),U.type===e.Element&&"link"===U.tagName&&"stylesheet"===U.attributes.rel&&function(e,t,n){let r,s=!1;try{r=e.sheet}catch(e){return}if(r)return;const o=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),s=!0,t()}))}(s,(()=>{if(A){const e=z(s,{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:m,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N,inlineImages:E,recordCanvas:I,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});e&&A(s,e)}}),O),U}function q(e,t){const{mirror:n=new u,blockClass:r="rr-block",blockSelector:s=null,unblockSelector:o=null,maskAllText:a=!1,maskTextClass:i="rr-mask",unmaskTextClass:c=null,maskTextSelector:l=null,unmaskTextSelector:m=null,inlineStylesheet:d=!0,inlineImages:p=!1,recordCanvas:f=!1,maskAllInputs:h=!1,maskAttributeFn:g,maskTextFn:k,maskInputFn:y,slimDOM:T=!1,dataURLOptions:b,preserveWhiteSpace:x,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:w,onStylesheetLoad:N,stylesheetLoadTimeout:E,keepIframeSrcFn:I=(()=>!1)}=t||{};return z(e,{doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:i,unmaskTextClass:c,maskTextSelector:l,unmaskTextSelector:m,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===h?{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}:!1===h?{}:h,maskAttributeFn:g,maskTextFn:k,maskInputFn:y,slimDOMOptions:!0===T||"all"===T?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===T,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===T?{}:T,dataURLOptions:b,inlineImages:p,recordCanvas:f,preserveWhiteSpace:x,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:w,onStylesheetLoad:N,stylesheetLoadTimeout:E,keepIframeSrcFn:I,newlyAddedElement:!1})}function Y(t,n){!function t(r){n(r),r.type!==e.Document&&r.type!==e.Element||r.childNodes.forEach(t)}(t)}function X(){x=1}const J=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function K(e,t={}){let n=1,r=1;function s(e){const t=e.match(/\n/g);t&&(n+=t.length);const s=e.lastIndexOf("\n");r=-1===s?r+e.length:e.length-s}function o(){const e={line:n,column:r};return t=>(t.position=new a(e),p(),t)}class a{constructor(e){this.start=e,this.end={line:n,column:r},this.source=t.source}}a.prototype.content=e;const i=[];function c(s){const o=new Error(`${t.source||""}:${n}:${r}: ${s}`);if(o.reason=s,o.filename=t.source,o.line=n,o.column=r,o.source=e,!t.silent)throw o;i.push(o)}function l(){return d(/^{\s*/)}function u(){return d(/^}/)}function m(){let t;const n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=w()||N());)t&&(n.push(t),f(n));return n}function d(t){const n=t.exec(e);if(!n)return;const r=n[0];return s(r),e=e.slice(r.length),n}function p(){d(/^\s*/)}function f(e=[]){let t;for(;t=h();)t&&e.push(t),t=h();return e}function h(){const t=o();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const a=e.slice(2,n-2);return r+=2,s(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}function g(){const e=d(/^([^{]+)/);if(e)return Q(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,""))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function k(){const e=o(),t=d(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=Q(t[0]);if(!d(/^:\s*/))return c("property missing ':'");const r=d(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),s=e({type:"declaration",property:n.replace(J,""),value:r?Q(r[0]).replace(J,""):""});return d(/^[;\s]*/),s}function y(){const e=[];if(!l())return c("missing '{'");let t;for(f(e);t=k();)!1!==t&&(e.push(t),f(e)),t=k();return u()?e:c("missing '}'")}function T(){let e;const t=[],n=o();for(;e=d(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),d(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:y()})}const b=C("import"),x=C("charset"),S=C("namespace");function C(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=o(),r=d(t);if(!r)return;const s={type:e};return s[e]=r[1].trim(),n(s)}}function w(){if("@"===e[0])return function(){const e=o();let t=d(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=d(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const r=t[1];if(!l())return c("@keyframes missing '{'");let s,a=f();for(;s=T();)a.push(s),a=a.concat(f());return u()?e({type:"keyframes",name:r,vendor:n,keyframes:a}):c("@keyframes missing '}'")}()||function(){const e=o(),t=d(/^@media *([^{]+)/);if(!t)return;const n=Q(t[1]);if(!l())return c("@media missing '{'");const r=f().concat(m());return u()?e({type:"media",media:n,rules:r}):c("@media missing '}'")}()||function(){const e=o(),t=d(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:Q(t[1]),media:Q(t[2])})}()||function(){const e=o(),t=d(/^@supports *([^{]+)/);if(!t)return;const n=Q(t[1]);if(!l())return c("@supports missing '{'");const r=f().concat(m());return u()?e({type:"supports",supports:n,rules:r}):c("@supports missing '}'")}()||b()||x()||S()||function(){const e=o(),t=d(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=Q(t[1]),r=Q(t[2]);if(!l())return c("@document missing '{'");const s=f().concat(m());return u()?e({type:"document",document:r,vendor:n,rules:s}):c("@document missing '}'")}()||function(){const e=o();if(!d(/^@page */))return;const t=g()||[];if(!l())return c("@page missing '{'");let n,r=f();for(;n=k();)r.push(n),r=r.concat(f());return u()?e({type:"page",selectors:t,declarations:r}):c("@page missing '}'")}()||function(){const e=o();if(!d(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=f().concat(m());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=o();if(!d(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=f();for(;t=k();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function N(){const e=o(),t=g();return t?(f(),e({type:"rule",selectors:t,declarations:y()})):c("selector missing")}return Z(function(){const e=m();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:i}}}())}function Q(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Z(e,t){const n=e&&"string"==typeof e.type,r=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{Z(e,r)})):n&&"object"==typeof n&&Z(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const ee={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"};const te=/([^\\]):hover/,ne=new RegExp(te.source,"g");function re(e,t){const n=t?.stylesWithHoverClass.get(e);if(n)return n;if(e.length>=1e6)return e;const r=K(e,{silent:!0});if(!r.stylesheet)return e;const s=[];if(r.stylesheet.rules.forEach((e=>{"selectors"in e&&(e.selectors||[]).forEach((e=>{te.test(e)&&s.push(e)}))})),0===s.length)return e;const o=new RegExp(s.filter(((e,t)=>s.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("|"),"g"),a=e.replace(o,(e=>{const t=e.replace(ne,"$1.\\:hover");return`${e}, ${t}`}));return t?.stylesWithHoverClass.set(e,a),a}function se(){return{stylesWithHoverClass:new Map}}function oe(t,n){const{doc:r,hackCss:s,cache:o}=n;switch(t.type){case e.Document:return r.implementation.createDocument(null,"",null);case e.DocumentType:return r.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.Element:{const e=function(e){let t=ee[e.tagName]?ee[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);let n;t.isSVG?n=r.createElementNS("http://www.w3.org/2000/svg",e):(t.isCustom&&r.defaultView?.customElements&&!r.defaultView.customElements.get(t.tagName)&&r.defaultView.customElements.define(t.tagName,class extends r.defaultView.HTMLElement{}),n=r.createElement(e));const a={};for(const i in t.attributes){if(!Object.prototype.hasOwnProperty.call(t.attributes,i))continue;let c=t.attributes[i];if("option"===e&&"selected"===i&&!1===c)continue;if(null===c)continue;if(!0===c&&(c=""),i.startsWith("rr_")){a[i]=c;continue}const l="textarea"===e&&"value"===i,u="style"===e&&"_cssText"===i;if(u&&s&&"string"==typeof c&&(c=re(c,o)),!l&&!u||"string"!=typeof c)try{if(t.isSVG&&"xlink:href"===i)n.setAttributeNS("http://www.w3.org/1999/xlink",i,c.toString());else if("onload"===i||"onclick"===i||"onmouse"===i.substring(0,7))n.setAttribute("_"+i,c.toString());else{if("meta"===e&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===i){n.setAttribute("csp-content",c.toString());continue}("link"!==e||"preload"!==t.attributes.rel&&"modulepreload"!==t.attributes.rel||"script"!==t.attributes.as)&&("link"===e&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===e&&t.attributes.srcset&&t.attributes.rr_dataURL?n.setAttribute("rrweb-original-srcset",t.attributes.srcset):n.setAttribute(i,c.toString())))}}catch(e){}else{const e=r.createTextNode(c);for(const e of Array.from(n.childNodes))e.nodeType===n.TEXT_NODE&&n.removeChild(e);n.appendChild(e)}}for(const r in a){const s=a[r];if("canvas"===e&&"rr_dataURL"===r){const e=document.createElement("img");e.onload=()=>{const t=n.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=s.toString(),n.RRNodeType&&(n.rr_dataURL=s.toString())}else if("img"===e&&"rr_dataURL"===r){const e=n;e.currentSrc.startsWith("data:")||(e.setAttribute("rrweb-original-src",t.attributes.src),e.src=s.toString())}if("rr_width"===r)n.style.setProperty("width",s.toString());else if("rr_height"===r)n.style.setProperty("height",s.toString());else if("rr_mediaCurrentTime"===r&&"number"==typeof s)n.currentTime=s;else if("rr_mediaState"===r)switch(s){case"played":n.play().catch((e=>console.warn("media playback error",e)));break;case"paused":n.pause()}}if(t.isShadowHost)if(n.shadowRoot)for(;n.shadowRoot.firstChild;)n.shadowRoot.removeChild(n.shadowRoot.firstChild);else n.attachShadow({mode:"open"});return n}case e.Text:return r.createTextNode(t.isStyle&&s?re(t.textContent,o):t.textContent);case e.CDATA:return r.createCDATASection(t.textContent);case e.Comment:return r.createComment(t.textContent);default:return null}}function ae(n,r){const{doc:s,mirror:o,skipChild:a=!1,hackCss:i=!0,afterAppend:c,cache:l}=r;if(o.has(n.id)){const e=o.getNode(n.id);if(y(o.getMeta(e),n))return o.getNode(n.id)}let u=oe(n,{doc:s,hackCss:i,cache:l});if(!u)return null;if(n.rootId&&o.getNode(n.rootId)!==s&&o.replace(n.rootId,s),n.type===e.Document&&(s.close(),s.open(),"BackCompat"===n.compatMode&&n.childNodes&&n.childNodes[0].type!==e.DocumentType&&(n.childNodes[0].type===e.Element&&"xmlns"in n.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===n.childNodes[0].attributes.xmlns?s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=s),o.add(u,n),(n.type===e.Document||n.type===e.Element)&&!a)for(const r of n.childNodes){const a=ae(r,{doc:s,mirror:o,skipChild:!1,hackCss:i,afterAppend:c,cache:l});if(a){if(r.isShadow&&t(u)&&u.shadowRoot)u.shadowRoot.appendChild(a);else if(n.type===e.Document&&r.type==e.Element){const e=a;let t=null;e.childNodes.forEach((e=>{"BODY"===e.nodeName&&(t=e)})),t?(e.removeChild(t),u.appendChild(a),e.appendChild(t)):u.appendChild(a)}else u.appendChild(a);c&&c(a,r.id)}else console.warn("Failed to rebuild",r)}return u}function ie(t,n){const{doc:r,onVisit:s,hackCss:o=!0,afterAppend:a,cache:i,mirror:c=new u}=n,l=ae(t,{doc:r,mirror:c,skipChild:!1,hackCss:o,afterAppend:a,cache:i});return function(e,t){for(const r of e.getIds())e.has(r)&&(n=e.getNode(r),t(n));var n}(c,(t=>{s&&s(t),function(t,n){const r=n.getMeta(t);if(r?.type!==e.Element)return;const s=t;for(const e in r.attributes){if(!Object.prototype.hasOwnProperty.call(r.attributes,e)||!e.startsWith("rr_"))continue;const t=r.attributes[e];"rr_scrollLeft"===e&&(s.scrollLeft=t),"rr_scrollTop"===e&&(s.scrollTop=t)}}(t,c)})),l}export{C as IGNORED_NODE,u as Mirror,e as NodeType,re as addHoverClass,ae as buildNodeWithSN,P as classMatchesRegex,X as cleanupSnapshot,se as createCache,B as createMatchPredicate,m as createMirror,j as distanceToMatch,s as escapeImportStatement,i as fixSafariColons,w as genId,T as getInputType,b as getInputValue,U as ignoreAttribute,k as is2DCanvasBlank,c as isCSSImportRule,l as isCSSStyleRule,t as isElement,r as isNativeShadowDom,y as isNodeMetaEqual,n as isShadowRoot,p as maskInputValue,G as needMaskingText,ie as rebuild,z as serializeNodeWithId,d as shouldMaskInput,q as snapshot,a as stringifyRule,o as stringifyStylesheet,f as toLowerCase,h as toUpperCase,$ as transformAttribute,Y as visitSnapshot}; | ||
var e;function t(e){return e.nodeType===e.ELEMENT_NODE}function n(e){const t=e?.host;return Boolean(t?.shadowRoot===e)}function r(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function s(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function o(e){try{const n=e.rules||e.cssRules;return n?((t=Array.from(n,a).join("")).includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),t):null}catch(e){return null}var t}function a(e){let t;if(c(e))try{t=o(e.styleSheet)||s(e)}catch(e){}else if(l(e)&&e.selectorText.includes(":"))return i(e.cssText);return t||e.cssText}function i(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function c(e){return"styleSheet"in e}function l(e){return"selectorText"in e}!function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"}(e||(e={}));class u{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){if(!e)return-1;const t=this.getMeta(e)?.id;return t??-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function m(){return new u}function d({maskInputOptions:e,tagName:t,type:n}){return"OPTION"===t&&(t="SELECT"),Boolean(e[t.toLowerCase()]||n&&e[n]||"password"===n||"INPUT"===t&&!n&&e.text)}function p({isMasked:e,element:t,value:n,maskInputFn:r}){let s=n||"";return e?(r&&(s=r(s,t)),"*".repeat(s.length)):s}function f(e){return e.toLowerCase()}function h(e){return e.toUpperCase()}const g="__rrweb_original__";function k(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let r=0;r<e.height;r+=50){const s=t.getImageData,o=g in s?s[g]:s;if(new Uint32Array(o.call(t,n,r,Math.min(50,e.width-n),Math.min(50,e.height-r)).data.buffer).some((e=>0!==e)))return!1}return!0}function y(t,n){return!(!t||!n||t.type!==n.type)&&(t.type===e.Document?t.compatMode===n.compatMode:t.type===e.DocumentType?t.name===n.name&&t.publicId===n.publicId&&t.systemId===n.systemId:t.type===e.Comment||t.type===e.Text||t.type===e.CDATA?t.textContent===n.textContent:t.type===e.Element&&(t.tagName===n.tagName&&JSON.stringify(t.attributes)===JSON.stringify(n.attributes)&&t.isSVG===n.isSVG&&t.needBlock===n.needBlock))}function T(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?f(t):null}function b(e,t,n){return"INPUT"!==t||"radio"!==n&&"checkbox"!==n?e.value:e.getAttribute("value")||""}let x=1;const S=new RegExp("[^a-z0-9-_:]"),C=-2;function w(){return x++}let N,E;const I=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,v=/^(?:[a-z+]+:)?\/\//i,L=/^www\..*/i,M=/^(data:)([^,]*),(.*)/i;function A(e,t){return(e||"").replace(I,((e,n,r,s,o,a)=>{const i=r||o||a,c=n||s||"";if(!i)return e;if(v.test(i)||L.test(i))return`url(${c}${i}${c})`;if(M.test(i))return`url(${c}${i}${c})`;if("/"===i[0])return`url(${c}${function(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+i}${c})`;const l=t.split("/"),u=i.split("/");l.pop();for(const e of u)"."!==e&&(".."===e?l.pop():l.push(e));return`url(${c}${l.join("/")}${c})`}))}const O=/^[^ \t\n\r\u000c]+/,D=/^[, \t\n\r\u000c]+/;function F(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.href}function _(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function R(){const e=document.createElement("a");return e.href="",e.href}function $(e,t,n,r,s,o){return r?"src"===n||"href"===n&&("use"!==t||"#"!==r[0])||"xlink:href"===n&&"#"!==r[0]?F(e,r):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const s=e.exec(t.substring(n));return s?(r=s[0],n+=r.length,r):""}const s=[];for(;r(D),!(n>=t.length);){let o=r(O);if(","===o.slice(-1))o=F(e,o.substring(0,o.length-1)),s.push(o);else{let r="";o=F(e,o);let a=!1;for(;;){const e=t.charAt(n);if(""===e){s.push((o+r).trim());break}if(a)")"===e&&(a=!1);else{if(","===e){n+=1,s.push((o+r).trim());break}"("===e&&(a=!0)}r+=e,n+=1}}}return s.join(", ")}(e,r):"style"===n?A(r,R()):"object"===t&&"data"===n?F(e,r):"function"==typeof o?o(n,r,s):r:F(e,r):r}function U(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function W(e,t){for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!1}function P(e,t,n){return!!e&&(n?j(e,(e=>W(e,t)))>=0:e.nodeType===e.ELEMENT_NODE&&W(e,t))}function j(e,t,n=1/0,r=0){return e?e.nodeType!==e.ELEMENT_NODE||r>n?-1:t(e)?r:j(e.parentNode,t,n,r+1):-1}function B(e,t){return n=>{const r=n;if(null===r)return!1;try{if(e)if("string"==typeof e){if(r.matches(`.${e}`))return!0}else if(W(r,e))return!0;return!(!t||!r.matches(t))}catch{return!1}}}function G(e,t,n,r,s,o){try{const a=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===a)return!1;let i=-1,c=-1;if(o){if(c=j(a,B(r,s)),c<0)return!0;i=j(a,B(t,n),c>=0?c:1/0)}else{if(i=j(a,B(t,n)),i<0)return!1;c=j(a,B(r,s),i>=0?i:1/0)}return i>=0?!(c>=0)||i<=c:!(c>=0)&&!!o}catch(e){}return!!o}function H(t,n){const{doc:r,mirror:s,blockClass:a,blockSelector:i,unblockSelector:c,maskAllText:l,maskAttributeFn:u,maskTextClass:m,unmaskTextClass:g,maskTextSelector:y,unmaskTextSelector:x,inlineStylesheet:C,maskInputOptions:w={},maskTextFn:I,maskInputFn:v,dataURLOptions:L={},inlineImages:M,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F=!1}=n,W=function(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(r,s);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode}:{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:W};case t.ELEMENT_NODE:return function(t,n){const{doc:r,blockClass:s,blockSelector:a,unblockSelector:i,inlineStylesheet:c,maskInputOptions:l={},maskAttributeFn:u,maskInputFn:m,dataURLOptions:g={},inlineImages:y,recordCanvas:x,keepIframeSrcFn:C,newlyAddedElement:w=!1,rootId:I,maskAllText:v,maskTextClass:L,unmaskTextClass:M,maskTextSelector:O,unmaskTextSelector:D}=n,F=function(e,t,n,r){try{if(r&&e.matches(r))return!1;if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}if(n)return e.matches(n)}catch(e){}return!1}(t,s,a,i),W=function(e){if(e instanceof HTMLFormElement)return"form";const t=f(e.tagName);return S.test(t)?"div":t}(t);let P={};const j=t.attributes.length;for(let e=0;e<j;e++){const n=t.attributes[e];n.name&&!U(W,n.name,n.value)&&(P[n.name]=$(r,W,f(n.name),n.value,t,u))}if("link"===W&&c){const e=Array.from(r.styleSheets).find((e=>e.href===t.href));let n=null;e&&(n=o(e)),n&&(delete P.rel,delete P.href,P._cssText=A(n,e.href))}if("style"===W&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const e=o(t.sheet);e&&(P._cssText=A(e,R()))}if("input"===W||"textarea"===W||"select"===W||"option"===W){const e=t,n=T(e),r=b(e,h(W),n),s=e.checked;if("submit"!==n&&"button"!==n&&r){const t=G(e,L,O,M,D,d({type:n,tagName:h(W),maskInputOptions:l}));P.value=p({isMasked:t,element:e,value:r,maskInputFn:m})}s&&(P.checked=s)}"option"===W&&(t.selected&&!l.select?P.selected=!0:delete P.selected);if("canvas"===W&&x)if("2d"===t.__context)k(t)||(P.rr_dataURL=t.toDataURL(g.type,g.quality));else if(!("__context"in t)){const e=t.toDataURL(g.type,g.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(g.type,g.quality)&&(P.rr_dataURL=e)}if("img"===W&&y){N||(N=r.createElement("canvas"),E=N.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const s=()=>{e.removeEventListener("load",s);try{N.width=e.naturalWidth,N.height=e.naturalHeight,E.drawImage(e,0,0),P.rr_dataURL=N.toDataURL(g.type,g.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}n?P.crossOrigin=n:e.removeAttribute("crossorigin")};e.complete&&0!==e.naturalWidth?s():e.addEventListener("load",s)}"audio"!==W&&"video"!==W||(P.rr_mediaState=t.paused?"paused":"played",P.rr_mediaCurrentTime=t.currentTime);w||(t.scrollLeft&&(P.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(P.rr_scrollTop=t.scrollTop));if(F){const{width:e,height:n}=t.getBoundingClientRect();P={class:P.class,rr_width:`${e}px`,rr_height:`${n}px`}}"iframe"!==W||C(P.src)||(t.contentDocument||(P.rr_src=P.src),delete P.src);let B;try{customElements.get(W)&&(B=!0)}catch(e){}return{type:e.Element,tagName:W,attributes:P,childNodes:[],isSVG:_(t)||void 0,needBlock:F,rootId:I,isCustom:B}}(t,{doc:r,blockClass:a,blockSelector:i,unblockSelector:c,inlineStylesheet:C,maskAttributeFn:u,maskInputOptions:w,maskInputFn:v,dataURLOptions:L,inlineImages:M,recordCanvas:O,keepIframeSrcFn:D,newlyAddedElement:F,rootId:W,maskAllText:l,maskTextClass:m,unmaskTextClass:g,maskTextSelector:y,unmaskTextSelector:x});case t.TEXT_NODE:return function(t,n){const{maskAllText:r,maskTextClass:s,unmaskTextClass:a,maskTextSelector:i,unmaskTextSelector:c,maskTextFn:l,maskInputOptions:u,maskInputFn:m,rootId:f}=n,h=t.parentNode&&t.parentNode.tagName;let g=t.textContent;const k="STYLE"===h||void 0,y="SCRIPT"===h||void 0,T="TEXTAREA"===h||void 0;if(k&&g){try{t.nextSibling||t.previousSibling||t.parentNode.sheet?.cssRules&&(g=o(t.parentNode.sheet))}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}g=A(g,R())}y&&(g="SCRIPT_PLACEHOLDER");const b=G(t,s,i,a,c,r);k||y||T||!g||!b||(g=l?l(g):g.replace(/[\S]/g,"*"));T&&g&&(u.textarea||b)&&(g=m?m(g,t.parentNode):g.replace(/[\S]/g,"*"));if("OPTION"===h&&g){g=p({isMasked:G(t,s,i,a,c,d({type:null,tagName:h,maskInputOptions:u})),element:t,value:g,maskInputFn:m})}return{type:e.Text,textContent:g||"",isStyle:k,rootId:f}}(t,{maskAllText:l,maskTextClass:m,unmaskTextClass:g,maskTextSelector:y,unmaskTextSelector:x,maskTextFn:I,maskInputOptions:w,maskInputFn:v,rootId:W});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:W};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:W};default:return!1}}function V(e){return null==e?"":e.toLowerCase()}function z(s,o){const{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:m,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:g=!1,inlineStylesheet:k=!0,maskInputOptions:y={},maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N={},inlineImages:E=!1,recordCanvas:I=!1,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M=5e3,onStylesheetLoad:A,stylesheetLoadTimeout:O=5e3,keepIframeSrcFn:D=(()=>!1),newlyAddedElement:F=!1}=o;let{preserveWhiteSpace:_=!0}=o;const R=H(s,{doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:m,unblockSelector:u,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,dataURLOptions:N,inlineImages:E,recordCanvas:I,keepIframeSrcFn:D,newlyAddedElement:F});if(!R)return console.warn(s,"not serialized"),null;let $;$=i.hasNode(s)?i.getId(s):!function(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel||"modulepreload"===t.attributes.rel)&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(V(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===V(t.attributes.name)||"icon"===V(t.attributes.rel)||"apple-touch-icon"===V(t.attributes.rel)||"shortcut icon"===V(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&V(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(V(t.attributes.property).match(/^(og|twitter|fb):/)||V(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===V(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===V(t.attributes.name)||"googlebot"===V(t.attributes.name)||"bingbot"===V(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===V(t.attributes.name)||"generator"===V(t.attributes.name)||"framework"===V(t.attributes.name)||"publisher"===V(t.attributes.name)||"progid"===V(t.attributes.name)||V(t.attributes.property).match(/^article:/)||V(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===V(t.attributes.name)||"yandex-verification"===V(t.attributes.name)||"csrf-token"===V(t.attributes.name)||"p:domain_verify"===V(t.attributes.name)||"verify-v1"===V(t.attributes.name)||"verification"===V(t.attributes.name)||"shopify-checkout-api-token"===V(t.attributes.name)))return!0}}return!1}(R,S)&&(_||R.type!==e.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?w():C;const U=Object.assign(R,{id:$});if(i.add(s,U),$===C)return null;v&&v(s);let W=!g;if(U.type===e.Element){W=W&&!U.needBlock,delete U.needBlock;const e=s.shadowRoot;e&&r(e)&&(U.isShadowHost=!0)}if((U.type===e.Document||U.type===e.Element)&&W){S.headWhitespace&&U.type===e.Element&&"head"===U.tagName&&(_=!1);const n={doc:a,mirror:i,blockClass:c,blockSelector:l,maskAllText:m,unblockSelector:u,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:g,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N,inlineImages:E,recordCanvas:I,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D};for(const e of Array.from(s.childNodes)){const t=z(e,n);t&&U.childNodes.push(t)}if(t(s)&&s.shadowRoot)for(const e of Array.from(s.shadowRoot.childNodes)){const t=z(e,n);t&&(r(s.shadowRoot)&&(t.isShadow=!0),U.childNodes.push(t))}}return s.parentNode&&n(s.parentNode)&&r(s.parentNode)&&(U.isShadow=!0),U.type===e.Element&&"iframe"===U.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let s,o=!1;try{s=r.document.readyState}catch(e){return}if("complete"!==s){const r=setTimeout((()=>{o||(t(),o=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(r),o=!0,t()}))}const a="about:blank";if(r.location.href!==a||e.src===a||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(s,(()=>{const e=s.contentDocument;if(e&&L){const t=z(e,{doc:e,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:m,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N,inlineImages:E,recordCanvas:I,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});t&&L(s,t)}}),M),U.type===e.Element&&"link"===U.tagName&&"stylesheet"===U.attributes.rel&&function(e,t,n){let r,s=!1;try{r=e.sheet}catch(e){return}if(r)return;const o=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(o),s=!0,t()}))}(s,(()=>{if(A){const e=z(s,{doc:a,mirror:i,blockClass:c,blockSelector:l,unblockSelector:u,maskAllText:m,maskTextClass:d,unmaskTextClass:p,maskTextSelector:f,unmaskTextSelector:h,skipChild:!1,inlineStylesheet:k,maskInputOptions:y,maskAttributeFn:T,maskTextFn:b,maskInputFn:x,slimDOMOptions:S,dataURLOptions:N,inlineImages:E,recordCanvas:I,preserveWhiteSpace:_,onSerialize:v,onIframeLoad:L,iframeLoadTimeout:M,onStylesheetLoad:A,stylesheetLoadTimeout:O,keepIframeSrcFn:D});e&&A(s,e)}}),O),U}function q(e,t){const{mirror:n=new u,blockClass:r="rr-block",blockSelector:s=null,unblockSelector:o=null,maskAllText:a=!1,maskTextClass:i="rr-mask",unmaskTextClass:c=null,maskTextSelector:l=null,unmaskTextSelector:m=null,inlineStylesheet:d=!0,inlineImages:p=!1,recordCanvas:f=!1,maskAllInputs:h=!1,maskAttributeFn:g,maskTextFn:k,maskInputFn:y,slimDOM:T=!1,dataURLOptions:b,preserveWhiteSpace:x,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:w,onStylesheetLoad:N,stylesheetLoadTimeout:E,keepIframeSrcFn:I=(()=>!1)}=t||{};return z(e,{doc:e,mirror:n,blockClass:r,blockSelector:s,unblockSelector:o,maskAllText:a,maskTextClass:i,unmaskTextClass:c,maskTextSelector:l,unmaskTextSelector:m,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===h?{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}:!1===h?{}:h,maskAttributeFn:g,maskTextFn:k,maskInputFn:y,slimDOMOptions:!0===T||"all"===T?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===T,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===T?{}:T,dataURLOptions:b,inlineImages:p,recordCanvas:f,preserveWhiteSpace:x,onSerialize:S,onIframeLoad:C,iframeLoadTimeout:w,onStylesheetLoad:N,stylesheetLoadTimeout:E,keepIframeSrcFn:I,newlyAddedElement:!1})}function Y(t,n){!function t(r){n(r),r.type!==e.Document&&r.type!==e.Element||r.childNodes.forEach(t)}(t)}function X(){x=1}const J=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function K(e,t={}){let n=1,r=1;function s(e){const t=e.match(/\n/g);t&&(n+=t.length);const s=e.lastIndexOf("\n");r=-1===s?r+e.length:e.length-s}function o(){const e={line:n,column:r};return t=>(t.position=new a(e),p(),t)}class a{constructor(e){this.start=e,this.end={line:n,column:r},this.source=t.source}}a.prototype.content=e;const i=[];function c(s){const o=new Error(`${t.source||""}:${n}:${r}: ${s}`);if(o.reason=s,o.filename=t.source,o.line=n,o.column=r,o.source=e,!t.silent)throw o;i.push(o)}function l(){return d(/^{\s*/)}function u(){return d(/^}/)}function m(){let t;const n=[];for(p(),f(n);e.length&&"}"!==e.charAt(0)&&(t=w()||N());)t&&(n.push(t),f(n));return n}function d(t){const n=t.exec(e);if(!n)return;const r=n[0];return s(r),e=e.slice(r.length),n}function p(){d(/^\s*/)}function f(e=[]){let t;for(;t=h();)t&&e.push(t),t=h();return e}function h(){const t=o();if("/"!==e.charAt(0)||"*"!==e.charAt(1))return;let n=2;for(;""!==e.charAt(n)&&("*"!==e.charAt(n)||"/"!==e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return c("End of comment missing");const a=e.slice(2,n-2);return r+=2,s(a),e=e.slice(n),r+=2,t({type:"comment",comment:a})}function g(){const e=d(/^([^{]+)/);if(e)return Q(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(e=>e.replace(/,/g,""))).split(/\s*(?![^(]*\)),\s*/).map((e=>e.replace(/\u200C/g,",")))}function k(){const e=o(),t=d(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!t)return;const n=Q(t[0]);if(!d(/^:\s*/))return c("property missing ':'");const r=d(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),s=e({type:"declaration",property:n.replace(J,""),value:r?Q(r[0]).replace(J,""):""});return d(/^[;\s]*/),s}function y(){const e=[];if(!l())return c("missing '{'");let t;for(f(e);t=k();)!1!==t&&(e.push(t),f(e)),t=k();return u()?e:c("missing '}'")}function T(){let e;const t=[],n=o();for(;e=d(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)t.push(e[1]),d(/^,\s*/);if(t.length)return n({type:"keyframe",values:t,declarations:y()})}const b=C("import"),x=C("charset"),S=C("namespace");function C(e){const t=new RegExp("^@"+e+"\\s*([^;]+);");return()=>{const n=o(),r=d(t);if(!r)return;const s={type:e};return s[e]=r[1].trim(),n(s)}}function w(){if("@"===e[0])return function(){const e=o();let t=d(/^@([-\w]+)?keyframes\s*/);if(!t)return;const n=t[1];if(t=d(/^([-\w]+)\s*/),!t)return c("@keyframes missing name");const r=t[1];if(!l())return c("@keyframes missing '{'");let s,a=f();for(;s=T();)a.push(s),a=a.concat(f());return u()?e({type:"keyframes",name:r,vendor:n,keyframes:a}):c("@keyframes missing '}'")}()||function(){const e=o(),t=d(/^@media *([^{]+)/);if(!t)return;const n=Q(t[1]);if(!l())return c("@media missing '{'");const r=f().concat(m());return u()?e({type:"media",media:n,rules:r}):c("@media missing '}'")}()||function(){const e=o(),t=d(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(t)return e({type:"custom-media",name:Q(t[1]),media:Q(t[2])})}()||function(){const e=o(),t=d(/^@supports *([^{]+)/);if(!t)return;const n=Q(t[1]);if(!l())return c("@supports missing '{'");const r=f().concat(m());return u()?e({type:"supports",supports:n,rules:r}):c("@supports missing '}'")}()||b()||x()||S()||function(){const e=o(),t=d(/^@([-\w]+)?document *([^{]+)/);if(!t)return;const n=Q(t[1]),r=Q(t[2]);if(!l())return c("@document missing '{'");const s=f().concat(m());return u()?e({type:"document",document:r,vendor:n,rules:s}):c("@document missing '}'")}()||function(){const e=o();if(!d(/^@page */))return;const t=g()||[];if(!l())return c("@page missing '{'");let n,r=f();for(;n=k();)r.push(n),r=r.concat(f());return u()?e({type:"page",selectors:t,declarations:r}):c("@page missing '}'")}()||function(){const e=o();if(!d(/^@host\s*/))return;if(!l())return c("@host missing '{'");const t=f().concat(m());return u()?e({type:"host",rules:t}):c("@host missing '}'")}()||function(){const e=o();if(!d(/^@font-face\s*/))return;if(!l())return c("@font-face missing '{'");let t,n=f();for(;t=k();)n.push(t),n=n.concat(f());return u()?e({type:"font-face",declarations:n}):c("@font-face missing '}'")}()}function N(){const e=o(),t=g();return t?(f(),e({type:"rule",selectors:t,declarations:y()})):c("selector missing")}return Z(function(){const e=m();return{type:"stylesheet",stylesheet:{source:t.source,rules:e,parsingErrors:i}}}())}function Q(e){return e?e.replace(/^\s+|\s+$/g,""):""}function Z(e,t){const n=e&&"string"==typeof e.type,r=n?e:t;for(const t of Object.keys(e)){const n=e[t];Array.isArray(n)?n.forEach((e=>{Z(e,r)})):n&&"object"==typeof n&&Z(n,r)}return n&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}const ee={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"};const te=/([^\\]):hover/,ne=new RegExp(te.source,"g");function re(e,t){const n=t?.stylesWithHoverClass.get(e);if(n)return n;if(e.length>=1e6)return e;const r=K(e,{silent:!0});if(!r.stylesheet)return e;const s=[];if(r.stylesheet.rules.forEach((e=>{"selectors"in e&&(e.selectors||[]).forEach((e=>{te.test(e)&&s.push(e)}))})),0===s.length)return e;const o=new RegExp(s.filter(((e,t)=>s.indexOf(e)===t)).sort(((e,t)=>t.length-e.length)).map((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))).join("|"),"g"),a=e.replace(o,(e=>{const t=e.replace(ne,"$1.\\:hover");return`${e}, ${t}`}));return t?.stylesWithHoverClass.set(e,a),a}function se(){return{stylesWithHoverClass:new Map}}function oe(t,n){const{doc:r,hackCss:s,cache:o}=n;switch(t.type){case e.Document:return r.implementation.createDocument(null,"",null);case e.DocumentType:return r.implementation.createDocumentType(t.name||"html",t.publicId,t.systemId);case e.Element:{const e=function(e){let t=ee[e.tagName]?ee[e.tagName]:e.tagName;return"link"===t&&e.attributes._cssText&&(t="style"),t}(t);let n;t.isSVG?n=r.createElementNS("http://www.w3.org/2000/svg",e):(t.isCustom&&r.defaultView?.customElements&&!r.defaultView.customElements.get(t.tagName)&&r.defaultView.customElements.define(t.tagName,class extends r.defaultView.HTMLElement{}),n=r.createElement(e));const a={};for(const i in t.attributes){if(!Object.prototype.hasOwnProperty.call(t.attributes,i))continue;let c=t.attributes[i];if("option"===e&&"selected"===i&&!1===c)continue;if(null===c)continue;if(!0===c&&(c=""),i.startsWith("rr_")){a[i]=c;continue}const l="textarea"===e&&"value"===i,u="style"===e&&"_cssText"===i;if(u&&s&&"string"==typeof c&&(c=re(c,o)),!l&&!u||"string"!=typeof c)try{if(t.isSVG&&"xlink:href"===i)n.setAttributeNS("http://www.w3.org/1999/xlink",i,c.toString());else if("onload"===i||"onclick"===i||"onmouse"===i.substring(0,7))n.setAttribute("_"+i,c.toString());else{if("meta"===e&&"Content-Security-Policy"===t.attributes["http-equiv"]&&"content"===i){n.setAttribute("csp-content",c.toString());continue}("link"!==e||"preload"!==t.attributes.rel&&"modulepreload"!==t.attributes.rel||"script"!==t.attributes.as)&&("link"===e&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&t.attributes.href.endsWith(".js")||("img"===e&&t.attributes.srcset&&t.attributes.rr_dataURL?n.setAttribute("rrweb-original-srcset",t.attributes.srcset):n.setAttribute(i,c.toString())))}}catch(e){}else{const e=r.createTextNode(c);for(const e of Array.from(n.childNodes))e.nodeType===n.TEXT_NODE&&n.removeChild(e);n.appendChild(e)}}for(const r in a){const s=a[r];if("canvas"===e&&"rr_dataURL"===r){const e=document.createElement("img");e.onload=()=>{const t=n.getContext("2d");t&&t.drawImage(e,0,0,e.width,e.height)},e.src=s.toString(),n.RRNodeType&&(n.rr_dataURL=s.toString())}else if("img"===e&&"rr_dataURL"===r){const e=n;e.currentSrc.startsWith("data:")||(e.setAttribute("rrweb-original-src",t.attributes.src),e.src=s.toString())}if("rr_width"===r)n.style.setProperty("width",s.toString());else if("rr_height"===r)n.style.setProperty("height",s.toString());else if("rr_mediaCurrentTime"===r&&"number"==typeof s)n.currentTime=s;else if("rr_mediaState"===r)switch(s){case"played":n.play().catch((e=>console.warn("media playback error",e)));break;case"paused":n.pause()}}if(t.isShadowHost)if(n.shadowRoot)for(;n.shadowRoot.firstChild;)n.shadowRoot.removeChild(n.shadowRoot.firstChild);else n.attachShadow({mode:"open"});return n}case e.Text:return r.createTextNode(t.isStyle&&s?re(t.textContent,o):t.textContent);case e.CDATA:return r.createCDATASection(t.textContent);case e.Comment:return r.createComment(t.textContent);default:return null}}function ae(n,r){const{doc:s,mirror:o,skipChild:a=!1,hackCss:i=!0,afterAppend:c,cache:l}=r;if(o.has(n.id)){const e=o.getNode(n.id);if(y(o.getMeta(e),n))return o.getNode(n.id)}let u=oe(n,{doc:s,hackCss:i,cache:l});if(!u)return null;if(n.rootId&&o.getNode(n.rootId)!==s&&o.replace(n.rootId,s),n.type===e.Document&&(s.close(),s.open(),"BackCompat"===n.compatMode&&n.childNodes&&n.childNodes[0].type!==e.DocumentType&&(n.childNodes[0].type===e.Element&&"xmlns"in n.childNodes[0].attributes&&"http://www.w3.org/1999/xhtml"===n.childNodes[0].attributes.xmlns?s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):s.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),u=s),o.add(u,n),(n.type===e.Document||n.type===e.Element)&&!a)for(const r of n.childNodes){const a=ae(r,{doc:s,mirror:o,skipChild:!1,hackCss:i,afterAppend:c,cache:l});if(a){if(r.isShadow&&t(u)&&u.shadowRoot)u.shadowRoot.appendChild(a);else if(n.type===e.Document&&r.type==e.Element){const e=a;let t=null;e.childNodes.forEach((e=>{"BODY"===e.nodeName&&(t=e)})),t?(e.removeChild(t),u.appendChild(a),e.appendChild(t)):u.appendChild(a)}else u.appendChild(a);c&&c(a,r.id)}else console.warn("Failed to rebuild",r)}return u}function ie(t,n){const{doc:r,onVisit:s,hackCss:o=!0,afterAppend:a,cache:i,mirror:c=new u}=n,l=ae(t,{doc:r,mirror:c,skipChild:!1,hackCss:o,afterAppend:a,cache:i});return function(e,t){for(const r of e.getIds())e.has(r)&&(n=e.getNode(r),t(n));var n}(c,(t=>{s&&s(t),function(t,n){const r=n.getMeta(t);if(r?.type!==e.Element)return;const s=t;for(const e in r.attributes){if(!Object.prototype.hasOwnProperty.call(r.attributes,e)||!e.startsWith("rr_"))continue;const t=r.attributes[e];"rr_scrollLeft"===e&&(s.scrollLeft=t),"rr_scrollTop"===e&&(s.scrollTop=t)}}(t,c)})),l}export{C as IGNORED_NODE,u as Mirror,e as NodeType,re as addHoverClass,ae as buildNodeWithSN,P as classMatchesRegex,X as cleanupSnapshot,se as createCache,B as createMatchPredicate,m as createMirror,j as distanceToMatch,s as escapeImportStatement,i as fixSafariColons,w as genId,T as getInputType,b as getInputValue,U as ignoreAttribute,k as is2DCanvasBlank,c as isCSSImportRule,l as isCSSStyleRule,t as isElement,r as isNativeShadowDom,y as isNodeMetaEqual,n as isShadowRoot,p as maskInputValue,G as needMaskingText,ie as rebuild,z as serializeNodeWithId,d as shouldMaskInput,q as snapshot,a as stringifyRule,o as stringifyStylesheet,f as toLowerCase,h as toUpperCase,$ as transformAttribute,Y as visitSnapshot}; | ||
//# sourceMappingURL=rrweb-snapshot.min.js.map |
{ | ||
"name": "@sentry-internal/rrweb-snapshot", | ||
"version": "2.9.0", | ||
"version": "2.10.0", | ||
"description": "rrweb's component to take a snapshot of DOM, aka DOM serializer", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
297232