Files
klz-cables.com/.pnpm-store/v10/files/e2/f1fb8372415f01d0ec052f76f439989ce437da3fcfeee18eb336bd735038fe17687636ff6b8c6183f1075ed4ed80313491a91c36ad41ec757eb9ef13557eb9
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

1 line
362 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"version":3,"file":"index.js","sources":["../../../../../node_modules/@sentry-internal/rrweb/dist/rrweb.js","../../../src/canvas.ts"],"sourcesContent":["var __defProp$1 = Object.defineProperty;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar NodeType$2 = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2[\"Document\"] = 0] = \"Document\";\n NodeType2[NodeType2[\"DocumentType\"] = 1] = \"DocumentType\";\n NodeType2[NodeType2[\"Element\"] = 2] = \"Element\";\n NodeType2[NodeType2[\"Text\"] = 3] = \"Text\";\n NodeType2[NodeType2[\"CDATA\"] = 4] = \"CDATA\";\n NodeType2[NodeType2[\"Comment\"] = 5] = \"Comment\";\n return NodeType2;\n})(NodeType$2 || {});\nfunction isElement(n2) {\n return n2.nodeType === n2.ELEMENT_NODE;\n}\nfunction isShadowRoot(n2) {\n const host = n2?.host;\n return Boolean(host?.shadowRoot === n2);\n}\nfunction isNativeShadowDom(shadowRoot) {\n return Object.prototype.toString.call(shadowRoot) === \"[object ShadowRoot]\";\n}\nfunction fixBrowserCompatibilityIssuesInCSS(cssText) {\n if (cssText.includes(\" background-clip: text;\") && !cssText.includes(\" -webkit-background-clip: text;\")) {\n cssText = cssText.replace(\n /\\sbackground-clip:\\s*text;/g,\n \" -webkit-background-clip: text; background-clip: text;\"\n );\n }\n return cssText;\n}\nfunction escapeImportStatement(rule) {\n const { cssText } = rule;\n if (cssText.split('\"').length < 3) return cssText;\n const statement = [\"@import\", `url(${JSON.stringify(rule.href)})`];\n if (rule.layerName === \"\") {\n statement.push(`layer`);\n } else if (rule.layerName) {\n statement.push(`layer(${rule.layerName})`);\n }\n if (rule.supportsText) {\n statement.push(`supports(${rule.supportsText})`);\n }\n if (rule.media.length) {\n statement.push(rule.media.mediaText);\n }\n return statement.join(\" \") + \";\";\n}\nfunction stringifyStylesheet(s2) {\n try {\n const rules2 = s2.rules || s2.cssRules;\n return rules2 ? fixBrowserCompatibilityIssuesInCSS(\n Array.from(rules2, stringifyRule).join(\"\")\n ) : null;\n } catch (error) {\n return null;\n }\n}\nfunction fixAllCssProperty(rule) {\n let styles = \"\";\n for (let i2 = 0; i2 < rule.style.length; i2++) {\n const styleDeclaration = rule.style;\n const attribute = styleDeclaration[i2];\n const isImportant = styleDeclaration.getPropertyPriority(attribute);\n styles += `${attribute}:${styleDeclaration.getPropertyValue(attribute)}${isImportant ? ` !important` : \"\"};`;\n }\n return `${rule.selectorText} { ${styles} }`;\n}\nfunction stringifyRule(rule) {\n let importStringified;\n if (isCSSImportRule(rule)) {\n try {\n importStringified = // for same-origin stylesheets,\n // we can access the imported stylesheet rules directly\n stringifyStylesheet(rule.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement\n escapeImportStatement(rule);\n } catch (error) {\n }\n } else if (isCSSStyleRule(rule)) {\n let cssText = rule.cssText;\n const needsSafariColonFix = rule.selectorText.includes(\":\");\n const needsAllFix = typeof rule.style[\"all\"] === \"string\" && rule.style[\"all\"];\n if (needsAllFix) {\n cssText = fixAllCssProperty(rule);\n }\n if (needsSafariColonFix) {\n cssText = fixSafariColons(cssText);\n }\n if (needsSafariColonFix || needsAllFix) {\n return cssText;\n }\n }\n return importStringified || rule.cssText;\n}\nfunction fixSafariColons(cssStringified) {\n const regex = /(\\[(?:[\\w-]+)[^\\\\])(:(?:[\\w-]+)\\])/gm;\n return cssStringified.replace(regex, \"$1\\\\$2\");\n}\nfunction isCSSImportRule(rule) {\n return \"styleSheet\" in rule;\n}\nfunction isCSSStyleRule(rule) {\n return \"selectorText\" in rule;\n}\nclass Mirror {\n constructor() {\n __publicField$1(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField$1(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n if (!n2) return -1;\n const id = this.getMeta(n2)?.id;\n return id ?? -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node) {\n return this.nodeMetaMap.has(node);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction createMirror$2() {\n return new Mirror();\n}\nfunction shouldMaskInput({\n maskInputOptions,\n tagName,\n type\n}) {\n if (tagName === \"OPTION\") {\n tagName = \"SELECT\";\n }\n return Boolean(\n maskInputOptions[tagName.toLowerCase()] || type && maskInputOptions[type] || type === \"password\" || // Default to \"text\" option for inputs without a \"type\" attribute defined\n tagName === \"INPUT\" && !type && maskInputOptions[\"text\"]\n );\n}\nfunction maskInputValue({\n isMasked,\n element,\n value,\n maskInputFn\n}) {\n let text = value || \"\";\n if (!isMasked) {\n return text;\n }\n if (maskInputFn) {\n text = maskInputFn(text, element);\n }\n return \"*\".repeat(text.length);\n}\nfunction toLowerCase(str) {\n return str.toLowerCase();\n}\nfunction toUpperCase(str) {\n return str.toUpperCase();\n}\nconst ORIGINAL_ATTRIBUTE_NAME = \"__rrweb_original__\";\nfunction is2DCanvasBlank(canvas) {\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return true;\n const chunkSize = 50;\n for (let x = 0; x < canvas.width; x += chunkSize) {\n for (let y = 0; y < canvas.height; y += chunkSize) {\n const getImageData = ctx.getImageData;\n const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;\n const pixelBuffer = new Uint32Array(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n originalGetImageData.call(\n ctx,\n x,\n y,\n Math.min(chunkSize, canvas.width - x),\n Math.min(chunkSize, canvas.height - y)\n ).data.buffer\n );\n if (pixelBuffer.some((pixel) => pixel !== 0)) return false;\n }\n }\n return true;\n}\nfunction isNodeMetaEqual(a2, b) {\n if (!a2 || !b || a2.type !== b.type) return false;\n if (a2.type === NodeType$2.Document)\n return a2.compatMode === b.compatMode;\n else if (a2.type === NodeType$2.DocumentType)\n return a2.name === b.name && a2.publicId === b.publicId && a2.systemId === b.systemId;\n else if (a2.type === NodeType$2.Comment || a2.type === NodeType$2.Text || a2.type === NodeType$2.CDATA)\n return a2.textContent === b.textContent;\n else if (a2.type === NodeType$2.Element)\n return a2.tagName === b.tagName && JSON.stringify(a2.attributes) === JSON.stringify(b.attributes) && a2.isSVG === b.isSVG && a2.needBlock === b.needBlock;\n return false;\n}\nfunction getInputType(element) {\n const type = element.type;\n return element.hasAttribute(\"data-rr-is-password\") ? \"password\" : type ? (\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n toLowerCase(type)\n ) : null;\n}\nfunction getInputValue(el, tagName, type) {\n if (tagName === \"INPUT\" && (type === \"radio\" || type === \"checkbox\")) {\n return el.getAttribute(\"value\") || \"\";\n }\n return el.value;\n}\nfunction extractFileExtension(path, baseURL) {\n let url;\n try {\n url = new URL(path, baseURL ?? window.location.href);\n } catch (err) {\n return null;\n }\n const regex = /\\.([0-9a-z]+)(?:$)/i;\n const match = url.pathname.match(regex);\n return match?.[1] ?? null;\n}\nconst cachedImplementations$1 = {};\nfunction getImplementation$1(name) {\n const cached = cachedImplementations$1[name];\n if (cached) {\n return cached;\n }\n const document2 = window.document;\n let impl = window[name];\n if (document2 && typeof document2.createElement === \"function\") {\n try {\n const sandbox = document2.createElement(\"iframe\");\n sandbox.hidden = true;\n document2.head.appendChild(sandbox);\n const contentWindow = sandbox.contentWindow;\n if (contentWindow && contentWindow[name]) {\n impl = // eslint-disable-next-line @typescript-eslint/unbound-method\n contentWindow[name];\n }\n document2.head.removeChild(sandbox);\n } catch (e2) {\n }\n }\n return cachedImplementations$1[name] = impl.bind(\n window\n );\n}\nfunction setTimeout$2(...rest) {\n return getImplementation$1(\"setTimeout\")(...rest);\n}\nfunction clearTimeout$1(...rest) {\n return getImplementation$1(\"clearTimeout\")(...rest);\n}\nfunction getIframeContentDocument(iframe) {\n try {\n return iframe.contentDocument;\n } catch (e2) {\n }\n}\nlet _id = 1;\nconst tagNameRegex = new RegExp(\"[^a-z0-9-_:]\");\nconst IGNORED_NODE = -2;\nfunction genId() {\n return _id++;\n}\nfunction getValidTagName$1(element) {\n if (element instanceof HTMLFormElement) {\n return \"form\";\n }\n const processedTagName = toLowerCase(element.tagName);\n if (tagNameRegex.test(processedTagName)) {\n return \"div\";\n }\n return processedTagName;\n}\nfunction extractOrigin(url) {\n let origin = \"\";\n if (url.indexOf(\"//\") > -1) {\n origin = url.split(\"/\").slice(0, 3).join(\"/\");\n } else {\n origin = url.split(\"/\")[0];\n }\n origin = origin.split(\"?\")[0];\n return origin;\n}\nlet canvasService;\nlet canvasCtx;\nconst URL_IN_CSS_REF = /url\\((?:(')([^']*)'|(\")(.*?)\"|([^)]*))\\)/gm;\nconst URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\\/\\//i;\nconst URL_WWW_MATCH = /^www\\..*/i;\nconst DATA_URI = /^(data:)([^,]*),(.*)/i;\nfunction filterCSSPropertiesFromInlineStyle(cssText, ignoredProperties) {\n if (!cssText || ignoredProperties.size === 0) {\n return cssText;\n }\n try {\n const properties = cssText.split(\";\");\n const filteredProperties = [];\n for (let property of properties) {\n property = property.trim();\n if (!property) continue;\n const colonIndex = property.indexOf(\":\");\n if (colonIndex === -1) {\n filteredProperties.push(property);\n continue;\n }\n const propertyName = property.slice(0, colonIndex).trim();\n if (!ignoredProperties.has(propertyName)) {\n filteredProperties.push(property);\n }\n }\n return filteredProperties.join(\"; \") + (filteredProperties.length > 0 && cssText.endsWith(\";\") ? \";\" : \"\");\n } catch (error) {\n console.warn(\"Error filtering CSS properties:\", error);\n return cssText;\n }\n}\nfunction absoluteToStylesheet(cssText, href) {\n return (cssText || \"\").replace(\n URL_IN_CSS_REF,\n (origin, quote1, path1, quote2, path2, path3) => {\n const filePath = path1 || path2 || path3;\n const maybeQuote = quote1 || quote2 || \"\";\n if (!filePath) {\n return origin;\n }\n if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (DATA_URI.test(filePath)) {\n return `url(${maybeQuote}${filePath}${maybeQuote})`;\n }\n if (filePath[0] === \"/\") {\n return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;\n }\n const stack = href.split(\"/\");\n const parts = filePath.split(\"/\");\n stack.pop();\n for (const part of parts) {\n if (part === \".\") {\n continue;\n } else if (part === \"..\") {\n stack.pop();\n } else {\n stack.push(part);\n }\n }\n return `url(${maybeQuote}${stack.join(\"/\")}${maybeQuote})`;\n }\n );\n}\nconst SRCSET_NOT_SPACES = /^[^ \\t\\n\\r\\u000c]+/;\nconst SRCSET_COMMAS_OR_SPACES = /^[, \\t\\n\\r\\u000c]+/;\nfunction getAbsoluteSrcsetString(doc, attributeValue) {\n if (attributeValue.trim() === \"\") {\n return attributeValue;\n }\n let pos = 0;\n function collectCharacters(regEx) {\n let chars2;\n const match = regEx.exec(attributeValue.substring(pos));\n if (match) {\n chars2 = match[0];\n pos += chars2.length;\n return chars2;\n }\n return \"\";\n }\n const output = [];\n while (true) {\n collectCharacters(SRCSET_COMMAS_OR_SPACES);\n if (pos >= attributeValue.length) {\n break;\n }\n let url = collectCharacters(SRCSET_NOT_SPACES);\n if (url.slice(-1) === \",\") {\n url = absoluteToDoc(doc, url.substring(0, url.length - 1));\n output.push(url);\n } else {\n let descriptorsStr = \"\";\n url = absoluteToDoc(doc, url);\n let inParens = false;\n while (true) {\n const c2 = attributeValue.charAt(pos);\n if (c2 === \"\") {\n output.push((url + descriptorsStr).trim());\n break;\n } else if (!inParens) {\n if (c2 === \",\") {\n pos += 1;\n output.push((url + descriptorsStr).trim());\n break;\n } else if (c2 === \"(\") {\n inParens = true;\n }\n } else {\n if (c2 === \")\") {\n inParens = false;\n }\n }\n descriptorsStr += c2;\n pos += 1;\n }\n }\n }\n return output.join(\", \");\n}\nconst cachedDocument = /* @__PURE__ */ new WeakMap();\nfunction absoluteToDoc(doc, attributeValue) {\n if (!attributeValue || attributeValue.trim() === \"\") {\n return attributeValue;\n }\n return getHref(doc, attributeValue);\n}\nfunction isSVGElement(el) {\n return Boolean(el.tagName === \"svg\" || el.ownerSVGElement);\n}\nfunction getHref(doc, customHref) {\n let a2 = cachedDocument.get(doc);\n if (!a2) {\n a2 = doc.createElement(\"a\");\n cachedDocument.set(doc, a2);\n }\n if (!customHref) {\n customHref = \"\";\n } else if (customHref.startsWith(\"blob:\") || customHref.startsWith(\"data:\")) {\n return customHref;\n }\n a2.setAttribute(\"href\", customHref);\n return a2.href;\n}\nfunction transformAttribute(doc, tagName, name, value, element, maskAttributeFn, ignoreCSSAttributes) {\n if (!value) {\n return value;\n }\n if (name === \"src\" || name === \"href\" && !(tagName === \"use\" && value[0] === \"#\")) {\n return absoluteToDoc(doc, value);\n } else if (name === \"xlink:href\" && value[0] !== \"#\") {\n return absoluteToDoc(doc, value);\n } else if (name === \"background\" && (tagName === \"table\" || tagName === \"td\" || tagName === \"th\")) {\n return absoluteToDoc(doc, value);\n } else if (name === \"srcset\") {\n return getAbsoluteSrcsetString(doc, value);\n } else if (name === \"style\") {\n let processedStyle = absoluteToStylesheet(value, getHref(doc));\n if (ignoreCSSAttributes && ignoreCSSAttributes.size > 0) {\n processedStyle = filterCSSPropertiesFromInlineStyle(\n processedStyle,\n ignoreCSSAttributes\n );\n }\n return processedStyle;\n } else if (tagName === \"object\" && name === \"data\") {\n return absoluteToDoc(doc, value);\n }\n if (typeof maskAttributeFn === \"function\") {\n return maskAttributeFn(name, value, element);\n }\n return value;\n}\nfunction ignoreAttribute(tagName, name, _value) {\n return (tagName === \"video\" || tagName === \"audio\") && name === \"autoplay\";\n}\nfunction _isBlockedElement(element, blockClass, blockSelector, unblockSelector) {\n try {\n if (unblockSelector && element.matches(unblockSelector)) {\n return false;\n }\n if (typeof blockClass === \"string\") {\n if (element.classList.contains(blockClass)) {\n return true;\n }\n } else {\n for (let eIndex = element.classList.length; eIndex--; ) {\n const className = element.classList[eIndex];\n if (blockClass.test(className)) {\n return true;\n }\n }\n }\n if (blockSelector) {\n return element.matches(blockSelector);\n }\n } catch (e2) {\n }\n return false;\n}\nfunction elementClassMatchesRegex(el, regex) {\n for (let eIndex = el.classList.length; eIndex--; ) {\n const className = el.classList[eIndex];\n if (regex.test(className)) {\n return true;\n }\n }\n return false;\n}\nfunction distanceToMatch(node, matchPredicate, limit = Infinity, distance = 0) {\n if (!node) return -1;\n if (node.nodeType !== node.ELEMENT_NODE) return -1;\n if (distance > limit) return -1;\n if (matchPredicate(node)) return distance;\n return distanceToMatch(node.parentNode, matchPredicate, limit, distance + 1);\n}\nfunction createMatchPredicate(className, selector) {\n return (node) => {\n const el = node;\n if (el === null) return false;\n try {\n if (className) {\n if (typeof className === \"string\") {\n if (el.matches(`.${className}`)) return true;\n } else if (elementClassMatchesRegex(el, className)) {\n return true;\n }\n }\n if (selector && el.matches(selector)) return true;\n return false;\n } catch {\n return false;\n }\n };\n}\nfunction needMaskingText(node, maskTextClass, maskTextSelector, unmaskTextClass, unmaskTextSelector, maskAllText) {\n try {\n const el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;\n if (el === null) return false;\n if (el.tagName === \"INPUT\") {\n const autocomplete = el.getAttribute(\"autocomplete\");\n const disallowedAutocompleteValues = [\n \"current-password\",\n \"new-password\",\n \"cc-number\",\n \"cc-exp\",\n \"cc-exp-month\",\n \"cc-exp-year\",\n \"cc-csc\"\n ];\n if (disallowedAutocompleteValues.includes(autocomplete)) {\n return true;\n }\n }\n let maskDistance = -1;\n let unmaskDistance = -1;\n if (maskAllText) {\n unmaskDistance = distanceToMatch(\n el,\n createMatchPredicate(unmaskTextClass, unmaskTextSelector)\n );\n if (unmaskDistance < 0) {\n return true;\n }\n maskDistance = distanceToMatch(\n el,\n createMatchPredicate(maskTextClass, maskTextSelector),\n unmaskDistance >= 0 ? unmaskDistance : Infinity\n );\n } else {\n maskDistance = distanceToMatch(\n el,\n createMatchPredicate(maskTextClass, maskTextSelector)\n );\n if (maskDistance < 0) {\n return false;\n }\n unmaskDistance = distanceToMatch(\n el,\n createMatchPredicate(unmaskTextClass, unmaskTextSelector),\n maskDistance >= 0 ? maskDistance : Infinity\n );\n }\n return maskDistance >= 0 ? unmaskDistance >= 0 ? maskDistance <= unmaskDistance : true : unmaskDistance >= 0 ? false : !!maskAllText;\n } catch (e2) {\n }\n return !!maskAllText;\n}\nfunction onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {\n const win = iframeEl.contentWindow;\n if (!win) {\n return;\n }\n let fired = false;\n let readyState;\n try {\n readyState = win.document.readyState;\n } catch (error) {\n return;\n }\n if (readyState !== \"complete\") {\n const timer = setTimeout$2(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, iframeLoadTimeout);\n iframeEl.addEventListener(\"load\", () => {\n clearTimeout$1(timer);\n fired = true;\n listener();\n });\n return;\n }\n const blankUrl = \"about:blank\";\n if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === \"\") {\n setTimeout$2(listener, 0);\n return iframeEl.addEventListener(\"load\", listener);\n }\n iframeEl.addEventListener(\"load\", listener);\n}\nfunction onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {\n let fired = false;\n let styleSheetLoaded;\n try {\n styleSheetLoaded = link.sheet;\n } catch (error) {\n return;\n }\n if (styleSheetLoaded) return;\n const timer = setTimeout$2(() => {\n if (!fired) {\n listener();\n fired = true;\n }\n }, styleSheetLoadTimeout);\n link.addEventListener(\"load\", () => {\n clearTimeout$1(timer);\n fired = true;\n listener();\n });\n}\nfunction serializeNode(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n maskAllText,\n maskAttributeFn,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n inlineStylesheet,\n maskInputOptions = {},\n maskTextFn,\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n ignoreCSSAttributes\n } = options;\n const rootId = getRootId(doc, mirror2);\n switch (n2.nodeType) {\n case n2.DOCUMENT_NODE:\n if (n2.compatMode !== \"CSS1Compat\") {\n return {\n type: NodeType$2.Document,\n childNodes: [],\n compatMode: n2.compatMode\n // probably \"BackCompat\"\n };\n } else {\n return {\n type: NodeType$2.Document,\n childNodes: []\n };\n }\n case n2.DOCUMENT_TYPE_NODE:\n return {\n type: NodeType$2.DocumentType,\n name: n2.name,\n publicId: n2.publicId,\n systemId: n2.systemId,\n rootId\n };\n case n2.ELEMENT_NODE:\n return serializeElementNode(n2, {\n doc,\n blockClass,\n blockSelector,\n unblockSelector,\n inlineStylesheet,\n maskAttributeFn,\n maskInputOptions,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n rootId,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n ignoreCSSAttributes\n });\n case n2.TEXT_NODE:\n return serializeTextNode(n2, {\n doc,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n maskTextFn,\n maskInputOptions,\n maskInputFn,\n rootId\n });\n case n2.CDATA_SECTION_NODE:\n return {\n type: NodeType$2.CDATA,\n textContent: \"\",\n rootId\n };\n case n2.COMMENT_NODE:\n return {\n type: NodeType$2.Comment,\n textContent: n2.textContent || \"\",\n rootId\n };\n default:\n return false;\n }\n}\nfunction getRootId(doc, mirror2) {\n if (!mirror2.hasNode(doc)) return void 0;\n const docId = mirror2.getId(doc);\n return docId === 1 ? void 0 : docId;\n}\nfunction serializeTextNode(n2, options) {\n const {\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n maskTextFn,\n maskInputOptions,\n maskInputFn,\n rootId\n } = options;\n const parentTagName = n2.parentNode && n2.parentNode.tagName;\n let textContent = n2.textContent;\n const isStyle = parentTagName === \"STYLE\" ? true : void 0;\n const isScript = parentTagName === \"SCRIPT\" ? true : void 0;\n const isTextarea = parentTagName === \"TEXTAREA\" ? true : void 0;\n if (isStyle && textContent) {\n try {\n if (n2.nextSibling || n2.previousSibling) {\n } else if (n2.parentNode.sheet?.cssRules) {\n textContent = stringifyStylesheet(\n n2.parentNode.sheet\n );\n }\n } catch (err) {\n console.warn(\n `Cannot get CSS styles from text's parentNode. Error: ${err}`,\n n2\n );\n }\n textContent = absoluteToStylesheet(textContent, getHref(options.doc));\n }\n if (isScript) {\n textContent = \"SCRIPT_PLACEHOLDER\";\n }\n const forceMask = needMaskingText(\n n2,\n maskTextClass,\n maskTextSelector,\n unmaskTextClass,\n unmaskTextSelector,\n maskAllText\n );\n if (!isStyle && !isScript && !isTextarea && textContent && forceMask) {\n textContent = maskTextFn ? maskTextFn(textContent, n2.parentElement) : textContent.replace(/[\\S]/g, \"*\");\n }\n if (isTextarea && textContent && (maskInputOptions.textarea || forceMask)) {\n textContent = maskInputFn ? maskInputFn(textContent, n2.parentNode) : textContent.replace(/[\\S]/g, \"*\");\n }\n if (parentTagName === \"OPTION\" && textContent) {\n const isInputMasked = shouldMaskInput({\n type: null,\n tagName: parentTagName,\n maskInputOptions\n });\n textContent = maskInputValue({\n isMasked: needMaskingText(\n n2,\n maskTextClass,\n maskTextSelector,\n unmaskTextClass,\n unmaskTextSelector,\n isInputMasked\n ),\n element: n2,\n value: textContent,\n maskInputFn\n });\n }\n return {\n type: NodeType$2.Text,\n textContent: textContent || \"\",\n isStyle,\n rootId\n };\n}\nfunction serializeElementNode(n2, options) {\n const {\n doc,\n blockClass,\n blockSelector,\n unblockSelector,\n inlineStylesheet,\n maskInputOptions = {},\n maskAttributeFn,\n maskInputFn,\n dataURLOptions = {},\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement = false,\n rootId,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n ignoreCSSAttributes\n } = options;\n const needBlock = _isBlockedElement(\n n2,\n blockClass,\n blockSelector,\n unblockSelector\n );\n const tagName = getValidTagName$1(n2);\n let attributes2 = {};\n const len = n2.attributes.length;\n for (let i2 = 0; i2 < len; i2++) {\n const attr = n2.attributes[i2];\n if (attr.name && !ignoreAttribute(tagName, attr.name, attr.value)) {\n attributes2[attr.name] = transformAttribute(\n doc,\n tagName,\n toLowerCase(attr.name),\n attr.value,\n n2,\n maskAttributeFn,\n ignoreCSSAttributes\n );\n }\n }\n if (tagName === \"link\" && inlineStylesheet) {\n const stylesheet = Array.from(doc.styleSheets).find((s2) => {\n return s2.href === n2.href;\n });\n let cssText = null;\n if (stylesheet) {\n cssText = stringifyStylesheet(stylesheet);\n }\n if (cssText) {\n attributes2.rel = null;\n attributes2.href = null;\n attributes2.crossorigin = null;\n attributes2._cssText = absoluteToStylesheet(cssText, stylesheet.href);\n }\n }\n if (tagName === \"style\" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element\n !(n2.innerText || n2.textContent || \"\").trim().length) {\n const cssText = stringifyStylesheet(\n n2.sheet\n );\n if (cssText) {\n attributes2._cssText = absoluteToStylesheet(cssText, getHref(doc));\n }\n }\n if (tagName === \"input\" || tagName === \"textarea\" || tagName === \"select\" || tagName === \"option\") {\n const el = n2;\n const type = getInputType(el);\n const value = getInputValue(el, toUpperCase(tagName), type);\n const checked = el.checked;\n if (type !== \"submit\" && type !== \"button\" && value) {\n const forceMask = needMaskingText(\n el,\n maskTextClass,\n maskTextSelector,\n unmaskTextClass,\n unmaskTextSelector,\n shouldMaskInput({\n type,\n tagName: toUpperCase(tagName),\n maskInputOptions\n })\n );\n attributes2.value = maskInputValue({\n isMasked: forceMask,\n element: el,\n value,\n maskInputFn\n });\n }\n if (checked) {\n attributes2.checked = checked;\n }\n }\n if (tagName === \"option\") {\n if (n2.selected && !maskInputOptions[\"select\"]) {\n attributes2.selected = true;\n } else {\n delete attributes2.selected;\n }\n }\n if (tagName === \"canvas\" && recordCanvas) {\n if (n2.__context === \"2d\") {\n if (!is2DCanvasBlank(n2)) {\n attributes2.rr_dataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n }\n } else if (!(\"__context\" in n2)) {\n const canvasDataURL = n2.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n const blankCanvas = doc.createElement(\"canvas\");\n blankCanvas.width = n2.width;\n blankCanvas.height = n2.height;\n const blankCanvasDataURL = blankCanvas.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n if (canvasDataURL !== blankCanvasDataURL) {\n attributes2.rr_dataURL = canvasDataURL;\n }\n }\n }\n if (tagName === \"img\" && inlineImages) {\n if (!canvasService) {\n canvasService = doc.createElement(\"canvas\");\n canvasCtx = canvasService.getContext(\"2d\");\n }\n const image = n2;\n const imageSrc = image.currentSrc || image.getAttribute(\"src\") || \"<unknown-src>\";\n const priorCrossOrigin = image.crossOrigin;\n const recordInlineImage = () => {\n image.removeEventListener(\"load\", recordInlineImage);\n try {\n canvasService.width = image.naturalWidth;\n canvasService.height = image.naturalHeight;\n canvasCtx.drawImage(image, 0, 0);\n attributes2.rr_dataURL = canvasService.toDataURL(\n dataURLOptions.type,\n dataURLOptions.quality\n );\n } catch (err) {\n if (image.crossOrigin !== \"anonymous\") {\n image.crossOrigin = \"anonymous\";\n if (image.complete && image.naturalWidth !== 0)\n recordInlineImage();\n else image.addEventListener(\"load\", recordInlineImage);\n return;\n } else {\n console.warn(\n `Cannot inline img src=${imageSrc}! Error: ${err}`\n );\n }\n }\n if (image.crossOrigin === \"anonymous\") {\n priorCrossOrigin ? attributes2.crossOrigin = priorCrossOrigin : image.removeAttribute(\"crossorigin\");\n }\n };\n if (image.complete && image.naturalWidth !== 0) recordInlineImage();\n else image.addEventListener(\"load\", recordInlineImage);\n }\n if (tagName === \"audio\" || tagName === \"video\") {\n attributes2.rr_mediaState = n2.paused ? \"paused\" : \"played\";\n attributes2.rr_mediaCurrentTime = n2.currentTime;\n }\n if (!newlyAddedElement) {\n if (n2.scrollLeft) {\n attributes2.rr_scrollLeft = n2.scrollLeft;\n }\n if (n2.scrollTop) {\n attributes2.rr_scrollTop = n2.scrollTop;\n }\n }\n if (needBlock) {\n const { width, height } = n2.getBoundingClientRect();\n attributes2 = {\n class: attributes2.class,\n rr_width: `${width}px`,\n rr_height: `${height}px`\n };\n }\n if (tagName === \"iframe\" && !keepIframeSrcFn(attributes2.src)) {\n if (!needBlock && !getIframeContentDocument(n2)) {\n attributes2.rr_src = attributes2.src;\n }\n delete attributes2.src;\n }\n let isCustomElement;\n try {\n if (customElements.get(tagName)) isCustomElement = true;\n } catch (e2) {\n }\n return {\n type: NodeType$2.Element,\n tagName,\n attributes: attributes2,\n childNodes: [],\n isSVG: isSVGElement(n2) || void 0,\n needBlock,\n rootId,\n isCustom: isCustomElement\n };\n}\nfunction lowerIfExists(maybeAttr) {\n if (maybeAttr === void 0 || maybeAttr === null) {\n return \"\";\n } else {\n return maybeAttr.toLowerCase();\n }\n}\nfunction slimDOMExcluded(sn, slimDOMOptions) {\n if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {\n return true;\n } else if (sn.type === NodeType$2.Element) {\n if (slimDOMOptions.script && // script tag\n (sn.tagName === \"script\" || // (module)preload link\n sn.tagName === \"link\" && (sn.attributes.rel === \"preload\" || sn.attributes.rel === \"modulepreload\") || // prefetch link\n sn.tagName === \"link\" && sn.attributes.rel === \"prefetch\" && typeof sn.attributes.href === \"string\" && extractFileExtension(sn.attributes.href) === \"js\")) {\n return true;\n } else if (slimDOMOptions.headFavicon && (sn.tagName === \"link\" && sn.attributes.rel === \"shortcut icon\" || sn.tagName === \"meta\" && (lowerIfExists(sn.attributes.name).match(\n /^msapplication-tile(image|color)$/\n ) || lowerIfExists(sn.attributes.name) === \"application-name\" || lowerIfExists(sn.attributes.rel) === \"icon\" || lowerIfExists(sn.attributes.rel) === \"apple-touch-icon\" || lowerIfExists(sn.attributes.rel) === \"shortcut icon\"))) {\n return true;\n } else if (sn.tagName === \"meta\") {\n if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {\n return true;\n } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)\n lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === \"pinterest\")) {\n return true;\n } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === \"robots\" || lowerIfExists(sn.attributes.name) === \"googlebot\" || lowerIfExists(sn.attributes.name) === \"bingbot\")) {\n return true;\n } else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes[\"http-equiv\"] !== void 0) {\n return true;\n } else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === \"author\" || lowerIfExists(sn.attributes.name) === \"generator\" || lowerIfExists(sn.attributes.name) === \"framework\" || lowerIfExists(sn.attributes.name) === \"publisher\" || lowerIfExists(sn.attributes.name) === \"progid\" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {\n return true;\n } else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === \"google-site-verification\" || lowerIfExists(sn.attributes.name) === \"yandex-verification\" || lowerIfExists(sn.attributes.name) === \"csrf-token\" || lowerIfExists(sn.attributes.name) === \"p:domain_verify\" || lowerIfExists(sn.attributes.name) === \"verify-v1\" || lowerIfExists(sn.attributes.name) === \"verification\" || lowerIfExists(sn.attributes.name) === \"shopify-checkout-api-token\")) {\n return true;\n }\n }\n }\n return false;\n}\nfunction serializeNodeWithId(n2, options) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n skipChild = false,\n inlineStylesheet = true,\n maskInputOptions = {},\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions = {},\n inlineImages = false,\n recordCanvas = false,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout = 5e3,\n onBlockedImageLoad,\n onStylesheetLoad,\n stylesheetLoadTimeout = 5e3,\n keepIframeSrcFn = () => false,\n newlyAddedElement = false,\n ignoreCSSAttributes\n } = options;\n let { preserveWhiteSpace = true } = options;\n const _serializedNode = serializeNode(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskAllText,\n unblockSelector,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n inlineStylesheet,\n maskInputOptions,\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n keepIframeSrcFn,\n newlyAddedElement,\n ignoreCSSAttributes\n });\n if (!_serializedNode) {\n console.warn(n2, \"not serialized\");\n return null;\n }\n let id;\n if (mirror2.hasNode(n2)) {\n id = mirror2.getId(n2);\n } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\\s+|\\s+$/gm, \"\").length) {\n id = IGNORED_NODE;\n } else {\n id = genId();\n }\n const serializedNode2 = Object.assign(_serializedNode, { id });\n mirror2.add(n2, serializedNode2);\n if (id === IGNORED_NODE) {\n return null;\n }\n if (onSerialize) {\n onSerialize(n2);\n }\n let recordChild = !skipChild;\n if (serializedNode2.type === NodeType$2.Element) {\n recordChild = recordChild && !serializedNode2.needBlock;\n const shadowRoot = n2.shadowRoot;\n if (shadowRoot && isNativeShadowDom(shadowRoot))\n serializedNode2.isShadowHost = true;\n }\n if ((serializedNode2.type === NodeType$2.Document || serializedNode2.type === NodeType$2.Element) && recordChild) {\n if (slimDOMOptions.headWhitespace && serializedNode2.type === NodeType$2.Element && serializedNode2.tagName === \"head\") {\n preserveWhiteSpace = false;\n }\n const bypassOptions = {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n maskAllText,\n unblockSelector,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n skipChild,\n inlineStylesheet,\n maskInputOptions,\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onBlockedImageLoad,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n ignoreCSSAttributes\n };\n const childNodes = n2.childNodes ? Array.from(n2.childNodes) : [];\n for (const childN of childNodes) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n serializedNode2.childNodes.push(serializedChildNode);\n }\n }\n if (isElement(n2) && n2.shadowRoot) {\n for (const childN of Array.from(n2.shadowRoot.childNodes)) {\n const serializedChildNode = serializeNodeWithId(childN, bypassOptions);\n if (serializedChildNode) {\n isNativeShadowDom(n2.shadowRoot) && (serializedChildNode.isShadow = true);\n serializedNode2.childNodes.push(serializedChildNode);\n }\n }\n }\n }\n if (n2.parentNode && isShadowRoot(n2.parentNode) && isNativeShadowDom(n2.parentNode)) {\n serializedNode2.isShadow = true;\n }\n if (serializedNode2.type === NodeType$2.Element && serializedNode2.tagName === \"iframe\" && !serializedNode2.needBlock) {\n onceIframeLoaded(\n n2,\n () => {\n const iframeDoc = getIframeContentDocument(n2);\n if (iframeDoc && onIframeLoad) {\n const serializedIframeNode = serializeNodeWithId(iframeDoc, {\n doc: iframeDoc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n ignoreCSSAttributes\n });\n if (serializedIframeNode) {\n onIframeLoad(\n n2,\n serializedIframeNode\n );\n }\n }\n },\n iframeLoadTimeout\n );\n }\n if (serializedNode2.type === NodeType$2.Element && serializedNode2.tagName === \"img\" && !n2.complete && serializedNode2.needBlock) {\n const image = n2;\n const updateImageDimensions = () => {\n if (image.isConnected && !image.complete && onBlockedImageLoad) {\n try {\n const rect = image.getBoundingClientRect();\n if (rect.width > 0 && rect.height > 0) {\n onBlockedImageLoad(image, serializedNode2, rect);\n }\n } catch (error) {\n }\n }\n image.removeEventListener(\"load\", updateImageDimensions);\n };\n if (image.isConnected) {\n image.addEventListener(\"load\", updateImageDimensions);\n }\n }\n if (serializedNode2.type === NodeType$2.Element && serializedNode2.tagName === \"link\" && typeof serializedNode2.attributes.rel === \"string\" && (serializedNode2.attributes.rel === \"stylesheet\" || serializedNode2.attributes.rel === \"preload\" && typeof serializedNode2.attributes.href === \"string\" && extractFileExtension(serializedNode2.attributes.href) === \"css\")) {\n onceStylesheetLoaded(\n n2,\n () => {\n if (onStylesheetLoad) {\n const serializedLinkNode = serializeNodeWithId(n2, {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n ignoreCSSAttributes\n });\n if (serializedLinkNode) {\n onStylesheetLoad(\n n2,\n serializedLinkNode\n );\n }\n }\n },\n stylesheetLoadTimeout\n );\n }\n if (serializedNode2.type === NodeType$2.Element) {\n delete serializedNode2.needBlock;\n }\n return serializedNode2;\n}\nfunction snapshot(n2, options) {\n const {\n mirror: mirror2 = new Mirror(),\n blockClass = \"rr-block\",\n blockSelector = null,\n unblockSelector = null,\n maskAllText = false,\n maskTextClass = \"rr-mask\",\n unmaskTextClass = null,\n maskTextSelector = null,\n unmaskTextSelector = null,\n inlineStylesheet = true,\n inlineImages = false,\n recordCanvas = false,\n maskAllInputs = false,\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n slimDOM = false,\n dataURLOptions,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onBlockedImageLoad,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn = () => false,\n ignoreCSSAttributes = /* @__PURE__ */ new Set([])\n } = options || {};\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n \"datetime-local\": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true\n } : maskAllInputs === false ? {} : maskAllInputs;\n const slimDOMOptions = slimDOM === true || slimDOM === \"all\" ? (\n // if true: set of sensible options that should not throw away any information\n {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaDescKeywords: slimDOM === \"all\",\n // destructive\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaAuthorship: true,\n headMetaVerification: true\n }\n ) : slimDOM === false ? {} : slimDOM;\n return serializeNodeWithId(n2, {\n doc: n2,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n skipChild: false,\n inlineStylesheet,\n maskInputOptions,\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n slimDOMOptions,\n dataURLOptions,\n inlineImages,\n recordCanvas,\n preserveWhiteSpace,\n onSerialize,\n onIframeLoad,\n iframeLoadTimeout,\n onBlockedImageLoad,\n onStylesheetLoad,\n stylesheetLoadTimeout,\n keepIframeSrcFn,\n newlyAddedElement: false,\n ignoreCSSAttributes\n });\n}\nconst commentre = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\nfunction parse(css, options = {}) {\n let lineno = 1;\n let column = 1;\n function updatePosition(str) {\n const lines = str.match(/\\n/g);\n if (lines) {\n lineno += lines.length;\n }\n const i2 = str.lastIndexOf(\"\\n\");\n column = i2 === -1 ? column + str.length : str.length - i2;\n }\n function position() {\n const start = { line: lineno, column };\n return (node) => {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n const _Position = class _Position2 {\n constructor(start) {\n __publicField$1(this, \"content\");\n __publicField$1(this, \"start\");\n __publicField$1(this, \"end\");\n __publicField$1(this, \"source\");\n this.start = start;\n this.end = { line: lineno, column };\n this.source = options.source;\n this.content = _Position2.content;\n }\n };\n __publicField$1(_Position, \"content\");\n let Position = _Position;\n Position.content = css;\n const errorsList = [];\n function error(msg) {\n const err = new Error(\n `${options.source || \"\"}:${lineno}:${column}: ${msg}`\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = css;\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n function stylesheet() {\n const rulesList = rules2();\n return {\n type: \"stylesheet\",\n stylesheet: {\n source: options.source,\n rules: rulesList,\n parsingErrors: errorsList\n }\n };\n }\n function open() {\n return match(/^{\\s*/);\n }\n function close() {\n return match(/^}/);\n }\n function rules2() {\n let node;\n const rules22 = [];\n whitespace();\n comments(rules22);\n while (css.length && css.charAt(0) !== \"}\" && (node = atrule() || rule())) {\n if (node) {\n rules22.push(node);\n comments(rules22);\n }\n }\n return rules22;\n }\n function match(re) {\n const m = re.exec(css);\n if (!m) {\n return;\n }\n const str = m[0];\n updatePosition(str);\n css = css.slice(str.length);\n return m;\n }\n function whitespace() {\n match(/^\\s*/);\n }\n function comments(rules22 = []) {\n let c2;\n while (c2 = comment()) {\n if (c2) {\n rules22.push(c2);\n }\n c2 = comment();\n }\n return rules22;\n }\n function comment() {\n const pos = position();\n if (\"/\" !== css.charAt(0) || \"*\" !== css.charAt(1)) {\n return;\n }\n let i2 = 2;\n while (\"\" !== css.charAt(i2) && (\"*\" !== css.charAt(i2) || \"/\" !== css.charAt(i2 + 1))) {\n ++i2;\n }\n i2 += 2;\n if (\"\" === css.charAt(i2 - 1)) {\n return error(\"End of comment missing\");\n }\n const str = css.slice(2, i2 - 2);\n column += 2;\n updatePosition(str);\n css = css.slice(i2);\n column += 2;\n return pos({\n type: \"comment\",\n comment: str\n });\n }\n function selector() {\n const m = match(/^([^{]+)/);\n if (!m) {\n return;\n }\n const splitSelectors = trim(m[0]).replace(/\\/\\*([^*]|[\\r\\n]|(\\*+([^*/]|[\\r\\n])))*\\*\\/+/g, \"\").replace(/\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'/g, (m2) => {\n return m2.replace(/,/g, \"\");\n }).split(/\\s*(?![^(]*\\)),\\s*/);\n if (splitSelectors.length <= 1) {\n return splitSelectors.map((s2) => {\n return s2.replace(/\\u200C/g, \",\");\n });\n }\n let i2 = 0;\n let j = 0;\n const len = splitSelectors.length;\n const finalSelectors = [];\n while (i2 < len) {\n const openingParensCount = (splitSelectors[i2].match(/\\(/g) || []).length;\n const closingParensCount = (splitSelectors[i2].match(/\\)/g) || []).length;\n let unbalancedParens = openingParensCount - closingParensCount;\n if (unbalancedParens >= 1) {\n let foundClosingSelector = false;\n j = i2 + 1;\n while (j < len) {\n const nextOpeningParensCount = (splitSelectors[j].match(/\\(/g) || []).length;\n const nextClosingParensCount = (splitSelectors[j].match(/\\)/g) || []).length;\n const nextUnbalancedParens = nextClosingParensCount - nextOpeningParensCount;\n if (nextUnbalancedParens === unbalancedParens) {\n finalSelectors.push(splitSelectors.slice(i2, j + 1).join(\",\"));\n i2 = j + 1;\n foundClosingSelector = true;\n break;\n }\n j++;\n unbalancedParens -= nextUnbalancedParens;\n }\n if (foundClosingSelector) {\n continue;\n }\n splitSelectors.slice(i2, len).forEach((selector2) => selector2 && finalSelectors.push(selector2));\n break;\n }\n splitSelectors[i2] && finalSelectors.push(splitSelectors[i2]);\n i2++;\n }\n return finalSelectors.map((s2) => {\n return s2.replace(/\\u200C/g, \",\");\n });\n }\n function declaration() {\n const pos = position();\n const propMatch = match(/^(\\*?[-#\\/\\*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/);\n if (!propMatch) {\n return;\n }\n const prop = trim(propMatch[0]);\n if (!match(/^:\\s*/)) {\n return error(`property missing ':'`);\n }\n const val = match(/^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^\\)]*?\\)|[^};])+)/);\n const ret = pos({\n type: \"declaration\",\n property: prop.replace(commentre, \"\"),\n value: val ? trim(val[0]).replace(commentre, \"\") : \"\"\n });\n match(/^[;\\s]*/);\n return ret;\n }\n function declarations() {\n const decls = [];\n if (!open()) {\n return error(`missing '{'`);\n }\n comments(decls);\n let decl;\n while (decl = declaration()) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n decl = declaration();\n }\n if (!close()) {\n return error(`missing '}'`);\n }\n return decls;\n }\n function keyframe() {\n let m;\n const vals = [];\n const pos = position();\n while (m = match(/^((\\d+\\.\\d+|\\.\\d+|\\d+)%?|[a-z]+)\\s*/)) {\n vals.push(m[1]);\n match(/^,\\s*/);\n }\n if (!vals.length) {\n return;\n }\n return pos({\n type: \"keyframe\",\n values: vals,\n declarations: declarations()\n });\n }\n function atkeyframes() {\n const pos = position();\n let m = match(/^@([-\\w]+)?keyframes\\s*/);\n if (!m) {\n return;\n }\n const vendor = m[1];\n m = match(/^([-\\w]+)\\s*/);\n if (!m) {\n return error(\"@keyframes missing name\");\n }\n const name = m[1];\n if (!open()) {\n return error(`@keyframes missing '{'`);\n }\n let frame;\n let frames = comments();\n while (frame = keyframe()) {\n frames.push(frame);\n frames = frames.concat(comments());\n }\n if (!close()) {\n return error(`@keyframes missing '}'`);\n }\n return pos({\n type: \"keyframes\",\n name,\n vendor,\n keyframes: frames\n });\n }\n function atsupports() {\n const pos = position();\n const m = match(/^@supports *([^{]+)/);\n if (!m) {\n return;\n }\n const supports = trim(m[1]);\n if (!open()) {\n return error(`@supports missing '{'`);\n }\n const style = comments().concat(rules2());\n if (!close()) {\n return error(`@supports missing '}'`);\n }\n return pos({\n type: \"supports\",\n supports,\n rules: style\n });\n }\n function athost() {\n const pos = position();\n const m = match(/^@host\\s*/);\n if (!m) {\n return;\n }\n if (!open()) {\n return error(`@host missing '{'`);\n }\n const style = comments().concat(rules2());\n if (!close()) {\n return error(`@host missing '}'`);\n }\n return pos({\n type: \"host\",\n rules: style\n });\n }\n function atmedia() {\n const pos = position();\n const m = match(/^@media *([^{]+)/);\n if (!m) {\n return;\n }\n const media = trim(m[1]);\n if (!open()) {\n return error(`@media missing '{'`);\n }\n const style = comments().concat(rules2());\n if (!close()) {\n return error(`@media missing '}'`);\n }\n return pos({\n type: \"media\",\n media,\n rules: style\n });\n }\n function atcustommedia() {\n const pos = position();\n const m = match(/^@custom-media\\s+(--[^\\s]+)\\s*([^{;]+);/);\n if (!m) {\n return;\n }\n return pos({\n type: \"custom-media\",\n name: trim(m[1]),\n media: trim(m[2])\n });\n }\n function atpage() {\n const pos = position();\n const m = match(/^@page */);\n if (!m) {\n return;\n }\n const sel = selector() || [];\n if (!open()) {\n return error(`@page missing '{'`);\n }\n let decls = comments();\n let decl;\n while (decl = declaration()) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n if (!close()) {\n return error(`@page missing '}'`);\n }\n return pos({\n type: \"page\",\n selectors: sel,\n declarations: decls\n });\n }\n function atdocument() {\n const pos = position();\n const m = match(/^@([-\\w]+)?document *([^{]+)/);\n if (!m) {\n return;\n }\n const vendor = trim(m[1]);\n const doc = trim(m[2]);\n if (!open()) {\n return error(`@document missing '{'`);\n }\n const style = comments().concat(rules2());\n if (!close()) {\n return error(`@document missing '}'`);\n }\n return pos({\n type: \"document\",\n document: doc,\n vendor,\n rules: style\n });\n }\n function atfontface() {\n const pos = position();\n const m = match(/^@font-face\\s*/);\n if (!m) {\n return;\n }\n if (!open()) {\n return error(`@font-face missing '{'`);\n }\n let decls = comments();\n let decl;\n while (decl = declaration()) {\n decls.push(decl);\n decls = decls.concat(comments());\n }\n if (!close()) {\n return error(`@font-face missing '}'`);\n }\n return pos({\n type: \"font-face\",\n declarations: decls\n });\n }\n const atimport = _compileAtrule(\"import\");\n const atcharset = _compileAtrule(\"charset\");\n const atnamespace = _compileAtrule(\"namespace\");\n function _compileAtrule(name) {\n const re = new RegExp(\n \"^@\" + name + \"\\\\s*((?:\" + [\n /[^\\\\]\"(?:\\\\\"|[^\"])*\"/.source,\n // consume any quoted parts (checking that the double quote isn't itself escaped)\n /[^\\\\]'(?:\\\\'|[^'])*'/.source,\n // same but for single quotes\n \"[^;]\"\n ].join(\"|\") + \")+);\"\n );\n return () => {\n const pos = position();\n const m = match(re);\n if (!m) {\n return;\n }\n const ret = { type: name };\n ret[name] = m[1].trim();\n return pos(ret);\n };\n }\n function atrule() {\n if (css[0] !== \"@\") {\n return;\n }\n return atkeyframes() || atmedia() || atcustommedia() || atsupports() || atimport() || atcharset() || atnamespace() || atdocument() || atpage() || athost() || atfontface();\n }\n function rule() {\n const pos = position();\n const sel = selector();\n if (!sel) {\n return error(\"selector missing\");\n }\n comments();\n return pos({\n type: \"rule\",\n selectors: sel,\n declarations: declarations()\n });\n }\n return addParent(stylesheet());\n}\nfunction trim(str) {\n return str ? str.replace(/^\\s+|\\s+$/g, \"\") : \"\";\n}\nfunction addParent(obj, parent) {\n const isNode = obj && typeof obj.type === \"string\";\n const childParent = isNode ? obj : parent;\n for (const k of Object.keys(obj)) {\n const value = obj[k];\n if (Array.isArray(value)) {\n value.forEach((v2) => {\n addParent(v2, childParent);\n });\n } else if (value && typeof value === \"object\") {\n addParent(value, childParent);\n }\n }\n if (isNode) {\n Object.defineProperty(obj, \"parent\", {\n configurable: true,\n writable: true,\n enumerable: false,\n value: parent || null\n });\n }\n return obj;\n}\nconst tagMap = {\n script: \"noscript\",\n // camel case svg element tag names\n altglyph: \"altGlyph\",\n altglyphdef: \"altGlyphDef\",\n altglyphitem: \"altGlyphItem\",\n animatecolor: \"animateColor\",\n animatemotion: \"animateMotion\",\n animatetransform: \"animateTransform\",\n clippath: \"clipPath\",\n feblend: \"feBlend\",\n fecolormatrix: \"feColorMatrix\",\n fecomponenttransfer: \"feComponentTransfer\",\n fecomposite: \"feComposite\",\n feconvolvematrix: \"feConvolveMatrix\",\n fediffuselighting: \"feDiffuseLighting\",\n fedisplacementmap: \"feDisplacementMap\",\n fedistantlight: \"feDistantLight\",\n fedropshadow: \"feDropShadow\",\n feflood: \"feFlood\",\n fefunca: \"feFuncA\",\n fefuncb: \"feFuncB\",\n fefuncg: \"feFuncG\",\n fefuncr: \"feFuncR\",\n fegaussianblur: \"feGaussianBlur\",\n feimage: \"feImage\",\n femerge: \"feMerge\",\n femergenode: \"feMergeNode\",\n femorphology: \"feMorphology\",\n feoffset: \"feOffset\",\n fepointlight: \"fePointLight\",\n fespecularlighting: \"feSpecularLighting\",\n fespotlight: \"feSpotLight\",\n fetile: \"feTile\",\n feturbulence: \"feTurbulence\",\n foreignobject: \"foreignObject\",\n glyphref: \"glyphRef\",\n lineargradient: \"linearGradient\",\n radialgradient: \"radialGradient\"\n};\nfunction getTagName(n2) {\n let tagName = tagMap[n2.tagName] ? tagMap[n2.tagName] : n2.tagName;\n if (tagName === \"link\" && n2.attributes._cssText) {\n tagName = \"style\";\n }\n return tagName;\n}\nfunction escapeRegExp(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\nconst HOVER_SELECTOR = /([^\\\\]):hover/;\nconst HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, \"g\");\nfunction addHoverClass(cssText, cache) {\n const cachedStyle = cache?.stylesWithHoverClass.get(cssText);\n if (cachedStyle) return cachedStyle;\n if (cssText.length >= 1e6) {\n return cssText;\n }\n const ast = parse(cssText, {\n silent: true\n });\n if (!ast.stylesheet) {\n return cssText;\n }\n const selectors = [];\n ast.stylesheet.rules.forEach((rule) => {\n if (\"selectors\" in rule) {\n (rule.selectors || []).forEach((selector) => {\n if (HOVER_SELECTOR.test(selector)) {\n selectors.push(selector);\n }\n });\n }\n });\n if (selectors.length === 0) {\n return cssText;\n }\n const selectorMatcher = new RegExp(\n selectors.filter((selector, index) => selectors.indexOf(selector) === index).sort((a2, b) => b.length - a2.length).map((selector) => {\n return escapeRegExp(selector);\n }).join(\"|\"),\n \"g\"\n );\n const result = cssText.replace(selectorMatcher, (selector) => {\n const newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, \"$1.\\\\:hover\");\n return `${selector}, ${newSelector}`;\n });\n cache?.stylesWithHoverClass.set(cssText, result);\n return result;\n}\nfunction createCache() {\n const stylesWithHoverClass = /* @__PURE__ */ new Map();\n return {\n stylesWithHoverClass\n };\n}\nfunction buildNode(n2, options) {\n const { doc, hackCss, cache } = options;\n switch (n2.type) {\n case NodeType$2.Document:\n return doc.implementation.createDocument(null, \"\", null);\n case NodeType$2.DocumentType:\n return doc.implementation.createDocumentType(\n n2.name || \"html\",\n n2.publicId,\n n2.systemId\n );\n case NodeType$2.Element: {\n const tagName = getTagName(n2);\n let node;\n if (n2.isSVG) {\n node = doc.createElementNS(\"http://www.w3.org/2000/svg\", tagName);\n } else {\n if (\n // If the tag name is a custom element name\n n2.isCustom && // If the browser supports custom elements\n doc.defaultView?.customElements && // If the custom element hasn't been defined yet\n !doc.defaultView.customElements.get(n2.tagName)\n )\n doc.defaultView.customElements.define(\n n2.tagName,\n class extends doc.defaultView.HTMLElement {\n }\n );\n node = doc.createElement(tagName);\n }\n const specialAttributes = {};\n for (const name in n2.attributes) {\n if (!Object.prototype.hasOwnProperty.call(n2.attributes, name)) {\n continue;\n }\n let value = n2.attributes[name];\n if (tagName === \"option\" && name === \"selected\" && value === false) {\n continue;\n }\n if (value === null) {\n continue;\n }\n if (value === true) value = \"\";\n if (name.startsWith(\"rr_\")) {\n specialAttributes[name] = value;\n continue;\n }\n const isTextarea = tagName === \"textarea\" && name === \"value\";\n const isRemoteOrDynamicCss = tagName === \"style\" && name === \"_cssText\";\n if (isRemoteOrDynamicCss && hackCss && typeof value === \"string\") {\n value = addHoverClass(value, cache);\n }\n if ((isTextarea || isRemoteOrDynamicCss) && typeof value === \"string\") {\n const child = doc.createTextNode(value);\n for (const c2 of Array.from(node.childNodes)) {\n if (c2.nodeType === node.TEXT_NODE) {\n node.removeChild(c2);\n }\n }\n node.appendChild(child);\n continue;\n }\n try {\n if (n2.isSVG && name === \"xlink:href\") {\n node.setAttributeNS(\n \"http://www.w3.org/1999/xlink\",\n name,\n value.toString()\n );\n } else if (name === \"onload\" || name === \"onclick\" || name.substring(0, 7) === \"onmouse\") {\n node.setAttribute(\"_\" + name, value.toString());\n } else if (tagName === \"meta\" && n2.attributes[\"http-equiv\"] === \"Content-Security-Policy\" && name === \"content\") {\n node.setAttribute(\"csp-content\", value.toString());\n continue;\n } else if (tagName === \"link\" && (n2.attributes.rel === \"preload\" || n2.attributes.rel === \"modulepreload\")) {\n } else if (tagName === \"link\" && n2.attributes.rel === \"prefetch\" && typeof n2.attributes.href === \"string\" && extractFileExtension(n2.attributes.href) === \"js\") {\n } else if (tagName === \"img\" && n2.attributes.srcset && n2.attributes.rr_dataURL) {\n node.setAttribute(\n \"rrweb-original-srcset\",\n n2.attributes.srcset\n );\n } else {\n node.setAttribute(name, value.toString());\n }\n } catch (error) {\n }\n }\n for (const name in specialAttributes) {\n const value = specialAttributes[name];\n if (tagName === \"canvas\" && name === \"rr_dataURL\") {\n const image = doc.createElement(\"img\");\n image.onload = () => {\n const ctx = node.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(image, 0, 0, image.width, image.height);\n }\n };\n image.src = value.toString();\n if (node.RRNodeType)\n node.rr_dataURL = value.toString();\n } else if (tagName === \"img\" && name === \"rr_dataURL\") {\n const image = node;\n if (!image.currentSrc.startsWith(\"data:\")) {\n image.setAttribute(\n \"rrweb-original-src\",\n n2.attributes.src\n );\n image.src = value.toString();\n }\n }\n if (name === \"rr_width\") {\n node.style.setProperty(\"width\", value.toString());\n } else if (name === \"rr_height\") {\n node.style.setProperty(\"height\", value.toString());\n } else if (name === \"rr_mediaCurrentTime\" && typeof value === \"number\") {\n node.currentTime = value;\n } else if (name === \"rr_mediaState\") {\n switch (value) {\n case \"played\":\n node.play().catch((e2) => console.warn(\"media playback error\", e2));\n break;\n case \"paused\":\n node.pause();\n break;\n }\n }\n }\n if (n2.isShadowHost) {\n if (!node.shadowRoot) {\n node.attachShadow({ mode: \"open\" });\n } else {\n while (node.shadowRoot.firstChild) {\n node.shadowRoot.removeChild(node.shadowRoot.firstChild);\n }\n }\n }\n return node;\n }\n case NodeType$2.Text:\n return doc.createTextNode(\n n2.isStyle && hackCss ? addHoverClass(n2.textContent, cache) : n2.textContent\n );\n case NodeType$2.CDATA:\n if (!(doc instanceof XMLDocument)) {\n return null;\n }\n return doc.createCDATASection(n2.textContent);\n case NodeType$2.Comment:\n return doc.createComment(n2.textContent);\n default:\n return null;\n }\n}\nfunction buildNodeWithSN(n2, options) {\n const {\n doc,\n mirror: mirror2,\n skipChild = false,\n hackCss = true,\n afterAppend,\n cache\n } = options;\n if (mirror2.has(n2.id)) {\n const nodeInMirror = mirror2.getNode(n2.id);\n const meta = mirror2.getMeta(nodeInMirror);\n if (isNodeMetaEqual(meta, n2)) return mirror2.getNode(n2.id);\n }\n let node = buildNode(n2, { doc, hackCss, cache });\n if (!node) {\n return null;\n }\n if (n2.rootId && mirror2.getNode(n2.rootId) !== doc) {\n mirror2.replace(n2.rootId, doc);\n }\n if (n2.type === NodeType$2.Document) {\n doc.close();\n doc.open();\n if (n2.compatMode === \"BackCompat\" && n2.childNodes && n2.childNodes[0].type !== NodeType$2.DocumentType) {\n if (n2.childNodes[0].type === NodeType$2.Element && \"xmlns\" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === \"http://www.w3.org/1999/xhtml\") {\n doc.write(\n '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\">'\n );\n } else {\n doc.write(\n '<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"\">'\n );\n }\n }\n node = doc;\n }\n mirror2.add(node, n2);\n if ((n2.type === NodeType$2.Document || n2.type === NodeType$2.Element) && !skipChild) {\n for (const childN of n2.childNodes) {\n const childNode = buildNodeWithSN(childN, {\n doc,\n mirror: mirror2,\n skipChild: false,\n hackCss,\n afterAppend,\n cache\n });\n if (!childNode) {\n console.warn(\"Failed to rebuild\", childN);\n continue;\n }\n if (childN.isShadow && isElement(node) && node.shadowRoot) {\n node.shadowRoot.appendChild(childNode);\n } else if (n2.type === NodeType$2.Document && childN.type == NodeType$2.Element) {\n const htmlElement = childNode;\n let body = null;\n htmlElement.childNodes.forEach((child) => {\n if (child.nodeName === \"BODY\") body = child;\n });\n if (body) {\n htmlElement.removeChild(body);\n node.appendChild(childNode);\n htmlElement.appendChild(body);\n } else {\n node.appendChild(childNode);\n }\n } else {\n node.appendChild(childNode);\n }\n if (afterAppend) {\n afterAppend(childNode, childN.id);\n }\n }\n }\n return node;\n}\nfunction visit(mirror2, onVisit) {\n function walk(node) {\n onVisit(node);\n }\n for (const id of mirror2.getIds()) {\n if (mirror2.has(id)) {\n walk(mirror2.getNode(id));\n }\n }\n}\nfunction handleScroll(node, mirror2) {\n const n2 = mirror2.getMeta(node);\n if (n2?.type !== NodeType$2.Element) {\n return;\n }\n const el = node;\n for (const name in n2.attributes) {\n if (!(Object.prototype.hasOwnProperty.call(n2.attributes, name) && name.startsWith(\"rr_\"))) {\n continue;\n }\n const value = n2.attributes[name];\n if (name === \"rr_scrollLeft\") {\n el.scrollLeft = value;\n }\n if (name === \"rr_scrollTop\") {\n el.scrollTop = value;\n }\n }\n}\nfunction rebuild(n2, options) {\n const {\n doc,\n onVisit,\n hackCss = true,\n afterAppend,\n cache,\n mirror: mirror2 = new Mirror()\n } = options;\n const node = buildNodeWithSN(n2, {\n doc,\n mirror: mirror2,\n skipChild: false,\n hackCss,\n afterAppend,\n cache\n });\n visit(mirror2, (visitedNode) => {\n if (onVisit) {\n onVisit(visitedNode);\n }\n handleScroll(visitedNode, mirror2);\n });\n return node;\n}\nfunction on(type, fn, target = document) {\n const options = { capture: true, passive: true };\n target.addEventListener(type, fn, options);\n return () => target.removeEventListener(type, fn, options);\n}\nconst DEPARTED_MIRROR_ACCESS_WARNING = \"Please stop import mirror directly. Instead of that,\\r\\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\\r\\nor you can use record.mirror to access the mirror instance during recording.\";\nlet _mirror = {\n map: {},\n getId() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return -1;\n },\n getNode() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return null;\n },\n removeNodeFromMap() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n },\n has() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n return false;\n },\n reset() {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n};\nif (typeof window !== \"undefined\" && window.Proxy && window.Reflect) {\n _mirror = new Proxy(_mirror, {\n get(target, prop, receiver) {\n if (prop === \"map\") {\n console.error(DEPARTED_MIRROR_ACCESS_WARNING);\n }\n return Reflect.get(target, prop, receiver);\n }\n });\n}\nfunction throttle(func, wait, options = {}) {\n let timeout = null;\n let previous = 0;\n return function(...args) {\n const now = Date.now();\n if (!previous && options.leading === false) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n const context = this;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n func.apply(context, args);\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout$1(() => {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n func.apply(context, args);\n }, remaining);\n }\n };\n}\nfunction hookSetter(target, key, d, isRevoked, win = window) {\n const original = win.Object.getOwnPropertyDescriptor(target, key);\n win.Object.defineProperty(\n target,\n key,\n isRevoked ? d : {\n set(value) {\n setTimeout$1(() => {\n d.set.call(this, value);\n }, 0);\n if (original && original.set) {\n original.set.call(this, value);\n }\n }\n }\n );\n return () => hookSetter(target, key, original || {}, true);\n}\nfunction patch(source, name, replacement) {\n try {\n if (!(name in source)) {\n return () => {\n };\n }\n const original = source[name];\n const wrapped = replacement(original);\n if (typeof wrapped === \"function\") {\n wrapped.prototype = wrapped.prototype || {};\n Object.defineProperties(wrapped, {\n __rrweb_original__: {\n enumerable: false,\n value: original\n }\n });\n }\n source[name] = wrapped;\n return () => {\n source[name] = original;\n };\n } catch {\n return () => {\n };\n }\n}\nlet nowTimestamp = Date.now;\nif (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {\n nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();\n}\nfunction getWindowScroll(win) {\n const doc = win.document;\n return {\n left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc?.documentElement.scrollLeft || doc?.body?.parentElement?.scrollLeft || doc?.body?.scrollLeft || 0,\n top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : doc?.documentElement.scrollTop || doc?.body?.parentElement?.scrollTop || doc?.body?.scrollTop || 0\n };\n}\nfunction getWindowHeight() {\n return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;\n}\nfunction getWindowWidth() {\n return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;\n}\nfunction closestElementOfNode(node) {\n if (!node) {\n return null;\n }\n try {\n const el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;\n return el;\n } catch (error) {\n return null;\n }\n}\nfunction isBlocked(node, blockClass, blockSelector, unblockSelector, checkAncestors) {\n if (!node) {\n return false;\n }\n const el = closestElementOfNode(node);\n if (!el) {\n return false;\n }\n const blockedPredicate = createMatchPredicate(blockClass, blockSelector);\n if (!checkAncestors) {\n const isUnblocked = unblockSelector && el.matches(unblockSelector);\n return blockedPredicate(el) && !isUnblocked;\n }\n const blockDistance = distanceToMatch(el, blockedPredicate);\n let unblockDistance = -1;\n if (blockDistance < 0) {\n return false;\n }\n if (unblockSelector) {\n unblockDistance = distanceToMatch(\n el,\n createMatchPredicate(null, unblockSelector)\n );\n }\n if (blockDistance > -1 && unblockDistance < 0) {\n return true;\n }\n return blockDistance < unblockDistance;\n}\nfunction isSerialized(n2, mirror2) {\n return mirror2.getId(n2) !== -1;\n}\nfunction isIgnored(n2, mirror2) {\n return mirror2.getId(n2) === IGNORED_NODE;\n}\nfunction isAncestorRemoved(target, mirror2) {\n if (isShadowRoot(target)) {\n return false;\n }\n const id = mirror2.getId(target);\n if (!mirror2.has(id)) {\n return true;\n }\n if (target.parentNode && target.parentNode.nodeType === target.DOCUMENT_NODE) {\n return false;\n }\n if (!target.parentNode) {\n return true;\n }\n return isAncestorRemoved(target.parentNode, mirror2);\n}\nfunction legacy_isTouchEvent(event) {\n return Boolean(event.changedTouches);\n}\nfunction polyfill$1(win = window) {\n if (\"NodeList\" in win && !win.NodeList.prototype.forEach) {\n win.NodeList.prototype.forEach = Array.prototype.forEach;\n }\n if (\"DOMTokenList\" in win && !win.DOMTokenList.prototype.forEach) {\n win.DOMTokenList.prototype.forEach = Array.prototype.forEach;\n }\n if (!Node.prototype.contains) {\n Node.prototype.contains = (...args) => {\n let node = args[0];\n if (!(0 in args)) {\n throw new TypeError(\"1 argument is required\");\n }\n do {\n if (this === node) {\n return true;\n }\n } while (node = node && node.parentNode);\n return false;\n };\n }\n}\nfunction queueToResolveTrees(queue) {\n const queueNodeMap = {};\n const putIntoMap = (m, parent) => {\n const nodeInTree = {\n value: m,\n parent,\n children: []\n };\n queueNodeMap[m.node.id] = nodeInTree;\n return nodeInTree;\n };\n const queueNodeTrees = [];\n for (const mutation of queue) {\n const { nextId, parentId } = mutation;\n if (nextId && nextId in queueNodeMap) {\n const nextInTree = queueNodeMap[nextId];\n if (nextInTree.parent) {\n const idx = nextInTree.parent.children.indexOf(nextInTree);\n nextInTree.parent.children.splice(\n idx,\n 0,\n putIntoMap(mutation, nextInTree.parent)\n );\n } else {\n const idx = queueNodeTrees.indexOf(nextInTree);\n queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));\n }\n continue;\n }\n if (parentId in queueNodeMap) {\n const parentInTree = queueNodeMap[parentId];\n parentInTree.children.push(putIntoMap(mutation, parentInTree));\n continue;\n }\n queueNodeTrees.push(putIntoMap(mutation, null));\n }\n return queueNodeTrees;\n}\nfunction iterateResolveTree(tree, cb) {\n cb(tree.value);\n for (let i2 = tree.children.length - 1; i2 >= 0; i2--) {\n iterateResolveTree(tree.children[i2], cb);\n }\n}\nfunction isSerializedIframe(n2, mirror2) {\n return Boolean(n2.nodeName === \"IFRAME\" && mirror2.getMeta(n2));\n}\nfunction isSerializedStylesheet(n2, mirror2) {\n return Boolean(\n n2.nodeName === \"LINK\" && n2.nodeType === n2.ELEMENT_NODE && n2.getAttribute && n2.getAttribute(\"rel\") === \"stylesheet\" && mirror2.getMeta(n2)\n );\n}\nfunction getBaseDimension(node, rootIframe) {\n const frameElement = node.ownerDocument?.defaultView?.frameElement;\n if (!frameElement || frameElement === rootIframe) {\n return {\n x: 0,\n y: 0,\n relativeScale: 1,\n absoluteScale: 1\n };\n }\n const frameDimension = frameElement.getBoundingClientRect();\n const frameBaseDimension = getBaseDimension(frameElement, rootIframe);\n const relativeScale = frameDimension.height / frameElement.clientHeight;\n return {\n x: frameDimension.x * frameBaseDimension.relativeScale + frameBaseDimension.x,\n y: frameDimension.y * frameBaseDimension.relativeScale + frameBaseDimension.y,\n relativeScale,\n absoluteScale: frameBaseDimension.absoluteScale * relativeScale\n };\n}\nfunction hasShadowRoot(n2) {\n return Boolean(n2?.shadowRoot);\n}\nfunction getNestedRule(rules2, position) {\n const rule = rules2[position[0]];\n if (position.length === 1) {\n return rule;\n } else {\n return getNestedRule(\n rule.cssRules[position[1]].cssRules,\n position.slice(2)\n );\n }\n}\nfunction getPositionsAndIndex(nestedIndex) {\n const positions = [...nestedIndex];\n const index = positions.pop();\n return { positions, index };\n}\nfunction uniqueTextMutations(mutations) {\n const idSet = /* @__PURE__ */ new Set();\n const uniqueMutations = [];\n for (let i2 = mutations.length; i2--; ) {\n const mutation = mutations[i2];\n if (!idSet.has(mutation.id)) {\n uniqueMutations.push(mutation);\n idSet.add(mutation.id);\n }\n }\n return uniqueMutations;\n}\nclass StyleSheetMirror {\n constructor() {\n this.id = 1;\n this.styleIDMap = /* @__PURE__ */ new WeakMap();\n this.idStyleMap = /* @__PURE__ */ new Map();\n }\n getId(stylesheet) {\n return this.styleIDMap.get(stylesheet) ?? -1;\n }\n has(stylesheet) {\n return this.styleIDMap.has(stylesheet);\n }\n /**\n * @returns If the stylesheet is in the mirror, returns the id of the stylesheet. If not, return the new assigned id.\n */\n add(stylesheet, id) {\n if (this.has(stylesheet)) return this.getId(stylesheet);\n let newId;\n if (id === void 0) {\n newId = this.id++;\n } else newId = id;\n this.styleIDMap.set(stylesheet, newId);\n this.idStyleMap.set(newId, stylesheet);\n return newId;\n }\n getStyle(id) {\n return this.idStyleMap.get(id) || null;\n }\n reset() {\n this.styleIDMap = /* @__PURE__ */ new WeakMap();\n this.idStyleMap = /* @__PURE__ */ new Map();\n this.id = 1;\n }\n generateId() {\n return this.id++;\n }\n}\nfunction getShadowHost(n2) {\n let shadowHost = null;\n if (n2.getRootNode?.()?.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n2.getRootNode().host)\n shadowHost = n2.getRootNode().host;\n return shadowHost;\n}\nfunction getRootShadowHost(n2) {\n let rootShadowHost = n2;\n let shadowHost;\n while (shadowHost = getShadowHost(rootShadowHost))\n rootShadowHost = shadowHost;\n return rootShadowHost;\n}\nfunction shadowHostInDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n const shadowHost = getRootShadowHost(n2);\n return doc.contains(shadowHost);\n}\nfunction inDom(n2) {\n const doc = n2.ownerDocument;\n if (!doc) return false;\n return doc.contains(n2) || shadowHostInDom(n2);\n}\nconst cachedImplementations = {};\nfunction getImplementation(name) {\n const cached = cachedImplementations[name];\n if (cached) {\n return cached;\n }\n const document2 = window.document;\n let impl = window[name];\n if (document2 && typeof document2.createElement === \"function\") {\n try {\n const sandbox = document2.createElement(\"iframe\");\n sandbox.hidden = true;\n document2.head.appendChild(sandbox);\n const contentWindow = sandbox.contentWindow;\n if (contentWindow && contentWindow[name]) {\n impl = // eslint-disable-next-line @typescript-eslint/unbound-method\n contentWindow[name];\n }\n document2.head.removeChild(sandbox);\n } catch (e2) {\n }\n }\n return cachedImplementations[name] = impl.bind(\n window\n );\n}\nfunction onRequestAnimationFrame(...rest) {\n return getImplementation(\"requestAnimationFrame\")(...rest);\n}\nfunction setTimeout$1(...rest) {\n return getImplementation(\"setTimeout\")(...rest);\n}\nfunction clearTimeout(...rest) {\n return getImplementation(\"clearTimeout\")(...rest);\n}\nconst utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n StyleSheetMirror,\n get _mirror() {\n return _mirror;\n },\n clearTimeout,\n closestElementOfNode,\n getBaseDimension,\n getNestedRule,\n getPositionsAndIndex,\n getRootShadowHost,\n getShadowHost,\n getWindowHeight,\n getWindowScroll,\n getWindowWidth,\n hasShadowRoot,\n hookSetter,\n inDom,\n isAncestorRemoved,\n isBlocked,\n isIgnored,\n isSerialized,\n isSerializedIframe,\n isSerializedStylesheet,\n iterateResolveTree,\n legacy_isTouchEvent,\n get nowTimestamp() {\n return nowTimestamp;\n },\n on,\n onRequestAnimationFrame,\n patch,\n polyfill: polyfill$1,\n queueToResolveTrees,\n setTimeout: setTimeout$1,\n shadowHostInDom,\n throttle,\n uniqueTextMutations\n}, Symbol.toStringTag, { value: \"Module\" }));\nvar EventType = /* @__PURE__ */ ((EventType2) => {\n EventType2[EventType2[\"DomContentLoaded\"] = 0] = \"DomContentLoaded\";\n EventType2[EventType2[\"Load\"] = 1] = \"Load\";\n EventType2[EventType2[\"FullSnapshot\"] = 2] = \"FullSnapshot\";\n EventType2[EventType2[\"IncrementalSnapshot\"] = 3] = \"IncrementalSnapshot\";\n EventType2[EventType2[\"Meta\"] = 4] = \"Meta\";\n EventType2[EventType2[\"Custom\"] = 5] = \"Custom\";\n EventType2[EventType2[\"Plugin\"] = 6] = \"Plugin\";\n return EventType2;\n})(EventType || {});\nvar IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {\n IncrementalSource2[IncrementalSource2[\"Mutation\"] = 0] = \"Mutation\";\n IncrementalSource2[IncrementalSource2[\"MouseMove\"] = 1] = \"MouseMove\";\n IncrementalSource2[IncrementalSource2[\"MouseInteraction\"] = 2] = \"MouseInteraction\";\n IncrementalSource2[IncrementalSource2[\"Scroll\"] = 3] = \"Scroll\";\n IncrementalSource2[IncrementalSource2[\"ViewportResize\"] = 4] = \"ViewportResize\";\n IncrementalSource2[IncrementalSource2[\"Input\"] = 5] = \"Input\";\n IncrementalSource2[IncrementalSource2[\"TouchMove\"] = 6] = \"TouchMove\";\n IncrementalSource2[IncrementalSource2[\"MediaInteraction\"] = 7] = \"MediaInteraction\";\n IncrementalSource2[IncrementalSource2[\"StyleSheetRule\"] = 8] = \"StyleSheetRule\";\n IncrementalSource2[IncrementalSource2[\"CanvasMutation\"] = 9] = \"CanvasMutation\";\n IncrementalSource2[IncrementalSource2[\"Font\"] = 10] = \"Font\";\n IncrementalSource2[IncrementalSource2[\"Log\"] = 11] = \"Log\";\n IncrementalSource2[IncrementalSource2[\"Drag\"] = 12] = \"Drag\";\n IncrementalSource2[IncrementalSource2[\"StyleDeclaration\"] = 13] = \"StyleDeclaration\";\n IncrementalSource2[IncrementalSource2[\"Selection\"] = 14] = \"Selection\";\n IncrementalSource2[IncrementalSource2[\"AdoptedStyleSheet\"] = 15] = \"AdoptedStyleSheet\";\n IncrementalSource2[IncrementalSource2[\"CustomElement\"] = 16] = \"CustomElement\";\n return IncrementalSource2;\n})(IncrementalSource || {});\nvar MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {\n MouseInteractions2[MouseInteractions2[\"MouseUp\"] = 0] = \"MouseUp\";\n MouseInteractions2[MouseInteractions2[\"MouseDown\"] = 1] = \"MouseDown\";\n MouseInteractions2[MouseInteractions2[\"Click\"] = 2] = \"Click\";\n MouseInteractions2[MouseInteractions2[\"ContextMenu\"] = 3] = \"ContextMenu\";\n MouseInteractions2[MouseInteractions2[\"DblClick\"] = 4] = \"DblClick\";\n MouseInteractions2[MouseInteractions2[\"Focus\"] = 5] = \"Focus\";\n MouseInteractions2[MouseInteractions2[\"Blur\"] = 6] = \"Blur\";\n MouseInteractions2[MouseInteractions2[\"TouchStart\"] = 7] = \"TouchStart\";\n MouseInteractions2[MouseInteractions2[\"TouchMove_Departed\"] = 8] = \"TouchMove_Departed\";\n MouseInteractions2[MouseInteractions2[\"TouchEnd\"] = 9] = \"TouchEnd\";\n MouseInteractions2[MouseInteractions2[\"TouchCancel\"] = 10] = \"TouchCancel\";\n return MouseInteractions2;\n})(MouseInteractions || {});\nvar PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {\n PointerTypes2[PointerTypes2[\"Mouse\"] = 0] = \"Mouse\";\n PointerTypes2[PointerTypes2[\"Pen\"] = 1] = \"Pen\";\n PointerTypes2[PointerTypes2[\"Touch\"] = 2] = \"Touch\";\n return PointerTypes2;\n})(PointerTypes || {});\nvar CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {\n CanvasContext2[CanvasContext2[\"2D\"] = 0] = \"2D\";\n CanvasContext2[CanvasContext2[\"WebGL\"] = 1] = \"WebGL\";\n CanvasContext2[CanvasContext2[\"WebGL2\"] = 2] = \"WebGL2\";\n return CanvasContext2;\n})(CanvasContext || {});\nvar MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {\n MediaInteractions2[MediaInteractions2[\"Play\"] = 0] = \"Play\";\n MediaInteractions2[MediaInteractions2[\"Pause\"] = 1] = \"Pause\";\n MediaInteractions2[MediaInteractions2[\"Seeked\"] = 2] = \"Seeked\";\n MediaInteractions2[MediaInteractions2[\"VolumeChange\"] = 3] = \"VolumeChange\";\n MediaInteractions2[MediaInteractions2[\"RateChange\"] = 4] = \"RateChange\";\n return MediaInteractions2;\n})(MediaInteractions || {});\nvar ReplayerEvents = /* @__PURE__ */ ((ReplayerEvents2) => {\n ReplayerEvents2[\"Start\"] = \"start\";\n ReplayerEvents2[\"Pause\"] = \"pause\";\n ReplayerEvents2[\"Resume\"] = \"resume\";\n ReplayerEvents2[\"Resize\"] = \"resize\";\n ReplayerEvents2[\"Finish\"] = \"finish\";\n ReplayerEvents2[\"FullsnapshotRebuilded\"] = \"fullsnapshot-rebuilded\";\n ReplayerEvents2[\"LoadStylesheetStart\"] = \"load-stylesheet-start\";\n ReplayerEvents2[\"LoadStylesheetEnd\"] = \"load-stylesheet-end\";\n ReplayerEvents2[\"SkipStart\"] = \"skip-start\";\n ReplayerEvents2[\"SkipEnd\"] = \"skip-end\";\n ReplayerEvents2[\"MouseInteraction\"] = \"mouse-interaction\";\n ReplayerEvents2[\"EventCast\"] = \"event-cast\";\n ReplayerEvents2[\"CustomEvent\"] = \"custom-event\";\n ReplayerEvents2[\"Flush\"] = \"flush\";\n ReplayerEvents2[\"StateChange\"] = \"state-change\";\n ReplayerEvents2[\"PlayBack\"] = \"play-back\";\n ReplayerEvents2[\"Destroy\"] = \"destroy\";\n return ReplayerEvents2;\n})(ReplayerEvents || {});\nvar __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar __defProp2 = Object.defineProperty;\nvar __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nvar NodeType$1 = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2[\"Document\"] = 0] = \"Document\";\n NodeType2[NodeType2[\"DocumentType\"] = 1] = \"DocumentType\";\n NodeType2[NodeType2[\"Element\"] = 2] = \"Element\";\n NodeType2[NodeType2[\"Text\"] = 3] = \"Text\";\n NodeType2[NodeType2[\"CDATA\"] = 4] = \"CDATA\";\n NodeType2[NodeType2[\"Comment\"] = 5] = \"Comment\";\n return NodeType2;\n})(NodeType$1 || {});\nlet Mirror$1 = class Mirror2 {\n constructor() {\n __publicField2(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField2(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n if (!n2) return -1;\n const id = this.getMeta(n2)?.id;\n return id ?? -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach(\n (childNode) => this.removeNodeFromMap(childNode)\n );\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node) {\n return this.nodeMetaMap.has(node);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n};\nfunction createMirror$1() {\n return new Mirror$1();\n}\nfunction parseCSSText(cssText) {\n const res = {};\n const listDelimiter = /;(?![^(]*\\))/g;\n const propertyDelimiter = /:(.+)/;\n const comment = /\\/\\*.*?\\*\\//g;\n cssText.replace(comment, \"\").split(listDelimiter).forEach(function(item) {\n if (item) {\n const tmp = item.split(propertyDelimiter);\n tmp.length > 1 && (res[camelize(tmp[0].trim())] = tmp[1].trim());\n }\n });\n return res;\n}\nfunction toCSSText(style) {\n const properties = [];\n for (const name in style) {\n const value = style[name];\n if (typeof value !== \"string\") continue;\n const normalizedName = hyphenate(name);\n properties.push(`${normalizedName}: ${value};`);\n }\n return properties.join(\" \");\n}\nconst camelizeRE = /-([a-z])/g;\nconst CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;\nconst camelize = (str) => {\n if (CUSTOM_PROPERTY_REGEX.test(str)) return str;\n return str.replace(camelizeRE, (_, c2) => c2 ? c2.toUpperCase() : \"\");\n};\nconst hyphenateRE = /\\B([A-Z])/g;\nconst hyphenate = (str) => {\n return str.replace(hyphenateRE, \"-$1\").toLowerCase();\n};\nclass BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n constructor(..._args) {\n __publicField(this, \"parentElement\", null);\n __publicField(this, \"parentNode\", null);\n __publicField(this, \"ownerDocument\");\n __publicField(this, \"firstChild\", null);\n __publicField(this, \"lastChild\", null);\n __publicField(this, \"previousSibling\", null);\n __publicField(this, \"nextSibling\", null);\n __publicField(this, \"ELEMENT_NODE\", 1);\n __publicField(this, \"TEXT_NODE\", 3);\n __publicField(this, \"nodeType\");\n __publicField(this, \"nodeName\");\n __publicField(this, \"RRNodeType\");\n }\n get childNodes() {\n const childNodes = [];\n let childIterator = this.firstChild;\n while (childIterator) {\n childNodes.push(childIterator);\n childIterator = childIterator.nextSibling;\n }\n return childNodes;\n }\n contains(node) {\n if (!(node instanceof BaseRRNode)) return false;\n else if (node.ownerDocument !== this.ownerDocument) return false;\n else if (node === this) return true;\n while (node.parentNode) {\n if (node.parentNode === this) return true;\n node = node.parentNode;\n }\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n appendChild(_newChild) {\n throw new Error(\n `RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n insertBefore(_newChild, _refChild) {\n throw new Error(\n `RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n removeChild(_node) {\n throw new Error(\n `RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.`\n );\n }\n toString() {\n return \"RRNode\";\n }\n}\nclass BaseRRDocument extends BaseRRNode {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(...args) {\n super(args);\n __publicField(this, \"nodeType\", 9);\n __publicField(this, \"nodeName\", \"#document\");\n __publicField(this, \"compatMode\", \"CSS1Compat\");\n __publicField(this, \"RRNodeType\", NodeType$1.Document);\n __publicField(this, \"textContent\", null);\n this.ownerDocument = this;\n }\n get documentElement() {\n return this.childNodes.find(\n (node) => node.RRNodeType === NodeType$1.Element && node.tagName === \"HTML\"\n ) || null;\n }\n get body() {\n return this.documentElement?.childNodes.find(\n (node) => node.RRNodeType === NodeType$1.Element && node.tagName === \"BODY\"\n ) || null;\n }\n get head() {\n return this.documentElement?.childNodes.find(\n (node) => node.RRNodeType === NodeType$1.Element && node.tagName === \"HEAD\"\n ) || null;\n }\n get implementation() {\n return this;\n }\n get firstElementChild() {\n return this.documentElement;\n }\n appendChild(newChild) {\n const nodeType = newChild.RRNodeType;\n if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {\n if (this.childNodes.some((s2) => s2.RRNodeType === nodeType)) {\n throw new Error(\n `RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? \"RRElement\" : \"RRDoctype\"} on RRDocument allowed.`\n );\n }\n }\n const child = appendChild(this, newChild);\n child.parentElement = null;\n return child;\n }\n insertBefore(newChild, refChild) {\n const nodeType = newChild.RRNodeType;\n if (nodeType === NodeType$1.Element || nodeType === NodeType$1.DocumentType) {\n if (this.childNodes.some((s2) => s2.RRNodeType === nodeType)) {\n throw new Error(\n `RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? \"RRElement\" : \"RRDoctype\"} on RRDocument allowed.`\n );\n }\n }\n const child = insertBefore(this, newChild, refChild);\n child.parentElement = null;\n return child;\n }\n removeChild(node) {\n return removeChild(this, node);\n }\n open() {\n this.firstChild = null;\n this.lastChild = null;\n }\n close() {\n }\n /**\n * Adhoc implementation for setting xhtml namespace in rebuilt.ts (rrweb-snapshot).\n * There are two lines used this function:\n * 1. doc.write('\\<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\"\\>')\n * 2. doc.write('\\<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"\"\\>')\n */\n write(content) {\n let publicId;\n if (content === '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\">')\n publicId = \"-//W3C//DTD XHTML 1.0 Transitional//EN\";\n else if (content === '<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"\">')\n publicId = \"-//W3C//DTD HTML 4.0 Transitional//EN\";\n if (publicId) {\n const doctype = this.createDocumentType(\"html\", publicId, \"\");\n this.open();\n this.appendChild(doctype);\n }\n }\n createDocument(_namespace, _qualifiedName, _doctype) {\n return new BaseRRDocument();\n }\n createDocumentType(qualifiedName, publicId, systemId) {\n const doctype = new BaseRRDocumentType(qualifiedName, publicId, systemId);\n doctype.ownerDocument = this;\n return doctype;\n }\n createElement(tagName) {\n const element = new BaseRRElement(tagName);\n element.ownerDocument = this;\n return element;\n }\n createElementNS(_namespaceURI, qualifiedName) {\n return this.createElement(qualifiedName);\n }\n createTextNode(data) {\n const text = new BaseRRText(data);\n text.ownerDocument = this;\n return text;\n }\n createComment(data) {\n const comment = new BaseRRComment(data);\n comment.ownerDocument = this;\n return comment;\n }\n createCDATASection(data) {\n const CDATASection = new BaseRRCDATASection(data);\n CDATASection.ownerDocument = this;\n return CDATASection;\n }\n toString() {\n return \"RRDocument\";\n }\n}\nclass BaseRRDocumentType extends BaseRRNode {\n constructor(qualifiedName, publicId, systemId) {\n super();\n __publicField(this, \"nodeType\", 10);\n __publicField(this, \"RRNodeType\", NodeType$1.DocumentType);\n __publicField(this, \"name\");\n __publicField(this, \"publicId\");\n __publicField(this, \"systemId\");\n __publicField(this, \"textContent\", null);\n this.name = qualifiedName;\n this.publicId = publicId;\n this.systemId = systemId;\n this.nodeName = qualifiedName;\n }\n toString() {\n return \"RRDocumentType\";\n }\n}\nclass BaseRRElement extends BaseRRNode {\n constructor(tagName) {\n super();\n __publicField(this, \"nodeType\", 1);\n __publicField(this, \"RRNodeType\", NodeType$1.Element);\n __publicField(this, \"tagName\");\n __publicField(this, \"attributes\", {});\n __publicField(this, \"shadowRoot\", null);\n __publicField(this, \"scrollLeft\");\n __publicField(this, \"scrollTop\");\n this.tagName = tagName.toUpperCase();\n this.nodeName = tagName.toUpperCase();\n }\n get textContent() {\n let result = \"\";\n this.childNodes.forEach((node) => result += node.textContent);\n return result;\n }\n set textContent(textContent) {\n this.firstChild = null;\n this.lastChild = null;\n this.appendChild(this.ownerDocument.createTextNode(textContent));\n }\n get classList() {\n return new ClassList(\n this.attributes.class,\n (newClassName) => {\n this.attributes.class = newClassName;\n }\n );\n }\n get id() {\n return this.attributes.id || \"\";\n }\n get className() {\n return this.attributes.class || \"\";\n }\n get style() {\n const style = this.attributes.style ? parseCSSText(this.attributes.style) : {};\n const hyphenateRE2 = /\\B([A-Z])/g;\n style.setProperty = (name, value, priority) => {\n if (hyphenateRE2.test(name)) return;\n const normalizedName = camelize(name);\n if (!value) delete style[normalizedName];\n else style[normalizedName] = value;\n if (priority === \"important\") style[normalizedName] += \" !important\";\n this.attributes.style = toCSSText(style);\n };\n style.removeProperty = (name) => {\n if (hyphenateRE2.test(name)) return \"\";\n const normalizedName = camelize(name);\n const value = style[normalizedName] || \"\";\n delete style[normalizedName];\n this.attributes.style = toCSSText(style);\n return value;\n };\n return style;\n }\n getAttribute(name) {\n return this.attributes[name] || null;\n }\n setAttribute(name, attribute) {\n this.attributes[name] = attribute;\n }\n setAttributeNS(_namespace, qualifiedName, value) {\n this.setAttribute(qualifiedName, value);\n }\n removeAttribute(name) {\n delete this.attributes[name];\n }\n appendChild(newChild) {\n return appendChild(this, newChild);\n }\n insertBefore(newChild, refChild) {\n return insertBefore(this, newChild, refChild);\n }\n removeChild(node) {\n return removeChild(this, node);\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n attachShadow(_init) {\n const shadowRoot = this.ownerDocument.createElement(\"SHADOWROOT\");\n this.shadowRoot = shadowRoot;\n return shadowRoot;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dispatchEvent(_event) {\n return true;\n }\n toString() {\n let attributeString = \"\";\n for (const attribute in this.attributes) {\n attributeString += `${attribute}=\"${this.attributes[attribute]}\" `;\n }\n return `${this.tagName} ${attributeString}`;\n }\n}\nclass BaseRRMediaElement extends BaseRRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"currentTime\");\n __publicField(this, \"volume\");\n __publicField(this, \"paused\");\n __publicField(this, \"muted\");\n __publicField(this, \"playbackRate\");\n __publicField(this, \"loop\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n attachShadow(_init) {\n throw new Error(\n `RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow`\n );\n }\n play() {\n this.paused = false;\n }\n pause() {\n this.paused = true;\n }\n}\nclass BaseRRText extends BaseRRNode {\n constructor(data) {\n super();\n __publicField(this, \"nodeType\", 3);\n __publicField(this, \"nodeName\", \"#text\");\n __publicField(this, \"RRNodeType\", NodeType$1.Text);\n __publicField(this, \"data\");\n this.data = data;\n }\n get textContent() {\n return this.data;\n }\n set textContent(textContent) {\n this.data = textContent;\n }\n toString() {\n return `RRText text=${JSON.stringify(this.data)}`;\n }\n}\nclass BaseRRComment extends BaseRRNode {\n constructor(data) {\n super();\n __publicField(this, \"nodeType\", 8);\n __publicField(this, \"nodeName\", \"#comment\");\n __publicField(this, \"RRNodeType\", NodeType$1.Comment);\n __publicField(this, \"data\");\n this.data = data;\n }\n get textContent() {\n return this.data;\n }\n set textContent(textContent) {\n this.data = textContent;\n }\n toString() {\n return `RRComment text=${JSON.stringify(this.data)}`;\n }\n}\nclass BaseRRCDATASection extends BaseRRNode {\n constructor(data) {\n super();\n __publicField(this, \"nodeName\", \"#cdata-section\");\n __publicField(this, \"nodeType\", 4);\n __publicField(this, \"RRNodeType\", NodeType$1.CDATA);\n __publicField(this, \"data\");\n this.data = data;\n }\n get textContent() {\n return this.data;\n }\n set textContent(textContent) {\n this.data = textContent;\n }\n toString() {\n return `RRCDATASection data=${JSON.stringify(this.data)}`;\n }\n}\nclass ClassList {\n constructor(classText, onChange) {\n __publicField(this, \"onChange\");\n __publicField(this, \"classes\", []);\n __publicField(this, \"add\", (...classNames) => {\n for (const item of classNames) {\n const className = String(item);\n if (this.classes.indexOf(className) >= 0) continue;\n this.classes.push(className);\n }\n this.onChange && this.onChange(this.classes.join(\" \"));\n });\n __publicField(this, \"remove\", (...classNames) => {\n this.classes = this.classes.filter(\n (item) => classNames.indexOf(item) === -1\n );\n this.onChange && this.onChange(this.classes.join(\" \"));\n });\n if (classText) {\n const classes = classText.trim().split(/\\s+/);\n this.classes.push(...classes);\n }\n this.onChange = onChange;\n }\n}\nfunction appendChild(parent, newChild) {\n if (newChild.parentNode) newChild.parentNode.removeChild(newChild);\n if (parent.lastChild) {\n parent.lastChild.nextSibling = newChild;\n newChild.previousSibling = parent.lastChild;\n } else {\n parent.firstChild = newChild;\n newChild.previousSibling = null;\n }\n parent.lastChild = newChild;\n newChild.nextSibling = null;\n newChild.parentNode = parent;\n newChild.parentElement = parent;\n newChild.ownerDocument = parent.ownerDocument;\n return newChild;\n}\nfunction insertBefore(parent, newChild, refChild) {\n if (!refChild) return appendChild(parent, newChild);\n if (refChild.parentNode !== parent)\n throw new Error(\n \"Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.\"\n );\n if (newChild === refChild) return newChild;\n if (newChild.parentNode) newChild.parentNode.removeChild(newChild);\n newChild.previousSibling = refChild.previousSibling;\n refChild.previousSibling = newChild;\n newChild.nextSibling = refChild;\n if (newChild.previousSibling) newChild.previousSibling.nextSibling = newChild;\n else parent.firstChild = newChild;\n newChild.parentElement = parent;\n newChild.parentNode = parent;\n newChild.ownerDocument = parent.ownerDocument;\n return newChild;\n}\nfunction removeChild(parent, child) {\n if (child.parentNode !== parent)\n throw new Error(\n \"Failed to execute 'removeChild' on 'RRNode': The RRNode to be removed is not a child of this RRNode.\"\n );\n if (child.previousSibling)\n child.previousSibling.nextSibling = child.nextSibling;\n else parent.firstChild = child.nextSibling;\n if (child.nextSibling)\n child.nextSibling.previousSibling = child.previousSibling;\n else parent.lastChild = child.previousSibling;\n child.previousSibling = null;\n child.nextSibling = null;\n child.parentElement = null;\n child.parentNode = null;\n return child;\n}\nvar NodeType = /* @__PURE__ */ ((NodeType2) => {\n NodeType2[NodeType2[\"PLACEHOLDER\"] = 0] = \"PLACEHOLDER\";\n NodeType2[NodeType2[\"ELEMENT_NODE\"] = 1] = \"ELEMENT_NODE\";\n NodeType2[NodeType2[\"ATTRIBUTE_NODE\"] = 2] = \"ATTRIBUTE_NODE\";\n NodeType2[NodeType2[\"TEXT_NODE\"] = 3] = \"TEXT_NODE\";\n NodeType2[NodeType2[\"CDATA_SECTION_NODE\"] = 4] = \"CDATA_SECTION_NODE\";\n NodeType2[NodeType2[\"ENTITY_REFERENCE_NODE\"] = 5] = \"ENTITY_REFERENCE_NODE\";\n NodeType2[NodeType2[\"ENTITY_NODE\"] = 6] = \"ENTITY_NODE\";\n NodeType2[NodeType2[\"PROCESSING_INSTRUCTION_NODE\"] = 7] = \"PROCESSING_INSTRUCTION_NODE\";\n NodeType2[NodeType2[\"COMMENT_NODE\"] = 8] = \"COMMENT_NODE\";\n NodeType2[NodeType2[\"DOCUMENT_NODE\"] = 9] = \"DOCUMENT_NODE\";\n NodeType2[NodeType2[\"DOCUMENT_TYPE_NODE\"] = 10] = \"DOCUMENT_TYPE_NODE\";\n NodeType2[NodeType2[\"DOCUMENT_FRAGMENT_NODE\"] = 11] = \"DOCUMENT_FRAGMENT_NODE\";\n return NodeType2;\n})(NodeType || {});\nfunction getIFrameContentDocument(iframe) {\n try {\n return iframe.contentDocument;\n } catch (e2) {\n }\n}\nfunction getIFrameContentWindow(iframe) {\n try {\n return iframe.contentWindow;\n } catch (e2) {\n }\n}\nconst NAMESPACES = {\n svg: \"http://www.w3.org/2000/svg\",\n \"xlink:href\": \"http://www.w3.org/1999/xlink\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\nconst SVGTagMap = {\n altglyph: \"altGlyph\",\n altglyphdef: \"altGlyphDef\",\n altglyphitem: \"altGlyphItem\",\n animatecolor: \"animateColor\",\n animatemotion: \"animateMotion\",\n animatetransform: \"animateTransform\",\n clippath: \"clipPath\",\n feblend: \"feBlend\",\n fecolormatrix: \"feColorMatrix\",\n fecomponenttransfer: \"feComponentTransfer\",\n fecomposite: \"feComposite\",\n feconvolvematrix: \"feConvolveMatrix\",\n fediffuselighting: \"feDiffuseLighting\",\n fedisplacementmap: \"feDisplacementMap\",\n fedistantlight: \"feDistantLight\",\n fedropshadow: \"feDropShadow\",\n feflood: \"feFlood\",\n fefunca: \"feFuncA\",\n fefuncb: \"feFuncB\",\n fefuncg: \"feFuncG\",\n fefuncr: \"feFuncR\",\n fegaussianblur: \"feGaussianBlur\",\n feimage: \"feImage\",\n femerge: \"feMerge\",\n femergenode: \"feMergeNode\",\n femorphology: \"feMorphology\",\n feoffset: \"feOffset\",\n fepointlight: \"fePointLight\",\n fespecularlighting: \"feSpecularLighting\",\n fespotlight: \"feSpotLight\",\n fetile: \"feTile\",\n feturbulence: \"feTurbulence\",\n foreignobject: \"foreignObject\",\n glyphref: \"glyphRef\",\n lineargradient: \"linearGradient\",\n radialgradient: \"radialGradient\"\n};\nlet createdNodeSet = null;\nfunction diff(oldTree, newTree, replayer, rrnodeMirror = newTree.mirror || newTree.ownerDocument.mirror) {\n oldTree = diffBeforeUpdatingChildren(\n oldTree,\n newTree,\n replayer,\n rrnodeMirror\n );\n diffChildren(oldTree, newTree, replayer, rrnodeMirror);\n diffAfterUpdatingChildren(oldTree, newTree, replayer);\n}\nfunction diffBeforeUpdatingChildren(oldTree, newTree, replayer, rrnodeMirror) {\n if (replayer.afterAppend && !createdNodeSet) {\n createdNodeSet = /* @__PURE__ */ new WeakSet();\n setTimeout(() => {\n createdNodeSet = null;\n }, 0);\n }\n if (!sameNodeType(oldTree, newTree)) {\n const calibratedOldTree = createOrGetNode(\n newTree,\n replayer.mirror,\n rrnodeMirror\n );\n oldTree.parentNode?.replaceChild(calibratedOldTree, oldTree);\n oldTree = calibratedOldTree;\n }\n switch (newTree.RRNodeType) {\n case NodeType$1.Document: {\n if (!nodeMatching(oldTree, newTree, replayer.mirror, rrnodeMirror)) {\n const newMeta = rrnodeMirror.getMeta(newTree);\n if (newMeta) {\n replayer.mirror.removeNodeFromMap(oldTree);\n oldTree.close();\n oldTree.open();\n replayer.mirror.add(oldTree, newMeta);\n createdNodeSet?.add(oldTree);\n }\n }\n break;\n }\n case NodeType$1.Element: {\n const oldElement = oldTree;\n const newRRElement = newTree;\n switch (newRRElement.tagName) {\n case \"IFRAME\": {\n const oldContentDocument = getIFrameContentDocument(\n oldTree\n );\n if (!oldContentDocument) break;\n diff(\n oldContentDocument,\n newTree.contentDocument,\n replayer,\n rrnodeMirror\n );\n break;\n }\n }\n if (newRRElement.shadowRoot) {\n if (!oldElement.shadowRoot) oldElement.attachShadow({ mode: \"open\" });\n diffChildren(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n oldElement.shadowRoot,\n newRRElement.shadowRoot,\n replayer,\n rrnodeMirror\n );\n }\n diffProps(oldElement, newRRElement, rrnodeMirror);\n break;\n }\n }\n return oldTree;\n}\nfunction diffAfterUpdatingChildren(oldTree, newTree, replayer) {\n switch (newTree.RRNodeType) {\n case NodeType$1.Document: {\n const scrollData = newTree.scrollData;\n scrollData && replayer.applyScroll(scrollData, true);\n break;\n }\n case NodeType$1.Element: {\n const oldElement = oldTree;\n const newRRElement = newTree;\n newRRElement.scrollData && replayer.applyScroll(newRRElement.scrollData, true);\n newRRElement.inputData && replayer.applyInput(newRRElement.inputData);\n switch (newRRElement.tagName) {\n case \"AUDIO\":\n case \"VIDEO\": {\n const oldMediaElement = oldTree;\n const newMediaRRElement = newRRElement;\n if (newMediaRRElement.paused !== void 0) {\n const maybePromise = newMediaRRElement.paused ? oldMediaElement.pause() : oldMediaElement.play();\n if (typeof maybePromise?.catch === \"function\") {\n maybePromise.catch((e2) => {\n console.warn(e2);\n });\n }\n }\n if (newMediaRRElement.muted !== void 0)\n oldMediaElement.muted = newMediaRRElement.muted;\n if (newMediaRRElement.volume !== void 0)\n oldMediaElement.volume = newMediaRRElement.volume;\n if (newMediaRRElement.currentTime !== void 0)\n oldMediaElement.currentTime = newMediaRRElement.currentTime;\n if (newMediaRRElement.playbackRate !== void 0)\n oldMediaElement.playbackRate = newMediaRRElement.playbackRate;\n break;\n }\n case \"CANVAS\": {\n const rrCanvasElement = newTree;\n if (rrCanvasElement.rr_dataURL !== null) {\n const image = document.createElement(\"img\");\n image.onload = () => {\n const ctx = oldElement.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(image, 0, 0, image.width, image.height);\n }\n };\n image.src = rrCanvasElement.rr_dataURL;\n }\n rrCanvasElement.canvasMutations.forEach(\n (canvasMutation2) => replayer.applyCanvas(\n canvasMutation2.event,\n canvasMutation2.mutation,\n oldTree\n )\n );\n break;\n }\n case \"STYLE\": {\n const styleSheet = oldElement.sheet;\n styleSheet && newTree.rules.forEach(\n (data) => replayer.applyStyleSheetMutation(data, styleSheet)\n );\n break;\n }\n }\n break;\n }\n case NodeType$1.Text:\n case NodeType$1.Comment:\n case NodeType$1.CDATA: {\n if (oldTree.textContent !== newTree.data)\n oldTree.textContent = newTree.data;\n break;\n }\n }\n if (createdNodeSet?.has(oldTree)) {\n createdNodeSet.delete(oldTree);\n replayer.afterAppend?.(oldTree, replayer.mirror.getId(oldTree));\n }\n}\nfunction diffProps(oldTree, newTree, rrnodeMirror) {\n const oldAttributes = oldTree.attributes;\n const newAttributes = newTree.attributes;\n for (const name in newAttributes) {\n const newValue = newAttributes[name];\n const sn = rrnodeMirror.getMeta(newTree);\n if (sn?.isSVG && NAMESPACES[name])\n oldTree.setAttributeNS(NAMESPACES[name], name, newValue);\n else if (newTree.tagName === \"CANVAS\" && name === \"rr_dataURL\") {\n const image = document.createElement(\"img\");\n image.src = newValue;\n image.onload = () => {\n const ctx = oldTree.getContext(\"2d\");\n if (ctx) {\n ctx.drawImage(image, 0, 0, image.width, image.height);\n }\n };\n } else if (newTree.tagName === \"IFRAME\" && name === \"srcdoc\") continue;\n else {\n try {\n oldTree.setAttribute(name, newValue);\n } catch (err) {\n console.warn(err);\n }\n }\n }\n for (const { name } of Array.from(oldAttributes))\n if (!(name in newAttributes)) oldTree.removeAttribute(name);\n newTree.scrollLeft && (oldTree.scrollLeft = newTree.scrollLeft);\n newTree.scrollTop && (oldTree.scrollTop = newTree.scrollTop);\n}\nfunction diffChildren(oldTree, newTree, replayer, rrnodeMirror) {\n const oldChildren = Array.from(oldTree.childNodes);\n const newChildren = newTree.childNodes;\n if (oldChildren.length === 0 && newChildren.length === 0) return;\n let oldStartIndex = 0, oldEndIndex = oldChildren.length - 1, newStartIndex = 0, newEndIndex = newChildren.length - 1;\n let oldStartNode = oldChildren[oldStartIndex], oldEndNode = oldChildren[oldEndIndex], newStartNode = newChildren[newStartIndex], newEndNode = newChildren[newEndIndex];\n let oldIdToIndex = void 0, indexInOld = void 0;\n while (oldStartIndex <= oldEndIndex && newStartIndex <= newEndIndex) {\n if (oldStartNode === void 0) {\n oldStartNode = oldChildren[++oldStartIndex];\n } else if (oldEndNode === void 0) {\n oldEndNode = oldChildren[--oldEndIndex];\n } else if (\n // same first node?\n nodeMatching(oldStartNode, newStartNode, replayer.mirror, rrnodeMirror)\n ) {\n oldStartNode = oldChildren[++oldStartIndex];\n newStartNode = newChildren[++newStartIndex];\n } else if (\n // same last node?\n nodeMatching(oldEndNode, newEndNode, replayer.mirror, rrnodeMirror)\n ) {\n oldEndNode = oldChildren[--oldEndIndex];\n newEndNode = newChildren[--newEndIndex];\n } else if (\n // is the first old node the same as the last new node?\n nodeMatching(oldStartNode, newEndNode, replayer.mirror, rrnodeMirror)\n ) {\n try {\n handleInsertBefore(oldTree, oldStartNode, oldEndNode.nextSibling);\n } catch (e2) {\n console.warn(e2);\n }\n oldStartNode = oldChildren[++oldStartIndex];\n newEndNode = newChildren[--newEndIndex];\n } else if (\n // is the last old node the same as the first new node?\n nodeMatching(oldEndNode, newStartNode, replayer.mirror, rrnodeMirror)\n ) {\n try {\n handleInsertBefore(oldTree, oldEndNode, oldStartNode);\n } catch (e2) {\n console.warn(e2);\n }\n oldEndNode = oldChildren[--oldEndIndex];\n newStartNode = newChildren[++newStartIndex];\n } else {\n if (!oldIdToIndex) {\n oldIdToIndex = {};\n for (let i2 = oldStartIndex; i2 <= oldEndIndex; i2++) {\n const oldChild2 = oldChildren[i2];\n if (oldChild2 && replayer.mirror.hasNode(oldChild2))\n oldIdToIndex[replayer.mirror.getId(oldChild2)] = i2;\n }\n }\n indexInOld = oldIdToIndex[rrnodeMirror.getId(newStartNode)];\n const nodeToMove = oldChildren[indexInOld];\n if (indexInOld !== void 0 && nodeToMove && nodeMatching(nodeToMove, newStartNode, replayer.mirror, rrnodeMirror)) {\n try {\n handleInsertBefore(oldTree, nodeToMove, oldStartNode);\n } catch (e2) {\n console.warn(e2);\n }\n oldChildren[indexInOld] = void 0;\n } else {\n const newNode = createOrGetNode(\n newStartNode,\n replayer.mirror,\n rrnodeMirror\n );\n if (oldTree.nodeName === \"#document\" && oldStartNode && /**\n * Special case 1: one document isn't allowed to have two doctype nodes at the same time, so we need to remove the old one first before inserting the new one.\n * How this case happens: A parent document in the old tree already has a doctype node with an id e.g. #1. A new full snapshot rebuilds the replayer with a new doctype node with another id #2. According to the algorithm, the new doctype node will be inserted before the old one, which is not allowed by the Document standard.\n */\n (newNode.nodeType === newNode.DOCUMENT_TYPE_NODE && oldStartNode.nodeType === oldStartNode.DOCUMENT_TYPE_NODE || /**\n * Special case 2: one document isn't allowed to have two HTMLElements at the same time, so we need to remove the old one first before inserting the new one.\n * How this case happens: A mounted iframe element has an automatically created HTML element. We should delete it before inserting a serialized one. Otherwise, an error 'Only one element on document allowed' will be thrown.\n */\n newNode.nodeType === newNode.ELEMENT_NODE && oldStartNode.nodeType === oldStartNode.ELEMENT_NODE)) {\n oldTree.removeChild(oldStartNode);\n replayer.mirror.removeNodeFromMap(oldStartNode);\n oldStartNode = oldChildren[++oldStartIndex];\n }\n try {\n handleInsertBefore(oldTree, newNode, oldStartNode || null);\n } catch (e2) {\n console.warn(e2);\n }\n }\n newStartNode = newChildren[++newStartIndex];\n }\n }\n if (oldStartIndex > oldEndIndex) {\n const referenceRRNode = newChildren[newEndIndex + 1];\n let referenceNode = null;\n if (referenceRRNode)\n referenceNode = replayer.mirror.getNode(\n rrnodeMirror.getId(referenceRRNode)\n );\n for (; newStartIndex <= newEndIndex; ++newStartIndex) {\n const newNode = createOrGetNode(\n newChildren[newStartIndex],\n replayer.mirror,\n rrnodeMirror\n );\n try {\n handleInsertBefore(oldTree, newNode, referenceNode);\n } catch (e2) {\n console.warn(e2);\n }\n }\n } else if (newStartIndex > newEndIndex) {\n for (; oldStartIndex <= oldEndIndex; oldStartIndex++) {\n const node = oldChildren[oldStartIndex];\n if (!node || node.parentNode !== oldTree) continue;\n try {\n oldTree.removeChild(node);\n replayer.mirror.removeNodeFromMap(node);\n } catch (e2) {\n console.warn(e2);\n }\n }\n }\n let oldChild = oldTree.firstChild;\n let newChild = newTree.firstChild;\n while (oldChild !== null && newChild !== null) {\n diff(oldChild, newChild, replayer, rrnodeMirror);\n oldChild = oldChild.nextSibling;\n newChild = newChild.nextSibling;\n }\n}\nfunction createOrGetNode(rrNode, domMirror, rrnodeMirror) {\n const nodeId = rrnodeMirror.getId(rrNode);\n const sn = rrnodeMirror.getMeta(rrNode);\n let node = null;\n if (nodeId > -1) node = domMirror.getNode(nodeId);\n if (node !== null && sameNodeType(node, rrNode)) return node;\n switch (rrNode.RRNodeType) {\n case NodeType$1.Document:\n node = new Document();\n break;\n case NodeType$1.DocumentType:\n node = document.implementation.createDocumentType(\n rrNode.name,\n rrNode.publicId,\n rrNode.systemId\n );\n break;\n case NodeType$1.Element: {\n let tagName = rrNode.tagName.toLowerCase();\n tagName = SVGTagMap[tagName] || tagName;\n if (sn && \"isSVG\" in sn && sn?.isSVG) {\n node = document.createElementNS(NAMESPACES[\"svg\"], tagName);\n } else node = document.createElement(rrNode.tagName);\n break;\n }\n case NodeType$1.Text:\n node = document.createTextNode(rrNode.data);\n break;\n case NodeType$1.Comment:\n node = document.createComment(rrNode.data);\n break;\n case NodeType$1.CDATA:\n node = document.createCDATASection(rrNode.data);\n break;\n }\n if (sn) domMirror.add(node, { ...sn });\n try {\n createdNodeSet?.add(node);\n } catch (e2) {\n }\n return node;\n}\nfunction sameNodeType(node1, node2) {\n if (node1.nodeType !== node2.nodeType) return false;\n return node1.nodeType !== node1.ELEMENT_NODE || node1.tagName.toUpperCase() === node2.tagName;\n}\nfunction nodeMatching(node1, node2, domMirror, rrdomMirror) {\n const node1Id = domMirror.getId(node1);\n const node2Id = rrdomMirror.getId(node2);\n if (node1Id === -1 || node1Id !== node2Id) return false;\n return sameNodeType(node1, node2);\n}\nfunction getInsertedStylesFromElement(styleElement) {\n const elementCssRules = styleElement.sheet?.cssRules;\n if (!elementCssRules || !elementCssRules.length) return;\n const tempStyleSheet = new CSSStyleSheet();\n tempStyleSheet.replaceSync(styleElement.innerText);\n const innerTextStylesMap = {};\n for (let i2 = 0; i2 < tempStyleSheet.cssRules.length; i2++) {\n innerTextStylesMap[tempStyleSheet.cssRules[i2].cssText] = tempStyleSheet.cssRules[i2];\n }\n const insertedStylesStyleSheet = [];\n for (let i2 = 0; i2 < elementCssRules?.length; i2++) {\n const cssRuleText = elementCssRules[i2].cssText;\n if (!innerTextStylesMap[cssRuleText]) {\n insertedStylesStyleSheet.push({\n index: i2,\n cssRuleText\n });\n }\n }\n return insertedStylesStyleSheet;\n}\nfunction handleInsertBefore(oldTree, nodeToMove, insertBeforeNode) {\n let insertedStyles;\n if (nodeToMove.nodeName === \"STYLE\") {\n insertedStyles = getInsertedStylesFromElement(\n nodeToMove\n );\n }\n oldTree.insertBefore(nodeToMove, insertBeforeNode);\n if (insertedStyles && insertedStyles.length) {\n insertedStyles.forEach(({ cssRuleText, index }) => {\n nodeToMove.sheet?.insertRule(cssRuleText, index);\n });\n }\n}\nclass RRDocument extends BaseRRDocument {\n constructor(mirror2) {\n super();\n __publicField(this, \"UNSERIALIZED_STARTING_ID\", -2);\n __publicField(this, \"_unserializedId\", this.UNSERIALIZED_STARTING_ID);\n __publicField(this, \"mirror\", createMirror());\n __publicField(this, \"scrollData\", null);\n if (mirror2) {\n this.mirror = mirror2;\n }\n }\n /**\n * Every time the id is used, it will minus 1 automatically to avoid collisions.\n */\n get unserializedId() {\n return this._unserializedId--;\n }\n createDocument(_namespace, _qualifiedName, _doctype) {\n return new RRDocument();\n }\n createDocumentType(qualifiedName, publicId, systemId) {\n const documentTypeNode = new RRDocumentType(\n qualifiedName,\n publicId,\n systemId\n );\n documentTypeNode.ownerDocument = this;\n return documentTypeNode;\n }\n createElement(tagName) {\n const upperTagName = tagName.toUpperCase();\n let element;\n switch (upperTagName) {\n case \"AUDIO\":\n case \"VIDEO\":\n element = new RRMediaElement(upperTagName);\n break;\n case \"IFRAME\":\n element = new RRIFrameElement(upperTagName, this.mirror);\n break;\n case \"CANVAS\":\n element = new RRCanvasElement(upperTagName);\n break;\n case \"STYLE\":\n element = new RRStyleElement(upperTagName);\n break;\n default:\n element = new RRElement(upperTagName);\n break;\n }\n element.ownerDocument = this;\n return element;\n }\n createComment(data) {\n const commentNode = new RRComment(data);\n commentNode.ownerDocument = this;\n return commentNode;\n }\n createCDATASection(data) {\n const sectionNode = new RRCDATASection(data);\n sectionNode.ownerDocument = this;\n return sectionNode;\n }\n createTextNode(data) {\n const textNode = new RRText(data);\n textNode.ownerDocument = this;\n return textNode;\n }\n destroyTree() {\n this.firstChild = null;\n this.lastChild = null;\n this.mirror.reset();\n }\n open() {\n super.open();\n this._unserializedId = this.UNSERIALIZED_STARTING_ID;\n }\n}\nconst RRDocumentType = BaseRRDocumentType;\nclass RRElement extends BaseRRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"inputData\", null);\n __publicField(this, \"scrollData\", null);\n }\n}\nclass RRMediaElement extends BaseRRMediaElement {\n}\nclass RRCanvasElement extends RRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"rr_dataURL\", null);\n __publicField(this, \"canvasMutations\", []);\n }\n /**\n * This is a dummy implementation to distinguish RRCanvasElement from real HTMLCanvasElement.\n */\n getContext() {\n return null;\n }\n}\nclass RRStyleElement extends RRElement {\n constructor() {\n super(...arguments);\n __publicField(this, \"rules\", []);\n }\n}\nclass RRIFrameElement extends RRElement {\n constructor(upperTagName, mirror2) {\n super(upperTagName);\n __publicField(this, \"contentDocument\", new RRDocument());\n this.contentDocument.mirror = mirror2;\n }\n}\nconst RRText = BaseRRText;\nconst RRComment = BaseRRComment;\nconst RRCDATASection = BaseRRCDATASection;\nfunction getValidTagName(element) {\n if (element instanceof HTMLFormElement) {\n return \"FORM\";\n }\n return element.tagName.toUpperCase();\n}\nfunction buildFromNode(node, rrdom, domMirror, parentRRNode) {\n let rrNode;\n switch (node.nodeType) {\n case NodeType.DOCUMENT_NODE:\n if (parentRRNode && parentRRNode.nodeName === \"IFRAME\")\n rrNode = parentRRNode.contentDocument;\n else {\n rrNode = rrdom;\n rrNode.compatMode = node.compatMode;\n }\n break;\n case NodeType.DOCUMENT_TYPE_NODE: {\n const documentType = node;\n rrNode = rrdom.createDocumentType(\n documentType.name,\n documentType.publicId,\n documentType.systemId\n );\n break;\n }\n case NodeType.ELEMENT_NODE: {\n const elementNode = node;\n const tagName = getValidTagName(elementNode);\n rrNode = rrdom.createElement(tagName);\n const rrElement = rrNode;\n for (const { name, value } of Array.from(elementNode.attributes)) {\n rrElement.attributes[name] = value;\n }\n elementNode.scrollLeft && (rrElement.scrollLeft = elementNode.scrollLeft);\n elementNode.scrollTop && (rrElement.scrollTop = elementNode.scrollTop);\n break;\n }\n case NodeType.TEXT_NODE:\n rrNode = rrdom.createTextNode(node.textContent || \"\");\n break;\n case NodeType.CDATA_SECTION_NODE:\n rrNode = rrdom.createCDATASection(node.data);\n break;\n case NodeType.COMMENT_NODE:\n rrNode = rrdom.createComment(node.textContent || \"\");\n break;\n case NodeType.DOCUMENT_FRAGMENT_NODE:\n rrNode = parentRRNode.attachShadow({ mode: \"open\" });\n break;\n default:\n return null;\n }\n let sn = domMirror.getMeta(node);\n if (rrdom instanceof RRDocument) {\n if (!sn) {\n sn = getDefaultSN(rrNode, rrdom.unserializedId);\n domMirror.add(node, sn);\n }\n rrdom.mirror.add(rrNode, { ...sn });\n }\n return rrNode;\n}\nfunction buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument()) {\n function walk2(node, parentRRNode) {\n const rrNode = buildFromNode(node, rrdom, domMirror, parentRRNode);\n if (rrNode === null) return;\n if (\n // if the parentRRNode isn't a RRIFrameElement\n parentRRNode?.nodeName !== \"IFRAME\" && // if node isn't a shadow root\n node.nodeType !== NodeType.DOCUMENT_FRAGMENT_NODE\n ) {\n parentRRNode?.appendChild(rrNode);\n rrNode.parentNode = parentRRNode;\n rrNode.parentElement = parentRRNode;\n }\n if (node.nodeName === \"IFRAME\") {\n const iframeDoc = getIFrameContentDocument(node);\n iframeDoc && walk2(iframeDoc, rrNode);\n } else if (node.nodeType === NodeType.DOCUMENT_NODE || node.nodeType === NodeType.ELEMENT_NODE || node.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {\n if (node.nodeType === NodeType.ELEMENT_NODE && node.shadowRoot)\n walk2(node.shadowRoot, rrNode);\n node.childNodes.forEach((childNode) => walk2(childNode, rrNode));\n }\n }\n walk2(dom, null);\n return rrdom;\n}\nfunction createMirror() {\n return new Mirror22();\n}\nclass Mirror22 {\n constructor() {\n __publicField(this, \"idNodeMap\", /* @__PURE__ */ new Map());\n __publicField(this, \"nodeMetaMap\", /* @__PURE__ */ new WeakMap());\n }\n getId(n2) {\n if (!n2) return -1;\n const id = this.getMeta(n2)?.id;\n return id ?? -1;\n }\n getNode(id) {\n return this.idNodeMap.get(id) || null;\n }\n getIds() {\n return Array.from(this.idNodeMap.keys());\n }\n getMeta(n2) {\n return this.nodeMetaMap.get(n2) || null;\n }\n // removes the node from idNodeMap\n // doesn't remove the node from nodeMetaMap\n removeNodeFromMap(n2) {\n const id = this.getId(n2);\n this.idNodeMap.delete(id);\n if (n2.childNodes) {\n n2.childNodes.forEach((childNode) => this.removeNodeFromMap(childNode));\n }\n }\n has(id) {\n return this.idNodeMap.has(id);\n }\n hasNode(node) {\n return this.nodeMetaMap.has(node);\n }\n add(n2, meta) {\n const id = meta.id;\n this.idNodeMap.set(id, n2);\n this.nodeMetaMap.set(n2, meta);\n }\n replace(id, n2) {\n const oldNode = this.getNode(id);\n if (oldNode) {\n const meta = this.nodeMetaMap.get(oldNode);\n if (meta) this.nodeMetaMap.set(n2, meta);\n }\n this.idNodeMap.set(id, n2);\n }\n reset() {\n this.idNodeMap = /* @__PURE__ */ new Map();\n this.nodeMetaMap = /* @__PURE__ */ new WeakMap();\n }\n}\nfunction getDefaultSN(node, id) {\n switch (node.RRNodeType) {\n case NodeType$1.Document:\n return {\n id,\n type: node.RRNodeType,\n childNodes: []\n };\n case NodeType$1.DocumentType: {\n const doctype = node;\n return {\n id,\n type: node.RRNodeType,\n name: doctype.name,\n publicId: doctype.publicId,\n systemId: doctype.systemId\n };\n }\n case NodeType$1.Element:\n return {\n id,\n type: node.RRNodeType,\n tagName: node.tagName.toLowerCase(),\n // In rrweb data, all tagNames are lowercase.\n attributes: {},\n childNodes: []\n };\n case NodeType$1.Text:\n return {\n id,\n type: node.RRNodeType,\n textContent: node.textContent || \"\"\n };\n case NodeType$1.Comment:\n return {\n id,\n type: node.RRNodeType,\n textContent: node.textContent || \"\"\n };\n case NodeType$1.CDATA:\n return {\n id,\n type: node.RRNodeType,\n textContent: \"\"\n };\n }\n}\nfunction isNodeInLinkedList(n2) {\n return \"__ln\" in n2;\n}\nclass DoubleLinkedList {\n constructor() {\n this.length = 0;\n this.head = null;\n this.tail = null;\n }\n get(position) {\n if (position >= this.length) {\n throw new Error(\"Position outside of list range\");\n }\n let current = this.head;\n for (let index = 0; index < position; index++) {\n current = current?.next || null;\n }\n return current;\n }\n addNode(n2) {\n const node = {\n value: n2,\n previous: null,\n next: null\n };\n n2.__ln = node;\n if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {\n const current = n2.previousSibling.__ln.next;\n node.next = current;\n node.previous = n2.previousSibling.__ln;\n n2.previousSibling.__ln.next = node;\n if (current) {\n current.previous = node;\n }\n } else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {\n const current = n2.nextSibling.__ln.previous;\n node.previous = current;\n node.next = n2.nextSibling.__ln;\n n2.nextSibling.__ln.previous = node;\n if (current) {\n current.next = node;\n }\n } else {\n if (this.head) {\n this.head.previous = node;\n }\n node.next = this.head;\n this.head = node;\n }\n if (node.next === null) {\n this.tail = node;\n }\n this.length++;\n }\n removeNode(n2) {\n const current = n2.__ln;\n if (!this.head) {\n return;\n }\n if (!current.previous) {\n this.head = current.next;\n if (this.head) {\n this.head.previous = null;\n } else {\n this.tail = null;\n }\n } else {\n current.previous.next = current.next;\n if (current.next) {\n current.next.previous = current.previous;\n } else {\n this.tail = current.previous;\n }\n }\n if (n2.__ln) {\n delete n2.__ln;\n }\n this.length--;\n }\n}\nconst moveKey = (id, parentId) => `${id}@${parentId}`;\nclass MutationBuffer {\n constructor() {\n this.frozen = false;\n this.locked = false;\n this.texts = [];\n this.attributes = [];\n this.attributeMap = /* @__PURE__ */ new WeakMap();\n this.removes = [];\n this.mapRemoves = [];\n this.movedMap = {};\n this.addedSet = /* @__PURE__ */ new Set();\n this.movedSet = /* @__PURE__ */ new Set();\n this.droppedSet = /* @__PURE__ */ new Set();\n this.processMutations = (mutations) => {\n mutations.forEach(this.processMutation);\n this.emit();\n };\n this.emit = () => {\n if (this.frozen || this.locked) {\n return;\n }\n const adds = [];\n const addedIds = /* @__PURE__ */ new Set();\n const addList = new DoubleLinkedList();\n const getNextId = (n2) => {\n let ns = n2;\n let nextId = IGNORED_NODE;\n while (nextId === IGNORED_NODE) {\n ns = ns && ns.nextSibling;\n nextId = ns && this.mirror.getId(ns);\n }\n return nextId;\n };\n const pushAdd = (n2) => {\n if (!n2.parentNode || !inDom(n2)) {\n return;\n }\n const parentId = isShadowRoot(n2.parentNode) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(n2.parentNode);\n const nextId = getNextId(n2);\n if (parentId === -1 || nextId === -1) {\n return addList.addNode(n2);\n }\n const sn = serializeNodeWithId(n2, {\n doc: this.doc,\n mirror: this.mirror,\n blockClass: this.blockClass,\n blockSelector: this.blockSelector,\n maskAllText: this.maskAllText,\n unblockSelector: this.unblockSelector,\n maskTextClass: this.maskTextClass,\n unmaskTextClass: this.unmaskTextClass,\n maskTextSelector: this.maskTextSelector,\n unmaskTextSelector: this.unmaskTextSelector,\n skipChild: true,\n newlyAddedElement: true,\n inlineStylesheet: this.inlineStylesheet,\n maskInputOptions: this.maskInputOptions,\n maskAttributeFn: this.maskAttributeFn,\n maskTextFn: this.maskTextFn,\n maskInputFn: this.maskInputFn,\n slimDOMOptions: this.slimDOMOptions,\n dataURLOptions: this.dataURLOptions,\n recordCanvas: this.recordCanvas,\n inlineImages: this.inlineImages,\n onSerialize: (currentN) => {\n if (isSerializedIframe(currentN, this.mirror) && !isBlocked(\n currentN,\n this.blockClass,\n this.blockSelector,\n this.unblockSelector,\n false\n )) {\n this.iframeManager.addIframe(currentN);\n }\n if (isSerializedStylesheet(currentN, this.mirror)) {\n this.stylesheetManager.trackLinkElement(\n currentN\n );\n }\n if (hasShadowRoot(n2)) {\n this.shadowDomManager.addShadowRoot(n2.shadowRoot, this.doc);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n if (isBlocked(\n iframe,\n this.blockClass,\n this.blockSelector,\n this.unblockSelector,\n false\n )) {\n return;\n }\n this.iframeManager.attachIframe(iframe, childSn);\n if (iframe.contentWindow) {\n this.canvasManager.addWindow(iframe.contentWindow);\n }\n this.shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (link, childSn) => {\n this.stylesheetManager.attachLinkElement(link, childSn);\n },\n onBlockedImageLoad: (_imageEl, serializedNode, { width, height }) => {\n this.mutationCb({\n adds: [],\n removes: [],\n texts: [],\n attributes: [\n {\n id: serializedNode.id,\n attributes: {\n style: {\n width: `${width}px`,\n height: `${height}px`\n }\n }\n }\n ]\n });\n },\n ignoreCSSAttributes: this.ignoreCSSAttributes\n });\n if (sn) {\n adds.push({\n parentId,\n nextId,\n node: sn\n });\n addedIds.add(sn.id);\n }\n };\n while (this.mapRemoves.length) {\n this.mirror.removeNodeFromMap(this.mapRemoves.shift());\n }\n for (const n2 of this.movedSet) {\n if (isParentRemoved(this.removes, n2, this.mirror) && !this.movedSet.has(n2.parentNode)) {\n continue;\n }\n pushAdd(n2);\n }\n for (const n2 of this.addedSet) {\n if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removes, n2, this.mirror)) {\n pushAdd(n2);\n } else if (isAncestorInSet(this.movedSet, n2)) {\n pushAdd(n2);\n } else {\n this.droppedSet.add(n2);\n }\n }\n let candidate = null;\n while (addList.length) {\n let node = null;\n if (candidate) {\n const parentId = this.mirror.getId(candidate.value.parentNode);\n const nextId = getNextId(candidate.value);\n if (parentId !== -1 && nextId !== -1) {\n node = candidate;\n }\n }\n if (!node) {\n let tailNode = addList.tail;\n while (tailNode) {\n const _node = tailNode;\n tailNode = tailNode.previous;\n if (_node) {\n const parentId = this.mirror.getId(_node.value.parentNode);\n const nextId = getNextId(_node.value);\n if (nextId === -1) continue;\n else if (parentId !== -1) {\n node = _node;\n break;\n } else {\n const unhandledNode = _node.value;\n if (unhandledNode.parentNode && unhandledNode.parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n const shadowHost = unhandledNode.parentNode.host;\n const parentId2 = this.mirror.getId(shadowHost);\n if (parentId2 !== -1) {\n node = _node;\n break;\n }\n }\n }\n }\n }\n }\n if (!node) {\n while (addList.head) {\n addList.removeNode(addList.head.value);\n }\n break;\n }\n candidate = node.previous;\n addList.removeNode(node.value);\n pushAdd(node.value);\n }\n const payload = {\n texts: this.texts.map((text) => ({\n id: this.mirror.getId(text.node),\n value: text.value\n })).filter((text) => !addedIds.has(text.id)).filter((text) => this.mirror.has(text.id)),\n attributes: this.attributes.map((attribute) => {\n const { attributes } = attribute;\n if (typeof attributes.style === \"string\") {\n const diffAsStr = JSON.stringify(attribute.styleDiff);\n const unchangedAsStr = JSON.stringify(attribute._unchangedStyles);\n if (diffAsStr.length < attributes.style.length) {\n if ((diffAsStr + unchangedAsStr).split(\"var(\").length === attributes.style.split(\"var(\").length) {\n attributes.style = attribute.styleDiff;\n }\n }\n }\n return {\n id: this.mirror.getId(attribute.node),\n attributes\n };\n }).filter((attribute) => !addedIds.has(attribute.id)).filter((attribute) => this.mirror.has(attribute.id)),\n removes: this.removes,\n adds\n };\n if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {\n return;\n }\n this.texts = [];\n this.attributes = [];\n this.attributeMap = /* @__PURE__ */ new WeakMap();\n this.removes = [];\n this.addedSet = /* @__PURE__ */ new Set();\n this.movedSet = /* @__PURE__ */ new Set();\n this.droppedSet = /* @__PURE__ */ new Set();\n this.movedMap = {};\n this.mutationCb(payload);\n };\n this.processMutation = (m) => {\n if (isIgnored(m.target, this.mirror)) {\n return;\n }\n switch (m.type) {\n case \"characterData\": {\n const value = m.target.textContent;\n if (!isBlocked(\n m.target,\n this.blockClass,\n this.blockSelector,\n this.unblockSelector,\n false\n ) && value !== m.oldValue) {\n this.texts.push({\n value: needMaskingText(\n m.target,\n this.maskTextClass,\n this.maskTextSelector,\n this.unmaskTextClass,\n this.unmaskTextSelector,\n this.maskAllText\n ) && value ? this.maskTextFn ? this.maskTextFn(value, closestElementOfNode(m.target)) : value.replace(/[\\S]/g, \"*\") : value,\n node: m.target\n });\n }\n break;\n }\n case \"attributes\": {\n const target = m.target;\n let attributeName = m.attributeName;\n let value = m.target.getAttribute(attributeName);\n if (attributeName === \"value\") {\n const type = getInputType(target);\n const tagName = target.tagName;\n value = getInputValue(target, tagName, type);\n const isInputMasked = shouldMaskInput({\n maskInputOptions: this.maskInputOptions,\n tagName,\n type\n });\n const forceMask = needMaskingText(\n m.target,\n this.maskTextClass,\n this.maskTextSelector,\n this.unmaskTextClass,\n this.unmaskTextSelector,\n isInputMasked\n );\n value = maskInputValue({\n isMasked: forceMask,\n element: target,\n value,\n maskInputFn: this.maskInputFn\n });\n }\n if (isBlocked(\n m.target,\n this.blockClass,\n this.blockSelector,\n this.unblockSelector,\n false\n ) || value === m.oldValue) {\n return;\n }\n let item = this.attributeMap.get(m.target);\n if (target.tagName === \"IFRAME\" && attributeName === \"src\" && !this.keepIframeSrcFn(value)) {\n const iframeDoc = getIFrameContentDocument(\n target\n );\n if (!iframeDoc) {\n attributeName = \"rr_src\";\n } else {\n return;\n }\n }\n if (!item) {\n item = {\n node: m.target,\n attributes: {},\n styleDiff: {},\n _unchangedStyles: {}\n };\n this.attributes.push(item);\n this.attributeMap.set(m.target, item);\n }\n if (attributeName === \"type\" && target.tagName === \"INPUT\" && (m.oldValue || \"\").toLowerCase() === \"password\") {\n target.setAttribute(\"data-rr-is-password\", \"true\");\n }\n if (!ignoreAttribute(target.tagName, attributeName)) {\n item.attributes[attributeName] = transformAttribute(\n this.doc,\n toLowerCase(target.tagName),\n toLowerCase(attributeName),\n value,\n target,\n this.maskAttributeFn\n );\n if (attributeName === \"style\") {\n if (!this.unattachedDoc) {\n try {\n this.unattachedDoc = document.implementation.createHTMLDocument();\n } catch (e2) {\n this.unattachedDoc = this.doc;\n }\n }\n const old = this.unattachedDoc.createElement(\"span\");\n if (m.oldValue) {\n old.setAttribute(\"style\", m.oldValue);\n }\n for (const pname of Array.from(target.style)) {\n const newValue = target.style.getPropertyValue(pname);\n const newPriority = target.style.getPropertyPriority(pname);\n if (newValue !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) {\n if (newPriority === \"\") {\n item.styleDiff[pname] = newValue;\n } else {\n item.styleDiff[pname] = [newValue, newPriority];\n }\n } else {\n item._unchangedStyles[pname] = [newValue, newPriority];\n }\n }\n for (const pname of Array.from(old.style)) {\n if (target.style.getPropertyValue(pname) === \"\") {\n item.styleDiff[pname] = false;\n }\n }\n }\n }\n break;\n }\n case \"childList\": {\n if (isBlocked(\n m.target,\n this.blockClass,\n this.blockSelector,\n this.unblockSelector,\n true\n )) {\n return;\n }\n m.addedNodes.forEach((n2) => this.genAdds(n2, m.target));\n m.removedNodes.forEach((n2) => {\n const nodeId = this.mirror.getId(n2);\n const parentId = isShadowRoot(m.target) ? this.mirror.getId(m.target.host) : this.mirror.getId(m.target);\n if (isBlocked(\n m.target,\n this.blockClass,\n this.blockSelector,\n this.unblockSelector,\n false\n ) || isIgnored(n2, this.mirror) || !isSerialized(n2, this.mirror)) {\n return;\n }\n if (this.addedSet.has(n2)) {\n deepDelete(this.addedSet, n2);\n this.droppedSet.add(n2);\n } else if (this.addedSet.has(m.target) && nodeId === -1) ;\n else if (isAncestorRemoved(m.target, this.mirror)) ;\n else if (this.movedSet.has(n2) && this.movedMap[moveKey(nodeId, parentId)]) {\n deepDelete(this.movedSet, n2);\n } else {\n this.removes.push({\n parentId,\n id: nodeId,\n isShadow: isShadowRoot(m.target) && isNativeShadowDom(m.target) ? true : void 0\n });\n }\n this.mapRemoves.push(n2);\n });\n break;\n }\n }\n };\n this.genAdds = (n2, target) => {\n if (this.processedNodeManager.inOtherBuffer(n2, this)) return;\n if (this.addedSet.has(n2) || this.movedSet.has(n2)) return;\n if (this.mirror.hasNode(n2)) {\n if (isIgnored(n2, this.mirror)) {\n return;\n }\n this.movedSet.add(n2);\n let targetId = null;\n if (target && this.mirror.hasNode(target)) {\n targetId = this.mirror.getId(target);\n }\n if (targetId && targetId !== -1) {\n this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true;\n }\n } else {\n this.addedSet.add(n2);\n this.droppedSet.delete(n2);\n }\n if (!isBlocked(\n n2,\n this.blockClass,\n this.blockSelector,\n this.unblockSelector,\n false\n )) {\n if (n2.childNodes) {\n n2.childNodes.forEach((childN) => this.genAdds(childN));\n }\n if (hasShadowRoot(n2)) {\n n2.shadowRoot.childNodes.forEach((childN) => {\n this.processedNodeManager.add(childN, this);\n this.genAdds(childN, n2);\n });\n }\n }\n };\n }\n init(options) {\n [\n \"mutationCb\",\n \"blockClass\",\n \"blockSelector\",\n \"unblockSelector\",\n \"maskAllText\",\n \"maskTextClass\",\n \"unmaskTextClass\",\n \"maskTextSelector\",\n \"unmaskTextSelector\",\n \"inlineStylesheet\",\n \"maskInputOptions\",\n \"maskAttributeFn\",\n \"maskTextFn\",\n \"maskInputFn\",\n \"keepIframeSrcFn\",\n \"recordCanvas\",\n \"inlineImages\",\n \"slimDOMOptions\",\n \"dataURLOptions\",\n \"doc\",\n \"mirror\",\n \"iframeManager\",\n \"stylesheetManager\",\n \"shadowDomManager\",\n \"canvasManager\",\n \"processedNodeManager\",\n \"ignoreCSSAttributes\"\n ].forEach((key) => {\n this[key] = options[key];\n });\n }\n freeze() {\n this.frozen = true;\n this.canvasManager.freeze();\n }\n unfreeze() {\n this.frozen = false;\n this.canvasManager.unfreeze();\n this.emit();\n }\n isFrozen() {\n return this.frozen;\n }\n lock() {\n this.locked = true;\n this.canvasManager.lock();\n }\n unlock() {\n this.locked = false;\n this.canvasManager.unlock();\n this.emit();\n }\n reset() {\n this.shadowDomManager.reset();\n this.canvasManager.reset();\n }\n}\nfunction deepDelete(addsSet, n2) {\n addsSet.delete(n2);\n n2.childNodes?.forEach((childN) => deepDelete(addsSet, childN));\n}\nfunction isParentRemoved(removes, n2, mirror2) {\n if (removes.length === 0) return false;\n return _isParentRemoved(removes, n2, mirror2);\n}\nfunction _isParentRemoved(removes, n2, mirror2) {\n let node = n2.parentNode;\n while (node) {\n const parentId = mirror2.getId(node);\n if (removes.some((r2) => r2.id === parentId)) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n}\nfunction isAncestorInSet(set, n2) {\n if (set.size === 0) return false;\n return _isAncestorInSet(set, n2);\n}\nfunction _isAncestorInSet(set, n2) {\n const { parentNode } = n2;\n if (!parentNode) {\n return false;\n }\n if (set.has(parentNode)) {\n return true;\n }\n return _isAncestorInSet(set, parentNode);\n}\nlet errorHandler;\nfunction registerErrorHandler(handler) {\n errorHandler = handler;\n}\nfunction unregisterErrorHandler() {\n errorHandler = void 0;\n}\nconst callbackWrapper = (cb) => {\n if (!errorHandler) {\n return cb;\n }\n const rrwebWrapped = (...rest) => {\n try {\n return cb(...rest);\n } catch (error) {\n if (errorHandler && errorHandler(error) === true) {\n return () => {\n };\n }\n throw error;\n }\n };\n return rrwebWrapped;\n};\nconst mutationBuffers = [];\nfunction getEventTarget(event) {\n try {\n if (\"composedPath\" in event) {\n const path = event.composedPath();\n if (path.length) {\n return path[0];\n }\n } else if (\"path\" in event && event.path.length) {\n return event.path[0];\n }\n } catch {\n }\n return event && event.target;\n}\nfunction initMutationObserver(options, rootEl) {\n const mutationBuffer = new MutationBuffer();\n mutationBuffers.push(mutationBuffer);\n mutationBuffer.init(options);\n let mutationObserverCtor = window.MutationObserver || /**\n * Some websites may disable MutationObserver by removing it from the window object.\n * If someone is using rrweb to build a browser extention or things like it, they\n * could not change the website's code but can have an opportunity to inject some\n * code before the website executing its JS logic.\n * Then they can do this to store the native MutationObserver:\n * window.__rrMutationObserver = MutationObserver\n */\n window.__rrMutationObserver;\n const angularZoneSymbol = window?.Zone?.__symbol__?.(\"MutationObserver\");\n if (angularZoneSymbol && window[angularZoneSymbol]) {\n mutationObserverCtor = window[angularZoneSymbol];\n }\n const observer = new mutationObserverCtor(\n callbackWrapper((mutations) => {\n if (options.onMutation && options.onMutation(mutations) === false) {\n return;\n }\n mutationBuffer.processMutations.bind(mutationBuffer)(mutations);\n })\n );\n observer.observe(rootEl, {\n attributes: true,\n attributeOldValue: true,\n characterData: true,\n characterDataOldValue: true,\n childList: true,\n subtree: true\n });\n return observer;\n}\nfunction initMoveObserver({\n mousemoveCb,\n sampling,\n doc,\n mirror: mirror2\n}) {\n if (sampling.mousemove === false) {\n return () => {\n };\n }\n const threshold = typeof sampling.mousemove === \"number\" ? sampling.mousemove : 50;\n const callbackThreshold = typeof sampling.mousemoveCallback === \"number\" ? sampling.mousemoveCallback : 500;\n let positions = [];\n let timeBaseline;\n const wrappedCb = throttle(\n callbackWrapper(\n (source) => {\n const totalOffset = Date.now() - timeBaseline;\n mousemoveCb(\n positions.map((p) => {\n p.timeOffset -= totalOffset;\n return p;\n }),\n source\n );\n positions = [];\n timeBaseline = null;\n }\n ),\n callbackThreshold\n );\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt;\n if (!timeBaseline) {\n timeBaseline = nowTimestamp();\n }\n positions.push({\n x: clientX,\n y: clientY,\n id: mirror2.getId(target),\n timeOffset: nowTimestamp() - timeBaseline\n });\n wrappedCb(\n typeof DragEvent !== \"undefined\" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove\n );\n }),\n threshold,\n {\n trailing: false\n }\n )\n );\n const handlers = [\n on(\"mousemove\", updatePosition, doc),\n on(\"touchmove\", updatePosition, doc),\n on(\"drag\", updatePosition, doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initMouseInteractionObserver({\n mouseInteractionCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n sampling\n}) {\n if (sampling.mouseInteraction === false) {\n return () => {\n };\n }\n const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;\n const handlers = [];\n let currentPointerType = null;\n const getHandler = (eventKey) => {\n return (event) => {\n const target = getEventTarget(event);\n if (isBlocked(target, blockClass, blockSelector, unblockSelector, true)) {\n return;\n }\n let pointerType = null;\n let thisEventKey = eventKey;\n if (\"pointerType\" in event) {\n switch (event.pointerType) {\n case \"mouse\":\n pointerType = PointerTypes.Mouse;\n break;\n case \"touch\":\n pointerType = PointerTypes.Touch;\n break;\n case \"pen\":\n pointerType = PointerTypes.Pen;\n break;\n }\n if (pointerType === PointerTypes.Touch) {\n if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) {\n thisEventKey = \"TouchStart\";\n } else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) {\n thisEventKey = \"TouchEnd\";\n }\n } else if (pointerType === PointerTypes.Pen) ;\n } else if (legacy_isTouchEvent(event)) {\n pointerType = PointerTypes.Touch;\n }\n if (pointerType !== null) {\n currentPointerType = pointerType;\n if (thisEventKey.startsWith(\"Touch\") && pointerType === PointerTypes.Touch || thisEventKey.startsWith(\"Mouse\") && pointerType === PointerTypes.Mouse) {\n pointerType = null;\n }\n } else if (MouseInteractions[eventKey] === MouseInteractions.Click) {\n pointerType = currentPointerType;\n currentPointerType = null;\n }\n const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;\n if (!e2) {\n return;\n }\n const id = mirror2.getId(target);\n const { clientX, clientY } = e2;\n callbackWrapper(mouseInteractionCb)({\n type: MouseInteractions[thisEventKey],\n id,\n x: clientX,\n y: clientY,\n ...pointerType !== null && { pointerType }\n });\n };\n };\n Object.keys(MouseInteractions).filter(\n (key) => Number.isNaN(Number(key)) && !key.endsWith(\"_Departed\") && disableMap[key] !== false\n ).forEach((eventKey) => {\n let eventName = toLowerCase(eventKey);\n const handler = getHandler(eventKey);\n if (window.PointerEvent) {\n switch (MouseInteractions[eventKey]) {\n case MouseInteractions.MouseDown:\n case MouseInteractions.MouseUp:\n eventName = eventName.replace(\n \"mouse\",\n \"pointer\"\n );\n break;\n case MouseInteractions.TouchStart:\n case MouseInteractions.TouchEnd:\n return;\n }\n }\n handlers.push(on(eventName, handler, doc));\n });\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initScrollObserver({\n scrollCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n sampling\n}) {\n const updatePosition = callbackWrapper(\n throttle(\n callbackWrapper((evt) => {\n const target = getEventTarget(evt);\n if (!target || isBlocked(\n target,\n blockClass,\n blockSelector,\n unblockSelector,\n true\n )) {\n return;\n }\n const id = mirror2.getId(target);\n if (target === doc && doc.defaultView) {\n const scrollLeftTop = getWindowScroll(doc.defaultView);\n scrollCb({\n id,\n x: scrollLeftTop.left,\n y: scrollLeftTop.top\n });\n } else {\n scrollCb({\n id,\n x: target.scrollLeft,\n y: target.scrollTop\n });\n }\n }),\n sampling.scroll || 100\n )\n );\n return on(\"scroll\", updatePosition, doc);\n}\nfunction initViewportResizeObserver({ viewportResizeCb }, { win }) {\n let lastH = -1;\n let lastW = -1;\n const updateDimension = callbackWrapper(\n throttle(\n callbackWrapper(() => {\n const height = getWindowHeight();\n const width = getWindowWidth();\n if (lastH !== height || lastW !== width) {\n viewportResizeCb({\n width: Number(width),\n height: Number(height)\n });\n lastH = height;\n lastW = width;\n }\n }),\n 200\n )\n );\n return on(\"resize\", updateDimension, win);\n}\nconst INPUT_TAGS = [\"INPUT\", \"TEXTAREA\", \"SELECT\"];\nconst lastInputValueMap = /* @__PURE__ */ new WeakMap();\nfunction initInputObserver({\n inputCb,\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n ignoreClass,\n ignoreSelector,\n maskInputOptions,\n maskInputFn,\n sampling,\n userTriggeredOnInput,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector\n}) {\n function eventHandler(event) {\n let target = getEventTarget(event);\n const userTriggered = event.isTrusted;\n const tagName = target && toUpperCase(target.tagName);\n if (tagName === \"OPTION\") target = target.parentElement;\n if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked(\n target,\n blockClass,\n blockSelector,\n unblockSelector,\n true\n )) {\n return;\n }\n const el = target;\n if (el.classList.contains(ignoreClass) || ignoreSelector && el.matches(ignoreSelector)) {\n return;\n }\n const type = getInputType(target);\n let text = getInputValue(el, tagName, type);\n let isChecked = false;\n const isInputMasked = shouldMaskInput({\n maskInputOptions,\n tagName,\n type\n });\n const forceMask = needMaskingText(\n target,\n maskTextClass,\n maskTextSelector,\n unmaskTextClass,\n unmaskTextSelector,\n isInputMasked\n );\n if (type === \"radio\" || type === \"checkbox\") {\n isChecked = target.checked;\n }\n text = maskInputValue({\n isMasked: forceMask,\n element: target,\n value: text,\n maskInputFn\n });\n cbWithDedup(\n target,\n userTriggeredOnInput ? { text, isChecked, userTriggered } : { text, isChecked }\n );\n const name = target.name;\n if (type === \"radio\" && name && isChecked) {\n doc.querySelectorAll(`input[type=\"radio\"][name=\"${name}\"]`).forEach((el2) => {\n if (el2 !== target) {\n const text2 = maskInputValue({\n // share mask behavior of `target`\n isMasked: forceMask,\n element: el2,\n value: getInputValue(el2, tagName, type),\n maskInputFn\n });\n cbWithDedup(\n el2,\n userTriggeredOnInput ? { text: text2, isChecked: !isChecked, userTriggered: false } : { text: text2, isChecked: !isChecked }\n );\n }\n });\n }\n }\n function cbWithDedup(target, v2) {\n const lastInputValue = lastInputValueMap.get(target);\n if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {\n lastInputValueMap.set(target, v2);\n const id = mirror2.getId(target);\n callbackWrapper(inputCb)({\n ...v2,\n id\n });\n }\n }\n const events = sampling.input === \"last\" ? [\"change\"] : [\"input\", \"change\"];\n const handlers = events.map(\n (eventName) => on(eventName, callbackWrapper(eventHandler), doc)\n );\n const currentWindow = doc.defaultView;\n if (!currentWindow) {\n return () => {\n handlers.forEach((h) => h());\n };\n }\n const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(\n currentWindow.HTMLInputElement.prototype,\n \"value\"\n );\n const hookProperties = [\n [currentWindow.HTMLInputElement.prototype, \"value\"],\n [currentWindow.HTMLInputElement.prototype, \"checked\"],\n [currentWindow.HTMLSelectElement.prototype, \"value\"],\n [currentWindow.HTMLTextAreaElement.prototype, \"value\"],\n // Some UI library use selectedIndex to set select value\n [currentWindow.HTMLSelectElement.prototype, \"selectedIndex\"],\n [currentWindow.HTMLOptionElement.prototype, \"selected\"]\n ];\n if (propertyDescriptor && propertyDescriptor.set) {\n handlers.push(\n ...hookProperties.map(\n (p) => hookSetter(\n p[0],\n p[1],\n {\n set() {\n callbackWrapper(eventHandler)({\n target: this,\n isTrusted: false\n // userTriggered to false as this could well be programmatic\n });\n }\n },\n false,\n currentWindow\n )\n )\n );\n }\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction getNestedCSSRulePositions(rule) {\n const positions = [];\n function recurse(childRule, pos) {\n if (hasNestedCSSRule(\"CSSGroupingRule\") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule(\"CSSMediaRule\") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule(\"CSSSupportsRule\") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule(\"CSSConditionRule\") && childRule.parentRule instanceof CSSConditionRule) {\n const rules2 = Array.from(\n childRule.parentRule.cssRules\n );\n const index = rules2.indexOf(childRule);\n pos.unshift(index);\n } else if (childRule.parentStyleSheet) {\n const rules2 = Array.from(childRule.parentStyleSheet.cssRules);\n const index = rules2.indexOf(childRule);\n pos.unshift(index);\n }\n return pos;\n }\n return recurse(rule, positions);\n}\nfunction getIdAndStyleId(sheet, mirror2, styleMirror) {\n let id, styleId;\n if (!sheet) return {};\n if (sheet.ownerNode) id = mirror2.getId(sheet.ownerNode);\n else styleId = styleMirror.getId(sheet);\n return {\n styleId,\n id\n };\n}\nfunction initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) {\n if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {\n return () => {\n };\n }\n const insertRule = win.CSSStyleSheet.prototype.insertRule;\n win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule, index] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [{ rule, index }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n const deleteRule = win.CSSStyleSheet.prototype.deleteRule;\n win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [{ index }]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n let replace;\n if (win.CSSStyleSheet.prototype.replace) {\n replace = win.CSSStyleSheet.prototype.replace;\n win.CSSStyleSheet.prototype.replace = new Proxy(replace, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replace: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n let replaceSync;\n if (win.CSSStyleSheet.prototype.replaceSync) {\n replaceSync = win.CSSStyleSheet.prototype.replaceSync;\n win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [text] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n replaceSync: text\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n }\n const supportedNestedCSSRuleTypes = {};\n if (canMonkeyPatchNestedCSSRule(\"CSSGroupingRule\")) {\n supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;\n } else {\n if (canMonkeyPatchNestedCSSRule(\"CSSMediaRule\")) {\n supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;\n }\n if (canMonkeyPatchNestedCSSRule(\"CSSConditionRule\")) {\n supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;\n }\n if (canMonkeyPatchNestedCSSRule(\"CSSSupportsRule\")) {\n supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;\n }\n }\n const unmodifiedFunctions = {};\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n unmodifiedFunctions[typeKey] = {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n insertRule: type.prototype.insertRule,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n deleteRule: type.prototype.deleteRule\n };\n type.prototype.insertRule = new Proxy(\n unmodifiedFunctions[typeKey].insertRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [rule, index] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n adds: [\n {\n rule,\n index: [\n ...getNestedCSSRulePositions(thisArg),\n index || 0\n // defaults to 0\n ]\n }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n type.prototype.deleteRule = new Proxy(\n unmodifiedFunctions[typeKey].deleteRule,\n {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [index] = argumentsList;\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleSheetRuleCb({\n id,\n styleId,\n removes: [\n { index: [...getNestedCSSRulePositions(thisArg), index] }\n ]\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n }\n );\n });\n return callbackWrapper(() => {\n win.CSSStyleSheet.prototype.insertRule = insertRule;\n win.CSSStyleSheet.prototype.deleteRule = deleteRule;\n replace && (win.CSSStyleSheet.prototype.replace = replace);\n replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);\n Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {\n type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;\n type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;\n });\n });\n}\nfunction initAdoptedStyleSheetObserver({\n mirror: mirror2,\n stylesheetManager\n}, host) {\n let hostId = null;\n if (host.nodeName === \"#document\") hostId = mirror2.getId(host);\n else hostId = mirror2.getId(host.host);\n const patchTarget = host.nodeName === \"#document\" ? host.defaultView?.Document : host.ownerDocument?.defaultView?.ShadowRoot;\n const originalPropertyDescriptor = patchTarget?.prototype ? Object.getOwnPropertyDescriptor(\n patchTarget?.prototype,\n \"adoptedStyleSheets\"\n ) : void 0;\n if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor)\n return () => {\n };\n Object.defineProperty(host, \"adoptedStyleSheets\", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n get() {\n return originalPropertyDescriptor.get?.call(this);\n },\n set(sheets) {\n const result = originalPropertyDescriptor.set?.call(this, sheets);\n if (hostId !== null && hostId !== -1) {\n try {\n stylesheetManager.adoptStyleSheets(sheets, hostId);\n } catch (e2) {\n }\n }\n return result;\n }\n });\n return callbackWrapper(() => {\n Object.defineProperty(host, \"adoptedStyleSheets\", {\n configurable: originalPropertyDescriptor.configurable,\n enumerable: originalPropertyDescriptor.enumerable,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n get: originalPropertyDescriptor.get,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n set: originalPropertyDescriptor.set\n });\n });\n}\nfunction initStyleDeclarationObserver({\n styleDeclarationCb,\n mirror: mirror2,\n ignoreCSSAttributes,\n stylesheetManager\n}, { win }) {\n const setProperty = win.CSSStyleDeclaration.prototype.setProperty;\n win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [property, value, priority] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return setProperty.apply(thisArg, [property, value, priority]);\n }\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentRule?.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n set: {\n property,\n value,\n priority\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {\n apply: callbackWrapper(\n (target, thisArg, argumentsList) => {\n const [property] = argumentsList;\n if (ignoreCSSAttributes.has(property)) {\n return removeProperty.apply(thisArg, [property]);\n }\n const { id, styleId } = getIdAndStyleId(\n thisArg.parentRule?.parentStyleSheet,\n mirror2,\n stylesheetManager.styleMirror\n );\n if (id && id !== -1 || styleId && styleId !== -1) {\n styleDeclarationCb({\n id,\n styleId,\n remove: {\n property\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n index: getNestedCSSRulePositions(thisArg.parentRule)\n });\n }\n return target.apply(thisArg, argumentsList);\n }\n )\n });\n return callbackWrapper(() => {\n win.CSSStyleDeclaration.prototype.setProperty = setProperty;\n win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;\n });\n}\nfunction initMediaInteractionObserver({\n mediaInteractionCb,\n blockClass,\n blockSelector,\n unblockSelector,\n mirror: mirror2,\n sampling,\n doc\n}) {\n const handler = callbackWrapper(\n (type) => throttle(\n callbackWrapper((event) => {\n const target = getEventTarget(event);\n if (!target || isBlocked(\n target,\n blockClass,\n blockSelector,\n unblockSelector,\n true\n )) {\n return;\n }\n const { currentTime, volume, muted, playbackRate } = target;\n mediaInteractionCb({\n type,\n id: mirror2.getId(target),\n currentTime,\n volume,\n muted,\n playbackRate\n });\n }),\n sampling.media || 500\n )\n );\n const handlers = [\n on(\"play\", handler(MediaInteractions.Play), doc),\n on(\"pause\", handler(MediaInteractions.Pause), doc),\n on(\"seeked\", handler(MediaInteractions.Seeked), doc),\n on(\"volumechange\", handler(MediaInteractions.VolumeChange), doc),\n on(\"ratechange\", handler(MediaInteractions.RateChange), doc)\n ];\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initFontObserver({ fontCb, doc }) {\n const win = doc.defaultView;\n if (!win) {\n return () => {\n };\n }\n const handlers = [];\n const fontMap = /* @__PURE__ */ new WeakMap();\n const originalFontFace = win.FontFace;\n win.FontFace = function FontFace2(family, source, descriptors) {\n const fontFace = new originalFontFace(family, source, descriptors);\n fontMap.set(fontFace, {\n family,\n buffer: typeof source !== \"string\",\n descriptors,\n fontSource: typeof source === \"string\" ? source : JSON.stringify(Array.from(new Uint8Array(source)))\n });\n return fontFace;\n };\n const restoreHandler = patch(\n doc.fonts,\n \"add\",\n function(original) {\n return function(fontFace) {\n setTimeout$1(\n callbackWrapper(() => {\n const p = fontMap.get(fontFace);\n if (p) {\n fontCb(p);\n fontMap.delete(fontFace);\n }\n }),\n 0\n );\n return original.apply(this, [fontFace]);\n };\n }\n );\n handlers.push(() => {\n win.FontFace = originalFontFace;\n });\n handlers.push(restoreHandler);\n return callbackWrapper(() => {\n handlers.forEach((h) => h());\n });\n}\nfunction initSelectionObserver(param) {\n const {\n doc,\n mirror: mirror2,\n blockClass,\n blockSelector,\n unblockSelector,\n selectionCb\n } = param;\n let collapsed = true;\n const updateSelection = callbackWrapper(() => {\n const selection = doc.getSelection();\n if (!selection || collapsed && selection?.isCollapsed) return;\n collapsed = selection.isCollapsed || false;\n const ranges = [];\n const count = selection.rangeCount || 0;\n for (let i2 = 0; i2 < count; i2++) {\n const range = selection.getRangeAt(i2);\n const { startContainer, startOffset, endContainer, endOffset } = range;\n const blocked = isBlocked(\n startContainer,\n blockClass,\n blockSelector,\n unblockSelector,\n true\n ) || isBlocked(\n endContainer,\n blockClass,\n blockSelector,\n unblockSelector,\n true\n );\n if (blocked) continue;\n ranges.push({\n start: mirror2.getId(startContainer),\n startOffset,\n end: mirror2.getId(endContainer),\n endOffset\n });\n }\n selectionCb({ ranges });\n });\n updateSelection();\n return on(\"selectionchange\", updateSelection);\n}\nfunction initCustomElementObserver({\n doc,\n customElementCb\n}) {\n const win = doc.defaultView;\n if (!win || !win.customElements) return () => {\n };\n const restoreHandler = patch(\n win.customElements,\n \"define\",\n function(original) {\n return function(name, constructor, options) {\n try {\n customElementCb({\n define: {\n name\n }\n });\n } catch (e2) {\n }\n return original.apply(this, [name, constructor, options]);\n };\n }\n );\n return restoreHandler;\n}\nfunction initObservers(o2, _hooks = {}) {\n const currentWindow = o2.doc.defaultView;\n if (!currentWindow) {\n return () => {\n };\n }\n let mutationObserver;\n if (o2.recordDOM) {\n mutationObserver = initMutationObserver(o2, o2.doc);\n }\n const mousemoveHandler = initMoveObserver(o2);\n const mouseInteractionHandler = initMouseInteractionObserver(o2);\n const scrollHandler = initScrollObserver(o2);\n const viewportResizeHandler = initViewportResizeObserver(o2, {\n win: currentWindow\n });\n const inputHandler = initInputObserver(o2);\n const mediaInteractionHandler = initMediaInteractionObserver(o2);\n let styleSheetObserver = () => {\n };\n let adoptedStyleSheetObserver = () => {\n };\n let styleDeclarationObserver = () => {\n };\n let fontObserver = () => {\n };\n if (o2.recordDOM) {\n styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow });\n adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc);\n styleDeclarationObserver = initStyleDeclarationObserver(o2, {\n win: currentWindow\n });\n if (o2.collectFonts) {\n fontObserver = initFontObserver(o2);\n }\n }\n const selectionObserver = initSelectionObserver(o2);\n const customElementObserver = initCustomElementObserver(o2);\n const pluginHandlers = [];\n for (const plugin of o2.plugins) {\n pluginHandlers.push(\n plugin.observer(plugin.callback, currentWindow, plugin.options)\n );\n }\n return callbackWrapper(() => {\n mutationBuffers.forEach((b) => b.reset());\n mutationObserver?.disconnect();\n mousemoveHandler();\n mouseInteractionHandler();\n scrollHandler();\n viewportResizeHandler();\n inputHandler();\n mediaInteractionHandler();\n styleSheetObserver();\n adoptedStyleSheetObserver();\n styleDeclarationObserver();\n fontObserver();\n selectionObserver();\n customElementObserver();\n pluginHandlers.forEach((h) => h());\n });\n}\nfunction hasNestedCSSRule(prop) {\n return typeof window[prop] !== \"undefined\";\n}\nfunction canMonkeyPatchNestedCSSRule(prop) {\n return Boolean(\n typeof window[prop] !== \"undefined\" && // Note: Generally, this check _shouldn't_ be necessary\n // However, in some scenarios (e.g. jsdom) this can sometimes fail, so we check for it here\n window[prop].prototype && \"insertRule\" in window[prop].prototype && \"deleteRule\" in window[prop].prototype\n );\n}\nclass CrossOriginIframeMirror {\n constructor(generateIdFn) {\n this.generateIdFn = generateIdFn;\n this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();\n this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();\n }\n getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {\n const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);\n let id = idToRemoteIdMap.get(remoteId);\n if (!id) {\n id = this.generateIdFn();\n idToRemoteIdMap.set(remoteId, id);\n remoteIdToIdMap.set(id, remoteId);\n }\n return id;\n }\n getIds(iframe, remoteId) {\n const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return remoteId.map(\n (id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap)\n );\n }\n getRemoteId(iframe, id, map) {\n const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);\n if (typeof id !== \"number\") return id;\n const remoteId = remoteIdToIdMap.get(id);\n if (!remoteId) return -1;\n return remoteId;\n }\n getRemoteIds(iframe, ids) {\n const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);\n return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));\n }\n reset(iframe) {\n if (!iframe) {\n this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();\n this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();\n return;\n }\n this.iframeIdToRemoteIdMap.delete(iframe);\n this.iframeRemoteIdToIdMap.delete(iframe);\n }\n getIdToRemoteIdMap(iframe) {\n let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);\n if (!idToRemoteIdMap) {\n idToRemoteIdMap = /* @__PURE__ */ new Map();\n this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);\n }\n return idToRemoteIdMap;\n }\n getRemoteIdToIdMap(iframe) {\n let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);\n if (!remoteIdToIdMap) {\n remoteIdToIdMap = /* @__PURE__ */ new Map();\n this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);\n }\n return remoteIdToIdMap;\n }\n}\nclass IframeManagerNoop {\n constructor() {\n this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId);\n this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap();\n }\n addIframe() {\n }\n addLoadListener() {\n }\n attachIframe() {\n }\n}\nclass IframeManager {\n constructor(options) {\n this.iframes = /* @__PURE__ */ new WeakMap();\n this.crossOriginIframeMap = /* @__PURE__ */ new WeakMap();\n this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId);\n this.crossOriginIframeRootIdMap = /* @__PURE__ */ new WeakMap();\n this.mutationCb = options.mutationCb;\n this.wrappedEmit = options.wrappedEmit;\n this.stylesheetManager = options.stylesheetManager;\n this.recordCrossOriginIframes = options.recordCrossOriginIframes;\n this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(\n this.stylesheetManager.styleMirror.generateId.bind(\n this.stylesheetManager.styleMirror\n )\n );\n this.mirror = options.mirror;\n if (this.recordCrossOriginIframes) {\n window.addEventListener(\"message\", this.handleMessage.bind(this));\n }\n }\n addIframe(iframeEl) {\n this.iframes.set(iframeEl, true);\n if (iframeEl.contentWindow)\n this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);\n }\n addLoadListener(cb) {\n this.loadListener = cb;\n }\n attachIframe(iframeEl, childSn) {\n this.mutationCb({\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: childSn\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n });\n if (this.recordCrossOriginIframes)\n iframeEl.contentWindow?.addEventListener(\n \"message\",\n this.handleMessage.bind(this)\n );\n this.loadListener?.(iframeEl);\n const iframeDoc = getIFrameContentDocument(iframeEl);\n if (iframeDoc && iframeDoc.adoptedStyleSheets && iframeDoc.adoptedStyleSheets.length > 0)\n this.stylesheetManager.adoptStyleSheets(\n iframeDoc.adoptedStyleSheets,\n this.mirror.getId(iframeDoc)\n );\n }\n handleMessage(message) {\n const crossOriginMessageEvent = message;\n if (crossOriginMessageEvent.data.type !== \"rrweb\" || // To filter out the rrweb messages which are forwarded by some sites.\n crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin)\n return;\n const iframeSourceWindow = message.source;\n if (!iframeSourceWindow) return;\n const iframeEl = this.crossOriginIframeMap.get(message.source);\n if (!iframeEl) return;\n const transformedEvent = this.transformCrossOriginEvent(\n iframeEl,\n crossOriginMessageEvent.data.event\n );\n if (transformedEvent)\n this.wrappedEmit(\n transformedEvent,\n crossOriginMessageEvent.data.isCheckout\n );\n }\n transformCrossOriginEvent(iframeEl, e2) {\n switch (e2.type) {\n case EventType.FullSnapshot: {\n this.crossOriginIframeMirror.reset(iframeEl);\n this.crossOriginIframeStyleMirror.reset(iframeEl);\n this.replaceIdOnNode(e2.data.node, iframeEl);\n const rootId = e2.data.node.id;\n this.crossOriginIframeRootIdMap.set(iframeEl, rootId);\n this.patchRootIdOnNode(e2.data.node, rootId);\n return {\n timestamp: e2.timestamp,\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n adds: [\n {\n parentId: this.mirror.getId(iframeEl),\n nextId: null,\n node: e2.data.node\n }\n ],\n removes: [],\n texts: [],\n attributes: [],\n isAttachIframe: true\n }\n };\n }\n case EventType.Meta:\n case EventType.Load:\n case EventType.DomContentLoaded: {\n return false;\n }\n case EventType.Plugin: {\n return e2;\n }\n case EventType.Custom: {\n this.replaceIds(\n e2.data.payload,\n iframeEl,\n [\"id\", \"parentId\", \"previousId\", \"nextId\"]\n );\n return e2;\n }\n case EventType.IncrementalSnapshot: {\n switch (e2.data.source) {\n case IncrementalSource.Mutation: {\n e2.data.adds.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\n \"parentId\",\n \"nextId\",\n \"previousId\"\n ]);\n this.replaceIdOnNode(n2.node, iframeEl);\n const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);\n rootId && this.patchRootIdOnNode(n2.node, rootId);\n });\n e2.data.removes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"parentId\", \"id\"]);\n });\n e2.data.attributes.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"id\"]);\n });\n e2.data.texts.forEach((n2) => {\n this.replaceIds(n2, iframeEl, [\"id\"]);\n });\n return e2;\n }\n case IncrementalSource.Drag:\n case IncrementalSource.TouchMove:\n case IncrementalSource.MouseMove: {\n e2.data.positions.forEach((p) => {\n this.replaceIds(p, iframeEl, [\"id\"]);\n });\n return e2;\n }\n case IncrementalSource.ViewportResize: {\n return false;\n }\n case IncrementalSource.MediaInteraction:\n case IncrementalSource.MouseInteraction:\n case IncrementalSource.Scroll:\n case IncrementalSource.CanvasMutation:\n case IncrementalSource.Input: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n return e2;\n }\n case IncrementalSource.StyleSheetRule:\n case IncrementalSource.StyleDeclaration: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n this.replaceStyleIds(e2.data, iframeEl, [\"styleId\"]);\n return e2;\n }\n case IncrementalSource.Font: {\n return e2;\n }\n case IncrementalSource.Selection: {\n e2.data.ranges.forEach((range) => {\n this.replaceIds(range, iframeEl, [\"start\", \"end\"]);\n });\n return e2;\n }\n case IncrementalSource.AdoptedStyleSheet: {\n this.replaceIds(e2.data, iframeEl, [\"id\"]);\n this.replaceStyleIds(e2.data, iframeEl, [\"styleIds\"]);\n e2.data.styles?.forEach((style) => {\n this.replaceStyleIds(style, iframeEl, [\"styleId\"]);\n });\n return e2;\n }\n }\n }\n }\n return false;\n }\n replace(iframeMirror, obj, iframeEl, keys) {\n for (const key of keys) {\n if (!Array.isArray(obj[key]) && typeof obj[key] !== \"number\") continue;\n if (Array.isArray(obj[key])) {\n obj[key] = iframeMirror.getIds(\n iframeEl,\n obj[key]\n );\n } else {\n obj[key] = iframeMirror.getId(iframeEl, obj[key]);\n }\n }\n return obj;\n }\n replaceIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);\n }\n replaceStyleIds(obj, iframeEl, keys) {\n return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);\n }\n replaceIdOnNode(node, iframeEl) {\n this.replaceIds(node, iframeEl, [\"id\", \"rootId\"]);\n if (\"childNodes\" in node) {\n node.childNodes.forEach((child) => {\n this.replaceIdOnNode(child, iframeEl);\n });\n }\n }\n patchRootIdOnNode(node, rootId) {\n if (node.type !== NodeType$2.Document && !node.rootId) node.rootId = rootId;\n if (\"childNodes\" in node) {\n node.childNodes.forEach((child) => {\n this.patchRootIdOnNode(child, rootId);\n });\n }\n }\n}\nclass ShadowDomManagerNoop {\n init() {\n }\n addShadowRoot() {\n }\n observeAttachShadow() {\n }\n reset() {\n }\n}\nclass ShadowDomManager {\n constructor(options) {\n this.shadowDoms = /* @__PURE__ */ new WeakSet();\n this.restoreHandlers = [];\n this.mutationCb = options.mutationCb;\n this.scrollCb = options.scrollCb;\n this.bypassOptions = options.bypassOptions;\n this.mirror = options.mirror;\n this.init();\n }\n init() {\n this.reset();\n this.patchAttachShadow(Element, document);\n }\n addShadowRoot(shadowRoot, doc) {\n if (!isNativeShadowDom(shadowRoot)) return;\n if (this.shadowDoms.has(shadowRoot)) return;\n this.shadowDoms.add(shadowRoot);\n this.bypassOptions.canvasManager.addShadowRoot(shadowRoot);\n const observer = initMutationObserver(\n {\n ...this.bypassOptions,\n doc,\n mutationCb: this.mutationCb,\n mirror: this.mirror,\n shadowDomManager: this\n },\n shadowRoot\n );\n this.restoreHandlers.push(() => observer.disconnect());\n this.restoreHandlers.push(\n initScrollObserver({\n ...this.bypassOptions,\n scrollCb: this.scrollCb,\n // https://gist.github.com/praveenpuglia/0832da687ed5a5d7a0907046c9ef1813\n // scroll is not allowed to pass the boundary, so we need to listen the shadow document\n doc: shadowRoot,\n mirror: this.mirror\n })\n );\n setTimeout$1(() => {\n if (shadowRoot.adoptedStyleSheets && shadowRoot.adoptedStyleSheets.length > 0)\n this.bypassOptions.stylesheetManager.adoptStyleSheets(\n shadowRoot.adoptedStyleSheets,\n this.mirror.getId(shadowRoot.host)\n );\n this.restoreHandlers.push(\n initAdoptedStyleSheetObserver(\n {\n mirror: this.mirror,\n stylesheetManager: this.bypassOptions.stylesheetManager\n },\n shadowRoot\n )\n );\n }, 0);\n }\n /**\n * Monkey patch 'attachShadow' of an IFrameElement to observe newly added shadow doms.\n */\n observeAttachShadow(iframeElement) {\n const iframeDoc = getIFrameContentDocument(iframeElement);\n const iframeWindow = getIFrameContentWindow(iframeElement);\n if (!iframeDoc || !iframeWindow) return;\n this.patchAttachShadow(\n iframeWindow.Element,\n iframeDoc\n );\n }\n /**\n * Patch 'attachShadow' to observe newly added shadow doms.\n */\n patchAttachShadow(element, doc) {\n const manager = this;\n this.restoreHandlers.push(\n patch(\n element.prototype,\n \"attachShadow\",\n function(original) {\n return function(option) {\n const shadowRoot = original.call(this, option);\n if (this.shadowRoot && inDom(this))\n manager.addShadowRoot(this.shadowRoot, doc);\n return shadowRoot;\n };\n }\n )\n );\n }\n reset() {\n this.restoreHandlers.forEach((handler) => {\n try {\n handler();\n } catch (e2) {\n }\n });\n this.restoreHandlers = [];\n this.shadowDoms = /* @__PURE__ */ new WeakSet();\n this.bypassOptions.canvasManager.resetShadowRoots();\n }\n}\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar lookup = typeof Uint8Array === \"undefined\" ? [] : new Uint8Array(256);\nfor (var i$1 = 0; i$1 < chars.length; i$1++) {\n lookup[chars.charCodeAt(i$1)] = i$1;\n}\nvar encode = function(arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i2, len = bytes.length, base64 = \"\";\n for (i2 = 0; i2 < len; i2 += 3) {\n base64 += chars[bytes[i2] >> 2];\n base64 += chars[(bytes[i2] & 3) << 4 | bytes[i2 + 1] >> 4];\n base64 += chars[(bytes[i2 + 1] & 15) << 2 | bytes[i2 + 2] >> 6];\n base64 += chars[bytes[i2 + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + \"=\";\n } else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + \"==\";\n }\n return base64;\n};\nvar decode = function(base64) {\n var bufferLength = base64.length * 0.75, len = base64.length, i2, p = 0, encoded1, encoded2, encoded3, encoded4;\n if (base64[base64.length - 1] === \"=\") {\n bufferLength--;\n if (base64[base64.length - 2] === \"=\") {\n bufferLength--;\n }\n }\n var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);\n for (i2 = 0; i2 < len; i2 += 4) {\n encoded1 = lookup[base64.charCodeAt(i2)];\n encoded2 = lookup[base64.charCodeAt(i2 + 1)];\n encoded3 = lookup[base64.charCodeAt(i2 + 2)];\n encoded4 = lookup[base64.charCodeAt(i2 + 3)];\n bytes[p++] = encoded1 << 2 | encoded2 >> 4;\n bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;\n bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;\n }\n return arraybuffer;\n};\nconst canvasVarMap = /* @__PURE__ */ new Map();\nfunction variableListFor$1(ctx, ctor) {\n let contextMap = canvasVarMap.get(ctx);\n if (!contextMap) {\n contextMap = /* @__PURE__ */ new Map();\n canvasVarMap.set(ctx, contextMap);\n }\n if (!contextMap.has(ctor)) {\n contextMap.set(ctor, []);\n }\n return contextMap.get(ctor);\n}\nconst saveWebGLVar = (value, win, ctx) => {\n if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === \"object\"))\n return;\n const name = value.constructor.name;\n const list = variableListFor$1(ctx, name);\n let index = list.indexOf(value);\n if (index === -1) {\n index = list.length;\n list.push(value);\n }\n return index;\n};\nfunction serializeArg(value, win, ctx) {\n if (value instanceof Array) {\n return value.map((arg) => serializeArg(arg, win, ctx));\n } else if (value === null) {\n return value;\n } else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [Object.values(value)]\n };\n } else if (\n // SharedArrayBuffer disabled on most browsers due to spectre.\n // More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer/SharedArrayBuffer\n // value instanceof SharedArrayBuffer ||\n value instanceof ArrayBuffer\n ) {\n const name = value.constructor.name;\n const base64 = encode(value);\n return {\n rr_type: name,\n base64\n };\n } else if (value instanceof DataView) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [\n serializeArg(value.buffer, win, ctx),\n value.byteOffset,\n value.byteLength\n ]\n };\n } else if (value instanceof HTMLImageElement) {\n const name = value.constructor.name;\n const { src } = value;\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof HTMLCanvasElement) {\n const name = \"HTMLImageElement\";\n const src = value.toDataURL();\n return {\n rr_type: name,\n src\n };\n } else if (value instanceof ImageData) {\n const name = value.constructor.name;\n return {\n rr_type: name,\n args: [serializeArg(value.data, win, ctx), value.width, value.height]\n };\n } else if (isInstanceOfWebGLObject(value, win) || typeof value === \"object\") {\n const name = value.constructor.name;\n const index = saveWebGLVar(value, win, ctx);\n return {\n rr_type: name,\n index\n };\n }\n return value;\n}\nconst serializeArgs = (args, win, ctx) => {\n return args.map((arg) => serializeArg(arg, win, ctx));\n};\nconst isInstanceOfWebGLObject = (value, win) => {\n const webGLConstructorNames = [\n \"WebGLActiveInfo\",\n \"WebGLBuffer\",\n \"WebGLFramebuffer\",\n \"WebGLProgram\",\n \"WebGLRenderbuffer\",\n \"WebGLShader\",\n \"WebGLShaderPrecisionFormat\",\n \"WebGLTexture\",\n \"WebGLUniformLocation\",\n \"WebGLVertexArrayObject\",\n // In old Chrome versions, value won't be an instanceof WebGLVertexArrayObject.\n \"WebGLVertexArrayObjectOES\"\n ];\n const supportedWebGLConstructorNames = webGLConstructorNames.filter(\n (name) => typeof win[name] === \"function\"\n );\n return Boolean(\n supportedWebGLConstructorNames.find(\n (name) => value instanceof win[name]\n )\n );\n};\nfunction initCanvas2DMutationObserver(cb, win, blockClass2, blockSelector, unblockSelector) {\n const handlers = [];\n const props2D = Object.getOwnPropertyNames(\n win.CanvasRenderingContext2D.prototype\n );\n for (const prop of props2D) {\n try {\n if (typeof win.CanvasRenderingContext2D.prototype[prop] !== \"function\") {\n continue;\n }\n const restoreHandler = patch(\n win.CanvasRenderingContext2D.prototype,\n prop,\n function(original) {\n return function(...args) {\n if (!isBlocked(\n this.canvas,\n blockClass2,\n blockSelector,\n unblockSelector,\n true\n )) {\n setTimeout$1(() => {\n const recordArgs = serializeArgs(args, win, this);\n cb(this.canvas, {\n type: CanvasContext[\"2D\"],\n property: prop,\n args: recordArgs\n });\n }, 0);\n }\n return original.apply(this, args);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n const hookHandler = hookSetter(\n win.CanvasRenderingContext2D.prototype,\n prop,\n {\n set(v2) {\n cb(this.canvas, {\n type: CanvasContext[\"2D\"],\n property: prop,\n args: [v2],\n setter: true\n });\n }\n }\n );\n handlers.push(hookHandler);\n }\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction getNormalizedContextName(contextType) {\n return contextType === \"experimental-webgl\" ? \"webgl\" : contextType;\n}\nfunction initCanvasContextObserver(win, blockClass, blockSelector, unblockSelector, setPreserveDrawingBufferToTrue) {\n const handlers = [];\n try {\n const restoreHandler = patch(\n win.HTMLCanvasElement.prototype,\n \"getContext\",\n function(original) {\n return function(contextType, ...args) {\n if (!isBlocked(this, blockClass, blockSelector, unblockSelector, true)) {\n const ctxName = getNormalizedContextName(contextType);\n if (!(\"__context\" in this)) this.__context = ctxName;\n if (setPreserveDrawingBufferToTrue && [\"webgl\", \"webgl2\"].includes(ctxName)) {\n if (args[0] && typeof args[0] === \"object\") {\n const contextAttributes = args[0];\n if (!contextAttributes.preserveDrawingBuffer) {\n contextAttributes.preserveDrawingBuffer = true;\n }\n } else {\n args.splice(0, 1, {\n preserveDrawingBuffer: true\n });\n }\n }\n }\n return original.apply(this, [contextType, ...args]);\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n console.error(\"failed to patch HTMLCanvasElement.prototype.getContext\");\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nfunction patchGLPrototype(prototype, type, cb, blockClass2, blockSelector, unblockSelector, _mirror2, win) {\n const handlers = [];\n const props = Object.getOwnPropertyNames(prototype);\n for (const prop of props) {\n if (\n //prop.startsWith('get') || // e.g. getProgramParameter, but too risky\n [\n \"isContextLost\",\n \"canvas\",\n \"drawingBufferWidth\",\n \"drawingBufferHeight\"\n ].includes(prop)\n ) {\n continue;\n }\n try {\n if (typeof prototype[prop] !== \"function\") {\n continue;\n }\n const restoreHandler = patch(\n prototype,\n prop,\n function(original) {\n return function(...args) {\n const result = original.apply(this, args);\n saveWebGLVar(result, win, this);\n if (\"tagName\" in this.canvas && !isBlocked(\n this.canvas,\n blockClass2,\n blockSelector,\n unblockSelector,\n true\n )) {\n const recordArgs = serializeArgs(args, win, this);\n const mutation = {\n type,\n property: prop,\n args: recordArgs\n };\n cb(this.canvas, mutation);\n }\n return result;\n };\n }\n );\n handlers.push(restoreHandler);\n } catch {\n const hookHandler = hookSetter(prototype, prop, {\n set(v2) {\n cb(this.canvas, {\n type,\n property: prop,\n args: [v2],\n setter: true\n });\n }\n });\n handlers.push(hookHandler);\n }\n }\n return handlers;\n}\nfunction initCanvasWebGLMutationObserver(cb, win, blockClass2, blockSelector, unblockSelector, mirror2) {\n const handlers = [];\n handlers.push(\n ...patchGLPrototype(\n win.WebGLRenderingContext.prototype,\n CanvasContext.WebGL,\n cb,\n blockClass2,\n blockSelector,\n unblockSelector,\n mirror2,\n win\n )\n );\n if (typeof win.WebGL2RenderingContext !== \"undefined\") {\n handlers.push(\n ...patchGLPrototype(\n win.WebGL2RenderingContext.prototype,\n CanvasContext.WebGL2,\n cb,\n blockClass2,\n blockSelector,\n unblockSelector,\n mirror2,\n win\n )\n );\n }\n return () => {\n handlers.forEach((h) => h());\n };\n}\nconst r$1 = `for(var e=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",t=\"undefined\"==typeof Uint8Array?[]:new Uint8Array(256),a=0;a<64;a++)t[e.charCodeAt(a)]=a;var n=function(t){var a,n=new Uint8Array(t),r=n.length,s=\"\";for(a=0;a<r;a+=3)s+=e[n[a]>>2],s+=e[(3&n[a])<<4|n[a+1]>>4],s+=e[(15&n[a+1])<<2|n[a+2]>>6],s+=e[63&n[a+2]];return r%3==2?s=s.substring(0,s.length-1)+\"=\":r%3==1&&(s=s.substring(0,s.length-2)+\"==\"),s};const r=new Map,s=new Map;const i=self;i.onmessage=async function(e){if(!(\"OffscreenCanvas\"in globalThis))return i.postMessage({id:e.data.id});{const{id:t,bitmap:a,width:o,height:f,maxCanvasSize:c,dataURLOptions:g}=e.data,u=async function(e,t,a){const r=e+\"-\"+t;if(\"OffscreenCanvas\"in globalThis){if(s.has(r))return s.get(r);const i=new OffscreenCanvas(e,t);i.getContext(\"2d\");const o=await i.convertToBlob(a),f=await o.arrayBuffer(),c=n(f);return s.set(r,c),c}return\"\"}(o,f,g),[h,d]=function(e,t,a){if(!a)return[e,t];const[n,r]=a;if(e<=n&&t<=r)return[e,t];let s=e,i=t;return s>n&&(i=Math.floor(n*t/e),s=n),i>r&&(s=Math.floor(r*e/t),i=r),[s,i]}(o,f,c),l=new OffscreenCanvas(h,d),w=l.getContext(\"bitmaprenderer\"),p=h===o&&d===f?a:await createImageBitmap(a,{resizeWidth:h,resizeHeight:d,resizeQuality:\"low\"});w?.transferFromImageBitmap(p),a.close();const y=await l.convertToBlob(g),v=y.type,b=await y.arrayBuffer(),m=n(b);if(p.close(),!r.has(t)&&await u===m)return r.set(t,m),i.postMessage({id:t});if(r.get(t)===m)return i.postMessage({id:t});i.postMessage({id:t,type:v,base64:m,width:o,height:f}),r.set(t,m)}};`;\nfunction t$1() {\n const t2 = new Blob([r$1]);\n return URL.createObjectURL(t2);\n}\nclass CanvasManagerNoop {\n reset() {\n }\n freeze() {\n }\n unfreeze() {\n }\n lock() {\n }\n unlock() {\n }\n snapshot() {\n }\n addWindow() {\n }\n addShadowRoot() {\n }\n resetShadowRoots() {\n }\n}\nclass CanvasManager {\n constructor(options) {\n this.pendingCanvasMutations = /* @__PURE__ */ new Map();\n this.rafStamps = { latestId: 0, invokeId: null };\n this.shadowDoms = /* @__PURE__ */ new Set();\n this.windowsSet = /* @__PURE__ */ new WeakSet();\n this.windows = [];\n this.restoreHandlers = [];\n this.frozen = false;\n this.locked = false;\n this.snapshotInProgressMap = /* @__PURE__ */ new Map();\n this.worker = null;\n this.lastSnapshotTime = 0;\n this.processMutation = (target, mutation) => {\n const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;\n if (newFrame || !this.rafStamps.invokeId)\n this.rafStamps.invokeId = this.rafStamps.latestId;\n if (!this.pendingCanvasMutations.has(target)) {\n this.pendingCanvasMutations.set(target, []);\n }\n this.pendingCanvasMutations.get(target).push(mutation);\n };\n const {\n enableManualSnapshot,\n sampling = \"all\",\n win,\n recordCanvas,\n errorHandler: errorHandler2\n } = options;\n options.sampling = sampling;\n this.mutationCb = options.mutationCb;\n this.mirror = options.mirror;\n this.options = options;\n if (errorHandler2) {\n registerErrorHandler(errorHandler2);\n }\n if (recordCanvas && typeof sampling === \"number\" || enableManualSnapshot) {\n this.worker = this.initFPSWorker();\n }\n this.addWindow(win);\n if (enableManualSnapshot) {\n return;\n }\n callbackWrapper(() => {\n if (recordCanvas && sampling === \"all\") {\n this.startRAFTimestamping();\n this.startPendingCanvasMutationFlusher();\n }\n if (recordCanvas && typeof sampling === \"number\") {\n this.initCanvasFPSObserver();\n }\n })();\n }\n reset() {\n this.pendingCanvasMutations.clear();\n this.restoreHandlers.forEach((handler) => {\n try {\n handler();\n } catch (e2) {\n }\n });\n this.restoreHandlers = [];\n this.windowsSet = /* @__PURE__ */ new WeakSet();\n this.windows = [];\n this.shadowDoms = /* @__PURE__ */ new Set();\n this.worker?.terminate();\n this.worker = null;\n this.snapshotInProgressMap = /* @__PURE__ */ new Map();\n }\n freeze() {\n this.frozen = true;\n }\n unfreeze() {\n this.frozen = false;\n }\n lock() {\n this.locked = true;\n }\n unlock() {\n this.locked = false;\n }\n addWindow(win) {\n const {\n sampling = \"all\",\n blockClass,\n blockSelector,\n unblockSelector,\n recordCanvas,\n enableManualSnapshot\n } = this.options;\n if (this.windowsSet.has(win)) return;\n if (enableManualSnapshot) {\n this.windowsSet.add(win);\n this.windows.push(new WeakRef(win));\n return;\n }\n callbackWrapper(() => {\n if (recordCanvas && sampling === \"all\") {\n this.initCanvasMutationObserver(\n win,\n blockClass,\n blockSelector,\n unblockSelector\n );\n }\n if (recordCanvas && typeof sampling === \"number\") {\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n unblockSelector,\n true\n );\n this.restoreHandlers.push(() => {\n canvasContextReset();\n });\n }\n })();\n this.windowsSet.add(win);\n this.windows.push(new WeakRef(win));\n }\n addShadowRoot(shadowRoot) {\n this.shadowDoms.add(new WeakRef(shadowRoot));\n }\n resetShadowRoots() {\n this.shadowDoms = /* @__PURE__ */ new Set();\n }\n snapshot(canvasElement, options) {\n if (options?.skipRequestAnimationFrame) {\n this.takeSnapshot(performance.now(), true, canvasElement);\n return;\n }\n onRequestAnimationFrame(\n (timestamp) => this.takeSnapshot(timestamp, true, canvasElement)\n );\n }\n initFPSWorker() {\n const worker = new Worker(t$1());\n worker.onmessage = (e2) => {\n const data = e2.data;\n const { id } = data;\n this.snapshotInProgressMap.set(id, false);\n if (!(\"base64\" in data)) return;\n const { base64, type, width, height } = data;\n this.mutationCb({\n id,\n type: CanvasContext[\"2D\"],\n commands: [\n {\n property: \"clearRect\",\n // wipe canvas\n args: [0, 0, width, height]\n },\n {\n property: \"drawImage\",\n // draws (semi-transparent) image\n args: [\n {\n rr_type: \"ImageBitmap\",\n args: [\n {\n rr_type: \"Blob\",\n data: [{ rr_type: \"ArrayBuffer\", base64 }],\n type\n }\n ]\n },\n 0,\n 0,\n // The below args are needed if we enforce a max size, we want to\n // retain the original size when drawing the image (which should be smaller)\n width,\n height\n ]\n }\n ]\n });\n };\n return worker;\n }\n initCanvasFPSObserver() {\n let rafId;\n if (!this.windows.length && !this.shadowDoms.size) {\n return;\n }\n const rafCallback = (timestamp) => {\n this.takeSnapshot(timestamp, false);\n rafId = onRequestAnimationFrame(rafCallback);\n };\n rafId = onRequestAnimationFrame(rafCallback);\n this.restoreHandlers.push(() => {\n if (rafId) {\n cancelAnimationFrame(rafId);\n }\n });\n }\n initCanvasMutationObserver(win, blockClass, blockSelector, unblockSelector) {\n const canvasContextReset = initCanvasContextObserver(\n win,\n blockClass,\n blockSelector,\n unblockSelector,\n false\n );\n const canvas2DReset = initCanvas2DMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector,\n unblockSelector\n );\n const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(\n this.processMutation.bind(this),\n win,\n blockClass,\n blockSelector,\n unblockSelector,\n this.mirror\n );\n this.restoreHandlers.push(() => {\n canvasContextReset();\n canvas2DReset();\n canvasWebGL1and2Reset();\n });\n }\n /**\n * Returns all `canvas` elements that are not blocked by the given selectors. Searches all windows and shadow roots.\n */\n getCanvasElements(blockClass, blockSelector, unblockSelector) {\n const matchedCanvas = [];\n const searchCanvas = (root) => {\n root.querySelectorAll(\"canvas\").forEach((canvas) => {\n if (!isBlocked(canvas, blockClass, blockSelector, unblockSelector, true)) {\n matchedCanvas.push(canvas);\n }\n });\n };\n for (const item of this.windows) {\n const window2 = item.deref();\n let _document;\n try {\n _document = window2 && window2.document;\n } catch {\n }\n if (_document) {\n searchCanvas(_document);\n }\n }\n for (const item of this.shadowDoms) {\n const shadowRoot = item.deref();\n if (shadowRoot) {\n searchCanvas(shadowRoot);\n }\n }\n return matchedCanvas;\n }\n /**\n * Takes a snapshot of the provided canvas element, or will search all windows/shadow roots for canvases. Will self-throttle based on `options.sampling`.\n *\n * @returns `true` if the snapshot was taken, `false` if it was throttled.\n */\n takeSnapshot(timestamp, isManualSnapshot, canvasElement) {\n const {\n sampling,\n blockClass,\n blockSelector,\n unblockSelector,\n dataURLOptions,\n maxCanvasSize\n } = this.options;\n const fps = sampling === \"all\" ? 2 : sampling || 2;\n const timeBetweenSnapshots = 1e3 / fps;\n const shouldThrottle = this.lastSnapshotTime && timestamp - this.lastSnapshotTime < timeBetweenSnapshots;\n if (shouldThrottle) {\n return false;\n }\n this.lastSnapshotTime = timestamp;\n const canvases = canvasElement ? [canvasElement] : this.getCanvasElements(blockClass, blockSelector, unblockSelector);\n canvases.forEach((canvas) => {\n const id = this.mirror.getId(canvas);\n if (!this.mirror.hasNode(canvas) || !canvas.width || !canvas.height || this.snapshotInProgressMap.get(id)) {\n return;\n }\n this.snapshotInProgressMap.set(id, true);\n if (!isManualSnapshot && [\"webgl\", \"webgl2\"].includes(canvas.__context)) {\n const context = canvas.getContext(canvas.__context);\n if (context?.getContextAttributes()?.preserveDrawingBuffer === false) {\n context.clear(context.COLOR_BUFFER_BIT);\n }\n }\n createImageBitmap(canvas).then((bitmap) => {\n this.worker?.postMessage(\n {\n id,\n bitmap,\n width: canvas.width,\n height: canvas.height,\n dataURLOptions,\n maxCanvasSize\n },\n [bitmap]\n );\n }).catch((error) => {\n callbackWrapper(() => {\n this.snapshotInProgressMap.delete(id);\n throw error;\n })();\n });\n });\n return true;\n }\n startPendingCanvasMutationFlusher() {\n onRequestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n startRAFTimestamping() {\n const setLatestRAFTimestamp = (timestamp) => {\n this.rafStamps.latestId = timestamp;\n onRequestAnimationFrame(setLatestRAFTimestamp);\n };\n onRequestAnimationFrame(setLatestRAFTimestamp);\n }\n flushPendingCanvasMutations() {\n this.pendingCanvasMutations.forEach(\n (_values, canvas) => {\n const id = this.mirror.getId(canvas);\n this.flushPendingCanvasMutationFor(canvas, id);\n }\n );\n onRequestAnimationFrame(() => this.flushPendingCanvasMutations());\n }\n flushPendingCanvasMutationFor(canvas, id) {\n if (this.frozen || this.locked) {\n return;\n }\n const valuesWithType = this.pendingCanvasMutations.get(canvas);\n if (!valuesWithType || id === -1) return;\n const values = valuesWithType.map((value) => {\n const { type: type2, ...rest } = value;\n return rest;\n });\n const { type } = valuesWithType[0];\n this.mutationCb({ id, type, commands: values });\n this.pendingCanvasMutations.delete(canvas);\n }\n}\nclass StylesheetManager {\n constructor(options) {\n this.trackedLinkElements = /* @__PURE__ */ new WeakSet();\n this.styleMirror = new StyleSheetMirror();\n this.mutationCb = options.mutationCb;\n this.adoptedStyleSheetCb = options.adoptedStyleSheetCb;\n }\n attachLinkElement(linkEl, childSn) {\n if (\"_cssText\" in childSn.attributes)\n this.mutationCb({\n adds: [],\n removes: [],\n texts: [],\n attributes: [\n {\n id: childSn.id,\n attributes: childSn.attributes\n }\n ]\n });\n this.trackLinkElement(linkEl);\n }\n trackLinkElement(linkEl) {\n if (this.trackedLinkElements.has(linkEl)) return;\n this.trackedLinkElements.add(linkEl);\n this.trackStylesheetInLinkElement(linkEl);\n }\n adoptStyleSheets(sheets, hostId) {\n if (sheets.length === 0) return;\n const adoptedStyleSheetData = {\n id: hostId,\n styleIds: []\n };\n const styles = [];\n for (const sheet of sheets) {\n let styleId;\n if (!this.styleMirror.has(sheet)) {\n styleId = this.styleMirror.add(sheet);\n styles.push({\n styleId,\n rules: Array.from(sheet.rules || CSSRule, (r2, index) => ({\n rule: stringifyRule(r2),\n index\n }))\n });\n } else styleId = this.styleMirror.getId(sheet);\n adoptedStyleSheetData.styleIds.push(styleId);\n }\n if (styles.length > 0) adoptedStyleSheetData.styles = styles;\n this.adoptedStyleSheetCb(adoptedStyleSheetData);\n }\n reset() {\n this.styleMirror.reset();\n this.trackedLinkElements = /* @__PURE__ */ new WeakSet();\n }\n // TODO: take snapshot on stylesheet reload by applying event listener\n trackStylesheetInLinkElement(_linkEl) {\n }\n}\nclass ProcessedNodeManager {\n constructor() {\n this.nodeMap = /* @__PURE__ */ new WeakMap();\n this.active = false;\n }\n inOtherBuffer(node, thisBuffer) {\n const buffers = this.nodeMap.get(node);\n return buffers && Array.from(buffers).some((buffer) => buffer !== thisBuffer);\n }\n add(node, buffer) {\n if (!this.active) {\n this.active = true;\n onRequestAnimationFrame(() => {\n this.nodeMap = /* @__PURE__ */ new WeakMap();\n this.active = false;\n });\n }\n this.nodeMap.set(node, (this.nodeMap.get(node) || /* @__PURE__ */ new Set()).add(buffer));\n }\n destroy() {\n }\n}\nlet wrappedEmit;\nlet _wrappedEmit;\nlet _takeFullSnapshot;\ntry {\n if (Array.from([1], (x) => x * 2)[0] !== 2) {\n const cleanFrame = document.createElement(\"iframe\");\n document.body.appendChild(cleanFrame);\n Array.from = cleanFrame.contentWindow?.Array.from || Array.from;\n document.body.removeChild(cleanFrame);\n }\n} catch (err) {\n console.debug(\"Unable to override Array.from\", err);\n}\nconst mirror = createMirror$2();\nfunction record(options = {}) {\n const {\n emit,\n checkoutEveryNms,\n checkoutEveryNth,\n blockClass = \"rr-block\",\n blockSelector = null,\n unblockSelector = null,\n ignoreClass = \"rr-ignore\",\n ignoreSelector = null,\n maskAllText = false,\n maskTextClass = \"rr-mask\",\n unmaskTextClass = null,\n maskTextSelector = null,\n unmaskTextSelector = null,\n inlineStylesheet = true,\n maskAllInputs,\n maskInputOptions: _maskInputOptions,\n slimDOMOptions: _slimDOMOptions,\n maskAttributeFn,\n maskInputFn,\n maskTextFn,\n maxCanvasSize = null,\n packFn,\n sampling = {},\n dataURLOptions = {},\n mousemoveWait,\n recordDOM = true,\n recordCanvas = false,\n recordCrossOriginIframes = false,\n recordAfter = options.recordAfter === \"DOMContentLoaded\" ? options.recordAfter : \"load\",\n userTriggeredOnInput = false,\n collectFonts = false,\n inlineImages = false,\n plugins,\n keepIframeSrcFn = () => false,\n ignoreCSSAttributes = /* @__PURE__ */ new Set([]),\n errorHandler: errorHandler2,\n onMutation,\n getCanvasManager\n } = options;\n registerErrorHandler(errorHandler2);\n const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;\n let passEmitsToParent = false;\n if (!inEmittingFrame) {\n try {\n if (window.parent.document) {\n passEmitsToParent = false;\n }\n } catch (e2) {\n passEmitsToParent = true;\n }\n }\n if (inEmittingFrame && !emit) {\n throw new Error(\"emit function is required\");\n }\n if (!inEmittingFrame && !passEmitsToParent) {\n return () => {\n };\n }\n if (mousemoveWait !== void 0 && sampling.mousemove === void 0) {\n sampling.mousemove = mousemoveWait;\n }\n mirror.reset();\n const maskInputOptions = maskAllInputs === true ? {\n color: true,\n date: true,\n \"datetime-local\": true,\n email: true,\n month: true,\n number: true,\n range: true,\n search: true,\n tel: true,\n text: true,\n time: true,\n url: true,\n week: true,\n textarea: true,\n select: true,\n radio: true,\n checkbox: true\n } : _maskInputOptions !== void 0 ? _maskInputOptions : {};\n const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === \"all\" ? {\n script: true,\n comment: true,\n headFavicon: true,\n headWhitespace: true,\n headMetaSocial: true,\n headMetaRobots: true,\n headMetaHttpEquiv: true,\n headMetaVerification: true,\n // the following are off for slimDOMOptions === true,\n // as they destroy some (hidden) info:\n headMetaAuthorship: _slimDOMOptions === \"all\",\n headMetaDescKeywords: _slimDOMOptions === \"all\"\n } : _slimDOMOptions ? _slimDOMOptions : {};\n polyfill$1();\n let lastFullSnapshotEvent;\n let incrementalSnapshotCount = 0;\n const eventProcessor = (e2) => {\n for (const plugin of plugins || []) {\n if (plugin.eventProcessor) {\n e2 = plugin.eventProcessor(e2);\n }\n }\n if (packFn && // Disable packing events which will be emitted to parent frames.\n !passEmitsToParent) {\n e2 = packFn(e2);\n }\n return e2;\n };\n wrappedEmit = (r2, isCheckout) => {\n const e2 = r2;\n e2.timestamp = nowTimestamp();\n if (mutationBuffers[0]?.isFrozen() && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {\n mutationBuffers.forEach((buf) => buf.unfreeze());\n }\n if (inEmittingFrame) {\n emit?.(eventProcessor(e2), isCheckout);\n } else if (passEmitsToParent) {\n const message = {\n type: \"rrweb\",\n event: eventProcessor(e2),\n origin: window.location.origin,\n isCheckout\n };\n window.parent.postMessage(message, \"*\");\n }\n if (e2.type === EventType.FullSnapshot) {\n lastFullSnapshotEvent = e2;\n incrementalSnapshotCount = 0;\n } else if (e2.type === EventType.IncrementalSnapshot) {\n if (e2.data.source === IncrementalSource.Mutation && e2.data.isAttachIframe) {\n return;\n }\n incrementalSnapshotCount++;\n const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;\n const exceedTime = checkoutEveryNms && lastFullSnapshotEvent && e2.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;\n if (exceedCount || exceedTime) {\n takeFullSnapshot2(true);\n }\n }\n };\n _wrappedEmit = wrappedEmit;\n const wrappedMutationEmit = (m) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Mutation,\n ...m\n }\n });\n };\n const wrappedScrollEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Scroll,\n ...p\n }\n });\n const wrappedCanvasMutationEmit = (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CanvasMutation,\n ...p\n }\n });\n const wrappedAdoptedStyleSheetEmit = (a2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.AdoptedStyleSheet,\n ...a2\n }\n });\n const stylesheetManager = new StylesheetManager({\n mutationCb: wrappedMutationEmit,\n adoptedStyleSheetCb: wrappedAdoptedStyleSheetEmit\n });\n const iframeManager = typeof __RRWEB_EXCLUDE_IFRAME__ === \"boolean\" && __RRWEB_EXCLUDE_IFRAME__ ? new IframeManagerNoop() : new IframeManager({\n mirror,\n mutationCb: wrappedMutationEmit,\n stylesheetManager,\n recordCrossOriginIframes,\n wrappedEmit\n });\n for (const plugin of plugins || []) {\n if (plugin.getMirror)\n plugin.getMirror({\n nodeMirror: mirror,\n crossOriginIframeMirror: iframeManager.crossOriginIframeMirror,\n crossOriginIframeStyleMirror: iframeManager.crossOriginIframeStyleMirror\n });\n }\n const processedNodeManager = new ProcessedNodeManager();\n const canvasManager = _getCanvasManager(\n getCanvasManager,\n {\n mirror,\n win: window,\n mutationCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CanvasMutation,\n ...p\n }\n }),\n recordCanvas,\n blockClass,\n blockSelector,\n unblockSelector,\n maxCanvasSize,\n sampling: sampling[\"canvas\"],\n dataURLOptions,\n errorHandler: errorHandler2\n }\n );\n const shadowDomManager = typeof __RRWEB_EXCLUDE_SHADOW_DOM__ === \"boolean\" && __RRWEB_EXCLUDE_SHADOW_DOM__ ? new ShadowDomManagerNoop() : new ShadowDomManager({\n mutationCb: wrappedMutationEmit,\n scrollCb: wrappedScrollEmit,\n bypassOptions: {\n onMutation,\n blockClass,\n blockSelector,\n unblockSelector,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n inlineStylesheet,\n maskInputOptions,\n dataURLOptions,\n maskAttributeFn,\n maskTextFn,\n maskInputFn,\n recordCanvas,\n inlineImages,\n sampling,\n slimDOMOptions,\n iframeManager,\n stylesheetManager,\n canvasManager,\n keepIframeSrcFn,\n processedNodeManager,\n ignoreCSSAttributes\n },\n mirror\n });\n const takeFullSnapshot2 = (isCheckout = false) => {\n if (!recordDOM) {\n return;\n }\n wrappedEmit(\n {\n type: EventType.Meta,\n data: {\n href: window.location.href,\n width: getWindowWidth(),\n height: getWindowHeight()\n }\n },\n isCheckout\n );\n stylesheetManager.reset();\n shadowDomManager.init();\n mutationBuffers.forEach((buf) => buf.lock());\n const node = snapshot(document, {\n mirror,\n blockClass,\n blockSelector,\n unblockSelector,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n inlineStylesheet,\n maskAllInputs: maskInputOptions,\n maskAttributeFn,\n maskInputFn,\n maskTextFn,\n slimDOM: slimDOMOptions,\n dataURLOptions,\n recordCanvas,\n inlineImages,\n onSerialize: (n2) => {\n if (isSerializedIframe(n2, mirror)) {\n iframeManager.addIframe(n2);\n }\n if (isSerializedStylesheet(n2, mirror)) {\n stylesheetManager.trackLinkElement(n2);\n }\n if (hasShadowRoot(n2)) {\n shadowDomManager.addShadowRoot(n2.shadowRoot, document);\n }\n },\n onIframeLoad: (iframe, childSn) => {\n iframeManager.attachIframe(iframe, childSn);\n if (iframe.contentWindow) {\n canvasManager.addWindow(iframe.contentWindow);\n }\n shadowDomManager.observeAttachShadow(iframe);\n },\n onStylesheetLoad: (linkEl, childSn) => {\n stylesheetManager.attachLinkElement(linkEl, childSn);\n },\n onBlockedImageLoad: (_imageEl, serializedNode, { width, height }) => {\n wrappedMutationEmit({\n adds: [],\n removes: [],\n texts: [],\n attributes: [\n {\n id: serializedNode.id,\n attributes: {\n style: {\n width: `${width}px`,\n height: `${height}px`\n }\n }\n }\n ]\n });\n },\n keepIframeSrcFn,\n ignoreCSSAttributes\n });\n if (!node) {\n return console.warn(\"Failed to snapshot the document\");\n }\n wrappedEmit({\n type: EventType.FullSnapshot,\n data: {\n node,\n initialOffset: getWindowScroll(window)\n }\n });\n mutationBuffers.forEach((buf) => buf.unlock());\n if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)\n stylesheetManager.adoptStyleSheets(\n document.adoptedStyleSheets,\n mirror.getId(document)\n );\n };\n _takeFullSnapshot = takeFullSnapshot2;\n try {\n const handlers = [];\n const observe = (doc) => {\n return callbackWrapper(initObservers)(\n {\n onMutation,\n mutationCb: wrappedMutationEmit,\n mousemoveCb: (positions, source) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source,\n positions\n }\n }),\n mouseInteractionCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MouseInteraction,\n ...d\n }\n }),\n scrollCb: wrappedScrollEmit,\n viewportResizeCb: (d) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.ViewportResize,\n ...d\n }\n }),\n inputCb: (v2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Input,\n ...v2\n }\n }),\n mediaInteractionCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.MediaInteraction,\n ...p\n }\n }),\n styleSheetRuleCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleSheetRule,\n ...r2\n }\n }),\n styleDeclarationCb: (r2) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.StyleDeclaration,\n ...r2\n }\n }),\n canvasMutationCb: wrappedCanvasMutationEmit,\n fontCb: (p) => wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Font,\n ...p\n }\n }),\n selectionCb: (p) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.Selection,\n ...p\n }\n });\n },\n customElementCb: (c2) => {\n wrappedEmit({\n type: EventType.IncrementalSnapshot,\n data: {\n source: IncrementalSource.CustomElement,\n ...c2\n }\n });\n },\n blockClass,\n ignoreClass,\n ignoreSelector,\n maskAllText,\n maskTextClass,\n unmaskTextClass,\n maskTextSelector,\n unmaskTextSelector,\n maskInputOptions,\n inlineStylesheet,\n sampling,\n recordDOM,\n recordCanvas,\n inlineImages,\n userTriggeredOnInput,\n collectFonts,\n doc,\n maskAttributeFn,\n maskInputFn,\n maskTextFn,\n keepIframeSrcFn,\n blockSelector,\n unblockSelector,\n slimDOMOptions,\n dataURLOptions,\n mirror,\n iframeManager,\n stylesheetManager,\n shadowDomManager,\n processedNodeManager,\n canvasManager,\n ignoreCSSAttributes,\n plugins: plugins?.filter((p) => p.observer)?.map((p) => ({\n observer: p.observer,\n options: p.options,\n callback: (payload) => wrappedEmit({\n type: EventType.Plugin,\n data: {\n plugin: p.name,\n payload\n }\n })\n })) || []\n },\n {}\n );\n };\n iframeManager.addLoadListener((iframeEl) => {\n try {\n handlers.push(observe(iframeEl.contentDocument));\n } catch (error) {\n console.warn(error);\n }\n });\n const init = () => {\n takeFullSnapshot2();\n handlers.push(observe(document));\n };\n if (document.readyState === \"interactive\" || document.readyState === \"complete\") {\n init();\n } else {\n handlers.push(\n on(\"DOMContentLoaded\", () => {\n wrappedEmit({\n type: EventType.DomContentLoaded,\n data: {}\n });\n if (recordAfter === \"DOMContentLoaded\") init();\n })\n );\n handlers.push(\n on(\n \"load\",\n () => {\n wrappedEmit({\n type: EventType.Load,\n data: {}\n });\n if (recordAfter === \"load\") init();\n },\n window\n )\n );\n }\n return () => {\n handlers.forEach((h) => h());\n processedNodeManager.destroy();\n _takeFullSnapshot = void 0;\n unregisterErrorHandler();\n };\n } catch (error) {\n console.warn(error);\n }\n}\nfunction addCustomEvent(tag, payload) {\n if (!_wrappedEmit) {\n throw new Error(\"please add custom event after start recording\");\n }\n wrappedEmit({\n type: EventType.Custom,\n data: {\n tag,\n payload\n }\n });\n}\nfunction freezePage() {\n mutationBuffers.forEach((buf) => buf.freeze());\n}\nfunction takeFullSnapshot(isCheckout) {\n if (!_takeFullSnapshot) {\n throw new Error(\"please take full snapshot after start recording\");\n }\n _takeFullSnapshot(isCheckout);\n}\nrecord.mirror = mirror;\nrecord.takeFullSnapshot = takeFullSnapshot;\nfunction _getCanvasManager(getCanvasManagerFn, options) {\n try {\n return getCanvasManagerFn ? getCanvasManagerFn(options) : new CanvasManagerNoop();\n } catch {\n console.warn(\"Unable to initialize CanvasManager\");\n return new CanvasManagerNoop();\n }\n}\nfunction mitt$1(n2) {\n return { all: n2 = n2 || /* @__PURE__ */ new Map(), on: function(t2, e2) {\n var i2 = n2.get(t2);\n i2 ? i2.push(e2) : n2.set(t2, [e2]);\n }, off: function(t2, e2) {\n var i2 = n2.get(t2);\n i2 && (e2 ? i2.splice(i2.indexOf(e2) >>> 0, 1) : n2.set(t2, []));\n }, emit: function(t2, e2) {\n var i2 = n2.get(t2);\n i2 && i2.slice().map(function(n3) {\n n3(e2);\n }), (i2 = n2.get(\"*\")) && i2.slice().map(function(n3) {\n n3(t2, e2);\n });\n } };\n}\nconst mittProxy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({\n __proto__: null,\n default: mitt$1\n}, Symbol.toStringTag, { value: \"Module\" }));\nfunction polyfill(w = window, d = document) {\n if (\"scrollBehavior\" in d.documentElement.style && w.__forceSmoothScrollPolyfill__ !== true) {\n return;\n }\n const Element2 = w.HTMLElement || w.Element;\n const SCROLL_TIME = 468;\n const original = {\n scroll: w.scroll || w.scrollTo,\n scrollBy: w.scrollBy,\n elementScroll: Element2.prototype.scroll || scrollElement,\n scrollIntoView: Element2.prototype.scrollIntoView\n };\n const now = w.performance && w.performance.now ? w.performance.now.bind(w.performance) : Date.now;\n function isMicrosoftBrowser(userAgent) {\n const userAgentPatterns = [\"MSIE \", \"Trident/\", \"Edge/\"];\n return new RegExp(userAgentPatterns.join(\"|\")).test(userAgent);\n }\n const ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;\n function scrollElement(x, y) {\n this.scrollLeft = x;\n this.scrollTop = y;\n }\n function ease(k) {\n return 0.5 * (1 - Math.cos(Math.PI * k));\n }\n function shouldBailOut(firstArg) {\n if (firstArg === null || typeof firstArg !== \"object\" || firstArg.behavior === void 0 || firstArg.behavior === \"auto\" || firstArg.behavior === \"instant\") {\n return true;\n }\n if (typeof firstArg === \"object\" && firstArg.behavior === \"smooth\") {\n return false;\n }\n throw new TypeError(\n \"behavior member of ScrollOptions \" + firstArg.behavior + \" is not a valid value for enumeration ScrollBehavior.\"\n );\n }\n function hasScrollableSpace(el, axis) {\n if (axis === \"Y\") {\n return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;\n }\n if (axis === \"X\") {\n return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;\n }\n }\n function canOverflow(el, axis) {\n const overflowValue = w.getComputedStyle(el, null)[\"overflow\" + axis];\n return overflowValue === \"auto\" || overflowValue === \"scroll\";\n }\n function isScrollable(el) {\n const isScrollableY = hasScrollableSpace(el, \"Y\") && canOverflow(el, \"Y\");\n const isScrollableX = hasScrollableSpace(el, \"X\") && canOverflow(el, \"X\");\n return isScrollableY || isScrollableX;\n }\n function findScrollableParent(el) {\n while (el !== d.body && isScrollable(el) === false) {\n el = el.parentNode || el.host;\n }\n return el;\n }\n function step(context) {\n const time = now();\n let value;\n let currentX;\n let currentY;\n let elapsed = (time - context.startTime) / SCROLL_TIME;\n elapsed = elapsed > 1 ? 1 : elapsed;\n value = ease(elapsed);\n currentX = context.startX + (context.x - context.startX) * value;\n currentY = context.startY + (context.y - context.startY) * value;\n context.method.call(context.scrollable, currentX, currentY);\n if (currentX !== context.x || currentY !== context.y) {\n w.requestAnimationFrame(step.bind(w, context));\n }\n }\n function smoothScroll(el, x, y) {\n let scrollable;\n let startX;\n let startY;\n let method;\n const startTime = now();\n if (el === d.body) {\n scrollable = w;\n startX = w.scrollX || w.pageXOffset;\n startY = w.scrollY || w.pageYOffset;\n method = original.scroll;\n } else {\n scrollable = el;\n startX = el.scrollLeft;\n startY = el.scrollTop;\n method = scrollElement;\n }\n step({\n scrollable,\n method,\n startTime,\n startX,\n startY,\n x,\n y\n });\n }\n w.scroll = w.scrollTo = function() {\n if (arguments[0] === void 0) {\n return;\n }\n if (shouldBailOut(arguments[0]) === true) {\n original.scroll.call(\n w,\n arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== \"object\" ? arguments[0] : w.scrollX || w.pageXOffset,\n // use top prop, second argument if present or fallback to scrollY\n arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : w.scrollY || w.pageYOffset\n );\n return;\n }\n smoothScroll.call(\n w,\n d.body,\n arguments[0].left !== void 0 ? ~~arguments[0].left : w.scrollX || w.pageXOffset,\n arguments[0].top !== void 0 ? ~~arguments[0].top : w.scrollY || w.pageYOffset\n );\n };\n w.scrollBy = function() {\n if (arguments[0] === void 0) {\n return;\n }\n if (shouldBailOut(arguments[0])) {\n original.scrollBy.call(\n w,\n arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== \"object\" ? arguments[0] : 0,\n arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : 0\n );\n return;\n }\n smoothScroll.call(\n w,\n d.body,\n ~~arguments[0].left + (w.scrollX || w.pageXOffset),\n ~~arguments[0].top + (w.scrollY || w.pageYOffset)\n );\n };\n Element2.prototype.scroll = Element2.prototype.scrollTo = function() {\n if (arguments[0] === void 0) {\n return;\n }\n if (shouldBailOut(arguments[0]) === true) {\n if (typeof arguments[0] === \"number\" && arguments[1] === void 0) {\n throw new SyntaxError(\"Value could not be converted\");\n }\n original.elementScroll.call(\n this,\n // use left prop, first number argument or fallback to scrollLeft\n arguments[0].left !== void 0 ? ~~arguments[0].left : typeof arguments[0] !== \"object\" ? ~~arguments[0] : this.scrollLeft,\n // use top prop, second argument or fallback to scrollTop\n arguments[0].top !== void 0 ? ~~arguments[0].top : arguments[1] !== void 0 ? ~~arguments[1] : this.scrollTop\n );\n return;\n }\n const left = arguments[0].left;\n const top = arguments[0].top;\n smoothScroll.call(\n this,\n this,\n typeof left === \"undefined\" ? this.scrollLeft : ~~left,\n typeof top === \"undefined\" ? this.scrollTop : ~~top\n );\n };\n Element2.prototype.scrollBy = function() {\n if (arguments[0] === void 0) {\n return;\n }\n if (shouldBailOut(arguments[0]) === true) {\n original.elementScroll.call(\n this,\n arguments[0].left !== void 0 ? ~~arguments[0].left + this.scrollLeft : ~~arguments[0] + this.scrollLeft,\n arguments[0].top !== void 0 ? ~~arguments[0].top + this.scrollTop : ~~arguments[1] + this.scrollTop\n );\n return;\n }\n this.scroll({\n left: ~~arguments[0].left + this.scrollLeft,\n top: ~~arguments[0].top + this.scrollTop,\n behavior: arguments[0].behavior\n });\n };\n Element2.prototype.scrollIntoView = function() {\n if (shouldBailOut(arguments[0]) === true) {\n original.scrollIntoView.call(\n this,\n arguments[0] === void 0 ? true : arguments[0]\n );\n return;\n }\n const scrollableParent = findScrollableParent(this);\n const parentRects = scrollableParent.getBoundingClientRect();\n const clientRects = this.getBoundingClientRect();\n if (scrollableParent !== d.body) {\n smoothScroll.call(\n this,\n scrollableParent,\n scrollableParent.scrollLeft + clientRects.left - parentRects.left,\n scrollableParent.scrollTop + clientRects.top - parentRects.top\n );\n if (w.getComputedStyle(scrollableParent).position !== \"fixed\") {\n w.scrollBy({\n left: parentRects.left,\n top: parentRects.top,\n behavior: \"smooth\"\n });\n }\n } else {\n w.scrollBy({\n left: clientRects.left,\n top: clientRects.top,\n behavior: \"smooth\"\n });\n }\n };\n}\nclass Timer {\n constructor(actions = [], config) {\n this.timeOffset = 0;\n this.raf = null;\n this.actions = actions;\n this.speed = config.speed;\n }\n /**\n * Add an action, possibly after the timer starts.\n */\n addAction(action) {\n const rafWasActive = this.raf === true;\n if (!this.actions.length || this.actions[this.actions.length - 1].delay <= action.delay) {\n this.actions.push(action);\n } else {\n const index = this.findActionIndex(action);\n this.actions.splice(index, 0, action);\n }\n if (rafWasActive) {\n this.raf = onRequestAnimationFrame(this.rafCheck.bind(this));\n }\n }\n start() {\n this.timeOffset = 0;\n this.lastTimestamp = performance.now();\n this.raf = onRequestAnimationFrame(this.rafCheck.bind(this));\n }\n rafCheck() {\n const time = performance.now();\n this.timeOffset += (time - this.lastTimestamp) * this.speed;\n this.lastTimestamp = time;\n while (this.actions.length) {\n const action = this.actions[0];\n if (this.timeOffset >= action.delay) {\n this.actions.shift();\n action.doAction();\n } else {\n break;\n }\n }\n if (this.actions.length > 0) {\n this.raf = onRequestAnimationFrame(this.rafCheck.bind(this));\n } else {\n this.raf = true;\n }\n }\n clear() {\n if (this.raf) {\n if (this.raf !== true) {\n cancelAnimationFrame(this.raf);\n }\n this.raf = null;\n }\n this.actions.length = 0;\n }\n setSpeed(speed) {\n this.speed = speed;\n }\n isActive() {\n return this.raf !== null;\n }\n findActionIndex(action) {\n let start = 0;\n let end = this.actions.length - 1;\n while (start <= end) {\n const mid = Math.floor((start + end) / 2);\n if (this.actions[mid].delay < action.delay) {\n start = mid + 1;\n } else if (this.actions[mid].delay > action.delay) {\n end = mid - 1;\n } else {\n return mid + 1;\n }\n }\n return start;\n }\n}\nfunction addDelay(event, baselineTime) {\n if (event.type === EventType.IncrementalSnapshot && event.data.source === IncrementalSource.MouseMove && event.data.positions && event.data.positions.length) {\n const firstOffset = event.data.positions[0].timeOffset;\n const firstTimestamp = event.timestamp + firstOffset;\n event.delay = firstTimestamp - baselineTime;\n return firstTimestamp - baselineTime;\n }\n event.delay = event.timestamp - baselineTime;\n return event.delay;\n}\n/*! *****************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\nfunction t(t2, n2) {\n var e2 = \"function\" == typeof Symbol && t2[Symbol.iterator];\n if (!e2) return t2;\n var r2, o2, i2 = e2.call(t2), a2 = [];\n try {\n for (; (void 0 === n2 || n2-- > 0) && !(r2 = i2.next()).done; ) a2.push(r2.value);\n } catch (t3) {\n o2 = { error: t3 };\n } finally {\n try {\n r2 && !r2.done && (e2 = i2.return) && e2.call(i2);\n } finally {\n if (o2) throw o2.error;\n }\n }\n return a2;\n}\nvar n;\n!function(t2) {\n t2[t2.NotStarted = 0] = \"NotStarted\", t2[t2.Running = 1] = \"Running\", t2[t2.Stopped = 2] = \"Stopped\";\n}(n || (n = {}));\nvar e = { type: \"xstate.init\" };\nfunction r(t2) {\n return void 0 === t2 ? [] : [].concat(t2);\n}\nfunction o(t2) {\n return { type: \"xstate.assign\", assignment: t2 };\n}\nfunction i(t2, n2) {\n return \"string\" == typeof (t2 = \"string\" == typeof t2 && n2 && n2[t2] ? n2[t2] : t2) ? { type: t2 } : \"function\" == typeof t2 ? { type: t2.name, exec: t2 } : t2;\n}\nfunction a(t2) {\n return function(n2) {\n return t2 === n2;\n };\n}\nfunction u(t2) {\n return \"string\" == typeof t2 ? { type: t2 } : t2;\n}\nfunction c(t2, n2) {\n return { value: t2, context: n2, actions: [], changed: false, matches: a(t2) };\n}\nfunction f(t2, n2, e2) {\n var r2 = n2, o2 = false;\n return [t2.filter(function(t3) {\n if (\"xstate.assign\" === t3.type) {\n o2 = true;\n var n3 = Object.assign({}, r2);\n return \"function\" == typeof t3.assignment ? n3 = t3.assignment(r2, e2) : Object.keys(t3.assignment).forEach(function(o3) {\n n3[o3] = \"function\" == typeof t3.assignment[o3] ? t3.assignment[o3](r2, e2) : t3.assignment[o3];\n }), r2 = n3, false;\n }\n return true;\n }), r2, o2];\n}\nfunction s(n2, o2) {\n void 0 === o2 && (o2 = {});\n var s2 = t(f(r(n2.states[n2.initial].entry).map(function(t2) {\n return i(t2, o2.actions);\n }), n2.context, e), 2), l2 = s2[0], v2 = s2[1], y = { config: n2, _options: o2, initialState: { value: n2.initial, actions: l2, context: v2, matches: a(n2.initial) }, transition: function(e2, o3) {\n var s3, l3, v3 = \"string\" == typeof e2 ? { value: e2, context: n2.context } : e2, p = v3.value, g = v3.context, d = u(o3), x = n2.states[p];\n if (x.on) {\n var m = r(x.on[d.type]);\n try {\n for (var h = function(t2) {\n var n3 = \"function\" == typeof Symbol && Symbol.iterator, e3 = n3 && t2[n3], r2 = 0;\n if (e3) return e3.call(t2);\n if (t2 && \"number\" == typeof t2.length) return { next: function() {\n return t2 && r2 >= t2.length && (t2 = void 0), { value: t2 && t2[r2++], done: !t2 };\n } };\n throw new TypeError(n3 ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n }(m), b = h.next(); !b.done; b = h.next()) {\n var S = b.value;\n if (void 0 === S) return c(p, g);\n var w = \"string\" == typeof S ? { target: S } : S, j = w.target, E = w.actions, R = void 0 === E ? [] : E, N = w.cond, O = void 0 === N ? function() {\n return true;\n } : N, _ = void 0 === j, k = null != j ? j : p, T = n2.states[k];\n if (O(g, d)) {\n var q = t(f((_ ? r(R) : [].concat(x.exit, R, T.entry).filter(function(t2) {\n return t2;\n })).map(function(t2) {\n return i(t2, y._options.actions);\n }), g, d), 3), z = q[0], A = q[1], B = q[2], C = null != j ? j : p;\n return { value: C, context: A, actions: z, changed: j !== p || z.length > 0 || B, matches: a(C) };\n }\n }\n } catch (t2) {\n s3 = { error: t2 };\n } finally {\n try {\n b && !b.done && (l3 = h.return) && l3.call(h);\n } finally {\n if (s3) throw s3.error;\n }\n }\n }\n return c(p, g);\n } };\n return y;\n}\nvar l = function(t2, n2) {\n return t2.actions.forEach(function(e2) {\n var r2 = e2.exec;\n return r2 && r2(t2.context, n2);\n });\n};\nfunction v(t2) {\n var r2 = t2.initialState, o2 = n.NotStarted, i2 = /* @__PURE__ */ new Set(), c2 = { _machine: t2, send: function(e2) {\n o2 === n.Running && (r2 = t2.transition(r2, e2), l(r2, u(e2)), i2.forEach(function(t3) {\n return t3(r2);\n }));\n }, subscribe: function(t3) {\n return i2.add(t3), t3(r2), { unsubscribe: function() {\n return i2.delete(t3);\n } };\n }, start: function(i3) {\n if (i3) {\n var u2 = \"object\" == typeof i3 ? i3 : { context: t2.config.context, value: i3 };\n r2 = { value: u2.value, actions: [], context: u2.context, matches: a(u2.value) };\n }\n return o2 = n.Running, l(r2, e), c2;\n }, stop: function() {\n return o2 = n.Stopped, i2.clear(), c2;\n }, get state() {\n return r2;\n }, get status() {\n return o2;\n } };\n return c2;\n}\nfunction discardPriorSnapshots(events, baselineTime) {\n for (let idx = events.length - 1; idx >= 0; idx--) {\n const event = events[idx];\n if (event.type === EventType.Meta) {\n if (event.timestamp <= baselineTime) {\n return events.slice(idx);\n }\n }\n }\n return events;\n}\nfunction createPlayerService(context, { getCastFn, applyEventsSynchronously, emitter }) {\n const playerMachine = s(\n {\n id: \"player\",\n context,\n initial: \"paused\",\n states: {\n playing: {\n on: {\n PAUSE: {\n target: \"paused\",\n actions: [\"pause\"]\n },\n CAST_EVENT: {\n target: \"playing\",\n actions: \"castEvent\"\n },\n END: {\n target: \"paused\",\n actions: [\"resetLastPlayedEvent\", \"pause\"]\n },\n ADD_EVENT: {\n target: \"playing\",\n actions: [\"addEvent\"]\n }\n }\n },\n paused: {\n on: {\n PLAY: {\n target: \"playing\",\n actions: [\"recordTimeOffset\", \"play\"]\n },\n CAST_EVENT: {\n target: \"paused\",\n actions: \"castEvent\"\n },\n TO_LIVE: {\n target: \"live\",\n actions: [\"startLive\"]\n },\n ADD_EVENT: {\n target: \"paused\",\n actions: [\"addEvent\"]\n }\n }\n },\n live: {\n on: {\n ADD_EVENT: {\n target: \"live\",\n actions: [\"addEvent\"]\n },\n CAST_EVENT: {\n target: \"live\",\n actions: [\"castEvent\"]\n }\n }\n }\n }\n },\n {\n actions: {\n castEvent: o({\n lastPlayedEvent: (ctx, event) => {\n if (event.type === \"CAST_EVENT\") {\n return event.payload.event;\n }\n return ctx.lastPlayedEvent;\n }\n }),\n recordTimeOffset: o((ctx, event) => {\n let timeOffset = ctx.timeOffset;\n if (\"payload\" in event && \"timeOffset\" in event.payload) {\n timeOffset = event.payload.timeOffset;\n }\n return {\n ...ctx,\n timeOffset,\n baselineTime: ctx.events[0].timestamp + timeOffset\n };\n }),\n play(ctx) {\n const { timer, events, baselineTime, lastPlayedEvent } = ctx;\n timer.clear();\n for (const event of events) {\n addDelay(event, baselineTime);\n }\n const neededEvents = discardPriorSnapshots(events, baselineTime);\n let lastPlayedTimestamp = lastPlayedEvent?.timestamp;\n if (lastPlayedEvent?.type === EventType.IncrementalSnapshot && lastPlayedEvent.data.source === IncrementalSource.MouseMove) {\n lastPlayedTimestamp = lastPlayedEvent.timestamp + lastPlayedEvent.data.positions[0]?.timeOffset;\n }\n if (baselineTime < (lastPlayedTimestamp || 0)) {\n emitter.emit(ReplayerEvents.PlayBack);\n }\n const syncEvents = new Array();\n for (const event of neededEvents) {\n if (lastPlayedTimestamp && lastPlayedTimestamp < baselineTime && (event.timestamp <= lastPlayedTimestamp || event === lastPlayedEvent)) {\n continue;\n }\n if (event.timestamp < baselineTime) {\n syncEvents.push(event);\n } else {\n const castFn = getCastFn(event, false);\n timer.addAction({\n doAction: () => {\n castFn();\n },\n delay: event.delay\n });\n }\n }\n applyEventsSynchronously(syncEvents);\n emitter.emit(ReplayerEvents.Flush);\n timer.start();\n },\n pause(ctx) {\n ctx.timer.clear();\n },\n resetLastPlayedEvent: o((ctx) => {\n return {\n ...ctx,\n lastPlayedEvent: null\n };\n }),\n startLive: o({\n baselineTime: (ctx, event) => {\n ctx.timer.start();\n if (event.type === \"TO_LIVE\" && event.payload.baselineTime) {\n return event.payload.baselineTime;\n }\n return Date.now();\n }\n }),\n addEvent: o((ctx, machineEvent) => {\n const { baselineTime, timer, events } = ctx;\n if (machineEvent.type === \"ADD_EVENT\") {\n const { event } = machineEvent.payload;\n addDelay(event, baselineTime);\n let end = events.length - 1;\n if (!events[end] || events[end].timestamp <= event.timestamp) {\n events.push(event);\n } else {\n let insertionIndex = -1;\n let start = 0;\n while (start <= end) {\n const mid = Math.floor((start + end) / 2);\n if (events[mid].timestamp <= event.timestamp) {\n start = mid + 1;\n } else {\n end = mid - 1;\n }\n }\n if (insertionIndex === -1) {\n insertionIndex = start;\n }\n events.splice(insertionIndex, 0, event);\n }\n const isSync = event.timestamp < baselineTime;\n const castFn = getCastFn(event, isSync);\n if (isSync) {\n castFn();\n } else if (timer.isActive()) {\n timer.addAction({\n doAction: () => {\n castFn();\n },\n delay: event.delay\n });\n }\n }\n return { ...ctx, events };\n })\n }\n }\n );\n return v(playerMachine);\n}\nfunction createSpeedService(context) {\n const speedMachine = s(\n {\n id: \"speed\",\n context,\n initial: \"normal\",\n states: {\n normal: {\n on: {\n FAST_FORWARD: {\n target: \"skipping\",\n actions: [\"recordSpeed\", \"setSpeed\"]\n },\n SET_SPEED: {\n target: \"normal\",\n actions: [\"setSpeed\"]\n }\n }\n },\n skipping: {\n on: {\n BACK_TO_NORMAL: {\n target: \"normal\",\n actions: [\"restoreSpeed\"]\n },\n SET_SPEED: {\n target: \"normal\",\n actions: [\"setSpeed\"]\n }\n }\n }\n }\n },\n {\n actions: {\n setSpeed: (ctx, event) => {\n if (\"payload\" in event) {\n ctx.timer.setSpeed(event.payload.speed);\n }\n },\n recordSpeed: o({\n normalSpeed: (ctx) => ctx.timer.speed\n }),\n restoreSpeed: (ctx) => {\n ctx.timer.setSpeed(ctx.normalSpeed);\n }\n }\n }\n );\n return v(speedMachine);\n}\nconst rules = (blockClass) => [\n `.${blockClass} { background: currentColor }`,\n \"noscript { display: none !important; }\"\n];\nconst webGLVarMap = /* @__PURE__ */ new Map();\nfunction variableListFor(ctx, ctor) {\n let contextMap = webGLVarMap.get(ctx);\n if (!contextMap) {\n contextMap = /* @__PURE__ */ new Map();\n webGLVarMap.set(ctx, contextMap);\n }\n if (!contextMap.has(ctor)) {\n contextMap.set(ctor, []);\n }\n return contextMap.get(ctor);\n}\nfunction deserializeArg(imageMap, ctx, preload) {\n return async (arg) => {\n if (arg && typeof arg === \"object\" && \"rr_type\" in arg) {\n if (preload) preload.isUnchanged = false;\n if (arg.rr_type === \"ImageBitmap\" && \"args\" in arg) {\n const args = await deserializeArg(imageMap, ctx, preload)(arg.args);\n return await createImageBitmap.apply(null, args);\n } else if (\"index\" in arg) {\n if (preload || ctx === null) return arg;\n const { rr_type: name, index } = arg;\n return variableListFor(ctx, name)[index];\n } else if (\"args\" in arg) {\n const { rr_type: name, args } = arg;\n const ctor = window[name];\n return new ctor(\n ...await Promise.all(\n args.map(deserializeArg(imageMap, ctx, preload))\n )\n );\n } else if (\"base64\" in arg) {\n return decode(arg.base64);\n } else if (\"src\" in arg) {\n const image = imageMap.get(arg.src);\n if (image) {\n return image;\n } else {\n const image2 = new Image();\n image2.src = arg.src;\n imageMap.set(arg.src, image2);\n return image2;\n }\n } else if (\"data\" in arg && arg.rr_type === \"Blob\") {\n const blobContents = await Promise.all(\n arg.data.map(deserializeArg(imageMap, ctx, preload))\n );\n const blob = new Blob(blobContents, {\n type: arg.type\n });\n return blob;\n }\n } else if (Array.isArray(arg)) {\n const result = await Promise.all(\n arg.map(deserializeArg(imageMap, ctx, preload))\n );\n return result;\n }\n return arg;\n };\n}\nfunction getContext(target, type) {\n try {\n if (type === CanvasContext.WebGL) {\n return target.getContext(\"webgl\") || target.getContext(\"experimental-webgl\");\n }\n return target.getContext(\"webgl2\");\n } catch (e2) {\n return null;\n }\n}\nconst WebGLVariableConstructorsNames = [\n \"WebGLActiveInfo\",\n \"WebGLBuffer\",\n \"WebGLFramebuffer\",\n \"WebGLProgram\",\n \"WebGLRenderbuffer\",\n \"WebGLShader\",\n \"WebGLShaderPrecisionFormat\",\n \"WebGLTexture\",\n \"WebGLUniformLocation\",\n \"WebGLVertexArrayObject\"\n];\nfunction saveToWebGLVarMap(ctx, result) {\n if (!result?.constructor) return;\n const { name } = result.constructor;\n if (!WebGLVariableConstructorsNames.includes(name)) return;\n const variables = variableListFor(ctx, name);\n if (!variables.includes(result)) variables.push(result);\n}\nasync function webglMutation({\n mutation,\n target,\n type,\n imageMap,\n errorHandler: errorHandler2\n}) {\n try {\n const ctx = getContext(target, type);\n if (!ctx) return;\n if (mutation.setter) {\n ctx[mutation.property] = mutation.args[0];\n return;\n }\n const original = ctx[mutation.property];\n const args = await Promise.all(\n mutation.args.map(deserializeArg(imageMap, ctx))\n );\n const result = original.apply(ctx, args);\n saveToWebGLVarMap(ctx, result);\n const debugMode = false;\n if (debugMode) ;\n } catch (error) {\n errorHandler2(mutation, error);\n }\n}\nasync function canvasMutation$1({\n event,\n mutations,\n target,\n imageMap,\n errorHandler: errorHandler2\n}) {\n const ctx = target.getContext(\"2d\");\n if (!ctx) {\n errorHandler2(mutations[0], new Error(\"Canvas context is null\"));\n return;\n }\n const mutationArgsPromises = mutations.map(\n async (mutation) => {\n return Promise.all(mutation.args.map(deserializeArg(imageMap, ctx)));\n }\n );\n const args = await Promise.all(mutationArgsPromises);\n args.forEach((args2, index) => {\n const mutation = mutations[index];\n try {\n if (mutation.setter) {\n ctx[mutation.property] = mutation.args[0];\n return;\n }\n const original = ctx[mutation.property];\n if (mutation.property === \"drawImage\" && typeof mutation.args[0] === \"string\") {\n imageMap.get(event);\n original.apply(ctx, mutation.args);\n } else {\n original.apply(ctx, args2);\n }\n } catch (error) {\n errorHandler2(mutation, error);\n }\n return;\n });\n}\nasync function canvasMutation({\n event,\n mutation,\n target,\n imageMap,\n canvasEventMap,\n errorHandler: errorHandler2\n}) {\n try {\n const precomputedMutation = canvasEventMap.get(event) || mutation;\n const commands = \"commands\" in precomputedMutation ? precomputedMutation.commands : [precomputedMutation];\n if ([CanvasContext.WebGL, CanvasContext.WebGL2].includes(mutation.type)) {\n for (let i2 = 0; i2 < commands.length; i2++) {\n const command = commands[i2];\n await webglMutation({\n mutation: command,\n type: mutation.type,\n target,\n imageMap,\n errorHandler: errorHandler2\n });\n }\n return;\n }\n await canvasMutation$1({\n event,\n mutations: commands,\n target,\n imageMap,\n errorHandler: errorHandler2\n });\n } catch (error) {\n errorHandler2(mutation, error);\n }\n}\nconst SKIP_TIME_INTERVAL = 5 * 1e3;\nconst mitt = mitt$1 || mittProxy;\nconst REPLAY_CONSOLE_PREFIX = \"[replayer]\";\nfunction getEventIndex(events, eventTime) {\n let result = -1;\n if (events.length === 0) {\n return result;\n }\n let left = 0, right = events.length - 1;\n while (left <= right) {\n const mid = Math.floor((left + right) / 2);\n if (events[mid].timestamp <= eventTime) {\n result = mid;\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n return result;\n}\nconst defaultMouseTailConfig = {\n duration: 500,\n lineCap: \"round\",\n lineWidth: 3,\n strokeStyle: \"red\"\n};\nfunction indicatesTouchDevice(e2) {\n return e2.type == EventType.IncrementalSnapshot && (e2.data.source == IncrementalSource.TouchMove || e2.data.source == IncrementalSource.MouseInteraction && e2.data.type == MouseInteractions.TouchStart);\n}\nfunction getPointerId(d) {\n const pointerId = \"pointerId\" in d && typeof d.pointerId === \"number\" ? d.pointerId : -1;\n return pointerId;\n}\nclass Replayer {\n constructor(events, config) {\n this.usingVirtualDom = false;\n this.virtualDom = new RRDocument();\n this.emitter = mitt();\n this.legacy_missingNodeRetryMap = {};\n this.cache = createCache();\n this.imageMap = /* @__PURE__ */ new Map();\n this.canvasEventMap = /* @__PURE__ */ new Map();\n this.mirror = createMirror$2();\n this.styleMirror = new StyleSheetMirror();\n this.firstFullSnapshot = null;\n this.newDocumentQueue = [];\n this.pointers = {};\n this.lastMouseDownEvent = null;\n this.lastSelectionData = null;\n this.constructedStyleMutations = [];\n this.adoptedStyleSheets = [];\n this.handleResize = (dimension) => {\n this.iframe.style.display = \"inherit\";\n for (const el of [\n ...Object.values(this.pointers).flatMap((a2) => a2.mouseTail),\n this.iframe\n ]) {\n if (!el) {\n continue;\n }\n el.setAttribute(\"width\", String(dimension.width));\n el.setAttribute(\"height\", String(dimension.height));\n }\n };\n this.applyEventsSynchronously = (events2) => {\n for (const event of events2) {\n switch (event.type) {\n case EventType.DomContentLoaded:\n case EventType.Load:\n case EventType.Custom:\n continue;\n case EventType.FullSnapshot:\n case EventType.Meta:\n case EventType.Plugin:\n case EventType.IncrementalSnapshot:\n break;\n }\n const castFn = this.getCastFn(event, true);\n castFn();\n }\n };\n this.getCastFn = (event, isSync = false) => {\n let castFn;\n switch (event.type) {\n case EventType.DomContentLoaded:\n case EventType.Load:\n break;\n case EventType.Custom:\n castFn = () => {\n this.emitter.emit(ReplayerEvents.CustomEvent, event);\n };\n break;\n case EventType.Meta:\n castFn = () => this.emitter.emit(ReplayerEvents.Resize, {\n width: event.data.width,\n height: event.data.height\n });\n break;\n case EventType.FullSnapshot:\n castFn = () => {\n if (this.firstFullSnapshot) {\n if (this.firstFullSnapshot === event) {\n this.firstFullSnapshot = true;\n return;\n }\n } else {\n this.firstFullSnapshot = true;\n }\n this.rebuildFullSnapshot(event, isSync);\n this.iframe.contentWindow?.scrollTo(event.data.initialOffset);\n this.styleMirror.reset();\n };\n break;\n case EventType.IncrementalSnapshot:\n castFn = () => {\n this.applyIncremental(event, isSync);\n if (isSync) {\n return;\n }\n if (event === this.nextUserInteractionEvent) {\n this.nextUserInteractionEvent = null;\n this.backToNormal();\n }\n if (this.config.skipInactive && !this.nextUserInteractionEvent) {\n for (const _event of this.service.state.context.events) {\n if (_event.timestamp <= event.timestamp) {\n continue;\n }\n if (this.isUserInteraction(_event)) {\n if (\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n _event.delay - event.delay > this.config.inactivePeriodThreshold * this.speedService.state.context.timer.speed\n ) {\n this.nextUserInteractionEvent = _event;\n }\n break;\n }\n }\n if (this.nextUserInteractionEvent) {\n const skipTime = (\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.nextUserInteractionEvent.delay - event.delay\n );\n const payload = {\n speed: Math.min(\n Math.round(skipTime / SKIP_TIME_INTERVAL),\n this.config.maxSpeed\n )\n };\n this.speedService.send({ type: \"FAST_FORWARD\", payload });\n this.emitter.emit(ReplayerEvents.SkipStart, payload);\n }\n }\n };\n break;\n }\n const wrappedCastFn = () => {\n if (castFn) {\n castFn();\n }\n for (const plugin of this.config.plugins || []) {\n if (plugin.handler) plugin.handler(event, isSync, { replayer: this });\n }\n this.service.send({ type: \"CAST_EVENT\", payload: { event } });\n const last_index = this.service.state.context.events.length - 1;\n if (!this.config.liveMode && event === this.service.state.context.events[last_index]) {\n const finish = () => {\n if (last_index < this.service.state.context.events.length - 1) {\n return;\n }\n this.backToNormal();\n this.service.send(\"END\");\n this.emitter.emit(ReplayerEvents.Finish);\n };\n let finish_buffer = 50;\n if (event.type === EventType.IncrementalSnapshot && event.data.source === IncrementalSource.MouseMove && event.data.positions.length) {\n finish_buffer += Math.max(0, -event.data.positions[0].timeOffset);\n }\n setTimeout$1(finish, finish_buffer);\n }\n this.emitter.emit(ReplayerEvents.EventCast, event);\n };\n return wrappedCastFn;\n };\n if (!config?.liveMode && events.length < 2) {\n throw new Error(\"Replayer need at least 2 events.\");\n }\n const defaultConfig = {\n speed: 1,\n maxSpeed: 360,\n root: document.body,\n loadTimeout: 0,\n skipInactive: false,\n inactivePeriodThreshold: 10 * 1e3,\n showWarning: true,\n showDebug: false,\n blockClass: \"rr-block\",\n liveMode: false,\n insertStyleRules: [],\n triggerFocus: true,\n UNSAFE_replayCanvas: false,\n pauseAnimation: true,\n mouseTail: defaultMouseTailConfig,\n useVirtualDom: true,\n // Virtual-dom optimization is enabled by default.\n logger: console\n };\n this.config = Object.assign({}, defaultConfig, config);\n this.handleResize = this.handleResize.bind(this);\n this.getCastFn = this.getCastFn.bind(this);\n this.applyEventsSynchronously = this.applyEventsSynchronously.bind(this);\n this.emitter.on(ReplayerEvents.Resize, this.handleResize);\n this.setupDom();\n for (const plugin of this.config.plugins || []) {\n if (plugin.getMirror) plugin.getMirror({ nodeMirror: this.mirror });\n }\n this.emitter.on(ReplayerEvents.Flush, () => {\n if (this.usingVirtualDom) {\n const replayerHandler = {\n mirror: this.mirror,\n applyCanvas: (canvasEvent, canvasMutationData2, target) => {\n void canvasMutation({\n event: canvasEvent,\n mutation: canvasMutationData2,\n target,\n imageMap: this.imageMap,\n canvasEventMap: this.canvasEventMap,\n errorHandler: this.warnCanvasMutationFailed.bind(this)\n });\n },\n applyInput: this.applyInput.bind(this),\n applyScroll: this.applyScroll.bind(this),\n applyStyleSheetMutation: (data, styleSheet) => {\n if (data.source === IncrementalSource.StyleSheetRule)\n this.applyStyleSheetRule(data, styleSheet);\n else if (data.source === IncrementalSource.StyleDeclaration)\n this.applyStyleDeclaration(data, styleSheet);\n },\n afterAppend: (node, id) => {\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild) plugin.onBuild(node, { id, replayer: this });\n }\n }\n };\n const iframeDoc = getIFrameContentDocument(this.iframe);\n if (iframeDoc)\n try {\n diff(\n iframeDoc,\n this.virtualDom,\n replayerHandler,\n this.virtualDom.mirror\n );\n } catch (e2) {\n console.warn(e2);\n }\n this.virtualDom.destroyTree();\n this.usingVirtualDom = false;\n if (Object.keys(this.legacy_missingNodeRetryMap).length) {\n for (const key in this.legacy_missingNodeRetryMap) {\n try {\n const value = this.legacy_missingNodeRetryMap[key];\n const realNode = createOrGetNode(\n value.node,\n this.mirror,\n this.virtualDom.mirror\n );\n diff(\n realNode,\n value.node,\n replayerHandler,\n this.virtualDom.mirror\n );\n value.node = realNode;\n } catch (error) {\n this.warn(error);\n }\n }\n }\n this.constructedStyleMutations.forEach((data) => {\n this.applyStyleSheetMutation(data);\n });\n this.constructedStyleMutations = [];\n this.adoptedStyleSheets.forEach((data) => {\n this.applyAdoptedStyleSheet(data);\n });\n this.adoptedStyleSheets = [];\n }\n for (const [\n pointerId,\n { pointerPosition, touchActive }\n ] of Object.entries(this.pointers)) {\n const id = parseInt(pointerId);\n const pointer = this.pointers[id];\n if (pointerPosition) {\n this.moveAndHover(\n pointerPosition.x,\n pointerPosition.y,\n pointerPosition.id,\n true,\n pointerPosition.debugData,\n id\n );\n pointer.pointerPosition = null;\n }\n if (touchActive === true) {\n pointer.pointerEl.classList.add(\"touch-active\");\n } else if (touchActive === false) {\n pointer.pointerEl.classList.remove(\"touch-active\");\n }\n pointer.touchActive = null;\n }\n if (this.lastMouseDownEvent) {\n const [target, event] = this.lastMouseDownEvent;\n target.dispatchEvent(event);\n }\n this.lastMouseDownEvent = null;\n if (this.lastSelectionData) {\n this.applySelection(this.lastSelectionData);\n this.lastSelectionData = null;\n }\n });\n this.emitter.on(ReplayerEvents.PlayBack, () => {\n this.firstFullSnapshot = null;\n this.mirror.reset();\n this.styleMirror.reset();\n });\n const timer = new Timer([], {\n speed: this.config.speed\n });\n this.service = createPlayerService(\n {\n events: events.map((e2) => {\n if (config && config.unpackFn) {\n return config.unpackFn(e2);\n }\n return e2;\n }).sort((a1, a2) => a1.timestamp - a2.timestamp),\n timer,\n timeOffset: 0,\n baselineTime: 0,\n lastPlayedEvent: null\n },\n {\n getCastFn: this.getCastFn,\n applyEventsSynchronously: this.applyEventsSynchronously,\n emitter: this.emitter\n }\n );\n this.service.start();\n this.service.subscribe((state) => {\n this.emitter.emit(ReplayerEvents.StateChange, {\n player: state\n });\n });\n this.speedService = createSpeedService({\n normalSpeed: -1,\n timer\n });\n this.speedService.start();\n this.speedService.subscribe((state) => {\n this.emitter.emit(ReplayerEvents.StateChange, {\n speed: state\n });\n });\n const firstMeta = this.service.state.context.events.find(\n (e2) => e2.type === EventType.Meta\n );\n const firstFullsnapshot = this.service.state.context.events.find(\n (e2) => e2.type === EventType.FullSnapshot\n );\n if (firstMeta) {\n const { width, height } = firstMeta.data;\n setTimeout$1(() => {\n this.emitter.emit(ReplayerEvents.Resize, {\n width,\n height\n });\n }, 0);\n }\n if (firstFullsnapshot) {\n setTimeout$1(() => {\n if (this.firstFullSnapshot) {\n return;\n }\n this.firstFullSnapshot = firstFullsnapshot;\n this.rebuildFullSnapshot(\n firstFullsnapshot\n );\n this.iframe.contentWindow?.scrollTo(\n firstFullsnapshot.data.initialOffset\n );\n }, 1);\n }\n }\n get timer() {\n return this.service.state.context.timer;\n }\n createPointer(pointerId, event) {\n const mouseTail = document.createElement(\"canvas\");\n mouseTail.classList.add(\"replayer-mouse-tail\");\n mouseTail.width = Number.parseFloat(this.iframe.width);\n mouseTail.height = Number.parseFloat(this.iframe.height);\n this.wrapper.insertBefore(mouseTail, this.iframe);\n mouseTail.style.display = this.config.mouseTail === false ? \"none\" : \"inherit\";\n const newMouse = document.createElement(\"div\");\n newMouse.classList.add(\"replayer-mouse\");\n this.pointers[pointerId] = {\n touchActive: null,\n pointerEl: newMouse,\n tailPositions: [],\n pointerPosition: null,\n mouseTail\n };\n if (indicatesTouchDevice(event)) {\n newMouse.classList.add(\"touch-device\");\n }\n this.wrapper.appendChild(newMouse);\n }\n on(event, handler) {\n this.emitter.on(event, handler);\n return this;\n }\n off(event, handler) {\n this.emitter.off(event, handler);\n return this;\n }\n setConfig(config) {\n const previousSkipInactive = this.config.skipInactive;\n Object.keys(config).forEach((key) => {\n config[key];\n this.config[key] = config[key];\n });\n if (!this.config.skipInactive) {\n this.backToNormal();\n } else if (previousSkipInactive === false && this.config.skipInactive === true) {\n this.reevaluateFastForward();\n }\n if (typeof config.speed !== \"undefined\") {\n this.speedService.send({\n type: \"SET_SPEED\",\n payload: {\n speed: config.speed\n }\n });\n }\n if (typeof config.mouseTail !== \"undefined\") {\n if (config.mouseTail === false) {\n for (const { mouseTail } of Object.values(this.pointers)) {\n if (mouseTail) {\n mouseTail.style.display = \"none\";\n }\n }\n } else {\n for (let { mouseTail } of Object.values(this.pointers)) {\n if (!mouseTail) {\n mouseTail = document.createElement(\"canvas\");\n mouseTail.width = Number.parseFloat(this.iframe.width);\n mouseTail.height = Number.parseFloat(this.iframe.height);\n mouseTail.classList.add(\"replayer-mouse-tail\");\n this.wrapper.insertBefore(mouseTail, this.iframe);\n }\n mouseTail.style.display = \"inherit\";\n }\n }\n }\n }\n getMetaData() {\n const firstEvent = this.service.state.context.events[0];\n const lastEvent = this.service.state.context.events[this.service.state.context.events.length - 1];\n return {\n startTime: firstEvent.timestamp,\n endTime: lastEvent.timestamp,\n totalTime: lastEvent.timestamp - firstEvent.timestamp\n };\n }\n getCurrentTime() {\n return this.timer.timeOffset + this.getTimeOffset();\n }\n getTimeOffset() {\n const { baselineTime, events } = this.service.state.context;\n return baselineTime - events[0].timestamp;\n }\n getMirror() {\n return this.mirror;\n }\n /**\n * This API was designed to be used as play at any time offset.\n * Since we minimized the data collected from recorder, we do not\n * have the ability of undo an event.\n * So the implementation of play at any time offset will always iterate\n * all of the events, cast event before the offset synchronously\n * and cast event after the offset asynchronously with timer.\n * @param timeOffset - number\n */\n play(timeOffset = 0) {\n if (this.config.skipInactive && this.speedService.state.matches(\"skipping\")) {\n this.backToNormal();\n }\n if (this.service.state.matches(\"paused\")) {\n this.service.send({ type: \"PLAY\", payload: { timeOffset } });\n } else {\n this.service.send({ type: \"PAUSE\" });\n this.service.send({ type: \"PLAY\", payload: { timeOffset } });\n }\n const iframeDoc = getIFrameContentDocument(this.iframe);\n iframeDoc?.getElementsByTagName(\"html\")[0]?.classList.remove(\"rrweb-paused\");\n this.emitter.emit(ReplayerEvents.Start);\n if (this.config.skipInactive) {\n this.reevaluateFastForward();\n }\n }\n pause(timeOffset) {\n if (timeOffset === void 0 && this.service.state.matches(\"playing\")) {\n this.service.send({ type: \"PAUSE\" });\n }\n if (typeof timeOffset === \"number\") {\n this.play(timeOffset);\n this.service.send({ type: \"PAUSE\" });\n }\n const iframeDoc = getIFrameContentDocument(this.iframe);\n iframeDoc?.getElementsByTagName(\"html\")[0]?.classList.add(\"rrweb-paused\");\n this.emitter.emit(ReplayerEvents.Pause);\n }\n resume(timeOffset = 0) {\n this.warn(\n `The 'resume' was deprecated in 1.0. Please use 'play' method which has the same interface.`\n );\n this.play(timeOffset);\n this.emitter.emit(ReplayerEvents.Resume);\n }\n /**\n * Totally destroy this replayer and please be careful that this operation is irreversible.\n * Memory occupation can be released by removing all references to this replayer.\n */\n destroy() {\n this.pause();\n this.config.root.removeChild(this.wrapper);\n this.emitter.emit(ReplayerEvents.Destroy);\n }\n startLive(baselineTime) {\n this.service.send({ type: \"TO_LIVE\", payload: { baselineTime } });\n }\n addEvent(rawEvent) {\n const event = this.config.unpackFn ? this.config.unpackFn(rawEvent) : rawEvent;\n void Promise.resolve().then(\n () => this.service.send({ type: \"ADD_EVENT\", payload: { event } })\n );\n }\n enableInteract() {\n this.iframe.setAttribute(\"scrolling\", \"auto\");\n this.iframe.style.pointerEvents = \"auto\";\n }\n disableInteract() {\n this.iframe.setAttribute(\"scrolling\", \"no\");\n this.iframe.style.pointerEvents = \"none\";\n }\n /**\n * Empties the replayer's cache and reclaims memory.\n * The replayer will use this cache to speed up the playback.\n */\n resetCache() {\n this.cache = createCache();\n }\n reevaluateFastForward() {\n if (!this.config.skipInactive) {\n return;\n }\n this.nextUserInteractionEvent = null;\n const events = this.service.state.context.events;\n const firstEvent = events[0];\n if (!firstEvent) {\n return;\n }\n const currentEventTime = firstEvent.timestamp + this.getCurrentTime();\n const currentEventIndex = getEventIndex(events, currentEventTime);\n if (currentEventIndex === -1) {\n return;\n }\n const currentEvent = events[currentEventIndex];\n const threshold = this.config.inactivePeriodThreshold * this.speedService.state.context.timer.speed;\n for (let i2 = currentEventIndex + 1; i2 < events.length; i2++) {\n const event = events[i2];\n if (this.isUserInteraction(event)) {\n const gapTime = event.timestamp - currentEvent.timestamp;\n if (gapTime > threshold) {\n this.nextUserInteractionEvent = event;\n const payload = {\n speed: Math.min(\n Math.round(gapTime / SKIP_TIME_INTERVAL),\n this.config.maxSpeed\n )\n };\n this.speedService.send({ type: \"FAST_FORWARD\", payload });\n this.emitter.emit(ReplayerEvents.SkipStart, payload);\n }\n break;\n }\n }\n }\n setupDom() {\n this.wrapper = document.createElement(\"div\");\n this.wrapper.classList.add(\"replayer-wrapper\");\n this.config.root.appendChild(this.wrapper);\n this.iframe = document.createElement(\"iframe\");\n const attributes2 = [\"allow-same-origin\"];\n if (this.config.UNSAFE_replayCanvas) {\n attributes2.push(\"allow-scripts\");\n }\n this.iframe.style.display = \"none\";\n this.iframe.setAttribute(\"sandbox\", attributes2.join(\" \"));\n this.disableInteract();\n this.wrapper.appendChild(this.iframe);\n const iframeDoc = getIFrameContentDocument(this.iframe);\n const iframeWindow = getIFrameContentWindow(this.iframe);\n if (iframeWindow && iframeDoc) {\n polyfill(iframeWindow, iframeDoc);\n polyfill$1(iframeWindow);\n }\n }\n rebuildFullSnapshot(event, isSync = false) {\n const iframeDoc = getIFrameContentDocument(this.iframe);\n if (!iframeDoc) {\n return this.warn(\"Looks like your replayer has been destroyed.\");\n }\n if (Object.keys(this.legacy_missingNodeRetryMap).length) {\n this.warn(\n \"Found unresolved missing node map\",\n this.legacy_missingNodeRetryMap\n );\n }\n this.legacy_missingNodeRetryMap = {};\n const collected = [];\n const afterAppend = (builtNode, id) => {\n this.collectIframeAndAttachDocument(collected, builtNode);\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild)\n plugin.onBuild(builtNode, {\n id,\n replayer: this\n });\n }\n };\n if (this.usingVirtualDom) {\n this.virtualDom.destroyTree();\n this.usingVirtualDom = false;\n }\n this.mirror.reset();\n rebuild(event.data.node, {\n doc: iframeDoc,\n afterAppend,\n cache: this.cache,\n mirror: this.mirror\n });\n afterAppend(iframeDoc, event.data.node.id);\n for (const { mutationInQueue, builtNode } of collected) {\n this.attachDocumentToIframe(mutationInQueue, builtNode);\n this.newDocumentQueue = this.newDocumentQueue.filter(\n (m) => m !== mutationInQueue\n );\n }\n const { documentElement, head } = iframeDoc;\n this.insertStyleRules(documentElement, head);\n if (!this.service.state.matches(\"playing\")) {\n const iframeHtmlElement = iframeDoc.getElementsByTagName(\"html\")[0];\n iframeHtmlElement && iframeHtmlElement.classList.add(\"rrweb-paused\");\n }\n this.emitter.emit(ReplayerEvents.FullsnapshotRebuilded, event);\n if (!isSync) {\n this.waitForStylesheetLoad();\n }\n if (this.config.UNSAFE_replayCanvas) {\n void this.preloadAllImages();\n }\n }\n insertStyleRules(documentElement, head) {\n const injectStylesRules = rules(\n this.config.blockClass\n ).concat(this.config.insertStyleRules);\n if (this.config.pauseAnimation) {\n injectStylesRules.push(\n \"html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }\"\n );\n }\n if (this.usingVirtualDom) {\n const styleEl = this.virtualDom.createElement(\"style\");\n this.virtualDom.mirror.add(\n styleEl,\n getDefaultSN(styleEl, this.virtualDom.unserializedId)\n );\n documentElement.insertBefore(styleEl, head);\n styleEl.rules.push({\n source: IncrementalSource.StyleSheetRule,\n adds: injectStylesRules.map((cssText, index) => ({\n rule: cssText,\n index\n }))\n });\n } else {\n const styleEl = document.createElement(\"style\");\n documentElement.insertBefore(\n styleEl,\n head\n );\n for (let idx = 0; idx < injectStylesRules.length; idx++) {\n styleEl.sheet?.insertRule(injectStylesRules[idx], idx);\n }\n }\n }\n attachDocumentToIframe(mutation, iframeEl) {\n const mirror2 = this.usingVirtualDom ? this.virtualDom.mirror : this.mirror;\n const iframeContentDoc = getIFrameContentDocument(\n iframeEl\n );\n const collected = [];\n const afterAppend = (builtNode, id) => {\n this.collectIframeAndAttachDocument(collected, builtNode);\n const sn = mirror2.getMeta(builtNode);\n if (sn?.type === NodeType$2.Element && sn?.tagName.toUpperCase() === \"HTML\" && iframeContentDoc) {\n const { documentElement, head } = iframeContentDoc;\n this.insertStyleRules(\n documentElement,\n head\n );\n }\n if (this.usingVirtualDom) return;\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild)\n plugin.onBuild(builtNode, {\n id,\n replayer: this\n });\n }\n };\n buildNodeWithSN(mutation.node, {\n doc: iframeContentDoc,\n mirror: mirror2,\n hackCss: true,\n skipChild: false,\n afterAppend,\n cache: this.cache\n });\n afterAppend(iframeContentDoc, mutation.node.id);\n for (const { mutationInQueue, builtNode } of collected) {\n this.attachDocumentToIframe(mutationInQueue, builtNode);\n this.newDocumentQueue = this.newDocumentQueue.filter(\n (m) => m !== mutationInQueue\n );\n }\n }\n collectIframeAndAttachDocument(collected, builtNode) {\n if (isSerializedIframe(builtNode, this.mirror)) {\n const mutationInQueue = this.newDocumentQueue.find(\n (m) => m.parentId === this.mirror.getId(builtNode)\n );\n if (mutationInQueue) {\n collected.push({\n mutationInQueue,\n builtNode\n });\n }\n }\n }\n /**\n * pause when loading style sheet, resume when loaded all timeout exceed\n */\n waitForStylesheetLoad() {\n const iframeDoc = getIFrameContentDocument(this.iframe);\n const head = iframeDoc?.head;\n if (head) {\n const unloadSheets = /* @__PURE__ */ new Set();\n let timer;\n let beforeLoadState = this.service.state;\n const stateHandler = () => {\n beforeLoadState = this.service.state;\n };\n this.emitter.on(ReplayerEvents.Start, stateHandler);\n this.emitter.on(ReplayerEvents.Pause, stateHandler);\n const unsubscribe = () => {\n this.emitter.off(ReplayerEvents.Start, stateHandler);\n this.emitter.off(ReplayerEvents.Pause, stateHandler);\n };\n head.querySelectorAll('link[rel=\"stylesheet\"]').forEach((css) => {\n if (!css.sheet) {\n unloadSheets.add(css);\n css.addEventListener(\"load\", () => {\n unloadSheets.delete(css);\n if (unloadSheets.size === 0 && timer !== -1) {\n if (beforeLoadState.matches(\"playing\")) {\n this.play(this.getCurrentTime());\n }\n this.emitter.emit(ReplayerEvents.LoadStylesheetEnd);\n if (timer) {\n clearTimeout(timer);\n }\n unsubscribe();\n }\n });\n }\n });\n if (unloadSheets.size > 0) {\n this.service.send({ type: \"PAUSE\" });\n this.emitter.emit(ReplayerEvents.LoadStylesheetStart);\n timer = setTimeout$1(() => {\n if (beforeLoadState.matches(\"playing\")) {\n this.play(this.getCurrentTime());\n }\n timer = -1;\n unsubscribe();\n }, this.config.loadTimeout);\n }\n }\n }\n /**\n * pause when there are some canvas drawImage args need to be loaded\n */\n async preloadAllImages() {\n const promises = [];\n for (const event of this.service.state.context.events) {\n if (event.type === EventType.IncrementalSnapshot && event.data.source === IncrementalSource.CanvasMutation) {\n promises.push(\n this.deserializeAndPreloadCanvasEvents(event.data, event)\n );\n const commands = \"commands\" in event.data ? event.data.commands : [event.data];\n commands.forEach((c2) => {\n this.preloadImages(c2, event);\n });\n }\n }\n return Promise.all(promises);\n }\n preloadImages(data, event) {\n if (data.property === \"drawImage\" && typeof data.args[0] === \"string\" && !this.imageMap.has(event)) {\n const canvas = document.createElement(\"canvas\");\n const ctx = canvas.getContext(\"2d\");\n const imgd = ctx?.createImageData(canvas.width, canvas.height);\n ctx?.putImageData(imgd, 0, 0);\n }\n }\n async deserializeAndPreloadCanvasEvents(data, event) {\n if (!this.canvasEventMap.has(event)) {\n const status = {\n isUnchanged: true\n };\n if (\"commands\" in data) {\n const commands = await Promise.all(\n data.commands.map(async (c2) => {\n const args = await Promise.all(\n c2.args.map(deserializeArg(this.imageMap, null, status))\n );\n return { ...c2, args };\n })\n );\n if (status.isUnchanged === false)\n this.canvasEventMap.set(event, { ...data, commands });\n } else {\n const args = await Promise.all(\n data.args.map(deserializeArg(this.imageMap, null, status))\n );\n if (status.isUnchanged === false)\n this.canvasEventMap.set(event, { ...data, args });\n }\n }\n }\n applyIncremental(e2, isSync) {\n const { data: d } = e2;\n switch (d.source) {\n case IncrementalSource.Mutation: {\n try {\n this.applyMutation(d, isSync);\n } catch (error) {\n this.warn(`Exception in mutation ${error.message || error}`, d);\n }\n break;\n }\n case IncrementalSource.Drag:\n case IncrementalSource.TouchMove:\n case IncrementalSource.MouseMove: {\n const pointerId = getPointerId(d);\n if (!this.pointers[pointerId]) {\n this.createPointer(pointerId, e2);\n }\n const pointer = this.pointers[pointerId];\n if (isSync) {\n const lastPosition = d.positions[d.positions.length - 1];\n pointer.pointerPosition = {\n x: lastPosition.x,\n y: lastPosition.y,\n id: lastPosition.id,\n debugData: d\n };\n } else {\n d.positions.forEach((p) => {\n const action = {\n doAction: () => {\n this.moveAndHover(p.x, p.y, p.id, isSync, d, pointerId);\n },\n delay: p.timeOffset + e2.timestamp - this.service.state.context.baselineTime\n };\n this.timer.addAction(action);\n });\n this.timer.addAction({\n doAction() {\n },\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n delay: e2.delay - d.positions[0]?.timeOffset\n });\n }\n break;\n }\n case IncrementalSource.MouseInteraction: {\n const pointerId = getPointerId(d);\n if (!this.pointers[pointerId]) {\n this.createPointer(pointerId, e2);\n }\n const pointer = this.pointers[pointerId];\n if (d.id === -1) {\n break;\n }\n const event = new Event(toLowerCase(MouseInteractions[d.type]));\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n this.emitter.emit(ReplayerEvents.MouseInteraction, {\n type: d.type,\n target\n });\n const { triggerFocus } = this.config;\n switch (d.type) {\n case MouseInteractions.Blur:\n if (\"blur\" in target) {\n target.blur();\n }\n break;\n case MouseInteractions.Focus:\n if (triggerFocus && target.focus) {\n target.focus({\n preventScroll: true\n });\n }\n break;\n case MouseInteractions.Click:\n case MouseInteractions.TouchStart:\n case MouseInteractions.TouchEnd:\n case MouseInteractions.MouseDown:\n case MouseInteractions.MouseUp:\n if (isSync) {\n if (d.type === MouseInteractions.TouchStart) {\n pointer.touchActive = true;\n Object.values(this.pointers).forEach((p) => {\n if (p !== pointer && !p.touchActive) {\n p.touchActive = false;\n }\n });\n } else if (d.type === MouseInteractions.TouchEnd) {\n pointer.touchActive = false;\n pointer.pointerEl.remove();\n if (pointer.mouseTail) {\n pointer.mouseTail.remove();\n }\n delete this.pointers[pointerId];\n }\n if (d.type === MouseInteractions.MouseDown) {\n this.lastMouseDownEvent = [target, event];\n } else if (d.type === MouseInteractions.MouseUp) {\n this.lastMouseDownEvent = null;\n }\n pointer.pointerPosition = {\n x: d.x || 0,\n y: d.y || 0,\n id: d.id,\n debugData: d\n };\n } else {\n if (d.type === MouseInteractions.TouchStart) {\n pointer.tailPositions.length = 0;\n }\n this.moveAndHover(d.x || 0, d.y || 0, d.id, isSync, d, pointerId);\n if (d.type === MouseInteractions.Click) {\n pointer.pointerEl.classList.remove(\"active\");\n void pointer.pointerEl.offsetWidth;\n pointer.pointerEl.classList.add(\"active\");\n } else if (d.type === MouseInteractions.TouchStart) {\n void pointer.pointerEl.offsetWidth;\n pointer.pointerEl.classList.add(\"touch-active\");\n } else if (d.type === MouseInteractions.TouchEnd) {\n pointer.pointerEl.remove();\n if (pointer.mouseTail) {\n pointer.mouseTail.remove();\n }\n delete this.pointers[pointerId];\n } else {\n target.dispatchEvent(event);\n }\n }\n break;\n case MouseInteractions.TouchCancel:\n if (isSync) {\n pointer.touchActive = false;\n } else {\n pointer.pointerEl.classList.remove(\"touch-active\");\n }\n break;\n default:\n target.dispatchEvent(event);\n }\n break;\n }\n case IncrementalSource.Scroll: {\n if (d.id === -1) {\n break;\n }\n if (this.usingVirtualDom) {\n const target = this.virtualDom.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n target.scrollData = d;\n break;\n }\n this.applyScroll(d, isSync);\n break;\n }\n case IncrementalSource.ViewportResize:\n this.emitter.emit(ReplayerEvents.Resize, {\n width: d.width,\n height: d.height\n });\n break;\n case IncrementalSource.Input: {\n if (d.id === -1) {\n break;\n }\n if (this.usingVirtualDom) {\n const target = this.virtualDom.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n target.inputData = d;\n break;\n }\n this.applyInput(d);\n break;\n }\n case IncrementalSource.MediaInteraction: {\n const target = this.usingVirtualDom ? this.virtualDom.mirror.getNode(d.id) : this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n const mediaEl = target;\n try {\n if (d.currentTime !== void 0) {\n mediaEl.currentTime = d.currentTime;\n }\n if (d.volume !== void 0) {\n mediaEl.volume = d.volume;\n }\n if (d.muted !== void 0) {\n mediaEl.muted = d.muted;\n }\n if (d.type === MediaInteractions.Pause) {\n mediaEl.pause();\n }\n if (d.type === MediaInteractions.Play) {\n const maybePlayPromise = mediaEl.play();\n if (typeof maybePlayPromise?.catch === \"function\") {\n maybePlayPromise.catch((err) => {\n console.warn(err);\n });\n }\n }\n if (d.type === MediaInteractions.RateChange) {\n mediaEl.playbackRate = d.playbackRate;\n }\n } catch (error) {\n this.warn(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/restrict-template-expressions\n `Failed to replay media interactions: ${error.message || error}`\n );\n }\n break;\n }\n case IncrementalSource.StyleSheetRule:\n case IncrementalSource.StyleDeclaration: {\n if (this.usingVirtualDom) {\n if (d.styleId) this.constructedStyleMutations.push(d);\n else if (d.id)\n this.virtualDom.mirror.getNode(d.id)?.rules?.push(d);\n } else this.applyStyleSheetMutation(d);\n break;\n }\n case IncrementalSource.CanvasMutation: {\n if (!this.config.UNSAFE_replayCanvas) {\n return;\n }\n if (this.usingVirtualDom) {\n const target = this.virtualDom.mirror.getNode(\n d.id\n );\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n target.canvasMutations.push({\n event: e2,\n mutation: d\n });\n } else {\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n void canvasMutation({\n event: e2,\n mutation: d,\n target,\n imageMap: this.imageMap,\n canvasEventMap: this.canvasEventMap,\n errorHandler: this.warnCanvasMutationFailed.bind(this)\n });\n }\n break;\n }\n case IncrementalSource.Font: {\n try {\n const fontFace = new FontFace(\n d.family,\n d.buffer ? new Uint8Array(JSON.parse(d.fontSource)) : d.fontSource,\n d.descriptors\n );\n getIFrameContentDocument(this.iframe)?.fonts.add(fontFace);\n } catch (error) {\n this.warn(error);\n }\n break;\n }\n case IncrementalSource.Selection: {\n if (isSync) {\n this.lastSelectionData = d;\n break;\n }\n this.applySelection(d);\n break;\n }\n case IncrementalSource.AdoptedStyleSheet: {\n if (this.usingVirtualDom) this.adoptedStyleSheets.push(d);\n else this.applyAdoptedStyleSheet(d);\n break;\n }\n }\n }\n applyMutation(d, isSync) {\n if (this.config.useVirtualDom && !this.usingVirtualDom && isSync) {\n this.usingVirtualDom = true;\n const iframeDoc = getIFrameContentDocument(this.iframe);\n if (iframeDoc) {\n buildFromDom(iframeDoc, this.mirror, this.virtualDom);\n }\n if (Object.keys(this.legacy_missingNodeRetryMap).length) {\n for (const key in this.legacy_missingNodeRetryMap) {\n try {\n const value = this.legacy_missingNodeRetryMap[key];\n const virtualNode = buildFromNode(\n value.node,\n this.virtualDom,\n this.mirror\n );\n if (virtualNode) value.node = virtualNode;\n } catch (error) {\n this.warn(error);\n }\n }\n }\n }\n const mirror2 = this.usingVirtualDom ? this.virtualDom.mirror : this.mirror;\n d.removes = d.removes.filter((mutation) => {\n if (!mirror2.getNode(mutation.id)) {\n this.warnNodeNotFound(d, mutation.id);\n return false;\n }\n return true;\n });\n d.removes.forEach((mutation) => {\n const target = mirror2.getNode(mutation.id);\n if (!target) {\n return;\n }\n let parent = mirror2.getNode(\n mutation.parentId\n );\n if (!parent) {\n return this.warnNodeNotFound(d, mutation.parentId);\n }\n if (mutation.isShadow && hasShadowRoot(parent)) {\n parent = parent.shadowRoot;\n }\n mirror2.removeNodeFromMap(target);\n if (parent)\n try {\n parent.removeChild(target);\n if (this.usingVirtualDom && target.nodeName === \"#text\" && parent.nodeName === \"STYLE\" && parent.rules?.length > 0)\n parent.rules = [];\n } catch (error) {\n if (error instanceof DOMException) {\n this.warn(\n \"parent could not remove child in mutation\",\n parent,\n target,\n d\n );\n } else {\n throw error;\n }\n }\n });\n const legacy_missingNodeMap = {\n ...this.legacy_missingNodeRetryMap\n };\n const queue = [];\n const nextNotInDOM = (mutation) => {\n let next = null;\n if (mutation.nextId) {\n next = mirror2.getNode(mutation.nextId);\n }\n if (mutation.nextId !== null && mutation.nextId !== void 0 && mutation.nextId !== -1 && !next) {\n return true;\n }\n return false;\n };\n const appendNode = (mutation) => {\n const iframeDoc = getIFrameContentDocument(this.iframe);\n if (!iframeDoc) {\n return this.warn(\"Looks like your replayer has been destroyed.\");\n }\n let parent = mirror2.getNode(\n mutation.parentId\n );\n if (!parent) {\n if (mutation.node.type === NodeType$2.Document) {\n return this.newDocumentQueue.push(mutation);\n }\n return queue.push(mutation);\n }\n if (mutation.node.isShadow) {\n if (!hasShadowRoot(parent)) {\n parent.attachShadow({ mode: \"open\" });\n parent = parent.shadowRoot;\n } else parent = parent.shadowRoot;\n }\n let previous = null;\n let next = null;\n if (mutation.previousId) {\n previous = mirror2.getNode(mutation.previousId);\n }\n if (mutation.nextId) {\n next = mirror2.getNode(mutation.nextId);\n }\n if (nextNotInDOM(mutation)) {\n return queue.push(mutation);\n }\n if (mutation.node.rootId && !mirror2.getNode(mutation.node.rootId)) {\n return;\n }\n const targetDoc = mutation.node.rootId ? mirror2.getNode(mutation.node.rootId) : this.usingVirtualDom ? this.virtualDom : iframeDoc;\n if (isSerializedIframe(parent, mirror2)) {\n this.attachDocumentToIframe(\n mutation,\n parent\n );\n return;\n }\n const afterAppend = (node, id) => {\n if (this.usingVirtualDom) return;\n for (const plugin of this.config.plugins || []) {\n if (plugin.onBuild) plugin.onBuild(node, { id, replayer: this });\n }\n };\n const target = buildNodeWithSN(mutation.node, {\n doc: targetDoc,\n // can be Document or RRDocument\n mirror: mirror2,\n // can be this.mirror or virtualDom.mirror\n skipChild: true,\n hackCss: true,\n cache: this.cache,\n /**\n * caveat: `afterAppend` only gets called on child nodes of target\n * we have to call it again below when this target was added to the DOM\n */\n afterAppend\n });\n if (mutation.previousId === -1 || mutation.nextId === -1) {\n legacy_missingNodeMap[mutation.node.id] = {\n node: target,\n mutation\n };\n return;\n }\n const parentSn = mirror2.getMeta(parent);\n if (parentSn && parentSn.type === NodeType$2.Element && parentSn.tagName === \"textarea\" && mutation.node.type === NodeType$2.Text) {\n const childNodeArray = Array.isArray(parent.childNodes) ? parent.childNodes : Array.from(parent.childNodes);\n for (const c2 of childNodeArray) {\n if (c2.nodeType === parent.TEXT_NODE) {\n parent.removeChild(c2);\n }\n }\n } else if (parentSn?.type === NodeType$2.Document) {\n const parentDoc = parent;\n if (mutation.node.type === NodeType$2.DocumentType && parentDoc.childNodes[0]?.nodeType === Node.DOCUMENT_TYPE_NODE)\n parentDoc.removeChild(parentDoc.childNodes[0]);\n if (target.nodeName === \"HTML\" && parentDoc.documentElement)\n parentDoc.removeChild(\n parentDoc.documentElement\n );\n }\n if (previous && previous.nextSibling && previous.nextSibling.parentNode) {\n parent.insertBefore(\n target,\n previous.nextSibling\n );\n } else if (next && next.parentNode) {\n parent.contains(next) ? parent.insertBefore(target, next) : parent.insertBefore(target, null);\n } else {\n parent.appendChild(target);\n }\n afterAppend(target, mutation.node.id);\n if (this.usingVirtualDom && target.nodeName === \"#text\" && parent.nodeName === \"STYLE\" && parent.rules?.length > 0)\n parent.rules = [];\n if (isSerializedIframe(target, this.mirror)) {\n const targetId = this.mirror.getId(target);\n const mutationInQueue = this.newDocumentQueue.find(\n (m) => m.parentId === targetId\n );\n if (mutationInQueue) {\n this.attachDocumentToIframe(\n mutationInQueue,\n target\n );\n this.newDocumentQueue = this.newDocumentQueue.filter(\n (m) => m !== mutationInQueue\n );\n }\n }\n if (mutation.previousId || mutation.nextId) {\n this.legacy_resolveMissingNode(\n legacy_missingNodeMap,\n parent,\n target,\n mutation\n );\n }\n };\n d.adds.forEach((mutation) => {\n appendNode(mutation);\n });\n const startTime = Date.now();\n while (queue.length) {\n const resolveTrees = queueToResolveTrees(queue);\n queue.length = 0;\n if (Date.now() - startTime > 500) {\n this.warn(\n \"Timeout in the loop, please check the resolve tree data:\",\n resolveTrees\n );\n break;\n }\n for (const tree of resolveTrees) {\n const parent = mirror2.getNode(tree.value.parentId);\n if (!parent) {\n this.debug(\n \"Drop resolve tree since there is no parent for the root node.\",\n tree\n );\n } else {\n iterateResolveTree(tree, (mutation) => {\n appendNode(mutation);\n });\n }\n }\n }\n if (Object.keys(legacy_missingNodeMap).length) {\n Object.assign(this.legacy_missingNodeRetryMap, legacy_missingNodeMap);\n }\n uniqueTextMutations(d.texts).forEach((mutation) => {\n const target = mirror2.getNode(mutation.id);\n if (!target) {\n if (d.removes.find((r2) => r2.id === mutation.id)) {\n return;\n }\n return this.warnNodeNotFound(d, mutation.id);\n }\n target.textContent = mutation.value;\n if (this.usingVirtualDom) {\n const parent = target.parentNode;\n if (parent?.rules?.length > 0) parent.rules = [];\n }\n });\n d.attributes.forEach((mutation) => {\n const target = mirror2.getNode(mutation.id);\n if (!target) {\n if (d.removes.find((r2) => r2.id === mutation.id)) {\n return;\n }\n return this.warnNodeNotFound(d, mutation.id);\n }\n for (const attributeName in mutation.attributes) {\n if (typeof attributeName === \"string\") {\n const value = mutation.attributes[attributeName];\n if (value === null) {\n target.removeAttribute(attributeName);\n } else if (typeof value === \"string\") {\n try {\n if (attributeName === \"_cssText\" && (target.nodeName === \"LINK\" || target.nodeName === \"STYLE\")) {\n try {\n const newSn = mirror2.getMeta(\n target\n );\n const newNode = buildNodeWithSN(\n {\n ...newSn,\n attributes: {\n ...newSn.attributes,\n ...mutation.attributes\n }\n },\n {\n doc: target.ownerDocument,\n // can be Document or RRDocument\n mirror: mirror2,\n skipChild: true,\n hackCss: true,\n cache: this.cache\n }\n );\n const siblingNode = target.nextSibling;\n const parentNode = target.parentNode;\n if (newNode && parentNode) {\n parentNode.removeChild(target);\n parentNode.insertBefore(\n newNode,\n siblingNode\n );\n mirror2.replace(mutation.id, newNode);\n break;\n }\n } catch (e2) {\n }\n }\n if (target.nodeType !== 3) {\n target.setAttribute(\n attributeName,\n value\n );\n }\n } catch (error) {\n this.warn(\n \"An error occurred may due to the checkout feature.\",\n error\n );\n }\n } else if (attributeName === \"style\") {\n const styleValues = value;\n const targetEl = target;\n for (const s2 in styleValues) {\n if (styleValues[s2] === false) {\n targetEl.style.removeProperty(s2);\n } else if (styleValues[s2] instanceof Array) {\n const svp = styleValues[s2];\n targetEl.style.setProperty(s2, svp[0], svp[1]);\n } else {\n const svs = styleValues[s2];\n targetEl.style.setProperty(s2, svs);\n }\n }\n }\n }\n }\n });\n }\n /**\n * Apply the scroll data on real elements.\n * If the replayer is in sync mode, smooth scroll behavior should be disabled.\n * @param d - the scroll data\n * @param isSync - whether the replayer is in sync mode(fast-forward)\n */\n applyScroll(d, isSync) {\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n const sn = this.mirror.getMeta(target);\n const iframeDoc = getIFrameContentDocument(this.iframe);\n if (target === iframeDoc) {\n this.iframe.contentWindow?.scrollTo({\n top: d.y,\n left: d.x,\n behavior: isSync ? \"auto\" : \"smooth\"\n });\n } else if (sn?.type === NodeType$2.Document) {\n target.defaultView?.scrollTo({\n top: d.y,\n left: d.x,\n behavior: isSync ? \"auto\" : \"smooth\"\n });\n } else {\n try {\n target.scrollTo({\n top: d.y,\n left: d.x,\n behavior: isSync ? \"auto\" : \"smooth\"\n });\n } catch (error) {\n }\n }\n }\n applyInput(d) {\n const target = this.mirror.getNode(d.id);\n if (!target) {\n return this.debugNodeNotFound(d, d.id);\n }\n try {\n target.checked = d.isChecked;\n target.value = d.text;\n } catch (error) {\n }\n }\n applySelection(d) {\n try {\n const selectionSet = /* @__PURE__ */ new Set();\n const ranges = d.ranges.map(({ start, startOffset, end, endOffset }) => {\n const startContainer = this.mirror.getNode(start);\n const endContainer = this.mirror.getNode(end);\n if (!startContainer || !endContainer) return;\n const result = new Range();\n result.setStart(startContainer, startOffset);\n result.setEnd(endContainer, endOffset);\n const doc = startContainer.ownerDocument;\n const selection = doc?.getSelection();\n selection && selectionSet.add(selection);\n return {\n range: result,\n selection\n };\n });\n selectionSet.forEach((s2) => s2.removeAllRanges());\n ranges.forEach((r2) => r2 && r2.selection?.addRange(r2.range));\n } catch (error) {\n }\n }\n applyStyleSheetMutation(data) {\n let styleSheet = null;\n if (data.styleId) styleSheet = this.styleMirror.getStyle(data.styleId);\n else if (data.id)\n styleSheet = this.mirror.getNode(data.id)?.sheet || null;\n if (!styleSheet) return;\n if (data.source === IncrementalSource.StyleSheetRule)\n this.applyStyleSheetRule(data, styleSheet);\n else if (data.source === IncrementalSource.StyleDeclaration)\n this.applyStyleDeclaration(data, styleSheet);\n }\n applyStyleSheetRule(data, styleSheet) {\n data.adds?.forEach(({ rule, index: nestedIndex }) => {\n try {\n if (Array.isArray(nestedIndex)) {\n const { positions, index } = getPositionsAndIndex(nestedIndex);\n const nestedRule = getNestedRule(styleSheet.cssRules, positions);\n nestedRule.insertRule(rule, index);\n } else {\n const index = nestedIndex === void 0 ? void 0 : Math.min(nestedIndex, styleSheet.cssRules.length);\n styleSheet?.insertRule(rule, index);\n }\n } catch (e2) {\n }\n });\n data.removes?.forEach(({ index: nestedIndex }) => {\n try {\n if (Array.isArray(nestedIndex)) {\n const { positions, index } = getPositionsAndIndex(nestedIndex);\n const nestedRule = getNestedRule(styleSheet.cssRules, positions);\n nestedRule.deleteRule(index || 0);\n } else {\n styleSheet?.deleteRule(nestedIndex);\n }\n } catch (e2) {\n }\n });\n if (data.replace)\n try {\n void styleSheet.replace?.(data.replace);\n } catch (e2) {\n }\n if (data.replaceSync)\n try {\n styleSheet.replaceSync?.(data.replaceSync);\n } catch (e2) {\n }\n }\n applyStyleDeclaration(data, styleSheet) {\n if (data.set) {\n const rule = getNestedRule(\n styleSheet.rules,\n data.index\n );\n rule && rule.style && rule.style.setProperty(\n data.set.property,\n data.set.value,\n data.set.priority\n );\n }\n if (data.remove) {\n const rule = getNestedRule(\n styleSheet.rules,\n data.index\n );\n rule && rule.style && rule.style.removeProperty(data.remove.property);\n }\n }\n applyAdoptedStyleSheet(data) {\n const targetHost = this.mirror.getNode(data.id);\n if (!targetHost) return;\n data.styles?.forEach((style) => {\n let newStyleSheet = null;\n let hostWindow = null;\n if (hasShadowRoot(targetHost))\n hostWindow = targetHost.ownerDocument?.defaultView || null;\n else if (targetHost.nodeName === \"#document\")\n hostWindow = targetHost.defaultView;\n if (!hostWindow) return;\n try {\n newStyleSheet = new hostWindow.CSSStyleSheet();\n this.styleMirror.add(newStyleSheet, style.styleId);\n this.applyStyleSheetRule(\n {\n source: IncrementalSource.StyleSheetRule,\n adds: style.rules\n },\n newStyleSheet\n );\n } catch (e2) {\n }\n });\n const MAX_RETRY_TIME = 10;\n let count = 0;\n const adoptStyleSheets = (targetHost2, styleIds) => {\n const stylesToAdopt = styleIds.map((styleId) => this.styleMirror.getStyle(styleId)).filter((style) => style !== null);\n if (hasShadowRoot(targetHost2))\n targetHost2.shadowRoot.adoptedStyleSheets = stylesToAdopt;\n else if (targetHost2.nodeName === \"#document\")\n targetHost2.adoptedStyleSheets = stylesToAdopt;\n if (stylesToAdopt.length !== styleIds.length && count < MAX_RETRY_TIME) {\n setTimeout$1(\n () => adoptStyleSheets(targetHost2, styleIds),\n 0 + 100 * count\n );\n count++;\n }\n };\n adoptStyleSheets(targetHost, data.styleIds);\n }\n legacy_resolveMissingNode(map, parent, target, targetMutation) {\n const { previousId, nextId } = targetMutation;\n const previousInMap = previousId && map[previousId];\n const nextInMap = nextId && map[nextId];\n if (previousInMap) {\n const { node, mutation } = previousInMap;\n parent.insertBefore(node, target);\n delete map[mutation.node.id];\n delete this.legacy_missingNodeRetryMap[mutation.node.id];\n if (mutation.previousId || mutation.nextId) {\n this.legacy_resolveMissingNode(map, parent, node, mutation);\n }\n }\n if (nextInMap) {\n const { node, mutation } = nextInMap;\n parent.insertBefore(\n node,\n target.nextSibling\n );\n delete map[mutation.node.id];\n delete this.legacy_missingNodeRetryMap[mutation.node.id];\n if (mutation.previousId || mutation.nextId) {\n this.legacy_resolveMissingNode(map, parent, node, mutation);\n }\n }\n }\n moveAndHover(x, y, id, isSync, debugData, pointerId) {\n const target = this.mirror.getNode(id);\n if (!target) {\n return this.debugNodeNotFound(debugData, id);\n }\n const base = getBaseDimension(target, this.iframe);\n const _x = x * base.absoluteScale + base.x;\n const _y = y * base.absoluteScale + base.y;\n const pointer = this.pointers[pointerId];\n if (pointer && pointer.pointerEl) {\n pointer.pointerEl.style.left = `${_x}px`;\n pointer.pointerEl.style.top = `${_y}px`;\n }\n if (!isSync) {\n this.drawMouseTail({ x: _x, y: _y }, pointerId);\n }\n this.hoverElements(target);\n }\n drawMouseTail(position, pointerId) {\n const pointer = this.pointers[pointerId];\n if (!pointer || !pointer.mouseTail) {\n return;\n }\n const { lineCap, lineWidth, strokeStyle, duration } = this.config.mouseTail === true ? defaultMouseTailConfig : Object.assign({}, defaultMouseTailConfig, this.config.mouseTail);\n const draw = () => {\n if (!pointer || !pointer.mouseTail) {\n return;\n }\n const mouseTail = pointer.mouseTail;\n const ctx = mouseTail.getContext(\"2d\");\n if (!ctx || !pointer.tailPositions.length) {\n return;\n }\n ctx.clearRect(0, 0, mouseTail.width, mouseTail.height);\n ctx.beginPath();\n ctx.lineWidth = lineWidth;\n ctx.lineCap = lineCap;\n ctx.strokeStyle = strokeStyle;\n ctx.moveTo(pointer.tailPositions[0].x, pointer.tailPositions[0].y);\n pointer.tailPositions.forEach((p) => ctx.lineTo(p.x, p.y));\n ctx.stroke();\n };\n pointer.tailPositions.push(position);\n draw();\n setTimeout$1(() => {\n if (pointerId in this.pointers) {\n pointer.tailPositions = pointer.tailPositions.filter(\n (p) => p !== position\n );\n draw();\n }\n }, duration / this.speedService.state.context.timer.speed);\n }\n hoverElements(el) {\n const iframeDoc = getIFrameContentDocument(this.iframe);\n const rootElement = this.lastHoveredRootNode || iframeDoc;\n if (rootElement && typeof rootElement.querySelectorAll === \"function\") {\n rootElement.querySelectorAll(\".\\\\:hover\").forEach((hoveredEl) => {\n hoveredEl.classList.remove(\":hover\");\n });\n }\n this.lastHoveredRootNode = el.getRootNode();\n let currentEl = el;\n while (currentEl) {\n if (currentEl.classList) {\n currentEl.classList.add(\":hover\");\n }\n currentEl = currentEl.parentElement;\n }\n }\n isUserInteraction(event) {\n if (event.type !== EventType.IncrementalSnapshot) {\n return false;\n }\n return event.data.source > IncrementalSource.Mutation && event.data.source <= IncrementalSource.Input;\n }\n backToNormal() {\n this.nextUserInteractionEvent = null;\n if (this.speedService.state.matches(\"normal\")) {\n return;\n }\n this.speedService.send({ type: \"BACK_TO_NORMAL\" });\n this.emitter.emit(ReplayerEvents.SkipEnd, {\n speed: this.speedService.state.context.normalSpeed\n });\n }\n warnNodeNotFound(d, id) {\n this.warn(`Node with id '${id}' not found. `, d);\n }\n warnCanvasMutationFailed(d, error) {\n this.warn(`Has error on canvas update`, error, \"canvas mutation:\", d);\n }\n debugNodeNotFound(d, id) {\n this.debug(`Node with id '${id}' not found. `, d);\n }\n warn(...args) {\n if (!this.config.showWarning) {\n return;\n }\n this.config.logger.warn(REPLAY_CONSOLE_PREFIX, ...args);\n }\n debug(...args) {\n if (!this.config.showDebug) {\n return;\n }\n this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);\n }\n}\nexport {\n CanvasManager,\n EventType,\n IncrementalSource,\n MouseInteractions,\n Replayer,\n ReplayerEvents,\n addCustomEvent,\n canvasMutation,\n deserializeArg,\n freezePage,\n record,\n takeFullSnapshot,\n utils\n};\n//# sourceMappingURL=rrweb.js.map\n","import type { Integration, IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { CanvasManagerInterface, CanvasManagerOptions } from '@sentry-internal/replay';\nimport { CanvasManager } from '@sentry-internal/rrweb';\n\ninterface SnapshotOptions {\n skipRequestAnimationFrame?: boolean;\n}\n\ninterface ReplayCanvasIntegration extends Integration {\n snapshot: (canvasElement?: HTMLCanvasElement, options?: SnapshotOptions) => Promise<void>;\n}\n\ninterface ReplayCanvasOptions {\n enableManualSnapshot?: boolean;\n maxCanvasSize?: [width: number, height: number];\n quality: 'low' | 'medium' | 'high';\n}\n\ntype GetCanvasManager = (options: CanvasManagerOptions) => CanvasManagerInterface;\nexport interface ReplayCanvasIntegrationOptions {\n enableManualSnapshot?: boolean;\n maxCanvasSize?: number;\n recordCanvas: true;\n getCanvasManager: GetCanvasManager;\n sampling: {\n canvas: number;\n };\n dataURLOptions: {\n type: string;\n quality: number;\n };\n}\n\nconst CANVAS_QUALITY = {\n low: {\n sampling: {\n canvas: 1,\n },\n dataURLOptions: {\n type: 'image/webp',\n quality: 0.25,\n },\n },\n medium: {\n sampling: {\n canvas: 2,\n },\n dataURLOptions: {\n type: 'image/webp',\n quality: 0.4,\n },\n },\n high: {\n sampling: {\n canvas: 4,\n },\n dataURLOptions: {\n type: 'image/webp',\n quality: 0.5,\n },\n },\n};\n\nconst INTEGRATION_NAME = 'ReplayCanvas';\nconst DEFAULT_MAX_CANVAS_SIZE = 1280;\n\n/** Exported only for type safe tests. */\nexport const _replayCanvasIntegration = ((options: Partial<ReplayCanvasOptions> = {}) => {\n const [maxCanvasWidth, maxCanvasHeight] = options.maxCanvasSize || [];\n const _canvasOptions = {\n quality: options.quality || 'medium',\n enableManualSnapshot: options.enableManualSnapshot,\n maxCanvasSize: [\n maxCanvasWidth ? Math.min(maxCanvasWidth, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE,\n maxCanvasHeight ? Math.min(maxCanvasHeight, DEFAULT_MAX_CANVAS_SIZE) : DEFAULT_MAX_CANVAS_SIZE,\n ] as [number, number],\n };\n\n let currentCanvasManager: CanvasManager | undefined;\n let canvasManagerResolve: (value: CanvasManager) => void;\n const _canvasManager: Promise<CanvasManager> = new Promise(resolve => (canvasManagerResolve = resolve));\n\n return {\n name: INTEGRATION_NAME,\n getOptions(): ReplayCanvasIntegrationOptions {\n const { quality, enableManualSnapshot, maxCanvasSize } = _canvasOptions;\n\n return {\n enableManualSnapshot,\n recordCanvas: true,\n getCanvasManager: (getCanvasManagerOptions: CanvasManagerOptions) => {\n const manager = new CanvasManager({\n ...getCanvasManagerOptions,\n enableManualSnapshot,\n maxCanvasSize,\n errorHandler: (err: unknown) => {\n try {\n if (typeof err === 'object') {\n (err as Error & { __rrweb__?: boolean }).__rrweb__ = true;\n }\n } catch {\n // ignore errors here\n // this can happen if the error is frozen or does not allow mutation for other reasons\n }\n },\n });\n\n currentCanvasManager = manager;\n\n // Resolve promise on first call for backward compatibility\n canvasManagerResolve(manager);\n\n return manager;\n },\n ...(CANVAS_QUALITY[quality || 'medium'] || CANVAS_QUALITY.medium),\n };\n },\n async snapshot(canvasElement?: HTMLCanvasElement, options?: SnapshotOptions) {\n const canvasManager = currentCanvasManager || (await _canvasManager);\n\n canvasManager.snapshot(canvasElement, options);\n },\n };\n}) satisfies IntegrationFn<ReplayCanvasIntegration>;\n\n/**\n * Add this in addition to `replayIntegration()` to enable canvas recording.\n */\nexport const replayCanvasIntegration = defineIntegration(\n _replayCanvasIntegration,\n) as IntegrationFn<ReplayCanvasIntegration>;\n"],"names":[],"mappings":";;AAAA,IAAI,WAAA,GAAc,MAAM,CAAC,cAAc;AACvC,IAAI,oBAAoB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAA,IAAO,MAAM,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAA,EAAO,IAAI,GAAG,CAAC,GAAG,CAAA,GAAI,KAAK;AACnK,IAAI,eAAA,GAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAA,KAAQ,QAAA,GAAW,GAAA,GAAM,EAAA,GAAK,GAAG,EAAE,KAAK,CAAC;AAsGnG,MAAA,MAAA,CAAA;AACA,EAAA,WAAA,GAAA;AACA,IAAA,eAAA,CAAA,IAAA,EAAA,WAAA,kBAAA,IAAA,GAAA,EAAA,CAAA;AACA,IAAA,eAAA,CAAA,IAAA,EAAA,aAAA,kBAAA,IAAA,OAAA,EAAA,CAAA;AACA,EAAA;AACA,EAAA,KAAA,CAAA,EAAA,EAAA;AACA,IAAA,IAAA,CAAA,EAAA,EAAA,OAAA,EAAA;AACA,IAAA,MAAA,EAAA,GAAA,IAAA,CAAA,OAAA,CAAA,EAAA,CAAA,EAAA,EAAA;AACA,IAAA,OAAA,EAAA,IAAA,EAAA;AACA,EAAA;AACA,EAAA,OAAA,CAAA,EAAA,EAAA;AACA,IAAA,OAAA,IAAA,CAAA,SAAA,CAAA,GAAA,CAAA,EAAA,CAAA,IAAA,IAAA;AACA,EAAA;AACA,EAAA,MAAA,GAAA;AACA,IAAA,OA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